转工单出库添加冲销

This commit is contained in:
王帅 2025-05-26 09:33:39 +08:00
parent b5d1c27ae5
commit 8290916c8d
2 changed files with 14 additions and 3 deletions

View File

@ -53,6 +53,8 @@ public class MESToWMSServiceImpl implements MESToWMSService {
@Autowired
private MesToWmsDao mesToWmsDao;
@Autowired
private InvoiceServiceImpl invoiceService;
@Override
@Transactional
@ -666,7 +668,7 @@ public class MESToWMSServiceImpl implements MESToWMSService {
*/
@Override
@Transactional
public AjaxResult workOrder_Request(JSONArray in) {
public AjaxResult workOrder_Request(JSONArray in) throws Exception {
//转工单按照批次先传MDC消耗请求SAP出库再生成入库信息传SAP入库
log.info("Received work order request: {}", in.toJSONString());
//转换前工单formOrder转换后工单toOrder料号 materialSpecname批次 charge
@ -707,7 +709,7 @@ public class MESToWMSServiceImpl implements MESToWMSService {
* 出库方法
*/
@Transactional
public String materialOutByMES(List<String> materialSpecnameList, List<String> chargeList) {
public String materialOutByMES(List<String> materialSpecnameList, List<String> chargeList) throws Exception {
String result = "";
//调用Mybatis方法查询当前可出库存
List<changeOrderDto> materialPackingList = mesToWmsDao.getMaterialPackingList(materialSpecnameList, chargeList);
@ -716,6 +718,15 @@ public class MESToWMSServiceImpl implements MESToWMSService {
materialPackingList,
"MES"
);
if (undoid != null) {
// 冲销
String undo = invoiceService.cancelShipInter(undoid, "MES");
if (undo == null || undo.isEmpty()) {
throw new GlobalException("下发mes失败后冲销失败");
} else {
throw new GlobalException("发送到mes失败");
}
}
//更新MDC表状态
mesToWmsDao.updateMDCFlag(materialSpecnameList, chargeList, "T");
return undoid;

View File

@ -40,7 +40,7 @@ public interface MESToWMSService {
* @param in
* @return
*/
AjaxResult workOrder_Request(JSONArray in);
AjaxResult workOrder_Request(JSONArray in) throws Exception;
@Transactional
AjaxResult materialConsumeRequestSapcprkUndo(String undoId, String user, String payMentDate) throws Exception;