3/30 单据退货 和 统计页面

dev_2.5_inv
wangwei 5 days ago
parent 477b0c86a3
commit 2660556a2c

@ -15,6 +15,7 @@ import com.glxp.api.entity.auth.SysWorkplace;
import com.glxp.api.entity.collect.IoCollectOrder;
import com.glxp.api.entity.collect.IoCollectOrderOrigin;
import com.glxp.api.entity.thrsys.ThrBusTypeOriginEntity;
import com.glxp.api.exception.JsonException;
import com.glxp.api.http.ErpBasicClient;
import com.glxp.api.req.basic.BasicCollectUserRequest;
import com.glxp.api.req.basic.GetSickPrescribeRequest;
@ -228,9 +229,11 @@ public class IoCollectOriginController extends BaseController {
}
//通过工位列表 获取出 业务列表
workBindBusTypeRequest.setWorkPlaceCodes(workPlaceCodes);
workBindBusTypeRequest.setDocumentTypeCodes(collectOrderRequest.getDocumentTypeCodes());
sysWorkplaceDocumentResponses = sysWorkplaceDocumentService.filterListByWorkplace(workBindBusTypeRequest);
} else {
workBindBusTypeRequest.setWorkplaceCode(collectOrderRequest.getWorkPlaceCode());
workBindBusTypeRequest.setDocumentTypeCodes(collectOrderRequest.getDocumentTypeCodes());
sysWorkplaceDocumentResponses = sysWorkplaceDocumentService.filterListByWorkplace(workBindBusTypeRequest);
collectOrderRequest.setWorkPlaceCode(null);
}
@ -269,4 +272,60 @@ public class IoCollectOriginController extends BaseController {
pageSimpleResponse.setList(list);
return ResultVOUtils.success(pageSimpleResponse);
}
@GetMapping("/udiwms/basic/collect/origin/orderUpload")
public BaseResponse getOrderUpload(CollectOrderRequest collectOrderRequest) {
List<IoCollectOrderResponse> orderResponses = new ArrayList<>();
if (collectOrderRequest.getWorkPlaceCode() == null) {
Long userId = getUserId();
BasicCollectUserRequest request = new BasicCollectUserRequest();
request.setPage(1);
request.setLimit(100);
request.setUserId(userId.toString());
List<UserWorkResponse> page = basicCollectUserService.filterList(request);
List<Long> workPlaceCodes = page != null ?
page.stream().map(UserWorkResponse::getWorkplaceId).collect(Collectors.toList()) : null;
WorkBindBusTypeRequest workBindBusTypeRequest = new WorkBindBusTypeRequest();
workBindBusTypeRequest.setWorkPlaceCodes(workPlaceCodes);
List<SysWorkplaceDocumentResponse> sysWorkplaceDocumentResponses = sysWorkplaceDocumentService.filterListByWorkplace(workBindBusTypeRequest);
if (CollUtil.isNotEmpty(sysWorkplaceDocumentResponses)) {
Set<String> uniqueDocumentTypeCodes = sysWorkplaceDocumentResponses.stream()
.map(SysWorkplaceDocumentResponse::getDocumentTypeCode)
.collect(Collectors.toCollection(LinkedHashSet::new));
collectOrderRequest.setDocumentTypeCodes(new ArrayList<>(uniqueDocumentTypeCodes));
}
} else {
WorkBindBusTypeRequest workBindBusTypeRequest = new WorkBindBusTypeRequest();
workBindBusTypeRequest.setWorkplaceCode(collectOrderRequest.getWorkPlaceCode());
List<SysWorkplaceDocumentResponse> sysWorkplaceDocumentResponses = sysWorkplaceDocumentService.filterListByWorkplace(workBindBusTypeRequest);
if (CollUtil.isNotEmpty(sysWorkplaceDocumentResponses)) {
Set<String> uniqueDocumentTypeCodes = sysWorkplaceDocumentResponses.stream()
.map(SysWorkplaceDocumentResponse::getDocumentTypeCode)
.collect(Collectors.toCollection(LinkedHashSet::new));
collectOrderRequest.setDocumentTypeCodes(new ArrayList<>(uniqueDocumentTypeCodes));
}
collectOrderRequest.setWorkPlaceCode(null);
}
orderResponses = collectOrderOriginService.filterOrderUploadList(collectOrderRequest);
PageInfo<IoCollectOrderResponse> pageInfo = new PageInfo<>(orderResponses);
PageSimpleResponse<IoCollectOrderResponse> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageInfo.getTotal());
pageSimpleResponse.setList(orderResponses);
return ResultVOUtils.success(pageSimpleResponse);
}
@PostMapping("/udiwms/basic/collect/origin/order/returnSubmit")
public BaseResponse returnOrderSubmit(@RequestBody CollectOrderRequest collectOrderRequest) {
//假数据设置
return collectOriginService.submitreturnOrder(collectOrderRequest);
}
}

@ -12,4 +12,5 @@ import java.util.List;
public interface IoCollectOrderOriginMapper extends BaseMapper<IoCollectOrderOrigin> {
List<IoCollectOrderResponse> filterList(CollectOrderRequest collectOrderRequest);
}
}

