fix:新增临时包装关系和空木箱入库逻辑优化

This commit is contained in:
zhouz
2024-07-02 23:37:41 +08:00
parent 2da22af59a
commit f846c48f32
6 changed files with 67 additions and 13 deletions

View File

@@ -3,6 +3,7 @@ package org.nl.b_lms.pdm.subpackagerelation.controller;
import java.util.Set;
import java.util.Map;
import cn.dev33.satoken.annotation.SaIgnore;
import com.alibaba.fastjson.JSONObject;
import org.nl.b_lms.pdm.subpackagerelation.dao.PdmBiSubpackagerelation;
import org.nl.common.TableDataInfo;
@@ -57,7 +58,6 @@ public class PdmBiSubpackagerelationController {
}
/**
* 查询订单装箱信息
*
@@ -124,14 +124,11 @@ public class PdmBiSubpackagerelationController {
@Log("传输子卷包装关系至LMS")
//@SaCheckPermission("@el.check(updateEntityList)")
public ResponseEntity<Object> transferBoxPackageToMes(@RequestBody JSONObject whereJson) {
pdmBiSubpackagerelationService.transferBoxPackageToMes(true,whereJson,null,null,null);
pdmBiSubpackagerelationService.transferBoxPackageToMes(true, whereJson, null, null, null);
return new ResponseEntity<>(HttpStatus.OK);
}
/**
* 删除数据
*
@@ -146,6 +143,14 @@ public class PdmBiSubpackagerelationController {
return new ResponseEntity<>(HttpStatus.OK);
}
@PostMapping("/createSubTest")
@Log("传输子卷包装关系至LMS")
@SaIgnore
public ResponseEntity<Object> createSubTest(@RequestBody JSONObject whereJson) {
pdmBiSubpackagerelationService.createSubTest(whereJson);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@@ -101,6 +101,8 @@ public interface IpdmBiSubpackagerelationService extends IService<PdmBiSubpackag
*/
void deleteAll(Set<String> ids);
void createSubTest(JSONObject jo);
}

View File

@@ -2,6 +2,9 @@ package org.nl.b_lms.pdm.subpackagerelation.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.date.StopWatch;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -718,6 +721,37 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
zxDjwTask.createTask(jo);
}
@Override
public void createSubTest(JSONObject jo) {
String containerName = jo.getString("container_name");
if (StrUtil.isEmpty(containerName)) {
throw new BadRequestException("输入的子卷号不能为空!");
}
PdmBiSlittingproductionplan plan = iPdmBiSlittingproductionplanService.getOne(new LambdaQueryWrapper<PdmBiSlittingproductionplan>().eq(PdmBiSlittingproductionplan::getContainer_name, containerName));
if (ObjectUtil.isEmpty(plan)) {
throw new BadRequestException("未查询到可用的分切计划!");
}
PdmBiSubpackagerelation sub = new PdmBiSubpackagerelation();
sub.setWorkorder_id(IdUtil.getSnowflake(1, 1).nextId() + "");
sub.setContainer_name(plan.getContainer_name());
sub.setSale_order_name(plan.getSale_order_name());
sub.setCustomer_name("test");
sub.setCustomer_description("临时包装关系");
sub.setProduct_description(plan.getDescription());
sub.setWidth(String.valueOf(plan.getSplit_breadth()));
int net_weight = Integer.parseInt(plan.getWeight()) - Integer.parseInt(plan.getPaper_weight());
sub.setNet_weight(net_weight + "");
sub.setLength("1000");
sub.setIs_un_plan_production("0");
sub.setCreate_id(1L);
sub.setCreate_name("管理员");
sub.setCreate_time(DateUtil.now());
sub.setStatus("99");
sub.setSap_pcsn("Test");
sub.setExt_code("BC01");
this.saveOrUpdate(sub);
}
}

View File

