fix(完工入库报工): 新增物料消耗报工job、完工入库过账日期自定义

This commit is contained in:
chengzhaofeng 2025-01-09 11:18:34 +08:00
parent 25d8510266
commit 17968d62da
2 changed files with 16 additions and 4 deletions

View File

@ -24,6 +24,7 @@ import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Component;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
@ -57,6 +58,7 @@ public class SapMaterialConsumptionJob {
site = paramMap.get("site");
startDate = paramMap.get("startDate");
endDate = paramMap.get("endDate");
postingDate = paramMap.get("postingDate");
}
if (StrUtil.isBlank(site)) {
XxlJobHelper.log("ERROR:未维护站点[site]参数");
@ -85,8 +87,12 @@ public class SapMaterialConsumptionJob {
if ("S".equals(targetObj.getSyncStatus())) {
throw BusinessException.build("批次" + targetObj.getLotNo() + "消耗已经报工,不可重复报工");
} else {
postingDate = consumptionTransaction.getSyncPostingDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
targetObj.setSyncPostingDate(consumptionTransaction.getSyncPostingDate());
LocalDate syncPostingDate = consumptionTransaction.getSyncPostingDate();
if (syncPostingDate != null) {
// 使用原来的过账日期
postingDate = syncPostingDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
}
targetObj.setSyncPostingDate(LocalDate.parse(postingDate));
srcList.add(targetObj);
JSONObject jsonObject = new JSONObject();
site = consumptionTransaction.getSite();

View File

@ -34,6 +34,7 @@ import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Component;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
@ -68,6 +69,7 @@ public class SapShopOrderCompleteJob {
site = paramMap.get("site");
startDate = paramMap.get("startDate");
endDate = paramMap.get("endDate");
postingDate = paramMap.get("postingDate");
}
if (StrUtil.isBlank(site)) {
XxlJobHelper.log("ERROR:未维护站点[site]参数");
@ -95,8 +97,12 @@ public class SapShopOrderCompleteJob {
if ("S".equals(targetObj.getSyncStatus())) {
throw BusinessException.build("批次" + targetObj.getLotNo() + "完工已经报工,不可重复报工");
} else {
postingDate = completeTransaction.getSyncPostingDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
targetObj.setSyncPostingDate(completeTransaction.getSyncPostingDate());
LocalDate syncPostingDate = completeTransaction.getSyncPostingDate();
if (syncPostingDate != null) {
// 使用原来的过账日期
postingDate = syncPostingDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
}
targetObj.setSyncPostingDate(LocalDate.parse(postingDate));
srcList.add(targetObj);
JSONObject jsonObject = new JSONObject();
site = completeTransaction.getSite();