@ -176,6 +176,11 @@ public class IoCollectCodeBackup implements Serializable {
@ApiModelProperty(value = "关联关系数量")
private Integer relCodeCount;
@TableField(value = "reCount")
@ApiModelProperty(value = "实际数量")
private Integer reCount;
@TableField(exist = false)
private String invDataType;
private static final long serialVersionUID = 1L;

@ -168,4 +168,15 @@ public class CollectOrderRequest extends ListPageRequest {
private String preInBillNo;
private Integer codingStatus;
private Integer orderUpStatus;
private String originOrder;
private Integer returnStatus;
}

@ -112,6 +112,8 @@ public class IoCollectCodeResponse {
private Integer scanActCount;
private Integer scanCodeCheckStatus;
private String prepnSpec;
private Integer isSplitCode;
private Integer reCount;
private IoCollectOrderResponse order;
private List<IoCollectOrderBizBackup> orderBizs;

@ -189,6 +189,17 @@ public class IoCollectOrderResponse {
*/
private Integer relCodeCount;
/**
*
*/
private Integer orderUpStatus;
/**
*
*/
private Integer codingStatus;
public String getFromName() {

@ -1,16 +1,20 @@
package com.glxp.api.service.collect;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.glxp.api.dao.collect.IoCollectCodeMapper;
import com.glxp.api.entity.collect.*;
import com.glxp.api.entity.inout.IoSplitCodeEntity;
import com.glxp.api.req.collect.CollectOrderBizRequest;
import com.glxp.api.req.collect.IoCollectCodeRequest;
import com.glxp.api.res.basic.UdiRelevanceResponse;
import com.glxp.api.res.collect.CollectOrderBizResponse;
import com.glxp.api.res.collect.IoCollectCodeResponse;
import com.glxp.api.service.basic.UdiRelevanceService;
import com.glxp.api.service.inout.IoSplitCodeService;
import com.glxp.api.service.inout.IoSplitFifoInvService;
import com.glxp.api.util.IntUtil;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
@ -102,6 +106,11 @@ public class IoCollectCodeService extends ServiceImpl<IoCollectCodeMapper, IoCol
@Resource
UdiRelevanceService udiRelevanceService;
@Resource
private IoSplitCodeService splitCodeService;
public void saveManuCode(List<IoCollectOrderCodeMan> manList, IoCollectOrder collectOrder) {
if (CollUtil.isEmpty(manList))
return;
@ -110,6 +119,13 @@ public class IoCollectCodeService extends ServiceImpl<IoCollectCodeMapper, IoCol
//查询采购类型
UdiRelevanceResponse udiRelevanceResponse = udiRelevanceService.selectByRelId(ioCollectOrderCodeMan.getRelId() + "");
//设置扫码次数 ioCollectOrderCodeMan scanActCount的实际数量 根据码查找拆零表
IoSplitCodeEntity one = splitCodeService.getOne(new LambdaQueryWrapper<IoSplitCodeEntity>().eq(IoSplitCodeEntity::getCode, ioCollectOrderCodeMan.getUdiCode()));
Integer reCount = 0;
if (one != null && one.getRemainCount() != null){
reCount = ioCollectOrderCodeMan.getScanActCount() - one.getRemainCount();
}
IoCollectCodeBackup collectCodeBackup = IoCollectCodeBackup.builder().code(ioCollectOrderCodeMan.getUdiCode())
.fromType(collectOrder.getFromType())
.busType(collectOrder.getBusType())
@ -122,7 +138,9 @@ public class IoCollectCodeService extends ServiceImpl<IoCollectCodeMapper, IoCol
.relId(ioCollectOrderCodeMan.getRelId())
.remark(collectOrder.getRemark())
.purType(udiRelevanceResponse.getPurType())
.inBatchNo(System.currentTimeMillis()).build();
.inBatchNo(System.currentTimeMillis())
.reCount(reCount)
.build();
if (IntUtil.value(ioCollectOrderCodeMan.getIsSplitCode())) {
collectCodeBackup.setFifoSplit(4);
@ -150,7 +168,9 @@ public class IoCollectCodeService extends ServiceImpl<IoCollectCodeMapper, IoCol
.workPlaceCode(collectOrder.getWorkPlaceCode())
.remark(collectOrder.getRemark())
.purType(udiRelevanceResponse.getPurType())
.inBatchNo(System.currentTimeMillis()).build());
.inBatchNo(System.currentTimeMillis())
.reCount(collectOrderCodeAuto.getReCount())
.build());
}
collectCodeBackService.saveBatch(ioCollectCodes);
}
@ -173,7 +193,9 @@ public class IoCollectCodeService extends ServiceImpl<IoCollectCodeMapper, IoCol
.workPlaceCode(collectOrder.getWorkPlaceCode())
.remark(collectOrder.getRemark())
.purType(udiRelevanceResponse.getPurType())
.inBatchNo(System.currentTimeMillis()).build());
.inBatchNo(System.currentTimeMillis())
.relCodeCount(collectOrderCodeAuto.getReCount())
.build());
}
collectCodeBackService.saveBatch(ioCollectCodes);
}

