From e4d8eb6129a78decbca64da52a97127cf05408f4 Mon Sep 17 00:00:00 2001 From: luxiaotao1123 <t1341870251@163.com> Date: 星期一, 01 三月 2021 14:23:29 +0800 Subject: [PATCH] # --- src/main/java/zy/cloud/wms/common/service/erp/ErpScheduler.java | 15 ++----- src/main/resources/mapper/LocDetlMapper.xml | 4 ++ src/main/java/zy/cloud/wms/manager/mapper/LocDetlMapper.java | 1 src/main/java/zy/cloud/wms/manager/service/LocDetlService.java | 2 + src/main/java/zy/cloud/wms/manager/service/impl/LocDetlServiceImpl.java | 5 ++ src/main/java/zy/cloud/wms/common/service/MainService.java | 46 ++++++++++++++++++++++ 6 files changed, 61 insertions(+), 12 deletions(-) diff --git a/src/main/java/zy/cloud/wms/common/service/MainService.java b/src/main/java/zy/cloud/wms/common/service/MainService.java index 6d4b847..3cfd663 100644 --- a/src/main/java/zy/cloud/wms/common/service/MainService.java +++ b/src/main/java/zy/cloud/wms/common/service/MainService.java @@ -1,7 +1,21 @@ package zy.cloud.wms.common.service; +import com.baomidou.mybatisplus.mapper.EntityWrapper; +import com.core.common.Cools; +import com.core.exception.CoolException; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import zy.cloud.wms.common.service.erp.entity.GetDataResult; +import zy.cloud.wms.manager.entity.LocDetl; +import zy.cloud.wms.manager.entity.Mat; +import zy.cloud.wms.manager.entity.Prior; +import zy.cloud.wms.manager.service.LocDetlService; +import zy.cloud.wms.manager.service.MatService; +import zy.cloud.wms.manager.service.PakoutService; +import zy.cloud.wms.manager.service.PriorService; + +import java.util.List; /** * Created by vincent on 2021/3/1 @@ -9,10 +23,40 @@ @Service("mainService") public class MainService { + @Autowired + private MatService matService; + @Autowired + private LocDetlService locDetlService; + @Autowired + private PakoutService pakoutService; + @Autowired + private PriorService priorService; @Transactional - public void stockOutProcess() { + public void stockOutProcess(List<GetDataResult> list) { + if (Cools.isEmpty(list)) { + return; + } + for (GetDataResult data : list) { + // 鍒ゆ柇鐗╂枡鏄惁瀛樺湪 + Mat mat = matService.selectByMatnr(data.getUserCode()); + if (null == mat) { + throw new CoolException(data.getUserCode() + "鐗╂枡灏氭湭鏇存柊銆�" + data.getNumber() +"鍗曟嵁鍥犳涓柇锛�"); + } + // 鏍规嵁鎺ㄨ崘搴撲綅鏌ユ壘搴撳瓨 + List<Prior> priors = priorService.selectList(new EntityWrapper<Prior>().eq("matnr", mat.getMatnr()).orderBy("prio")); + if (!Cools.isEmpty(priors)) { + for (Prior prior : priors) { + LocDetl locDetl = locDetlService.getLocDetl(prior.getNodeId(), prior.getMatnr()); + if (null != locDetl) { + } + } + } + + + + } } diff --git a/src/main/java/zy/cloud/wms/common/service/erp/ErpScheduler.java b/src/main/java/zy/cloud/wms/common/service/erp/ErpScheduler.java index 918919a..64c8002 100644 --- a/src/main/java/zy/cloud/wms/common/service/erp/ErpScheduler.java +++ b/src/main/java/zy/cloud/wms/common/service/erp/ErpScheduler.java @@ -7,7 +7,6 @@ import org.springframework.stereotype.Component; import zy.cloud.wms.common.service.MainService; import zy.cloud.wms.common.service.erp.entity.GetDataResult; -import zy.cloud.wms.manager.entity.Mat; import zy.cloud.wms.manager.service.MatService; import zy.cloud.wms.manager.utils.HttpHandler; @@ -51,17 +50,11 @@ } else { log.info(response); Result result = JSON.parseObject(response, Result.class); - List<GetDataResult> datas = JSON.parseArray(result.getData(), GetDataResult.class); - if (!Cools.isEmpty(datas)) { - for (GetDataResult data : datas) { - // 鐢熸垚鍑哄簱鍗� - Mat mat = matService.selectByMatnr(data.getUserCode()); - mainService.stockOutProcess(); - - - } + List<GetDataResult> list = JSON.parseArray(result.getData(), GetDataResult.class); + if (!Cools.isEmpty(list)) { + // 鐢熸垚鍑哄簱鍗� + mainService.stockOutProcess(list); } - } } catch (IOException e) { e.printStackTrace(); diff --git a/src/main/java/zy/cloud/wms/manager/mapper/LocDetlMapper.java b/src/main/java/zy/cloud/wms/manager/mapper/LocDetlMapper.java index b02db5a..ff30237 100644 --- a/src/main/java/zy/cloud/wms/manager/mapper/LocDetlMapper.java +++ b/src/main/java/zy/cloud/wms/manager/mapper/LocDetlMapper.java @@ -15,4 +15,5 @@ List<LocDetl> listByPage(Page page, @Param("nodeId") String nodeId, @Param("locNo") Object locNo, @Param("matnr") Object matnr, @Param("maktx") Object maktx); + LocDetl selectByLocNoAndMatnr(@Param("nodeId")Long nodeId, @Param("matnr")String martnr); } diff --git a/src/main/java/zy/cloud/wms/manager/service/LocDetlService.java b/src/main/java/zy/cloud/wms/manager/service/LocDetlService.java index 4202ab1..deb5b13 100644 --- a/src/main/java/zy/cloud/wms/manager/service/LocDetlService.java +++ b/src/main/java/zy/cloud/wms/manager/service/LocDetlService.java @@ -8,4 +8,6 @@ Page<LocDetl> getPage(Page page, String nodeId, Object locNo, Object matnr, Object maktx); + LocDetl getLocDetl(Long nodeId, String matnr); + } diff --git a/src/main/java/zy/cloud/wms/manager/service/impl/LocDetlServiceImpl.java b/src/main/java/zy/cloud/wms/manager/service/impl/LocDetlServiceImpl.java index 65ffa9d..3c37193 100644 --- a/src/main/java/zy/cloud/wms/manager/service/impl/LocDetlServiceImpl.java +++ b/src/main/java/zy/cloud/wms/manager/service/impl/LocDetlServiceImpl.java @@ -15,5 +15,10 @@ return page.setRecords(baseMapper.listByPage(page, nodeId, locNo, matnr, maktx)); } + @Override + public LocDetl getLocDetl(Long nodeId, String matnr) { + return this.baseMapper.selectByLocNoAndMatnr(nodeId, matnr); + } + } diff --git a/src/main/resources/mapper/LocDetlMapper.xml b/src/main/resources/mapper/LocDetlMapper.xml index 176d5b2..8a39a3a 100644 --- a/src/main/resources/mapper/LocDetlMapper.xml +++ b/src/main/resources/mapper/LocDetlMapper.xml @@ -50,4 +50,8 @@ ORDER BY mld.create_time DESC </select> + <select id="selectByLocNoAndMatnr" resultMap="BaseResultMap"> + select * from man_loc_detl where 1=1 and node_id = #{nodeId} and matnr = #{matnr} + </select> + </mapper> -- Gitblit v1.9.1