fix(261):增加cj数组可不许自动报工

This commit is contained in:
liaohechuan 2025-03-06 18:58:46 +08:00
parent 7c955cb641
commit 46ec6afe5d
4 changed files with 19 additions and 4 deletions

View File

@ -284,7 +284,7 @@ public class ShopOrderStatisticTransController {
for (int i = 0; i < zLotMaterialConsumptionTransactions.size(); i++) {
List<ZLotMaterialConsumptionTransaction> newList = new ArrayList<>();
newList.add(zLotMaterialConsumptionTransactions.get(i));
InvokeResponse invokeResponse = lotMaterialDealSendSapService.callLotMaterialConsumption(newList, false,"");
InvokeResponse invokeResponse = lotMaterialDealSendSapService.callLotMaterialConsumption(newList, false,"", new ArrayList<>());
if ("E".equals(invokeResponse.getResult())) {
sb.append("批次【"+zLotMaterialConsumptionTransactions.get(i).getLotNo()+"】SAP错误:" + invokeResponse.getMessageContent());
}

View File

@ -44,6 +44,8 @@ public class SapMaterialConsumptionJob {
String postingDate = null;
// 同步时间节点
String syncTimeNode = null;
// 车间列表不需要消耗报工
List<String> cjList = new ArrayList<>();
String jobParam = XxlJobHelper.getJobParam();
if (StrUtil.isNotBlank(jobParam)) {
Map<String, String> paramMap = JS.parseMap(jobParam, "=", ";");
@ -52,6 +54,14 @@ public class SapMaterialConsumptionJob {
endDate = paramMap.get("endDate");
postingDate = paramMap.get("postingDate");
syncTimeNode = paramMap.get("syncTimeNode");
String cj = paramMap.get("cjList");
if (StrUtil.isNotBlank(cj)) {
if (cj.contains(",")) {
cjList = Arrays.asList(cj.split(","));
} else {
cjList.add(cj);
}
}
}
if (StrUtil.isBlank(site)) {
XxlJobHelper.log("ERROR:未维护站点[site]参数");
@ -99,7 +109,7 @@ public class SapMaterialConsumptionJob {
for (int i = 0; i < zLotMaterialConsumptionTransactionList.size(); i++) {
List<ZLotMaterialConsumptionTransaction> newList = new ArrayList<>();
newList.add(zLotMaterialConsumptionTransactionList.get(i));
InvokeResponse invokeResponse = lotMaterialDealSendSapService.callLotMaterialConsumption(newList, true, postingDate);
InvokeResponse invokeResponse = lotMaterialDealSendSapService.callLotMaterialConsumption(newList, true, postingDate, cjList);
if (!"S".equals(invokeResponse.getResult())) {
XxlJobHelper.log("WARN:同步261物料消耗数据失败!!!" + invokeResponse.getMessageContent());
// return ReturnT.FAIL;

View File

@ -10,5 +10,5 @@ public interface LotMaterialDealSendSapService {
InvokeResponse callLotMaterialComplete(List<ZLotMaterialCompleteTransaction> zLotMaterialCompleteTransactions, boolean isPass, String postingDate);
InvokeResponse callLotMaterialConsumption(List<ZLotMaterialConsumptionTransaction> zLotMaterialConsumptionTransactions, boolean isPass, String postingDate);
InvokeResponse callLotMaterialConsumption(List<ZLotMaterialConsumptionTransaction> zLotMaterialConsumptionTransactions, boolean isPass, String postingDate, List<String> cjList);
}

View File

@ -17,6 +17,7 @@ import com.foreverwin.iep.wip.mapper.LotMaterialMapper;
import com.foreverwin.mom.common.core.exception.BusinessException;
import com.foreverwin.mom.common.data.tenant.TenantContextHolder;
import com.foreverwin.mom.common.security.util.SecurityUtils;
import io.seata.common.util.CollectionUtils;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
@ -191,12 +192,16 @@ public class LotMaterialDealSendSapServiceImpl implements LotMaterialDealSendSap
// ------------------------- 物料消耗报工开始 ----------------------------------------------------------
@Override
public InvokeResponse callLotMaterialConsumption(List<ZLotMaterialConsumptionTransaction> zLotMaterialConsumptionTransactions, boolean isPass, String postingDate) {
public InvokeResponse callLotMaterialConsumption(List<ZLotMaterialConsumptionTransaction> zLotMaterialConsumptionTransactions, boolean isPass, String postingDate, List<String> cjList) {
InvokeResponse invokeResponse = new InvokeResponse();
String site = "";
JSONArray itemList = new JSONArray();
List<ZLotMaterialConsumptionTransaction> srcList = new ArrayList<>();
for (ZLotMaterialConsumptionTransaction consumptionTransaction : zLotMaterialConsumptionTransactions) {
// 如果车间在维护的数据里,不自动报工
if (CollectionUtils.isNotEmpty(cjList) && cjList.contains(consumptionTransaction.getFabNo())) {
continue;
}
// 重新校验一遍是否已经报过工,防止重复报工
ZLotMaterialConsumptionTransaction targetObj = zLotMaterialConsumptionTransactionMapper.selectById(consumptionTransaction.getSid());
if ("S".equals(targetObj.getSyncStatus()) && !isPass) {