| | |
| | | import com.zy.common.utils.Synchro; |
| | | import com.zy.common.web.BaseController; |
| | | import com.zy.nc.entity.NccJcQilibcBarcodeflowWms; |
| | | import com.zy.nc.entity.NccXsckmxTkWms; |
| | | import com.zy.nc.service.NccJcQilibcBarcodeflowWmsService; |
| | | import com.zy.nc.service.NccXsckmxTkWmsService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | private ManLocDetlMapper manLocDetlMapper; |
| | | @Autowired |
| | | private WrkDetlLogService wrkDetlLogService; |
| | | @Autowired |
| | | private WrkMastLogService wrkMastLogService; |
| | | |
| | | @Autowired |
| | | private MatService matService; |
| | |
| | | |
| | | @Autowired |
| | | private OrderDetlPakinService orderDetlPakinService; |
| | | |
| | | @Autowired |
| | | private NccXsckmxTkWmsService nccXsckmxTkWmsService; |
| | | |
| | | @RequestMapping("/pda/WarehouseOut/v1") |
| | | @ManagerAuth(memo = "并板途中拣料-参考念初") |
| | |
| | | |
| | | @RequestMapping(value = "/mat/back") |
| | | @ManagerAuth |
| | | public R pdaSearchBack(@RequestParam String matnr) { |
| | | EntityWrapper<NccXsckmxTkWms> wrapper = new EntityWrapper<>(); |
| | | wrapper.like("VBATCHCODE", matnr); |
| | | List<NccXsckmxTkWms> nccXsckmxTkWmsList = nccXsckmxTkWmsService.selectList(wrapper); |
| | | if (nccXsckmxTkWmsList.isEmpty()) { |
| | | return R.error("未找到此条码"); |
| | | public R pdaSearchBack(@RequestParam String barcode) { |
| | | WrkMastLog wrkMastLog = wrkMastLogService.selectOne(new EntityWrapper<WrkMastLog>() |
| | | .eq("barcode", barcode) |
| | | .in("io_type", 101, 103, 107) |
| | | .orderBy("appe_time", false) |
| | | ); |
| | | |
| | | if(null == wrkMastLog) { |
| | | return R.error("未找到此托盘码出库记录"); |
| | | } |
| | | |
| | | List<String> orderNos = new ArrayList<>(); |
| | | List<HashMap<String, Object>> list = new ArrayList<>(); |
| | | for (NccXsckmxTkWms nccXsckmxTkWms : nccXsckmxTkWmsList) { |
| | | if (orderNos.contains(nccXsckmxTkWms.getVsourcebillcode())) { |
| | | continue; |
| | | } |
| | | orderNos.add(nccXsckmxTkWms.getVsourcebillcode()); |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | |
| | | Mat mat = matService.selectByMatnr(nccXsckmxTkWms.getWlbm()); |
| | | if (mat == null) { |
| | | continue; |
| | | } |
| | | MatParam matParam = new MatParam(); |
| | | Synchro.Copy(mat, matParam); |
| | | matParam.setBatch(nccXsckmxTkWms.getVbatchcode()); |
| | | matParam.setAnfme(0.0D); |
| | | matParam.setAnfme2(0.0D); |
| | | matParam.setTiaoma(matnr); |
| | | |
| | | map.put("orderNo", nccXsckmxTkWms.getVsourcebillcode()); |
| | | map.put("khmc", nccXsckmxTkWms.getKhmc()); |
| | | map.put("matData", matParam); |
| | | list.add(map); |
| | | List<WrkDetlLog> wrkDetlLogs = wrkDetlLogService.selectList(new EntityWrapper<WrkDetlLog>() |
| | | .eq("wrk_no", wrkMastLog.getWrkNo()) |
| | | .eq("zpallet", barcode) |
| | | .orderBy("io_time", false) |
| | | ); |
| | | if (wrkDetlLogs.isEmpty()) { |
| | | return R.error("未找到此托盘码出库记录明细"); |
| | | } |
| | | return R.ok().add(list); |
| | | |
| | | WrkDetlLog wrkDetlLog = wrkDetlLogs.get(0); |
| | | String batch = wrkDetlLog.getBatch(); |
| | | |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | Mat mat = matService.selectByMatnr(wrkDetlLog.getMatnr()); |
| | | if (mat == null) { |
| | | return R.error("未找到物料明细"); |
| | | } |
| | | MatParam matParam = new MatParam(); |
| | | Synchro.Copy(mat, matParam); |
| | | matParam.setBatch(batch); |
| | | matParam.setAnfme(0.0D); |
| | | matParam.setAnfme2(0.0D); |
| | | matParam.setTiaoma(batch); |
| | | |
| | | String[] split = wrkDetlLog.getOrderNo().split("-"); |
| | | map.put("orderNo", split[0]); |
| | | map.put("matData", matParam); |
| | | return R.ok().add(map); |
| | | } |
| | | |
| | | @RequestMapping("/comb/auth") |
| | |
| | | import com.core.common.R; |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.asrs.utils.MatUtils; |
| | | import com.zy.common.model.LocDto; |
| | | import com.zy.common.model.TaskDto; |
| | | import com.zy.common.web.BaseController; |
| | |
| | | locDto.setBoxType1(orderDetl.getBoxType1()); |
| | | locDto.setBoxType2(orderDetl.getBoxType2()); |
| | | locDto.setBoxType3(orderDetl.getBoxType3()); |
| | | locDto.setWeight(orderDetl.getWeight()); |
| | | |
| | | //计算辅单位 |
| | | Double weight = MatUtils.calcWeight(locDto.getMatnr(), locDto.getAnfme()); |
| | | locDto.setWeight(weight); |
| | | |
| | | locDto.setUnit(orderDetl.getUnit()); |
| | | |
| | | locDto.setStaNos(staNos); |
| | |
| | | locDto.setBoxType1(orderDetl.getBoxType1()); |
| | | locDto.setBoxType2(orderDetl.getBoxType2()); |
| | | locDto.setBoxType3(orderDetl.getBoxType3()); |
| | | locDto.setWeight(orderDetl.getWeight()); |
| | | |
| | | //计算辅单位 |
| | | Double weight = MatUtils.calcWeight(locDto.getMatnr(), locDto.getAnfme()); |
| | | locDto.setWeight(weight); |
| | | |
| | | locDto.setUnit(orderDetl.getUnit()); |
| | | locDto.setLack(Boolean.TRUE); |
| | | locDtos.add(locDto); |
| | |
| | | LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", locDetl.getLocNo())); |
| | | locDto.setFrozen(locDetl.getFrozen()); |
| | | locDto.setFrozenLoc(locMast.getFrozen()); |
| | | List<Integer> staNos = staDescService.queryOutStaNosByLocNo(locDetl.getLocNo(), issued >= locDetl.getAnfme() ? 101 : 103); |
| | | int ioType = (issued >= locDetl.getAnfme() && locDetlService.selectCount(new EntityWrapper<LocDetl>().eq("loc_no", locDto.getLocNo())) == 1) ? 101 : 103; |
| | | List<Integer> staNos = staDescService.queryOutStaNosByLocNo(locDetl.getLocNo(), ioType); |
| | | locDto.setStaNos(staNos); |
| | | locDto.setBrand(orderDetl.getBrand()); |
| | | |
| | |
| | | locDto.setBoxType1(orderDetl.getBoxType1()); |
| | | locDto.setBoxType2(orderDetl.getBoxType2()); |
| | | locDto.setBoxType3(orderDetl.getBoxType3()); |
| | | locDto.setWeight(orderDetl.getWeight()); |
| | | locDto.setUnit(orderDetl.getUnit()); |
| | | |
| | | //计算辅单位 |
| | | Double weight = MatUtils.calcWeight(locDto.getMatnr(), locDto.getAnfme()); |
| | | locDto.setWeight(weight); |
| | | |
| | | locDtos.add(locDto); |
| | | exist.add(locDetl.getLocNo()); |
| | | // 剩余待出数量递减 |
| | |
| | | locDto.setBoxType1(orderDetl.getBoxType1()); |
| | | locDto.setBoxType2(orderDetl.getBoxType2()); |
| | | locDto.setBoxType3(orderDetl.getBoxType3()); |
| | | locDto.setWeight(orderDetl.getWeight()); |
| | | |
| | | //计算辅单位 |
| | | Double weight = MatUtils.calcWeight(locDto.getMatnr(), locDto.getAnfme()); |
| | | locDto.setWeight(weight); |
| | | |
| | | locDto.setUnit(orderDetl.getUnit()); |
| | | locDto.setLack(Boolean.TRUE); |
| | | locDtos.add(locDto); |
| | |
| | | |
| | | void report(Order order, List<OrderDetl> orderDetls, DocType docType) throws Exception; |
| | | |
| | | boolean reportTkrk(String batch, String orderNo, Double anfme); |
| | | boolean reportTkrk(String matnr, String batch, String orderNo, Double anfme); |
| | | |
| | | } |
| | |
| | | import com.zy.asrs.mapper.LocDetlMapper; |
| | | import com.zy.asrs.service.LocDetlService; |
| | | import com.zy.asrs.service.MatService; |
| | | import com.zy.asrs.utils.MatUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | return false; |
| | | } |
| | | |
| | | //更新辅料 |
| | | Mat mat = matService.selectByMatnr(matnr); |
| | | if (mat == null) { |
| | | return false; |
| | | } |
| | | |
| | | //转换关系 |
| | | String origin = mat.getOrigin(); |
| | | if (Cools.isEmpty(origin)) { |
| | | return true; |
| | | } |
| | | String[] split = origin.split("/"); |
| | | //辅单位 |
| | | Double weight = (anfme / Double.parseDouble(split[1])) / Double.parseDouble(split[0]); |
| | | //计算辅单位 |
| | | Double weight = MatUtils.calcWeight(matnr, anfme); |
| | | return this.baseMapper.updateWeight(weight, locNo, matnr, batch, brand, standby1, standby2, standby3, boxType1, boxType2, boxType3) > 0; |
| | | } |
| | | } |
| | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.common.Cools; |
| | | import com.core.common.R; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.DocType; |
| | | import com.zy.asrs.entity.Order; |
| | |
| | | import com.zy.nc.entity.*; |
| | | import com.zy.nc.service.NccSaleXsfhmxWmsService; |
| | | import com.zy.nc.service.NccScPcdaWmsService; |
| | | import com.zy.nc.service.NccXsckmxTkWmsService; |
| | | import com.zy.nc.util.NcResultMessage; |
| | | import com.zy.nc.vo.*; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | |
| | | @Autowired |
| | | private NccScPcdaWmsService nccScPcdaWmsService; |
| | | |
| | | @Autowired |
| | | private NccXsckmxTkWmsService nccXsckmxTkWmsService; |
| | | |
| | | @Autowired |
| | | private NccSaleXsfhmxWmsService nccSaleXsfhmxWmsService; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public boolean reportTkrk(String batch, String orderNo, Double anfme) { |
| | | Object process1 = processTKRK(batch, orderNo, anfme); |
| | | public boolean reportTkrk(String matnr, String batch, String orderNo, Double anfme) { |
| | | Object process1 = processTKRK(matnr, batch, orderNo, anfme); |
| | | //发送请求 |
| | | NcResultMessage response = SendUtil.sendDataToNc(SendUtil.token, nyncIp + ":" + port, saveRefDelivery, JSONObject.toJSONString(process1)); |
| | | log.info("退库入库response:{}", response); |
| | |
| | | return data; |
| | | } |
| | | |
| | | private Object processTKRK(String batch, String orderNo, Double anfme) { |
| | | EntityWrapper<NccXsckmxTkWms> wrapper = new EntityWrapper<>(); |
| | | wrapper.eq("VBATCHCODE", batch).eq("VSOURCEBILLCODE", orderNo); |
| | | NccXsckmxTkWms nccXsckmxTkWms = nccXsckmxTkWmsService.selectOne(wrapper); |
| | | if (null == nccXsckmxTkWms) { |
| | | throw new CoolException("未找到此条码"); |
| | | } |
| | | private Object processTKRK(String matnr,String batch, String orderNo, Double anfme) { |
| | | // EntityWrapper<NccXsckmxTkWms> wrapper = new EntityWrapper<>(); |
| | | // wrapper.eq("VBATCHCODE", batch).eq("VSOURCEBILLCODE", orderNo); |
| | | // NccXsckmxTkWms nccXsckmxTkWms = nccXsckmxTkWmsService.selectOne(wrapper); |
| | | // if (null == nccXsckmxTkWms) { |
| | | // throw new CoolException("未找到此条码"); |
| | | // } |
| | | |
| | | NccSaleXsfhmxWms nccSaleXsfhmxWms = nccSaleXsfhmxWmsService.selectOne(new EntityWrapper<NccSaleXsfhmxWms>() |
| | | .eq("VBILLCODE", nccXsckmxTkWms.getVsourcebillcode()) |
| | | .eq("WLBM", nccXsckmxTkWms.getWlbm()) |
| | | .eq("VBILLCODE", orderNo) |
| | | .eq("WLBM", matnr) |
| | | ); |
| | | if(null == nccSaleXsfhmxWms) { |
| | | throw new CoolException("未找到销售单据"); |
| | |
| | | |
| | | saleOutBodyVO = new SaleOutBodyVO(); |
| | | saleOutBodyVO.setCsourcetype("4331"); |
| | | saleOutBodyVO.setCsourcebillbid(nccXsckmxTkWms.getCsourcebillbid()); |
| | | saleOutBodyVO.setCsourcebillhid(nccXsckmxTkWms.getCsourcebillhid()); |
| | | saleOutBodyVO.setCsourcebillbid(nccSaleXsfhmxWms.getCdeliverybid()); |
| | | saleOutBodyVO.setCsourcebillhid(nccSaleXsfhmxWms.getCdeliveryid()); |
| | | saleOutHeadVO.setCwarehouseid(nccSaleXsfhmxWms.getFhckbm()); |
| | | |
| | | saleOutBodyVO.setVbatchcode(nccXsckmxTkWms.getVbatchcode()); |
| | | saleOutBodyVO.setVbatchcode(batch); |
| | | saleOutBodyVO.setNnum(anfme * -1); |
| | | saleOutBodyVOList.add(saleOutBodyVO); |
| | | |
| | |
| | | import com.zy.asrs.mapper.WrkDetlMapper; |
| | | import com.zy.asrs.service.MatService; |
| | | import com.zy.asrs.service.WrkDetlService; |
| | | import com.zy.asrs.utils.MatUtils; |
| | | import com.zy.common.model.DetlDto; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | return false; |
| | | } |
| | | |
| | | //更新辅料 |
| | | Mat mat = matService.selectByMatnr(matnr); |
| | | if (mat == null) { |
| | | return false; |
| | | } |
| | | |
| | | //转换关系 |
| | | String origin = mat.getOrigin(); |
| | | if (Cools.isEmpty(origin)) { |
| | | return true; |
| | | } |
| | | String[] split = origin.split("/"); |
| | | //辅单位 |
| | | Double weight = (anfme / Double.parseDouble(split[1])) / Double.parseDouble(split[0]); |
| | | //计算辅单位 |
| | | Double weight = MatUtils.calcWeight(matnr, anfme); |
| | | return baseMapper.updateWeight(weight, wrkNo, matnr, batch) > 0; |
| | | } |
| | | } |
| | |
| | | if (!Cools.isEmpty(wrkMast.getBarcode())) { |
| | | WaitPakin waitPakin = waitPakinService.selectOne(new EntityWrapper<WaitPakin>().eq("zpallet", wrkMast.getBarcode())); |
| | | if (!Cools.isEmpty(waitPakin.getTkFlag())) { |
| | | boolean result = reportToThirdService.reportTkrk(waitPakin.getBatch(), waitPakin.getTkFlag(), waitPakin.getAnfme()); |
| | | boolean result = reportToThirdService.reportTkrk(waitPakin.getMatnr(), waitPakin.getBatch(), waitPakin.getTkFlag(), waitPakin.getAnfme()); |
| | | if (!result) { |
| | | exceptionHandle("退库入库上报ERP[workNo={0}]失败", wrkMast.getWrkNo()); |
| | | } |
| | |
| | | package com.zy.asrs.utils; |
| | | |
| | | import com.core.common.Cools; |
| | | import com.core.common.SpringUtils; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.Mat; |
| | | import com.zy.asrs.service.MatService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | /** |
| | |
| | | } |
| | | } |
| | | |
| | | public static Double calcWeight(String matnr, Double anfme) { |
| | | MatService matService = SpringUtils.getBean(MatService.class); |
| | | //更新辅料 |
| | | Mat mat = matService.selectByMatnr(matnr); |
| | | if (mat == null) { |
| | | throw new CoolException("物料信息不存在"); |
| | | } |
| | | |
| | | //转换关系 |
| | | String origin = mat.getOrigin(); |
| | | if (Cools.isEmpty(origin)) { |
| | | throw new CoolException("主辅数量转换公式不存在"); |
| | | } |
| | | String[] split = origin.split("/"); |
| | | //辅单位 |
| | | Double weight = (anfme / Double.parseDouble(split[1])) / Double.parseDouble(split[0]); |
| | | return weight; |
| | | } |
| | | |
| | | } |
| | |
| | | package com.zy.nc.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.zy.nc.entity.NccScPcdaWms; |
| | | import com.zy.nc.entity.NccXsckmxTkWms; |
| | | import com.zy.nc.mapper.NccScPcdaWmsMapper; |
| | | import com.zy.nc.mapper.NccXsckmxTkWmsMapper; |
| | | import com.zy.nc.service.NccScPcdaWmsService; |
| | | import com.zy.nc.service.NccXsckmxTkWmsService; |
| | | import org.springframework.stereotype.Service; |
| | | |