@ -11,6 +11,7 @@ import org.springframework.stereotype.Service;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
@Service
public class IoCollectOrderOriginService extends ServiceImpl<IoCollectOrderOriginMapper, IoCollectOrderOrigin> {
@ -31,4 +32,35 @@ public class IoCollectOrderOriginService extends ServiceImpl<IoCollectOrderOrigi
public IoCollectOrderOrigin getByBillNo(String billNo) {
return this.baseMapper.selectOne(new LambdaQueryWrapper<IoCollectOrderOrigin>().eq(IoCollectOrderOrigin::getBillNo, billNo).last("limit 1"));
}
public List<IoCollectOrderResponse> filterOrderUploadList(CollectOrderRequest collectOrderRequest) {
if (collectOrderRequest == null) {
return Collections.emptyList();
}
if (collectOrderRequest.getPage() != null) {
int offset = (collectOrderRequest.getPage() - 1) * collectOrderRequest.getLimit();
PageHelper.offsetPage(offset, collectOrderRequest.getLimit());
}
List<IoCollectOrderResponse> data = this.baseMapper.filterList(collectOrderRequest);
for (IoCollectOrderResponse ioCollectOrderResponse : data){
ioCollectOrderResponse.setCodingStatus(
ioCollectOrderResponse.getOrderUpStatus() == null ? 0 : 1
);
}
if (collectOrderRequest.getCodingStatus() != null && collectOrderRequest.getCodingStatus() == 1){
//查询已赋码
data = data.stream()
.filter(ioCollectOrderResponse -> ioCollectOrderResponse.getOrderUpStatus() != null &&
ioCollectOrderResponse.getOrderUpStatus() == 1)
.collect(Collectors.toList());
}
if (collectOrderRequest.getCodingStatus() != null && collectOrderRequest.getCodingStatus() == 0){
//查询未赋码
data = data.stream()
.filter(ioCollectOrderResponse -> ioCollectOrderResponse.getOrderUpStatus() != null &&
ioCollectOrderResponse.getOrderUpStatus() == 0)
.collect(Collectors.toList());
}
return data;
}
}

