fix:回调完成需求单

This commit is contained in:
zhaoyf
2026-11-05 16:41:58 +08:00
parent bb5214416c
commit a3aacd017e
3 changed files with 22 additions and 19 deletions

View File

@@ -7,6 +7,7 @@ import org.nl.wms.ext_manage.api.MesApi;
import org.nl.wms.ext_manage.purchase.service.InboundZDwmsService;
import org.nl.wms.pm_manage.demand.service.IPmDemandService;
import org.nl.wms.pm_manage.demand.service.dao.PmDemand;
import org.nl.wms.pm_manage.demand.service.enums.DemandStatus;
import org.nl.wms.warehouse_manage.stockReturn.strategy.core.impl.sap.SapDealLLDBBillPmDeamndCallBack;
import org.nl.wms.warehouse_manage.stockReturn.strategy.core.impl.sap.SapProductionOutboundDelivery;
import org.springframework.beans.factory.annotation.Autowired;
@@ -53,9 +54,19 @@ public class InboundZDwmsServiceImpl implements InboundZDwmsService {
//走sap库存转储
sapDealLLDBBillPmDeamndCallBack.feedbackDemand(pmDemand, feedbackQty);
}
closeDemandIfFinished(pmDemand);
}
mesApi.pmDemandCallback(dtos);
}
/**
* 累计已分配数量达到需求数量时结束需求单(assign_qty 由调用方累加)
*/
private void closeDemandIfFinished(PmDemand demand) {
if (demand.getAssign_qty() != null && demand.getQty() != null
&& demand.getAssign_qty().compareTo(demand.getQty()) >= 0
&& !DemandStatus.FINISH.getValue().equals(demand.getStatus())) {
demand.setStatus(DemandStatus.FINISH.getValue());
pmDemandService.updateById(demand);
}
}
}

View File

@@ -253,20 +253,9 @@ public class SapDealLLDBBillPmDeamndCallBack implements CallbackStrategy {
stockReturn.setProcess_time(DateUtil.now());
}
iPmStockReturnService.save(stockReturn);
closeDemandIfFinished(demand);
}
/**
* 累计已分配数量达到需求数量时结束需求单(assign_qty 由调用方累加)
*/
private void closeDemandIfFinished(PmDemand demand) {
if (demand.getAssign_qty() != null && demand.getQty() != null
&& demand.getAssign_qty().compareTo(demand.getQty()) >= 0
&& !DemandStatus.FINISH.getValue().equals(demand.getStatus())) {
demand.setStatus(DemandStatus.FINISH.getValue());
iPmDemandService.updateById(demand);
}
}
/**
* 组装中鼎反馈的 MM057 转储报文:单物料、数量=本次反馈数量

View File

@@ -14,6 +14,7 @@ import org.nl.wms.ext_manage.sap.api.dto.ProductionOutboundRequest;
import org.nl.wms.ext_manage.sap.enums.SapConstant;
import org.nl.wms.pm_manage.demand.service.IPmDemandService;
import org.nl.wms.pm_manage.demand.service.dao.PmDemand;
import org.nl.wms.pm_manage.demand.service.enums.DemandStatus;
import org.nl.wms.warehouse_manage.enums.IOSEnum;
import org.nl.wms.warehouse_manage.inAndOut.service.dao.IOStorInv;
import org.nl.wms.warehouse_manage.inAndOut.service.dao.IOStorInvDtl;
@@ -32,11 +33,7 @@ import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.regex.Pattern;
/**
@@ -106,6 +103,12 @@ public class SapProductionOutboundDelivery implements CallbackStrategy {
// if (postedTotal.signum() > 0) {
// syncDetailAssignQty(bill, materialCode, usedQtyByBom);
// }
demand.setAssign_qty(param.getAssign_qty());
if (demand.getAssign_qty().compareTo(demand.getQty()) >= 0
&& !DemandStatus.FINISH.getValue().equals(demand.getStatus())) {
demand.setStatus(DemandStatus.FINISH.getValue());
iPmDemandService.updateById(demand);
}
}
/**