diff --git a/op-modules/op-device/src/main/java/com/op/device/domain/MesReportWork.java b/op-modules/op-device/src/main/java/com/op/device/domain/MesReportWork.java index fabd9e6b..b8433691 100644 --- a/op-modules/op-device/src/main/java/com/op/device/domain/MesReportWork.java +++ b/op-modules/op-device/src/main/java/com/op/device/domain/MesReportWork.java @@ -48,6 +48,24 @@ public class MesReportWork extends BaseEntity { /** 单位 */ @Excel(name = "单位") private String unit; + private String SAPstatus; + private String SAPmessage; + + public String getSAPstatus() { + return SAPstatus; + } + + public void setSAPstatus(String SAPstatus) { + this.SAPstatus = SAPstatus; + } + + public String getSAPmessage() { + return SAPmessage; + } + + public void setSAPmessage(String SAPmessage) { + this.SAPmessage = SAPmessage; + } /** 排产数量 */ @Excel(name = "排产数量") @@ -166,6 +184,15 @@ public class MesReportWork extends BaseEntity { private String feedbackTimeEnd; private String batch; private String endReport; + private String whCode; + + public String getWhCode() { + return whCode; + } + + public void setWhCode(String whCode) { + this.whCode = whCode; + } public String getEndReport() { return endReport; diff --git a/op-modules/op-mes/src/main/java/com/op/mes/controller/MesReportWorkController.java b/op-modules/op-mes/src/main/java/com/op/mes/controller/MesReportWorkController.java index d70885d4..3fe7cd91 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/controller/MesReportWorkController.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/controller/MesReportWorkController.java @@ -409,6 +409,8 @@ public class MesReportWorkController extends BaseController { e.printStackTrace(); } } + /**获取母子报工记录**/ + } diff --git a/op-modules/op-wms/src/main/java/com/op/wms/controller/OdsProcureOrderController.java b/op-modules/op-wms/src/main/java/com/op/wms/controller/OdsProcureOrderController.java index 58d83e6b..2ebb32e7 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/controller/OdsProcureOrderController.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/controller/OdsProcureOrderController.java @@ -291,4 +291,10 @@ public class OdsProcureOrderController extends BaseController { odsProcureOrderService.OutboundPostingSAP(orderList); return success(); } + @PostMapping("/listCKT") + public AjaxResult listCKT( BaseWarehouse baseWarehouse) { + + List list = baseWarehouseService.selectBaseWarehouseListTWO(baseWarehouse); + return success(list); + } } 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 9527a2fc..73ee365d 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 @@ -2,13 +2,17 @@ package com.op.wms.controller; import java.util.List; import javax.servlet.http.HttpServletResponse; + +import com.op.device.domain.MesReportWork; + +import com.op.wms.domain.WmsProductPut; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.web.bind.annotation.*; import com.op.common.log.annotation.Log; import com.op.common.log.enums.BusinessType; import com.op.common.security.annotation.RequiresPermissions; -import com.op.wms.domain.WmsProductPut; + import com.op.wms.service.IWmsProductPutService; import com.op.common.core.web.controller.BaseController; import com.op.common.core.web.domain.AjaxResult; @@ -107,5 +111,23 @@ public class WmsProductPutController extends BaseController { public AjaxResult selectWmsProductPutByWorkOrder(@PathVariable("workOrder") String workOrder){ return AjaxResult.success(wmsProductPutService.selectWmsProductPutByWorkOrder(workOrder)); } + /** + * 成品 + * 手持接口:根据报工单号查询--新 + */ + @PostMapping("/WmsProductPutByWorkOrderqueryPC") + public AjaxResult WmsProductPutByWorkOrderqueryPC(@RequestBody WmsProductPut wmsProductPut){ + return AjaxResult.success(wmsProductPutService.WmsProductPutByWorkOrderqueryPC(wmsProductPut)); + } + @GetMapping("/getReportListSap") + public List getReportListSap(MesReportWork mesReportWork) { + List rlist = wmsProductPutService.getReportList(mesReportWork); + return rlist; + } + @PostMapping("/addReportListSap") + public AjaxResult addReportListSap(@RequestBody List mesReportWork) { + String rlist = wmsProductPutService.addReportListSap(mesReportWork); + return AjaxResult.success(rlist); + } } 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 d57a1700..f559ecde 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 @@ -2,7 +2,10 @@ package com.op.wms.mapper; import java.util.List; + +import com.op.device.domain.MesReportWork; import com.op.wms.domain.WmsProductPut; +import org.apache.ibatis.annotations.Param; /** * 成品生产入库Mapper接口 @@ -67,4 +70,10 @@ public interface WmsProductPutMapper { public WmsProductPut selectMesReportWork(WmsProductPut wmsProductPut); public WmsProductPut selectWmsProductPutSAPById(String id); + + List getReportList(MesReportWork mesReportWork); + + List selectWmsProductPutSAPByProDuct(String productOrder); + + void updateWmsProductPutByIds(@Param("wmsProductPut") WmsProductPut wmsProductPut4,@Param("list") List wmsProductPut2); } diff --git a/op-modules/op-wms/src/main/java/com/op/wms/service/IWmsProductPutService.java b/op-modules/op-wms/src/main/java/com/op/wms/service/IWmsProductPutService.java index 3d8152ab..1656ebe1 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/service/IWmsProductPutService.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/service/IWmsProductPutService.java @@ -1,6 +1,8 @@ package com.op.wms.service; import java.util.List; + +import com.op.device.domain.MesReportWork; import com.op.wms.domain.WmsProductPut; /** @@ -68,4 +70,10 @@ public interface IWmsProductPutService { String WmsProductPutByWorkOrderConfirm(WmsProductPut wmsProductPut); String WmsProductPutByWorkOrderConfirmSAPPosting(List wmsProductPut); + + public WmsProductPut WmsProductPutByWorkOrderqueryPC(WmsProductPut wmsProductPut); + + List getReportList(MesReportWork mesReportWork); + + String addReportListSap(List mesReportWork); } 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 e3215c0e..9ef2e853 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 @@ -10,6 +10,7 @@ import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder; import com.op.common.core.domain.R; import com.op.common.core.utils.DateUtils; import com.op.common.core.utils.uuid.IdUtils; +import com.op.device.domain.MesReportWork; import com.op.system.api.RemoteSapService; import com.op.wms.domain.*; import com.op.wms.mapper.*; @@ -245,30 +246,161 @@ public class WmsProductPutServiceImpl implements IWmsProductPutService { String msgs="操作完成"; for (WmsProductPut wmsProductPut1: wmsProductPut) { - WmsProductPut wmsProductPut2= wmsProductPutMapper.selectWmsProductPutSAPById(wmsProductPut1.getId()); - List> mapList = new ArrayList<>(); + WmsProductPut wmsProductPutSAPById= wmsProductPutMapper.selectWmsProductPutSAPById(wmsProductPut1.getId()); + if (wmsProductPutSAPById!=null){ + List wmsProductPut2= wmsProductPutMapper.selectWmsProductPutSAPByProDuct(wmsProductPutSAPById.getProductOrder()); + if (wmsProductPut2.size()>0){ + List> mapList = new ArrayList<>(); + Map map = new HashMap<>(); + for (WmsProductPut wmsProductPut3: + wmsProductPut2) { + map.put("AUFNR",wmsProductPut3.getProductOrder()); + map.put("WERKS",wmsProductPut3.getFactoryCode()); + map.put("LGORT",wmsProductPut3.getWhCode()); + map.put("QUANTITY",wmsProductPut3.getPutQuantity()); + map.put("ERFME",wmsProductPut3.getUnitOfMeasure()); + map.put("BATCH",wmsProductPut3.getBatchNumber()); + map.put("HSDAT",wmsProductPut3.getProductDate()); + mapList.add(map); + } + R result= remoteSapService.sapOrderReceipt(mapList); + + int code= result.getCode(); + String msg= result.getMsg(); + WmsProductPut wmsProductPut4=new WmsProductPut(); + wmsProductPut4.setSapMessage(msg); + if (code==200) {//过账成功 + String date= (String) result.getData(); + wmsProductPut4.setSapProof(date); + wmsProductPut4.setSapStatus("1"); + + }else { + wmsProductPut4.setSapProof(""); + wmsProductPut4.setSapStatus("2"); + } + wmsProductPutMapper.updateWmsProductPutByIds(wmsProductPut4,wmsProductPut2); + } + } + } + return msgs; + } + + @Override + public WmsProductPut WmsProductPutByWorkOrderqueryPC(WmsProductPut wmsProductPut) { + DynamicDataSourceContextHolder.push("ds_" +wmsProductPut.getFactoryCode()); + WmsProductPut wmsProductPut1= wmsProductPutMapper.selectMesReportWork(wmsProductPut); + return wmsProductPut1; + } + + @Override + @DS("#header.poolName") + public List getReportList(MesReportWork mesReportWork) { + List rlist = wmsProductPutMapper.getReportList(mesReportWork);; + return rlist; + } + + @Override + @DS("#header.poolName") + public String addReportListSap(List mesReportWorks) { + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss"); + Date date = new Date(); + String formattedDate = dateFormat.format(date);//批次 + //List wmsProductPutList= new ArrayList<>(); + for (MesReportWork mesReportWork: + mesReportWorks) { + WmsProductPut wmsProductPutk=new WmsProductPut(); + //wms_product_put + mesReportWork.setId(IdUtils.fastSimpleUUID()); + wmsProductPutk.setId(mesReportWork.getId()); + wmsProductPutk.setWorkOrder(mesReportWork.getReportCode()); + wmsProductPutk.setFactoryCode(mesReportWork.getFactoryCode()); + wmsProductPutk.setWhCode(mesReportWork.getWhCode());//仓库编码 + wmsProductPutk.setProductName(mesReportWork.getProductName()); + wmsProductPutk.setProductCode(mesReportWork.getProductCode()); + wmsProductPutk.setProductOrder(mesReportWork.getWorkorderCodeSap()); + wmsProductPutk.setPlanQuantity(mesReportWork.getQuantityFeedback()); + wmsProductPutk.setPutQuantity(mesReportWork.getQuantityQualified()); + wmsProductPutk.setStatus("1"); + wmsProductPutk.setSapStatus("0"); + wmsProductPutk.setBatchNumber(mesReportWork.getBatch());// + wmsProductPutk.setAttr3(formattedDate);// + wmsProductPutk.setCreateBy(mesReportWork.getCreateBy()); + wmsProductPutk.setCreateTime(new Date()); + wmsProductPutk.setUnitOfMeasure(mesReportWork.getUnit()); + wmsProductPutk.setProductDate(mesReportWork.getProductDate()); + wmsProductPutMapper.insertWmsProductPut(wmsProductPutk); + //入库记录 + WmsProductPutRecords wmsProductPutRecords=new WmsProductPutRecords(); + wmsProductPutRecords.setWorkOrder(mesReportWork.getReportCode()); + wmsProductPutRecords.setProductOrder(mesReportWork.getWorkorderCodeSap()); + wmsProductPutRecords.setProductName(mesReportWork.getProductName()); + wmsProductPutRecords.setProductCode(mesReportWork.getProductCode()); + wmsProductPutRecords.setWhCode(mesReportWork.getWhCode());//仓库编码 + wmsProductPutRecords.setId(IdUtils.fastSimpleUUID()); + wmsProductPutRecords.setNumber(mesReportWork.getQuantityQualified().toString()); + wmsProductPutRecords.setCreateBy(mesReportWork.getCreateBy()); + wmsProductPutRecords.setCreateTime(new Date()); + wmsProductPutRecordsMapper.insertWmsProductPutRecords(wmsProductPutRecords); + + + WmsFpStorageNews wmsFpStorageNews=new WmsFpStorageNews(); + + wmsFpStorageNews.setWhCode(mesReportWork.getWhCode());//仓库编码 + // wmsFpStorageNews.setWlCode(mesReportWork.getWlCode()); + wmsFpStorageNews.setStorageType("成品"); + wmsFpStorageNews.setProductCode(mesReportWork.getProductCode()); + wmsFpStorageNews.setProductName(mesReportWork.getProductName()); + wmsFpStorageNews.setFactoryCode(mesReportWork.getFactoryCode()); + wmsFpStorageNews.setActiveFlag("1"); + wmsFpStorageNews.setUserDefined1(mesReportWork.getUnit()); + List wmsFpStorageNewsList= wmsFpStorageNewsMapper.selectWmsFpStorageNewsList(wmsFpStorageNews); + wmsFpStorageNews.setStorageId(IdUtils.fastSimpleUUID()); + wmsFpStorageNews.setAmount(mesReportWork.getQuantityQualified()); + wmsFpStorageNews.setCreateBy(mesReportWork.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); + } + } + List> mapList = new ArrayList<>(); + for (MesReportWork mesReportWork: + mesReportWorks) { 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()); + map.put("AUFNR",mesReportWork.getWorkorderCodeSap()); + map.put("WERKS",mesReportWork.getFactoryCode()); + map.put("LGORT",mesReportWork.getWhCode()); + map.put("QUANTITY",mesReportWork.getQuantityQualified()); + map.put("ERFME",mesReportWork.getUnit()); + map.put("BATCH",mesReportWork.getBatch()); + map.put("HSDAT",mesReportWork.getProductDate()); mapList.add(map); - R result= remoteSapService.sapOrderReceipt(mapList); - int code= result.getCode(); - String msg= result.getMsg(); - wmsProductPut2.setSapMessage(msg); + } + //过账 + R result=remoteSapService.sapOrderReceipt(mapList); + int code= result.getCode(); + String msg= result.getMsg(); + for (MesReportWork mesReportWork: + mesReportWorks) { + WmsProductPut wmsProductPut2=new WmsProductPut(); + wmsProductPut2.setId(mesReportWork.getId()); + wmsProductPut2.setSapMessage(msg); if (code==200) {//过账成功 - String date= (String) result.getData(); - wmsProductPut2.setSapProof(date); + String tem= (String) result.getData(); + wmsProductPut2.setSapProof(tem); wmsProductPut2.setSapStatus("1"); }else { wmsProductPut2.setSapStatus("2"); } wmsProductPutMapper.updateWmsProductPut(wmsProductPut2); } - return msgs; + String SUCCESS="操作完成"; + return SUCCESS; } + } 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 a5e86342..f91b81b3 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 @@ -222,7 +222,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + + update wms_product_put + set + SAP_status = #{wmsProductPut.sapStatus}, + SAP_proof = #{wmsProductPut.sapProof}, + SAP_message = #{wmsProductPut.sapMessage} + where + id in + + #{item.id} + +