opt:成品入库修改被注释的空木箱MES查询

This commit is contained in:
2024-07-07 14:21:07 +08:00
parent 59dace36a0
commit ac229c4823
4 changed files with 57 additions and 17 deletions

View File

@@ -178,6 +178,7 @@ public class VehicleTwoServiceImpl implements VehicleTwoService {
whereJson.put("bill_type", IOSEnum.IN_TYPE.code("改切入库"));
}
whereJson.put("box_no", whereJson.getString("box_no"));
JSONArray resultJSONArray = WQLObject.getWQLObject("pdm_bi_subpackagerelation").query("package_box_sn = '" + whereJson.getString("material_barcode") + "' AND status = '0'").getResultJSONArray(0);
if (ObjectUtil.isEmpty(resultJSONArray)) {
throw new BadRequestException("未查询到子卷包装信息!");

View File

@@ -94,7 +94,7 @@ public class AutoSendVehicleToKzj {
JSONObject task = new JSONObject();
boolean hasEmptyVehicle = true;
Optional<BstIvtPackageinfoivt> emptyList = kzjIvtList.stream()
.filter(n -> n.getIvt_status().equals(PackageInfoIvtEnum.IVT_STATUS.code("")))
.filter(n -> n.getIvt_status().equals(PackageInfoIvtEnum.IVT_STATUS.code("载具")))
.findFirst();
//判断点位外层是否有空载具
if (emptyList.isPresent()) {

View File

@@ -300,11 +300,11 @@ public class InBoxManageServiceImpl implements InBoxManageService {
@Override
public void returnIn(JSONObject whereJson) {
// 载具表
///api/twoPda/vehicle/returnIn
//api/twoPda/vehicle/returnIn
/*
* 查询mes木箱信息插入木箱信息表
*/
//lmsToMesService.momGetPackingInfo(whereJson);
lmsToMesService.momGetPackingInfo(whereJson);
//查询对应的木箱信息

View File

@@ -4,12 +4,11 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONAware;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import lombok.extern.log4j.Log4j;
import org.apache.commons.lang3.StringUtils;
import org.checkerframework.checker.units.qual.A;
import org.nl.b_lms.sch.task.dao.SchBaseTask;
import org.nl.b_lms.sch.task.service.IschBaseTaskService;
import org.nl.b_lms.storage_manage.database.service.IBstIvtBoxinfoService;
@@ -18,21 +17,18 @@ import org.nl.b_lms.storage_manage.ios.enums.IOSEnum;
import org.nl.b_lms.storage_manage.ios.service.iostorInv.IStIvtIostorinvService;
import org.nl.b_lms.storage_manage.ios.service.iostorInv.IStIvtIostorinvdisService;
import org.nl.b_lms.storage_manage.ios.service.iostorInv.IStIvtIostorinvdtlService;
import org.nl.b_lms.storage_manage.ios.service.iostorInv.dao.StIvtIostorinv;
import org.nl.b_lms.storage_manage.ios.service.iostorInv.dao.StIvtIostorinvdis;
import org.nl.b_lms.storage_manage.ios.service.iostorInv.dao.StIvtIostorinvdtl;
import org.nl.b_lms.storage_manage.ios.service.iostorInv.dao.mapper.StIvtIostorinvMapper;
import org.nl.b_lms.storage_manage.ios.service.iostorInv.util.service.InBussManageService;
import org.nl.common.utils.MapOf;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.wql.WQL;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.wms.sch.service.TaskService;
import org.nl.wms.ext.mes.service.LmsToMesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.lang.reflect.Array;
import java.util.*;
import java.util.stream.Collectors;
@@ -45,6 +41,7 @@ import java.util.stream.Collectors;
* @since 2023-11-10
*/
@Service
@Log4j
public class InBussManageServiceImpl implements InBussManageService {
@Autowired
@@ -65,6 +62,10 @@ public class InBussManageServiceImpl implements InBussManageService {
@Autowired
private IBstIvtBoxinfoService iBstIvtBoxinfoService;
@Autowired
private LmsToMesService lmsToMesService;
/**
* 不需要查询的排集合
*/
@@ -228,13 +229,15 @@ public class InBussManageServiceImpl implements InBussManageService {
public void inTask(JSONObject jsonObject) {
// 子卷包装关系表
WQLObject subTab = WQLObject.getWQLObject("pdm_bi_subpackagerelation");
// 载具扩展属性表
WQLObject veExtTab = WQLObject.getWQLObject("md_pb_storagevehicleext");
// 载具表
WQLObject vehicleTab = WQLObject.getWQLObject("MD_PB_StorageVehicleInfo");
// 处理子卷号
String material_barcode = jsonObject.getString("material_barcode");
if (ObjectUtil.isEmpty(material_barcode)) {
throw new BadRequestException("子卷号不能为空!");
}
if (ObjectUtil.isEmpty(jsonObject.getString("device_code"))) {
throw new BadRequestException("设备号不能为空!");
}
@@ -252,6 +255,47 @@ public class InBussManageServiceImpl implements InBussManageService {
new QueryWrapper<BstIvtBoxinfo>().lambda()
.eq(BstIvtBoxinfo::getBox_no, subList.get(0).getString("package_box_sn"))
);
String vehicleType;
if (boxDao != null) {
vehicleType = boxDao.getVehicle_type();
} else {
//查询mes木箱信息插入木箱信息表
try {
JSONObject jo = new JSONObject();
jo.put("box_no", subList.get(0).getString("package_box_sn"));
lmsToMesService.momGetPackingInfo(jo);
} catch (Exception ex) {
throw new BadRequestException("MES系统未查询到木箱信息!");
}
BstIvtBoxinfo boxDao1 = iBstIvtBoxinfoService.getOne(
new QueryWrapper<BstIvtBoxinfo>().lambda()
.eq(BstIvtBoxinfo::getBox_no, subList.get(0).getString("package_box_sn"))
);
vehicleType = boxDao1.getVehicle_type();
}
//处理托盘扩展信息
JSONObject jsonVehicle = vehicleTab.query("storagevehicle_code = '" + jsonObject.getString("vehicle_code") + "'")
.uniqueResult(0);
if (ObjectUtil.isEmpty(jsonVehicle)) {
throw new BadRequestException("载具不存在!");
}
JSONObject ext_jo = veExtTab.query("storagevehicle_code = '" + jsonVehicle.getString("storagevehicle_code") + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(ext_jo)) {
JSONObject jsonVeExt = new JSONObject();
jsonVeExt.put("storagevehicleext_id", org.nl.common.utils.IdUtil.getLongId());
jsonVeExt.put("storagevehicle_id", jsonVehicle.getLongValue("storagevehicle_id"));
jsonVeExt.put("storagevehicle_code", jsonVehicle.getString("storagevehicle_code"));
jsonVeExt.put("storagevehicle_type", jsonVehicle.getString("storagevehicle_type"));
jsonVeExt.put("pcsn", subList.get(0).getString("package_box_sn"));
jsonVeExt.put("device_uuid", org.nl.common.utils.IdUtil.getLongId());
jsonVeExt.put("update_time", DateUtil.now());
veExtTab.insert(jsonVeExt);
} else {
ext_jo.put("pcsn", subList.get(0).getString("package_box_sn"));
ext_jo.put("device_uuid", org.nl.common.utils.IdUtil.getLongId());
ext_jo.put("update_time", DateUtil.now());
veExtTab.update(ext_jo);
}
// 主表
JSONObject mst = new JSONObject();
mst.put("stor_id", IOSEnum.STOR_ID.code("二期"));
@@ -261,14 +305,11 @@ public class InBussManageServiceImpl implements InBussManageService {
mst.put("bill_type", jsonObject.getString("bill_type"));
mst.put("biz_date", DateUtil.today());
mst.put("remark", "");
// 明细
ArrayList<LinkedHashMap> tableData = new ArrayList<>();
for (int i = 0; i < subList.size(); i++) {
JSONObject json = subList.get(i);
LinkedHashMap<String, Object> jsonDtl = new LinkedHashMap<>();
jsonDtl.put("package_box_sn", json.getString("package_box_sn"));
jsonDtl.put("thickness", json.getString("thickness"));
jsonDtl.put("plan_qty", json.getString("net_weight"));
@@ -287,13 +328,11 @@ public class InBussManageServiceImpl implements InBussManageService {
tableData.add(jsonDtl);
}
mst.put("tableData", tableData);
// 判断是否已经生成过入库单
String package_box_sn = (String) tableData.get(0).get("package_box_sn");
JSONObject param = new JSONObject();
param.put("package_box_sn",package_box_sn);
JSONObject iosMst = stIvtIostorinvMapper.queryBoxMst(param);
String iostorinv_id;
if (ObjectUtil.isNotEmpty(iosMst)) {
iostorinv_id = iosMst.getString("iostorinv_id");
@@ -325,7 +364,7 @@ public class InBussManageServiceImpl implements InBussManageService {
jsonDiv.put("stor_id", IOSEnum.STOR_ID.code("二期"));
jsonDiv.put("material_barcode", jsonObject.getString("material_barcode"));
jsonDiv.put("vehicle_code", jsonObject.getString("vehicle_code"));
jsonDiv.put("vehicle_type", boxDao.getVehicle_type());
jsonDiv.put("vehicle_type", vehicleType);
iStIvtIostorinvService.divStruct(jsonDiv);
}