From f213410be3c8f1af41d04cfe1af51df4ccb1bc76 Mon Sep 17 00:00:00 2001 From: mengjiao <3338049200@qq,com> Date: Fri, 5 Jan 2024 16:18:32 +0800 Subject: [PATCH] =?UTF-8?q?wms=E4=BF=AE=E6=94=B917--=E6=88=90=E5=93=81?= =?UTF-8?q?=E5=85=A5=E5=BA=93=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/op/system/api/RemoteSapService.java | 12 +- .../controller/WmsProductPutController.java | 18 +- .../controller/WmsToWCSmissionController.java | 29 +++- .../java/com/op/wms/domain/WmsProductPut.java | 61 +++++-- .../op/wms/mapper/WmsProductPutMapper.java | 4 +- .../impl/WmsProductPutServiceImpl.java | 154 +++++++++++++++++- .../mapper/wms/WmsProductPutMapper.xml | 75 +++++++-- 7 files changed, 311 insertions(+), 42 deletions(-) diff --git a/op-api/op-api-system/src/main/java/com/op/system/api/RemoteSapService.java b/op-api/op-api-system/src/main/java/com/op/system/api/RemoteSapService.java index 4eacd38f..ed59282a 100644 --- a/op-api/op-api-system/src/main/java/com/op/system/api/RemoteSapService.java +++ b/op-api/op-api-system/src/main/java/com/op/system/api/RemoteSapService.java @@ -92,7 +92,17 @@ public interface RemoteSapService { @PostMapping("/sap/sapPOrderGoodsReceipt") public R sapPOrderGoodsReceipt(@RequestBody(required = false) List> mapList); - /**101类型订单收货*/ + /** + * 智慧工厂101类型订单收货 + * 订单为母订单 + * * AUFNR CHAR12 订单号 必填 + * * WERKS 工厂 + * * LGORT CHAR4 库位 必填 + * * QUANTITY 数量 + * * ERFME UNIT 条目单位 + * * BATCH 批号 + * * HSDAT DATS8 生产日期 必填 + */ @PostMapping("/sap/sapOrderReceipt") public R sapOrderReceipt(@RequestBody(required = false) List> mapList); } diff --git a/op-modules/op-wms/src/main/java/com/op/wms/controller/WmsProductPutController.java b/op-modules/op-wms/src/main/java/com/op/wms/controller/WmsProductPutController.java index 180d35cf..9527a2fc 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/controller/WmsProductPutController.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/controller/WmsProductPutController.java @@ -88,6 +88,17 @@ public class WmsProductPutController extends BaseController { public AjaxResult remove(@PathVariable String[] ids) { return toAjax(wmsProductPutService.deleteWmsProductPutByIds(ids)); } + /** + * 成品过账 + * + */ + @PostMapping("/WmsProductPutByWorkOrderConfirmSAPPosting") + public AjaxResult WmsProductPutByWorkOrderConfirmSAPPosting(@RequestBody List wmsProductPut){ + return AjaxResult.success(wmsProductPutService.WmsProductPutByWorkOrderConfirmSAPPosting(wmsProductPut)); + } + + + /** * 手持接口:根据报工单号查询 @@ -96,12 +107,5 @@ public class WmsProductPutController extends BaseController { public AjaxResult selectWmsProductPutByWorkOrder(@PathVariable("workOrder") String workOrder){ return AjaxResult.success(wmsProductPutService.selectWmsProductPutByWorkOrder(workOrder)); } - /** - * 手持接口:根据报工单号查询 - */ - @PostMapping("/s/WmsProductPutByWorkOrderquery") - public AjaxResult WmsProductPutByWorkOrderquery(@RequestBody WmsProductPut wmsProductPut){ - return AjaxResult.success(wmsProductPutService.WmsProductPutByWorkOrderquery(wmsProductPut)); - } } diff --git a/op-modules/op-wms/src/main/java/com/op/wms/controller/WmsToWCSmissionController.java b/op-modules/op-wms/src/main/java/com/op/wms/controller/WmsToWCSmissionController.java index 945a8050..06f196a3 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/controller/WmsToWCSmissionController.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/controller/WmsToWCSmissionController.java @@ -11,6 +11,7 @@ import com.op.common.log.enums.BusinessType; import com.op.wms.domain.*; import com.op.wms.service.IBaseWarehouseService; import com.op.wms.service.IOdsProcureOrderService; +import com.op.wms.service.IWmsProductPutService; import com.op.wms.service.IWmsToWCSmissionService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -22,7 +23,8 @@ import static com.op.common.core.web.domain.AjaxResult.success; @RestController @RequestMapping("/WmsToWCSmission") public class WmsToWCSmissionController { - + @Autowired + private IWmsProductPutService wmsProductPutService; @Autowired private IWmsToWCSmissionService iWmsToWCSmissionService; @Autowired @@ -95,8 +97,10 @@ public WmsToWCSDTO packingMaterialsOutBoundCompleted(@RequestBody WmsToWCSDTO wc @PostMapping("/PurchaseOrderdeliPda") public AjaxResult PurchaseOrderdeliPda(@RequestBody OdsProcureOrder odsProcureOrder) { - int tem =odsProcureOrderService.PurchaseOrderdeliPda(odsProcureOrder); - return success(tem); + odsProcureOrderService.PurchaseOrderdeliPdas(odsProcureOrder); + return success(); +// int tem =odsProcureOrderService.PurchaseOrderdeliPda(odsProcureOrder); +// return success(tem); } /** @@ -196,4 +200,23 @@ public WmsToWCSDTO packingMaterialsOutBoundCompleted(@RequestBody WmsToWCSDTO wc AjaxResult result= odsProcureOrderService.sapPurchaseOrderSync(odsProcureOrder); return result; } + + + + /** + * 成品 + * 手持接口:根据报工单号查询--新 + */ + @PostMapping("/WmsProductPutByWorkOrderquery") + public AjaxResult WmsProductPutByWorkOrderquery(@RequestBody WmsProductPut wmsProductPut){ + return AjaxResult.success(wmsProductPutService.WmsProductPutByWorkOrderquery(wmsProductPut)); + } + /** + * 成品 + * 手持接口:确认 + */ + @PostMapping("/WmsProductPutByWorkOrderConfirm") + public AjaxResult WmsProductPutByWorkOrderConfirm(@RequestBody WmsProductPut wmsProductPut){ + return AjaxResult.success(wmsProductPutService.WmsProductPutByWorkOrderConfirm(wmsProductPut)); + } } diff --git a/op-modules/op-wms/src/main/java/com/op/wms/domain/WmsProductPut.java b/op-modules/op-wms/src/main/java/com/op/wms/domain/WmsProductPut.java index 1d42825b..a7084322 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/domain/WmsProductPut.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/domain/WmsProductPut.java @@ -1,6 +1,9 @@ package com.op.wms.domain; +import java.math.BigDecimal; import java.util.Date; +import java.util.List; + import com.fasterxml.jackson.annotation.JsonFormat; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; @@ -9,7 +12,7 @@ import com.op.common.core.web.domain.BaseEntity; /** * 成品生产入库对象 wms_product_put - * + * * @author Open Platform * @date 2023-08-31 */ @@ -65,15 +68,26 @@ public class WmsProductPut extends BaseEntity { /** 计划入库数量 */ @Excel(name = "计划入库数量") - private Long planQuantity; + private BigDecimal planQuantity; /** 入库数量 */ @Excel(name = "入库数量") - private Long putQuantity; + private BigDecimal putQuantity; /** 入库状态 */ @Excel(name = "入库状态") private String status; + /** 箱数 */ + @Excel(name = "箱数") + private String number; + + public String getNumber() { + return number; + } + + public void setNumber(String number) { + this.number = number; + } /** 过账SAP状态 */ @Excel(name = "过账SAP状态") @@ -131,6 +145,24 @@ public class WmsProductPut extends BaseEntity { /** 预留字段10 */ @Excel(name = "预留字段10") private String attr10; + List wmsProductPut; + private String sn; + + public String getSn() { + return sn; + } + + public void setSn(String sn) { + this.sn = sn; + } + + public List getWmsProductPut() { + return wmsProductPut; + } + + public void setWmsProductPut(List wmsProductPut) { + this.wmsProductPut = wmsProductPut; + } public void setId(String id) { this.id = id; @@ -216,20 +248,23 @@ public class WmsProductPut extends BaseEntity { public String getUnitOfMeasure() { return unitOfMeasure; } - public void setPlanQuantity(Long planQuantity) { - this.planQuantity = planQuantity; - } - public Long getPlanQuantity() { + public BigDecimal getPlanQuantity() { return planQuantity; } - public void setPutQuantity(Long putQuantity) { - this.putQuantity = putQuantity; + + public void setPlanQuantity(BigDecimal planQuantity) { + this.planQuantity = planQuantity; } - public Long getPutQuantity() { + public BigDecimal getPutQuantity() { return putQuantity; } + + public void setPutQuantity(BigDecimal putQuantity) { + this.putQuantity = putQuantity; + } + public void setStatus(String status) { this.status = status; } @@ -265,14 +300,14 @@ public class WmsProductPut extends BaseEntity { public Date getPutDate() { return putDate; } - public void setBatchNumber(String batchNumber) { - this.batchNumber = batchNumber; - } public String getBatchNumber() { return batchNumber; } + public void setBatchNumber(String batchNumber) { + this.batchNumber = batchNumber; + } public String getProductDate() { return productDate; diff --git a/op-modules/op-wms/src/main/java/com/op/wms/mapper/WmsProductPutMapper.java b/op-modules/op-wms/src/main/java/com/op/wms/mapper/WmsProductPutMapper.java index 5ec18082..d57a1700 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/mapper/WmsProductPutMapper.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/mapper/WmsProductPutMapper.java @@ -64,5 +64,7 @@ public interface WmsProductPutMapper { */ public WmsProductPut selectWmsProductPutByWorkOrder(String workOrder); - WmsProductPut selectMesReportWork(WmsProductPut wmsProductPut); + public WmsProductPut selectMesReportWork(WmsProductPut wmsProductPut); + + public WmsProductPut selectWmsProductPutSAPById(String id); } diff --git a/op-modules/op-wms/src/main/java/com/op/wms/service/impl/WmsProductPutServiceImpl.java b/op-modules/op-wms/src/main/java/com/op/wms/service/impl/WmsProductPutServiceImpl.java index b3e31698..e3215c0e 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/service/impl/WmsProductPutServiceImpl.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/service/impl/WmsProductPutServiceImpl.java @@ -1,20 +1,22 @@ package com.op.wms.service.impl; -import java.util.List; +import java.math.BigDecimal; +import java.text.SimpleDateFormat; +import java.util.*; import java.util.concurrent.TimeUnit; import com.baomidou.dynamic.datasource.annotation.DS; import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder; +import com.op.common.core.domain.R; import com.op.common.core.utils.DateUtils; -import com.op.wms.domain.WmsProductPutTray; -import com.op.wms.domain.WmsProductPutTrayCode; -import com.op.wms.mapper.WmsProductPutTrayMapper; +import com.op.common.core.utils.uuid.IdUtils; +import com.op.system.api.RemoteSapService; +import com.op.wms.domain.*; +import com.op.wms.mapper.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.ValueOperations; import org.springframework.stereotype.Service; -import com.op.wms.mapper.WmsProductPutMapper; -import com.op.wms.domain.WmsProductPut; import com.op.wms.service.IWmsProductPutService; /** @@ -29,7 +31,14 @@ public class WmsProductPutServiceImpl implements IWmsProductPutService { private WmsProductPutMapper wmsProductPutMapper; @Autowired private RedisTemplate redisTemplate; - + @Autowired + private WmsProductPutRecordsMapper wmsProductPutRecordsMapper; + @Autowired + private WmsFpStorageNewsSnMapper wmsFpStorageNewsSnMapper; + @Autowired + private WmsFpStorageNewsMapper wmsFpStorageNewsMapper; + @Autowired + private RemoteSapService remoteSapService; /** * 查询成品生产入库 * @@ -131,4 +140,135 @@ public class WmsProductPutServiceImpl implements IWmsProductPutService { WmsProductPut wmsProductPut1= wmsProductPutMapper.selectMesReportWork(wmsProductPut); return wmsProductPut1; } + + /** + * 入库--wms_product_put_records入库记录表(记录每次入库的单子和入库数量) + * ,wms_fp_storage_news_sn明细表(入库明细-托盘,库位), + * wms_fp_storage_news(物料)库存主表 + * ,wms_product_put(记录单子)入库单 + *其中他这个要生成批次, + * @param wmsProductPut + * @return + */ + @Override + public String WmsProductPutByWorkOrderConfirm(WmsProductPut wmsProductPut) { + DynamicDataSourceContextHolder.push("ds_" +wmsProductPut.getFactoryCode()); + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss"); + Date date = new Date(); + String formattedDate = dateFormat.format(date);//批次 + List wmsProductPutList= wmsProductPut.getWmsProductPut(); + WmsProductPut wmsProductPutk=new WmsProductPut(); + //wms_product_put + wmsProductPutk.setId(IdUtils.fastSimpleUUID()); + wmsProductPutk.setWorkOrder(wmsProductPut.getWorkOrder()); + wmsProductPutk.setFactoryCode(wmsProductPut.getFactoryCode()); + wmsProductPutk.setWhCode(wmsProductPut.getWhCode());//仓库编码 + wmsProductPutk.setProductName(wmsProductPut.getProductName()); + wmsProductPutk.setProductCode(wmsProductPut.getProductCode()); + wmsProductPutk.setProductOrder(wmsProductPut.getProductOrder()); + wmsProductPutk.setPlanQuantity(wmsProductPut.getPlanQuantity()); + wmsProductPutk.setPutQuantity(wmsProductPut.getPutQuantity()); + wmsProductPutk.setStatus("1"); + wmsProductPutk.setSapStatus("0"); + wmsProductPutk.setBatchNumber(wmsProductPut.getBatchNumber());// + wmsProductPutk.setAttr3(formattedDate);// + wmsProductPutk.setCreateBy(wmsProductPut.getCreateBy()); + wmsProductPutk.setCreateTime(new Date()); + wmsProductPutk.setUnitOfMeasure(wmsProductPut.getUnitOfMeasure()); + wmsProductPutMapper.insertWmsProductPut(wmsProductPutk); + + String SUCCESS="操作成功"; + for (WmsProductPut wmsProductPut1: + wmsProductPutList) { + WmsProductPutRecords wmsProductPutRecords=new WmsProductPutRecords(); + wmsProductPutRecords.setWorkOrder(wmsProductPut.getWorkOrder()); + wmsProductPutRecords.setProductOrder(wmsProductPut.getProductOrder()); + wmsProductPutRecords.setProductName(wmsProductPut.getProductName()); + wmsProductPutRecords.setProductCode(wmsProductPut.getProductCode()); + wmsProductPutRecords.setWhCode(wmsProductPut.getWhCode());//仓库编码 + wmsProductPutRecords.setId(IdUtils.fastSimpleUUID()); + wmsProductPutRecords.setWlCode(wmsProductPut1.getWlCode()); + wmsProductPutRecords.setSn(wmsProductPut1.getSn()); + wmsProductPutRecords.setNumber(wmsProductPut1.getNumber()); + wmsProductPutRecords.setCreateBy(wmsProductPut.getCreateBy()); + wmsProductPutRecords.setCreateTime(new Date()); + wmsProductPutRecordsMapper.insertWmsProductPutRecords(wmsProductPutRecords); + //wms_fp_storage_news_sn + WmsFpStorageNewsSn wmsFpStorageNewsSn=new WmsFpStorageNewsSn(); + wmsFpStorageNewsSn.setStorageId(IdUtils.fastSimpleUUID()); + wmsFpStorageNewsSn.setFactoryCode(wmsProductPut.getFactoryCode()); + wmsFpStorageNewsSn.setWhCode(wmsProductPut.getWhCode());//仓库编码 + wmsFpStorageNewsSn.setWlCode(wmsProductPut1.getWlCode()); + wmsFpStorageNewsSn.setOrderNo(wmsProductPutk.getId()); + wmsFpStorageNewsSn.setProductCode(wmsProductPut.getProductCode()); + wmsFpStorageNewsSn.setProductName(wmsProductPut.getProductName()); + wmsFpStorageNewsSn.setSn(wmsProductPut1.getSn()); + wmsFpStorageNewsSn.setAmount(new BigDecimal(wmsProductPut1.getNumber())); + wmsFpStorageNewsSn.setBatchNumber(wmsProductPut.getBatchNumber()); + wmsFpStorageNewsSn.setUserDefined2(formattedDate); + wmsFpStorageNewsSn.setCreateBy(wmsProductPut.getCreateBy()); + wmsFpStorageNewsSn.setCreateTime(new Date()); + wmsFpStorageNewsSn.setActiveFlag("1"); + wmsFpStorageNewsSnMapper.insertWmsFpStorageNewsSn(wmsFpStorageNewsSn); +// wms_fp_storage_news + WmsFpStorageNews wmsFpStorageNews=new WmsFpStorageNews(); + + wmsFpStorageNews.setWhCode(wmsProductPut.getWhCode());//仓库编码 + wmsFpStorageNews.setWlCode(wmsProductPut1.getWlCode()); + wmsFpStorageNews.setStorageType("成品"); + wmsFpStorageNews.setProductCode(wmsProductPut.getProductCode()); + wmsFpStorageNews.setProductName(wmsProductPut.getProductName()); + wmsFpStorageNews.setFactoryCode(wmsProductPut.getFactoryCode()); + wmsFpStorageNews.setActiveFlag("1"); + wmsFpStorageNews.setUserDefined1(wmsProductPut.getUnitOfMeasure()); + List wmsFpStorageNewsList= wmsFpStorageNewsMapper.selectWmsFpStorageNewsList(wmsFpStorageNews); + wmsFpStorageNews.setStorageId(IdUtils.fastSimpleUUID()); + wmsFpStorageNews.setAmount(new BigDecimal(wmsProductPut1.getNumber())); + wmsFpStorageNews.setCreateBy(wmsProductPut.getCreateBy()); + wmsFpStorageNews.setCreateTime(new Date()); + if (wmsFpStorageNewsList.size()>0){ + WmsFpStorageNews wmsFpStorageNews1= wmsFpStorageNewsList.get(0); + BigDecimal amount= wmsFpStorageNews1.getAmount(); + BigDecimal amountAdd= amount.add(wmsFpStorageNews.getAmount()); + wmsFpStorageNews1.setAmount(amountAdd); + wmsFpStorageNewsMapper.updateWmsFpStorageNews(wmsFpStorageNews1); + }else { + wmsFpStorageNewsMapper.insertWmsFpStorageNews(wmsFpStorageNews); + } + } + return SUCCESS; + } + + @Override + @DS("#header.poolName") + public String WmsProductPutByWorkOrderConfirmSAPPosting(List wmsProductPut) { + String msgs="操作完成"; + for (WmsProductPut wmsProductPut1: + wmsProductPut) { + WmsProductPut wmsProductPut2= wmsProductPutMapper.selectWmsProductPutSAPById(wmsProductPut1.getId()); + List> mapList = new ArrayList<>(); + Map map = new HashMap<>(); + map.put("AUFNR",wmsProductPut2.getProductOrder()); + map.put("WERKS",wmsProductPut2.getFactoryCode()); + map.put("LGORT",wmsProductPut2.getWhCode()); + map.put("QUANTITY",wmsProductPut2.getPutQuantity()); + map.put("ERFME",wmsProductPut2.getUnitOfMeasure()); + map.put("BATCH",wmsProductPut2.getAttr3()); + map.put("HSDAT",wmsProductPut2.getProductDate()); + mapList.add(map); + R result= remoteSapService.sapOrderReceipt(mapList); + int code= result.getCode(); + String msg= result.getMsg(); + wmsProductPut2.setSapMessage(msg); + if (code==200) {//过账成功 + String date= (String) result.getData(); + wmsProductPut2.setSapProof(date); + wmsProductPut2.setSapStatus("1"); + }else { + wmsProductPut2.setSapStatus("2"); + } + wmsProductPutMapper.updateWmsProductPut(wmsProductPut2); + } + return msgs; + } } diff --git a/op-modules/op-wms/src/main/resources/mapper/wms/WmsProductPutMapper.xml b/op-modules/op-wms/src/main/resources/mapper/wms/WmsProductPutMapper.xml index 5ea7ec9b..9b08c208 100644 --- a/op-modules/op-wms/src/main/resources/mapper/wms/WmsProductPutMapper.xml +++ b/op-modules/op-wms/src/main/resources/mapper/wms/WmsProductPutMapper.xml @@ -7,6 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -152,8 +153,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{sapProof}, #{sapMessage}, #{putDate}, - #{batch_number}, - #{product_date}, + #{batchNumber}, + #{productDate}, #{attr3}, #{attr4}, #{attr5}, @@ -220,17 +221,71 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" +