转工单
This commit is contained in:
parent
0699dc27f5
commit
19136f60e0
@ -6707,7 +6707,6 @@ public class ToSAPServiceImpl {
|
|||||||
sendData.put("HEAD", header);
|
sendData.put("HEAD", header);
|
||||||
JSONObject body = new JSONObject(true);
|
JSONObject body = new JSONObject(true);
|
||||||
sendData.put("BODY", body);
|
sendData.put("BODY", body);
|
||||||
JSONArray itemArray = new JSONArray();
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
HEAD
|
HEAD
|
||||||
@ -6740,37 +6739,10 @@ public class ToSAPServiceImpl {
|
|||||||
}
|
}
|
||||||
for (Map<String, Object> mm : mapList) {
|
for (Map<String, Object> mm : mapList) {
|
||||||
mm.put("BWART", bwart);
|
mm.put("BWART", bwart);
|
||||||
JSONObject item = new JSONObject(true);
|
|
||||||
/*if(materialPackingList.size()>0) {
|
|
||||||
// MATNR 发货物料号
|
|
||||||
item.put("MATNR", mm.getMATNR());
|
|
||||||
|
|
||||||
// WERKS 发货工厂
|
|
||||||
item.put("WERKS", mm.getWERKS());
|
|
||||||
// LGORT 发货库存地点
|
|
||||||
item.put("LGORT", mm.getLGORT());
|
|
||||||
//MENGE 数量
|
|
||||||
item.put("MENGE",mm.getMENGE());
|
|
||||||
//MENGE 单位
|
|
||||||
item.put("MEINS",mm.getMEINS());
|
|
||||||
item.put("BWART", bwart);
|
|
||||||
//ZLLORDER 自定义领料单号
|
|
||||||
// item.put("ZLLORDER", "LL1010250408001");
|
|
||||||
item.put("ZLLORDER", mm.getZLLORDER());
|
|
||||||
//ZLLITEM 自定义领料单行号
|
|
||||||
|
|
||||||
// item.put("ZLLITEM", "0001");
|
|
||||||
item.put("ZLLITEM", mm.getZLLITEM());
|
|
||||||
//AUFNR 订单号
|
|
||||||
item.put("AUFNR", mm.getAUFNR());
|
|
||||||
|
|
||||||
}
|
|
||||||
itemArray.add(item);*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println(mapList);
|
|
||||||
log.info("SendTOSAP >>>>" + sendData);
|
log.info("SendTOSAP >>>>" + sendData);
|
||||||
/*String sendDatas = sendData.toJSONString();
|
String sendDatas = sendData.toJSONString();
|
||||||
String sapreturn = toSAPMessageUtil.sendHttpPost(toSAPMessageUtil.materialChangeLocationUrl, "", sendDatas);
|
String sapreturn = toSAPMessageUtil.sendHttpPost(toSAPMessageUtil.materialChangeLocationUrl, "", sendDatas);
|
||||||
org.json.JSONObject receiveJsonObject = new org.json.JSONObject(sapreturn);
|
org.json.JSONObject receiveJsonObject = new org.json.JSONObject(sapreturn);
|
||||||
org.json.JSONObject returnJsonObject = (org.json.JSONObject) receiveJsonObject.get("RETURN");
|
org.json.JSONObject returnJsonObject = (org.json.JSONObject) receiveJsonObject.get("RETURN");
|
||||||
@ -6782,24 +6754,28 @@ public class ToSAPServiceImpl {
|
|||||||
}
|
}
|
||||||
//将log写到表里
|
//将log写到表里
|
||||||
ErpMessageLog erplog = new ErpMessageLog();
|
ErpMessageLog erplog = new ErpMessageLog();
|
||||||
erplog.setEventUser("");
|
erplog.setEventUser(mes);
|
||||||
erplog.setServerName("WmsToErp");
|
erplog.setServerName("WmsToErp");
|
||||||
erplog.setEventName("MES物料消耗261和转工单");
|
if ("261".equals(bwart)) {
|
||||||
|
erplog.setEventName("转工单-入库");
|
||||||
|
} else {
|
||||||
|
erplog.setEventName("转工单-出库");
|
||||||
|
}
|
||||||
erplog.setInterfaceTime(TimeStampUtil.getCurrentTime(TimeStampUtil.FORMAT_DEFAULT));
|
erplog.setInterfaceTime(TimeStampUtil.getCurrentTime(TimeStampUtil.FORMAT_DEFAULT));
|
||||||
erplog.setMessageId(UUID.randomUUID().toString());
|
erplog.setMessageId(UUID.randomUUID().toString());
|
||||||
erplog.setSendMsg(sendData.toJSONString());
|
erplog.setSendMsg(sendData.toJSONString());
|
||||||
erplog.setSendMsg2(sendData.toJSONString());
|
erplog.setSendMsg2(sendData.toJSONString());
|
||||||
erplog.setReturnMsg2(sapreturn);
|
erplog.setReturnMsg2(sapreturn);
|
||||||
erplog.setResultCode(rcode);
|
erplog.setResultCode(rcode);
|
||||||
MessageLogUtil.writeMessageLog(erplog);*/
|
MessageLogUtil.writeMessageLog(erplog);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.info(e.getMessage(), e);
|
log.info(e.getMessage(), e);
|
||||||
// throw new RuntimeException("SAP返回" + e.toString());
|
throw new RuntimeException("SAP返回" + e.toString());
|
||||||
}
|
}
|
||||||
/* if (!"S".equals(rcode)) {
|
if (!"S".equals(rcode)) {
|
||||||
throw new RuntimeException("SAP返回" + rmsg);
|
throw new RuntimeException("SAP返回" + rmsg);
|
||||||
}*/
|
}
|
||||||
return null;
|
return undoId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -30,6 +30,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@ -666,24 +667,49 @@ public class MESToWMSServiceImpl implements MESToWMSService {
|
|||||||
log.info("Received work order request: {}", in.toJSONString());
|
log.info("Received work order request: {}", in.toJSONString());
|
||||||
List<Map<String, Object>> mapList = new ArrayList<>();
|
List<Map<String, Object>> mapList = new ArrayList<>();
|
||||||
for (int i = 0; i < in.size(); i++) {
|
for (int i = 0; i < in.size(); i++) {
|
||||||
|
String line = "第" + (i + 1) + "行,";
|
||||||
JSONObject jsonObject = in.getJSONObject(i);
|
JSONObject jsonObject = in.getJSONObject(i);
|
||||||
Map<String, Object> map = new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
// 料号
|
// 料号
|
||||||
String materialSpecname = jsonObject.getString("materialSpecname");
|
String materialSpecname = jsonObject.getString("materialSpecname");
|
||||||
|
if (StringUtils.isEmpty(materialSpecname)) {
|
||||||
|
return AjaxResult.me().setSuccess(false).setErrorCode(500).
|
||||||
|
setMessage(line + "料号-materialSpecname-不能为空");
|
||||||
|
}
|
||||||
// 组织
|
// 组织
|
||||||
String WERKS = jsonObject.getString("WERKS");
|
String WERKS = jsonObject.getString("WERKS");
|
||||||
|
if (StringUtils.isEmpty(WERKS)) {
|
||||||
|
return AjaxResult.me().setSuccess(false).setErrorCode(500).
|
||||||
|
setMessage(line + "组织-WERKS-不能为空");
|
||||||
|
}
|
||||||
// 仓库
|
// 仓库
|
||||||
String LGORT = jsonObject.getString("erpLocation");
|
String LGORT = jsonObject.getString("erpLocation");
|
||||||
|
if (StringUtils.isEmpty(LGORT)) {
|
||||||
|
return AjaxResult.me().setSuccess(false).setErrorCode(500).
|
||||||
|
setMessage(line + "仓库-erpLocation-不能为空");
|
||||||
|
}
|
||||||
|
if (StringUtils.isEmpty(jsonObject.getString("MENGE"))) {
|
||||||
|
return AjaxResult.me().setSuccess(false).setErrorCode(500).
|
||||||
|
setMessage(line + "数量-MENGE-不能为空");
|
||||||
|
}
|
||||||
// 数量
|
// 数量
|
||||||
String MENGE = jsonObject.getString("MENGE");
|
BigDecimal MENGE = new BigDecimal(jsonObject.getString("MENGE"));
|
||||||
// 单位
|
// 单位
|
||||||
String MEINS = jsonObject.getString("MEINS");
|
String MEINS = jsonObject.getString("MEINS");
|
||||||
|
if (StringUtils.isEmpty(MEINS)) {
|
||||||
|
return AjaxResult.me().setSuccess(false).setErrorCode(500).
|
||||||
|
setMessage(line + "单位-MEINS-不能为空");
|
||||||
|
}
|
||||||
// 自定义领料单号
|
// 自定义领料单号
|
||||||
String ZLLORDER = jsonObject.getString("ZLLORDER");
|
String ZLLORDER = jsonObject.getString("ZLLORDER");
|
||||||
// 自定义领料单行号
|
// 自定义领料单行号
|
||||||
String ZLLITEM = jsonObject.getString("ZLLITEM");
|
String ZLLITEM = jsonObject.getString("ZLLITEM");
|
||||||
// 工单
|
// 工单
|
||||||
String AUFNR = jsonObject.getString("toOrder");
|
String AUFNR = jsonObject.getString("toOrder");
|
||||||
|
if (StringUtils.isEmpty(AUFNR)) {
|
||||||
|
return AjaxResult.me().setSuccess(false).setErrorCode(500).
|
||||||
|
setMessage(line + "工单-toOrder-不能为空");
|
||||||
|
}
|
||||||
|
|
||||||
map.put("MATNR", materialSpecname);
|
map.put("MATNR", materialSpecname);
|
||||||
map.put("WERKS", WERKS);
|
map.put("WERKS", WERKS);
|
||||||
@ -696,10 +722,10 @@ public class MESToWMSServiceImpl implements MESToWMSService {
|
|||||||
mapList.add(map);
|
mapList.add(map);
|
||||||
}
|
}
|
||||||
// 出库
|
// 出库
|
||||||
// String undoidOut = toSAPService.StockOutByOrder_new(mapList, "MES", "262");
|
String undoidOut = toSAPService.StockOutByOrder_new(mapList, "MES", "262");
|
||||||
// 入库
|
// 入库
|
||||||
String undoidIn = toSAPService.StockOutByOrder_new(mapList, "MES", "261");
|
String undoidIn = toSAPService.StockOutByOrder_new(mapList, "MES", "261");
|
||||||
/*if (StringUtils.isEmpty(undoidIn)) {
|
if (StringUtils.isEmpty(undoidIn)) {
|
||||||
// 冲销
|
// 冲销
|
||||||
String undo = invoiceService.cancelShipInter(undoidOut, "MES");
|
String undo = invoiceService.cancelShipInter(undoidOut, "MES");
|
||||||
if (undo == null || undo.isEmpty()) {
|
if (undo == null || undo.isEmpty()) {
|
||||||
@ -707,7 +733,7 @@ public class MESToWMSServiceImpl implements MESToWMSService {
|
|||||||
} else {
|
} else {
|
||||||
throw new GlobalException("发送到mes失败!");
|
throw new GlobalException("发送到mes失败!");
|
||||||
}
|
}
|
||||||
}*/
|
}
|
||||||
return AjaxResult.me().setResultObj(null).setSuccess(true).setErrorCode(200).setMessage("执行成功,物料凭证 " + undoidIn);
|
return AjaxResult.me().setResultObj(null).setSuccess(true).setErrorCode(200).setMessage("执行成功,物料凭证 " + undoidIn);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user