fix:修改产成品入库
This commit is contained in:
parent
5e080ab0d7
commit
a41f66bccf
@ -13,11 +13,13 @@ import com.cim.idm.wmsextend.generic.errorHandler.CustomException;
|
||||
import com.cim.idm.wmspackage.materialpacking.management.data.MaterialPackingKey;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.JsonMappingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.MapUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
|
||||
import java.util.*;
|
||||
@Slf4j
|
||||
@ -26,6 +28,8 @@ public class ToSAPServiceImpl {
|
||||
|
||||
@Autowired
|
||||
private ToSAPMessageUtil toSAPMessageUtil;
|
||||
|
||||
|
||||
public String PurStockIn(String receiveRequestName, String siteName, String user,
|
||||
Map<String, ?> args) throws Exception {
|
||||
|
||||
@ -516,17 +520,25 @@ public class ToSAPServiceImpl {
|
||||
* @return 返回物料凭证相关的ID
|
||||
* @throws Exception 如果与SAP系统的通信或其他错误发生时抛出异常
|
||||
*/
|
||||
public String FGStockInByManulIn(String bodyJson, String user) throws Exception {
|
||||
public String FGStockInByManulIn( String bodyJson, String user, String RECEIVEACTNO) throws Exception {
|
||||
// 初始化SAP返回信息、结果代码、消息文本和撤销ID
|
||||
String sapreturn = "";
|
||||
String rcode = "";
|
||||
String rmsg = "";
|
||||
String undoId = "";
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
List<Map<String, Object>> objList = objectMapper.readValue(
|
||||
bodyJson,
|
||||
new TypeReference<List<Map<String, Object>>>() {}
|
||||
);
|
||||
|
||||
String makeFGStockIn = makeFGStockIn2(objList, user, RECEIVEACTNO);
|
||||
|
||||
try {
|
||||
// 发送物料信息到SAP系统
|
||||
sapreturn = toSAPMessageUtil.sendHttpPost(toSAPMessageUtil.materialChangeLocationUrl, "",
|
||||
bodyJson);
|
||||
makeFGStockIn);
|
||||
|
||||
// 解析SAP系统的返回信息
|
||||
org.json.JSONObject receiveJsonObject = new org.json.JSONObject(sapreturn);
|
||||
@ -692,6 +704,58 @@ public class ToSAPServiceImpl {
|
||||
String sendData = ToSAPMessageUtil.mm067(eventUser, bodyData, itemsData);
|
||||
return sendData;
|
||||
}
|
||||
public String makeFGStockIn2(List<Map<String, Object>> list, String eventUser, String receiveRequestName) 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);
|
||||
return sendData;
|
||||
}
|
||||
//取消成品入库接口字段。zd.2024.8.29
|
||||
public String makeCancelFGStockIn(List<Map<String, Object>> list, String eventUser) throws JsonMappingException, JsonProcessingException {
|
||||
|
||||
|
@ -565,30 +565,33 @@ public class SAPToWMSController {
|
||||
String sqlCheck ="SELECT * FROM materialreceiverequest WHERE receiverequestname =:receiverequestname";
|
||||
Map<String, Object> selectMap= new HashMap<String, Object>();
|
||||
selectMap.put("receiverequestname", receiveRequestName);
|
||||
List<Map<String, Object>> checkResultList = IDMFrameServiceProxy.getSqlTemplate().queryForList(sqlCheck, selectMap);
|
||||
|
||||
List<Map<String, Object>> isResultList = IDMFrameServiceProxy.getSqlTemplate().queryForList(sqlCheck, selectMap);
|
||||
// 检验单据是否已存在,并且未被使用过账
|
||||
String isSql = "SELECT\n" +
|
||||
"\t*\n" +
|
||||
"m.RECEIVEREQUESTNAME,\n" +
|
||||
"SUM(md.RECEIVEDQUANTITY)\n" +
|
||||
"FROM\n" +
|
||||
"\tMATERIALRECEIVEREQUEST m\n" +
|
||||
"MATERIALRECEIVEREQUEST m\n" +
|
||||
"LEFT JOIN MATERIALRECEIVEREQUESTDETAIL md ON\n" +
|
||||
"\tmd.RECEIVEREQUESTNAME = m.RECEIVEREQUESTNAME\n" +
|
||||
"md.RECEIVEREQUESTNAME = m.RECEIVEREQUESTNAME\n" +
|
||||
"WHERE\n" +
|
||||
"\tm.RECEIVEREQUESTNAME =:receiverequestname\n" +
|
||||
"\tAND md.RECEIVEDQUANTITY > 0";
|
||||
"m.RECEIVEREQUESTNAME =:receiverequestname\n" +
|
||||
"AND md.RECEIVEDQUANTITY > 0\n" +
|
||||
"GROUP BY m.RECEIVEREQUESTNAME";
|
||||
|
||||
List<Map<String, Object>> isList = IDMFrameServiceProxy.getSqlTemplate().queryForList(isSql, selectMap);
|
||||
if (isList != null && isList.size() > 0) {
|
||||
throw new CustomException("ERROR","单据已存在,并且已存在过账!");
|
||||
}else {
|
||||
throw new CustomException("ERROR","单据已存在,并且已存在过账,不能更新或删除!");
|
||||
}else if(isResultList != null && isResultList.size() > 0) {
|
||||
String shipquestSql="DELETE FROM MATERIALRECEIVEREQUEST WHERE receiveRequestName =?";
|
||||
String shipDetailSql="DELETE FROM MATERIALRECEIVEREQUESTDETAIL WHERE receiveRequestName =?";
|
||||
Object[] obj=new Object[] {receiveRequestName, receiveRequestName};
|
||||
Object[] obj=new Object[] {receiveRequestName};
|
||||
IDMFrameServiceProxy.getSqlTemplate().update(shipquestSql, obj);
|
||||
IDMFrameServiceProxy.getSqlTemplate().update(shipDetailSql, obj);
|
||||
}
|
||||
|
||||
List<Map<String, Object>> checkResultList = IDMFrameServiceProxy.getSqlTemplate().queryForList(sqlCheck, selectMap);
|
||||
|
||||
if(checkResultList == null || checkResultList.size() == 0) {
|
||||
CreateReceiveRequestInfo createInfo = new CreateReceiveRequestInfo();
|
||||
createInfo.setSiteName(sitename);
|
||||
@ -1057,29 +1060,32 @@ public class SAPToWMSController {
|
||||
String sqlCheck =" SELECT * FROM materialshiprequest m WHERE shiprequestname =:SHIPREQUESTNAME ";
|
||||
Map<String, Object> selectMap= new HashMap<String, Object>();
|
||||
selectMap.put("SHIPREQUESTNAME", shipRequestName);
|
||||
List<Map<String, Object>> checkResultList = IDMFrameServiceProxy.getSqlTemplate().queryForList(sqlCheck, selectMap);
|
||||
List<Map<String, Object>> isResultList = IDMFrameServiceProxy.getSqlTemplate().queryForList(sqlCheck, selectMap);
|
||||
|
||||
String isSql = "SELECT\n" +
|
||||
"\t*\n" +
|
||||
"m.SHIPREQUESTNAME ,\n" +
|
||||
"SUM(md.SALEOUTQUANTITY) \n" +
|
||||
"FROM\n" +
|
||||
"\tMATERIALSHIPREQUEST m\n" +
|
||||
"MATERIALSHIPREQUEST m\n" +
|
||||
"LEFT JOIN MATERIALSHIPREQUESTDETAIL md ON\n" +
|
||||
"\tmd.SHIPREQUESTNAME = m.SHIPREQUESTNAME\n" +
|
||||
"md.SHIPREQUESTNAME = m.SHIPREQUESTNAME\n" +
|
||||
"WHERE\n" +
|
||||
"\tm.SHIPREQUESTNAME =:SHIPREQUESTNAME\n" +
|
||||
"\tAND md.SALEOUTQUANTITY > 0";
|
||||
"m.SHIPREQUESTNAME =:SHIPREQUESTNAME\n" +
|
||||
"AND md.SALEOUTQUANTITY > 0\n" +
|
||||
"GROUP BY m.SHIPREQUESTNAME";
|
||||
|
||||
List<Map<String, Object>> isList = IDMFrameServiceProxy.getSqlTemplate().queryForList(isSql, selectMap);
|
||||
if (isList != null && isList.size() > 0) {
|
||||
throw new CustomException("ERROR","单据已存在,并且已存在过账!");
|
||||
}else {
|
||||
}else if (isResultList != null && isResultList.size() > 0) {
|
||||
String shipquestSql="DELETE FROM MATERIALSHIPREQUEST WHERE shiprequestname =?";
|
||||
String shipDetailSql="DELETE FROM materialshiprequestdetail WHERE shiprequestname =?";
|
||||
Object[] obj=new Object[] {shipRequestName, shipRequestName};
|
||||
Object[] obj=new Object[] {shipRequestName};
|
||||
IDMFrameServiceProxy.getSqlTemplate().update(shipquestSql, obj);
|
||||
IDMFrameServiceProxy.getSqlTemplate().update(shipDetailSql, obj);
|
||||
}
|
||||
|
||||
List<Map<String, Object>> checkResultList = IDMFrameServiceProxy.getSqlTemplate().queryForList(sqlCheck, selectMap);
|
||||
|
||||
if(checkResultList == null || checkResultList.size() == 0) {
|
||||
CreateMaterialShipRequestInfo createInfo = new CreateMaterialShipRequestInfo();
|
||||
|
@ -17,12 +17,12 @@ public class ToSAPFgStockInDto {
|
||||
// m.MATERIALSPECTYPE,
|
||||
// sum(m.MATERIALQUANTITY ) MATERIALQUANTITY
|
||||
|
||||
private String materialSpecName;
|
||||
private String productOrder;
|
||||
private String packingGrade;
|
||||
private String erpFactory;
|
||||
private String erpLocation;
|
||||
private String unit;
|
||||
private String materialSpecType;
|
||||
private String materialQuantity;
|
||||
private String MATERIALSPECNAME;
|
||||
private String PRODUCTORDER;
|
||||
private String PACKINGGRADE;
|
||||
private String ERPFACTORY;
|
||||
private String ERPLOCATION;
|
||||
private String UNIT;
|
||||
private String MATERIALSPECTYPE;
|
||||
private String MATERIALQUANTITY;
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ import com.cim.idm.framework.data.EventInfo;
|
||||
import com.cim.idm.framework.util.time.TimeStampUtil;
|
||||
import com.cim.idm.model.ToSAPFgStockInDto;
|
||||
import com.cim.idm.service.FGStockInService;
|
||||
import com.cim.idm.service.impl.MESServiceImpl;
|
||||
import com.cim.idm.service.impl.ToSAPServiceImpl;
|
||||
import com.cim.idm.utils.CommonUtils;
|
||||
import com.cim.idm.utils.EventInfoUtil;
|
||||
@ -296,7 +297,7 @@ public class ProductIntoServiceImpl implements FGStockInService {
|
||||
EventInfo eventInfo = EventInfoUtil.makeEventInfo("receiveMesShippInfo", user, "receiveMesShippInfo");
|
||||
|
||||
List<MaterialPackingKey> arrayList = new ArrayList<MaterialPackingKey> ();
|
||||
|
||||
List<String> chargeList = new ArrayList<> ();
|
||||
//将查询的结果写入MaterialPacking表
|
||||
for(int i=0;i<packingList.size();i++){
|
||||
//util将实体类中有值的放到map
|
||||
@ -313,6 +314,7 @@ public class ProductIntoServiceImpl implements FGStockInService {
|
||||
|
||||
MaterialPackingKey materialPackingKey = new MaterialPackingKey("SDK",packingList.get(i).getMaterialPackingName());
|
||||
arrayList.add(materialPackingKey);
|
||||
chargeList.add(packingList.get(i).getMaterialPackingName());
|
||||
}
|
||||
//调用Sap入库接口
|
||||
List<ToSAPFgStockInDto> fgStockInInfo = toSapDao.getFgStockInInfo(boxList);
|
||||
@ -331,8 +333,10 @@ public class ProductIntoServiceImpl implements FGStockInService {
|
||||
}else {
|
||||
// 直接入库
|
||||
//封装为Json的字符串
|
||||
|
||||
// String json = JSON.toJSONString(fgStockInInfo);
|
||||
String json = JSON.toJSONString(fgStockInInfo);
|
||||
undoID = toSAPService.FGStockInByManulIn(json, user);
|
||||
undoID = toSAPService.FGStockInByManulIn(json, user,receiveRequestActNo);
|
||||
|
||||
// String pc = "(";
|
||||
// for (MaterialPacking materialPacking : boxList) {
|
||||
@ -349,6 +353,9 @@ public class ProductIntoServiceImpl implements FGStockInService {
|
||||
toSapDao.saveUnDoInfo( boxList, undoID, commitDate);
|
||||
//更新接口表的标记和
|
||||
fgStockInDao.updateBsMesShipped(boxList);
|
||||
|
||||
MESServiceImpl mesService=new MESServiceImpl() ;
|
||||
mesService.CCPRK_deleteMaterialPackingInfo(chargeList);
|
||||
}
|
||||
|
||||
|
||||
|
@ -281,7 +281,7 @@ public class ReturnStockIntoServiceImpl implements ReturnStockInService {
|
||||
// SHIPMesShippInfo(makeEventInfo, "SDK", materialPackingName, "", user,
|
||||
// materialPackingName, ReceiveRequestActNo, erpLocation, erpFactory, locationName,queryForList.get(0).get("SHIPREQUESTNAME").toString(), queryForList.get(0).get("SHIPREQUESTDETAILNAME").toString());
|
||||
|
||||
SHIPMesShippInfo(makeEventInfo, "SDK", materialPackingName, "", user,
|
||||
SHIPMesShippInfo2(makeEventInfo, "SDK", materialPackingName, "", user,
|
||||
materialPackingName, ReceiveRequestActNo, erpLocation, erpFactory, locationName,list2.get(0).get("REQUESTNAME").toString(), "");
|
||||
|
||||
} catch (Exception e) {
|
||||
@ -359,6 +359,212 @@ public class ReturnStockIntoServiceImpl implements ReturnStockInService {
|
||||
}
|
||||
|
||||
|
||||
// 查出是否存在原标签
|
||||
// String receive_flag = queryForList.get(0).get("RECEIVE_FLAG") == null ? "" : queryForList.get(0).get("RECEIVE_FLAG").toString();
|
||||
// String PREMATERIALPACKINGNAME = queryForList.get(0).get("PREMATERIALPACKINGNAME") == null ? "" : queryForList.get(0).get("PREMATERIALPACKINGNAME").toString();
|
||||
//
|
||||
// List<Map<String, Object>> xcqueryForList = new ArrayList<Map<String, Object>> ();
|
||||
// Map<String, Object> xcHashMap = new HashMap<String,Object> ();
|
||||
// xcHashMap.put("CHARGE", queryForList.get(0).get("CHARGE"));
|
||||
// xcHashMap.put("MATERIALPACKINGNAME", PREMATERIALPACKINGNAME);
|
||||
//
|
||||
// String xcSql = "SELECT * FROM MATERIALPACKING m WHERE m.CHARGE = :CHARGE AND m.MATERIALPACKINGNAME = :MATERIALPACKINGNAME";
|
||||
// xcqueryForList = IDMFrameServiceProxy.getSqlTemplate().queryForList(xcSql, xcHashMap);
|
||||
|
||||
|
||||
//判断标签是否存在,存在就更新不存在就创建新的入库
|
||||
String judgeSql = "SELECT * FROM MATERIALPACKING m WHERE m.MATERIALPACKINGNAME = :MATERIALPACKINGNAME";
|
||||
List<Map<String, Object>> queryForList2 = IDMFrameServiceProxy.getSqlTemplate().queryForList(judgeSql, hashMap);
|
||||
if (queryForList2 == null || queryForList2.size() < 1) {
|
||||
//入库信息存入库存表
|
||||
CreateInfo createInfo = new CreateInfo();
|
||||
createInfo.setSiteName(siteName);
|
||||
createInfo.setMaterialPackingName(materialPackingName);// 新生成的box id
|
||||
createInfo.setMaterialPackingType("Box");
|
||||
createInfo.setContentMaterialType("");
|
||||
Map<String, Object> bindMap = new HashMap<String, Object>();
|
||||
String packingGrade = queryForList.get(0).get("PACKINGGRADE") == null ? "" : queryForList.get(0).get("PACKINGGRADE").toString();
|
||||
if (!"".equals(packingGrade)) {
|
||||
bindMap.put("oqaResultState", GenericServiceProxy.getConstantMap().OQA_State_End);
|
||||
bindMap.put("oqaResult",packingGrade);
|
||||
bindMap.put("packingGrade", packingGrade);
|
||||
} else {
|
||||
bindMap.put("oqaResultState",GenericServiceProxy.getConstantMap().OQA_State_Pre);
|
||||
}
|
||||
|
||||
|
||||
bindMap.put("lkMaterialPackingName", palletName);
|
||||
bindMap.put("MaterialType", queryForList.get(0).get("MATERIALTYPE"));
|
||||
bindMap.put("MaterialSpecName", queryForList.get(0).get("MATERIALSPECNAME"));
|
||||
bindMap.put("PackingGrade", queryForList.get(0).get("PACKINGGRADE"));
|
||||
bindMap.put("SubPackingQuantity",queryForList.get(0).get("MATERIALQUANTITY"));
|
||||
bindMap.put("MaterialCreateQuantity",
|
||||
queryForList.get(0).get("MATERIALQUANTITY"));
|
||||
bindMap.put("MaterialQuantity", queryForList.get(0).get("MATERIALQUANTITY"));// 数量
|
||||
bindMap.put("PackingState", "Released");
|
||||
bindMap.put("OldPackingState", "Released");
|
||||
bindMap.put("stockState", "Created");
|
||||
bindMap.put("OldStockState", "Created");
|
||||
bindMap.put("truegg", queryForList.get(0).get("TRUEGG"));
|
||||
bindMap.put("HoldState", "N");
|
||||
bindMap.put("AreaName", queryForList.get(0).get("AREANAME"));
|
||||
bindMap.put("LocationName", locationName);
|
||||
bindMap.put("charge",queryForList.get(0).get("CHARGE"));
|
||||
bindMap.put("DurableName", durableName);
|
||||
bindMap.put("MaterialProcessGroupName",
|
||||
"");
|
||||
bindMap.put("LastEventTimeKey",
|
||||
TimeStampUtil.getCurrentEventTimeKey());
|
||||
bindMap.put("receiveRequestName", SHIPRequestName);
|
||||
bindMap.put("productOrder", SHIPRequestName);
|
||||
bindMap.put("receiveRequestDetailName",SHIPRequestDetailName);
|
||||
//如果queryForList.get(0).get("SHIPTIME")为null获取当前时间字符串"YYYY-MM-DD"
|
||||
String makeDate = queryForList.get(0).get("SHIPTIME") == null ? TimeStampUtil.getCurrentTime("yyyy-MM-dd") : queryForList.get(0).get("SHIPTIME").toString();
|
||||
|
||||
|
||||
bindMap.put("MakeDate", makeDate);
|
||||
|
||||
if(queryForList.get(0).get("EXPIRINGDATE") == null || queryForList.get(0).get("EXPIRINGDATE").toString().isEmpty()) {
|
||||
bindMap.put("expiringDate", getExpridate( makeDate, queryForList.get(0).get("MATERIALSPECNAME").toString()));
|
||||
}else {
|
||||
bindMap.put("expiringDate", queryForList.get(0).get("EXPIRINGDATE").toString());
|
||||
}
|
||||
|
||||
bindMap.put("SHIPTime", eventInfo.getEventTime());
|
||||
bindMap.put("SHIPUser", eventInfo.getEventUser());
|
||||
bindMap.put("ReceiveTime", eventInfo.getEventTime());
|
||||
bindMap.put("ReceiveUser", eventInfo.getEventUser());
|
||||
bindMap.put("ShipTime",queryForList.get(0).get("SHIPTIME"));
|
||||
|
||||
bindMap.put("MJPC",queryForList.get(0).get("MJPC"));
|
||||
bindMap.put("RETURNPC",queryForList.get(0).get("RETURNPC"));
|
||||
|
||||
bindMap.put("ShipUser",queryForList.get(0).get("SHIPUSER"));
|
||||
|
||||
// 如果是现场仓更新标签,需根据批次才能找到对应的原标签
|
||||
// if("T".equals(receive_flag)) {
|
||||
// // 如果存在对应的原标签,MATERIALPACKINGNAME相等,组织 仓库 货位 用原标签,拥于后面过账
|
||||
// if(xcqueryForList != null && xcqueryForList.size() > 0) {
|
||||
// erpFactory = xcqueryForList.get(0).get("ErpFactory") == null ? "" : xcqueryForList.get(0).get("ErpFactory").toString();
|
||||
// erpLocation = xcqueryForList.get(0).get("ErpLocation") == null ? "" : xcqueryForList.get(0).get("ErpLocation").toString();
|
||||
// locationName = xcqueryForList.get(0).get("LocationName") == null ? "" : xcqueryForList.get(0).get("LocationName").toString();
|
||||
// }
|
||||
// }
|
||||
|
||||
bindMap.put("ErpLocation", erpLocation);
|
||||
bindMap.put("ErpFactory", erpFactory);
|
||||
bindMap.put("receiveActNo", SHIPActNo);
|
||||
bindMap.put("locationName", locationName);
|
||||
bindMap.put("StockInType", "Return");
|
||||
bindMap.put("SDK_ID", queryForList.get(0).get("SDK_ID"));
|
||||
bindMap.put("PHASE", queryForList.get(0).get("PHASE"));
|
||||
bindMap.put("unit", queryForList.get(0).get("UNIT"));
|
||||
bindMap.put("CAREER_ASSISTANCE", queryForList.get(0).get("CAREER_ASSISTANCE"));//业助信息
|
||||
bindMap.put("BUSINESS_UNIT", queryForList.get(0).get("BUSINESS_UNIT"));//业务
|
||||
bindMap.put("SALESPERSON", queryForList.get(0).get("SALESPERSON"));//事业部
|
||||
bindMap.put("CUSTOMNO", queryForList.get(0).get("CUSTOMNO"));//客户
|
||||
bindMap.put("remark", queryForList.get(0).get("REMARK"));//备注
|
||||
createInfo.setUserColumns(bindMap);
|
||||
MaterialPackingKey materialPackingKey = new MaterialPackingKey(siteName,materialPackingName);
|
||||
MaterialPackingServiceProxy.getMaterialPackingService().create(
|
||||
eventInfo, createInfo);
|
||||
|
||||
// 如果是现场仓更新标签,需根据批次才能找到对应的原标签
|
||||
// if("T".equals(receive_flag)) {
|
||||
// 如果存在对应的原标签,MATERIALPACKINGNAME相等,就删除原标签
|
||||
// if(xcqueryForList != null && xcqueryForList.size() > 0) {
|
||||
// String delsql = "DELETE FROM MATERIALPACKING m WHERE m.CHARGE = :CHARGE AND m.MATERIALPACKINGNAME = :MATERIALPACKINGNAME";
|
||||
// IDMFrameServiceProxy.getSqlTemplate().update(delsql, xcHashMap);
|
||||
// }
|
||||
// }
|
||||
|
||||
} else {
|
||||
SetEventInfo setEventInfo = new SetEventInfo();
|
||||
Map<String, Object> bindMap = new HashMap<String, Object>();
|
||||
String packingGrade = queryForList.get(0).get("PACKINGGRADE") == null ? "" : queryForList.get(0).get("PACKINGGRADE").toString();
|
||||
if (!"".equals(packingGrade)) {
|
||||
bindMap.put("oqaResultState",GenericServiceProxy.getConstantMap().OQA_State_End);
|
||||
bindMap.put("oqaResult",packingGrade);
|
||||
bindMap.put("packingGrade", packingGrade);
|
||||
} else {
|
||||
bindMap.put("oqaResultState",GenericServiceProxy.getConstantMap().OQA_State_Pre);
|
||||
}
|
||||
bindMap.put("ReceiveTime", eventInfo.getEventTime());
|
||||
bindMap.put("ReceiveUser", eventInfo.getEventUser());
|
||||
bindMap.put("ErpLocation", erpLocation);
|
||||
bindMap.put("ErpFactory", erpFactory);
|
||||
bindMap.put("locationName", locationName);
|
||||
bindMap.put("MaterialQuantity", queryForList.get(0).get("MATERIALQUANTITY"));// 数量
|
||||
bindMap.put("PackingState", "Released");
|
||||
bindMap.put("OldPackingState", "Released");
|
||||
bindMap.put("stockState", "Created");
|
||||
bindMap.put("SDK_ID", queryForList.get(0).get("SDK_ID"));
|
||||
bindMap.put("PHASE", queryForList.get(0).get("PHASE"));
|
||||
bindMap.put("unit", queryForList.get(0).get("UNIT"));
|
||||
bindMap.put("MJPC",queryForList.get(0).get("MJPC"));
|
||||
bindMap.put("RETURNPC",queryForList.get(0).get("RETURNPC"));
|
||||
bindMap.put("receiveActNo", SHIPActNo);
|
||||
bindMap.put("LastEventTimeKey",TimeStampUtil.getCurrentEventTimeKey());
|
||||
bindMap.put("receiveRequestName", SHIPRequestName);
|
||||
bindMap.put("receiveRequestDetailName",SHIPRequestDetailName);
|
||||
bindMap.put("CAREER_ASSISTANCE", queryForList.get(0).get("CAREER_ASSISTANCE"));//业助信息
|
||||
bindMap.put("BUSINESS_UNIT", queryForList.get(0).get("BUSINESS_UNIT"));//业务
|
||||
bindMap.put("SALESPERSON", queryForList.get(0).get("SALESPERSON"));//事业部
|
||||
bindMap.put("CUSTOMNO", queryForList.get(0).get("CUSTOMNO"));//客户
|
||||
bindMap.put("charge",palletName.split("\\|")[4]);
|
||||
|
||||
setEventInfo.setUserColumns(bindMap);
|
||||
MaterialPackingKey materialPackingKey = new MaterialPackingKey("SDK",materialPackingName);
|
||||
MaterialPackingServiceProxy.getMaterialPackingService().setEvent(materialPackingKey, eventInfo, setEventInfo);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// 退料入库创建
|
||||
public boolean SHIPMesShippInfo2(EventInfo eventInfo,String siteName,String materialPackingName,
|
||||
String durableName,String user,String palletName,String SHIPActNo,
|
||||
String erpLocation,String erpFactory,String locationName,String SHIPRequestName, String SHIPRequestDetailName) {
|
||||
StringBuffer sql = new StringBuffer();
|
||||
sql.append(" ");
|
||||
sql.append(" SELECT ");
|
||||
sql.append(" T.LOTNAME MATERIALPACKINGNAME, ");
|
||||
sql.append(" T.QTY MATERIALQUANTITY, ");
|
||||
sql.append(" T.UNIT ,T.RECEIVE_FLAG, T.MATERIALPACKINGNAME PREMATERIALPACKINGNAME,T.CHARGE, ");
|
||||
sql.append(" M2. SHIPREQUESTDETAILNAME,");
|
||||
sql.append(" T.REQUESTNAME SHIPREQUESTNAME,");
|
||||
sql.append(" T.PRODUCTSPECNAME MATERIALSPECNAME, ");
|
||||
sql.append(" SS.SPECNAME , ");
|
||||
sql.append(" REPLACE(T.SDK_ID,'~','') SDK_ID , ");
|
||||
sql.append(" M.ERPLOCATION , ");
|
||||
sql.append(" T.AREA ,");
|
||||
sql.append(" T.SHIPUSER , NVL(M4.CAREER_ASSISTANCE ,T.CAREER_ASSISTANCE ) CAREER_ASSISTANCE, NVL(M4.DURABLETYPE ,T.DURABLETYPE ) DURABLETYPE ,NVL(M4.BUSINESS_UNIT ,T.BUSINESS_UNIT ) BUSINESS_UNIT,NVL(M4.CUSTOMNO ,T.CUSTOMERNO ) CUSTOMNO,NVL(M4.SALESPERSON ,T.SALESPERSON ) SALESPERSON,NVL(M4.MJPC ,T.MJPC ) MJPC ,NVL(T.TRUEGG,M4.TRUEGG) TRUEGG,");
|
||||
sql.append(" T.PACKINGGRADE , ");
|
||||
sql.append(" M4.EXPIRINGDATE , ");
|
||||
sql.append(" NVL(M4.MAKEDATE ,T.MAKEDATE ) SHIPTIME , ");
|
||||
sql.append(" M3.MATERIALTYPE , ");
|
||||
sql.append(" T.REMARK, T.PHASE, T.RETURNPC,T.MJPC ");
|
||||
sql.append(" FROM ");
|
||||
sql.append(" BS_MES_SHIPPED T LEFT JOIN MATERIALPACKING M4 ON T.RETURNPC = M4.CHARGE AND T.PRODUCTSPECNAME = M4.MATERIALSPECNAME ");
|
||||
sql.append(" LEFT JOIN MATERIALSHIPREQUEST M ON ");
|
||||
sql.append(" T.REQUESTNAME = M.SHIPREQUESTNAME ");
|
||||
sql.append(" LEFT JOIN MATERIALSHIPREQUESTDETAIL M2 ON ");
|
||||
sql.append(" T.REQUESTNAME = M2.SHIPREQUESTNAME ");
|
||||
sql.append(" AND T.PRODUCTSPECNAME = M2.MATERIALSPECNAME ");
|
||||
sql.append(" AND T.SDK_ID = M2.SDK_ID ");
|
||||
sql.append(" LEFT JOIN SDK_SPEC SS ON T.SDK_ID = SS.SDK_ID ");
|
||||
sql.append(" LEFT JOIN MATERIALSPEC M3 ON T.PRODUCTSPECNAME = M3.MATERIALSPECNAME ");
|
||||
sql.append(" WHERE (T.RECEIVE_FLAG IS NULL OR T.RECEIVE_FLAG <> 'Y') ");
|
||||
sql.append(" AND T.LOTNAME = :MATERIALPACKINGNAME ");
|
||||
// sql.append(" AND M.SITENAME = :SITENAME ");
|
||||
Map<String, Object> hashMap = new HashMap<String,Object> ();
|
||||
hashMap.put("MATERIALPACKINGNAME", materialPackingName);
|
||||
List<Map<String, Object>> queryForList = IDMFrameServiceProxy.getSqlTemplate().queryForList(sql.toString(), hashMap);
|
||||
if(queryForList == null || queryForList.size() < 1) {
|
||||
new CustomException("不存在要入库的信息");
|
||||
}
|
||||
|
||||
|
||||
// 查出是否存在原标签
|
||||
String receive_flag = queryForList.get(0).get("RECEIVE_FLAG") == null ? "" : queryForList.get(0).get("RECEIVE_FLAG").toString();
|
||||
String PREMATERIALPACKINGNAME = queryForList.get(0).get("PREMATERIALPACKINGNAME") == null ? "" : queryForList.get(0).get("PREMATERIALPACKINGNAME").toString();
|
||||
@ -471,11 +677,11 @@ public class ReturnStockIntoServiceImpl implements ReturnStockInService {
|
||||
|
||||
// 如果是现场仓更新标签,需根据批次才能找到对应的原标签
|
||||
// if("T".equals(receive_flag)) {
|
||||
// 如果存在对应的原标签,MATERIALPACKINGNAME相等,就删除原标签
|
||||
if(xcqueryForList != null && xcqueryForList.size() > 0) {
|
||||
String delsql = "DELETE FROM MATERIALPACKING m WHERE m.CHARGE = :CHARGE AND m.MATERIALPACKINGNAME = :MATERIALPACKINGNAME";
|
||||
IDMFrameServiceProxy.getSqlTemplate().update(delsql, xcHashMap);
|
||||
}
|
||||
// 如果存在对应的原标签,MATERIALPACKINGNAME相等,就删除原标签
|
||||
if(xcqueryForList != null && xcqueryForList.size() > 0) {
|
||||
String delsql = "DELETE FROM MATERIALPACKING m WHERE m.CHARGE = :CHARGE AND m.MATERIALPACKINGNAME = :MATERIALPACKINGNAME";
|
||||
IDMFrameServiceProxy.getSqlTemplate().update(delsql, xcHashMap);
|
||||
}
|
||||
// }
|
||||
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user