| | |
| | | import com.core.common.SpringUtils; |
| | | import com.zy.asrs.entity.LocDetl; |
| | | import com.zy.asrs.entity.LocMast; |
| | | import com.zy.asrs.entity.param.OrderOutLocBoxCsUtilParam; |
| | | import com.zy.asrs.entity.param.StockOutParam; |
| | | import com.zy.asrs.service.LocDetlService; |
| | | import com.zy.asrs.service.LocMastService; |
| | |
| | | import com.zy.common.properties.SlaveProperties; |
| | | import com.zy.system.entity.OperateLog; |
| | | import com.zy.system.service.OperateLogService; |
| | | import reactor.core.publisher.Mono; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | |
| | | } |
| | | |
| | | |
| | | public R setOrderOutBatch(List<String[]> OutLocBoxCs) { |
| | | public R setOrderOutBatch(List<OrderOutLocBoxCsUtilParam> OutLocBoxCs) { |
| | | int total = OutLocBoxCs.size(); |
| | | if (!Cools.isEmpty(OutLocBoxCs) && !OutLocBoxCs.isEmpty()) { |
| | | LocDetlService locDetlService = SpringUtils.getBean(LocDetlService.class); |
| | | LocMastService locMastService = SpringUtils.getBean(LocMastService.class); |
| | | SlaveProperties slaveProperties = SpringUtils.getBean(SlaveProperties.class); |
| | | WorkService workService = SpringUtils.getBean(WorkService.class); |
| | | List<LocDto> locDtos = new ArrayList<>(); |
| | | List<OrderOutLocBoxCsUtilParam> outLocBoxCList = new ArrayList<>(); |
| | | List<String> outLocBoxCNew = new ArrayList<>(); |
| | | List<String> outLocRollListOld = new ArrayList<>(); |
| | | List<String> outLocRollListNew = new ArrayList<>(); |
| | | for (OrderOutLocBoxCsUtilParam outLocBoxC : OutLocBoxCs) { |
| | | if (!outLocRollListOld.contains(outLocBoxC.getRoll())) { |
| | | outLocRollListOld.add(outLocBoxC.getRoll()); |
| | | } |
| | | } |
| | | for (OrderOutLocBoxCsUtilParam outLocBoxC : OutLocBoxCs) { |
| | | total--; |
| | | LocDetl locDetlSou = locDetlService.selectOne(new EntityWrapper<LocDetl>().eq("batch", outLocBoxC.getBoxNo()).eq("model",outLocBoxC.getRoll())); |
| | | if (Cools.isEmpty(locDetlSou)) { |
| | | sign = false; |
| | | errorMsgOrderLoc = errorMsgOrderLoc + "[===》" + "箱号:" + outLocBoxC.getBoxNo() + "卷号:" + outLocBoxC.getRoll() + " 未查询到数据!!!《===]"; |
| | | continue; |
| | | } |
| | | if (signDanger){ |
| | | if (!locDetlSou.getDanger$().equals(outLocBoxC.getDanger())) { |
| | | sign = false; |
| | | errorMsgOrderLoc = errorMsgOrderLoc + "[===》" + "箱号:" + outLocBoxC.getBoxNo() + "卷号:" + outLocBoxC.getRoll() + " ==》出库输入待判状态:" + outLocBoxC.getDanger() + "、库存状态:" + locDetlSou.getDanger$() + "。状态不匹配《===]"; |
| | | continue; |
| | | } |
| | | } |
| | | if (!outLocBoxCNew.contains(outLocBoxC.getBoxNo())) { |
| | | LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", locDetlSou.getLocNo())); |
| | | if (Cools.isEmpty(locMast)) { |
| | | sign = false; |
| | | errorMsgOrderLoc = errorMsgOrderLoc + "[===》" + "箱号:" + outLocBoxC.getBoxNo() + "卷号:" + outLocBoxC.getRoll() + " 所在库位不满足出库条件!!!未查询到此箱号所在库位" + "《===]"; |
| | | continue; |
| | | } |
| | | if (!locMast.getLocSts().equals("F")) { |
| | | sign = false; |
| | | errorMsgOrderLoc = errorMsgOrderLoc + "[===》" + "箱号:" + outLocBoxC.getBoxNo() + "卷号:" + outLocBoxC.getRoll() + " 所在库位不满足出库条件!!!库位状态不为F!!!库位状态:" + locMast.getLocSts$() + "《===]"; |
| | | continue; |
| | | } |
| | | |
| | | // 目标库位 ===>> 浅库位 |
| | | if (Utils.isShallowLoc(slaveProperties, locMast.getLocNo())) { |
| | | String shallowLoc = Utils.getDeepLoc(slaveProperties, locMast.getLocNo()); |
| | | LocMast locMast2 = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", shallowLoc)); |
| | | if (!Cools.isEmpty(locMast2)) { |
| | | if (locMast2.getLocSts().equals("P") || locMast2.getLocSts().equals("R")) { |
| | | errorMsgOrderLoc = errorMsgOrderLoc + "[===》" + "箱号:" + outLocBoxC.getBoxNo() + "卷号:" + outLocBoxC.getRoll() + " 所在库位满足出库条件!!!但是相邻库位在出库中!!!因此会夹杂在前边订单执行!!!" + "《===]"; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | if (sign && !outLocRollListNew.contains(outLocBoxC.getRoll())) { |
| | | List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>() |
| | | .eq("loc_no", locDetlSou.getLocNo()).eq("origin", locDetlSou.getOrigin())); |
| | | for (LocDetl locDetl : locDetls) { |
| | | if (!outLocRollListNew.contains(locDetl.getModel())){ |
| | | if (!outLocRollListOld.contains(locDetl.getModel())){ |
| | | total++; |
| | | OrderOutLocBoxCsUtilParam orderOutLocBoxCsUtilParam = new OrderOutLocBoxCsUtilParam(locDetl.getBatch(),locDetl.getModel(), outLocBoxC); |
| | | orderOutLocBoxCsUtilParam.setMemo("附带出库"); |
| | | orderOutLocBoxCsUtilParam.setDanger(locDetl.getDanger$()); |
| | | outLocBoxCList.add(orderOutLocBoxCsUtilParam); |
| | | outLocBoxCNew.add(outLocBoxC.getBoxNo()); |
| | | outLocRollListNew.add(outLocBoxC.getRoll()); |
| | | } else { |
| | | if (locDetlSou.getBatch().equals(locDetl.getBatch()) && locDetlSou.getModel().equals(locDetl.getModel())) { |
| | | total++; |
| | | outLocBoxCList.add(outLocBoxC); |
| | | outLocBoxCNew.add(outLocBoxC.getBoxNo()); |
| | | outLocRollListNew.add(outLocBoxC.getRoll()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | for (OrderOutLocBoxCsUtilParam outLocBoxC : outLocBoxCList) { |
| | | LocDetl locDetl = locDetlService.selectOne(new EntityWrapper<LocDetl>().eq("batch", outLocBoxC.getBoxNo()).eq("model", outLocBoxC.getRoll())); |
| | | if (Cools.isEmpty(locDetl)) { |
| | | total--; |
| | | continue; |
| | | } |
| | | |
| | | if (!Cools.isEmpty(Mono.just(outLocBoxC.getMemo()))) { |
| | | String memo = Cools.isEmpty(locDetl.getMemo()) ? "" : locDetl.getMemo() + ","; |
| | | locDetl.setMemo(memo + DateUtils.convert(new Date(), DateUtils.yyyyMMdd_C) + "备注:" + outLocBoxC.getMemo()); |
| | | } else if (Cools.isEmpty(locDetl.getMemo())) { |
| | | locDetl.setMemo(outLocBoxC.getMemo()); |
| | | } |
| | | LocDto locDto = new LocDto(locDetl); |
| | | locDtos.add(locDto); |
| | | } |
| | | |
| | | StockOutParam param = new StockOutParam(); |
| | | ArrayList<StockOutParam.LocDetl> locDetls = new ArrayList<>(); |
| | | List<LocDto> locDtosList = new ArrayList<>(); |
| | | List<String> batchList = new ArrayList<>(); |
| | | for (LocDto locDto : locDtos) { |
| | | if (!batchList.contains(locDto.getBatch())) { |
| | | batchList.add(locDto.getBatch()); |
| | | locDtosList.add(locDto); |
| | | } |
| | | } |
| | | for (LocDto locDto : locDtosList) { |
| | | StockOutParam.LocDetl locDetl = new StockOutParam.LocDetl(); |
| | | locDetl.setBrand(locDto.getBrand()); |
| | | locDetl.setLocNo(locDto.getLocNo()); |
| | | locDetl.setAnfme(locDto.getAnfme()); |
| | | locDetl.setMatnr(locDto.getMatnr()); |
| | | locDetl.setBatch(locDto.getBatch()); |
| | | locDetl.setModel(locDto.getModel()); |
| | | locDetl.setSpecs(locDto.getSpecs()); |
| | | locDetl.setZpallet(locDto.getZpallet()); |
| | | locDetl.setOrigin(locDto.getOrigin()); |
| | | locDetl.setWeight(locDto.getWeight()); |
| | | locDetl.setMemo(locDto.getMemo()); |
| | | locDetl.setDanger(locDto.getDanger()); |
| | | |
| | | locDetls.add(locDetl); |
| | | } |
| | | param.setLocDetls(locDetls); |
| | | param.setOrderNo(orderOneNo); |
| | | param.setCstmrName(cstmrName); |
| | | param.setOrderName(orderName); |
| | | param.setGroupGoodsNo(groupGoodsNo); |
| | | |
| | | if (sign && total > 0) { |
| | | workService.startupFullTakeStoreOrder(param, 9999L); |
| | | } |
| | | |
| | | try { |
| | | OperateLogService operateLogService = SpringUtils.getBean(OperateLogService.class); |
| | | // 记录操作日志 |
| | | OperateLog operateLog = new OperateLog(); |
| | | operateLog.setAction(action); |
| | | operateLog.setIp(ip); |
| | | operateLog.setUserId(9999L); |
| | | operateLog.setRequest("单号:" + orderOneNo + "、客户名:" + cstmrName); |
| | | operateLog.setResponse(errorMsgOrderLoc.equals("") ? "正常" : (sign && total > 0) ? "成功:" + errorMsgOrderLoc : "失败:" + errorMsgOrderLoc); |
| | | operateLogService.insert(operateLog); |
| | | } catch (Exception e) { |
| | | log.error("记录操作日志失败!" + e.getMessage()); |
| | | } |
| | | |
| | | } |
| | | |
| | | log.info("出库{}条箱号!", total); |
| | | |
| | | String requert = errorMsgOrderLoc.equals("") ? "正常" : (sign && total > 0) ? "成功:" + errorMsgOrderLoc : "失败:" + errorMsgOrderLoc; |
| | | if (sign && total > 0) { |
| | | return R.ok(requert.equals("正常")? "成功":requert); |
| | | } |
| | | return R.error(requert); |
| | | } |
| | | public R setOrderOutBatchCargoBookingNote(List<String[]> OutLocBoxCs) { |
| | | int total = OutLocBoxCs.size(); |
| | | if (!Cools.isEmpty(OutLocBoxCs) && !OutLocBoxCs.isEmpty()) { |
| | | LocDetlService locDetlService = SpringUtils.getBean(LocDetlService.class); |
| | |
| | | param.setGroupGoodsNo(groupGoodsNo); |
| | | |
| | | if (sign && total > 0) { |
| | | workService.startupFullTakeStoreOrder(param, 9999L); |
| | | workService.startupFullTakeStoreOrderPakout(param, 9999L); |
| | | } |
| | | |
| | | try { |