From f8e0ea20d9deafed4a805e7062e40da18d227a23 Mon Sep 17 00:00:00 2001 From: zds <2388969634@qq.com> Date: Wed, 13 Aug 2025 17:53:51 +0800 Subject: [PATCH] =?UTF-8?q?opt:=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sap/service/impl/SapToLmsServiceImpl.java | 41 +++++++++++-------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/ext/sap/service/impl/SapToLmsServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/ext/sap/service/impl/SapToLmsServiceImpl.java index 94d1e18..33bddb6 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/ext/sap/service/impl/SapToLmsServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/ext/sap/service/impl/SapToLmsServiceImpl.java @@ -6,8 +6,11 @@ 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; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.nl.b_lms.pdm.subpackagerelation.dao.PdmBiSubpackagerelation; +import org.nl.b_lms.pdm.subpackagerelation.dao.mapper.PdmBiSubpackagerelationMapper; import org.nl.b_lms.storage_manage.ios.enums.IOSEnum; import org.nl.b_lms.storage_manage.ios.service.iostorInv.IStIvtIostorinvOutService; import org.nl.common.utils.CodeUtil; @@ -27,6 +30,8 @@ import java.util.stream.Collectors; @RequiredArgsConstructor @Slf4j public class SapToLmsServiceImpl implements SapToLmsService { + @Resource + private PdmBiSubpackagerelationMapper pdmBiSubpackagerelationMapper; private final RecutPlanService recutPlanService; @@ -522,15 +527,14 @@ public class SapToLmsServiceImpl implements SapToLmsService { * "SaleOrderItem": "销售订单号-行号", * "PackageBoxSN": "包装箱号", * "isRePrintPackageBoxLabel": "是否需要重打外包装标签", - * "isUnPackBox": "是否需要拆包重打子卷标签", + * "isUnPackBox": "是否需要拆包重打子卷标签",` * "UpdatedDateOfProduction": "更改后的制造完成日期" * } * ] - * } + * }` */ log.info("inventoryTransferInfoSync接口输入参数为:-------------------" + param.toString()); JSONObject result = new JSONObject(); - WQLObject pdm_bi_subpackagerelation = WQLObject.getWQLObject("pdm_bi_subpackagerelation"); WQLObject st_ivt_structattr = WQLObject.getWQLObject("st_ivt_structattr"); WQLObject st_ivt_bsrealstorattr = WQLObject.getWQLObject("st_ivt_bsrealstorattr"); WQLObject st_ivt_structivt = WQLObject.getWQLObject("st_ivt_structivt"); @@ -597,23 +601,24 @@ public class SapToLmsServiceImpl implements SapToLmsService { String isUnPackBox = row.getString("isUnPackBox"); String UpdatedDateOfProduction = row.getString("UpdatedDateOfProduction"); //查询该木箱内子卷数量 - JSONArray container_rows = pdm_bi_subpackagerelation.query("package_box_sn = '" + PackageBoxSN + "'").getResultJSONArray(0); + List container_rows = pdmBiSubpackagerelationMapper + .selectList(new LambdaQueryWrapper().eq(PdmBiSubpackagerelation::getPackage_box_sn, PackageBoxSN)); for (int j = 0; j < container_rows.size(); j++) { - JSONObject container_row = container_rows.getJSONObject(j); + PdmBiSubpackagerelation container_row = container_rows.get(j); JSONObject change_jo = new JSONObject(); change_jo.put("seq_no", detail_count + 1); - JSONObject structivt = st_ivt_structivt.query("pcsn = '" + container_row.getString("container_name") + "'").uniqueResult(0); + JSONObject structivt = st_ivt_structivt.query("pcsn = '" + container_row.getContainer_name() + "'").uniqueResult(0); if (ObjectUtil.isEmpty(structivt)) { - throw new BadRequestException("子卷库存不存在:" + container_row.getString("container_name")); + throw new BadRequestException("子卷库存不存在:" + container_row.getContainer_name()); } change_jo.put("pcsn", structivt.getString("pcsn")); - change_jo.put("quality_scode", structivt.getString("pcsn")); + change_jo.put("quality_scode", structivt.getString("quality_scode")); change_jo.put("material_id", structivt.getString("material_id")); change_jo.put("qty_unit_id", structivt.getString("qty_unit_id")); change_jo.put("plan_qty", structivt.getString("ivt_qty")); change_jo.put("source_bill_code", SaleOrderItem); - change_jo.put("box_no", container_row.getString("package_box_sn")); - change_jo.put("width", container_row.getString("width")); + change_jo.put("box_no", container_row.getPackage_box_sn()); + change_jo.put("width", container_row.getWidth()); JSONObject param_jo = new JSONObject(); param_jo.put("isRePrintPackageBoxLabel", isRePrintPackageBoxLabel); @@ -623,14 +628,14 @@ public class SapToLmsServiceImpl implements SapToLmsService { param_jo.put("bill_type", IOSEnum.OUT_TYPE.code("转单出库")); change_jo.put("remark",param_jo); //更新包装关系 - container_row.put("sale_order_name",SaleOrderItem); - container_row.put("customer_name",CustomerName); - container_row.put("isRePrintPackageBoxLabel",isRePrintPackageBoxLabel); - container_row.put("isUnPackBox",isUnPackBox); - container_row.put("date_of_production",UpdatedDateOfProduction); + container_row.setSale_order_name(SaleOrderItem); + container_row.setCustomer_name(CustomerName); + container_row.setIsRePrintPackageBoxLabel(isRePrintPackageBoxLabel); + container_row.setIsUnPackBox(isUnPackBox); + container_row.setDate_of_production(UpdatedDateOfProduction); JSONObject cust = md_cs_customerbase.query("cust_code = '" + CustomerName + "' and is_delete='0'").uniqueResult(0); - container_row.put("customer_name",cust.getString("cust_name")); - pdm_bi_subpackagerelation.update(container_row); + container_row.setCustomer_description(cust.getString("cust_name")); + pdmBiSubpackagerelationMapper.updateById(container_row); tableData.add(change_jo); total_qty += structivt.getDoubleValue("ivt_qty"); @@ -659,10 +664,12 @@ public class SapToLmsServiceImpl implements SapToLmsService { mst_jo.put("update_optname", nickName); mst_jo.put("update_time", now); mst_jo.put("user","sap"); + mst_jo.put("tableData",tableData); //新增 String id = iStIvtIostorinvOutService.insertMst(mst_jo); JSONObject div_jo = new JSONObject(); div_jo.put("iostorinv_id",id); + div_jo.put("div_type","1"); //全部分配 iStIvtIostorinvOutService.allDiv(div_jo); }