update meswms_ship_request接口修改,将MES调用WMS接口时传递的payMentDate字段放在WMS给SAP过账时的过账日期字段中
This commit is contained in:
parent
9e97a1da30
commit
55d841ebed
@ -448,7 +448,7 @@ public class ToSAPServiceImpl {
|
|||||||
return undoId;
|
return undoId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String FGStockIn3(String RECEIVEACTNO, String user, String stockInType) throws Exception {
|
public String FGStockIn3(String RECEIVEACTNO, String user, String stockInType,String payMentDate) throws Exception {
|
||||||
StringBuffer sql = new StringBuffer();
|
StringBuffer sql = new StringBuffer();
|
||||||
sql.append(SystemPropHelper.CR)
|
sql.append(SystemPropHelper.CR)
|
||||||
.append("SELECT m.MATERIALSPECNAME ,").append(SystemPropHelper.CR)
|
.append("SELECT m.MATERIALSPECNAME ,").append(SystemPropHelper.CR)
|
||||||
@ -471,7 +471,9 @@ public class ToSAPServiceImpl {
|
|||||||
hashMap.put("RECEIVEACTNO", RECEIVEACTNO);
|
hashMap.put("RECEIVEACTNO", RECEIVEACTNO);
|
||||||
hashMap.put("MATERIALSPECTYPE", stockInType);
|
hashMap.put("MATERIALSPECTYPE", stockInType);
|
||||||
List<Map<String, Object>> queryForList = IDMFrameServiceProxy.getSqlTemplate().queryForList(sql.toString(), hashMap);
|
List<Map<String, Object>> queryForList = IDMFrameServiceProxy.getSqlTemplate().queryForList(sql.toString(), hashMap);
|
||||||
String makeFGStockIn = makeFGStockIn(queryForList, user, RECEIVEACTNO);
|
//String makeFGStockIn = makeFGStockIn(queryForList, user, RECEIVEACTNO);
|
||||||
|
String makeFGStockIn = makeFGStockInPayMentDate(queryForList, user, RECEIVEACTNO,payMentDate);
|
||||||
|
|
||||||
String sapreturn = "";
|
String sapreturn = "";
|
||||||
String rcode = "";
|
String rcode = "";
|
||||||
String rmsg = "";
|
String rmsg = "";
|
||||||
@ -5788,4 +5790,208 @@ public class ToSAPServiceImpl {
|
|||||||
return undoId;
|
return undoId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 成品入库
|
||||||
|
*
|
||||||
|
* @param list
|
||||||
|
* @param eventUser
|
||||||
|
* @return
|
||||||
|
* @throws JsonMappingException
|
||||||
|
* @throws JsonProcessingException
|
||||||
|
*/
|
||||||
|
public String makeFGStockInPayMentDate(List<Map<String, Object>> list, String eventUser, String receiveRequestName, String payMentDate) throws JsonMappingException, JsonProcessingException {
|
||||||
|
|
||||||
|
if (list == null || list.size() < 1) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String,Object> bodyData = new HashMap<>();
|
||||||
|
List<Map<String,Object>> itemsData = new ArrayList<>();
|
||||||
|
|
||||||
|
for (Map<String, Object> mm : list) {
|
||||||
|
Map<String,Object> item = new HashMap<>();
|
||||||
|
//UMWRK 收货工厂
|
||||||
|
//LGORT 发货库存地点
|
||||||
|
//UMLOG 收货库存地点
|
||||||
|
//MATNR 发货物料号
|
||||||
|
//UMMAT 收货物料
|
||||||
|
|
||||||
|
item.put("MATNR", mm.get("MATERIALSPECNAME"));
|
||||||
|
item.put("LGORT", mm.get("ERPLOCATION"));
|
||||||
|
item.put("WERKS", mm.get("ERPFACTORY"));
|
||||||
|
|
||||||
|
// item.put("BWART", "531");
|
||||||
|
if("FG".equals((String)mm.get("MATERIALSPECTYPE")) ) {
|
||||||
|
item.put("BWART", "101"); //产成品,移动类型 101
|
||||||
|
}else if("BFG".equals((String)mm.get("MATERIALSPECTYPE")) ) {
|
||||||
|
item.put("BWART", "531"); //副产品, 移动类型 531
|
||||||
|
}else if("FGDEV".equals((String)mm.get("MATERIALSPECTYPE")) ) {
|
||||||
|
item.put("BWART", "511"); //研发品, 移动类型 511
|
||||||
|
}else {
|
||||||
|
item.put("BWART", "101"); //为了兼容之前的未提到的成品,统一暂用 101
|
||||||
|
}
|
||||||
|
|
||||||
|
item.put("MENGE", mm.get("MATERIALQUANTITY"));
|
||||||
|
item.put("MEINS", mm.get("UNIT"));
|
||||||
|
item.put("AUFNR", mm.get("PRODUCTORDER"));
|
||||||
|
item.put("BPMNG", "");
|
||||||
|
item.put("BPRME", "");
|
||||||
|
item.put("SGTXT", mm.get("REMARK"));
|
||||||
|
String insmk = "";
|
||||||
|
if (StringUtils.isEmpty((String)mm.get("PACKINGGRADE"))) {
|
||||||
|
insmk = "2";
|
||||||
|
}else if ("NG".equals((String)mm.get("PACKINGGRADE"))) {
|
||||||
|
insmk = "3";
|
||||||
|
}
|
||||||
|
// String insmk = StringUtils.equals(mm.get("OQARESULTSTATE").toString(),"END")?"":"X";
|
||||||
|
item.put("INSMK", insmk);
|
||||||
|
itemsData.add(item);
|
||||||
|
|
||||||
|
}
|
||||||
|
//String sendData = ToSAPMessageUtil.mm067(eventUser, bodyData, itemsData);
|
||||||
|
/**
|
||||||
|
* 将MES调用接口传递的payMentDate(过账日期)传递给SAP
|
||||||
|
* 2024-05-06
|
||||||
|
*/
|
||||||
|
String sendData = ToSAPMessageUtil.mm067Budat(eventUser, bodyData, itemsData,payMentDate);
|
||||||
|
return sendData;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退料入库
|
||||||
|
*
|
||||||
|
* @param siteName
|
||||||
|
* @param eventUser
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public String ReturnStockInNewPayMentDate(String siteName, String eventUser, String shipRequestName, String commitDate, String opCode, String payMentDate) throws Exception {
|
||||||
|
String sql="SELECT T.RECEIVEREQUESTNAME ," + SystemPropHelper.CR+
|
||||||
|
" D.REQUESTNAME PRODUCTORDER," +SystemPropHelper.CR+
|
||||||
|
" T.ERPFACTORY, " + SystemPropHelper.CR+
|
||||||
|
" T.ERPLOCATION, " + SystemPropHelper.CR+
|
||||||
|
" T.MATERIALSPECNAME, " + SystemPropHelper.CR+
|
||||||
|
" T.UNIT, " + SystemPropHelper.CR+
|
||||||
|
" T.PACKINGGRADE," + SystemPropHelper.CR+
|
||||||
|
" SUM(T.MATERIALQUANTITY) AS MATERIALQUANTITY" + SystemPropHelper.CR+
|
||||||
|
" FROM MATERIALPACKING T LEFT JOIN BS_MES_SHIPPED D ON D.LOTNAME = T.MATERIALPACKINGNAME" + SystemPropHelper.CR+
|
||||||
|
" WHERE 1 = 1 " + SystemPropHelper.CR+
|
||||||
|
" AND T.receiveActNo = :SHIPREQUESTNAME" + SystemPropHelper.CR+
|
||||||
|
" AND T.SITENAME = :SITENAME " + SystemPropHelper.CR+
|
||||||
|
" AND T.STOCKSTATE = 'Created' " + SystemPropHelper.CR+
|
||||||
|
"GROUP BY T.RECEIVEREQUESTNAME, D.REQUESTNAME, T.ERPFACTORY,T.ERPLOCATION, " + SystemPropHelper.CR+
|
||||||
|
" T.MATERIALSPECNAME,T.UNIT,T.PACKINGGRADE ";
|
||||||
|
Map<String, Object> hashMap = new HashMap<String, Object>();
|
||||||
|
hashMap.put("SITENAME", siteName);
|
||||||
|
// hashMap.put("SHIPREQUESTNAME", shipRequestName);
|
||||||
|
hashMap.put("SHIPREQUESTNAME", opCode);
|
||||||
|
List<Map<String, Object>> queryForList = IDMFrameServiceProxy.getSqlTemplate().queryForList(sql.toString(), hashMap);
|
||||||
|
//根据不同的类型进行处理
|
||||||
|
//String makeReturnStockIn = makeReturnStockIn(queryForList, eventUser);
|
||||||
|
String makeReturnStockIn = makeReturnStockInPayMentDate(queryForList, eventUser,payMentDate);
|
||||||
|
String sapreturn = "";
|
||||||
|
String rcode = "";
|
||||||
|
String rmsg = "";
|
||||||
|
String undoId = "";
|
||||||
|
try {
|
||||||
|
sapreturn = toSAPMessageUtil.sendHttpPost(toSAPMessageUtil.materialChangeLocationUrl, "",
|
||||||
|
makeReturnStockIn);
|
||||||
|
org.json.JSONObject receiveJsonObject = new org.json.JSONObject(sapreturn);
|
||||||
|
|
||||||
|
org.json.JSONObject returnJsonObject = (org.json.JSONObject) receiveJsonObject.get("RETURN");
|
||||||
|
rcode = returnJsonObject.get("STATUS").toString();
|
||||||
|
rmsg = returnJsonObject.get("MSGTXT").toString();
|
||||||
|
if ("S".equals(rcode)) {
|
||||||
|
undoId = returnJsonObject.get("MBLNR").toString()+"_"+returnJsonObject.get("MJAHR").toString();//将物料凭证号与凭证年度拼在一起
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("WMS请求SAP:" + e.getMessage(), e);
|
||||||
|
throw new RuntimeException("WMS请求SAP" + rmsg);
|
||||||
|
}finally {
|
||||||
|
// 写入message log
|
||||||
|
ErpMessageLog erplog = new ErpMessageLog();
|
||||||
|
erplog.setEventUser(eventUser);
|
||||||
|
erplog.setServerName("WmsToErp");
|
||||||
|
erplog.setEventName("ReturnStockIn生产退料");
|
||||||
|
erplog.setInterfaceTime(TimeStampUtil.getCurrentTime(TimeStampUtil.FORMAT_DEFAULT));
|
||||||
|
erplog.setMessageId(opCode);
|
||||||
|
erplog.setSendMsg(makeReturnStockIn);
|
||||||
|
erplog.setSendMsg2(makeReturnStockIn);
|
||||||
|
erplog.setSendMsg(makeReturnStockIn);
|
||||||
|
erplog.setReturnMsg2(sapreturn);
|
||||||
|
erplog.setResultCode(rcode);
|
||||||
|
MessageLogUtil.writeMessageLog(erplog);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (!"S".equals(rcode)) {
|
||||||
|
throw new Exception("SAP返回异常" + rmsg);
|
||||||
|
}
|
||||||
|
return undoId;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public String makeReturnStockInPayMentDate(List<Map<String, Object>> list, String eventUser, String payMentDate) throws JsonMappingException, JsonProcessingException {
|
||||||
|
if (list == null || list.size() < 1) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
String moveType = "262";
|
||||||
|
// String shipRequestType = (String)list.get(0).get("SHIPREQUESTTYPE");
|
||||||
|
// switch(shipRequestType) {
|
||||||
|
// //生产退料单,同组织&跨组织,投工单的退料使用 移动类型用262
|
||||||
|
// case "03": moveType = "262";break;
|
||||||
|
// //转库单,同组织&跨组织,有线边仓退料使用,移动类型用311
|
||||||
|
// case "04": moveType = "311";break;
|
||||||
|
// //成本中心退料,移动类型202
|
||||||
|
// case "07": moveType = "202";break;
|
||||||
|
// //研发(内部订单)退料, 移动类型Z62
|
||||||
|
// case "10": moveType = "Z62";break;
|
||||||
|
// default:break;
|
||||||
|
// }
|
||||||
|
Map<String,Object> bodyData = new HashMap<>();
|
||||||
|
List<Map<String,Object>> itemsData = new ArrayList<>();
|
||||||
|
|
||||||
|
|
||||||
|
for (Map<String, Object> mm : list) {
|
||||||
|
Map<String,Object> item = new HashMap<>();
|
||||||
|
//BWART 移动类型(库存管理)CHAR 3
|
||||||
|
//KOSTL 成本中心 CHAR 10\
|
||||||
|
//GRUND 移动原因 NUMC 4
|
||||||
|
|
||||||
|
|
||||||
|
item.put("MATNR", mm.get("MATERIALSPECNAME"));
|
||||||
|
item.put("LGORT", mm.get("ERPLOCATION"));
|
||||||
|
item.put("WERKS", mm.get("ERPFACTORY"));
|
||||||
|
item.put("BWART", moveType); //移动类型
|
||||||
|
item.put("LIFNR", "");
|
||||||
|
if(moveType.equals("202")) {
|
||||||
|
item.put("KOSTL", mm.get("COSTCENTER")); //成本中心
|
||||||
|
}
|
||||||
|
if(moveType.equals("262")) {
|
||||||
|
item.put("AUFNR", mm.get("PRODUCTORDER"));; //生产工单
|
||||||
|
}
|
||||||
|
if(moveType.equals("Z62")) {
|
||||||
|
item.put("AUFNR", mm.get("RECEIVEREQUESTNAME"));; //内部订单号,对于研发品来说
|
||||||
|
}
|
||||||
|
item.put("MENGE", mm.get("MATERIALQUANTITY"));
|
||||||
|
item.put("MEINS", mm.get("UNIT"));
|
||||||
|
item.put("ZLLORDER", mm.get("SHIPREQUESTNAME"));
|
||||||
|
item.put("ZLLITEM", mm.get("SHIPREQUESTDETAILNAME"));
|
||||||
|
|
||||||
|
item.put("SGTXT", mm.get("REMARK"));
|
||||||
|
String insmk = "";
|
||||||
|
//对于退料来说, 是已检查之后的结果直接入库, 不需要设置待检
|
||||||
|
String packingGrade = mm.get("PACKINGGRADE") == null ? "" : mm.get("PACKINGGRADE").toString();
|
||||||
|
if ("NG".equals(packingGrade)) {
|
||||||
|
insmk = "3";
|
||||||
|
}
|
||||||
|
// String insmk = StringUtils.equals(mm.get("OQARESULTSTATE").toString(),"END")?"":"X";
|
||||||
|
item.put("INSMK", insmk);
|
||||||
|
itemsData.add(item);
|
||||||
|
|
||||||
|
}
|
||||||
|
String sendData = ToSAPMessageUtil.mm067Budat(eventUser, bodyData, itemsData,payMentDate);
|
||||||
|
return sendData;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -612,4 +612,364 @@ public class ToSAPMessageUtil {
|
|||||||
public static void setBaseUrl(String baseUrl) {
|
public static void setBaseUrl(String baseUrl) {
|
||||||
ToSAPMessageUtil.baseUrl = baseUrl;
|
ToSAPMessageUtil.baseUrl = baseUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将MES调用接口传递的payMentDate(过账日期)传递给SAP
|
||||||
|
* @param user
|
||||||
|
* @param bodyData
|
||||||
|
* @param itemsData
|
||||||
|
* @param budat 过账日期
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String mm067Budat(String user, Map<String,?> bodyData, List<Map<String,Object>> itemsData, String budat){
|
||||||
|
try {
|
||||||
|
|
||||||
|
JSONObject sendData = new JSONObject(true);
|
||||||
|
JSONObject header = new JSONObject(true);
|
||||||
|
sendData.put("HEAD",header);
|
||||||
|
JSONObject body = new JSONObject(true);
|
||||||
|
sendData.put("BODY",body);
|
||||||
|
JSONArray itemArray = new JSONArray();
|
||||||
|
body.put("ITEM",itemArray);
|
||||||
|
/*
|
||||||
|
HEAD
|
||||||
|
INTFID 指定什么接口 MM067
|
||||||
|
REQ_KEYID 接口唯一ID
|
||||||
|
SRC_MSGID XI:消息标识
|
||||||
|
SRC_SYSTEM 发送方系统 WMS
|
||||||
|
DEST_SYSTEM 目标系统,接收方系统 SAP
|
||||||
|
REQUSER 用户名
|
||||||
|
BACKUP1 备注1
|
||||||
|
BACKUP2 备注2
|
||||||
|
*/
|
||||||
|
header.put("INTF_ID","MM067");
|
||||||
|
//uniqueID
|
||||||
|
String uniqueID = UUID.randomUUID().toString();
|
||||||
|
header.put("REQ_KEYID",uniqueID);
|
||||||
|
header.put("SRC_MSGID",uniqueID);
|
||||||
|
header.put("SRC_SYSTEM","WMS");
|
||||||
|
header.put("DEST_SYSTEM","SAP");
|
||||||
|
header.put("REQUSER",user);
|
||||||
|
header.put("BACKUP1","");
|
||||||
|
header.put("BACKUP2","");
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
BODY
|
||||||
|
|
||||||
|
ITEMID
|
||||||
|
BUDAT 过账日期
|
||||||
|
BLDAT 凭证日期
|
||||||
|
BKTXT 凭证抬头文本
|
||||||
|
USNAM 用户名
|
||||||
|
ZFLAG 标识
|
||||||
|
ZRSV01 预留字段01
|
||||||
|
ZRSV02 预留字段02
|
||||||
|
ZRSV03 预留字段03
|
||||||
|
ZRSV04 预留字段04
|
||||||
|
ZRSV05 预留字段05
|
||||||
|
ZRSV06 预留字段06
|
||||||
|
ZRSV07 预留字段07
|
||||||
|
ZRSV08 预留字段08
|
||||||
|
ZRSV09 预留字段09
|
||||||
|
ZRSV10 预留字段10
|
||||||
|
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* 将MES调用接口传递的payMentDate(过账日期)传递给SAP
|
||||||
|
* 2024-05-06
|
||||||
|
*/
|
||||||
|
body.put("ITEMID",uniqueID);
|
||||||
|
String postingDate = "";
|
||||||
|
if (StringUtils.isNotEmpty(budat)){
|
||||||
|
postingDate = budat;
|
||||||
|
}else {
|
||||||
|
postingDate = TimeStampUtil.getCurrentTime("yyyyMMdd");
|
||||||
|
}
|
||||||
|
//过账日期
|
||||||
|
body.put("BUDAT",postingDate);
|
||||||
|
//凭证日期
|
||||||
|
body.put("BLDAT",TimeStampUtil.getCurrentTime("yyyyMMdd"));
|
||||||
|
//凭证抬头文本
|
||||||
|
body.put("BKTXT",StringUtils.isEmpty((String)bodyData.get("BKTXT"))?uniqueID:bodyData.get("BKTXT"));
|
||||||
|
//用户名
|
||||||
|
body.put("USNAM",user);
|
||||||
|
//标识
|
||||||
|
body.put("ZFLAG","");
|
||||||
|
body.put("ZRSV01",bodyData.get("ZRSV01")==null?"":bodyData.get("ZRSV01"));
|
||||||
|
body.put("ZRSV02",bodyData.get("ZRSV02")==null?"":bodyData.get("ZRSV02"));
|
||||||
|
body.put("ZRSV03",bodyData.get("ZRSV03")==null?"":bodyData.get("ZRSV03"));
|
||||||
|
body.put("ZRSV04",bodyData.get("ZRSV04")==null?"":bodyData.get("ZRSV04"));
|
||||||
|
body.put("ZRSV05",bodyData.get("ZRSV05")==null?"":bodyData.get("ZRSV05"));
|
||||||
|
body.put("ZRSV06",bodyData.get("ZRSV06")==null?"":bodyData.get("ZRSV06"));
|
||||||
|
body.put("ZRSV07",bodyData.get("ZRSV07")==null?"":bodyData.get("ZRSV07"));
|
||||||
|
body.put("ZRSV08",bodyData.get("ZRSV08")==null?"":bodyData.get("ZRSV08"));
|
||||||
|
body.put("ZRSV09",bodyData.get("ZRSV09")==null?"":bodyData.get("ZRSV09"));
|
||||||
|
body.put("ZRSV10",bodyData.get("ZRSV10")==null?"":bodyData.get("ZRSV10"));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
for (Map<String, Object> mm : itemsData) {
|
||||||
|
JSONObject item = new JSONObject(true);
|
||||||
|
/*
|
||||||
|
MATNR 发货物料号
|
||||||
|
UMMAT 收货物料 移动类型是 309、311、312、输入值,其他传空
|
||||||
|
WERKS 发货工厂
|
||||||
|
UMWRK 收货工厂
|
||||||
|
LGORT 发货库存地点
|
||||||
|
UMLGO 收货库存地点
|
||||||
|
BWART 移动类型
|
||||||
|
SOBKZ 特殊库存标识
|
||||||
|
LIFNR 供应商编码
|
||||||
|
MENGE 数量
|
||||||
|
MEINS 单位
|
||||||
|
BPMNG 采购价格单位数量
|
||||||
|
BPRME 采购价格单位
|
||||||
|
EBELN 采购订单编码
|
||||||
|
EBELP 采购订单项目编码
|
||||||
|
SGTXT 项目文本
|
||||||
|
KOSTL 成本中心
|
||||||
|
MAT_KDAUF 发货销售订单编码
|
||||||
|
MAT_KDPOS 发货销售订单项目编码
|
||||||
|
UMMAT_KDAUF 收货销售订单编码
|
||||||
|
UMMAT_KDPOS 收货销售订单项目编码
|
||||||
|
ELIKZ 交货已完成标识
|
||||||
|
AUFNR 订单号
|
||||||
|
AUFPS 订单项目编号
|
||||||
|
RSNUM 预留/相关需求的编号
|
||||||
|
RSPOS 预留/相关需求的项目编号
|
||||||
|
RSART 记录类型
|
||||||
|
KZEAR 该预留的最后发货
|
||||||
|
UMMAT 收货物料
|
||||||
|
UMCHA 收货/发货批量
|
||||||
|
PRCTR 利润中心
|
||||||
|
KZBEW 移动标识
|
||||||
|
GRUND 移动原因
|
||||||
|
SAKTO 总帐科目编号
|
||||||
|
ZLLORDER 自定义领料单号
|
||||||
|
ZLLITEM 自定义领料单行号
|
||||||
|
INSMK 库存类型
|
||||||
|
VBELN_IM 交货单
|
||||||
|
VBELP_IM 交货单项目
|
||||||
|
ZRSV01 预留字段01
|
||||||
|
ZRSV02 预留字段02
|
||||||
|
ZRSV03 预留字段03
|
||||||
|
ZRSV04 预留字段04
|
||||||
|
ZRSV05 预留字段05
|
||||||
|
ZRSV06 预留字段06
|
||||||
|
ZRSV07 预留字段07
|
||||||
|
ZRSV08 预留字段08
|
||||||
|
ZRSV09 预留字段09
|
||||||
|
ZRSV10 预留字段10
|
||||||
|
*/
|
||||||
|
|
||||||
|
item.put("MATNR", mm.get("MATNR")==null?"":mm.get("MATNR"));
|
||||||
|
item.put("UMMAT", mm.get("UMMAT")==null?"":mm.get("UMMAT"));
|
||||||
|
item.put("UMLGO", mm.get("UMLGO")==null?"":mm.get("UMLGO"));
|
||||||
|
item.put("LGORT", mm.get("LGORT")==null?"":mm.get("LGORT"));
|
||||||
|
item.put("UMWRK", mm.get("UMWRK")==null?"":mm.get("UMWRK"));
|
||||||
|
item.put("WERKS", mm.get("WERKS")==null?"":mm.get("WERKS"));
|
||||||
|
/*
|
||||||
|
101:采购订单/生产工订单收货
|
||||||
|
102:采购订单原单退货/生产工单入库冲销
|
||||||
|
161:退货采购订单收货
|
||||||
|
162:退货采购订单原单退货(162BAPI传参移动类型需传102)
|
||||||
|
201:成本中心领料
|
||||||
|
202:成本中心退料
|
||||||
|
261:生产订单发料
|
||||||
|
262:生产订单发料-冲销
|
||||||
|
309:物料转物料
|
||||||
|
310:物料转物料-冲销
|
||||||
|
311:库存地点调拨 (工厂内)
|
||||||
|
312:库存地点调拨-冲销
|
||||||
|
321:TF质量到非限制
|
||||||
|
322:TR 质量到非限制
|
||||||
|
343:TF冻结到非限制
|
||||||
|
344:TR 冻结到非限制
|
||||||
|
349:TF 冻结到质检
|
||||||
|
350:TR 冻结到质检
|
||||||
|
411K:供应商寄售转自有
|
||||||
|
412K:自有库存转K库存
|
||||||
|
411E:从E库存转非限制
|
||||||
|
413:从非限制转E库存
|
||||||
|
413E:从E库存转E库存
|
||||||
|
531:副产品入库
|
||||||
|
532:副产品入库-冲销
|
||||||
|
541O:委外发料
|
||||||
|
542O:委外退料
|
||||||
|
Z05盘亏
|
||||||
|
Z06盘盈
|
||||||
|
Z61研发领料(内部订单)
|
||||||
|
Z62研发退料(内部订单)
|
||||||
|
Z63调机领料(内部订单)
|
||||||
|
Z64调机领料(内部订单)
|
||||||
|
Z07 降级品出库
|
||||||
|
Z08 RE降级品出库
|
||||||
|
*/
|
||||||
|
String mmtype = mm.get("BWART")==null?"":(String)mm.get("BWART");
|
||||||
|
item.put("BWART", mm.get("BWART")==null?"":mm.get("BWART"));
|
||||||
|
/*
|
||||||
|
移动类型为三位代码,备注了字母的需要在特殊库存标识字段输入对应字母
|
||||||
|
O:分包库存
|
||||||
|
E:销售订单库存
|
||||||
|
K:供应商寄售库存
|
||||||
|
*/
|
||||||
|
if(StringUtils.isNotEmpty(mmtype) && mmtype.length()==4) {
|
||||||
|
item.put("SOBKZ",mmtype.substring(3, 4));
|
||||||
|
} else {
|
||||||
|
item.put("SOBKZ","");
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* LIFNR 供应商编码
|
||||||
|
* 411、411k、412k 、541O、542O输入,其他传空
|
||||||
|
*/
|
||||||
|
item.put("LIFNR", mm.get("LIFNR")==null?"":mm.get("LIFNR"));
|
||||||
|
/*
|
||||||
|
* MENGE 数量
|
||||||
|
* 当单位是采购订单单位时,输入对应实际数量
|
||||||
|
*/
|
||||||
|
item.put("MENGE", mm.get("MENGE")==null?"":mm.get("MENGE"));
|
||||||
|
/*
|
||||||
|
* MEINS 单位
|
||||||
|
* 基于采购订单的业务输入采购订单单位,其他输入基本单位
|
||||||
|
*/
|
||||||
|
item.put("MEINS", mm.get("MEINS")==null?"":mm.get("MEINS"));
|
||||||
|
/*
|
||||||
|
* BPMNG 采购价格单位数量
|
||||||
|
* 采购订单价格单位与采购订单单位不一致时,输入实际采购价格单位数量
|
||||||
|
*/
|
||||||
|
item.put("BPMNG", mm.get("BPMNG")==null?"":mm.get("BPMNG"));
|
||||||
|
item.put("BPRME", mm.get("BPRME")==null?"":mm.get("BPRME"));
|
||||||
|
/*
|
||||||
|
* BPRME 采购价格单位
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
item.put("SGTXT", mm.get("SGTXT")==null?"":mm.get("SGTXT"));
|
||||||
|
/*
|
||||||
|
* EBELN 采购订单编码
|
||||||
|
* 移动类型是101、102、161、162必输入
|
||||||
|
*/
|
||||||
|
item.put("EBELN", mm.get("EBELN")==null?"":mm.get("EBELN"));
|
||||||
|
/*
|
||||||
|
* EBELP 采购订单项目编码
|
||||||
|
* 移动类型是101、102、161、162必输入
|
||||||
|
*/
|
||||||
|
item.put("EBELP", mm.get("EBELP")==null?"":mm.get("EBELP"));
|
||||||
|
/*
|
||||||
|
* SGTXT 项目文本
|
||||||
|
*/
|
||||||
|
item.put("SGTXT", mm.get("SGTXT")==null?"":mm.get("SGTXT"));
|
||||||
|
/*
|
||||||
|
* KOSTL 成本中心
|
||||||
|
* 移动类型201、202、Z05、Z06输入,其他传空
|
||||||
|
*/
|
||||||
|
|
||||||
|
item.put("KOSTL", mm.get("KOSTL")==null?"":mm.get("KOSTL"));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* MAT_KDAUF 发货销售订单编码
|
||||||
|
* MAT_KDPOS 发货销售订单项目编码
|
||||||
|
* E库存更换销售订单号
|
||||||
|
* 移动类型411E、413E输入,其他传空
|
||||||
|
*/
|
||||||
|
item.put("MAT_KDAUF", mm.get("MAT_KDAUF")==null?"":mm.get("MAT_KDAUF"));
|
||||||
|
item.put("MAT_KDPOS", mm.get("MAT_KDPOS")==null?"":mm.get("MAT_KDPOS"));
|
||||||
|
/*
|
||||||
|
* UMMAT_KDAUF 收货销售订单编码
|
||||||
|
* UMMAT_KDPOS 收货销售订单项目编码
|
||||||
|
* 413、413E输入,其他传空
|
||||||
|
*/
|
||||||
|
item.put("UMMAT_KDAUF", mm.get("UMMAT_KDAUF")==null?"":mm.get("UMMAT_KDAUF"));
|
||||||
|
item.put("UMMAT_KDPOS", mm.get("UMMAT_KDPOS")==null?"":mm.get("UMMAT_KDPOS"));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ELIKZ 交货已完成标识
|
||||||
|
*/
|
||||||
|
item.put("ELIKZ", mm.get("ELIKZ")==null?"":mm.get("ELIKZ"));
|
||||||
|
/*
|
||||||
|
* AUFNR 订单号
|
||||||
|
* 261、262输入生产订单号;Z61、Z62、Z63、Z64输入内部订单号,其他传空
|
||||||
|
*/
|
||||||
|
item.put("AUFNR", mm.get("AUFNR")==null?"":mm.get("AUFNR"));
|
||||||
|
/*
|
||||||
|
* AUFPS 订单项目编号
|
||||||
|
*/
|
||||||
|
item.put("AUFPS", mm.get("AUFPS")==null?"":mm.get("AUFPS"));
|
||||||
|
/*
|
||||||
|
RSNUM 预留/相关需求的编号
|
||||||
|
RSPOS 预留/相关需求的项目编号
|
||||||
|
RSART 记录类型
|
||||||
|
KZEAR 该预留的最后发货
|
||||||
|
UMMAT 收货物料
|
||||||
|
UMCHA 收货/发货批量
|
||||||
|
PRCTR 利润中心
|
||||||
|
KZBEW 移动标识
|
||||||
|
GRUND 移动原因
|
||||||
|
SAKTO 总帐科目编号
|
||||||
|
*/
|
||||||
|
item.put("RSNUM", mm.get("RSNUM")==null?"":mm.get("RSNUM"));
|
||||||
|
item.put("RSPOS", mm.get("RSPOS")==null?"":mm.get("RSPOS"));
|
||||||
|
item.put("RSART", mm.get("RSART")==null?"":mm.get("RSART"));
|
||||||
|
item.put("KZEAR", mm.get("KZEAR")==null?"":mm.get("KZEAR"));
|
||||||
|
item.put("UMMAT", mm.get("UMMAT")==null?"":mm.get("UMMAT"));
|
||||||
|
item.put("UMCHA", mm.get("UMCHA")==null?"":mm.get("UMCHA"));
|
||||||
|
item.put("PRCTR", mm.get("PRCTR")==null?"":mm.get("PRCTR"));
|
||||||
|
item.put("KZBEW", mm.get("KZBEW")==null?"":mm.get("KZBEW"));
|
||||||
|
item.put("GRUND", mm.get("GRUND")==null?"":mm.get("GRUND"));
|
||||||
|
item.put("SAKTO", mm.get("SAKTO")==null?"":mm.get("SAKTO"));
|
||||||
|
/*
|
||||||
|
* ZLLORDER 自定义领料单号
|
||||||
|
* ZLLITEM 自定义领料单行号
|
||||||
|
* 309、310、261、262、411E、413、413E、Z61、Z62、Z63、Z64、541、201、202输入,其他传空
|
||||||
|
*/
|
||||||
|
item.put("ZLLORDER", mm.get("ZLLORDER")==null?"":mm.get("ZLLORDER"));
|
||||||
|
item.put("ZLLITEM", mm.get("ZLLITEM")==null?"":mm.get("ZLLITEM"));
|
||||||
|
/*
|
||||||
|
* INSMK 库存类型
|
||||||
|
* 采购入库或工单入库时使用
|
||||||
|
空:非限制使用
|
||||||
|
2:质量检验
|
||||||
|
3:已冻结
|
||||||
|
*/
|
||||||
|
item.put("INSMK", mm.get("INSMK")==null?"":mm.get("INSMK"));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* VBELN_IM 交货单
|
||||||
|
* VBELP_IM 交货单项目
|
||||||
|
* 101, 跨工厂调拨时使用
|
||||||
|
*/
|
||||||
|
item.put("VBELN_IM", mm.get("VBELN_IM")==null?"":mm.get("VBELN_IM"));
|
||||||
|
item.put("VBELP_IM", mm.get("VBELP_IM")==null?"":mm.get("VBELP_IM"));
|
||||||
|
/*
|
||||||
|
ZRSV01 预留字段01
|
||||||
|
ZRSV02 预留字段02
|
||||||
|
ZRSV03 预留字段03
|
||||||
|
ZRSV04 预留字段04
|
||||||
|
ZRSV05 预留字段05
|
||||||
|
ZRSV06 预留字段06
|
||||||
|
ZRSV07 预留字段07
|
||||||
|
ZRSV08 预留字段08
|
||||||
|
ZRSV09 预留字段09
|
||||||
|
ZRSV10 预留字段10
|
||||||
|
*/
|
||||||
|
item.put("ZRSV01",mm.get("ZRSV01")==null?"":mm.get("ZRSV01"));
|
||||||
|
item.put("ZRSV02",mm.get("ZRSV02")==null?"":mm.get("ZRSV02"));
|
||||||
|
item.put("ZRSV03",mm.get("ZRSV03")==null?"":mm.get("ZRSV03"));
|
||||||
|
item.put("ZRSV04",mm.get("ZRSV04")==null?"":mm.get("ZRSV04"));
|
||||||
|
item.put("ZRSV05",mm.get("ZRSV05")==null?"":mm.get("ZRSV05"));
|
||||||
|
item.put("ZRSV06",mm.get("ZRSV06")==null?"":mm.get("ZRSV06"));
|
||||||
|
item.put("ZRSV07",mm.get("ZRSV07")==null?"":mm.get("ZRSV07"));
|
||||||
|
item.put("ZRSV08",mm.get("ZRSV08")==null?"":mm.get("ZRSV08"));
|
||||||
|
item.put("ZRSV09",mm.get("ZRSV09")==null?"":mm.get("ZRSV09"));
|
||||||
|
item.put("ZRSV10",mm.get("ZRSV10")==null?"":mm.get("ZRSV10"));
|
||||||
|
itemArray.add(item);
|
||||||
|
|
||||||
|
}
|
||||||
|
log.info("SendTOSAP >>>>"+sendData);
|
||||||
|
return sendData.toJSONString();
|
||||||
|
}catch (Exception e) {
|
||||||
|
log.error("发给SAP的消息拼装异常:"+e.getMessage(),e);
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -369,6 +369,7 @@ public class MESToWMSServiceImpl implements MESToWMSService {
|
|||||||
String operationType = ""; // 用于记录是否是自动入库 手动入库0,自动入库1
|
String operationType = ""; // 用于记录是否是自动入库 手动入库0,自动入库1
|
||||||
String fgStockIn = "";
|
String fgStockIn = "";
|
||||||
if (in != null && in.size() > 0) {
|
if (in != null && in.size() > 0) {
|
||||||
|
String payMentDate = in.getJSONObject(0).get("payMentDate").toString(); //日期
|
||||||
for (int i = 0; i < in.size(); i++) {
|
for (int i = 0; i < in.size(); i++) {
|
||||||
JSONObject jb = in.getJSONObject(i);
|
JSONObject jb = in.getJSONObject(i);
|
||||||
String charge = jb.get("charge").toString(); // 批号
|
String charge = jb.get("charge").toString(); // 批号
|
||||||
@ -512,7 +513,7 @@ public class MESToWMSServiceImpl implements MESToWMSService {
|
|||||||
}
|
}
|
||||||
if ("1".equals(operationType)) { // 自动入库
|
if ("1".equals(operationType)) { // 自动入库
|
||||||
if ("FG".equals(stockInType) || "BFG".equals(stockInType)) { // 产成品入库 增加回收粒子入库
|
if ("FG".equals(stockInType) || "BFG".equals(stockInType)) { // 产成品入库 增加回收粒子入库
|
||||||
fgStockIn = productIntoServiceImpl.outoFgStockIn(receiveActNo, "MES",stockInType);
|
fgStockIn = productIntoServiceImpl.outoFgStockIn(receiveActNo, "MES",stockInType,payMentDate);
|
||||||
if (fgStockIn.isEmpty()) {
|
if (fgStockIn.isEmpty()) {
|
||||||
throw new GlobalException("报送ERP失败,请联系IT处理!");
|
throw new GlobalException("报送ERP失败,请联系IT处理!");
|
||||||
}
|
}
|
||||||
@ -537,7 +538,8 @@ public class MESToWMSServiceImpl implements MESToWMSService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else if ("MAT".equals(stockInType)) { // 生产退料入库
|
} else if ("MAT".equals(stockInType)) { // 生产退料入库
|
||||||
fgStockIn = returnStockIntoServiceImpl.ReturnStockIn(receiveActNo, "MES", "", "");
|
//fgStockIn = returnStockIntoServiceImpl.ReturnStockIn(receiveActNo, "MES", "", "");
|
||||||
|
fgStockIn = returnStockIntoServiceImpl.ReturnStockInPayMentDate(receiveActNo, "MES", "", "",payMentDate);
|
||||||
if (fgStockIn.isEmpty()) {
|
if (fgStockIn.isEmpty()) {
|
||||||
throw new GlobalException("报送ERP失败,请联系IT处理!");
|
throw new GlobalException("报送ERP失败,请联系IT处理!");
|
||||||
}
|
}
|
||||||
|
@ -1002,9 +1002,9 @@ public class ProductIntoServiceImpl implements FGStockInService {
|
|||||||
return billCode;
|
return billCode;
|
||||||
}
|
}
|
||||||
//自动成品入库到现场仓
|
//自动成品入库到现场仓
|
||||||
public String outoFgStockIn (String RECEIVEACTNO, String eventUser, String stockInType) throws Exception {
|
public String outoFgStockIn (String RECEIVEACTNO, String eventUser, String stockInType, String payMentDate) throws Exception {
|
||||||
|
|
||||||
String billCode = toSAPService.FGStockIn3(RECEIVEACTNO, eventUser,stockInType);
|
String billCode = toSAPService.FGStockIn3(RECEIVEACTNO, eventUser,stockInType,payMentDate);
|
||||||
if (billCode == null) {
|
if (billCode == null) {
|
||||||
throw new GlobalException("报送ERP失败,请联系IT处理!");
|
throw new GlobalException("报送ERP失败,请联系IT处理!");
|
||||||
}
|
}
|
||||||
|
@ -970,4 +970,50 @@ public class ReturnStockIntoServiceImpl implements ReturnStockInService {
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param RECEIVEACTNO
|
||||||
|
* @param eventUser
|
||||||
|
* @return
|
||||||
|
* @throws IOException
|
||||||
|
* @throws SAXException
|
||||||
|
* @throws ParserConfigurationException
|
||||||
|
*/
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public String ReturnStockInPayMentDate (String RECEIVEACTNO, String eventUser,String commitDate,String opCode,String payMentDate) throws Exception {
|
||||||
|
//String billCode = ToSAPServiceImpl.ReturnStockInNew("SDK", eventUser, RECEIVEACTNO,commitDate,opCode);
|
||||||
|
String billCode = ToSAPServiceImpl.ReturnStockInNewPayMentDate("SDK", eventUser, RECEIVEACTNO,commitDate,opCode, payMentDate);
|
||||||
|
if (billCode == null) {
|
||||||
|
throw new RuntimeException("SAP接口过账失败");
|
||||||
|
}
|
||||||
|
EventInfo makeEventInfo = new EventInfoUtil().makeEventInfo("ReturnStockIn", eventUser, "ReturnStockIn");
|
||||||
|
//更新抬头文本状态和Box状态
|
||||||
|
String sql = "SELECT M.SITENAME ,M.MATERIALPACKINGNAME FROM MATERIALPACKING M WHERE M.RECEIVEACTNO = :RECEIVEACTNO";
|
||||||
|
Map<String, Object> hashMap = new HashMap<String,Object> ();
|
||||||
|
hashMap.put("RECEIVEACTNO", RECEIVEACTNO);
|
||||||
|
List<Map<String, Object>> queryForList = IDMFrameServiceProxy.getSqlTemplate().queryForList(sql, hashMap);
|
||||||
|
for (Map<String, Object> map : queryForList) {
|
||||||
|
MaterialPackingKey materialPackingKey = new MaterialPackingKey(map.get("SITENAME").toString(),map.get("MATERIALPACKINGNAME").toString());
|
||||||
|
SetEventInfo setEventInfo = new SetEventInfo();
|
||||||
|
Map<String, Object> bindMap = new HashMap<String, Object>();
|
||||||
|
bindMap.put("unDoID", billCode);
|
||||||
|
bindMap.put("stockState", "Stocked");
|
||||||
|
setEventInfo.setUserColumns(bindMap);
|
||||||
|
MaterialPackingServiceProxy.getMaterialPackingService().setEvent(materialPackingKey, makeEventInfo, setEventInfo);
|
||||||
|
|
||||||
|
String sql2 = "UPDATE BS_MES_SHIPPED T SET T.RECEIVE_FLAG = 'Y', T.RECEIVE_TIME = SYSDATE WHERE T.LOTNAME = :LOTNAME";
|
||||||
|
Map<String, Object> hashMap2 = new HashMap<String,Object> ();
|
||||||
|
hashMap2.put("LOTNAME", map.get("MATERIALPACKINGNAME").toString());
|
||||||
|
IDMFrameServiceProxy.getSqlTemplate().update(sql2, hashMap2);
|
||||||
|
|
||||||
|
String sql3 = "UPDATE MATERIALRECEIVEACT T SET T.RECEIVEACTSTATE = 'Received' WHERE T.RECEIVEACTNO = :RECEIVEACTNO";
|
||||||
|
Map<String, Object> hashMap3 = new HashMap<String,Object> ();
|
||||||
|
hashMap2.put("RECEIVEACTNO", RECEIVEACTNO);
|
||||||
|
IDMFrameServiceProxy.getSqlTemplate().update(sql3, hashMap2);
|
||||||
|
}
|
||||||
|
SaveUnDoInfo( billCode,commitDate);
|
||||||
|
//更新MES标识
|
||||||
|
return billCode;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user