fix:修改成品待入库
This commit is contained in:
parent
8036a2181a
commit
e0b8e12f43
@ -130,6 +130,8 @@ public class MaterialPacking extends FieldAccessor implements DataInfo<MaterialP
|
|||||||
private String CUSTOMNO;
|
private String CUSTOMNO;
|
||||||
|
|
||||||
private String lastHoldUser; //最近一次冻结人
|
private String lastHoldUser; //最近一次冻结人
|
||||||
|
private String preOqaResult; // 质检前状态
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public String getLastHoldUser() {
|
public String getLastHoldUser() {
|
||||||
@ -993,6 +995,14 @@ public class MaterialPacking extends FieldAccessor implements DataInfo<MaterialP
|
|||||||
this.gxId = gxId;
|
this.gxId = gxId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getPreOqaResult() {
|
||||||
|
return preOqaResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPreOqaResult(String preOqaResult) {
|
||||||
|
this.preOqaResult = preOqaResult;
|
||||||
|
}
|
||||||
|
|
||||||
public static class Field {
|
public static class Field {
|
||||||
public static final String messageID = "messageId";
|
public static final String messageID = "messageId";
|
||||||
}
|
}
|
||||||
|
@ -4458,6 +4458,150 @@ public class ToSAPServiceImpl {
|
|||||||
return undoId;
|
return undoId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//自动转仓和质检一起过账 (311)
|
||||||
|
public String autoTurnWareAndQms(List<MaterialPackingKey> all,
|
||||||
|
String aimERPlocation,
|
||||||
|
String user,
|
||||||
|
String pqcResult) throws Exception {
|
||||||
|
String rcode;
|
||||||
|
String undoId = "";
|
||||||
|
String rmsg = null;
|
||||||
|
StringBuffer sql = new StringBuffer();
|
||||||
|
sql
|
||||||
|
.append(" SELECT ").append(SystemPropHelper.CR)
|
||||||
|
.append(" MP.MATERIALSPECNAME, ").append(SystemPropHelper.CR)
|
||||||
|
.append(" MP.ERPFACTORY , ").append(SystemPropHelper.CR)
|
||||||
|
.append(" MP.ERPFACTORY AS UMWRK_RECIEVEFACTORY, ").append(SystemPropHelper.CR)
|
||||||
|
.append(" MP.PREERPLOCATION ERPLOCATION, ").append(SystemPropHelper.CR)
|
||||||
|
.append(" :AIMERPLOCATION AS UMLGO_RECIEVEERPLOCATION, ").append(SystemPropHelper.CR)
|
||||||
|
.append(" MP.MATERIALQUANTITY , ").append(SystemPropHelper.CR)
|
||||||
|
.append(" MP.UNIT, ").append(SystemPropHelper.CR)
|
||||||
|
.append(" MP.PACKINGGRADE, ").append(SystemPropHelper.CR)
|
||||||
|
.append(" MP.LOCATIONNAME AS NULL_RECIVELOCAITONNAME ").append(SystemPropHelper.CR)
|
||||||
|
.append(" FROM ").append(SystemPropHelper.CR)
|
||||||
|
.append(" MATERIALPACKING MP ").append(SystemPropHelper.CR)
|
||||||
|
.append(" WHERE ").append(SystemPropHelper.CR)
|
||||||
|
.append(" MP.MATERIALPACKINGNAME IN ").append(SystemPropHelper.CR);
|
||||||
|
Map<String, Object> hashMap = new HashMap<String,Object> ();
|
||||||
|
// hashMap.put("AIMFACTORY", aimFactory);
|
||||||
|
// hashMap.put("AIMLOCATIONNAME", aimLocationName);
|
||||||
|
hashMap.put("AIMERPLOCATION", aimERPlocation);
|
||||||
|
String str = "";
|
||||||
|
str += "(";
|
||||||
|
for (MaterialPackingKey materialPackingKey : all) {
|
||||||
|
str += "'" + materialPackingKey.getMaterialPackingName() + "',";
|
||||||
|
}
|
||||||
|
str += "'')";
|
||||||
|
List<Map<String, Object>> queryForList = IDMFrameServiceProxy.getSqlTemplate().queryForList(sql.toString() + str, hashMap);
|
||||||
|
if (queryForList == null || queryForList.size() < 1) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
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();
|
||||||
|
|
||||||
|
/*
|
||||||
|
HEAD
|
||||||
|
*/
|
||||||
|
header.put("INTF_ID", "MM067");
|
||||||
|
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);
|
||||||
|
|
||||||
|
/*
|
||||||
|
BODY
|
||||||
|
*/
|
||||||
|
body.put("ITEM", itemArray);
|
||||||
|
body.put("ITEMID", uniqueID);
|
||||||
|
//过账日期
|
||||||
|
body.put("BUDAT", TimeStampUtil.getCurrentTime("yyyyMMdd"));
|
||||||
|
//凭证日期
|
||||||
|
body.put("BLDAT", TimeStampUtil.getCurrentTime("yyyyMMdd"));
|
||||||
|
//凭证抬头文本
|
||||||
|
body.put("BKTXT", uniqueID);
|
||||||
|
//用户名
|
||||||
|
body.put("USNAM", user);
|
||||||
|
|
||||||
|
for (Map<String, Object> mm : queryForList) {
|
||||||
|
|
||||||
|
JSONObject item = new JSONObject(true);
|
||||||
|
|
||||||
|
// MATNR 发货物料号
|
||||||
|
item.put("MATNR", mm.get("MATERIALSPECNAME"));
|
||||||
|
//UMMAT 收货物料
|
||||||
|
item.put("UMMAT", mm.get("MATERIALSPECNAME"));
|
||||||
|
// WERKS 发货工厂
|
||||||
|
item.put("WERKS", mm.get("ERPFACTORY"));
|
||||||
|
// LGORT 发货库存地点
|
||||||
|
item.put("LGORT", mm.get("ERPLOCATION"));
|
||||||
|
//UMWRK 收货工厂
|
||||||
|
item.put("UMWRK", mm.get("UMWRK_RECIEVEFACTORY"));
|
||||||
|
//UMLGO 收货库存地点
|
||||||
|
item.put("UMLGO", mm.get("UMLGO_RECIEVEERPLOCATION"));
|
||||||
|
//MENGE 数量
|
||||||
|
item.put("MENGE", mm.get("MATERIALQUANTITY"));
|
||||||
|
//MENGE 单位
|
||||||
|
item.put("MEINS", mm.get("UNIT"));
|
||||||
|
//BWART 移动类型
|
||||||
|
item.put("BWART", "311");
|
||||||
|
|
||||||
|
String insmk = "";
|
||||||
|
if("NG".equals(pqcResult) ){
|
||||||
|
insmk = "3";
|
||||||
|
}
|
||||||
|
// String insmk = StringUtils.equals(mm.get("OQARESULTSTATE").toString(),"END")?"":"X";
|
||||||
|
item.put("INSMK", insmk);
|
||||||
|
// //ZLLORDER 自定义领料单号
|
||||||
|
// item.put("ZLLORDER", mm.get("SHIPREQUESTNAME"));
|
||||||
|
// //ZLLITEM 自定义领料单行号
|
||||||
|
// item.put("ZLLITEM", mm.get("SHIPREQUESTDETAILNAME"));
|
||||||
|
|
||||||
|
itemArray.add(item);
|
||||||
|
|
||||||
|
}
|
||||||
|
log.info("SendTOSAP >>>>" + sendData);
|
||||||
|
String senddata2 = sendData.toJSONString();
|
||||||
|
String sapreturn = toSAPMessageUtil.sendHttpPost(toSAPMessageUtil.materialChangeLocationUrl, "", sendData.toJSONString());
|
||||||
|
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();//将物料凭证号与凭证年度拼在一起
|
||||||
|
}
|
||||||
|
//将log写到表里
|
||||||
|
UUID uuid = UUID.randomUUID();
|
||||||
|
ErpMessageLog erplog = new ErpMessageLog();
|
||||||
|
erplog.setEventUser("");
|
||||||
|
erplog.setServerName("WmsToErp");
|
||||||
|
erplog.setEventName("qms质检判定自动转库-311");
|
||||||
|
erplog.setId(uuid.toString());
|
||||||
|
erplog.setInterfaceTime(TimeStampUtil.getCurrentTime(TimeStampUtil.FORMAT_DEFAULT));
|
||||||
|
erplog.setMessageId(UUID.randomUUID().toString());
|
||||||
|
erplog.setSendMsg(sendData.toJSONString());
|
||||||
|
erplog.setSendMsg2(sendData.toJSONString());
|
||||||
|
erplog.setReturnMsg2(sapreturn);
|
||||||
|
erplog.setResultCode(rcode);
|
||||||
|
MessageLogUtil.writeMessageLog(erplog);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.info(e.getMessage(), e);
|
||||||
|
throw new RuntimeException("SAP返回" + rmsg);
|
||||||
|
}
|
||||||
|
if (!"S".equals(rcode)) {
|
||||||
|
throw new RuntimeException("SAP返回" + rmsg);
|
||||||
|
}
|
||||||
|
return undoId;
|
||||||
|
}
|
||||||
|
|
||||||
//无来源转库过账 (311)
|
//无来源转库过账 (311)
|
||||||
public String NoSourceChangeLocation(List<MaterialPackingKey> all,
|
public String NoSourceChangeLocation(List<MaterialPackingKey> all,
|
||||||
String aimFactory,
|
String aimFactory,
|
||||||
@ -4469,19 +4613,19 @@ public class ToSAPServiceImpl {
|
|||||||
String rmsg = null;
|
String rmsg = null;
|
||||||
StringBuffer sql = new StringBuffer();
|
StringBuffer sql = new StringBuffer();
|
||||||
sql
|
sql
|
||||||
.append(" SELECT ").append(SystemPropHelper.CR)
|
.append(" SELECT ").append(SystemPropHelper.CR)
|
||||||
.append(" MP.MATERIALSPECNAME, ").append(SystemPropHelper.CR)
|
.append(" MP.MATERIALSPECNAME, ").append(SystemPropHelper.CR)
|
||||||
.append(" MP.ERPFACTORY , ").append(SystemPropHelper.CR)
|
.append(" MP.ERPFACTORY , ").append(SystemPropHelper.CR)
|
||||||
.append(" :AIMFACTORY AS UMWRK_RECIEVEFACTORY, ").append(SystemPropHelper.CR)
|
.append(" :AIMFACTORY AS UMWRK_RECIEVEFACTORY, ").append(SystemPropHelper.CR)
|
||||||
.append(" MP.ERPLOCATION, ").append(SystemPropHelper.CR)
|
.append(" MP.ERPLOCATION, ").append(SystemPropHelper.CR)
|
||||||
.append(" :AIMERPLOCATION AS UMLGO_RECIEVEERPLOCATION, ").append(SystemPropHelper.CR)
|
.append(" :AIMERPLOCATION AS UMLGO_RECIEVEERPLOCATION, ").append(SystemPropHelper.CR)
|
||||||
.append(" MP.MATERIALQUANTITY , ").append(SystemPropHelper.CR)
|
.append(" MP.MATERIALQUANTITY , ").append(SystemPropHelper.CR)
|
||||||
.append(" MP.UNIT, ").append(SystemPropHelper.CR)
|
.append(" MP.UNIT, ").append(SystemPropHelper.CR)
|
||||||
.append(" :AIMLOCATIONNAME AS NULL_RECIVELOCAITONNAME ").append(SystemPropHelper.CR)
|
.append(" :AIMLOCATIONNAME AS NULL_RECIVELOCAITONNAME ").append(SystemPropHelper.CR)
|
||||||
.append(" FROM ").append(SystemPropHelper.CR)
|
.append(" FROM ").append(SystemPropHelper.CR)
|
||||||
.append(" MATERIALPACKING MP ").append(SystemPropHelper.CR)
|
.append(" MATERIALPACKING MP ").append(SystemPropHelper.CR)
|
||||||
.append(" WHERE ").append(SystemPropHelper.CR)
|
.append(" WHERE ").append(SystemPropHelper.CR)
|
||||||
.append(" MP.MATERIALPACKINGNAME IN ").append(SystemPropHelper.CR);
|
.append(" MP.MATERIALPACKINGNAME IN ").append(SystemPropHelper.CR);
|
||||||
Map<String, Object> hashMap = new HashMap<String,Object> ();
|
Map<String, Object> hashMap = new HashMap<String,Object> ();
|
||||||
hashMap.put("AIMFACTORY", aimFactory);
|
hashMap.put("AIMFACTORY", aimFactory);
|
||||||
hashMap.put("AIMLOCATIONNAME", aimLocationName);
|
hashMap.put("AIMLOCATIONNAME", aimLocationName);
|
||||||
|
@ -1,12 +1,8 @@
|
|||||||
package com.cim.idm.controller;
|
package com.cim.idm.controller;
|
||||||
|
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
import java.util.stream.Collectors;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import com.cim.idm.framework.template.workflow.BpelExecuter;
|
import com.cim.idm.framework.template.workflow.BpelExecuter;
|
||||||
import com.cim.idm.model.ErpMessageLog;
|
import com.cim.idm.model.ErpMessageLog;
|
||||||
@ -16,6 +12,7 @@ import com.cim.idm.utils.EventInfoUtil;
|
|||||||
import com.cim.idm.wmsextend.generic.GenericServiceProxy;
|
import com.cim.idm.wmsextend.generic.GenericServiceProxy;
|
||||||
import com.cim.idm.wmsextend.generic.errorHandler.CustomException;
|
import com.cim.idm.wmsextend.generic.errorHandler.CustomException;
|
||||||
import com.cim.idm.wmsextend.generic.util.ConvertUtil;
|
import com.cim.idm.wmsextend.generic.util.ConvertUtil;
|
||||||
|
import com.cim.idm.wmspackage.materialpacking.management.data.MaterialPacking;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.jdom.Document;
|
import org.jdom.Document;
|
||||||
import org.jdom.Element;
|
import org.jdom.Element;
|
||||||
@ -262,7 +259,7 @@ public class QMSController {
|
|||||||
// @Transactional(isolation= Isolation.READ_COMMITTED)
|
// @Transactional(isolation= Isolation.READ_COMMITTED)
|
||||||
@Transactional
|
@Transactional
|
||||||
@RequestMapping(value = "/pqcSyncdata2", method = RequestMethod.POST)
|
@RequestMapping(value = "/pqcSyncdata2", method = RequestMethod.POST)
|
||||||
public AjaxResult pqcSyncdata2(@RequestBody JSONArray in) throws CustomException {
|
public AjaxResult pqcSyncdata2(@RequestBody JSONArray in) throws Exception {
|
||||||
|
|
||||||
AjaxResult result = new AjaxResult();
|
AjaxResult result = new AjaxResult();
|
||||||
ErpMessageLog loginfo = new ErpMessageLog();
|
ErpMessageLog loginfo = new ErpMessageLog();
|
||||||
@ -277,6 +274,7 @@ public class QMSController {
|
|||||||
String siteName = "SDK";
|
String siteName = "SDK";
|
||||||
|
|
||||||
SetEventInfo setEventInfo = new SetEventInfo();
|
SetEventInfo setEventInfo = new SetEventInfo();
|
||||||
|
SetEventInfo setEventInfo2 = new SetEventInfo();
|
||||||
EventInfo makeEventInfo = new EventInfoUtil().makeEventInfo("iqcSyncdata", "", "iqcSyncdata");
|
EventInfo makeEventInfo = new EventInfoUtil().makeEventInfo("iqcSyncdata", "", "iqcSyncdata");
|
||||||
EventInfo eventInfo = new EventInfo();
|
EventInfo eventInfo = new EventInfo();
|
||||||
eventInfo.setEventName("iqcSyncdata");
|
eventInfo.setEventName("iqcSyncdata");
|
||||||
@ -343,6 +341,7 @@ public class QMSController {
|
|||||||
bindMap.put("exceptionHandling",exceptionHandling);
|
bindMap.put("exceptionHandling",exceptionHandling);
|
||||||
bindMap.put("specialState", specialState);
|
bindMap.put("specialState", specialState);
|
||||||
setEventInfo.setUserColumns(bindMap);
|
setEventInfo.setUserColumns(bindMap);
|
||||||
|
|
||||||
//eventInfo.setEventTime(Timestamp.valueOf(pqcResultDate));
|
//eventInfo.setEventTime(Timestamp.valueOf(pqcResultDate));
|
||||||
eventInfo.setEventUser(user);
|
eventInfo.setEventUser(user);
|
||||||
List<String> sapBoxList = new ArrayList<> ();
|
List<String> sapBoxList = new ArrayList<> ();
|
||||||
@ -353,7 +352,7 @@ public class QMSController {
|
|||||||
if (!java.util.Objects.isNull(jsonArray)) {
|
if (!java.util.Objects.isNull(jsonArray)) {
|
||||||
for (int j = 0; j < jsonArray.size(); j++) {
|
for (int j = 0; j < jsonArray.size(); j++) {
|
||||||
String charge = jsonArray.getString(j);
|
String charge = jsonArray.getString(j);
|
||||||
String sql = "SELECT M.SITENAME ,M.MATERIALPACKINGNAME FROM MATERIALPACKING M "
|
String sql = "SELECT M.SITENAME ,M.MATERIALPACKINGNAME,M.OQARESULT FROM MATERIALPACKING M "
|
||||||
+ "WHERE M.CHARGE = :CHARGE AND M.MATERIALSPECNAME =:MATERIALSPECNAME AND M.STOCKSTATE = 'Stocked'";
|
+ "WHERE M.CHARGE = :CHARGE AND M.MATERIALSPECNAME =:MATERIALSPECNAME AND M.STOCKSTATE = 'Stocked'";
|
||||||
Map<String, Object> hashMap = new HashMap<String,Object> ();
|
Map<String, Object> hashMap = new HashMap<String,Object> ();
|
||||||
hashMap.put("CHARGE", charge);
|
hashMap.put("CHARGE", charge);
|
||||||
@ -367,12 +366,13 @@ public class QMSController {
|
|||||||
// MaterialPackingServiceProxy.getMaterialPackingService().setEvent(new MaterialPackingKey(queryForList.get(j).get("SITENAME").toString(),
|
// MaterialPackingServiceProxy.getMaterialPackingService().setEvent(new MaterialPackingKey(queryForList.get(j).get("SITENAME").toString(),
|
||||||
// queryForList.get(j).get("MATERIALPACKINGNAME").toString()), makeEventInfo, setEventInfo);
|
// queryForList.get(j).get("MATERIALPACKINGNAME").toString()), makeEventInfo, setEventInfo);
|
||||||
sapBoxList.add( queryForList.get(0).get("MATERIALPACKINGNAME").toString());
|
sapBoxList.add( queryForList.get(0).get("MATERIALPACKINGNAME").toString());
|
||||||
|
bindMap.put("preOqaResult", queryForList.get(0).get("OQARESULT") == null ? "PREOQA" : queryForList.get(0).get("OQARESULT").toString());
|
||||||
success ++;
|
success ++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (!StringUtils.isEmpty(commonNumber)) {
|
} else if (!StringUtils.isEmpty(commonNumber)) {
|
||||||
String sql = "SELECT M.SITENAME ,M.MATERIALPACKINGNAME FROM MATERIALPACKING M "
|
String sql = "SELECT M.SITENAME ,M.MATERIALPACKINGNAME,M.OQARESULT FROM MATERIALPACKING M "
|
||||||
+ "WHERE M.MESSAGEID = :RECEIVEREQUESTNAME";
|
+ "WHERE M.MESSAGEID = :RECEIVEREQUESTNAME";
|
||||||
Map<String, Object> hashMap = new HashMap<String,Object> ();
|
Map<String, Object> hashMap = new HashMap<String,Object> ();
|
||||||
hashMap.put("RECEIVEREQUESTNAME", commonNumber);
|
hashMap.put("RECEIVEREQUESTNAME", commonNumber);
|
||||||
@ -386,6 +386,7 @@ public class QMSController {
|
|||||||
// MaterialPackingServiceProxy.getMaterialPackingService().setEvent(new MaterialPackingKey(queryForList.get(j).get("SITENAME").toString(),
|
// MaterialPackingServiceProxy.getMaterialPackingService().setEvent(new MaterialPackingKey(queryForList.get(j).get("SITENAME").toString(),
|
||||||
// queryForList.get(j).get("MATERIALPACKINGNAME").toString()), makeEventInfo, setEventInfo);
|
// queryForList.get(j).get("MATERIALPACKINGNAME").toString()), makeEventInfo, setEventInfo);
|
||||||
sapBoxList.add(queryForList.get(j).get("MATERIALPACKINGNAME").toString());
|
sapBoxList.add(queryForList.get(j).get("MATERIALPACKINGNAME").toString());
|
||||||
|
bindMap.put("preOqaResult", queryForList.get(0).get("OQARESULT") == null ? "PREOQA" : queryForList.get(0).get("OQARESULT").toString());
|
||||||
success ++;
|
success ++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -394,12 +395,13 @@ public class QMSController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 将订单的质检结果传给SAP
|
// 将订单的质检结果传给SAP
|
||||||
String undoId = toSAPService.iqcResultFeekback(sapBoxList,siteName,commonNumber,materialCode,pqcResult,pqcResultDate,user,
|
// String undoId = toSAPService.iqcResultFeekback(sapBoxList,siteName,commonNumber,materialCode,pqcResult,pqcResultDate,user,
|
||||||
exceptionHandling,specialState);
|
// exceptionHandling,specialState);
|
||||||
|
|
||||||
if(mpList.size()>0)
|
if(mpList.size()>0)
|
||||||
{
|
{
|
||||||
MaterialPackingServiceProxy.getMaterialPackingService().setEvent(mpList, eventInfo, setEventInfo);
|
setEventInfo2.setUserColumns(bindMap);
|
||||||
|
MaterialPackingServiceProxy.getMaterialPackingService().setEvent(mpList, eventInfo, setEventInfo2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -450,7 +452,7 @@ public class QMSController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if ("1".equals(tpType) || "2".equals(tpType) || "3".equals(tpType) || "4".equals(tpType) || "5".equals(tpType)) {//料号+批次
|
} else if ("1".equals(tpType) || "2".equals(tpType) || "3".equals(tpType) || "4".equals(tpType) || "5".equals(tpType) || "7".equals(tpType)) {//料号+批次
|
||||||
String kcsql = "SELECT M.SITENAME ,M.MATERIALPACKINGNAME FROM MATERIALPACKING M "
|
String kcsql = "SELECT M.SITENAME ,M.MATERIALPACKINGNAME FROM MATERIALPACKING M "
|
||||||
+ "WHERE M.CHARGE = :BATCH AND M.MATERIALSPECNAME = :MATERIALSPECNAME";
|
+ "WHERE M.CHARGE = :BATCH AND M.MATERIALSPECNAME = :MATERIALSPECNAME";
|
||||||
Map<String, Object> hashMap = new HashMap<String,Object> ();
|
Map<String, Object> hashMap = new HashMap<String,Object> ();
|
||||||
@ -523,11 +525,18 @@ public class QMSController {
|
|||||||
saveMessageLog(loginfo);
|
saveMessageLog(loginfo);
|
||||||
|
|
||||||
//根据品质状态自动转库
|
//根据品质状态自动转库
|
||||||
|
// try {
|
||||||
|
// autoChangeERPlocation(in, makeEventInfo,mpList);
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// e.printStackTrace();
|
||||||
|
// throw new CustomException(e.toString());
|
||||||
|
// }
|
||||||
|
|
||||||
|
//根据品质状态自动转库2
|
||||||
try {
|
try {
|
||||||
autoChangeERPlocation(in, makeEventInfo,mpList);
|
autoChangeLOCATIONNAME(in, makeEventInfo,mpList);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
throw e;
|
||||||
throw new CustomException(e.toString());
|
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -792,7 +801,161 @@ public class QMSController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
public void autoChangeLOCATIONNAME (JSONArray in,EventInfo eventInfo,List<MaterialPackingKey> mpkList) throws Exception {
|
||||||
|
try {
|
||||||
|
String sqlDic = "SELECT\n" +
|
||||||
|
"\tS.DJERPLOCATION,\n" +
|
||||||
|
"\tS.TYPE,\n" +
|
||||||
|
"\tS.OKERPLOCATION\n" +
|
||||||
|
"FROM\n" +
|
||||||
|
"\tBS_ERPLOCATIONSHIP S\n" +
|
||||||
|
"LEFT JOIN STORAGESPEC s2 \n" +
|
||||||
|
"ON\n" +
|
||||||
|
"\tS.OKSTORAGENAME = s2.STORAGENAME\n" +
|
||||||
|
"WHERE\n" +
|
||||||
|
"\tS.DJERPLOCATION = :ERPLOCATION";
|
||||||
|
Map<String, Object> hashMap2 = new HashMap<String,Object> ();
|
||||||
|
for (int i = 0; i < in.size(); i++) {
|
||||||
|
JSONObject jb = in.getJSONObject(i);
|
||||||
|
String commonNumber = jb.get("commonNumber").toString();//通用单号
|
||||||
|
String materialCode = jb.get("materialCode")== null ? "" : jb.get("materialCode").toString();//料号
|
||||||
|
String pqcResult = jb.get("judgementResult").toString();//检验结果
|
||||||
|
String pqcResultDate = jb.get("resultTime").toString();//检验时间
|
||||||
|
String user = jb.get("inspector").toString();//检验员
|
||||||
|
String exceptionHandling = jb.get("exceptionHandling") == null ? "" : jb.get("exceptionHandling").toString();//异常处理 (0复卷,1降级,2报废)
|
||||||
|
String specialState = jb.get("specialState") == null ? "" : jb.get("specialState").toString();//特殊状态 (0特采、1紧急放行)
|
||||||
|
String transferStatus = jb.get("transferStatus") == null ? "" : jb.get("transferStatus").toString();//异常处理
|
||||||
|
|
||||||
|
String tpType = jb.get("tpType").toString();//检验类型
|
||||||
|
//0不合格、1合格
|
||||||
|
if("1".equals(pqcResult))
|
||||||
|
{
|
||||||
|
pqcResult="OK";
|
||||||
|
}else if ("0".equals(pqcResult)) {
|
||||||
|
pqcResult = "NG";
|
||||||
|
continue;//NG直接跳过
|
||||||
|
}
|
||||||
|
List<MaterialPackingKey> mpList = new ArrayList<> ();
|
||||||
|
// 转货位
|
||||||
|
List<String> boxList1 = new ArrayList<> ();
|
||||||
|
// 转仓库
|
||||||
|
List<String> boxList2 = new ArrayList<> ();
|
||||||
|
SetEventInfo setEventInfo = new SetEventInfo();
|
||||||
|
if (mpkList == null || mpkList.size() < 1) {
|
||||||
|
} else {
|
||||||
|
for (int j=0;j<mpkList.size();j++) {
|
||||||
|
String sql = "SELECT M.SITENAME ,M.MATERIALPACKINGNAME,M.ERPLOCATION,M.LOCATIONNAME,M.PREERPLOCATION,M.PREOQARESULT FROM MATERIALPACKING M "
|
||||||
|
+ "WHERE M.MATERIALPACKINGNAME = :MATERIALPACKINGNAME AND M.STOCKSTATE = 'Stocked'";
|
||||||
|
Map<String, Object> hashMap = new HashMap<String,Object> ();
|
||||||
|
hashMap.put("MATERIALPACKINGNAME", mpkList.get(j).getMaterialPackingName());
|
||||||
|
List<Map<String, Object>> queryForList = IDMFrameServiceProxy.getSqlTemplate().queryForList(sql, hashMap);
|
||||||
|
|
||||||
|
if(queryForList.isEmpty()) {
|
||||||
|
throw new CustomException(mpkList.get(j).getMaterialPackingName() + " 该标签已出库");
|
||||||
|
}
|
||||||
|
hashMap2.put("ERPLOCATION", queryForList.get(0).get("ERPLOCATION") == null ? "" : queryForList.get(0).get("ERPLOCATION"));
|
||||||
|
// hashMap2.put("LOCATIONNAME", queryForList.get(0).get("LOCATIONNAME") == null ? "" : queryForList.get(0).get("LOCATIONNAME"));
|
||||||
|
|
||||||
|
List<Map<String, Object>> queryForList2 = IDMFrameServiceProxy.getSqlTemplate().queryForList(sqlDic, hashMap2);
|
||||||
|
if (queryForList2 == null || queryForList2.size() < 1) {
|
||||||
|
log.info("未找到待检货位");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
String DJERPLOCATION=queryForList2.get(0).get("DJERPLOCATION")==null?"":queryForList2.get(0).get("DJERPLOCATION").toString();
|
||||||
|
String OKERPLOCATION=queryForList2.get(0).get("OKERPLOCATION")==null?"":queryForList2.get(0).get("OKERPLOCATION").toString();
|
||||||
|
String PREOQARESULT = queryForList.get(0).get("PREOQARESULT")==null?"":queryForList.get(0).get("PREOQARESULT").toString();
|
||||||
|
String TYPE = queryForList2.get(0).get("TYPE")==null?"":queryForList2.get(0).get("TYPE").toString();
|
||||||
|
Map<String, Object> hashMap3 = new HashMap<String,Object> ();
|
||||||
|
hashMap3.put("preErpLocation", queryForList.get(0).get("ERPLOCATION"));
|
||||||
|
hashMap3.put("PRELOCATIONNAME", queryForList.get(0).get("LOCATIONNAME") == null ? "" : queryForList.get(0).get("LOCATIONNAME"));
|
||||||
|
// if ("OK".equals(pqcResult)) {
|
||||||
|
if(OKERPLOCATION.length()==0 || ("PREOQA".equals(PREOQARESULT) && pqcResult == "OK") || PREOQARESULT.equals(pqcResult))
|
||||||
|
{
|
||||||
|
log.info("未维护转库对应关系");
|
||||||
|
continue;
|
||||||
|
//throw new CustomException("未维护转库对应关系");
|
||||||
|
}else {
|
||||||
|
hashMap3.put("erpLocation", queryForList2.get(0).get("OKERPLOCATION"));
|
||||||
|
// hashMap3.put("locationName", queryForList2.get(0).get("OKSTORAGENAME"));
|
||||||
|
mpList.add(new MaterialPackingKey( queryForList.get(0).get("SITENAME").toString(),
|
||||||
|
queryForList.get(0).get("MATERIALPACKINGNAME").toString()));
|
||||||
|
|
||||||
|
boxList2.add( queryForList.get(0).get("MATERIALPACKINGNAME").toString());
|
||||||
|
setEventInfo.setUserColumns(hashMap3);
|
||||||
|
MaterialPackingServiceProxy.getMaterialPackingService().setEvent(new MaterialPackingKey( queryForList.get(0).get("SITENAME").toString(),
|
||||||
|
queryForList.get(0).get("MATERIALPACKINGNAME").toString()), eventInfo, setEventInfo);
|
||||||
|
}
|
||||||
|
// }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if(boxList2.size()>0) {
|
||||||
|
// gzQMSTemp(boxList2,"1",mpList,user,"SDK",commonNumber,materialCode,pqcResult,pqcResultDate, exceptionHandling,specialState);
|
||||||
|
Map<String, Object> hashMap = new HashMap<>();
|
||||||
|
hashMap.put("BOXLIST", boxList2);
|
||||||
|
|
||||||
|
//按不同仓库划分为多个条码,一对多关系,LISTAGG ,MATERIALPACKINGNAMES是一个逗号隔开的字符串如"a,b,c"
|
||||||
|
String sqlLocation = "SELECT \n" +
|
||||||
|
" m.ERPLOCATION,\n" +
|
||||||
|
" LISTAGG(m.MATERIALPACKINGNAME, ',') WITHIN GROUP (ORDER BY m.MATERIALPACKINGNAME) AS MATERIALPACKINGNAMES\n" +
|
||||||
|
"FROM MATERIALPACKING m\n" +
|
||||||
|
"WHERE m.MATERIALPACKINGNAME IN (:BOXLIST) AND m.STOCKSTATE = 'Stocked'\n" +
|
||||||
|
"GROUP BY m.ERPLOCATION";
|
||||||
|
|
||||||
|
List<Map<String, Object>> queryForList = IDMFrameServiceProxy.getSqlTemplate().queryForList(sqlLocation, hashMap);
|
||||||
|
for (int j=0;j<queryForList.size();j++) {
|
||||||
|
String makps = queryForList.get(j).get("MATERIALPACKINGNAMES").toString();
|
||||||
|
String ERPLOCATION = queryForList.get(j).get("ERPLOCATION").toString();
|
||||||
|
List<String> LocationBoxList = Arrays.stream(makps.split(","))
|
||||||
|
.map(String::trim) // 去除每个元素的空格
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
String billCode = "";
|
||||||
|
// if( "3".equals(TYPE)) {
|
||||||
|
|
||||||
|
List<MaterialPacking> MpList = new ArrayList<MaterialPacking>();
|
||||||
|
List<MaterialPackingKey> MpKeyList = new ArrayList<MaterialPackingKey>();
|
||||||
|
for (int z=0;z<LocationBoxList.size();z++) {
|
||||||
|
Map<String, Object> hashMapLo = new HashMap<>();
|
||||||
|
hashMapLo.put("MATERIALPACKINGNAME", LocationBoxList.get(z));
|
||||||
|
String sqlLo = "SELECT MATERIALPACKINGNAME,SITENAME FROM MATERIALPACKING WHERE MATERIALPACKINGNAME = :MATERIALPACKINGNAME";
|
||||||
|
List<Map<String, Object>> materialPackingList = IDMFrameServiceProxy.getSqlTemplate().queryForList(sqlLo, hashMapLo);
|
||||||
|
Map<String, Object> mPKingHashMap = new HashMap<>();
|
||||||
|
// mPKingHashMap.put("MATERIALPACKINGNAME", materialPackingList.get(z).get("MATERIALPACKINGNAME"));
|
||||||
|
|
||||||
|
MaterialPackingKey mpkey = new MaterialPackingKey();
|
||||||
|
String SITENAME = materialPackingList.get(0).get("SITENAME") == null ? "" : materialPackingList.get(0).get("SITENAME").toString();
|
||||||
|
|
||||||
|
mpkey.setSiteName(SITENAME);
|
||||||
|
mpkey.setMaterialPackingName(materialPackingList.get(0).get("MATERIALPACKINGNAME").toString());
|
||||||
|
MaterialPacking mp = MaterialPackingServiceProxy.getMaterialPackingService().selectByKey(mpkey);
|
||||||
|
|
||||||
|
MpList.add(mp);
|
||||||
|
MpKeyList.add(mpkey);
|
||||||
|
}
|
||||||
|
|
||||||
|
String commitDate=TimeStampUtil.getCurrentTime("yyyy-MM-dd") + " 00:00:00";
|
||||||
|
UUID uuid = UUID.randomUUID();
|
||||||
|
billCode = toSAPService.autoTurnWareAndQms(MpKeyList,ERPLOCATION,user,pqcResult);
|
||||||
|
|
||||||
|
// }else {
|
||||||
|
// billCode = NCWServiceImpl.OQZkNoInvoice(LocationBoxList, sendUser);
|
||||||
|
// }
|
||||||
|
|
||||||
|
if (billCode == null || "".equals(billCode)) {
|
||||||
|
throw new CustomException("ERP过账失败!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public void autoChangeERPlocation (JSONArray in,EventInfo eventInfo,List<MaterialPackingKey> mpkList) throws Exception {
|
public void autoChangeERPlocation (JSONArray in,EventInfo eventInfo,List<MaterialPackingKey> mpkList) throws Exception {
|
||||||
String sqlDic = "SELECT s.OKERPLOCATION,s.BEPENDINGERPLOCATION,\r\n" +
|
String sqlDic = "SELECT s.OKERPLOCATION,s.BEPENDINGERPLOCATION,\r\n" +
|
||||||
@ -885,7 +1048,8 @@ public class QMSController {
|
|||||||
if(boxList.size()>0)
|
if(boxList.size()>0)
|
||||||
{
|
{
|
||||||
String sendUser="101867";
|
String sendUser="101867";
|
||||||
// NCWServiceImpl.OQZkNoInvoice(boxList, sendUser);
|
// String undoId = toSAPService.iqcResultFeekback(boxList,"SDK",commonNumber,materialCode,pqcResult,pqcResultDate,user,
|
||||||
|
// exceptionHandling,specialState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -952,7 +1116,8 @@ public class QMSController {
|
|||||||
if(boxList.size()>0)
|
if(boxList.size()>0)
|
||||||
{
|
{
|
||||||
String sendUser="101867";
|
String sendUser="101867";
|
||||||
// NCWServiceImpl.OQZkNoInvoice(boxList, sendUser);
|
// String undoId = toSAPService.iqcResultFeekback(sapBoxList,siteName,commonNumber,materialCode,pqcResult,pqcResultDate,user,
|
||||||
|
// exceptionHandling,specialState);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -588,7 +588,6 @@ public class ReturnStockIntoServiceImpl implements ReturnStockInService {
|
|||||||
}
|
}
|
||||||
SaveUnDoInfo(billCode, commitDate);
|
SaveUnDoInfo(billCode, commitDate);
|
||||||
|
|
||||||
|
|
||||||
Map<String, Object> requestBodyMap = new HashMap<>();
|
Map<String, Object> requestBodyMap = new HashMap<>();
|
||||||
requestBodyMap.put("chargeList", chargeList);
|
requestBodyMap.put("chargeList", chargeList);
|
||||||
String requestBody = new ObjectMapper(requestBodyMap).toString();
|
String requestBody = new ObjectMapper(requestBodyMap).toString();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user