请求入库

This commit is contained in:
liuhanqing
2025-09-24 15:05:17 +08:00
parent e055bc4920
commit a3c9a3c833
3 changed files with 111 additions and 103 deletions

View File

@@ -96,7 +96,6 @@ public class ToWmsServiceImpl implements IToWmsService {
return AjaxResult.error("托盘条码不能为空");
}
log.info("扫码内容{}", requestEnter.getTrayCode());
//生成调拨单
Map<String, String> saveTransferBill = toErpService.saveTransferBill();
if (!"200".equals(saveTransferBill.get("code"))) {
@@ -104,26 +103,31 @@ public class ToWmsServiceImpl implements IToWmsService {
}
log.info("生成调拨单{}", saveTransferBill);
//解析扫码内容
String trayCode = requestEnter.getTrayCode();
String[] split = trayCode.split(" ");
String model = split[0].substring(6);
String color = split[1].substring(6);
String serial = split[2].substring(7);
String v = split[3].substring(2);
String hz = split[4].substring(3);
String ph = split[5].substring(3);
String nw = split[6].substring(5, split[6].length() - 2);
String gw = split[7].substring(5, split[7].length() - 2);
String productId = split[8].substring(10);
String bm = split[9].substring(2, split[9].length() - 1);
String[] decode = ProcodeUtils.decode(bm);
String erpBill = decode[0];
String xh = decode[1];
String jx = decode[2];
String fx = decode[3];
String xlh = decode[4];
log.info("二维码详情 productId:{} model:{},color:{},serial:{},v:{},hz:{},ph:{},nw:{},gw:{},erpBill:{},xh:{},jx:{},fx:{},xlh:{}", productId, model, color, serial, v, hz, ph, nw, gw, erpBill, xh, jx, fx, xlh);
//解析扫码内容
String trayCode = requestEnter.getTrayCode();
String[] split = trayCode.split(" ");
String model = split[0].substring(6);
String color = split[1].substring(6);
String serial = split[2].substring(7);
String v = split[3].substring(2);
String hz = split[4].substring(3);
String ph = split[5].substring(3);
String nw = split[6].substring(5, split[6].length() - 2);
String gw = split[7].substring(5, split[7].length() - 2);
String productId = split[8].substring(10);
String bm = split[9].substring(2, split[9].length() - 1);
String[] decode = ProcodeUtils.decode(bm);
String erpBill = decode[0];
String xh = decode[1];
String jx = decode[2];
String fx = decode[3];
String xlh = decode[4];
log.info("二维码详情 productId:{} model:{},color:{},serial:{},v:{},hz:{},ph:{},nw:{},gw:{},erpBill:{},xh:{},jx:{},fx:{},xlh:{}", productId, model, color, serial, v, hz, ph, nw, gw, erpBill, xh, jx, fx, xlh);
for (String s : split) {
if (StrUtil.isEmpty(s)){
return new AjaxResult(503,"二维码内容错误");
}
}
//查询物料信息
BasProduct basProductParam = new BasProduct();
@@ -132,7 +136,22 @@ public class ToWmsServiceImpl implements IToWmsService {
if (CollUtil.isEmpty(basProducts)) {
return AjaxResult.error("物料信息不存在");
}
BasProduct basProduct = basProducts.get(0);
//根据包装方式 主要包装方式 描述 长 宽 高 包装材积
int size = getSize(basProduct);
//超大托盘不处理 直接返回
if (size == 5){
return new AjaxResult(501,"超大托盘");
}
//托盘大小与电气返回不匹配
if (size != Integer.parseInt(requestEnter.getSize())){
return new AjaxResult(502,"托盘大小不匹配");
}
String inOrOutType = null;
String inStockId = null;
String inStockDetailId = null;
@@ -174,20 +193,7 @@ public class ToWmsServiceImpl implements IToWmsService {
mydoJob.setExecutionPhase("1");
mydoJob.setTrayCode(basJobIdService.getJobId("TP"));
mydoJob.setWarehouseId("01");
//todo 根据包装方式 主要包装方式 描述 长 宽 高 包装材积 判断巷道1 还是巷道2
switch (requestEnter.getSize()) {
case "1":
mydoJob.setRoadwayId("1");
break;
case "2":
mydoJob.setRoadwayId("2");
break;
case "4":
break;
default:
return AjaxResult.error("规格不存在");
}
mydoJob.setRoadwayId(getRoadway(size));
//根据巷道查找货位
BasCargoSpace basCargoSpaceParam = new BasCargoSpace();
basCargoSpaceParam.setWarehouseId(mydoJob.getWarehouseId());
@@ -238,7 +244,6 @@ public class ToWmsServiceImpl implements IToWmsService {
transferBillCallbackService.insertTransferBillCallback(transferBillCallback);
}
//修改作业状态为正执行
HashMap<String,String> result = new HashMap<>();
result.put("jobId", mydoJob.getJobId());
result.put("taskNo", mydoJob.getTaskNo());
@@ -248,34 +253,67 @@ public class ToWmsServiceImpl implements IToWmsService {
return AjaxResult.success(result);
}
private String getRoadway(int size) {
return switch (size) {
case 1, 2 -> "1";
case 3, 4 -> "2";
default -> null;
};
}
/**
* todo 根据包装方式 主要包装方式 描述 长 宽 高 包装材积获取大小
* @param basProduct
* @return
*/
private int getSize(BasProduct basProduct) {
String remark = basProduct.getRemark();
String packageType = basProduct.getSpare34();
String mainPackageType = basProduct.getSpare35();
String length = basProduct.getSpare36();
String width = basProduct.getSpare37();
String height = basProduct.getSpare38();
String volume = basProduct.getSpare39();
return 0;
}
@Override
public AjaxResult selectMydoJobByEntranceId(RequestEnter requestEnter) {
MydoJob mydoJob = new MydoJob();
mydoJob.setStatus("1");
mydoJob.setEntranceId("G1005");
MydoJob mydoJob2 = mydoJobService.selectMydoJobByEntranceId(mydoJob);
MydoJob param = new MydoJob();
param.setStatus("1");
param.setEntranceId("G1005");
MydoJob mydoJob = mydoJobService.selectMydoJobByEntranceId(param);
if(mydoJob2 != null){
//todo 根据包装方式 主要包装方式 描述 长 宽 高 包装材积 判断巷道1 还是巷道2
switch (requestEnter.getSize()) {
case "1":
mydoJob.setRoadwayId("1");
break;
case "2":
mydoJob.setRoadwayId("2");
break;
case "4":
break;
default:
return AjaxResult.error("规格不存在");
if(mydoJob != null && StrUtil.isNotEmpty(mydoJob.getTrayCode())){
List<MydoJobDetail> mydoJobDetails = mydoJobDetailService.selectMydoJobDetailListByJobId(mydoJob.getJobId());
if (CollUtil.isEmpty(mydoJobDetails)) {
return AjaxResult.error("没有任务");
}
MydoJobDetail mydoJobDetail = mydoJobDetails.get(0);
String productId = mydoJobDetail.getProductId();
BasProduct basProduct = basProductService.selectBasProductByProductId(productId);
int size = getSize(basProduct);
//超大托盘不处理 直接返回
if (size == 5){
return new AjaxResult(501,"超大托盘");
}
//托盘大小与电气返回不匹配
if (size != Integer.parseInt(requestEnter.getSize())){
return new AjaxResult(502,"托盘大小不匹配");
}
HashMap<String,String> result = new HashMap<>();
result.put("jobId", mydoJob.getJobId());
result.put("taskNo", mydoJob.getTaskNo());
result.put("cargoSpaceId", mydoJob.getCargoSpaceId());
result.put("roadwayId", mydoJob.getRoadwayId());
result.put("entranceId", mydoJob.getEntranceId());
return AjaxResult.success(result);
}else {
return AjaxResult.error("没有任务");
}
//查子作业,查物料规格,判断是否对的上
return null;
}
@Override