@ -15,15 +15,22 @@ import com.glxp.api.dao.basic.UdiRelevanceDao;
import com.glxp.api.entity.basic.BasicProductsEntity;
import com.glxp.api.entity.basic.SysWorkplaceDocumentEntity;
import com.glxp.api.entity.basic.UdiRelevanceEntity;
import com.glxp.api.entity.collect.IoCollectOrder;
import com.glxp.api.entity.collect.IoCollectOrderBiz;
import com.glxp.api.entity.collect.IoCollectOrderBizOrigin;
import com.glxp.api.entity.collect.IoCollectOrderOrigin;
import com.glxp.api.entity.collect.*;
import com.glxp.api.entity.inout.IoSplitCodeEntity;
import com.glxp.api.entity.inout.IoSplitFifoInv;
import com.glxp.api.exception.JsonException;
import com.glxp.api.req.collect.CollectOrderBizRequest;
import com.glxp.api.req.collect.CollectOrderRequest;
import com.glxp.api.req.collect.IoCollectCodeRequest;
import com.glxp.api.res.collect.CollectOrderBizResponse;
import com.glxp.api.res.collect.IoCollectCodeResponse;
import com.glxp.api.service.basic.SysWorkplaceDocumentService;
import com.glxp.api.service.inout.IoSplitCodeService;
import com.glxp.api.service.inout.IoSplitFifoInvService;
import com.glxp.api.util.BeanCopyUtils;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.weaver.ast.Var;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -56,6 +63,23 @@ public class IoCollectOriginService {
@Resource
private BasicProductsDao basicProductsDao;
@Resource
private IoCollectCodeBackService ioCollectCodeBackService;
@Resource
private IoCollectOrderBackupService ioCollectOrderBackupService;
@Resource
private IoCollectOrderBizBackupService ioCollectOrderBizBackupService;
@Resource
private IoSplitCodeService splitCodeService;
@Resource
private IoSplitFifoInvService splitFifoInvService;
public BaseResponse downloadOrderV2(CollectOrderRequest collectOrderRequest) {
//条件
String busType = collectOrderRequest.getBusType();
@ -211,4 +235,221 @@ public class IoCollectOriginService {
}
return null;
}
@Transactional(rollbackFor = Exception.class)
public BaseResponse submitreturnOrder(CollectOrderRequest collectOrderRequest) {
if (StrUtil.isBlank(collectOrderRequest.getBillNo())) {
return ResultVOUtils.error(500, "单据号不能为空");
}
IoCollectOrderOrigin collectOrder = collectOrderOriginService.getByBillNo(collectOrderRequest.getBillNo());
//已完成处方单据
IoCollectOrderBackup prescriptionOrder = ioCollectOrderBackupService.getByBillNo(collectOrder.getRemark());
if (collectOrder == null) {
return ResultVOUtils.error(500, "未找到单据");
}
if (StrUtil.isBlank(collectOrderRequest.getBusType())) {
return ResultVOUtils.error(500, "单据类型不能为空");
}
// collectOrder.setRemark("36351637");
//订单已经存在 如果后端 需要是否含有 处方号 没有的话返回错误
if (StrUtil.isBlank(collectOrder.getRemark())){
return ResultVOUtils.error(500, "退货处方单号为空");
}
CollectOrderBizRequest collectOrderBizRequest = new CollectOrderBizRequest();
collectOrderBizRequest.setOrderIdFk(collectOrder.getBillNo());
List<CollectOrderBizResponse> collectOrderBizResponses = collectOrderBizOriginService.filterList(collectOrderBizRequest);
String orginOrder = collectOrder.getRemark();
ArrayList<IoCollectCodeBackup> ioCollectCodeBackups = new ArrayList<>();
// 获取已完成处方码明细
for (CollectOrderBizResponse collectOrderBizResponse : collectOrderBizResponses){
//退货产品
IoCollectCodeRequest ioCollectCodeRequest = new IoCollectCodeRequest();
ioCollectCodeRequest.setBillNo(orginOrder);
ioCollectCodeRequest.setRelId(collectOrderBizResponse.getRelId());
List<IoCollectCodeResponse> ioCollectCodeResponses = ioCollectCodeBackService.filterList(ioCollectCodeRequest);
if (ioCollectCodeResponses.isEmpty()){
return ResultVOUtils.error(500,"码明细为空");
}
//码明细
for(IoCollectCodeResponse ioCollectCodeResponse : ioCollectCodeResponses){
//拆零码
if (ioCollectCodeResponse.getIsSplitCode() == 1){
//退回拆零码
IoSplitCodeEntity splitCode = splitCodeService.getOne(new LambdaQueryWrapper<IoSplitCodeEntity>().eq(IoSplitCodeEntity::getCode, ioCollectCodeResponse.getCode()));
//拆零码存在直接加库存
if (splitCode != null){
splitCode.setRemainCount(splitCode.getRemainCount() + ioCollectCodeResponse.getReCount());
splitCode.setUpdateTime(new Date());
splitCodeService.updateById(splitCode);
} else {
//不存在的话 插入
IoSplitCodeEntity splitCode1 = new IoSplitCodeEntity();
splitCode1.setCode(ioCollectCodeResponse.getCode());
splitCode1.setAction(collectOrder.getBusType());
splitCode1.setRemainCount(ioCollectCodeResponse.getReCount());
splitCode1.setScanCount(1);
splitCode1.setScanCount(1);
splitCode1.setStatus(2);
splitCode1.setOrderId(collectOrder.getBillNo());
splitCode1.setCreateTime(new Date());
splitCode1.setUpdateTime(new Date());
splitCode1.setUnpackTime(new Date());
splitCode1.setUnpackExpireTime(new Date());
splitCode1.setRelId(Long.valueOf(ioCollectCodeResponse.getRelId()));
splitCode1.setNameCode(ioCollectCodeResponse.getNameCode());
splitCode1.setSerialNo(ioCollectCodeResponse.getSerialNo());
splitCode1.setProduceDate(ioCollectCodeResponse.getProductDate());
splitCode1.setExpireDate(ioCollectCodeResponse.getExpireDate());
splitCodeService.save(splitCode1);
}
}
//库存加码明细
// IoSplitFifoInv invServiceOne = splitFifoInvService.getOne(new LambdaQueryWrapper<IoSplitFifoInv>().eq(IoSplitFifoInv::getRelId, ioCollectCodeResponse.getRelId()));
// if (invServiceOne == null){
// throw new JsonException(500,"当前产品库存不村子啊");
// }
// invServiceOne.setAvailableCount(invServiceOne.getAvailableCount() + ioCollectCodeResponse.getReCount());
// invServiceOne.setReCount(invServiceOne.getReCount() + ioCollectCodeResponse.getReCount());
//// invServiceOne.setInCount(invServiceOne.getInCount() + ioCollectCodeResponse.getReCount());
// invServiceOne.setOutCount(invServiceOne.getOutCount() - ioCollectCodeResponse.getReCount());
// invServiceOne.setUpdateTime(new Date());
// splitFifoInvService.updateById(invServiceOne);
// /**
// * 赋码方式 1:自动拆零赋码2:自动整取赋码;3.手动整取赋码4.手动拆零赋码
// */
// if (ioCollectCodeResponse.getFifoSplit() == 1 || ioCollectCodeResponse.getFifoSplit() == 4){
// //拆零
//
// }else {
// //整取
// }
IoCollectCodeBackup collectCodeBackup = new IoCollectCodeBackup();
BeanUtils.copyProperties(ioCollectCodeResponse,collectCodeBackup);
collectCodeBackup.setBillNo(collectOrder.getBillNo());
collectCodeBackup.setId(null);
collectCodeBackup.setBusType(collectOrder.getBusType());
collectCodeBackup.setRelId(Long.valueOf(ioCollectCodeResponse.getRelId()));
ioCollectCodeBackups.add(collectCodeBackup);
}
}
ioCollectCodeBackService.saveBatch(ioCollectCodeBackups);
//删除单据
IoCollectOrder ioCollectOrder = collectOrderService.getByBillNo(collectOrder.getBillNo());
IoCollectOrderBackup orderBackup = new IoCollectOrderBackup();
BeanUtils.copyProperties(ioCollectOrder, orderBackup);
orderBackup.setTagStatus(3);
orderBackup.setWorkPlaceCode(prescriptionOrder.getWorkPlaceCode());
ioCollectOrderBackupService.save(orderBackup);
List<IoCollectOrderBiz> ioCollectOrderBizs = collectOrderBizService.listByBillNo(ioCollectOrder.getBillNo());
ArrayList<IoCollectOrderBizBackup> ioCollectOrderBizBackups = new ArrayList<>();
for (IoCollectOrderBiz ioCollectOrderBiz : ioCollectOrderBizs){
IoCollectOrderBizBackup ioCollectOrderBizBackup = new IoCollectOrderBizBackup();
BeanUtils.copyProperties(ioCollectOrderBiz,ioCollectOrderBizBackup);
ioCollectOrderBizBackup.setId(null);
ioCollectOrderBizBackups.add(ioCollectOrderBizBackup);
}
collectOrder.setTagStatus(3);
collectOrderOriginService.updateById(collectOrder);
ioCollectOrderBizBackupService.saveBatch(ioCollectOrderBizBackups);
collectOrderService.removeOrderByBillNo(ioCollectOrder);
return ResultVOUtils.success();
}
// @Transactional(rollbackFor = Exception.class)
// public BaseResponse errorHandleSubmit(CollectOrderRequest collectOrderRequest) {
// if (StrUtil.isBlank(collectOrderRequest.getBillNo())) {
// throw new JsonException(500, "单据号不能为空");
// }
//// if (collectOrderRequest.getTagStatus() != 4) {
//// throw new JsonException(500, "非异常单据,无需处理");
//// }
// if (StrUtil.isBlank(collectOrderRequest.getBusType())) {
// throw new JsonException(500, "单据类型不能为空");
// }
// String billNo = collectOrderRequest.getBillNo();
// List<IoCollectOrderOrigin> thrOrderEntities = collectOrderOriginService.list(new LambdaUpdateWrapper<IoCollectOrderOrigin>().eq(IoCollectOrderOrigin::getBillNo, billNo));
//
// if (CollUtil.isNotEmpty(thrOrderEntities)) {
// for (IoCollectOrderOrigin thrOrder : thrOrderEntities) {
// IoCollectOrder ioCollectOrder = new IoCollectOrder();
// BeanUtil.copyProperties(thrOrder, ioCollectOrder);
// StringBuilder errorMsg = new StringBuilder();
// List<IoCollectOrderBiz> bizList = new ArrayList<>();
//
// List<IoCollectOrderBizOrigin> list = collectOrderBizOriginService.list(new LambdaUpdateWrapper<IoCollectOrderBizOrigin>().eq(IoCollectOrderBizOrigin::getOrderIdFk, thrOrder.getBillNo()));
// for (IoCollectOrderBizOrigin entity : list) {
// IoCollectOrderBiz collectOrderBiz = new IoCollectOrderBiz();
// BeanUtil.copyProperties(entity, collectOrderBiz);
//
// if (BusTypeConstant.QXCF001.getBusType().equals(collectOrderRequest.getBusType())){
// collectOrderBiz.setRelId(entity.getRelId());
// BasicProductsEntity basicProductsEntity = basicProductsDao.selectOne(new LambdaQueryWrapper<BasicProductsEntity>().eq(BasicProductsEntity::getYbbm, entity.getYbbm()).last("limit 1"));
// if (StrUtil.isEmpty(basicProductsEntity.getNameCode())) {
// errorMsg.append(entity.getCpmctymc()).append("字典未对照").append(";");
// }
// collectOrderBiz.setTagStatus(1);
// collectOrderBiz.setUnTagCount(0);
// bizList.add(collectOrderBiz);
//
// }else {
// UdiRelevanceEntity basicUdirelEntity = udiRelevanceDao.selectOne(new LambdaQueryWrapper<UdiRelevanceEntity>().eq(UdiRelevanceEntity::getMainId, entity.getThrCode()));
// if (basicUdirelEntity != null) {
// collectOrderBiz.setRelId(basicUdirelEntity.getId());
// BasicProductsEntity basicProductsEntity = basicProductsDao.selectOne(new LambdaQueryWrapper<BasicProductsEntity>().eq(BasicProductsEntity::getUuid, basicUdirelEntity.getUuid()).last("limit 1"));
// if (StrUtil.isEmpty(basicProductsEntity.getNameCode())) {
// errorMsg.append(entity.getCpmctymc()).append("字典未对照").append(";");
// }
// } else {
// errorMsg.append(entity.getCpmctymc()).append("字典未对照").append(";");
// }
// collectOrderBiz.setTagStatus(1);
// collectOrderBiz.setUnTagCount(0);
// bizList.add(collectOrderBiz);
// }
// }
// if (StrUtil.isNotEmpty(errorMsg)) {
// thrOrder.setTagStatus(4);
// thrOrder.setErrorMsg(errorMsg.toString());
// collectOrderOriginService.updateById(thrOrder);
//
// List<IoCollectOrderBizOrigin> ioCollectOrderBizOrigins = BeanCopyUtils.copyList(bizList, IoCollectOrderBizOrigin.class);
// collectOrderBizOriginService.updateBatchById(ioCollectOrderBizOrigins);
// }else {
// thrOrder.setTagStatus(2);
// collectOrderOriginService.updateById(thrOrder);
//
// List<IoCollectOrderBizOrigin> ioCollectOrderBizOrigins = BeanCopyUtils.copyList(bizList, IoCollectOrderBizOrigin.class);
// collectOrderBizOriginService.updateBatchById(ioCollectOrderBizOrigins);
//
// //删除
// collectOrderService.remove(new LambdaQueryWrapper<IoCollectOrder>().eq(IoCollectOrder::getBillNo, billNo));
// //更改 原始单据表 为未处理
// collectOrderBizService.remove(new LambdaUpdateWrapper<IoCollectOrderBiz>().eq(IoCollectOrderBiz::getOrderIdFk, billNo));
//
// for (IoCollectOrderBiz ioCollectOrderBiz : bizList) {
// ioCollectOrderBiz.setId(null);
// }
// //新增
// collectOrderBizService.saveBatch(bizList);
// ioCollectOrder.setFromType("HIS系统");
// ioCollectOrder.setWorkPlaceCode(collectOrderRequest.getWorkPlaceCode());
// ioCollectOrder.setCreateTime(new Date());
// ioCollectOrder.setCreateUser(collectOrderRequest.getCreateUser());
// ioCollectOrder.setBackupOrderRemark1(null);
// ioCollectOrder.setUpdateTime(new Date());
// ioCollectOrder.setSplitStatus(0);
// ioCollectOrder.setTagStatus(1);
// ioCollectOrder.setId(IdUtil.getSnowflakeNextId());
//
// collectOrderService.save(ioCollectOrder);
// }
// }
//
// }
// return ResultVOUtils.success("提交成功");
// }
}

