fix:销售退和调拨出

This commit is contained in:
郭飞 2025-04-15 10:29:13 +08:00
parent da6844026e
commit f786ebaae8
7 changed files with 566 additions and 82 deletions

View File

@ -28,7 +28,20 @@ public class MaterialReceiveRequest extends FieldAccessor implements DataInfo<Ma
private String respDepart; private String respDepart;
private Timestamp solveTime; private Timestamp solveTime;
private String passState; private String passState;
private String deliveryName; private String shipRequestDec;
private String bezei;
private String deliveryAddress;
private String customName;
private String deliveryRemark;
private String orderDateStr;
private String erpFactory;
private String planDate;
private String customerOrder;
private String customerArea;
private String carFlag;
/** /**
* 2024.09.26 新增 * 2024.09.26 新增
@ -199,11 +212,91 @@ public class MaterialReceiveRequest extends FieldAccessor implements DataInfo<Ma
this.solveTime = solveTime; this.solveTime = solveTime;
} }
public String getDeliveryName() { public String getShipRequestDec() {
return deliveryName; return shipRequestDec;
} }
public void setDeliveryName(String deliveryName) { public void setShipRequestDec(String shipRequestDec) {
this.deliveryName = deliveryName; this.shipRequestDec = shipRequestDec;
}
public String getBezei() {
return bezei;
}
public void setBezei(String bezei) {
this.bezei = bezei;
}
public String getDeliveryAddress() {
return deliveryAddress;
}
public void setDeliveryAddress(String deliveryAddress) {
this.deliveryAddress = deliveryAddress;
}
public String getCustomName() {
return customName;
}
public void setCustomName(String customName) {
this.customName = customName;
}
public String getDeliveryRemark() {
return deliveryRemark;
}
public void setDeliveryRemark(String deliveryRemark) {
this.deliveryRemark = deliveryRemark;
}
public String getOrderDateStr() {
return orderDateStr;
}
public void setOrderDateStr(String orderDateStr) {
this.orderDateStr = orderDateStr;
}
public String getErpFactory() {
return erpFactory;
}
public void setErpFactory(String erpFactory) {
this.erpFactory = erpFactory;
}
public String getPlanDate() {
return planDate;
}
public void setPlanDate(String planDate) {
this.planDate = planDate;
}
public String getCustomerOrder() {
return customerOrder;
}
public void setCustomerOrder(String customerOrder) {
this.customerOrder = customerOrder;
}
public String getCustomerArea() {
return customerArea;
}
public void setCustomerArea(String customerArea) {
this.customerArea = customerArea;
}
public String getCarFlag() {
return carFlag;
}
public void setCarFlag(String carFlag) {
this.carFlag = carFlag;
} }
} }

View File

@ -26,6 +26,17 @@ public class MaterialReceiveRequestHistory extends FieldAccessor implements Hist
private String respPerson; private String respPerson;
private String respDepart; private String respDepart;
private Timestamp solveTime; private Timestamp solveTime;
private String shipRequestDec;
private String bezei;
private String deliveryAddress;
private String customName;
private String deliveryRemark;
private String orderDateStr;
private String erpFactory;
private String planDate;
private String customerOrder;
private String customerArea;
private String carFlag;
public MaterialReceiveRequestHistory() { public MaterialReceiveRequestHistory() {
} }
@ -225,4 +236,91 @@ public class MaterialReceiveRequestHistory extends FieldAccessor implements Hist
this.solveTime = solveTime; this.solveTime = solveTime;
} }
public String getShipRequestDec() {
return shipRequestDec;
}
public void setShipRequestDec(String shipRequestDec) {
this.shipRequestDec = shipRequestDec;
}
public String getBezei() {
return bezei;
}
public void setBezei(String bezei) {
this.bezei = bezei;
}
public String getDeliveryAddress() {
return deliveryAddress;
}
public void setDeliveryAddress(String deliveryAddress) {
this.deliveryAddress = deliveryAddress;
}
public String getCustomName() {
return customName;
}
public void setCustomName(String customName) {
this.customName = customName;
}
public String getDeliveryRemark() {
return deliveryRemark;
}
public void setDeliveryRemark(String deliveryRemark) {
this.deliveryRemark = deliveryRemark;
}
public String getOrderDateStr() {
return orderDateStr;
}
public void setOrderDateStr(String orderDateStr) {
this.orderDateStr = orderDateStr;
}
public String getErpFactory() {
return erpFactory;
}
public void setErpFactory(String erpFactory) {
this.erpFactory = erpFactory;
}
public String getPlanDate() {
return planDate;
}
public void setPlanDate(String planDate) {
this.planDate = planDate;
}
public String getCustomerOrder() {
return customerOrder;
}
public void setCustomerOrder(String customerOrder) {
this.customerOrder = customerOrder;
}
public String getCustomerArea() {
return customerArea;
}
public void setCustomerArea(String customerArea) {
this.customerArea = customerArea;
}
public String getCarFlag() {
return carFlag;
}
public void setCarFlag(String carFlag) {
this.carFlag = carFlag;
}
} }

View File

@ -519,13 +519,7 @@ public class MaterialReceiveActController {
String receiveRequestName = request.getReceiveRequestName(); String receiveRequestName = request.getReceiveRequestName();
String siteName = request.getSiteName(); String siteName = request.getSiteName();
String erpFactory = request.getSTOCKORGNO(); String erpFactory = request.getSTOCKORGNO();
try {
// 调用 QMS
qMSServiceImpl.PreIQCInfoSend(receiveRequestName, "SDK",opCode, erpFactory);
} catch (CustomException e) {
e.printStackTrace();
return AjaxResult.me().setSuccess(false).setMessage(e.toString());
}
String undoId; String undoId;
try { try {
undoId = SendERPStockIn(receiveRequestName, siteName, user, opCode,commitDate,opCode); undoId = SendERPStockIn(receiveRequestName, siteName, user, opCode,commitDate,opCode);
@ -533,6 +527,13 @@ public class MaterialReceiveActController {
e.printStackTrace(); e.printStackTrace();
return AjaxResult.me().setSuccess(false).setMessage(e.toString()); return AjaxResult.me().setSuccess(false).setMessage(e.toString());
} }
try {
// 调用 QMS
qMSServiceImpl.PreIQCInfoSend(receiveRequestName, "SDK",opCode, erpFactory);
} catch (CustomException e) {
e.printStackTrace();
return AjaxResult.me().setSuccess(false).setMessage(e.toString());
}
// 发送过账 // 发送过账
EventInfoUtil util = new EventInfoUtil(); EventInfoUtil util = new EventInfoUtil();
makeEventInfo = util.makeEventInfo("NormalStockInForSDK", user, "NormalStockInForSDK"); makeEventInfo = util.makeEventInfo("NormalStockInForSDK", user, "NormalStockInForSDK");
@ -579,6 +580,10 @@ public class MaterialReceiveActController {
case "Z007" : //股份泗洪-分子公司STO case "Z007" : //股份泗洪-分子公司STO
break; break;
case "Z008" : //物资退货采购订单 case "Z008" : //物资退货采购订单
break;
case "ZLR1" : //销售退料
billCode = toSAPServiceImpl.SaleReturn(receiveRequestName, "SDK", eventUser,commitDate, opCode);
break;
default : default :
break; break;
} }

View File

@ -13,10 +13,12 @@ import com.cim.idm.mwmsextend.materialreceiverequest.service.MaterialReceiveRequ
import com.cim.idm.util.MessageLogUtil; import com.cim.idm.util.MessageLogUtil;
import com.cim.idm.wmsextend.generic.errorHandler.CustomException; import com.cim.idm.wmsextend.generic.errorHandler.CustomException;
import com.cim.idm.wmspackage.invoice.MaterialReceiveRequestServiceProxy; import com.cim.idm.wmspackage.invoice.MaterialReceiveRequestServiceProxy;
import com.cim.idm.wmspackage.invoice.management.data.MaterialReceiveRequest;
import com.cim.idm.wmspackage.invoice.management.data.MaterialReceiveRequestKey; import com.cim.idm.wmspackage.invoice.management.data.MaterialReceiveRequestKey;
import com.cim.idm.wmspackage.invoice.management.info.CreateReceiveRequestInfo; import com.cim.idm.wmspackage.invoice.management.info.CreateReceiveRequestInfo;
import com.cim.idm.wmspackage.invoice.management.info.SetEventInfo; import com.cim.idm.wmspackage.invoice.management.info.SetEventInfo;
import com.cim.idm.wmspackage.materialpacking.management.data.MaterialPackingStockInfo; import com.cim.idm.wmspackage.materialpacking.management.data.MaterialPackingStockInfo;
import com.cim.idm.wmspackage.materialreceiverequestactdetail.MaterialReceiveRequestActDetailServiceProxy;
import com.cim.idm.wmspackage.materialshiprequest.MaterialShipRequestServiceProxy; import com.cim.idm.wmspackage.materialshiprequest.MaterialShipRequestServiceProxy;
import com.cim.idm.wmspackage.materialshiprequest.management.data.MaterialShipRequest; import com.cim.idm.wmspackage.materialshiprequest.management.data.MaterialShipRequest;
import com.cim.idm.wmspackage.materialshiprequest.management.data.MaterialShipRequestKey; import com.cim.idm.wmspackage.materialshiprequest.management.data.MaterialShipRequestKey;
@ -1382,7 +1384,8 @@ public class SAPToWMSController {
ArrayList<Map<String,Object>> datas = request.getBODY(); ArrayList<Map<String,Object>> datas = request.getBODY();
String siteName = System.getProperty("company"); // String siteName = System.getProperty("company");
String siteName = "SDK";
// //存放所有单据号body遍历结束后更新成Created // //存放所有单据号body遍历结束后更新成Created
// List<String> shipRequestList = new ArrayList<>(); // List<String> shipRequestList = new ArrayList<>();
@ -1407,23 +1410,20 @@ public class SAPToWMSController {
String carFlag = MapUtils.getString(data, "Z_SSEND");//是否需要专车派送 String carFlag = MapUtils.getString(data, "Z_SSEND");//是否需要专车派送
String factoryName = MapUtils.getString(data, "WERKS"); //工厂 String factoryName = MapUtils.getString(data, "WERKS"); //工厂
String sqlCheck =" SELECT * FROM materialshiprequest m WHERE shiprequestname =:SHIPREQUESTNAME "; List<Map<String, Object>> checkResultList = new ArrayList<>();
Map<String, Object> selectMap= new HashMap<String, Object>(); Map<String, Object> selectMap= new HashMap<String, Object>();
selectMap.put("SHIPREQUESTNAME", shipRequestName); selectMap.put("SHIPREQUESTNAME", shipRequestName);
List<Map<String, Object>> checkResultList = IDMFrameServiceProxy.getSqlTemplate().queryForList(sqlCheck, selectMap); // 如果是销售退货
if("ZLR1".equals(shipRequestType)) {
String sqlCheck =" SELECT * FROM MATERIALRECEIVEREQUEST m WHERE RECEIVEREQUESTNAME =:SHIPREQUESTNAME ";
checkResultList = IDMFrameServiceProxy.getSqlTemplate().queryForList(sqlCheck, selectMap);
}else {
String sqlCheck =" SELECT * FROM materialshiprequest m WHERE shiprequestname =:SHIPREQUESTNAME ";
checkResultList = IDMFrameServiceProxy.getSqlTemplate().queryForList(sqlCheck, selectMap);
}
if(checkResultList == null || checkResultList.size() == 0) { if(checkResultList == null || checkResultList.size() == 0) {
CreateMaterialShipRequestInfo createInfo = new CreateMaterialShipRequestInfo();
createInfo.setSiteName(siteName);
createInfo.setShipRequestName(shipRequestName);
createInfo.setShipRequestType(shipRequestType);
createInfo.setShipRequestDetailType(shipRequestType);
createInfo.setCustomerNO(receiveUser);
createInfo.setShipRequestState("Created");
// shipRequestList.add(shipRequestName);
createInfo.setSystemType("ERP");
Map<String, Object> bindMap = new HashMap<String, Object>(); Map<String, Object> bindMap = new HashMap<String, Object>();
bindMap.put("shipRequestDec", shiprequestdec); bindMap.put("shipRequestDec", shiprequestdec);
bindMap.put("bezei", provinceAndCity); bindMap.put("bezei", provinceAndCity);
@ -1441,26 +1441,55 @@ public class SAPToWMSController {
// bindMap.put("erpReceiveFactory", receiveUser); // bindMap.put("erpReceiveFactory", receiveUser);
createInfo.setUserColumns(bindMap); // 如果是销售退货
if("ZLR1".equals(shipRequestType)) {
CreateReceiveRequestInfo reCreateInfo = new CreateReceiveRequestInfo();
reCreateInfo.setSiteName(siteName);
reCreateInfo.setReceiveRequestName(shipRequestName);
reCreateInfo.setReceiveRequestType(shipRequestType);
reCreateInfo.setReceiveRequestState("Created");
reCreateInfo.setSupplierNO(receiveUser);
reCreateInfo.setSystemType("ERP");
reCreateInfo.setUserColumns(bindMap);
EventInfo reEventInfo = new EventInfo();
reEventInfo.setEventName("CreateReceiveRequestForDNSAPToWMS");
reEventInfo.setEventUser(createUser);
EventInfo eventInfo = new EventInfo(); MaterialReceiveRequestServiceProxy.getMaterialReceiveRequestService().create(reEventInfo, reCreateInfo);
eventInfo.setEventName("MaterialShipRequestForDNSAPToWMS"); }else {
eventInfo.setEventUser(createUser); CreateMaterialShipRequestInfo createInfo = new CreateMaterialShipRequestInfo();
createInfo.setSiteName(siteName);
createInfo.setShipRequestName(shipRequestName);
createInfo.setShipRequestType(shipRequestType);
createInfo.setShipRequestDetailType(shipRequestType);
createInfo.setCustomerNO(receiveUser);
MaterialShipRequestServiceProxy.getMaterialShipRequestService().create(eventInfo, createInfo); createInfo.setShipRequestState("Created");
}else { // shipRequestList.add(shipRequestName);
MaterialShipRequestSetEventInfo info = new MaterialShipRequestSetEventInfo();
MaterialShipRequestKey key = new MaterialShipRequestKey(); createInfo.setSystemType("ERP");
key.setSiteName(siteName); createInfo.setUserColumns(bindMap);
key.setShipRequestName(shipRequestName);
MaterialShipRequest shipRequest=MaterialShipRequestServiceProxy.getMaterialShipRequestService().selectByKey(key); EventInfo eventInfo = new EventInfo();
eventInfo.setEventName("MaterialShipRequestForDNSAPToWMS");
if (!shipRequest.getShipRequestState().equalsIgnoreCase("Created")) { eventInfo.setEventUser(createUser);
throw new CustomException("ERROR","交货单已确认,禁止修改!"); MaterialShipRequestServiceProxy.getMaterialShipRequestService().create(eventInfo, createInfo);
} }
}else {
// MaterialShipRequestSetEventInfo info = new MaterialShipRequestSetEventInfo();
//
// MaterialShipRequestKey key = new MaterialShipRequestKey();
// key.setSiteName(siteName);
// key.setShipRequestName(shipRequestName);
//
// MaterialShipRequest shipRequest=MaterialShipRequestServiceProxy.getMaterialShipRequestService().selectByKey(key);
//
// if (!shipRequest.getShipRequestState().equalsIgnoreCase("Created")) {
// throw new CustomException("ERROR","交货单已确认,禁止修改!");
// }
Map<String, Object> bindMap = new HashMap<String, Object>(); Map<String, Object> bindMap = new HashMap<String, Object>();
bindMap.put("createUser", createUser); bindMap.put("createUser", createUser);
bindMap.put("shipRequestDec", shiprequestdec); bindMap.put("shipRequestDec", shiprequestdec);
@ -1476,12 +1505,54 @@ public class SAPToWMSController {
bindMap.put("customerArea", customerArea);//客户大区 bindMap.put("customerArea", customerArea);//客户大区
bindMap.put("carFlag", carFlag);//是否需要专车派送 bindMap.put("carFlag", carFlag);//是否需要专车派送
info.setUserColumns(bindMap); // info.setUserColumns(bindMap);
//
// EventInfo eventInfo = new EventInfo();
// eventInfo.setEventName("ModifyMaterialShipRequest");
// eventInfo.setEventUser(createUser);
// MaterialShipRequestServiceProxy.getMaterialShipRequestService().setEvent(key, eventInfo, info);
EventInfo eventInfo = new EventInfo();
eventInfo.setEventName("ModifyMaterialShipRequest"); // 如果是销售退货
eventInfo.setEventUser(createUser); if("ZLR1".equals(shipRequestType)) {
MaterialShipRequestServiceProxy.getMaterialShipRequestService().setEvent(key, eventInfo, info); SetEventInfo reInfo = new SetEventInfo();
MaterialReceiveRequestKey key = new MaterialReceiveRequestKey();
key.setSiteName(siteName);
key.setReceiveRequestName(shipRequestName);
MaterialReceiveRequest shipRequest=MaterialReceiveRequestServiceProxy.getMaterialReceiveRequestService().selectByKey(key);
if (!shipRequest.getReceiveRequestState().equalsIgnoreCase("Created")) {
throw new CustomException("ERROR","交货单已确认,禁止修改!");
}
reInfo.setUserColumns(bindMap);
EventInfo reEventInfo = new EventInfo();
reEventInfo.setEventName("ModifyMaterialtReceiveRequest");
reEventInfo.setEventUser(createUser);
MaterialReceiveRequestServiceProxy.getMaterialReceiveRequestService().setEvent(key, reEventInfo, reInfo);
}else {
MaterialShipRequestSetEventInfo info = new MaterialShipRequestSetEventInfo();
MaterialShipRequestKey key = new MaterialShipRequestKey();
key.setSiteName(siteName);
key.setShipRequestName(shipRequestName);
MaterialShipRequest shipRequest=MaterialShipRequestServiceProxy.getMaterialShipRequestService().selectByKey(key);
if (!shipRequest.getShipRequestState().equalsIgnoreCase("Created")) {
throw new CustomException("ERROR","交货单已确认,禁止修改!");
}
info.setUserColumns(bindMap);
EventInfo eventInfo = new EventInfo();
eventInfo.setEventName("ModifyMaterialShipRequest");
eventInfo.setEventUser(createUser);
MaterialShipRequestServiceProxy.getMaterialShipRequestService().setEvent(key, eventInfo, info);
}
} }
String shipRequestDetailName = MapUtils.getString(data, "POSNR"); // 交货单行号 String shipRequestDetailName = MapUtils.getString(data, "POSNR"); // 交货单行号
@ -1507,19 +1578,38 @@ public class SAPToWMSController {
String sourceNo=MapUtils.getString(data, "Z_LGORT"); //原单号 String sourceNo=MapUtils.getString(data, "Z_LGORT"); //原单号
String xloek= MapUtils.getString(data, ""); // 删除标识 String xloek= MapUtils.getString(data, ""); // 删除标识
MaterialShipRequestDetail mrd =new MaterialShipRequestDetail(); MaterialShipRequestDetailKey mrdk = new MaterialShipRequestDetailKey();
MaterialShipRequestDetailKey mrdk=new MaterialShipRequestDetailKey();
mrdk.setSiteName(siteName);
mrdk.setShipRequestName(shipRequestName);
mrdk.setShipRequestDetailName(shipRequestDetailName);
try { if("ZLR1".equals(shipRequestType)) {
mrd=MaterialShipRequestDetailServiceProxy.getMaterialShipRequestDetailService().selectByKey(mrdk); MaterialReceiveRequestDetail mrd =new MaterialReceiveRequestDetail();
if (mrd.getAssignedQuantity()!=0) { MaterialReceiveRequestDetailKey receiveKey = new MaterialReceiveRequestDetailKey();
throw new CustomException("ERROR","行项目已在拣配途中!"); receiveKey.setSiteName(siteName);
receiveKey.setReceiveRequestName(shipRequestName);
receiveKey.setReceiveRequestDetailName(shipRequestDetailName);
try {
mrd = ReceiveRequestDetailServiceProxy.getReceiveRequestDetailService().selectByKey(receiveKey);
if (mrd.getReceivedQuantity() != 0) {
throw new CustomException("ERROR","行项目已在拣配途中!");
}
} catch (Exception e) {
// TODO: handle exception
}
}else {
MaterialShipRequestDetail mrd =new MaterialShipRequestDetail();
// MaterialShipRequestDetailKey mrdk=new MaterialShipRequestDetailKey();
mrdk.setSiteName(siteName);
mrdk.setShipRequestName(shipRequestName);
mrdk.setShipRequestDetailName(shipRequestDetailName);
try {
mrd=MaterialShipRequestDetailServiceProxy.getMaterialShipRequestDetailService().selectByKey(mrdk);
if (mrd.getAssignedQuantity()!=0) {
throw new CustomException("ERROR","行项目已在拣配途中!");
}
} catch (Exception e) {
// TODO: handle exception
} }
} catch (Exception e) {
// TODO: handle exception
} }
@ -1529,22 +1619,25 @@ public class SAPToWMSController {
IDMFrameServiceProxy.getSqlTemplate().update(sql, obj); IDMFrameServiceProxy.getSqlTemplate().update(sql, obj);
}else { }else {
String sqlItemCheck ="SELECT * FROM materialshiprequestdetail " + List<Map<String, Object>> checkItemResultList = new ArrayList<Map<String, Object>>();
"WHERE shiprequestname =:SHIPREQUESTNAME and shiprequestdetailname = :SHIPREQUESTDETAILNAME"; if("ZLR1".equals(shipRequestType)) {
Map<String, Object> selectItemMap= new HashMap<String, Object>(); String sqlItemCheck ="SELECT * FROM MATERIALRECEIVEREQUESTDETAIL " +
selectItemMap.put("SHIPREQUESTNAME", shipRequestName); "WHERE RECEIVEREQUESTNAME =:RECEIVEREQUESTNAME and RECEIVEREQUESTDETAILNAME = :RECEIVEREQUESTDETAILNAME";
selectItemMap.put("SHIPREQUESTDETAILNAME", shipRequestDetailName); Map<String, Object> selectItemMap= new HashMap<String, Object>();
List<Map<String, Object>> checkItemResultList = IDMFrameServiceProxy.getSqlTemplate().queryForList(sqlItemCheck, selectItemMap); selectItemMap.put("RECEIVEREQUESTNAME", shipRequestName);
selectItemMap.put("RECEIVEREQUESTDETAILNAME", shipRequestDetailName);
checkItemResultList = IDMFrameServiceProxy.getSqlTemplate().queryForList(sqlItemCheck, selectItemMap);
} else {
String sqlItemCheck ="SELECT * FROM materialshiprequestdetail " +
"WHERE shiprequestname =:SHIPREQUESTNAME and shiprequestdetailname = :SHIPREQUESTDETAILNAME";
Map<String, Object> selectItemMap= new HashMap<String, Object>();
selectItemMap.put("SHIPREQUESTNAME", shipRequestName);
selectItemMap.put("SHIPREQUESTDETAILNAME", shipRequestDetailName);
checkItemResultList = IDMFrameServiceProxy.getSqlTemplate().queryForList(sqlItemCheck, selectItemMap);
}
if (checkItemResultList == null || checkItemResultList.size() == 0) { if (checkItemResultList == null || checkItemResultList.size() == 0) {
CreateMaterialShipRequestDetailInfo createInfo = new CreateMaterialShipRequestDetailInfo();
createInfo.setSiteName(siteName);
createInfo.setShipRequestName(shipRequestName);
createInfo.setShipRequestDetailName(shipRequestDetailName);
createInfo.setMaterialSpecName(materialSpecName);
createInfo.setRequestQuantity(Float.parseFloat(requestQuantity));
createInfo.setAssignedQuantity(0);
Map<String, Object> bindMapItem = new HashMap<String, Object>(); Map<String, Object> bindMapItem = new HashMap<String, Object>();
bindMapItem.put("erpFactory", factoryName); // 工厂 bindMapItem.put("erpFactory", factoryName); // 工厂
@ -1569,13 +1662,46 @@ public class SAPToWMSController {
bindMapItem.put("sendSalesOrderDetailNo", sendSaleOrderDetailNo); // 销售订单行号 bindMapItem.put("sendSalesOrderDetailNo", sendSaleOrderDetailNo); // 销售订单行号
bindMapItem.put("sourceNo", sourceNo); // 原单号 bindMapItem.put("sourceNo", sourceNo); // 原单号
createInfo.setUserColumns(bindMapItem); // 如果是销售退
EventInfo eventInfo = new EventInfo(); if("ZLR1".equals(shipRequestType)) {
eventInfo.setEventUser(createUser); bindMapItem.put("receiveRequestDetailType", shipRequestType); // 原单号
eventInfo.setEventName("Create"); CreateReceiveRequestDetailInfo createReceiveInfo = new CreateReceiveRequestDetailInfo();
MaterialShipRequestDetailServiceProxy.getMaterialShipRequestDetailService().create(createInfo); createReceiveInfo.setSiteName(siteName);
createReceiveInfo.setReceiveRequestName(shipRequestName);
createReceiveInfo.setReceiveRequestDetailName(shipRequestDetailName);
createReceiveInfo.setMaterialSpecName(materialSpecName);
createReceiveInfo.setRequestQuantity(Float.parseFloat(requestQuantity));
createReceiveInfo.setReceivedQuantity(0);
createReceiveInfo.setUserColumns(bindMapItem);
EventInfo eventReciveInfo = new EventInfo();
eventReciveInfo.setEventUser(createUser);
eventReciveInfo.setEventName("Create");
MaterialReceiveRequestDetailKey key = new MaterialReceiveRequestDetailKey();
key.setSiteName(siteName);
key.setReceiveRequestName(shipRequestName);
key.setReceiveRequestDetailName(shipRequestDetailName);
ReceiveRequestDetailServiceProxy.getReceiveRequestDetailService().create(key,eventReciveInfo, createReceiveInfo);
}else {
CreateMaterialShipRequestDetailInfo createInfo = new CreateMaterialShipRequestDetailInfo();
createInfo.setSiteName(siteName);
createInfo.setShipRequestName(shipRequestName);
createInfo.setShipRequestDetailName(shipRequestDetailName);
createInfo.setMaterialSpecName(materialSpecName);
createInfo.setRequestQuantity(Float.parseFloat(requestQuantity));
createInfo.setAssignedQuantity(0);
createInfo.setUserColumns(bindMapItem);
EventInfo eventInfo = new EventInfo();
eventInfo.setEventUser(createUser);
eventInfo.setEventName("Create");
MaterialShipRequestDetailServiceProxy.getMaterialShipRequestDetailService().create(createInfo);
}
}else { }else {
NonPrimaryKeyValueInfo nonPrimaryKeyValueInfo = new NonPrimaryKeyValueInfo(); NonPrimaryKeyValueInfo nonPrimaryKeyValueInfo = new NonPrimaryKeyValueInfo();
com.cim.idm.wmspackage.receiverequestdetail.management.info.SetEventInfo setReciveInfo = new com.cim.idm.wmspackage.receiverequestdetail.management.info.SetEventInfo();
Map<String, Object> bindMapItem = new HashMap<String, Object>(); Map<String, Object> bindMapItem = new HashMap<String, Object>();
bindMapItem.put("erpFactory", factoryName); // 工厂 bindMapItem.put("erpFactory", factoryName); // 工厂
bindMapItem.put("materialSpecName", materialSpecName); bindMapItem.put("materialSpecName", materialSpecName);
@ -1601,11 +1727,24 @@ public class SAPToWMSController {
bindMapItem.put("sourceNo", sourceNo); // 原单号 bindMapItem.put("sourceNo", sourceNo); // 原单号
nonPrimaryKeyValueInfo.setUserColumns(bindMapItem); nonPrimaryKeyValueInfo.setUserColumns(bindMapItem);
setReciveInfo.setUserColumns(bindMapItem);
EventInfo eventInfo = new EventInfo(); EventInfo eventInfo = new EventInfo();
eventInfo.setEventUser(createUser); eventInfo.setEventUser(createUser);
eventInfo.setEventName("update"); eventInfo.setEventName("update");
MaterialShipRequestDetailServiceProxy.getMaterialShipRequestDetailService().setEvent(mrdk, nonPrimaryKeyValueInfo); // 如果是销售退
if("ZLR1".equals(shipRequestType)) {
MaterialReceiveRequestDetailKey receiveRequestDetailKey = new MaterialReceiveRequestDetailKey();
MaterialReceiveRequestDetail receiveRequestDetail = new MaterialReceiveRequestDetail();
receiveRequestDetailKey.setReceiveRequestDetailName(shipRequestDetailName);
receiveRequestDetailKey.setReceiveRequestName(shipRequestName);
receiveRequestDetailKey.setSiteName(siteName);
ReceiveRequestDetailServiceProxy.getReceiveRequestDetailService().setEvent(receiveRequestDetailKey, eventInfo, setReciveInfo);
}else {
MaterialShipRequestDetailServiceProxy.getMaterialShipRequestDetailService().setEvent(mrdk, nonPrimaryKeyValueInfo);
}
} }
} }
} }

View File

@ -167,7 +167,7 @@ public class SaleReturnController {
" 1 = 1\r\n" + " 1 = 1\r\n" +
" AND m.RECEIVEREQUESTNAME = :RECEIVEREQUESTNAME\r\n" + " AND m.RECEIVEREQUESTNAME = :RECEIVEREQUESTNAME\r\n" +
" AND m.SITENAME = :SITENAME\r\n" + " AND m.SITENAME = :SITENAME\r\n" +
" AND m2.RECEIVEREQUESTTYPE IN ('4C')\r\n" + " AND m2.RECEIVEREQUESTTYPE IN ('ZLR1')\r\n" +
" AND (m2.RETURNFLAG IS NULL\r\n" + " AND (m2.RETURNFLAG IS NULL\r\n" +
" OR m2.RETURNFLAG <> 'Y')\r\n" + " OR m2.RETURNFLAG <> 'Y')\r\n" +
" AND m3.IS_BATCH = 'Y'\r\n" + " AND m3.IS_BATCH = 'Y'\r\n" +
@ -332,7 +332,7 @@ public class SaleReturnController {
+ "LEFT JOIN MATERIALSHIPREQUEST m2 ON m.SHIPREQUESTNAME = m2.SHIPREQUESTNAME\r\n" + "LEFT JOIN MATERIALSHIPREQUEST m2 ON m.SHIPREQUESTNAME = m2.SHIPREQUESTNAME\r\n"
+ "WHERE m.STOCKSTATE ='StockOut'\r\n" + "WHERE m.STOCKSTATE ='StockOut'\r\n"
+ " AND m.MATERIALPACKINGNAME = :MATERIALPACKINGNAME\r\n" + " AND m.MATERIALPACKINGNAME = :MATERIALPACKINGNAME\r\n"
+ " AND m2.SHIPREQUESTTYPE = '4C'"; + " AND m2.SHIPREQUESTTYPE = 'ZLF1'";
Map<String,Object> hashMap = new HashMap<String,Object>(); Map<String,Object> hashMap = new HashMap<String,Object>();
hashMap.put("MATERIALPACKINGNAME", materialPackingName); hashMap.put("MATERIALPACKINGNAME", materialPackingName);
@ -361,8 +361,9 @@ public class SaleReturnController {
// } // }
String invoiceSql = "SELECT M.REQUESTQUANTITY - M.RECEIVEDQUANTITY QTY, M.RECEIVEREQUESTNAME,M.RECEIVEREQUESTDETAILNAME,M.SDK_ID \r\n" String invoiceSql = "SELECT M.REQUESTQUANTITY - M.RECEIVEDQUANTITY QTY, M.RECEIVEREQUESTNAME,M.RECEIVEREQUESTDETAILNAME,M.SDK_ID \r\n"
+ "FROM MATERIALRECEIVEREQUESTDETAIL M\r\n" + "FROM MATERIALRECEIVEREQUESTDETAIL M\r\n"
+ "LEFT JOIN MATERIALSPEC B ON M.MATERIALSPECNAME = B.MATERIALSPECNAME\r\n"
+ "WHERE M.MATERIALSPECNAME = :MATERIALSPECNAME\r\n" + "WHERE M.MATERIALSPECNAME = :MATERIALSPECNAME\r\n"
+ " AND (:PHASE IS NULL OR PHASE = :PHASE)\r\n" + " AND (:PHASE IS NULL OR B.PHASE = :PHASE)\r\n"
+ "-- AND (:SDK_ID IS NULL OR SDK_ID = :SDK_ID)\r\n" + "-- AND (:SDK_ID IS NULL OR SDK_ID = :SDK_ID)\r\n"
+ " AND M.REQUESTQUANTITY - M.RECEIVEDQUANTITY > 0\r\n" + " AND M.REQUESTQUANTITY - M.RECEIVEDQUANTITY > 0\r\n"
+ " AND RECEIVEREQUESTNAME = :RECEIVEREQUESTNAME"; + " AND RECEIVEREQUESTNAME = :RECEIVEREQUESTNAME";

View File

@ -284,8 +284,8 @@ public class InvoiceServiceImpl implements InvoiceService {
" MATERIALSHIPREQUESTDETAIL m\r\n" + " MATERIALSHIPREQUESTDETAIL m\r\n" +
"WHERE\r\n" + "WHERE\r\n" +
" m.MATERIALSPECNAME = :MATERIALSPECNAME\r\n" + " m.MATERIALSPECNAME = :MATERIALSPECNAME\r\n" +
" AND (:SDK_ID IS NULL\r\n" + // " AND (:SDK_ID IS NULL\r\n" +
" OR SDK_ID = :SDK_ID)\r\n" + // " OR SDK_ID = :SDK_ID)\r\n" +
// " AND (:PHASE IS NULL\r\n" + // " AND (:PHASE IS NULL\r\n" +
// " OR PHASE = :PHASE)\r\n" + // " OR PHASE = :PHASE)\r\n" +
" AND SHIPREQUESTNAME = :SHIPREQUESTNAME ORDER BY TO_NUMBER(SHIPREQUESTDETAILNAME) ASC "; " AND SHIPREQUESTNAME = :SHIPREQUESTNAME ORDER BY TO_NUMBER(SHIPREQUESTDETAILNAME) ASC ";
@ -341,7 +341,7 @@ public class InvoiceServiceImpl implements InvoiceService {
switch (shipRequestType) { switch (shipRequestType) {
case "NLCC" : //STO调拨出库 case "NLCC" : //STO调拨出库
billCode=toSAPService.TransferStockOut_NLCC(shipRequestName, "SDK", eventUser,materialPackingKeyList); billCode=TransferStockOut_NLCC(shipRequestName, "SDK", eventUser,materialPackingKeyList);
//makeEventInfo = eventInfoUtil.makeEventInfo("CompleteShipRequest", eventUser, "CompleteShipRequest:"+shipRequestType); //makeEventInfo = eventInfoUtil.makeEventInfo("CompleteShipRequest", eventUser, "CompleteShipRequest:"+shipRequestType);
untils.SaveUnDoInfo_ForSap(materialPackingKeyList, billCode, makeEventInfo); untils.SaveUnDoInfo_ForSap(materialPackingKeyList, billCode, makeEventInfo);
break; break;
@ -710,6 +710,140 @@ public class InvoiceServiceImpl implements InvoiceService {
IDMFrameServiceProxy.getSqlTemplate().update(bfSql, hashMap); IDMFrameServiceProxy.getSqlTemplate().update(bfSql, hashMap);
IDMFrameServiceProxy.getSqlTemplate().update(scSql, hashMap); IDMFrameServiceProxy.getSqlTemplate().update(scSql, hashMap);
} }
//重写STO业务销售交货单过账zd.2024.8.14
public String TransferStockOut_NLCC(String shipRequestName, String siteName, String user,List<String> boxList) throws Exception {
String rcode;
String undoId = "";
String rmsg = null;
String sql=" SELECT \r\n" +
" count(*) AS ZROL, \r\n" +
" m1.SHIPREQUESTDETAILNAME , \r\n" +
" t.ERPLOCATION, \r\n" +
" sum(m.QTY)MATERIALQUANTITY \r\n" +
" FROM \r\n" +
" MATERIALPACKINGSUB m \r\n" +
" LEFT JOIN MATERIALPACKING T ON \r\n" +
" m.MATERIALPACKINGNAME = T.MATERIALPACKINGNAME AND m.RECEIVEREQUESTNAME = T.SHIPREQUESTNAME \r\n" +
" LEFT JOIN MATERIALSHIPREQUESTDETAIL M1 \r\n" +
" ON \r\n" +
" m.RECEIVEREQUESTNAME = M1.SHIPREQUESTNAME \r\n" +
" AND m.RECEIVEREQUESTDETAILNAME = M1.SHIPREQUESTDETAILNAME \r\n" +
" LEFT JOIN MATERIALSHIPREQUEST M2 \r\n" +
" ON \r\n" +
" M1.SHIPREQUESTNAME = M2.SHIPREQUESTNAME \r\n" +
" WHERE \r\n" +
" T.SHIPREQUESTNAME = :SHIPREQUESTNAME \r\n" +
" AND T.SITENAME = :SITENAME \r\n" +
" AND T.STOCKSTATE = 'Stocked' AND T.MATERIALPACKINGNAME IN (:BOXLIST)\r\n" +
" GROUP BY m1.SHIPREQUESTDETAILNAME , t.ERPLOCATION";
Map<String, Object> hashMap = new HashMap<String, Object>();
hashMap.put("SHIPREQUESTNAME", shipRequestName);
hashMap.put("SITENAME", siteName);
hashMap.put("BOXLIST", boxList);
List<Map<String, Object>> queryForList = IDMFrameServiceProxy.getSqlTemplate().queryForList(sql.toString(), hashMap);
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("DEST_SYSTEM", "SAP");
header.put("INTF_ID", "SD023");
header.put("SRC_SYSTEM", "WMS");
String uniqueID = UUID.randomUUID().toString();
header.put("SRC_MSGID", uniqueID);
header.put("BACKUP1", uniqueID);
header.put("BACKUP2", uniqueID);
/*
BODY
*/
//交货单号
body.put("VBELN", shipRequestName);
//实际过账日期
body.put("WADAT_IST", TimeStampUtil.getCurrentTime("yyyyMMdd"));//yyyyMMddhhmmss
//发送日期
body.put("Z_SENDDATE", TimeStampUtil.getCurrentTime("yyyyMMdd"));
//操作类型过账
body.put("Z_OPTION", "1");
if (queryForList.size() >= 1) {
for (Map<String, Object> mm : queryForList) {
JSONObject item = new JSONObject(true);
//交货单行号
item.put("POSNR", mm.get("SHIPREQUESTDETAILNAME"));
//交货数量
item.put("PIKMG", mm.get("MATERIALQUANTITY"));
//库存地点
item.put("LGORT", mm.get("ERPLOCATION"));
//实际发货卷数
item.put("Z_ROL", mm.get("ZROL"));
//实际发货平方米
item.put("Z_SQUE", mm.get("MATERIALQUANTITY"));
itemArray.add(item);
}
body.put("ITEMS", itemArray);
}else {
for (Map<String, Object> mm : queryForList) {
//交货单行号
body.put("POSNR", mm.get("SHIPREQUESTDETAILNAME"));
//交货数量
body.put("PIKMG", mm.get("MATERIALQUANTITY")); //SUM
//库存地点
body.put("LGORT", mm.get("ERPLOCATION"));
//实际发货卷数
body.put("Z_ROL", mm.get("ZROL")); //COUNT
//实际发货平方米
body.put("Z_SQUE", mm.get("MATERIALQUANTITY"));
}
}
// log.info("SendTOSAP >>>>" + sendData);
String sapreturn = toSAPMessageUtil.sendHttpPost(toSAPMessageUtil.DNUrl, "", sendData.toJSONString());
org.json.JSONObject receiveJsonObject = new org.json.JSONObject(sapreturn);
//销售交货单过账不返回物料凭证,且RETURN为JsonArray
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 = "S";
}
//将log写到表里
ErpMessageLog erplog = new ErpMessageLog();
erplog.setEventUser("");
erplog.setServerName("WmsToErp");
erplog.setEventName("调拨出库(NLCC)");
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;
}
/** /**
* *
@ -1984,6 +2118,7 @@ public class InvoiceServiceImpl implements InvoiceService {
erplog.setEventName("成本中心/研发领料"); 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.setSendMsg2(sendData.toJSONString()); erplog.setSendMsg2(sendData.toJSONString());
erplog.setReturnMsg2(sapreturn); erplog.setReturnMsg2(sapreturn);
erplog.setResultCode(rcode); erplog.setResultCode(rcode);
@ -2118,6 +2253,7 @@ public class InvoiceServiceImpl implements InvoiceService {
erplog.setEventName("调拨出库(NLCC)"); erplog.setEventName("调拨出库(NLCC)");
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.setSendMsg2(sendData.toJSONString()); erplog.setSendMsg2(sendData.toJSONString());
erplog.setReturnMsg2(sapreturn); erplog.setReturnMsg2(sapreturn);
erplog.setResultCode(rcode); erplog.setResultCode(rcode);
@ -2274,6 +2410,7 @@ public class InvoiceServiceImpl implements InvoiceService {
erplog.setId(uuid.toString()); erplog.setId(uuid.toString());
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.setSendMsg2(sendData.toJSONString()); erplog.setSendMsg2(sendData.toJSONString());
erplog.setReturnMsg2(sapreturn); erplog.setReturnMsg2(sapreturn);
erplog.setResultCode(rcode); erplog.setResultCode(rcode);

View File

@ -189,6 +189,16 @@ public class SaleReturnServiceImpl implements SaleReturnService {
oqa = "NG"; oqa = "NG";
} }
} }
String sqlDetString = "SELECT RECEIVEREQUESTDETAILNAME FROM MATERIALPACKINGSUB WHERE MATERIALPACKINGNAME = :MATERIALPACKINGNAME\r\n"
+ " AND RECEIVEREQUESTNAME = :RECEIVEREQUESTNAME";
Map<String,Object> DeH = new HashMap<String,Object>();
DeH.put("MATERIALPACKINGNAME", materialPackingName);
DeH.put("RECEIVEREQUESTNAME", receiveRequestName);
List<Map<String, Object>> mapsList = IDMFrameServiceProxy.getSqlTemplate().queryForList(sqlDetString, DeH);
String receiveRequestDetailName = mapsList.get(0).get("RECEIVEREQUESTDETAILNAME") == null ? "" : mapsList.get(0).get("RECEIVEREQUESTDETAILNAME").toString();
EventInfoUtil eventInfoUtil = new EventInfoUtil(); EventInfoUtil eventInfoUtil = new EventInfoUtil();
SetEventInfo setEventInfo = new SetEventInfo(); SetEventInfo setEventInfo = new SetEventInfo();
EventInfo eventInfo = EventInfoUtil.makeEventInfo("ProductSaleReturn", user, "ProductSaleReturn"); EventInfo eventInfo = EventInfoUtil.makeEventInfo("ProductSaleReturn", user, "ProductSaleReturn");
@ -198,7 +208,8 @@ public class SaleReturnServiceImpl implements SaleReturnService {
hashMap2.put("locationName", locationName); hashMap2.put("locationName", locationName);
hashMap2.put("receiveRequestName",receiveRequestName); hashMap2.put("receiveRequestName",receiveRequestName);
hashMap2.put("shipRequestName",""); hashMap2.put("receiveRequestDetailName",receiveRequestDetailName);
// hashMap2.put("shipRequestName","");
hashMap2.put("stockState", "Created"); hashMap2.put("stockState", "Created");
hashMap2.put("oqaResult", oqa); hashMap2.put("oqaResult", oqa);
hashMap2.put("packingGrade", oqa); hashMap2.put("packingGrade", oqa);