修改
This commit is contained in:
@@ -104,7 +104,7 @@ public class GenCodeServiceImpl implements GenCodeService {
|
|||||||
//如果flag=1就执行更新数据库的操作
|
//如果flag=1就执行更新数据库的操作
|
||||||
String flag = (String) form.get("flag");
|
String flag = (String) form.get("flag");
|
||||||
WQLObject wo = WQLObject.getWQLObject("sys_code_rule_detail");
|
WQLObject wo = WQLObject.getWQLObject("sys_code_rule_detail");
|
||||||
JSONArray ja = wo.query("code_rule_id = '" + id + "' FOR UPDATE").getResultJSONArray(0);
|
JSONArray ja = wo.query("code_rule_id = '" + id + "' order by sort_num FOR UPDATE").getResultJSONArray(0);
|
||||||
String demo = "";
|
String demo = "";
|
||||||
boolean is_same = true;
|
boolean is_same = true;
|
||||||
for (int i = 0; i < ja.size(); i++) {
|
for (int i = 0; i < ja.size(); i++) {
|
||||||
|
|||||||
@@ -28,8 +28,8 @@ public class SapToLmsController {
|
|||||||
@PostMapping("/getMaterialInfo")
|
@PostMapping("/getMaterialInfo")
|
||||||
@Log("SAP给LMS推送物料信息")
|
@Log("SAP给LMS推送物料信息")
|
||||||
@ApiOperation("SAP给LMS推送物料信息")
|
@ApiOperation("SAP给LMS推送物料信息")
|
||||||
public ResponseEntity<Object> getMaterialInfo(@RequestBody JSONArray rows) {
|
public ResponseEntity<Object> getMaterialInfo(@RequestBody JSONObject jo) {
|
||||||
return new ResponseEntity<>(sapToLmsService.getMaterialInfo(rows), HttpStatus.OK);
|
return new ResponseEntity<>(sapToLmsService.getMaterialInfo(jo), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SaIgnore
|
@SaIgnore
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ public interface SapToLmsService {
|
|||||||
/*
|
/*
|
||||||
* 获取物料信息
|
* 获取物料信息
|
||||||
* */
|
* */
|
||||||
JSONObject getMaterialInfo(JSONArray rows);
|
JSONObject getMaterialInfo(JSONObject jo);
|
||||||
/*
|
/*
|
||||||
* 获取交货单信息
|
* 获取交货单信息
|
||||||
* */
|
* */
|
||||||
|
|||||||
@@ -49,14 +49,12 @@ public class LmsToSapServiceImpl implements LmsToSapService {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
JSONArray list = new JSONArray();
|
|
||||||
|
|
||||||
// String url = acsUrl + api;
|
// String url = acsUrl + api;
|
||||||
String url = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("SAP_URL").getValue();
|
String url = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("SAP_URL").getValue();
|
||||||
String api = "";
|
String api = "";
|
||||||
url = url + api;
|
url = url + "/sap/center/wms/004";
|
||||||
try {
|
try {
|
||||||
String resultMsg = HttpRequest.post(url)
|
String resultMsg = HttpRequest.post(url).header("TOKEN","FA163EE139D41EED9286BB7E1A2F8D4C")
|
||||||
.body(String.valueOf(jo))
|
.body(String.valueOf(jo))
|
||||||
.execute().body();
|
.execute().body();
|
||||||
result = JSONObject.parseObject(resultMsg);
|
result = JSONObject.parseObject(resultMsg);
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package org.nl.wms.ext.sap.service.impl;
|
package org.nl.wms.ext.sap.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
@@ -13,9 +14,12 @@ import org.nl.wms.ext.sap.service.SapToLmsService;
|
|||||||
import org.nl.wms.log.LokiLog;
|
import org.nl.wms.log.LokiLog;
|
||||||
import org.nl.wms.log.LokiLogType;
|
import org.nl.wms.log.LokiLogType;
|
||||||
import org.nl.wms.st.inbill.service.CheckOutBillService;
|
import org.nl.wms.st.inbill.service.CheckOutBillService;
|
||||||
import org.nl.wms.st.outbill.service.impl.CheckOutBillServiceImpl;
|
import org.nl.wms.st.inbill.service.RawAssistIStorService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@@ -23,21 +27,36 @@ public class SapToLmsServiceImpl implements SapToLmsService {
|
|||||||
|
|
||||||
private final CheckOutBillService checkOutBillService;
|
private final CheckOutBillService checkOutBillService;
|
||||||
|
|
||||||
|
private final RawAssistIStorService rawAssistIStorService;
|
||||||
|
|
||||||
@LokiLog(type = LokiLogType.SAP_TO_LMS)
|
@LokiLog(type = LokiLogType.SAP_TO_LMS)
|
||||||
@Override
|
@Override
|
||||||
public JSONObject getMaterialInfo(JSONArray rows) {
|
public JSONObject getMaterialInfo(JSONObject jo) {
|
||||||
if (ObjectUtil.isEmpty(rows)) {
|
JSONArray rows = jo.getJSONArray("DATAS");
|
||||||
throw new BadRequestException("物料信息为空!");
|
|
||||||
}
|
|
||||||
log.info("getMaterialInfo的输入参数为:------------------------" + rows.toString());
|
log.info("getMaterialInfo的输入参数为:------------------------" + rows.toString());
|
||||||
|
JSONObject result = new JSONObject();
|
||||||
|
try {
|
||||||
for (int i = 0; i < rows.size(); i++) {
|
for (int i = 0; i < rows.size(); i++) {
|
||||||
JSONObject row = rows.getJSONObject(i);
|
JSONObject row = rows.getJSONObject(i);
|
||||||
|
String MATNR = row.getString("MATNR");
|
||||||
|
if (StrUtil.isEmpty(MATNR)){
|
||||||
|
throw new BadRequestException("物料编码不能为空!");
|
||||||
}
|
}
|
||||||
JSONObject jo = new JSONObject();
|
JSONObject mater_jo = WQLObject.getWQLObject("md_me_materialbaseext").query("MATNR ='"+MATNR+"'").uniqueResult(0);
|
||||||
jo.put("msg", "推送成功!");
|
if (ObjectUtil.isEmpty(mater_jo)){
|
||||||
jo.put("code", "1");
|
WQLObject.getWQLObject("md_me_materialbaseext").insert(row);
|
||||||
return jo;
|
}else {
|
||||||
|
WQLObject.getWQLObject("md_me_materialbaseext").update(row);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception exception) {
|
||||||
|
result.put("RTYPE", "E");
|
||||||
|
result.put("RTMSG", "操作失败!" + exception.getMessage());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
result.put("TYPE", "S");
|
||||||
|
result.put("MESSAGE", "物料同步成功!");
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@LokiLog(type = LokiLogType.SAP_TO_LMS)
|
@LokiLog(type = LokiLogType.SAP_TO_LMS)
|
||||||
@@ -63,6 +82,7 @@ public class SapToLmsServiceImpl implements SapToLmsService {
|
|||||||
jsonMst.put("user", "sap");
|
jsonMst.put("user", "sap");
|
||||||
|
|
||||||
JSONArray tableData = new JSONArray();
|
JSONArray tableData = new JSONArray();
|
||||||
|
ArrayList<HashMap> box_rows = new ArrayList<>();
|
||||||
|
|
||||||
String lfart = "";
|
String lfart = "";
|
||||||
for (int i = 0; i < item.size(); i++) {
|
for (int i = 0; i < item.size(); i++) {
|
||||||
@@ -82,7 +102,8 @@ public class SapToLmsServiceImpl implements SapToLmsService {
|
|||||||
|
|
||||||
// 明细
|
// 明细
|
||||||
JSONObject jsonMater = materTab.query("material_code = '" + json.getString("MATNR") + "'").uniqueResult(0);
|
JSONObject jsonMater = materTab.query("material_code = '" + json.getString("MATNR") + "'").uniqueResult(0);
|
||||||
if (ObjectUtil.isEmpty(jsonMater)) throw new BadRequestException("此物料不存在"+json.getString("MATNR"));
|
if (ObjectUtil.isEmpty(jsonMater))
|
||||||
|
throw new BadRequestException("此物料不存在" + json.getString("MATNR"));
|
||||||
JSONObject jsonUnit = unitTab.query("measure_unit_id = '" + jsonMater.getString("base_unit_id") + "'").uniqueResult(0);
|
JSONObject jsonUnit = unitTab.query("measure_unit_id = '" + jsonMater.getString("base_unit_id") + "'").uniqueResult(0);
|
||||||
|
|
||||||
jsonDtl.put("material_id", jsonMater.getString("material_id"));
|
jsonDtl.put("material_id", jsonMater.getString("material_id"));
|
||||||
@@ -94,28 +115,110 @@ public class SapToLmsServiceImpl implements SapToLmsService {
|
|||||||
jsonDtl.put("posnr", json.getString("POSNR")); // 来源交货单行
|
jsonDtl.put("posnr", json.getString("POSNR")); // 来源交货单行
|
||||||
tableData.add(jsonDtl);
|
tableData.add(jsonDtl);
|
||||||
}
|
}
|
||||||
|
if (StrUtil.equals(lfart, "ZLR")) {
|
||||||
|
HashMap map = new HashMap();
|
||||||
|
//更新包装关系
|
||||||
|
String sap_pcsn = json.getString("CHARG");
|
||||||
|
if (StrUtil.isEmpty(sap_pcsn)) {
|
||||||
|
throw new BadRequestException("批次不能为空!");
|
||||||
}
|
}
|
||||||
jsonMst.put("tableData", tableData);
|
String package_box_sn = json.getString("ZZJXH");
|
||||||
|
if (StrUtil.isEmpty(package_box_sn)) {
|
||||||
|
throw new BadRequestException("箱号不能为空!");
|
||||||
|
}
|
||||||
|
String sale_order_name = json.getString("VGBEL-VGPOS");
|
||||||
|
if (StrUtil.isEmpty(sale_order_name)) {
|
||||||
|
throw new BadRequestException("销售订单及行号不能为空!");
|
||||||
|
}
|
||||||
|
String length = json.getString("ZZJCD");
|
||||||
|
if (StrUtil.isEmpty(length)) {
|
||||||
|
throw new BadRequestException("子卷长度不能为空!");
|
||||||
|
}
|
||||||
|
String width = json.getString("HL02");
|
||||||
|
if (StrUtil.isEmpty(width)) {
|
||||||
|
throw new BadRequestException("子卷幅宽不能为空!");
|
||||||
|
}
|
||||||
|
// 明细
|
||||||
|
JSONObject jsonMater = materTab.query("material_code = '" + json.getString("MATNR") + "'").uniqueResult(0);
|
||||||
|
if (ObjectUtil.isEmpty(jsonMater)) {
|
||||||
|
throw new BadRequestException("此物料不存在" + json.getString("MATNR"));
|
||||||
|
}
|
||||||
|
|
||||||
|
JSONObject sub_jo = WQLObject.getWQLObject("PDM_BI_SubPackageRelation").query("sap_pcsn = '" + sap_pcsn + "'").uniqueResult(0);
|
||||||
|
if (ObjectUtil.isEmpty(sub_jo)) {
|
||||||
|
//为空新增一条
|
||||||
|
sub_jo = new JSONObject();
|
||||||
|
sub_jo.put("workorder_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||||
|
sub_jo.put("package_box_sn", package_box_sn);
|
||||||
|
sub_jo.put("quanlity_in_box", 1);
|
||||||
|
sub_jo.put("sale_order_name", sale_order_name);
|
||||||
|
sub_jo.put("customer_name", json.getString("KUNNR"));
|
||||||
|
sub_jo.put("customer_description", json.getString("NAMEM"));
|
||||||
|
sub_jo.put("product_name", json.getString("MATNR"));
|
||||||
|
sub_jo.put("product_description", jsonMater.getString("material_name"));
|
||||||
|
sub_jo.put("container_name", sap_pcsn);
|
||||||
|
sub_jo.put("width", width);
|
||||||
|
sub_jo.put("net_weight", json.getString("LFIMG"));
|
||||||
|
sub_jo.put("length", length);
|
||||||
|
sub_jo.put("is_un_plan_production", 0);
|
||||||
|
sub_jo.put("create_id", 0);
|
||||||
|
sub_jo.put("create_name", 0);
|
||||||
|
sub_jo.put("create_time", 0);
|
||||||
|
sub_jo.put("status", "0");
|
||||||
|
sub_jo.put("sap_pcsn", sap_pcsn);
|
||||||
|
WQLObject.getWQLObject("PDM_BI_SubPackageRelation").insert(sub_jo);
|
||||||
|
} else {
|
||||||
|
//不为空修改子卷包装关系
|
||||||
|
sub_jo.put("vbeln", json.getString("VBELN"));
|
||||||
|
sub_jo.put("posnr", json.getString("POSNR"));
|
||||||
|
sub_jo.put("package_box_sn", package_box_sn);
|
||||||
|
sub_jo.put("width", width);
|
||||||
|
sub_jo.put("length", length);
|
||||||
|
sub_jo.put("status", "0");
|
||||||
|
WQLObject.getWQLObject("PDM_BI_SubPackageRelation").update(sub_jo);
|
||||||
|
}
|
||||||
|
|
||||||
|
map.put("container_name", sub_jo.getString("container_name"));
|
||||||
|
map.put("net_weight", sub_jo.getString("net_weight"));
|
||||||
|
map.put("package_box_sn", sub_jo.getString("package_box_sn"));
|
||||||
|
map.put("product_name", sub_jo.getString("product_name"));
|
||||||
|
map.put("product_name", sub_jo.getString("product_name"));
|
||||||
|
map.put("vbeln", json.getString("VBELN"));
|
||||||
|
map.put("posnr", json.getString("POSNR"));
|
||||||
|
box_rows.add(map);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (StrUtil.equals(lfart, "ZLF")) {
|
if (StrUtil.equals(lfart, "ZLF")) {
|
||||||
|
jsonMst.put("tableData", tableData);
|
||||||
// 调用出库新增并分配
|
// 调用出库新增并分配
|
||||||
String iostorinv_id = checkOutBillService.insertDtl(jsonMst);
|
String iostorinv_id = checkOutBillService.insertDtl(jsonMst);
|
||||||
JSONObject jsonObject = new JSONObject();
|
JSONObject jsonObject = new JSONObject();
|
||||||
jsonObject.put("iostorinv_id", iostorinv_id);
|
jsonObject.put("iostorinv_id", iostorinv_id);
|
||||||
//checkOutBillService.allDiv(jsonObject);
|
//checkOutBillService.allDiv(jsonObject);
|
||||||
|
}
|
||||||
result.put("RTYPE", "S");
|
if (StrUtil.equals(lfart, "ZLR")) {
|
||||||
result.put("RTMSG", "操作成功!");
|
jsonMst.put("tableData", box_rows);
|
||||||
result.put("RTOAL", 1);
|
//创建退货入库单
|
||||||
result.put("RTDAT", null);
|
jsonMst.put("bill_type", "0002");
|
||||||
|
jsonMst.put("biz_date", DateUtil.now());
|
||||||
|
JSONObject stor = WQLObject.getWQLObject("st_ivt_bsrealstorattr").query("is_delete = '0' AND is_used = '1' AND is_productstore = '1'").uniqueResult(0);
|
||||||
|
jsonMst.put("stor_id", stor.getString("stor_id"));
|
||||||
|
jsonMst.put("bill_status", "10");
|
||||||
|
rawAssistIStorService.insertDtl(jsonMst);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
result.put("RTYPE", "E");
|
result.put("RTYPE", "E");
|
||||||
result.put("RTMSG", "操作失败!" + e.getMessage());
|
result.put("RTMSG", "操作失败!" + e.getMessage());
|
||||||
result.put("RTOAL", 1);
|
result.put("RTOAL", 1);
|
||||||
result.put("RTDAT", null);
|
result.put("RTDAT", null);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
result.put("RTYPE", "S");
|
||||||
|
result.put("RTMSG", "操作成功!");
|
||||||
|
result.put("RTOAL", 1);
|
||||||
|
result.put("RTDAT", null);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package org.nl.wms.pda.st.service.impl;
|
|||||||
|
|
||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
@@ -55,11 +56,17 @@ public class ProductInstorServiceImpl implements ProductInstorService {
|
|||||||
map.put("flag", "1");
|
map.put("flag", "1");
|
||||||
//如果是报废入库要查询对应的报废出库
|
//如果是报废入库要查询对应的报废出库
|
||||||
rows = WQL.getWO("PDA_ST_01").addParamMap(map).process().getResultJSONArray(0);
|
rows = WQL.getWO("PDA_ST_01").addParamMap(map).process().getResultJSONArray(0);
|
||||||
} else {
|
}
|
||||||
|
if (option.equals("2")) {
|
||||||
map.put("flag", "2");
|
map.put("flag", "2");
|
||||||
//查询状态为生成的子卷包装关系对应表
|
//查询状态为生成的子卷包装关系对应表
|
||||||
rows = WQL.getWO("PDA_ST_01").addParamMap(map).process().getResultJSONArray(0);
|
rows = WQL.getWO("PDA_ST_01").addParamMap(map).process().getResultJSONArray(0);
|
||||||
}
|
}
|
||||||
|
if (option.equals("3")) {
|
||||||
|
map.put("flag", "4");
|
||||||
|
//查询状态为生成的子卷包装关系对应表
|
||||||
|
rows = WQL.getWO("PDA_ST_01").addParamMap(map).process().getResultJSONArray(0);
|
||||||
|
}
|
||||||
|
|
||||||
JSONObject jo = new JSONObject();
|
JSONObject jo = new JSONObject();
|
||||||
jo.put("data", rows);
|
jo.put("data", rows);
|
||||||
@@ -80,7 +87,7 @@ public class ProductInstorServiceImpl implements ProductInstorService {
|
|||||||
|
|
||||||
HashMap<String, String> map = new HashMap<>();
|
HashMap<String, String> map = new HashMap<>();
|
||||||
map.put("box_no", box_no);
|
map.put("box_no", box_no);
|
||||||
if (option.equals("1")) {
|
if (option.equals("3")) {
|
||||||
HashMap<String, String> sub_map = new HashMap<>();
|
HashMap<String, String> sub_map = new HashMap<>();
|
||||||
sub_map.put("box_type", material_code);
|
sub_map.put("box_type", material_code);
|
||||||
//如果是退货入库要更新子卷包装关系的木箱料号
|
//如果是退货入库要更新子卷包装关系的木箱料号
|
||||||
@@ -108,13 +115,21 @@ public class ProductInstorServiceImpl implements ProductInstorService {
|
|||||||
mst_jo.put("stor_id", stor.getString("stor_id"));
|
mst_jo.put("stor_id", stor.getString("stor_id"));
|
||||||
mst_jo.put("detail_count", box_rows.size());
|
mst_jo.put("detail_count", box_rows.size());
|
||||||
mst_jo.put("total_qty", "0");
|
mst_jo.put("total_qty", "0");
|
||||||
mst_jo.put("bill_status", "10");
|
mst_jo.put("bill_status", "30");
|
||||||
String iostorinv_id = rawAssistIStorService.insertDtl(mst_jo);
|
String iostorinv_id = "";
|
||||||
|
if (!option.equals("3")) {
|
||||||
|
iostorinv_id = rawAssistIStorService.insertDtl(mst_jo);
|
||||||
|
} else {
|
||||||
|
//查询该木箱所在的未完成的入库单
|
||||||
|
JSONObject box_mst_jo = WQLObject.getWQLObject("ST_IVT_IOStorInvDtl").query("box_no = '" + box_no + "' AND bill_status <'99'").uniqueResult(0);
|
||||||
|
iostorinv_id = box_mst_jo.getString("iostorinv_id");
|
||||||
|
}
|
||||||
|
|
||||||
//判断是否虚拟
|
//判断是否虚拟
|
||||||
if (!is_virtual.equals("1")) {
|
if (!is_virtual.equals("1")) {
|
||||||
//创建二楼去一楼的任务
|
//创建二楼去一楼的任务
|
||||||
} else {
|
} else {
|
||||||
|
String task_id = IdUtil.getSnowflake(1, 1).nextId() + "";
|
||||||
//直接分配虚拟区货位,并确认
|
//直接分配虚拟区货位,并确认
|
||||||
JSONObject struct = WQL.getWO("PDA_ST_01").addParam("flag", "3").process().uniqueResult(0);
|
JSONObject struct = WQL.getWO("PDA_ST_01").addParam("flag", "3").process().uniqueResult(0);
|
||||||
|
|
||||||
@@ -126,9 +141,10 @@ public class ProductInstorServiceImpl implements ProductInstorService {
|
|||||||
dis_map.put("struct_code", struct.getString("struct_code"));
|
dis_map.put("struct_code", struct.getString("struct_code"));
|
||||||
dis_map.put("struct_name", struct.getString("struct_name"));
|
dis_map.put("struct_name", struct.getString("struct_name"));
|
||||||
dis_map.put("work_status", "01");
|
dis_map.put("work_status", "01");
|
||||||
dis_map.put("task_id", iostorinv_id);
|
dis_map.put("task_id", task_id);
|
||||||
|
|
||||||
WQLObject.getWQLObject("ST_IVT_IOStorInvDis").update(dis_map, "iostorinv_id = '" + iostorinv_id + "'");
|
//更新该木箱明细对应的分配
|
||||||
|
WQLObject.getWQLObject("ST_IVT_IOStorInvDis").update(dis_map, "iostorinv_id = '" + iostorinv_id + "' AND box_no = '"+box_no+"'");
|
||||||
|
|
||||||
//修改库存
|
//修改库存
|
||||||
//直接取出入库分配表的库存
|
//直接取出入库分配表的库存
|
||||||
@@ -174,7 +190,7 @@ public class ProductInstorServiceImpl implements ProductInstorService {
|
|||||||
//调用入库分配确认方法
|
//调用入库分配确认方法
|
||||||
InbillServiceImpl inbillService = SpringContextHolder.getBean(InbillServiceImpl.class);
|
InbillServiceImpl inbillService = SpringContextHolder.getBean(InbillServiceImpl.class);
|
||||||
JSONObject dis_form = new JSONObject();
|
JSONObject dis_form = new JSONObject();
|
||||||
dis_form.put("task_id", iostorinv_id);
|
dis_form.put("task_id", task_id);
|
||||||
inbillService.confirmDis(dis_form);
|
inbillService.confirmDis(dis_form);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,7 +77,7 @@
|
|||||||
ENDQUERY
|
ENDQUERY
|
||||||
ENDIF
|
ENDIF
|
||||||
|
|
||||||
IF 输入.flag = "2"
|
IF 输入.flag = "4"
|
||||||
QUERY
|
QUERY
|
||||||
SELECT
|
SELECT
|
||||||
package_box_SN,
|
package_box_SN,
|
||||||
@@ -88,7 +88,7 @@
|
|||||||
FROM
|
FROM
|
||||||
pdm_bi_subpackagerelation sub
|
pdm_bi_subpackagerelation sub
|
||||||
WHERE
|
WHERE
|
||||||
sub.status = '0'
|
sub.status = '1'
|
||||||
AND
|
AND
|
||||||
sub.package_box_SN = 输入.box_no
|
sub.package_box_SN = 输入.box_no
|
||||||
ENDSELECT
|
ENDSELECT
|
||||||
|
|||||||
Binary file not shown.
@@ -134,7 +134,7 @@ public class InbillServiceImpl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//更新目的点位,仓位、加库存
|
//更新目的点位,仓位、加库存
|
||||||
JSONArray dis_rows = dis_table.query("iostorinv_id = '" + iostorinv_id + "' AND work_status < '99'").getResultJSONArray(0);
|
JSONArray dis_rows = dis_table.query("iostorinv_id = '" + iostorinv_id + "'").getResultJSONArray(0);
|
||||||
for (int i = 0; i < dis_rows.size(); i++) {
|
for (int i = 0; i < dis_rows.size(); i++) {
|
||||||
JSONObject dis_row = dis_rows.getJSONObject(i);
|
JSONObject dis_row = dis_rows.getJSONObject(i);
|
||||||
JSONObject point_form = new JSONObject();
|
JSONObject point_form = new JSONObject();
|
||||||
|
|||||||
@@ -172,6 +172,16 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
|
|||||||
row.put("plan_qty", row.get("net_weight"));
|
row.put("plan_qty", row.get("net_weight"));
|
||||||
row.put("box_no", row.get("package_box_sn"));
|
row.put("box_no", row.get("package_box_sn"));
|
||||||
|
|
||||||
|
/*//如果是退货入库,查询对应的包装关系维护交货单号和交货单行号
|
||||||
|
if (whereJson.get("bill_type").equals("0002")) {
|
||||||
|
JSONObject sub_jo = WQLObject.getWQLObject("pdm_bi_subpackagerelation").query("container_name = '" + row.get("container_name") + "'").uniqueResult(0);
|
||||||
|
if (ObjectUtil.isEmpty(sub_jo)) {
|
||||||
|
throw new BadRequestException("未查询到对应的子卷包装关系!");
|
||||||
|
}
|
||||||
|
row.put("vbeln", sub_jo.getString("vbeln"));
|
||||||
|
row.put("posnr", sub_jo.getString("posnr"));
|
||||||
|
}*/
|
||||||
|
|
||||||
WQLObject.getWQLObject("ST_IVT_IOStorInvDtl").insert(row);
|
WQLObject.getWQLObject("ST_IVT_IOStorInvDtl").insert(row);
|
||||||
|
|
||||||
JSONObject dis = new JSONObject();
|
JSONObject dis = new JSONObject();
|
||||||
@@ -184,8 +194,8 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
|
|||||||
dis.put("box_no", row.get("box_no"));
|
dis.put("box_no", row.get("box_no"));
|
||||||
dis.put("quality_scode", row.get("quality_scode"));
|
dis.put("quality_scode", row.get("quality_scode"));
|
||||||
dis.put("work_status", "00");
|
dis.put("work_status", "00");
|
||||||
dis.put("qty_unit_id", "1");
|
dis.put("qty_unit_id", material.getString("base_unit_id"));
|
||||||
dis.put("qty_unit_name", "KG");
|
dis.put("qty_unit_name", unit.getString("unit_name"));
|
||||||
dis.put("plan_qty", row.get("plan_qty"));
|
dis.put("plan_qty", row.get("plan_qty"));
|
||||||
WQLObject.getWQLObject("ST_IVT_IOStorInvDis").insert(dis);
|
WQLObject.getWQLObject("ST_IVT_IOStorInvDis").insert(dis);
|
||||||
|
|
||||||
@@ -403,7 +413,8 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
|
|||||||
boolean is_virtual = false;
|
boolean is_virtual = false;
|
||||||
if (sect_jo.getString("sect_type_attr").equals("09")) {
|
if (sect_jo.getString("sect_type_attr").equals("09")) {
|
||||||
is_virtual = true;
|
is_virtual = true;
|
||||||
dis_map.put("task_id", map.get("iostorinv_id"));
|
String task_id = IdUtil.getSnowflake(1, 1).nextId()+"";
|
||||||
|
dis_map.put("task_id", task_id);
|
||||||
dis_map.put("work_status", "01");
|
dis_map.put("work_status", "01");
|
||||||
}
|
}
|
||||||
if (StrUtil.isNotEmpty(ios_dis.getString("point_id")) && !is_virtual) {
|
if (StrUtil.isNotEmpty(ios_dis.getString("point_id")) && !is_virtual) {
|
||||||
@@ -506,7 +517,7 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
|
|||||||
//如果是虚拟区,直接更新完成分配任务
|
//如果是虚拟区,直接更新完成分配任务
|
||||||
if (is_virtual) {
|
if (is_virtual) {
|
||||||
JSONObject dis_form = new JSONObject();
|
JSONObject dis_form = new JSONObject();
|
||||||
dis_form.put("task_id", map.get("iostorinv_id"));
|
dis_form.put("task_id", dis_map.get("task_id"));
|
||||||
inbillService.confirmDis(dis_form);
|
inbillService.confirmDis(dis_form);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ public class InAndOutReturnlController {
|
|||||||
@PostMapping("/uploadMES")
|
@PostMapping("/uploadMES")
|
||||||
@Log("回传MES")
|
@Log("回传MES")
|
||||||
@ApiOperation("回传MES")
|
@ApiOperation("回传MES")
|
||||||
public ResponseEntity<Object> uploadMES(@RequestBody Map whereJson) {
|
public ResponseEntity<Object> uploadMES(@RequestBody JSONObject whereJson) {
|
||||||
inAndOutReturnService.uploadMES(whereJson);
|
inAndOutReturnService.uploadMES(whereJson);
|
||||||
return new ResponseEntity<>(HttpStatus.OK);
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
}
|
}
|
||||||
@@ -49,7 +49,7 @@ public class InAndOutReturnlController {
|
|||||||
@PostMapping("/uploadSAP")
|
@PostMapping("/uploadSAP")
|
||||||
@Log("回传SAP")
|
@Log("回传SAP")
|
||||||
@ApiOperation("回传SAP")
|
@ApiOperation("回传SAP")
|
||||||
public ResponseEntity<Object> uploadSAP(@RequestBody Map whereJson) {
|
public ResponseEntity<Object> uploadSAP(@RequestBody JSONObject whereJson) {
|
||||||
inAndOutReturnService.uploadSAP(whereJson);
|
inAndOutReturnService.uploadSAP(whereJson);
|
||||||
return new ResponseEntity<>(HttpStatus.OK);
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ public interface InAndOutReturnService {
|
|||||||
|
|
||||||
void uploadMES(Map whereJson);
|
void uploadMES(Map whereJson);
|
||||||
|
|
||||||
void uploadSAP(Map whereJson);
|
void uploadSAP(JSONObject whereJson);
|
||||||
|
|
||||||
void disupload(Map whereJson);
|
void disupload(Map whereJson);
|
||||||
|
|
||||||
|
|||||||
@@ -57,7 +57,87 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void uploadSAP(Map whereJson) {
|
public void uploadSAP(JSONObject whereJson) {
|
||||||
|
//出库分配表
|
||||||
|
WQLObject wo_dis = WQLObject.getWQLObject("ST_IVT_IOStorInvDis");
|
||||||
|
//出库明细表
|
||||||
|
WQLObject wo_dtl = WQLObject.getWQLObject("ST_IVT_IOStorInvDtl");
|
||||||
|
//出库主表
|
||||||
|
WQLObject wo_mst = WQLObject.getWQLObject("ST_IVT_IOStorInv");
|
||||||
|
// 物料表
|
||||||
|
WQLObject materTab = WQLObject.getWQLObject("md_me_materialbase");
|
||||||
|
// 库区表
|
||||||
|
WQLObject sectTab = WQLObject.getWQLObject("st_ivt_sectattr");
|
||||||
|
// 子卷包装关系表
|
||||||
|
WQLObject subTab = WQLObject.getWQLObject("pdm_bi_subpackagerelation");
|
||||||
|
|
||||||
|
JSONArray rows = whereJson.getJSONArray("rows");
|
||||||
|
for (int i = 0; i < rows.size(); i++) {
|
||||||
|
JSONObject jo_mst = rows.getJSONObject(i);
|
||||||
|
String isUpload = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("is_upload").getValue();
|
||||||
|
if (StrUtil.equals(isUpload, "1")) {
|
||||||
|
String bill_type = jo_mst.getString("bill_type");
|
||||||
|
//退货入库
|
||||||
|
if (StrUtil.equals(bill_type, "0002")) {
|
||||||
|
// 1.回传sap
|
||||||
|
JSONArray paramSapMstArr = new JSONArray();
|
||||||
|
|
||||||
|
JSONObject paramSapMst = new JSONObject();
|
||||||
|
paramSapMst.put("ZACTION", "P");
|
||||||
|
paramSapMst.put("BUDAT", jo_mst.getString("biz_date"));
|
||||||
|
|
||||||
|
JSONArray paramDtlArr = new JSONArray();
|
||||||
|
JSONArray dtlArr = wo_dtl.query("iostorinv_id = '" + jo_mst.getString("iostorinv_id") + "'").getResultJSONArray(0);
|
||||||
|
for (int k = 0; k < dtlArr.size(); k++) {
|
||||||
|
JSONArray paramDisArr = new JSONArray();
|
||||||
|
JSONObject json = dtlArr.getJSONObject(k);
|
||||||
|
JSONObject jsonMater = materTab.query("material_id = '" + json.getString("material_id") + "'").uniqueResult(0);
|
||||||
|
|
||||||
|
// 明细
|
||||||
|
JSONObject jsonDtl = new JSONObject();
|
||||||
|
jsonDtl.put("VBELN", json.getString("vbeln")); // 交货
|
||||||
|
paramSapMst.put("VBELN", json.getString("vbeln")); // 主表交货
|
||||||
|
jsonDtl.put("POSNR", json.getString("posnr")); // 项目
|
||||||
|
jsonDtl.put("MATNR", jsonMater.getString("material_code"));
|
||||||
|
|
||||||
|
// 分配明细
|
||||||
|
JSONArray disArr = wo_dis.query("iostorinvdtl_id = '" + json.getString("iostorinvdtl_id") + "'").getResultJSONArray(0);
|
||||||
|
for (int j = 0; j < disArr.size(); j++) {
|
||||||
|
JSONObject json2 = disArr.getJSONObject(j);
|
||||||
|
JSONObject jsonDis = new JSONObject();
|
||||||
|
|
||||||
|
JSONObject jsonSect = sectTab.query("sect_id = '" + json2.getString("sect_id") + "'").uniqueResult(0);
|
||||||
|
if (ObjectUtil.isNotEmpty(jsonSect)) {
|
||||||
|
jsonDtl.put("LGORT", jsonSect.getString("ext_id")); // 明細储存地点
|
||||||
|
}
|
||||||
|
|
||||||
|
JSONObject jsonSub = subTab.query("container_name = '" + json2.getString("pcsn") + "'").uniqueResult(0);
|
||||||
|
if (ObjectUtil.isNotEmpty(jsonSect)) {
|
||||||
|
jsonDis.put("CHARG", jsonSub.getString("sap_pcsn")); // sap批次
|
||||||
|
}
|
||||||
|
jsonDis.put("VBELN", json.getString("vbeln")); // 交货
|
||||||
|
jsonDis.put("POSNR", json.getString("posnr")); // 项目
|
||||||
|
jsonDis.put("LFIMG", json2.getString("real_qty"));
|
||||||
|
jsonDis.put("VRKME", json.getString("qty_unit_name"));
|
||||||
|
jsonDis.put("PIKMG", json2.getString("real_qty"));
|
||||||
|
jsonDis.put("VRKMP", json2.getString("qty_unit_name"));
|
||||||
|
paramDisArr.add(jsonDis);
|
||||||
|
}
|
||||||
|
jsonDtl.put("CHARG_T", paramDisArr);
|
||||||
|
paramDtlArr.add(jsonDtl);
|
||||||
|
}
|
||||||
|
paramSapMst.put("ITEM", paramDtlArr);
|
||||||
|
paramSapMstArr.add(paramSapMst);
|
||||||
|
|
||||||
|
JSONObject param = new JSONObject();
|
||||||
|
param.put("HEAD", paramSapMstArr);
|
||||||
|
// System.out.println(param.toString());
|
||||||
|
|
||||||
|
// 调用接口回传
|
||||||
|
new LmsToSapServiceImpl().returnDelivery(param);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
@@ -94,6 +174,94 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService {
|
|||||||
//1.回传MES
|
//1.回传MES
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//退货入库
|
||||||
|
if (StrUtil.equals(bill_type, "0002")) {
|
||||||
|
// 1.回传sap
|
||||||
|
JSONArray paramSapMstArr = new JSONArray();
|
||||||
|
|
||||||
|
JSONObject paramSapMst = new JSONObject();
|
||||||
|
paramSapMst.put("ZACTION", "P");
|
||||||
|
paramSapMst.put("BUDAT", jo_mst.getString("biz_date"));
|
||||||
|
|
||||||
|
JSONArray paramDtlArr = new JSONArray();
|
||||||
|
JSONArray dtlArr = wo_dtl.query("iostorinv_id = '" + jo_mst.getString("iostorinv_id") + "'").getResultJSONArray(0);
|
||||||
|
for (int k = 0; k < dtlArr.size(); k++) {
|
||||||
|
JSONArray paramDisArr = new JSONArray();
|
||||||
|
JSONObject json = dtlArr.getJSONObject(k);
|
||||||
|
JSONObject jsonMater = materTab.query("material_id = '" + json.getString("material_id") + "'").uniqueResult(0);
|
||||||
|
|
||||||
|
// 明细
|
||||||
|
JSONObject jsonDtl = new JSONObject();
|
||||||
|
jsonDtl.put("VBELN", json.getString("vbeln")); // 交货
|
||||||
|
paramSapMst.put("VBELN", json.getString("vbeln")); // 主表交货
|
||||||
|
jsonDtl.put("POSNR", json.getString("posnr")); // 项目
|
||||||
|
jsonDtl.put("MATNR", jsonMater.getString("material_code"));
|
||||||
|
|
||||||
|
// 分配明细
|
||||||
|
JSONArray disArr = wo_dis.query("iostorinvdtl_id = '" + json.getString("iostorinvdtl_id") + "'").getResultJSONArray(0);
|
||||||
|
for (int j = 0; j < disArr.size(); j++) {
|
||||||
|
JSONObject json2 = disArr.getJSONObject(j);
|
||||||
|
JSONObject jsonDis = new JSONObject();
|
||||||
|
|
||||||
|
JSONObject jsonSect = sectTab.query("sect_id = '" + json2.getString("sect_id") + "'").uniqueResult(0);
|
||||||
|
if (ObjectUtil.isNotEmpty(jsonSect)) {
|
||||||
|
jsonDtl.put("LGORT", jsonSect.getString("ext_id")); // 明細储存地点
|
||||||
|
}
|
||||||
|
|
||||||
|
JSONObject jsonSub = subTab.query("container_name = '" + json2.getString("pcsn") + "'").uniqueResult(0);
|
||||||
|
if (ObjectUtil.isNotEmpty(jsonSect)) {
|
||||||
|
jsonDis.put("CHARG", jsonSub.getString("sap_pcsn")); // sap批次
|
||||||
|
}
|
||||||
|
jsonDis.put("VBELN", json.getString("vbeln")); // 交货
|
||||||
|
jsonDis.put("POSNR", json.getString("posnr")); // 项目
|
||||||
|
jsonDis.put("LFIMG", json2.getString("real_qty"));
|
||||||
|
jsonDis.put("VRKME", json.getString("qty_unit_name"));
|
||||||
|
jsonDis.put("PIKMG", json2.getString("real_qty"));
|
||||||
|
jsonDis.put("VRKMP", json2.getString("qty_unit_name"));
|
||||||
|
paramDisArr.add(jsonDis);
|
||||||
|
}
|
||||||
|
jsonDtl.put("CHARG_T", paramDisArr);
|
||||||
|
paramDtlArr.add(jsonDtl);
|
||||||
|
}
|
||||||
|
paramSapMst.put("ITEM", paramDtlArr);
|
||||||
|
paramSapMstArr.add(paramSapMst);
|
||||||
|
|
||||||
|
JSONObject param = new JSONObject();
|
||||||
|
param.put("HEAD", paramSapMstArr);
|
||||||
|
// System.out.println(param.toString());
|
||||||
|
|
||||||
|
// 调用接口回传
|
||||||
|
new LmsToSapServiceImpl().returnDelivery(param);
|
||||||
|
|
||||||
|
// 2.回传mes
|
||||||
|
JSONObject paramMesMst = new JSONObject();
|
||||||
|
String userName = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("MES_USERNAME").getValue();
|
||||||
|
String passWord = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("MES_PASSWORD").getValue();
|
||||||
|
|
||||||
|
paramMesMst.put("UserName", userName);
|
||||||
|
paramMesMst.put("Password", passWord);
|
||||||
|
paramMesMst.put("OutboundOrderNum", jo_mst.getString("bill_code"));
|
||||||
|
paramMesMst.put("OutboundUser", jo_mst.getString("confirm_optname"));
|
||||||
|
paramMesMst.put("OutboundTime", jo_mst.getString("confirm_time"));
|
||||||
|
|
||||||
|
JSONArray boxArr = WQL.getWO("ST_OUTIVT02").addParam("flag", "2")
|
||||||
|
.addParam("iostorinv_id", jo_mst.getString("iostorinv_id"))
|
||||||
|
.process().getResultJSONArray(0);
|
||||||
|
|
||||||
|
JSONArray paramArr = new JSONArray();
|
||||||
|
for (int j = 0; j < boxArr.size(); j++) {
|
||||||
|
JSONObject json = boxArr.getJSONObject(j);
|
||||||
|
JSONObject jsonBox = new JSONObject();
|
||||||
|
|
||||||
|
jsonBox.put("PackageBoxSN", json.getString("num"));
|
||||||
|
paramArr.add(jsonBox);
|
||||||
|
}
|
||||||
|
paramMesMst.put("item", paramArr);
|
||||||
|
|
||||||
|
// 调用接口回传
|
||||||
|
new LmsToMesServiceImpl().childRollFGOutboundComplete(paramMesMst);
|
||||||
|
}
|
||||||
// 销售出库
|
// 销售出库
|
||||||
if (StrUtil.equals(bill_type, "1001")) {
|
if (StrUtil.equals(bill_type, "1001")) {
|
||||||
// 1.回传sap
|
// 1.回传sap
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ https://juejin.cn/post/6844903775631572999
|
|||||||
<springProfile name="dev">
|
<springProfile name="dev">
|
||||||
<root level="debug">
|
<root level="debug">
|
||||||
<appender-ref ref="CONSOLE"/>
|
<appender-ref ref="CONSOLE"/>
|
||||||
|
<appender-ref ref="asyncFileAppender"/>
|
||||||
<appender-ref ref="lokiAppender" />
|
<appender-ref ref="lokiAppender" />
|
||||||
</root>
|
</root>
|
||||||
<logger name="org.springframework" level="ERROR" additivity="false">
|
<logger name="org.springframework" level="ERROR" additivity="false">
|
||||||
|
|||||||
@@ -32,9 +32,17 @@ export function upload(data) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function upload2(data) {
|
export function uploadSAP(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/api/inandoutreturn/upload2',
|
url: '/api/inandoutreturn/uploadSAP',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function uploadMES(data) {
|
||||||
|
return request({
|
||||||
|
url: '/api/inandoutreturn/uploadSAP',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data
|
data
|
||||||
})
|
})
|
||||||
@@ -56,4 +64,4 @@ export function getType(data) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export default { add, edit, del, upload, upload2, disupload, getType }
|
export default { add, edit, del, upload, uploadMES, uploadSAP, disupload, getType }
|
||||||
|
|||||||
@@ -380,7 +380,7 @@ export default {
|
|||||||
this.fullscreenLoading = true
|
this.fullscreenLoading = true
|
||||||
const data = {}
|
const data = {}
|
||||||
data.rows = res
|
data.rows = res
|
||||||
inandoutreturn.disupload(data).then(res => {
|
inandoutreturn.uploadSAP(data).then(res => {
|
||||||
this.fullscreenLoading = false
|
this.fullscreenLoading = false
|
||||||
this.crud.notify('操作成功!', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
this.crud.notify('操作成功!', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||||
this.crud.toQuery()
|
this.crud.toQuery()
|
||||||
@@ -397,7 +397,7 @@ export default {
|
|||||||
this.fullscreenLoading = true
|
this.fullscreenLoading = true
|
||||||
const data = {}
|
const data = {}
|
||||||
data.rows = res
|
data.rows = res
|
||||||
inandoutreturn.disupload(data).then(res => {
|
inandoutreturn.uploadMES(data).then(res => {
|
||||||
this.fullscreenLoading = false
|
this.fullscreenLoading = false
|
||||||
this.crud.notify('操作成功!', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
this.crud.notify('操作成功!', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||||
this.crud.toQuery()
|
this.crud.toQuery()
|
||||||
|
|||||||
Reference in New Issue
Block a user