update 到货单入库按钮,增加更新入库单数量
This commit is contained in:
parent
7ed15cee23
commit
7bbf052b99
@ -6417,8 +6417,7 @@ public class ToSAPServiceImpl {
|
|||||||
* @return
|
* @return
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public String DeliveryToSAPMontage(String deliveryName, String siteName, String user,String commitDate, String opCode, List<String> saleList) throws Exception {
|
public String DeliveryToSAPMontage(EventInfo eventInfo, String deliveryName, String siteName, String user,String commitDate, String opCode, List<String> saleList) throws Exception {
|
||||||
EventInfo eventInfo = new EventInfoUtil().makeEventInfo("NormalStockInDelivery", user, "NormalStockInDelivery", "", "");
|
|
||||||
String rcode;
|
String rcode;
|
||||||
String undoId = "";
|
String undoId = "";
|
||||||
String rmsg = "";
|
String rmsg = "";
|
||||||
@ -6430,7 +6429,8 @@ public class ToSAPServiceImpl {
|
|||||||
List<MaterialPackingKey> materialPackingKeyList = new ArrayList<>();
|
List<MaterialPackingKey> materialPackingKeyList = new ArrayList<>();
|
||||||
List<Map<String, Object>> qmsDataList = new ArrayList<>();
|
List<Map<String, Object>> qmsDataList = new ArrayList<>();
|
||||||
//依据采购订单,查询待入库的物料(MATERIALPACKING)
|
//依据采购订单,查询待入库的物料(MATERIALPACKING)
|
||||||
String querySql = " SUM(DR.DELIVERYNUM) AS MATERIALQUANTITY,\n" +
|
String querySql = " SELECT " +
|
||||||
|
" SUM(DR.DELIVERYNUM) AS MATERIALQUANTITY,\n" +
|
||||||
" DR.RECEIVEREQUESTNAME,\n" +
|
" DR.RECEIVEREQUESTNAME,\n" +
|
||||||
" DR.RECEIVEREQUESTDETAILNAME,\n" +
|
" DR.RECEIVEREQUESTDETAILNAME,\n" +
|
||||||
" P.ERPLOCATION,\n" +
|
" P.ERPLOCATION,\n" +
|
||||||
@ -6529,8 +6529,8 @@ public class ToSAPServiceImpl {
|
|||||||
|
|
||||||
sendData = ToSAPMessageUtil.mm067(user, bodyData, itemData, commitDate);
|
sendData = ToSAPMessageUtil.mm067(user, bodyData, itemData, commitDate);
|
||||||
exceptionMsg = "SAP返回";
|
exceptionMsg = "SAP返回";
|
||||||
//sapreturn = toSAPMessageUtil.sendHttpPost(toSAPMessageUtil.materialChangeLocationUrl,"",sendData);
|
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\"}}";
|
//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 receiveJsonObject = new org.json.JSONObject(sapreturn);
|
||||||
|
|
||||||
org.json.JSONObject returnJsonObject = (org.json.JSONObject) receiveJsonObject.get("RETURN");
|
org.json.JSONObject returnJsonObject = (org.json.JSONObject) receiveJsonObject.get("RETURN");
|
||||||
|
@ -155,6 +155,9 @@ public class DeliveryController {
|
|||||||
MaterialDelivery byKey = deliveryService.getByKey(storeDetailDto);
|
MaterialDelivery byKey = deliveryService.getByKey(storeDetailDto);
|
||||||
// 到货单
|
// 到货单
|
||||||
if (Objects.nonNull(byKey)) {
|
if (Objects.nonNull(byKey)) {
|
||||||
|
if ("03".equals(byKey.getDeliveryState())){
|
||||||
|
return AjaxResult.me().setErrorCode(400).setMessage("到货单:" + byKey.getDeliveryName() + "已入库,请勿重复操作");
|
||||||
|
}
|
||||||
deliveryName = byKey.getDeliveryName();
|
deliveryName = byKey.getDeliveryName();
|
||||||
// 到库单(找出该单据下的所有的采购单)
|
// 到库单(找出该单据下的所有的采购单)
|
||||||
nameList = deliveryService.getRelByDelivery(storeDetailDto)
|
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.mwmsextend.materialpacking.service.MaterialPackingServiceImpl;
|
||||||
import com.cim.idm.service.IDeliveryService;
|
import com.cim.idm.service.IDeliveryService;
|
||||||
import com.cim.idm.service.IMaterialPackingService;
|
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.QMSServiceImpl;
|
||||||
import com.cim.idm.service.impl.ToSAPServiceImpl;
|
import com.cim.idm.service.impl.ToSAPServiceImpl;
|
||||||
import com.cim.idm.utils.AjaxResult;
|
import com.cim.idm.utils.AjaxResult;
|
||||||
@ -66,6 +67,9 @@ public class MaterialReceiveActController {
|
|||||||
|
|
||||||
private QMSServiceImpl qMSServiceImpl = new QMSServiceImpl();
|
private QMSServiceImpl qMSServiceImpl = new QMSServiceImpl();
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IMaterialShipService materialShipService;
|
||||||
|
|
||||||
@RequestMapping(value = "/dessiginBoxByAct", method = RequestMethod.POST)
|
@RequestMapping(value = "/dessiginBoxByAct", method = RequestMethod.POST)
|
||||||
public AjaxResult dessiginBoxByAct(@RequestBody JSONObject in ) throws Exception{
|
public AjaxResult dessiginBoxByAct(@RequestBody JSONObject in ) throws Exception{
|
||||||
|
|
||||||
@ -641,22 +645,24 @@ public class MaterialReceiveActController {
|
|||||||
String opCode = trackOutBoDto.getOpCode();
|
String opCode = trackOutBoDto.getOpCode();
|
||||||
String commitDate = trackOutBoDto.getCommitDate();
|
String commitDate = trackOutBoDto.getCommitDate();
|
||||||
String siteName = trackOutBoDto.getSiteName();
|
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())) {
|
if (Objects.nonNull(materialDelivery.getDeliveryName())) {
|
||||||
DeliveryEditDto deliveryEditDto = new DeliveryEditDto();
|
DeliveryEditDto deliveryEditDto = new DeliveryEditDto();
|
||||||
deliveryEditDto.setDeliveryName(trackOutBoDto.getReceiveRequestName());
|
deliveryEditDto.setDeliveryName(trackOutBoDto.getReceiveRequestName());
|
||||||
deliveryEditDto.setSiteName(trackOutBoDto.getSiteName());
|
deliveryEditDto.setSiteName(trackOutBoDto.getSiteName());
|
||||||
// @TODO 完成状态下,更新为 DeliveryStateEnums.FINISH
|
|
||||||
deliveryEditDto.setDeliveryState(DeliveryStateEnums.FINISH.getCode());
|
deliveryEditDto.setDeliveryState(DeliveryStateEnums.FINISH.getCode());
|
||||||
deliveryService.editDelivery(deliveryEditDto);
|
deliveryService.editDelivery(deliveryEditDto);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return AjaxResult.me().setSuccess(false).setMessage("到货单:" + trackOutBoDto.getReceiveRequestName() + "不存在").setErrorCode(400);
|
return AjaxResult.me().setMessage("到货单:" + trackOutBoDto.getReceiveRequestName() + "不存在").setErrorCode(400);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return AjaxResult.me().setSuccess(false).setMessage(e.toString());
|
return AjaxResult.me().setErrorCode(400).setMessage(e.toString());
|
||||||
}
|
}
|
||||||
return AjaxResult.me().setSuccess(true);
|
return AjaxResult.me().setSuccess(true);
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ package com.cim.idm.service;
|
|||||||
import com.cim.idm.exception.GlobalException;
|
import com.cim.idm.exception.GlobalException;
|
||||||
import com.cim.idm.framework.data.EventInfo;
|
import com.cim.idm.framework.data.EventInfo;
|
||||||
import com.cim.idm.model.OutStockDto;
|
import com.cim.idm.model.OutStockDto;
|
||||||
|
import com.cim.idm.model.po.delivery.MaterialDelivery;
|
||||||
import com.cim.idm.utils.AjaxResult;
|
import com.cim.idm.utils.AjaxResult;
|
||||||
|
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
@ -62,4 +63,10 @@ public interface IMaterialShipService {
|
|||||||
*/
|
*/
|
||||||
AjaxResult MaterialShipRequestAuxiliaryCancelConfirmStocking(EventInfo eventInfo, String siteName, String shipRequestName, String user);
|
AjaxResult MaterialShipRequestAuxiliaryCancelConfirmStocking(EventInfo eventInfo, String siteName, String shipRequestName, String user);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据到货单号更新入库单数量
|
||||||
|
* @param eventInfo 事件信息
|
||||||
|
* @param materialDelivery 到货单信息
|
||||||
|
*/
|
||||||
|
void DeliveryStockInUpdateReceiveRequestQty(EventInfo eventInfo, MaterialDelivery materialDelivery);
|
||||||
}
|
}
|
||||||
|
@ -2,12 +2,16 @@ package com.cim.idm.service.Impl;
|
|||||||
|
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.cim.idm.dao.DeliveryDao;
|
||||||
import com.cim.idm.data.ErpMessageLog;
|
import com.cim.idm.data.ErpMessageLog;
|
||||||
import com.cim.idm.exception.GlobalException;
|
import com.cim.idm.exception.GlobalException;
|
||||||
import com.cim.idm.framework.IDMFrameServiceProxy;
|
import com.cim.idm.framework.IDMFrameServiceProxy;
|
||||||
import com.cim.idm.framework.data.EventInfo;
|
import com.cim.idm.framework.data.EventInfo;
|
||||||
import com.cim.idm.framework.util.time.TimeStampUtil;
|
import com.cim.idm.framework.util.time.TimeStampUtil;
|
||||||
import com.cim.idm.model.OutStockDto;
|
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.mwmsextend.materialpacking.service.MaterialPackingServiceImpl;
|
||||||
import com.cim.idm.service.IMaterialShipService;
|
import com.cim.idm.service.IMaterialShipService;
|
||||||
import com.cim.idm.service.impl.MESServiceImpl;
|
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.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
@ -45,6 +50,8 @@ public class MaterialShipServiceImpl implements IMaterialShipService {
|
|||||||
private ToSAPMessageUtil toSAPMessageUtil;
|
private ToSAPMessageUtil toSAPMessageUtil;
|
||||||
|
|
||||||
private EventInfo makeEventInfo;
|
private EventInfo makeEventInfo;
|
||||||
|
@Autowired
|
||||||
|
private DeliveryDao deliveryDao;
|
||||||
/**
|
/**
|
||||||
* 出库方法实现
|
* 出库方法实现
|
||||||
*/
|
*/
|
||||||
@ -2044,4 +2051,43 @@ public class MaterialShipServiceImpl implements IMaterialShipService {
|
|||||||
}
|
}
|
||||||
return true;
|
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