@@ -14,6 +14,7 @@ import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.nl.b_lms.pdm.subpackagerelation.service.IpdmBiSubpackagerelationService;
import org.nl.b_lms.sch.point.dao.BstIvtPackageinfoivt;
import org.nl.b_lms.sch.point.dao.mapper.BstIvtPackageinfoivtMapper;
import org.nl.b_lms.sch.point.service.IbstIvtPackageinfoivtService;
@@ -58,6 +59,8 @@ public class BstIvtPackageinfoivtServiceImpl extends ServiceImpl<BstIvtPackagein
private BstIvtPackageinfoivtMapper bstIvtPackageinfoivtMapper;
@Resource
private IbstIvtPackageinfoivtService packageinfoivtService;
@Resource
private IpdmBiSubpackagerelationService subpackagerelationService;
/**
@@ -545,6 +548,9 @@ public class BstIvtPackageinfoivtServiceImpl extends ServiceImpl<BstIvtPackagein
result.put("message", "子卷号或子卷品质为空");
return result;
}
subpackagerelationService.createSubTest(whereJson);
//"有子卷","2","合格品","3","管制品","4"
BstIvtPackageinfoivt dto = bstIvtPackageinfoivtMapper.selectOne(new LambdaQueryWrapper<BstIvtPackageinfoivt>().eq(BstIvtPackageinfoivt::getContainer_name, whereJson.getString("container_name")));
if (dto == null) {

View File

@@ -16,6 +16,7 @@ import org.nl.common.utils.IdUtil;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.wql.util.SpringContextHolder;
import org.nl.system.service.param.ISysParamService;
import org.nl.wms.ext.mes.service.LmsToMesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
@@ -40,6 +41,9 @@ public class BstIvtBoxinfoServiceImpl extends ServiceImpl<BstIvtBoxinfoMapper, B
@Autowired
private ISysParamService iSysParamService;
@Autowired
private LmsToMesService lmsToMesService;
@Override
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
@@ -100,7 +104,7 @@ public class BstIvtBoxinfoServiceImpl extends ServiceImpl<BstIvtBoxinfoMapper, B
}else {
boxDao.setBox_high(whereJson.getString("Height"));
boxDao.setBox_length(whereJson.getString("Length"));
boxDao.setBox_length(whereJson.getString("Width"));
boxDao.setBox_width(whereJson.getString("Width"));
this.updateById(boxDao);
}
@@ -119,6 +123,8 @@ public class BstIvtBoxinfoServiceImpl extends ServiceImpl<BstIvtBoxinfoMapper, B
@Override
public JSONObject saveBoxInfo(JSONObject jsonObject) {
//从MES获取包装关系
lmsToMesService.momGetPackingInfo(jsonObject);
String boxNo = jsonObject.getString("box_no");
String box_weight = jsonObject.getString("box_weight");
BstIvtBoxinfo boxinfo = bstIvtBoxinfoMapper.selectOne(new LambdaQueryWrapper<BstIvtBoxinfo>().eq(BstIvtBoxinfo::getBox_no, boxNo));

View File

@@ -189,6 +189,14 @@ public class InBoxManageServiceImpl implements InBoxManageService {
String box_no = whereJson.getString("box_no");
String[] split = box_no.split(",");
String boxType = "";
for (int i = 0; i < split.length; i++) {
String boxNO = split[i];
JSONObject jo = new JSONObject();
jo.put("box_no", boxNO);
lmsToMesService.momGetPackingInfo(jo);
}
for (int i = 0; i < split.length; i++) {
String boxNo = split[i];
BstIvtBoxinfo boxinfo = iBstIvtBoxinfoService.getOne(
@@ -204,13 +212,6 @@ public class InBoxManageServiceImpl implements InBoxManageService {
}
for (int i = 0; i < split.length; i++) {
String boxNO = split[i];
JSONObject jo = new JSONObject();
jo.put("box_No", boxNO);
lmsToMesService.momGetPackingInfo(jo);
}
//查询对应的木箱信息
// 查询木箱信息
BstIvtBoxinfo boxDao = iBstIvtBoxinfoService.getOne(