dev:改切出库支持多条明细推送,幅宽精度显示优化

This commit is contained in:
2023-10-08 17:46:14 +08:00
parent 29a4c41723
commit b3f59428ee
8 changed files with 103 additions and 61 deletions

View File

@@ -29,8 +29,8 @@ public class SapToLmsServiceImpl implements SapToLmsService {
@Override
public JSONObject getReCutInfo(JSONObject jo) {
log.info("getReCutInfo的输入参数为------------------------" + jo.toString());
public JSONObject getReCutInfo(JSONObject json) {
log.info("getReCutInfo的输入参数为------------------------" + json.toString());
JSONObject jsonMst = new JSONObject();
@@ -38,7 +38,8 @@ public class SapToLmsServiceImpl implements SapToLmsService {
String msg = "改切出库单据推送成功!";
try {
String LGORT = jo.getString("LGORT");
JSONArray dtl_ja = json.getJSONArray("ITEM");
String LGORT = dtl_ja.getJSONObject(0).getString("LGORT");
JSONObject stor_jo = WQLObject.getWQLObject("ST_IVT_BSRealStorAttr").query("ext_id = '" + LGORT + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(stor_jo)) {
result.put("RTYPE", "E");
@@ -51,7 +52,7 @@ public class SapToLmsServiceImpl implements SapToLmsService {
jsonMst.put("stor_id", stor_jo.getString("stor_id"));
jsonMst.put("stor_code", stor_jo.getString("stor_code"));
jsonMst.put("stor_name", stor_jo.getString("stor_name"));
jsonMst.put("detail_count", "1");
jsonMst.put("detail_count", dtl_ja.size());
jsonMst.put("bill_status", "10");
jsonMst.put("create_mode", "03");
jsonMst.put("bill_type", "1003");
@@ -59,49 +60,55 @@ public class SapToLmsServiceImpl implements SapToLmsService {
jsonMst.put("user", "sap");
JSONArray dtls = new JSONArray();
String sap_pcsn = jo.getString("CHARG");
if (StrUtil.isEmpty("sap_pcsn")) {
throw new BadRequestException("请求参数SAP批次不能为空!");
}
JSONObject sub_jo = WQLObject.getWQLObject("PDM_BI_SubPackageRelation").query("sap_pcsn = '" + sap_pcsn + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(sub_jo)) {
throw new BadRequestException("LMS中不存在SAP批次为【" + sap_pcsn + "】的包装关系");
}
String container_name = sub_jo.getString("container_name");
JSONObject struct_ivt = WQLObject.getWQLObject("st_ivt_structivt").query("pcsn = '" + container_name + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(struct_ivt)) {
throw new BadRequestException("SAP批次为【" + sap_pcsn + "】的成品卷不存在或已经出库!");
} else {
if (struct_ivt.getDoubleValue("frozen_qty") > 0) {
msg = "SAP批次为【" + sap_pcsn + "】的成品卷已经被分配或出库中";
}else {
JSONObject dtl = new JSONObject();
//查询该物料
JSONObject mater_jo = WQLObject.getWQLObject("md_me_materialbase").query("material_code = '" + sub_jo.getString("product_name") + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(mater_jo)) {
throw new BadRequestException("未查询到物料:" + sub_jo.getString("product_name") + ",信息!");
}
dtl.put("material_id", mater_jo.getString("material_id"));
dtl.put("pcsn", container_name);
dtl.put("box_no", sub_jo.getString("package_box_sn"));
JSONObject unit = WQLObject.getWQLObject("md_pb_measureunit").query("measure_unit_id = '" + mater_jo.getString("base_unit_id") + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(unit)) {
throw new BadRequestException("未查询到物料计量单位:" + mater_jo.getString("base_unit_id") + ",信息!");
}
dtl.put("qty_unit_id", unit.getString("measure_unit_id"));
dtl.put("qty_unit_name", unit.getString("unit_name"));
dtl.put("plan_qty", sub_jo.getString("net_weight"));
dtls.add(dtl);
jsonMst.put("tableData", dtls);
String iostorinv_id = checkOutBillService.insertDtl(jsonMst);
//调用自动分配
JSONObject out_jo = new JSONObject();
out_jo.put("iostorinv_id", iostorinv_id);
checkOutBillService.allDiv(out_jo);
for (int i = 0; i < dtl_ja.size(); i++) {
JSONObject jo = dtl_ja.getJSONObject(i);
String sap_pcsn = jo.getString("CHARG");
if (StrUtil.isEmpty("sap_pcsn")) {
throw new BadRequestException("请求参数SAP批次不能为空!");
}
JSONObject sub_jo = WQLObject.getWQLObject("PDM_BI_SubPackageRelation").query("sap_pcsn = '" + sap_pcsn + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(sub_jo)) {
throw new BadRequestException("LMS中不存在SAP批次为【" + sap_pcsn + "】的包装关系");
}
String container_name = sub_jo.getString("container_name");
JSONObject struct_ivt = WQLObject.getWQLObject("st_ivt_structivt").query("pcsn = '" + container_name + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(struct_ivt)) {
throw new BadRequestException("SAP批次为【" + sap_pcsn + "】的成品卷不存在或已经出库!");
} else {
if (struct_ivt.getDoubleValue("frozen_qty") > 0) {
msg = "SAP批次为【" + sap_pcsn + "】的成品卷已经被分配或出库中";
} else {
JSONObject dtl = new JSONObject();
//查询该物料
JSONObject mater_jo = WQLObject.getWQLObject("md_me_materialbase").query("material_code = '" + sub_jo.getString("product_name") + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(mater_jo)) {
throw new BadRequestException("未查询到物料:" + sub_jo.getString("product_name") + ",信息!");
}
dtl.put("material_id", mater_jo.getString("material_id"));
dtl.put("pcsn", container_name);
dtl.put("box_no", sub_jo.getString("package_box_sn"));
JSONObject unit = WQLObject.getWQLObject("md_pb_measureunit").query("measure_unit_id = '" + mater_jo.getString("base_unit_id") + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(unit)) {
throw new BadRequestException("未查询到物料计量单位:" + mater_jo.getString("base_unit_id") + ",信息!");
}
dtl.put("qty_unit_id", unit.getString("measure_unit_id"));
dtl.put("qty_unit_name", unit.getString("unit_name"));
dtl.put("plan_qty", sub_jo.getString("net_weight"));
dtls.add(dtl);
}
}
}
if (!dtls.isEmpty()){
jsonMst.put("tableData", dtls);
String iostorinv_id = checkOutBillService.insertDtl(jsonMst);
//调用自动分配
JSONObject out_jo = new JSONObject();
out_jo.put("iostorinv_id", iostorinv_id);
checkOutBillService.allDiv(out_jo);
}else {
throw new BadRequestException("推送失败SAP推送的子卷明细不符合出库状态");
}
} catch (Exception exception) {
result.put("TYPE", "E");
@@ -498,10 +505,12 @@ public class SapToLmsServiceImpl implements SapToLmsService {
JSONObject jsonDtl = new JSONObject();
JSONObject jsonMater = materTab.query("material_code = '" + jsonObject.getString("MATNR") + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonMater)) throw new BadRequestException("此物料不存在" + jsonObject.getString("MATNR"));
if (ObjectUtil.isEmpty(jsonMater))
throw new BadRequestException("此物料不存在" + jsonObject.getString("MATNR"));
JSONObject jsonUnit = unitTab.query("measure_unit_id = '" + jsonMater.getString("base_unit_id") + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonObject.getString("KALAB"))) throw new BadRequestException("调拨数量不能为空!");
if (ObjectUtil.isEmpty(jsonObject.getString("KALAB")))
throw new BadRequestException("调拨数量不能为空!");
if (ObjectUtil.isEmpty(jsonObject.getString("ZVBELN"))) throw new BadRequestException("订单不能为空!");
jsonDtl.put("material_id", jsonMater.getString("material_id"));

View File

@@ -125,7 +125,7 @@ public class ProductInstorServiceImpl implements ProductInstorService {
mst_jo.put("tableData", box_rows);
mst_jo.put("biz_date", DateUtil.now());
RLock lock = redissonClient.getLock("pda_ioIn:" + option);
RLock lock = redissonClient.getLock("pda_ioIn");
boolean tryLock = lock.tryLock(5, TimeUnit.SECONDS);
try {
if (tryLock) {

View File

@@ -50,7 +50,7 @@ public class SlittingproductionplanDto implements Serializable {
private String split_group;
/** 生产顺序 */
private BigDecimal manufacture_sort;
private String manufacture_sort;
/** 生产订单 */
private String mfg_order_name;
@@ -138,4 +138,7 @@ public class SlittingproductionplanDto implements Serializable {
/** 气涨轴编码 */
private String qzzno;
/** 销售订单及行号 */
private String sale_order_name;
}

View File

@@ -184,7 +184,7 @@ public class OutBillQueryServiceImpl implements OutBillQueryService {
mp.put("发货客户名称", json.getString("customer_description"));
mp.put("销售订单", json.getString("sale_order_name"));
mp.put("出库日期", json.getString("input_time"));
mp.put("产品规格", json.getString("width"));
mp.put("产品规格", String.format("%.0f", json.getDoubleValue("width")));
mp.put("产品厚度", json.getString("thickness"));
mp.put("单位面积", json.getString("mass_per_unit_area"));
mp.put("制单人", json.getString("input_optname"));
@@ -247,7 +247,7 @@ public class OutBillQueryServiceImpl implements OutBillQueryService {
mp.put("发货客户名称", json.getString("customer_description"));
mp.put("销售订单", json.getString("sale_order_name"));
mp.put("出库日期", json.getString("input_time"));
mp.put("产品规格", json.getIntValue("width"));
mp.put("产品规格", String.format("%.0f", json.getDoubleValue("width")));
mp.put("产品厚度", json.getString("thickness"));
mp.put("单位面积", json.getString("mass_per_unit_area"));
mp.put("制单人", json.getString("input_optname"));