Merge branch 'main' of http://162.14.99.253:3000/10539622/2025-03-JS-SDK-svr
This commit is contained in:
commit
3e0fbfd3b0
@ -6417,57 +6417,70 @@ public class ToSAPServiceImpl {
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public String DeliveryToSAPMontage(String deliveryName, String siteName, String user,String commitDate, String opCode, List<String> saleList) throws Exception {
|
||||
EventInfo eventInfo = new EventInfoUtil().makeEventInfo("NormalStockInDelivery", user, "NormalStockInDelivery", "", "");
|
||||
public String DeliveryToSAPMontage(EventInfo eventInfo, String deliveryName, String siteName, String user,String commitDate, String opCode, List<String> saleList) throws Exception {
|
||||
String rcode;
|
||||
String undoId = "";
|
||||
String rmsg = null;
|
||||
String rmsg = "";
|
||||
String exceptionMsg = "";
|
||||
//调用SAP接口的报文
|
||||
String sendData = "";
|
||||
//SAP返回报文
|
||||
String sapreturn = "";
|
||||
List<MaterialPackingKey> materialPackingKeyList = new ArrayList<>();
|
||||
List<Map<String, Object>> qmsDataList = new ArrayList<>();
|
||||
//依据采购订单,查询待入库的物料(MATERIALPACKING)
|
||||
String querySql = " \n" +
|
||||
"\tSELECT\n" +
|
||||
" D.DELIVERYSTATE,\n" +
|
||||
" DR.DELIVERYNAME,\n" +
|
||||
" DR.DELIVERYNUM,\n" +
|
||||
String querySql = " SELECT " +
|
||||
" SUM(DR.DELIVERYNUM) AS MATERIALQUANTITY,\n" +
|
||||
" DR.RECEIVEREQUESTNAME,\n" +
|
||||
" DR.RECEIVEREQUESTDETAILNAME,\n" +
|
||||
" DR.MATERIALSPECNAME,\n" +
|
||||
" P.MATERIALPACKINGNAME,\n" +
|
||||
" P.ERPLOCATION,\n" +
|
||||
" P.ERPFACTORY,\n" +
|
||||
" P.SUPPLIERNAME,\n" +
|
||||
" P.UNIT,\n" +
|
||||
"\t\tP.FQTY,\n" +
|
||||
"\t\tSUM(P.FQTY) AS FQTY,\n" +
|
||||
" P.FUNIT,\n" +
|
||||
" P.REMARK,\n" +
|
||||
"\t\tP.OQARESULTSTATE,\n" +
|
||||
"\t\tBF.IQCFLAG,\n" +
|
||||
" P.OQARESULT,\n" +
|
||||
"\t\tR.STOCKORGNO,\n" +
|
||||
"\t\tR.RECEIVEREQUESTTYPE\n" +
|
||||
"FROM\n" +
|
||||
"\t\tR.RECEIVEREQUESTTYPE,\n" +
|
||||
"\t\tEL.DESCRIPTION AS ERPLOCATIONDESC,\n" +
|
||||
"\t\tSP.SUPPLIERNO AS SUPPLIERCODE,\n" +
|
||||
"\t\tSP.SUPPLIERNAME,\n" +
|
||||
"\t\tMP.MATERIALSPECNAME AS MATERIALSPECNAME,\n" +
|
||||
"\t\tMP.DESC_CN AS MATERIALNAME,\n" +
|
||||
"\t\tMP.MATERIALGROUP,\n" +
|
||||
"\t\tP.LOCATIONNAME,\t\t\n" +
|
||||
"\t\tP.RECEIVETIME,\n" +
|
||||
"\t\tP.TRUEGG " +
|
||||
" FROM\n" +
|
||||
" MATERIALPACKING P \n" +
|
||||
"LEFT JOIN SUPPLIER SP\tON SP.SITENAME = P.SUPPLIERNAME\n" +
|
||||
"LEFT JOIN BS_ERPLOCATION EL ON EL.ERPLOCATIONNAME = P.ERPLOCATION AND EL.SITENAME = P.SITENAME\n" +
|
||||
"LEFT JOIN MATERIALSPEC MP ON MP.MATERIALSPECNAME = P.MATERIALSPECNAME AND MP.SITENAME = P.SITENAME\n" +
|
||||
"LEFT JOIN BS_MATERIALFACTORY BF ON BF.MATERIALSPECNAME = P.MATERIALSPECNAME AND BF.ERPFACTORY = P.ERPFACTORY\n" +
|
||||
"LEFT JOIN MATERIALRECEIVEREQUESTDETAIL RD ON P.SITENAME = RD.SITENAME \n" +
|
||||
"LEFT JOIN MATERIALRECEIVEREQUEST R ON RD.RECEIVEREQUESTNAME = R.RECEIVEREQUESTNAME AND RD.SITENAME = R.SITENAME\n" +
|
||||
"LEFT JOIN MATERIALDELIVERYRECEIVE DR ON R.RECEIVEREQUESTNAME=DR.RECEIVEREQUESTNAME \n" +
|
||||
"LEFT JOIN MATERIALDELIVERY D ON DR.DELIVERYNAME = D.DELIVERYNAME\n" +
|
||||
"LEFT JOIN MATERIALDELIVERY D ON DR.DELIVERYNAME = D.DELIVERYNAME " +
|
||||
"WHERE\n" +
|
||||
" D.SITENAME =:SITENAME\n" +
|
||||
" AND D.DELIVERYNAME =:DELIVERYNAME\n" +
|
||||
" AND D.DELIVERYSTATE = '01'\n" +
|
||||
" AND D.DELIVERYSTATE = '02'\n" +
|
||||
"\t\tAND DR.MATERIALSPECNAME=RD.MATERIALSPECNAME\n" +
|
||||
"\t\tAND RD.RECEIVEREQUESTDETAILNAME=DR.RECEIVEREQUESTDETAILNAME\n" +
|
||||
"\t\tAND P.RECEIVEREQUESTNAME = DR.DELIVERYNAME \n" +
|
||||
"\t\tAND P.MATERIALSPECNAME = DR.MATERIALSPECNAME ";
|
||||
"\t\tAND P.MATERIALSPECNAME = DR.MATERIALSPECNAME" +
|
||||
" AND P.STOCKSTATE = 'Created' " +
|
||||
" GROUP BY DR.RECEIVEREQUESTNAME, DR.RECEIVEREQUESTDETAILNAME\n" +
|
||||
"\t\t,P.OQARESULT, P.OQARESULTSTATE, P.UNIT, P.FUNIT, P.REMARK, P.SUPPLIERNAME\n" +
|
||||
"\t\t,P.ERPFACTORY, P.ERPLOCATION, BF.IQCFLAG, R.RECEIVEREQUESTTYPE\n" +
|
||||
"\t\t,EL.DESCRIPTION, SP.SUPPLIERNO,SP.SUPPLIERNAME,MP.MATERIALSPECNAME\n" +
|
||||
"\t\t,MP.DESC_CN, MP.MATERIALGROUP, P.LOCATIONNAME, P.RECEIVETIME,P.TRUEGG ";
|
||||
Map<String, Object> hashMap = new HashMap<String, Object>();
|
||||
hashMap.put("DELIVERYNAME", deliveryName);
|
||||
hashMap.put("SITENAME", siteName);
|
||||
List<Map<String, Object>> queryForList = IDMFrameServiceProxy.getSqlTemplate().queryForList(querySql, hashMap);
|
||||
List<Map<String, Object>> receiveBoxsQty = new ArrayList<>(); //基于标签收包的维度的数量
|
||||
//List<Map<String, Object>> receiveBoxsQty = new ArrayList<>(); //基于标签收包的维度的数量
|
||||
try {
|
||||
Map<String,Object> bodyData = new HashMap<>();
|
||||
List<Map<String,Object>> itemData = new ArrayList<>();
|
||||
@ -6504,14 +6517,20 @@ public class ToSAPServiceImpl {
|
||||
// String insmk = StringUtils.equals(mm.get("OQARESULTSTATE").toString(),"END")?"":"X";
|
||||
item.put("INSMK", insmk);
|
||||
itemData.add(item);
|
||||
if (!saleList.contains(mm.get("RECEIVEREQUESTTYPE").toString())){
|
||||
qmsDataList.add(mm);
|
||||
}
|
||||
/**
|
||||
//存储条码,更新UNDOID用
|
||||
MaterialPackingKey materialPackingKey = new MaterialPackingKey(siteName, mm.get("MATERIALPACKINGNAME").toString());
|
||||
materialPackingKeyList.add(materialPackingKey);
|
||||
*/
|
||||
}
|
||||
|
||||
sendData = ToSAPMessageUtil.mm067(user, bodyData, itemData, commitDate);
|
||||
|
||||
exceptionMsg = "SAP返回";
|
||||
sapreturn = toSAPMessageUtil.sendHttpPost(toSAPMessageUtil.materialChangeLocationUrl,"",sendData);
|
||||
//sapreturn = "{\"HEAD\":{\"INTF_ID\":\"MM067\",\"SRC_SYSTEM\":\"WMS\",\"DEST_SYSTEM\":\"SAP\",\"SRC_MSGID\":\"4908eca1-e70f-4b09-8c79-fb3d34f0f42c\"},\"RETURN\":{\"STATUS\":\"S\",\"MSGTXT\":\"\",\"MBLNR\":\"5000000303\",\"MJAHR\":\"2025\"}}";
|
||||
org.json.JSONObject receiveJsonObject = new org.json.JSONObject(sapreturn);
|
||||
|
||||
org.json.JSONObject returnJsonObject = (org.json.JSONObject) receiveJsonObject.get("RETURN");
|
||||
@ -6533,23 +6552,39 @@ public class ToSAPServiceImpl {
|
||||
}else {
|
||||
throw new RuntimeException("SAP返回" + rmsg);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.info(e.getMessage(), e);
|
||||
throw new RuntimeException("SAP返回" + rmsg);
|
||||
}
|
||||
|
||||
if(!saleList.contains(queryForList.get(0).get("RECEIVEREQUESTTYPE").toString())) {
|
||||
try {
|
||||
if("S".equals(rcode) && qmsDataList.size() > 0) {
|
||||
/**
|
||||
jsonObject.put("warehouse", list.get(i).get("ERPLOCATIONDESC"));
|
||||
jsonObject.put("supplierName", list.get(i).get("SUPPLIERNAME"));
|
||||
jsonObject.put("supplierCode", list.get(i).get("SUPPLIERCODE"));
|
||||
jsonObject.put("materialName", list.get(i).get("MATERIALNAME"));
|
||||
jsonObject.put("materialCode", list.get(i).get("MATERIALCODE"));
|
||||
jsonObject.put("materialGroup", list.get(i).get("MATERIALGROUP"));
|
||||
jsonObject.put("batchQuantity", list.get(i).get("BATCHQUANTITY"));
|
||||
jsonObject.put("quantityUnit", list.get(i).get("QUANTITYUNIT"));
|
||||
jsonObject.put("deliveryDate", list.get(i).get("DELIVERYDATE"));
|
||||
jsonObject.put("specifications", list.get(i).get("BATCHNUMBER"));
|
||||
jsonObject.put("LOCATIONNAME", list.get(i).get("LOCATIONNAME"));
|
||||
String receiveRequestName = list.get(i).get("RECEIVEREQUESTNAME") == null ? "" : list.get(i).get("RECEIVEREQUESTNAME").toString();
|
||||
*/
|
||||
// 调用 QMS
|
||||
//qMSServiceImpl.PreIQCInfoSend(receiveRequestName, "SDK",opCode, erpFactory);
|
||||
qmsServiceImpl.sendToIQCByDataList(opCode, queryForList);
|
||||
} catch (CustomException e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException("QMS返回" + e.toString());
|
||||
}
|
||||
exceptionMsg = "QMS返回";
|
||||
qmsServiceImpl.sendToIQCByDataList(opCode, qmsDataList);
|
||||
}
|
||||
|
||||
// 更新入库凭证,更新库存状态
|
||||
if (materialPackingKeyList.size() > 0){
|
||||
if (StringUtils.isNotEmpty(undoId)){
|
||||
// 更新入库凭证
|
||||
String queryBoxIdsql = "SELECT MATERIALPACKINGNAME, SITENAME FROM MATERIALPACKING WHERE RECEIVEREQUESTNAME = :RECEIVEREQUESTNAME AND STOCKSTATE = 'Created' ";
|
||||
Map<String, Object> hashBoxIdMap = new HashMap<String,Object> ();
|
||||
hashBoxIdMap.put("RECEIVEREQUESTNAME", deliveryName);
|
||||
List<Map<String, Object>> queryBoxIdForList = IDMFrameServiceProxy.getSqlTemplate().queryForList(queryBoxIdsql, hashBoxIdMap);
|
||||
for (Map<String, Object> map : queryBoxIdForList) {
|
||||
MaterialPackingKey materialPackingKey = new MaterialPackingKey(map.get("SITENAME").toString(), map.get("MATERIALPACKINGNAME").toString());
|
||||
materialPackingKeyList.add(materialPackingKey);
|
||||
}
|
||||
SetEventInfo setEventInfo = new SetEventInfo();
|
||||
Map<String, Object> updateMap = new HashMap<>();
|
||||
updateMap.put("unDoID", undoId);
|
||||
@ -6563,6 +6598,10 @@ public class ToSAPServiceImpl {
|
||||
}
|
||||
//插入凭证信息
|
||||
SaveUnDoInfo(deliveryName,commitDate);
|
||||
} catch (Exception e) {
|
||||
log.info(e.getMessage(), e);
|
||||
throw new RuntimeException(exceptionMsg + rmsg);
|
||||
}
|
||||
return undoId;
|
||||
}
|
||||
|
||||
|
@ -155,6 +155,9 @@ public class DeliveryController {
|
||||
MaterialDelivery byKey = deliveryService.getByKey(storeDetailDto);
|
||||
// 到货单
|
||||
if (Objects.nonNull(byKey)) {
|
||||
if ("03".equals(byKey.getDeliveryState())){
|
||||
return AjaxResult.me().setErrorCode(400).setMessage("到货单:" + byKey.getDeliveryName() + "已入库,请勿重复操作");
|
||||
}
|
||||
deliveryName = byKey.getDeliveryName();
|
||||
// 到库单(找出该单据下的所有的采购单)
|
||||
nameList = deliveryService.getRelByDelivery(storeDetailDto)
|
||||
|
@ -16,6 +16,7 @@ import com.cim.idm.model.po.delivery.MaterialDelivery;
|
||||
import com.cim.idm.mwmsextend.materialpacking.service.MaterialPackingServiceImpl;
|
||||
import com.cim.idm.service.IDeliveryService;
|
||||
import com.cim.idm.service.IMaterialPackingService;
|
||||
import com.cim.idm.service.IMaterialShipService;
|
||||
import com.cim.idm.service.impl.QMSServiceImpl;
|
||||
import com.cim.idm.service.impl.ToSAPServiceImpl;
|
||||
import com.cim.idm.utils.AjaxResult;
|
||||
@ -66,6 +67,9 @@ public class MaterialReceiveActController {
|
||||
|
||||
private QMSServiceImpl qMSServiceImpl = new QMSServiceImpl();
|
||||
|
||||
@Autowired
|
||||
private IMaterialShipService materialShipService;
|
||||
|
||||
@RequestMapping(value = "/dessiginBoxByAct", method = RequestMethod.POST)
|
||||
public AjaxResult dessiginBoxByAct(@RequestBody JSONObject in ) throws Exception{
|
||||
|
||||
@ -627,34 +631,38 @@ public class MaterialReceiveActController {
|
||||
* @return 返回信息
|
||||
*/
|
||||
@RequestMapping(value = "/commitDeliveryStockInToSAP", method = RequestMethod.POST)
|
||||
public AjaxResult CommitDeliveryStockInToSAP(@RequestBody JSONObject in ) {
|
||||
public AjaxResult CommitDeliveryStockInToSAP(@RequestBody JSONObject in ) throws Exception {
|
||||
try {
|
||||
TrackOutBoDto trackOutBoDto = JSON.toJavaObject(in, TrackOutBoDto.class);
|
||||
StoreDetailDto storeDetailDto = new StoreDetailDto();
|
||||
storeDetailDto.setDocumentName(trackOutBoDto.getReceiveRequestName());
|
||||
storeDetailDto.setSiteName(trackOutBoDto.getSiteName());
|
||||
MaterialDelivery materialDelivery = deliveryService.getByKey(storeDetailDto);
|
||||
if (Objects.nonNull(materialDelivery)) {
|
||||
// 采购单
|
||||
List<MaterialReceiveRequest> materialReceiveRequestList = deliveryService.getReceiveByDelivery(storeDetailDto);
|
||||
if (Objects.nonNull(materialDelivery) && materialReceiveRequestList.size() > 0) {
|
||||
String user = trackOutBoDto.getUser();
|
||||
String opCode = trackOutBoDto.getOpCode();
|
||||
String commitDate = trackOutBoDto.getCommitDate();
|
||||
String siteName = trackOutBoDto.getSiteName();
|
||||
toSAPServiceImpl.DeliveryToSAPMontage(materialDelivery.getDeliveryName(), siteName, user, commitDate,opCode,ReceiveTypeEnums.getsaleReturn());
|
||||
EventInfo eventInfo = new com.cim.idm.wmsextend.generic.util.EventInfoUtil().makeEventInfo("NormalStockInDelivery", user, "NormalStockInDelivery", "", "");
|
||||
toSAPServiceImpl.DeliveryToSAPMontage(eventInfo, materialDelivery.getDeliveryName(), siteName, user, commitDate,opCode,ReceiveTypeEnums.getsaleReturn());
|
||||
//更新入库单数量
|
||||
materialShipService.DeliveryStockInUpdateReceiveRequestQty(eventInfo, materialDelivery);
|
||||
// 到货单据更新状态
|
||||
if (Objects.nonNull(materialDelivery.getDeliveryName())) {
|
||||
DeliveryEditDto deliveryEditDto = new DeliveryEditDto();
|
||||
deliveryEditDto.setDeliveryName(trackOutBoDto.getReceiveRequestName());
|
||||
deliveryEditDto.setSiteName(trackOutBoDto.getSiteName());
|
||||
// @TODO 完成状态下,更新为 DeliveryStateEnums.FINISH
|
||||
deliveryEditDto.setDeliveryState(DeliveryStateEnums.DOING.getCode());
|
||||
deliveryEditDto.setDeliveryState(DeliveryStateEnums.FINISH.getCode());
|
||||
deliveryService.editDelivery(deliveryEditDto);
|
||||
}
|
||||
} else {
|
||||
return AjaxResult.me().setSuccess(false).setMessage("到货单:" + trackOutBoDto.getReceiveRequestName() + "不存在").setErrorCode(400);
|
||||
return AjaxResult.me().setMessage("到货单:" + trackOutBoDto.getReceiveRequestName() + "不存在").setErrorCode(400);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return AjaxResult.me().setSuccess(false).setMessage(e.toString());
|
||||
return AjaxResult.me().setErrorCode(400).setMessage(e.toString());
|
||||
}
|
||||
return AjaxResult.me().setSuccess(true);
|
||||
}
|
||||
|
@ -2270,7 +2270,7 @@ public class SAPToWMSController {
|
||||
|
||||
/**
|
||||
* 物料消耗
|
||||
* 2024-05-08
|
||||
* 2025-05-08
|
||||
* @param httpRequest
|
||||
* @param request
|
||||
* @return
|
||||
@ -2291,7 +2291,7 @@ public class SAPToWMSController {
|
||||
materialPackingService.materialConsumeSapBwtar(datas,siteName,userName);
|
||||
Map<String, Object> oKReturn = new HashMap<>();
|
||||
oKReturn.put("STATUS", "S");
|
||||
oKReturn.put("MSGTXT", "物料消耗成功");
|
||||
oKReturn.put("MSGTXT", "物料消耗/冲销成功");
|
||||
oKReturn.put("ZRSV01", "");
|
||||
oKReturn.put("ZRSV02", "");
|
||||
oKReturn.put("ZRSV03", "");
|
||||
@ -2319,7 +2319,7 @@ public class SAPToWMSController {
|
||||
IDMFrameServiceProxy.getTransactionManager().rollbackTransaction();
|
||||
Map<String, Object> errorReturn = new HashMap<>();
|
||||
errorReturn.put("STATUS", "E");
|
||||
errorReturn.put("MSGTXT", "物料消耗失败, " + e.getMessage());
|
||||
errorReturn.put("MSGTXT", e.getMessage());
|
||||
errorReturn.put("HEAD", request.getHEAD());
|
||||
WMSToSAPReturn WMSToSAPReturn = new WMSToSAPReturn(head, errorReturn);
|
||||
ErpMessageLog erpMessageLog = new ErpMessageLog();
|
||||
|
@ -4,6 +4,7 @@ package com.cim.idm.service;
|
||||
import com.cim.idm.exception.GlobalException;
|
||||
import com.cim.idm.framework.data.EventInfo;
|
||||
import com.cim.idm.model.OutStockDto;
|
||||
import com.cim.idm.model.po.delivery.MaterialDelivery;
|
||||
import com.cim.idm.utils.AjaxResult;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
@ -62,4 +63,10 @@ public interface IMaterialShipService {
|
||||
*/
|
||||
AjaxResult MaterialShipRequestAuxiliaryCancelConfirmStocking(EventInfo eventInfo, String siteName, String shipRequestName, String user);
|
||||
|
||||
/**
|
||||
* 根据到货单号更新入库单数量
|
||||
* @param eventInfo 事件信息
|
||||
* @param materialDelivery 到货单信息
|
||||
*/
|
||||
void DeliveryStockInUpdateReceiveRequestQty(EventInfo eventInfo, MaterialDelivery materialDelivery);
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ public class MESToWMSServiceImpl implements MESToWMSService {
|
||||
errorCode = stringObjectMap.get("V_RETURN_CODE").toString();
|
||||
String vReturnMessage = stringObjectMap.get("V_RETURN_MESSAGE").toString();
|
||||
log.error("MES_CONSUME返回错误码:" + errorCode + ",错误信息:" + vReturnMessage);
|
||||
result = AjaxResult.me().setSuccess(false).setErrorCode(Integer.parseInt(errorCode)).setMessage(vReturnMessage);
|
||||
result = AjaxResult.me().setErrorCode(Integer.parseInt(errorCode)).setMessage(vReturnMessage);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
@ -106,7 +106,6 @@ public class MaterialPackingServiceServiceImpl implements IMaterialPackingServic
|
||||
"\tAND ERPLOCATION =:ERPLOCATION\n" +
|
||||
"\tAND UNIT =:UNIT\n" +
|
||||
"\tAND MATERIALSPECNAME =:MATERIALSPECNAME \n" +
|
||||
"\tAND UNDOID =:UNDOID \n" +
|
||||
"ORDER BY CREATETIME ASC ";
|
||||
Map<String, Object> selcetMaterialpackingMap = new HashMap<String, Object> ();
|
||||
selcetMaterialpackingMap.put("SITENAME", siteName);
|
||||
@ -174,7 +173,7 @@ public class MaterialPackingServiceServiceImpl implements IMaterialPackingServic
|
||||
|
||||
}
|
||||
if (mengeBigDecimal.compareTo(BigDecimal.ZERO) > 0){
|
||||
throw new Exception("物料:" + matnr + " " + werks + " " + lgort + " " + meins + "库存短缺");
|
||||
throw new Exception("消耗失败,物料:" + matnr + " " + werks + " " + lgort + " " + meins + "库存短缺");
|
||||
}
|
||||
MaterialPackingServiceProxy.getMaterialPackingService().setEvent(materialPackingKeyList, eventInfo, setEventInfoList);
|
||||
} else if ("262".equals(bwart)) {
|
||||
@ -225,7 +224,7 @@ public class MaterialPackingServiceServiceImpl implements IMaterialPackingServic
|
||||
break;
|
||||
}
|
||||
if (queryMaterialpackingList.isEmpty()){
|
||||
throw new Exception("物料:" + matnr + " " + werks + " " + lgort + " " + meins + "冲销失败");
|
||||
throw new Exception("冲销失败,物料:" + matnr + " " + werks + " " + lgort + " " + meins + "库存短缺");
|
||||
}else {
|
||||
MaterialPackingServiceProxy.getMaterialPackingService().setEvent(materialPackingKeyList, eventInfo, setEventInfoList);
|
||||
}
|
||||
|
@ -2,12 +2,16 @@ package com.cim.idm.service.Impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cim.idm.dao.DeliveryDao;
|
||||
import com.cim.idm.data.ErpMessageLog;
|
||||
import com.cim.idm.exception.GlobalException;
|
||||
import com.cim.idm.framework.IDMFrameServiceProxy;
|
||||
import com.cim.idm.framework.data.EventInfo;
|
||||
import com.cim.idm.framework.util.time.TimeStampUtil;
|
||||
import com.cim.idm.model.OutStockDto;
|
||||
import com.cim.idm.model.dto.delivery.StoreDetailDto;
|
||||
import com.cim.idm.model.po.delivery.MaterialDelivery;
|
||||
import com.cim.idm.model.po.delivery.MaterialDeliveryReceive;
|
||||
import com.cim.idm.mwmsextend.materialpacking.service.MaterialPackingServiceImpl;
|
||||
import com.cim.idm.service.IMaterialShipService;
|
||||
import com.cim.idm.service.impl.MESServiceImpl;
|
||||
@ -30,6 +34,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.Timestamp;
|
||||
import java.text.SimpleDateFormat;
|
||||
@ -45,6 +50,8 @@ public class MaterialShipServiceImpl implements IMaterialShipService {
|
||||
private ToSAPMessageUtil toSAPMessageUtil;
|
||||
|
||||
private EventInfo makeEventInfo;
|
||||
@Autowired
|
||||
private DeliveryDao deliveryDao;
|
||||
/**
|
||||
* 出库方法实现
|
||||
*/
|
||||
@ -2044,4 +2051,43 @@ public class MaterialShipServiceImpl implements IMaterialShipService {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 2025-05-20
|
||||
* 根据到货单号更新入库单数量
|
||||
* @param eventInfo 事件信息
|
||||
* @param materialDelivery 到货单信息
|
||||
*/
|
||||
public void DeliveryStockInUpdateReceiveRequestQty(EventInfo eventInfo, MaterialDelivery materialDelivery){
|
||||
//获取到货单关联的所有入库单
|
||||
StoreDetailDto storeDetailDto = new StoreDetailDto();
|
||||
storeDetailDto.setDocumentName(materialDelivery.getDeliveryName());
|
||||
List<MaterialDeliveryReceive> materialDeliveryReceivesList = deliveryDao.getRelByDelivery(storeDetailDto);
|
||||
//更新入库单信息
|
||||
for (MaterialDeliveryReceive materialDeliveryReceive : materialDeliveryReceivesList) {
|
||||
String updateReceiveRequestQtySql = " UPDATE MATERIALRECEIVEREQUESTDETAIL m \n" +
|
||||
"SET m.RECEIVEDQUANTITY = m.RECEIVEDQUANTITY - :QTY" +
|
||||
" , m.LASTEVENTNAME =:LASTEVENTNAME \n" +
|
||||
" , m.LASTEVENTTIMEKEY =:LASTEVENTTIMEKEY \n" +
|
||||
" , m.LASTEVENTTIME =:LASTEVENTTIME \n" +
|
||||
" , m.LASTEVENTUSER =:LASTEVENTUSER \n" +
|
||||
" , m.LASTEVENTCOMMENT =:LASTEVENTCOMMENT \n" +
|
||||
"WHERE\n" +
|
||||
"\tm.SITENAME = :SITENAME \n" +
|
||||
"\tAND m.RECEIVEREQUESTNAME = :RECEIVEREQUESTNAME \n" +
|
||||
"\tAND m.MATERIALSPECNAME = :MATERIALSPECNAME \n" +
|
||||
"\tAND m.RECEIVEREQUESTDETAILNAME = :RECEIVEREQUESTDETAILNAME ";
|
||||
Map<String, Object> updateReceiveRequestQtyMap = new HashMap<String, Object>();
|
||||
updateReceiveRequestQtyMap.put("QTY", materialDeliveryReceive.getDeliveryNum());
|
||||
updateReceiveRequestQtyMap.put("SITENAME", materialDelivery.getSiteName());
|
||||
updateReceiveRequestQtyMap.put("MATERIALSPECNAME", materialDeliveryReceive.getMaterialSpecName());
|
||||
updateReceiveRequestQtyMap.put("RECEIVEREQUESTNAME", materialDeliveryReceive.getReceiveRequestName());
|
||||
updateReceiveRequestQtyMap.put("LASTEVENTNAME", eventInfo.getEventUser());
|
||||
updateReceiveRequestQtyMap.put("LASTEVENTTIMEKEY", eventInfo.getEventTimeKey());
|
||||
updateReceiveRequestQtyMap.put("LASTEVENTTIME", eventInfo.getEventTime());
|
||||
updateReceiveRequestQtyMap.put("LASTEVENTUSER", eventInfo.getEventUser());
|
||||
updateReceiveRequestQtyMap.put("LASTEVENTCOMMENT", eventInfo.getEventComment());
|
||||
IDMFrameServiceProxy.getSqlTemplate().update(updateReceiveRequestQtySql, updateReceiveRequestQtyMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user