|
|
|
@ -1,21 +1,18 @@
|
|
|
|
|
package com.glxp.udi.admin.thread;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import com.glxp.udi.admin.constant.ConstantStatus;
|
|
|
|
|
import com.glxp.udi.admin.entity.basic.BussinessTypeEntity;
|
|
|
|
|
import com.glxp.udi.admin.entity.inout.*;
|
|
|
|
|
import com.glxp.udi.admin.service.inout.OrderDetailService;
|
|
|
|
|
import com.glxp.udi.admin.service.inout.OrderService;
|
|
|
|
|
import com.glxp.udi.admin.service.inout.WarehouseService;
|
|
|
|
|
import com.glxp.udi.admin.service.inout.WarehouseTempService;
|
|
|
|
|
import com.glxp.udi.admin.entity.product.StackCode;
|
|
|
|
|
import com.glxp.udi.admin.req.inout.OrderFilterRequest;
|
|
|
|
|
import com.glxp.udi.admin.req.inout.PostOrderRequest;
|
|
|
|
|
import com.glxp.udi.admin.service.basic.BussinessTypeService;
|
|
|
|
|
import com.glxp.udi.admin.service.info.SetupService;
|
|
|
|
|
import com.glxp.udi.admin.service.inout.UdiInfoService;
|
|
|
|
|
import com.glxp.udi.admin.service.inout.UdiRelevanceService;
|
|
|
|
|
import com.glxp.udi.admin.service.inout.UnitMaintainService;
|
|
|
|
|
import com.glxp.udi.admin.service.inout.*;
|
|
|
|
|
import com.glxp.udi.admin.service.product.StackOrderService;
|
|
|
|
|
import com.glxp.udi.admin.util.Constant;
|
|
|
|
|
import com.glxp.udi.admin.util.CustomUtil;
|
|
|
|
|
import com.glxp.udi.admin.util.GennerOrderUtils;
|
|
|
|
@ -58,6 +55,8 @@ public class TransInoutService {
|
|
|
|
|
private InoutUtils inoutUtils;
|
|
|
|
|
@Resource
|
|
|
|
|
private GennerOrderUtils gennerOrderUtils;
|
|
|
|
|
@Resource
|
|
|
|
|
private StackOrderService stackOrderService;
|
|
|
|
|
|
|
|
|
|
@Async
|
|
|
|
|
public void transInout(OrderEntity orderEntity) {
|
|
|
|
@ -131,37 +130,90 @@ public class TransInoutService {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//判断是否是扫描的垛号
|
|
|
|
|
boolean isDHCode = filterList.get(0).getCode().contains("DH");
|
|
|
|
|
|
|
|
|
|
//临时码表
|
|
|
|
|
for (WarehousetempEntity warehousetemp : filterList) {
|
|
|
|
|
warehousetemp.setLocStorageCode(orderEntity.getLocStorageCode());
|
|
|
|
|
String result = inoutUtils.filterCode(warehouseService, warehousetemp, setupService);
|
|
|
|
|
if (result == null) {
|
|
|
|
|
WarehouseEntity warehouseEntity = new WarehouseEntity();
|
|
|
|
|
BeanUtil.copyProperties(warehousetemp, warehouseEntity, "id");
|
|
|
|
|
insertList.add(warehouseEntity);
|
|
|
|
|
} else {
|
|
|
|
|
tempEntity.setStatus(ConstantStatus.ORDER_STATUS_FAIL);
|
|
|
|
|
tempEntity.setRemark(result);
|
|
|
|
|
orderService.updateOrder(tempEntity);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//产品是否可以使用单元入库
|
|
|
|
|
UdiInfoEntity udiInfoEntity = udiInfoService.findByNameCode(warehousetemp.getNameCode(), String.valueOf(warehousetemp.getCustomerId()));
|
|
|
|
|
if (null != udiInfoEntity) {
|
|
|
|
|
if (udiInfoEntity.getIsUseDy() == 0 && udiInfoEntity.getDiType() == ConstantStatus.DITYPE_SYDY) {
|
|
|
|
|
if (isDHCode) {
|
|
|
|
|
//扫描的码为垛号码
|
|
|
|
|
//查询此垛的条码,校验单码信息
|
|
|
|
|
List<StackCode> codeList = stackOrderService.getCodeList(warehousetemp.getCode(), warehousetemp.getCustomerId());
|
|
|
|
|
if (CollUtil.isEmpty(codeList)) {
|
|
|
|
|
tempEntity.setStatus(ConstantStatus.ORDER_STATUS_FAIL);
|
|
|
|
|
tempEntity.setRemark("udi码:" + warehousetemp.getCode() + "该产品不允许以使用单元入库");
|
|
|
|
|
tempEntity.setRemark("垛号:" + warehousetemp.getCode() + " 无条码数据");
|
|
|
|
|
orderService.updateOrder(tempEntity);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//todo 判断是否为有效码
|
|
|
|
|
for (StackCode stackCode : codeList){
|
|
|
|
|
WarehousetempEntity tempCode = new WarehousetempEntity();
|
|
|
|
|
BeanUtil.copyProperties(warehousetemp, tempCode);
|
|
|
|
|
BeanUtil.copyProperties(stackCode, tempCode);
|
|
|
|
|
tempCode.setId(null);
|
|
|
|
|
//校验条码
|
|
|
|
|
String result = inoutUtils.filterCode(warehouseService, tempCode, setupService);
|
|
|
|
|
if (result == null) {
|
|
|
|
|
WarehouseEntity warehouseEntity = new WarehouseEntity();
|
|
|
|
|
BeanUtil.copyProperties(tempCode, warehouseEntity, "id");
|
|
|
|
|
insertList.add(warehouseEntity);
|
|
|
|
|
} else {
|
|
|
|
|
tempEntity.setStatus(ConstantStatus.ORDER_STATUS_FAIL);
|
|
|
|
|
tempEntity.setRemark(result);
|
|
|
|
|
orderService.updateOrder(tempEntity);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
//产品是否可以使用单元入库
|
|
|
|
|
UdiInfoEntity udiInfoEntity = udiInfoService.findByNameCode(tempCode.getNameCode(), String.valueOf(warehousetemp.getCustomerId()));
|
|
|
|
|
if (null != udiInfoEntity) {
|
|
|
|
|
if (udiInfoEntity.getIsUseDy() == 0 && udiInfoEntity.getDiType() == ConstantStatus.DITYPE_SYDY) {
|
|
|
|
|
tempEntity.setStatus(ConstantStatus.ORDER_STATUS_FAIL);
|
|
|
|
|
tempEntity.setRemark("udi码:" + tempCode.getCode() + " 该产品不允许以使用单元入库");
|
|
|
|
|
orderService.updateOrder(tempEntity);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//todo 判断是否为有效码
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
tempEntity.setStatus(ConstantStatus.ORDER_STATUS_FAIL);
|
|
|
|
|
tempEntity.setRemark("udi码:" + tempCode.getCode() + " 该产品信息在耗材字典未维护!");
|
|
|
|
|
orderService.updateOrder(tempEntity);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
tempEntity.setStatus(ConstantStatus.ORDER_STATUS_FAIL);
|
|
|
|
|
tempEntity.setRemark("udi码:" + warehousetemp.getCode() + "该产品信息在耗材字典未维护!");
|
|
|
|
|
orderService.updateOrder(tempEntity);
|
|
|
|
|
return;
|
|
|
|
|
String result = inoutUtils.filterCode(warehouseService, warehousetemp, setupService);
|
|
|
|
|
if (result == null) {
|
|
|
|
|
WarehouseEntity warehouseEntity = new WarehouseEntity();
|
|
|
|
|
BeanUtil.copyProperties(warehousetemp, warehouseEntity, "id");
|
|
|
|
|
insertList.add(warehouseEntity);
|
|
|
|
|
} else {
|
|
|
|
|
tempEntity.setStatus(ConstantStatus.ORDER_STATUS_FAIL);
|
|
|
|
|
tempEntity.setRemark(result);
|
|
|
|
|
orderService.updateOrder(tempEntity);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//产品是否可以使用单元入库
|
|
|
|
|
UdiInfoEntity udiInfoEntity = udiInfoService.findByNameCode(warehousetemp.getNameCode(), String.valueOf(warehousetemp.getCustomerId()));
|
|
|
|
|
if (null != udiInfoEntity) {
|
|
|
|
|
if (udiInfoEntity.getIsUseDy() == 0 && udiInfoEntity.getDiType() == ConstantStatus.DITYPE_SYDY) {
|
|
|
|
|
tempEntity.setStatus(ConstantStatus.ORDER_STATUS_FAIL);
|
|
|
|
|
tempEntity.setRemark("udi码:" + warehousetemp.getCode() + " 该产品不允许以使用单元入库");
|
|
|
|
|
orderService.updateOrder(tempEntity);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//todo 判断是否为有效码
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
tempEntity.setStatus(ConstantStatus.ORDER_STATUS_FAIL);
|
|
|
|
|
tempEntity.setRemark("udi码:" + warehousetemp.getCode() + " 该产品信息在耗材字典未维护!");
|
|
|
|
|
orderService.updateOrder(tempEntity);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|