@ -125,7 +125,23 @@ public class IoSplitCodeService extends ServiceImpl<IoSplitCodeMapper, IoSplitCo
unCount = IntUtil.value(collectOrderBiz.getUnTagCount());
for (IoSplitCodeEntity ioSplitCodeEntity : ioSplitCodeEntities) {
count = IntUtil.value(ioSplitCodeEntity.getRemainCount()) - unCount;
collectOrderCodeAutoService.save(IoCollectOrderCodeAuto.builder().codeIdFk(ioSplitCodeEntity.getId()).udiCode(ioSplitCodeEntity.getCode()).orderIdFk(collectOrder.getBillNo()).batchNo(ioSplitCodeEntity.getBatchNo()).productDate(ioSplitCodeEntity.getProduceDate()).expireDate(ioSplitCodeEntity.getExpireDate()).serialNo(ioSplitCodeEntity.getSerialNo()).relId(collectOrderBiz.getRelId()).bizIdFk(collectOrderBiz.getId()).fifoSplit(1).createTime(new Date()).updateTime(new Date()).build());
collectOrderCodeAutoService.save(
IoCollectOrderCodeAuto.builder()
.codeIdFk(ioSplitCodeEntity.getId())
.udiCode(ioSplitCodeEntity.getCode())
.orderIdFk(collectOrder.getBillNo())
.batchNo(ioSplitCodeEntity.getBatchNo())
.productDate(ioSplitCodeEntity.getProduceDate())
.expireDate(ioSplitCodeEntity.getExpireDate())
.serialNo(ioSplitCodeEntity.getSerialNo())
.relId(collectOrderBiz.getRelId())
.bizIdFk(collectOrderBiz.getId())
.fifoSplit(1)
.createTime(new Date())
.updateTime(new Date())
.count(count > 0 ? count : 0)
.reCount(unCount)
.build());
if (count > 0) {
ioSplitCodeEntity.setRemainCount(count);
unCount = 0;
@ -157,7 +173,21 @@ public class IoSplitCodeService extends ServiceImpl<IoSplitCodeMapper, IoSplitCo
for (IoSplitCodeEntity ioSplitCodeEntity : ioSplitCodeEntities) {
if (IntUtil.value(ioSplitCodeEntity.getRemainCount()) > 0) {
count = IntUtil.value(ioSplitCodeEntity.getRemainCount()) - unCount;
collectOrderCodeAutoService.save(IoCollectOrderCodeAuto.builder().codeIdFk(ioSplitCodeEntity.getId()).udiCode(ioSplitCodeEntity.getCode()).orderIdFk(collectOrder.getBillNo()).batchNo(ioSplitCodeEntity.getBatchNo()).productDate(ioSplitCodeEntity.getProduceDate()).expireDate(ioSplitCodeEntity.getExpireDate()).serialNo(ioSplitCodeEntity.getSerialNo()).relId(collectOrderBiz.getRelId()).bizIdFk(collectOrderBiz.getId()).fifoSplit(1).createTime(new Date()).updateTime(new Date()).build());
collectOrderCodeAutoService.save(IoCollectOrderCodeAuto.builder()
.codeIdFk(ioSplitCodeEntity.getId())
.udiCode(ioSplitCodeEntity.getCode())
.orderIdFk(collectOrder.getBillNo())
.batchNo(ioSplitCodeEntity.getBatchNo())
.productDate(ioSplitCodeEntity.getProduceDate())
.expireDate(ioSplitCodeEntity.getExpireDate())
.serialNo(ioSplitCodeEntity.getSerialNo())
.relId(collectOrderBiz.getRelId())
.bizIdFk(collectOrderBiz.getId())
.fifoSplit(count > 0 ? count : 0)
.reCount(count)
.createTime(new Date())
.updateTime(new Date())
.build());
if (count > 0) {
ioSplitCodeEntity.setRemainCount(count);
splitCodeMapper.updateById(ioSplitCodeEntity);
@ -319,7 +349,20 @@ public class IoSplitCodeService extends ServiceImpl<IoSplitCodeMapper, IoSplitCo
for (int i = 0; i < indexFlag; i++) {
IoSplitFifoCodeEntity splitFifoCodeEntity = ioSplitFifoCodeEntities.get(i);
collectOrderBiz.setUnTagCount(IntUtil.value(collectOrderBiz.getUnTagCount()) - IntUtil.value(udiRelevanceResponse.getBhxjsl()));
collectOrderCodeAutoService.save(IoCollectOrderCodeAuto.builder().codeIdFk(splitFifoCodeEntity.getId()).udiCode(splitFifoCodeEntity.getCode()).orderIdFk(collectOrder.getBillNo()).batchNo(splitFifoCodeEntity.getBatchNo()).productDate(splitFifoCodeEntity.getProduceDate()).expireDate(splitFifoCodeEntity.getExpireDate()).serialNo(splitFifoCodeEntity.getSerialNo()).relId(collectOrderBiz.getRelId()).bizIdFk(collectOrderBiz.getId()).fifoSplit(2).createTime(new Date()).updateTime(new Date()).build());
collectOrderCodeAutoService.save(IoCollectOrderCodeAuto.builder()
.codeIdFk(splitFifoCodeEntity.getId())
.udiCode(splitFifoCodeEntity.getCode())
.orderIdFk(collectOrder.getBillNo())
.batchNo(splitFifoCodeEntity.getBatchNo())
.productDate(splitFifoCodeEntity.getProduceDate())
.expireDate(splitFifoCodeEntity.getExpireDate())
.serialNo(splitFifoCodeEntity.getSerialNo())
.relId(collectOrderBiz.getRelId())
.bizIdFk(collectOrderBiz.getId())
.fifoSplit(2)
.createTime(new Date())
.updateTime(new Date())
.build());
splitFifoCodeService.removeById(splitFifoCodeEntity.getId());
IoSplitFifoInv splitFifoInv = splitFifoInvService.findByFifoCode(splitFifoCodeEntity);
if (splitFifoInv != null) {
@ -487,7 +530,21 @@ public class IoSplitCodeService extends ServiceImpl<IoSplitCodeMapper, IoSplitCo
for (int i = 0; i < quotient; i++) {
IoSplitFifoCodeEntity splitFifoCodeEntity = availableCodes.get(i);
collectOrderBiz.setUnTagCount(IntUtil.value(collectOrderBiz.getUnTagCount()) - IntUtil.value(udiRelevanceResponse.getBhxjsl()));
collectOrderCodeAutoService.save(IoCollectOrderCodeAuto.builder().codeIdFk(splitFifoCodeEntity.getId()).udiCode(splitFifoCodeEntity.getCode()).orderIdFk(collectOrder.getBillNo()).batchNo(splitFifoCodeEntity.getBatchNo()).productDate(splitFifoCodeEntity.getProduceDate()).expireDate(splitFifoCodeEntity.getExpireDate()).serialNo(splitFifoCodeEntity.getSerialNo()).relId(collectOrderBiz.getRelId()).bizIdFk(collectOrderBiz.getId()).fifoSplit(2).createTime(new Date()).updateTime(new Date()).build());
collectOrderCodeAutoService.save(
IoCollectOrderCodeAuto.builder()
.codeIdFk(splitFifoCodeEntity.getId())
.udiCode(splitFifoCodeEntity.getCode())
.orderIdFk(collectOrder.getBillNo())
.batchNo(splitFifoCodeEntity.getBatchNo())
.productDate(splitFifoCodeEntity.getProduceDate())
.expireDate(splitFifoCodeEntity.getExpireDate())
.serialNo(splitFifoCodeEntity.getSerialNo())
.relId(collectOrderBiz.getRelId())
.bizIdFk(collectOrderBiz.getId())
.fifoSplit(2)
.createTime(new Date())
.updateTime(new Date())
.build());
splitFifoCodeService.removeById(splitFifoCodeEntity.getId());
IoSplitFifoInv splitFifoInv = splitFifoInvService.findByFifoCode(splitFifoCodeEntity);
if (splitFifoInv != null) {

@ -242,6 +242,7 @@ public class IoSplitQxService {
.fifoSplit(ioSplitCodeEntity.getFifoSplit())
.createTime(new Date())
.updateTime(new Date())
.reCount(count > 0 ? count : 0)
.build());
if (count > 0) {
ioSplitCodeEntity.setRemainCount(count);

@ -25,6 +25,12 @@
<if test="busKey != null and busKey != ''">
AND sys_workplace_document.busName like concat('%', #{busKey}, '%')
</if>
<if test="documentTypeCodes != null and documentTypeCodes.size() > 0">
and documentTypeCode in
<foreach collection="documentTypeCodes" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
</where>
GROUP BY sys_workplace_document.documentTypeCode
ORDER BY sys_workplace_document.number
@ -59,6 +65,12 @@
#{item}
</foreach>
</if>
<if test="documentTypeCodes != null and documentTypeCodes.size() > 0">
and sys_workplace_document.documentTypeCode in
<foreach collection="documentTypeCodes" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
<if test="documentTypeCode != '' and documentTypeCode != null">
AND sys_workplace_document.documentTypeCode = #{documentTypeCode}
</if>

@ -32,6 +32,7 @@
ico.uploadError,
ico.errorMsg,
ico.shipper,
iocb.uploadStatus as orderUpStatus,
ico.shipperName,
row_number()
over ( order by case
@ -43,6 +44,7 @@
left join basic_bussiness_type on sys_workplace_document.documentTypeCode = basic_bussiness_type.action
left join basic_corp bc on ico.fromCorp = bc.erpId
left join sys_workplace sw on ico.workPlaceCode = sw.workplaceId
left join io_collect_order_backup iocb on iocb.billNo = ico.billNo
<where>
<if test="billNo != '' and billNo != null">
@ -69,11 +71,31 @@
AND ico.busType = #{busType}
</if>
<if test="tagStatus != null">
AND tagStatus = #{tagStatus}
AND ico.tagStatus = #{tagStatus}
</if>
<if test="returnStatus != null">
<choose>
<when test="returnStatus == 3">
AND ico.tagStatus = #{returnStatus}
</when>
<otherwise>
AND ico.tagStatus = 2
</otherwise>
</choose>
</if>
<if test="workPlaceCode != null">
AND ico.workPlaceCode = #{workPlaceCode}
</if>
<if test="orderUpStatus != null">
<choose>
<when test="orderUpStatus == 1">
AND iocb.uploadStatus = #{orderUpStatus}
</when>
<otherwise>
AND iocb.uploadStatus != 1
</otherwise>
</choose>
</if>
<if test="chargeUser != null">
AND sw.chargeUser = #{chargeUser}
</if>
@ -91,7 +113,7 @@
or ico.backupOrderRemark6 like concat('%', #{unionKey}, '%'))
</if>
<if test="tagStatusList != null and tagStatusList.size() > 0">
and tagStatus in
and ico.tagStatus in
<foreach collection="tagStatusList" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
@ -111,6 +133,12 @@
#{item}
</foreach>
</if>
<if test="documentTypeCodes != null and documentTypeCodes.size() > 0">
and sys_workplace_document.documentTypeCode in
<foreach collection="documentTypeCodes" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
<if test="uploadStatus != null">
and ico.uploadStatus = #{uploadStatus}
</if>
@ -128,7 +156,4 @@
ico.billNo
order by case when ico.orderTime is null then ico.createTime else ico.orderTime end desc
</select>
</mapper>

@ -5469,7 +5469,6 @@ CALL Pro_Temp_ColumnWork('basic_udirel', 'hangingNetType',
' tinyint DEFAULT NULL COMMENT ''是否挂网 0 否 1 是''',
1);
CREATE TABLE IF NOT EXISTS `yb_not_code` (
`ybbm` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '国家医保目录编码',
`organizationCode` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '机构编码',
@ -5493,3 +5492,7 @@ INSERT IGNORE INTO sys_scheduled(`id`, `cronName`, `cron`, `customerId`, `remark
VALUES (3000, 'notCodeTask', '0 */20 * * * ?', NULL, '定时更新无码库');
INSERT IGNORE INTO sys_scheduled(`id`, `cronName`, `cron`, `customerId`, `remark`)
VALUES (3001, 'ioSplitFifoCodeTask', '0 */30 * * * ?', NULL, '工位库存定时补齐码的三期');
CALL Pro_Temp_ColumnWork('io_collect_code_backup', 'reCount',
'int NULL DEFAULT NULL COMMENT ''实际数量''',
1);

Loading…
Cancel
Save