From 34a4cfd363e92c6c7529eeac331780f25968b6d6 Mon Sep 17 00:00:00 2001 From: yinq Date: Fri, 2 Aug 2024 17:22:38 +0800 Subject: [PATCH] =?UTF-8?q?change=20-=20add=E5=90=8C=E6=AD=A5=E6=88=90?= =?UTF-8?q?=E5=93=81=E5=87=BA=E3=80=81=E5=85=A5=E5=BA=93=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E5=88=B0ERP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hw/jindie/api/RemoteJindieService.java | 4 + .../factory/RemoteJindieFallbackFactory.java | 5 + .../java/com/hw/wms/api/RemoteWmsService.java | 22 ++- .../api/factory/RemoteWmsFallbackFactory.java | 12 +- .../src/main/java/com/hw/job/task/RyTask.java | 17 +- .../hw/wms/controller/WmsApiController.java | 20 +++ .../com/hw/wms/domain/WmsProductInstock.java | 40 +++++ .../com/hw/wms/domain/WmsProductOutstock.java | 27 ++++ .../wms/mapper/WmsProductInstockMapper.java | 7 + .../wms/mapper/WmsProductOutstockMapper.java | 6 + .../service/IWmsErpScheduledTaskService.java | 15 ++ .../impl/WmsErpScheduledTaskServiceImpl.java | 145 +++++++++++++++++- .../mapper/wms/WmsProductInstockMapper.xml | 36 +++++ .../mapper/wms/WmsProductOutstockMapper.xml | 35 +++++ 14 files changed, 383 insertions(+), 8 deletions(-) diff --git a/hw-api/hw-api-jindie/src/main/java/com/hw/jindie/api/RemoteJindieService.java b/hw-api/hw-api-jindie/src/main/java/com/hw/jindie/api/RemoteJindieService.java index 91594d1..fb09b7f 100644 --- a/hw-api/hw-api-jindie/src/main/java/com/hw/jindie/api/RemoteJindieService.java +++ b/hw-api/hw-api-jindie/src/main/java/com/hw/jindie/api/RemoteJindieService.java @@ -52,4 +52,8 @@ public interface RemoteJindieService { @PostMapping("/jindie/saveOtherOutStorage") R saveOtherOutStorage(@RequestBody String params, @RequestHeader(SecurityConstants.FROM_SOURCE) String source); + /** 其他入库单保存->提交->审核*/ + @PostMapping("/jindie/saveOtherInStorage") + R saveOtherInStorage(@RequestBody String params, @RequestHeader(SecurityConstants.FROM_SOURCE) String source); + } diff --git a/hw-api/hw-api-jindie/src/main/java/com/hw/jindie/api/factory/RemoteJindieFallbackFactory.java b/hw-api/hw-api-jindie/src/main/java/com/hw/jindie/api/factory/RemoteJindieFallbackFactory.java index b8a7ad1..247317b 100644 --- a/hw-api/hw-api-jindie/src/main/java/com/hw/jindie/api/factory/RemoteJindieFallbackFactory.java +++ b/hw-api/hw-api-jindie/src/main/java/com/hw/jindie/api/factory/RemoteJindieFallbackFactory.java @@ -55,6 +55,11 @@ public class RemoteJindieFallbackFactory implements FallbackFactory saveOtherOutStorage(String params, String source) { return R.fail("其他出库单同步失败:" + throwable.getMessage()); } + + @Override + public R saveOtherInStorage(String params, String source) { + return R.fail("其他入库单同步失败:" + throwable.getMessage()); + } }; } } diff --git a/hw-api/hw-api-wms/src/main/java/com/hw/wms/api/RemoteWmsService.java b/hw-api/hw-api-wms/src/main/java/com/hw/wms/api/RemoteWmsService.java index 6c9340c..68df7e6 100644 --- a/hw-api/hw-api-wms/src/main/java/com/hw/wms/api/RemoteWmsService.java +++ b/hw-api/hw-api-wms/src/main/java/com/hw/wms/api/RemoteWmsService.java @@ -6,15 +6,17 @@ import com.hw.common.core.domain.R; import com.hw.common.core.web.domain.AjaxResult; import com.hw.wms.api.factory.RemoteWmsFallbackFactory; import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestHeader; +import org.springframework.web.bind.annotation.RequestParam; @FeignClient(contextId = "remoteWmsService", value = ServiceNameConstants.WMS_SERVICE, fallbackFactory = RemoteWmsFallbackFactory.class) public interface RemoteWmsService { /** - * 定时同步入库信息给ERP + * 定时同步原材料入库信息给ERP * @param source * @return */ @@ -29,4 +31,22 @@ public interface RemoteWmsService { @PostMapping("/api/synchronizeRawMaterialDeliveryInformationToERP") public R synchronizeRawMaterialDeliveryInformationToERP(@RequestHeader(SecurityConstants.FROM_SOURCE) String source); + /** + * 定时同步成品入库信息给ERP + * @param days + * @param source + * @return + */ + @PostMapping("/api/synchronizeProductInstockInformationToERP/{days}") + public R synchronizeProductInstockInformationToERP(@PathVariable("days") Integer days, @RequestHeader(SecurityConstants.FROM_SOURCE) String source); + + /** + * 定时同步成品出库信息给ERP + * @param days + * @param source + * @return + */ + @PostMapping("/api/synchronizeProductOutstockInformationToERP/{days}") + public R synchronizeProductOutstockInformationToERP(@PathVariable("days") Integer days, @RequestHeader(SecurityConstants.FROM_SOURCE) String source); + } diff --git a/hw-api/hw-api-wms/src/main/java/com/hw/wms/api/factory/RemoteWmsFallbackFactory.java b/hw-api/hw-api-wms/src/main/java/com/hw/wms/api/factory/RemoteWmsFallbackFactory.java index 00fc5cf..1643476 100644 --- a/hw-api/hw-api-wms/src/main/java/com/hw/wms/api/factory/RemoteWmsFallbackFactory.java +++ b/hw-api/hw-api-wms/src/main/java/com/hw/wms/api/factory/RemoteWmsFallbackFactory.java @@ -24,13 +24,23 @@ public class RemoteWmsFallbackFactory implements FallbackFactory synchronizeInventoryInformationToERP(String source) { - return R.fail("定时同步入库信息给ERP失败:" + throwable.getMessage()); + return R.fail("定时同步原材料入库信息给ERP失败:" + throwable.getMessage()); } @Override public R synchronizeRawMaterialDeliveryInformationToERP(String source) { return R.fail("定时同步原材料出库给ERP失败:" + throwable.getMessage()); } + + @Override + public R synchronizeProductInstockInformationToERP(Integer days, String inner) { + return R.fail("定时同步成品入库给ERP失败:" + throwable.getMessage()); + } + + @Override + public R synchronizeProductOutstockInformationToERP(Integer days, String source) { + return R.fail("定时同步成品出库给ERP失败:" + throwable.getMessage()); + } }; } } diff --git a/hw-modules/hw-job/src/main/java/com/hw/job/task/RyTask.java b/hw-modules/hw-job/src/main/java/com/hw/job/task/RyTask.java index 854f003..878be2c 100644 --- a/hw-modules/hw-job/src/main/java/com/hw/job/task/RyTask.java +++ b/hw-modules/hw-job/src/main/java/com/hw/job/task/RyTask.java @@ -6,6 +6,7 @@ import com.hw.ems.api.RemoteEmsService; import com.hw.jindie.api.RemoteJindieService; import com.hw.jindie.api.domain.vo.ErpSyncInfoVo; import com.hw.wms.api.RemoteWmsService; +import io.swagger.models.auth.In; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import com.hw.common.core.utils.StringUtils; @@ -103,17 +104,27 @@ public class RyTask public void syncPurchaseOrderFromErp(String maxErpModifyDate){ ErpSyncInfoVo erpSyncInfoVo = new ErpSyncInfoVo(); erpSyncInfoVo.setMaxErpModifyDate(maxErpModifyDate); - System.out.println("++同步ERP中采购订单信息++ErpPurchaseOrder"); + System.out.println("++同步ERP中采购订单信息++syncPurchaseOrderFromErp"); remoteJindieService.syncPurchaseOrderFromErp(erpSyncInfoVo,SecurityConstants.INNER); } public void syncInventoryInformationToERP(){ - System.out.println("++定时同步入库信息给ERP++ErpPurchaseOrder"); + System.out.println("++定时同步原材料入库信息给ERP++syncInventoryInformationToERP"); remoteWmsService.synchronizeInventoryInformationToERP(SecurityConstants.INNER); } public void syncRawMaterialDeliveryInformationToERP(){ - System.out.println("++定时同步入库信息给ERP++ErpPurchaseOrder"); + System.out.println("++定时同步原材料入库信息给ERP++syncRawMaterialDeliveryInformationToERP"); remoteWmsService.synchronizeRawMaterialDeliveryInformationToERP(SecurityConstants.INNER); } + + public void synchronizeProductInstockInformationToERP(Integer days){ + System.out.println("++定时同步成品入库信息给ERP++synchronizeProductInstockInformationToERP"); + remoteWmsService.synchronizeProductInstockInformationToERP(days, SecurityConstants.INNER); + } + + public void synchronizeProductOutstockInformationToERP(Integer days){ + System.out.println("++定时同步成品出库信息给ERP++synchronizeProductOutstockInformationToERP"); + remoteWmsService.synchronizeProductOutstockInformationToERP(days, SecurityConstants.INNER); + } } diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/controller/WmsApiController.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/controller/WmsApiController.java index 76c6b85..bc42ff7 100644 --- a/hw-modules/hw-wms/src/main/java/com/hw/wms/controller/WmsApiController.java +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/controller/WmsApiController.java @@ -200,4 +200,24 @@ public class WmsApiController extends BaseController { return toAjax(wmsErpScheduledTaskService.synchronizeRawMaterialDeliveryInformationToERP()); } + /** + * 定时同步成品入库信息给ERP + * @param days 同步days天前数据 + * @return + */ + @PostMapping(("/synchronizeProductInstockInformationToERP/{days}")) + public AjaxResult synchronizeProductInstockInformationToERP(@PathVariable Integer days) { + return toAjax(wmsErpScheduledTaskService.synchronizeProductInstockInformationToERP(days)); + } + + /** + * 定时同步成品出库信息给ERP + * @param days 同步days天前数据 + * @return + */ + @PostMapping(("/synchronizeProductOutstockInformationToERP/{days}")) + public AjaxResult synchronizeProductOutstockInformationToERP(@PathVariable Integer days) { + return toAjax(wmsErpScheduledTaskService.synchronizeProductOutstockInformationToERP(days)); + } + } diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/domain/WmsProductInstock.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/domain/WmsProductInstock.java index bdaf1e5..08084c4 100644 --- a/hw-modules/hw-wms/src/main/java/com/hw/wms/domain/WmsProductInstock.java +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/domain/WmsProductInstock.java @@ -172,6 +172,46 @@ public class WmsProductInstock extends BaseEntity { */ private List wmsProductInstockDetailList; + private BigDecimal price; + + private String specificationParameter; + + private String unitCode; + + private String materialCode; + + public BigDecimal getPrice() { + return price; + } + + public void setPrice(BigDecimal price) { + this.price = price; + } + + public String getSpecificationParameter() { + return specificationParameter; + } + + public void setSpecificationParameter(String specificationParameter) { + this.specificationParameter = specificationParameter; + } + + public String getUnitCode() { + return unitCode; + } + + public void setUnitCode(String unitCode) { + this.unitCode = unitCode; + } + + public String getMaterialCode() { + return materialCode; + } + + public void setMaterialCode(String materialCode) { + this.materialCode = materialCode; + } + public void setProductInstockId(Long productInstockId) { this.productInstockId = productInstockId; } diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/domain/WmsProductOutstock.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/domain/WmsProductOutstock.java index 6a311f9..b694f84 100644 --- a/hw-modules/hw-wms/src/main/java/com/hw/wms/domain/WmsProductOutstock.java +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/domain/WmsProductOutstock.java @@ -153,14 +153,41 @@ public class WmsProductOutstock extends BaseEntity { private String materialName; + private BigDecimal price; + private String specificationParameter; + private String unitCode; /** * 成品出库记录明细信息 */ private List wmsProductOutstockDetailList; + public BigDecimal getPrice() { + return price; + } + + public void setPrice(BigDecimal price) { + this.price = price; + } + + public String getSpecificationParameter() { + return specificationParameter; + } + + public void setSpecificationParameter(String specificationParameter) { + this.specificationParameter = specificationParameter; + } + + public String getUnitCode() { + return unitCode; + } + + public void setUnitCode(String unitCode) { + this.unitCode = unitCode; + } + public void setProductOutstockId(Long productOutstockId) { this.productOutstockId = productOutstockId; } diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/mapper/WmsProductInstockMapper.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/mapper/WmsProductInstockMapper.java index e2fa9df..f02c395 100644 --- a/hw-modules/hw-wms/src/main/java/com/hw/wms/mapper/WmsProductInstockMapper.java +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/mapper/WmsProductInstockMapper.java @@ -84,4 +84,11 @@ public interface WmsProductInstockMapper * @return 结果 */ public int deleteWmsProductInstockDetailByProductInstockId(Long productInstockId); + + /** + * 执行完成且未同步ERP的成品入库List + * @param wmsProductInstock + * @return + */ + List selectWmsProductInstockERPNotSynchronized(WmsProductInstock wmsProductInstock); } diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/mapper/WmsProductOutstockMapper.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/mapper/WmsProductOutstockMapper.java index b777572..0814237 100644 --- a/hw-modules/hw-wms/src/main/java/com/hw/wms/mapper/WmsProductOutstockMapper.java +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/mapper/WmsProductOutstockMapper.java @@ -113,4 +113,10 @@ public interface WmsProductOutstockMapper */ public WmsProductOutstock selectOnlyWmsProductOutstockByOutstockId(Long productOutstockId); + /** + * 执行完成且未同步ERP的成品出库List + * @param wmsProductOutstock + * @return + */ + List selectWmsProductOutstockERPNotSynchronized(WmsProductOutstock wmsProductOutstock); } diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/service/IWmsErpScheduledTaskService.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/service/IWmsErpScheduledTaskService.java index 23241f0..9749e5d 100644 --- a/hw-modules/hw-wms/src/main/java/com/hw/wms/service/IWmsErpScheduledTaskService.java +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/service/IWmsErpScheduledTaskService.java @@ -21,4 +21,19 @@ public interface IWmsErpScheduledTaskService { * @return */ int synchronizeRawMaterialDeliveryInformationToERP(); + + /** + * 定时同步成品入库信息给ERP + * @param days 同步days天前数据 + * @return + */ + int synchronizeProductInstockInformationToERP(Integer days); + + /** + * 定时同步成品出库信息给ERP + * @param days 同步days天前数据 + * @return + */ + int synchronizeProductOutstockInformationToERP(Integer days); + } diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsErpScheduledTaskServiceImpl.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsErpScheduledTaskServiceImpl.java index 3f47c6d..471afaf 100644 --- a/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsErpScheduledTaskServiceImpl.java +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsErpScheduledTaskServiceImpl.java @@ -6,8 +6,12 @@ import com.hw.common.core.domain.R; import com.hw.common.core.utils.DateUtils; import com.hw.common.core.web.domain.AjaxResult; import com.hw.jindie.api.RemoteJindieService; +import com.hw.wms.domain.WmsProductInstock; +import com.hw.wms.domain.WmsProductOutstock; import com.hw.wms.domain.WmsRawInstock; import com.hw.wms.domain.WmsRawOutstock; +import com.hw.wms.mapper.WmsProductInstockMapper; +import com.hw.wms.mapper.WmsProductOutstockMapper; import com.hw.wms.mapper.WmsRawInstockMapper; import com.hw.wms.mapper.WmsRawOutstockMapper; import com.hw.wms.service.IWmsErpScheduledTaskService; @@ -18,8 +22,9 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; -import java.util.List; -import java.util.Map; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.*; import java.util.stream.Collectors; /** @@ -39,6 +44,12 @@ public class WmsErpScheduledTaskServiceImpl implements IWmsErpScheduledTaskServi @Autowired private WmsRawOutstockMapper wmsRawOutstockMapper; + @Autowired + private WmsProductInstockMapper wmsProductInstockMapper; + + @Autowired + private WmsProductOutstockMapper wmsProductOutstockMapper; + @Autowired private RemoteJindieService remoteJindieService; @@ -96,6 +107,7 @@ public class WmsErpScheduledTaskServiceImpl implements IWmsErpScheduledTaskServi /** * 定时同步原材料出库信息给ERP + * * @return */ @Override @@ -131,7 +143,7 @@ public class WmsErpScheduledTaskServiceImpl implements IWmsErpScheduledTaskServi if (isSuccess) { result++; for (WmsRawOutstock wmsRawOutstock : wmsRawOutstockList) { - if (wmsRawOutstock.getRealOutstockAmount().equals(wmsRawOutstock.getOutstockAmount())){ + if (wmsRawOutstock.getRealOutstockAmount().equals(wmsRawOutstock.getOutstockAmount())) { wmsRawOutstock.setErpStatus("1");//同步ERP状态(0:失败,1成功,2同步中) } else { wmsRawOutstock.setErpStatus("2");//同步ERP状态(0:失败,1成功,2同步中) @@ -144,7 +156,134 @@ public class WmsErpScheduledTaskServiceImpl implements IWmsErpScheduledTaskServi } else { log.error("synchronizeRawMaterialDeliveryInformationToERP失败:" + paramsResult.toString()); } + } + + /** + * 定时同步成品入库信息给ERP + * @param days 同步days天前数据 + * @return + */ + @Override + public int synchronizeProductInstockInformationToERP(Integer days) { + int result = 0; + WmsProductInstock wmsProductInstock = new WmsProductInstock(); + HashMap paramMap = new HashMap<>(); + String beginTime= subtractDaysFromCurrentDate(days); + paramMap.put("beginTime", beginTime); + paramMap.put("endTime", DateUtils.getTime()); + wmsProductInstock.setParams(paramMap); + List productInstockList = wmsProductInstockMapper.selectWmsProductInstockERPNotSynchronized(wmsProductInstock); + Map> productIdMap = productInstockList.stream().collect(Collectors.groupingBy(WmsProductInstock::getProductId)); + for (Long productId : productIdMap.keySet()) { + syncProductInstockInformation(productIdMap, productId, result); + } + return result; + } + + @Transactional(propagation = Propagation.REQUIRES_NEW) + void syncProductInstockInformation(Map> productIdMap, Long productId, int result) { + List wmsProductInstockList = productIdMap.get(productId); + JSONObject data = new JSONObject(); + double FRealQty = wmsProductInstockList.stream().mapToDouble(item -> item.getInstockAmount().subtract(item.getErpAmount()).doubleValue()).sum(); + WmsProductInstock instock = wmsProductInstockList.get(0); + data.put("FDate", DateUtils.getTime()); + data.put("FMaterialId", instock.getMaterialCode()); + data.put("FAuxPropId", instock.getSpecificationParameter()); + data.put("FUnitID", instock.getUnitCode()); + data.put("FQty", FRealQty); + data.put("FPrice", instock.getPrice()); + data.put("FStockId", FStockId); + String params = data.toJSONString(); + R paramsResult = remoteJindieService.saveOtherInStorage(params, SecurityConstants.INNER); + String paramsResultData = paramsResult.getMsg(); + JSONObject jsonObject = JSONObject.parseObject(paramsResultData); + Boolean isSuccess = (Boolean) jsonObject.get("IsSuccess"); + if (isSuccess) { + result++; + for (WmsProductInstock wmsProductInstock : wmsProductInstockList) { + wmsProductInstock.setErpStatus("1");//同步ERP状态(0:失败,1成功) + wmsProductInstock.setErpAmount(wmsProductInstock.getInstockAmount()); + wmsProductInstock.setUpdateDate(DateUtils.getNowDate()); + wmsProductInstockMapper.updateWmsProductInstock(wmsProductInstock); + } + log.info("synchronizeProductInstockInformationToERP成功:" + paramsResult.toString()); + } else { + log.error("synchronizeProductInstockInformationToERP失败:" + paramsResult.toString()); + } + } + + /** + * 定时同步成品出库信息给ERP + * @param days 同步days天前数据 + * @return + */ + @Override + public int synchronizeProductOutstockInformationToERP(Integer days) { + int result = 0; + WmsProductOutstock wmsProductOutstock = new WmsProductOutstock(); + HashMap paramMap = new HashMap<>(); + String beginTime= subtractDaysFromCurrentDate(days); + paramMap.put("beginTime", beginTime); + paramMap.put("endTime", DateUtils.getTime()); + wmsProductOutstock.setParams(paramMap); + List productOutstockList = wmsProductOutstockMapper.selectWmsProductOutstockERPNotSynchronized(wmsProductOutstock); + Map> productIdMap = productOutstockList.stream().collect(Collectors.groupingBy(WmsProductOutstock::getProductId)); + for (Long productId : productIdMap.keySet()) { + syncProductOutstockInformation(productIdMap, productId, result); + } + return result; + } + + @Transactional(propagation = Propagation.REQUIRES_NEW) + void syncProductOutstockInformation(Map> productIdMap, Long productId, int result) { + List wmsProductOutstockList = productIdMap.get(productId); + JSONObject data = new JSONObject(); + double FRealQty = wmsProductOutstockList.stream().mapToDouble(item -> item.getOutstockQty().subtract(item.getErpAmount()).doubleValue()).sum(); + WmsProductOutstock outstock = wmsProductOutstockList.get(0); + data.put("FDate", DateUtils.getTime()); + data.put("FMaterialId", outstock.getMaterialCode()); + data.put("FAuxPropId", outstock.getSpecificationParameter()); + data.put("FUnitID", outstock.getUnitCode()); + data.put("FQty", FRealQty); + data.put("FPrice", outstock.getPrice()); + data.put("FStockId", FStockId); + String params = data.toJSONString(); + R paramsResult = remoteJindieService.saveOtherOutStorage(params, SecurityConstants.INNER); + String paramsResultData = paramsResult.getMsg(); + JSONObject jsonObject = JSONObject.parseObject(paramsResultData); + Boolean isSuccess = (Boolean) jsonObject.get("IsSuccess"); + if (isSuccess) { + result++; + for (WmsProductOutstock wmsProductOutstock : wmsProductOutstockList) { + wmsProductOutstock.setErpStatus("1");//同步ERP状态(0:失败,1成功) + wmsProductOutstock.setErpAmount(wmsProductOutstock.getOutstockQty()); + wmsProductOutstock.setUpdateDate(DateUtils.getNowDate()); + wmsProductOutstockMapper.updateWmsProductOutstock(wmsProductOutstock); + } + log.info("synchronizeProductOutstockInformationToERP成功:" + paramsResult.toString()); + } else { + log.error("synchronizeProductOutstockInformationToERP失败:" + paramsResult.toString()); + } + } + /** + * 从当前日期减去指定的天数,并返回结果日期(字符串格式,包括时分秒) + * + * @param daysToSubtract 要减去的天数(如果为空,则默认为 180 天) + * @return 减去指定天数后的日期(字符串格式,包括时分秒) + */ + public static String subtractDaysFromCurrentDate(Integer daysToSubtract) { + // 如果 daysToSubtract 为空,则默认为 180 天 + daysToSubtract = Optional.ofNullable(daysToSubtract).orElse(180); + // 获取当前日期时间 + LocalDateTime currentDateTime = LocalDateTime.now(); + // 减去指定的天数 + LocalDateTime resultDateTime = currentDateTime.minusDays(daysToSubtract); + // 定义日期时间格式 + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + // 格式化结果日期时间 + return resultDateTime.format(formatter); } + } diff --git a/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsProductInstockMapper.xml b/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsProductInstockMapper.xml index c2c3127..a999604 100644 --- a/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsProductInstockMapper.xml +++ b/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsProductInstockMapper.xml @@ -32,6 +32,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + + @@ -216,4 +220,36 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ( #{item.productInstockDetailId}, #{item.productInstockId}, #{item.locationCode}, #{item.productId}, #{item.productBarcode}, #{item.productBatch}, #{item.executeStatus}, #{item.erpStatus}, #{item.planAmount}, #{item.instockAmount}, #{item.instockBy}, #{item.instockDate}, #{item.instockWay}, #{item.updateBy}, #{item.updateDate}) + + diff --git a/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsProductOutstockMapper.xml b/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsProductOutstockMapper.xml index ced8139..5e825b4 100644 --- a/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsProductOutstockMapper.xml +++ b/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsProductOutstockMapper.xml @@ -41,6 +41,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + @@ -290,4 +293,36 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where a.product_outstock_id = #{productOutstockId} + +