From da3070daffbbe2ac420b2a4077c890dbf65d2557 Mon Sep 17 00:00:00 2001 From: 18516761980 <tqsxp@163.com> Date: 星期四, 09 三月 2023 16:54:45 +0800 Subject: [PATCH] # --- src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java | 128 ++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 128 insertions(+), 0 deletions(-) diff --git a/src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java index a05d92b..6a7aeae 100644 --- a/src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java +++ b/src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java @@ -1,6 +1,7 @@ package com.zy.asrs.service.impl; import com.baomidou.mybatisplus.mapper.EntityWrapper; +import com.core.common.BaseRes; import com.core.common.Cools; import com.core.common.DateUtils; import com.core.common.SnowflakeIdWorker; @@ -9,8 +10,11 @@ import com.zy.asrs.entity.param.*; import com.zy.asrs.entity.result.OpenOrderCompeteResult; import com.zy.asrs.entity.result.StockVo; +import com.zy.asrs.mapper.ReportQueryMapper; import com.zy.asrs.mapper.TagMapper; import com.zy.asrs.service.*; +import com.zy.asrs.task.core.ReturnT; +import com.zy.asrs.task.handler.WorkLogHandler; import com.zy.asrs.utils.MatUtils; import com.zy.common.model.DetlDto; import com.zy.common.utils.ListUtils; @@ -49,6 +53,12 @@ private TagMapper tagMapper; @Autowired private ApiLogService apiLogService; + @Autowired + private WaitPakinService waitPakinService; + @Autowired + private WrkDetlService wrkDetlService; + @Autowired + private ReportQueryMapper reportQueryMapper; @Override @Transactional @@ -485,4 +495,122 @@ response, bool); } + + @Override + @Transactional + public void combMes(CombParam param) { + Long userId=9999l; + if (Cools.isEmpty(param.getBarcode(), param.getCombMats())) { + callApiLogSaveMES(null, null, BaseRes.PARAM, false); + throw new CoolException(BaseRes.PARAM); + } + if(param.getBarcode().length()!=8){ + callApiLogSaveMES(param, null, param.getBarcode() + "锛氭潯鐮侀暱搴︿笉鏄�8浣�", false); + throw new CoolException("鏉$爜闀垮害涓嶆槸8浣�===>>" + param.getBarcode()); + } + // 鍒ゆ柇鏄惁鏈夌浉鍚屾潯鐮佺殑鏁版嵁 + if (waitPakinService.selectCount(new EntityWrapper<WaitPakin>(). + eq("zpallet", param.getBarcode()).eq("io_status", "N")) > 0) { + callApiLogSaveMES(param, null, param.getBarcode() + "鏁版嵁姝e湪杩涜鍏ュ簱", false); + throw new CoolException(param.getBarcode() + "鏁版嵁姝e湪杩涜鍏ュ簱"); + } + + int countLoc = locDetlService.selectCount(new EntityWrapper<LocDetl>().eq("zpallet",param.getBarcode())); + int countWrk = wrkDetlService.selectCount(new EntityWrapper<WrkDetl>().eq("zpallet",param.getBarcode())); + if (countLoc > 0) { + callApiLogSaveMES(param, null, param.getBarcode() + "锛氬簱瀛樻潯鐮佹暟鎹凡瀛樺湪", false); + throw new CoolException("搴撳瓨鏉$爜鏁版嵁宸插瓨鍦�===>>" + param.getBarcode()); + }else if (countWrk > 0){ + callApiLogSaveMES(param, null, param.getBarcode() + "锛氬伐浣滄槑缁嗘。宸插瓨鍦ㄦ鏁版嵁", false); + throw new CoolException("宸ヤ綔鏄庣粏妗e凡瀛樺湪姝ゆ暟鎹�===>>" + param.getBarcode()); + } + + Date now = new Date(); + try{ + // 鐢熸垚鍏ュ簱閫氱煡妗� + List<DetlDto> detlDtos = new ArrayList<>(); + param.getCombMats().forEach(elem -> { + DetlDto detlDto = new DetlDto(elem.getMatnr(), elem.getBatch(), elem.getAnfme()); + if (DetlDto.has(detlDtos, detlDto)) { + DetlDto one = DetlDto.find(detlDtos, detlDto.getMatnr(), detlDto.getBatch()); + assert one != null; + one.setAnfme(one.getAnfme() + detlDto.getAnfme()); + } else { + detlDtos.add(detlDto); + } + }); + + for (DetlDto detlDto : detlDtos) { + Mat mat = matService.selectByMatnr(detlDto.getMatnr()); + if (Cools.isEmpty(mat)) { + callApiLogSaveMES(param, null,mat.getMatnr()+"鍟嗗搧妗f涓嶅瓨鍦�", false); + throw new CoolException(detlDto.getMatnr() + "鍟嗗搧妗f涓嶅瓨鍦�"); + } + WaitPakin waitPakin = new WaitPakin(); + waitPakin.sync(mat); + waitPakin.setBatch(detlDto.getBatch()); + waitPakin.setZpallet(param.getBarcode()); // 鎵樼洏鐮� + waitPakin.setIoStatus("N"); // 鍏ュ嚭鐘舵�� + waitPakin.setAnfme(detlDto.getAnfme()); // 鏁伴噺 + waitPakin.setStatus("Y"); // 鐘舵�� + waitPakin.setAppeUser(userId); + waitPakin.setAppeTime(now); + waitPakin.setModiUser(userId); + waitPakin.setModiTime(now); + if (!waitPakinService.insert(waitPakin)) { + callApiLogSaveMES(param, null,mat.getMatnr()+"淇濆瓨鍏ュ簱閫氱煡妗eけ璐�", false); + throw new CoolException("淇濆瓨鍏ュ簱閫氱煡妗eけ璐�"); + } + } + }catch (Exception e){ + callApiLogSaveMES(null, null,""+e, false); + } + callApiLogSaveMES(param, param.getCombMats().get(0),"缁勬墭鎴愬姛", true); + } + public void callApiLogSaveMES(CombParam combParam,CombParam.CombMat combMat, String response, Boolean bool) { + if (Cools.isEmpty(combParam)){ + apiLogService.save("MES涓嬪彂鍏ュ簱閫氱煡鍗�", "/open/asrs/comb/v1", "null", "10.10.10.1", + "", + response, bool); + }else if (Cools.isEmpty(combMat)){ + apiLogService.save("MES涓嬪彂鍏ュ簱閫氱煡鍗�", "/open/asrs/comb/v1", "null", "10.10.10.1", + "鎵樼洏鐮侊細" + combParam.getBarcode(), + response, bool); + }else { + apiLogService.save("MES涓嬪彂鍏ュ簱閫氱煡鍗�", "/open/asrs/comb/v1", "null", "10.10.10.1", + "鎵樼洏鐮侊細" + combParam.getBarcode() + "銆佺墿鏂欑紪鍙凤細" + combMat.getMatnr() + "銆佹暟閲忥細" + combMat.getAnfme(), + response, bool); + } + } + + /** + * 鍏ュ簱璁板綍鑾峰彇 + */ + @Override + @Transactional + public List<ViewWorkInBean> inlogERP() { + List<ViewWorkInBean> viewWorkInERP = reportQueryMapper.getViewWorkInERP(); + ArrayList<ViewWorkInBean> viewWorkInBeans = new ArrayList<>(); + for (ViewWorkInBean viewWorkInBean:viewWorkInERP){ + viewWorkInBean.sype(); + viewWorkInBeans.add(viewWorkInBean); + } + return viewWorkInBeans; + } + + /** + * 鍑哄簱璁板綍鑾峰彇 + */ + @Override + @Transactional + public List<ViewWorkInBean> outlogERP() { + List<ViewWorkInBean> viewWorkInERP = reportQueryMapper.getViewWorkOutERP(); + ArrayList<ViewWorkInBean> viewWorkInBeans = new ArrayList<>(); + for (ViewWorkInBean viewWorkInBean:viewWorkInERP){ + viewWorkInBean.sype(); + viewWorkInBeans.add(viewWorkInBean); + } + return viewWorkInBeans; + } + } -- Gitblit v1.9.1