Merge remote-tracking branch 'origin/jshdasrs' into jshdasrs
| | |
| | | // @ManagerAuth(memo = "组托") |
| | | public R combAutoWcs(@RequestBody CombParam combParam){ |
| | | // mobileService.comb(combParam, getUserId()); |
| | | mobileService.comb(combParam, 7777L); |
| | | mobileService.combAuto(combParam, 7777L); |
| | | return R.ok("组托成功"); |
| | | } |
| | | |
| | |
| | | if (Cools.isEmpty(param.getUpc())) { |
| | | return R.error("UPC[upc]不能为空"); |
| | | } |
| | | if (Cools.isEmpty(param.getSupplier())) { |
| | | return R.error("货源[supplier]不能为空"); |
| | | if (Cools.isEmpty(param.getItem())) { |
| | | return R.error("UPC[item]不能为空"); |
| | | } |
| | | // if (Cools.isEmpty(param.getSupplier())) { |
| | | // return R.error("货源[supplier]不能为空"); |
| | | // } |
| | | if (Cools.isEmpty(param.getStaNo())) { |
| | | return R.error("分拣点位[staNo]不能为空"); |
| | | } |
| | |
| | | |
| | | |
| | | /** |
| | | * 分拣线上报接收 |
| | | * AGV上报接收 |
| | | */ |
| | | @PostMapping("/agv/task/v1/agvCallback") |
| | | @AppAuth(memo = "AGV上报接收") |
| | |
| | | public BasArmMast(TaskArmReportParam param) { |
| | | this.orderNo = param.getOrderNo(); |
| | | this.sku = param.getSku(); |
| | | this.matnr = param.getSku(); |
| | | this.matnr = param.getItem(); |
| | | this.po = param.getPo(); |
| | | this.upc = param.getUpc(); |
| | | this.supplier = param.getSupplier(); |
| | |
| | | |
| | | // 规格 |
| | | private String specs = ""; |
| | | private String supp = "";//supp -> po |
| | | private String supp = ""; |
| | | |
| | | // sku |
| | | private String sku = ""; |
| | |
| | | private int total_num;//预期需要完成的数量 |
| | | private String staNo; |
| | | private String orderNo; |
| | | private String sku; |
| | | // private String sku; |
| | | private String matnr; |
| | | private Long bindingTags; |
| | | |
| | | public void OrderIdTwo(String sign_order,String sign_sku){ |
| | |
| | | staNo = split[1]; |
| | | String[] split1 = split[0].split(Pattern.quote(sign_sku)); |
| | | orderNo = split1[2]; |
| | | sku = split1[0]; |
| | | matnr = split1[0]; |
| | | bindingTags = Long.parseLong(split1[1]); |
| | | } |
| | | } |
| | |
| | | @Data |
| | | public static class MatList { |
| | | |
| | | // Sku\型号\分拣属性1\不可为空\扫码可获取 |
| | | private String item; |
| | | |
| | | // Sku\客人型号\分拣属性1\不可为空\扫码可获取 |
| | | private String sku; |
| | | |
| | |
| | | //0:不分拣,在线体循环 |
| | | private Integer sign; |
| | | |
| | | //货源\非分拣属性(不下发,数据在条码中,需上报) |
| | | private String supplier; |
| | | //货源\非分拣属性(不下发,数据在条码中,需上报) 废弃 |
| | | // private String supplier; |
| | | |
| | | //绑定标记(标识相同必须去同一个分拣口) |
| | | private Long bindingTags; |
| | |
| | | this.sku = sku; |
| | | this.po = po; |
| | | } |
| | | public MatList(String sku, String po, Double ctns, String upc, Integer sign, String supplier, Long bindingTags) { |
| | | public MatList(String item, String sku, String po, Double ctns, String upc, Integer sign, Long bindingTags) { |
| | | this.item = item; |
| | | this.sku = sku; |
| | | this.po = po; |
| | | this.ctns = ctns; |
| | | this.upc = upc; |
| | | this.sign = sign; |
| | | this.supplier = supplier; |
| | | this.bindingTags = bindingTags; |
| | | } |
| | | } |
| | |
| | | private String pick_num; |
| | | private String staNo; |
| | | private String orderNo; |
| | | private String sku; |
| | | private String matnr; |
| | | // private String sku; |
| | | private Long bindingTags; |
| | | |
| | | public void OrderIdTwo(String sign_order,String sign_sku){ |
| | |
| | | staNo = split[1]; |
| | | String[] split1 = split[0].split(Pattern.quote(sign_sku)); |
| | | orderNo = split1[2]; |
| | | sku = split1[0]; |
| | | matnr = split1[0]; |
| | | bindingTags = Long.parseLong(split1[1]); |
| | | } |
| | | } |
| | |
| | | private String sku; |
| | | //客人PO |
| | | private String po; |
| | | private String item; |
| | | //条码值 |
| | | private String upc; |
| | | //货源 |
| | |
| | | * 组托 |
| | | */ |
| | | void comb(CombParam param, Long userId); |
| | | void combAuto(CombParam param, Long userId); |
| | | |
| | | /** |
| | | * 齐套入库查询 |
| | |
| | | |
| | | @Override |
| | | @Transactional |
| | | public void combAuto(CombParam param, Long userId) { |
| | | if (Cools.isEmpty(param.getBarcode(), param.getCombMats())) { |
| | | throw new CoolException(BaseRes.PARAM); |
| | | } |
| | | // if(param.getCombMats().size()>1){ |
| | | // throw new CoolException("请提取一个商品,或者刷新重新组托!"); |
| | | // } |
| | | // 判断是否有相同条码的数据 |
| | | if (waitPakinService.selectCount(new EntityWrapper<WaitPakin>(). |
| | | eq("zpallet", param.getBarcode()).eq("io_status", "N")) > 0) { |
| | | throw new CoolException(param.getBarcode() + "数据正在进行入库"); |
| | | } |
| | | |
| | | if(param.getBarcode().length()!=6){ |
| | | throw new CoolException("条码长度不是6位===>>" + param.getBarcode()); |
| | | } |
| | | // if (param.getCombMats().size()>1){ |
| | | // throw new CoolException("不允许混料===>>" + param.getBarcode()); |
| | | // } |
| | | |
| | | int countLoc = locDetlService.selectCount(new EntityWrapper<LocDetl>().eq("zpallet",param.getBarcode())); |
| | | int countWrk = wrkDetlService.selectCount(new EntityWrapper<WrkDetl>().eq("zpallet",param.getBarcode())); |
| | | int countwait = waitPakinService.selectCount(new EntityWrapper<WaitPakin>().eq("zpallet",param.getBarcode())); |
| | | if (countLoc > 0 || countWrk > 0 || countwait > 0) { |
| | | throw new CoolException("组托档/工作档/库存条码数据已存在===>>" + param.getBarcode()); |
| | | } |
| | | |
| | | Date now = new Date(); |
| | | |
| | | String orderNo = null; |
| | | for (CombParam.CombMat combMat : param.getCombMats()) { |
| | | List<OrderDetlPakin> orderDetlPakins = orderDetlPakinService.selectList(new EntityWrapper<OrderDetlPakin>() |
| | | .eq("matnr", combMat.getMatnr()).eq("boxType3", combMat.getOrderNo()) |
| | | .eq("standby1", combMat.getStandby1()).eq("standby2", combMat.getStandby2()) |
| | | .eq("standby3", combMat.getStandby3())); |
| | | if (orderDetlPakins.size() > 0) { |
| | | orderNo = orderDetlPakins.get(0).getOrderNo(); |
| | | combMat.setBoxType1(orderDetlPakins.get(0).getBoxType1()); |
| | | combMat.setBoxType2(orderDetlPakins.get(0).getBoxType2()); |
| | | combMat.setBoxType3(orderDetlPakins.get(0).getBoxType3()); |
| | | } else { |
| | | throw new CoolException("未查询到相关订单===>>" + param.getBarcode()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | // Order order = orderService.selectByNo(param.getOrderNo()); |
| | | Order order = OrderInAndOutUtil.selectByNo(Boolean.TRUE, orderNo); |
| | | if (Cools.isEmpty(order) || order.getSettle() > 2) { |
| | | throw new CoolException("单据编号已过期"); |
| | | } |
| | | // 生成入库通知档 |
| | | List<DetlDto> detlDtos = new ArrayList<>(); |
| | | param.getCombMats().forEach(elem -> { |
| | | |
| | | // 订单明细数量校验 |
| | | // OrderDetl orderDetl = orderDetlService.selectItem(order.getId(), elem.getMatnr(), elem.getBatch()); |
| | | OrderDetl orderDetl = OrderInAndOutUtil.selectItem(Boolean.TRUE, order.getId(), elem.getMatnr(), elem.getBatch(),elem.getBrand(),elem.getStandby1(),elem.getStandby2(),elem.getStandby3(), |
| | | elem.getBoxType1(),elem.getBoxType2(),elem.getBoxType3()); |
| | | if (elem.getAnfme() > orderDetl.getEnableQty()) { |
| | | throw new CoolException(orderDetl.getMatnr() + "入库数量不合法"); |
| | | } |
| | | // 修改订单作业数量 |
| | | // if (!orderDetlService.increaseWorkQty(order.getId(), elem.getMatnr(), elem.getBatch(), elem.getAnfme())) { |
| | | // throw new CoolException("修改单据作业数量失败"); |
| | | // } |
| | | OrderInAndOutUtil.increaseWorkQty(Boolean.TRUE,order.getId(), elem.getMatnr(), elem.getBatch(),elem.getBrand(),elem.getStandby1(),elem.getStandby2(),elem.getStandby3(), |
| | | elem.getBoxType1(),elem.getBoxType2(),elem.getBoxType3(), elem.getAnfme()); |
| | | DetlDto detlDto = new DetlDto(elem.getMatnr(), elem.getBatch(),elem.getBrand(),elem.getStandby1(),elem.getStandby2(),elem.getStandby3(), |
| | | elem.getBoxType1(),elem.getBoxType2(),elem.getBoxType3(), elem.getAnfme()); |
| | | if (DetlDto.has(detlDtos, detlDto)) { |
| | | DetlDto one = DetlDto.findDto(detlDtos, detlDto); |
| | | 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)) { |
| | | throw new CoolException(detlDto.getMatnr() + "商品档案不存在"); |
| | | } |
| | | WaitPakin waitPakin = new WaitPakin(); |
| | | waitPakin.sync(mat); |
| | | waitPakin.setOrderNo(orderNo); // 单据编号 |
| | | 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); |
| | | waitPakin.setStandby1(detlDto.getStandby1()); |
| | | waitPakin.setStandby2(detlDto.getStandby2()); |
| | | waitPakin.setStandby3(detlDto.getStandby3()); |
| | | waitPakin.setBoxType1(detlDto.getBoxType1()); |
| | | waitPakin.setBoxType2(detlDto.getBoxType2()); |
| | | waitPakin.setBoxType3(detlDto.getBoxType3()); |
| | | if (!waitPakinService.insert(waitPakin)) { |
| | | throw new CoolException("保存入库通知档失败"); |
| | | } |
| | | } |
| | | // orderService.updateSettle(order.getId(), 2L, userId); |
| | | OrderInAndOutUtil.updateOrder(Boolean.TRUE,order.getId(), 2L, userId); |
| | | |
| | | |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public R kittingQuery(CombParam combParam, Long userId) { |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | List<LocDetl> locDetlResultList = new ArrayList<>(); |
| | |
| | | try{ |
| | | BasArmMastSign basArmMastSign = basArmMastSignService.selectOne( |
| | | new EntityWrapper<BasArmMastSign>() |
| | | .eq("matnr", param.getSku()) |
| | | .eq("matnr", param.getMatnr()) |
| | | .eq("order_no", param.getOrderNo()) |
| | | .eq("create_time", param.getBindingTags()) |
| | | ); |
| | |
| | | //遍历单据 |
| | | for (String orderNo : orderNos) { |
| | | try{ |
| | | List<OrderDetlPakin> orderDetlPakinList = orderDetlPakinService.selectList(new EntityWrapper<OrderDetlPakin>().eq("order_no",orderNo)); |
| | | if (orderDetlPakinList.size()<1){ |
| | | List<OrderDetlPakin> orderDetlPakinListAll = orderDetlPakinService.selectList(new EntityWrapper<OrderDetlPakin>().eq("order_no",orderNo).eq("inspect",0)); |
| | | if (orderDetlPakinListAll.size()<1){ |
| | | orderPakinService.updateOrderStatus(orderNo); //更新订单状态 0 -> 1 |
| | | continue; |
| | | } |
| | | List<ItemUtilParam.Item> items = new ArrayList<>(); |
| | | for (OrderDetlPakin orderDetl:orderDetlPakinList){ |
| | | Integer number = basArmRulesService.getNumber(orderDetl.getWeight(),orderDetl.getVolume(),orderDetl.getManLength(),orderDetl.getWidth(),orderDetl.getHeight()); |
| | | if (number == null) { |
| | | BasArmRules basArmRules = new BasArmRules(); |
| | | basArmRules.setMaterialHeight(orderDetl.getHeight()); |
| | | basArmRules.setMaterialWeight(orderDetl.getWeight()); |
| | | basArmRules.setMaterialLength(orderDetl.getManLength()); |
| | | basArmRules.setMaterialWidth(orderDetl.getWidth()); |
| | | basArmRulesService.insert(basArmRules); |
| | | return; |
| | | } else if (number == 0){ |
| | | return; |
| | | List<String> boxType3List = new ArrayList<>(); |
| | | for (OrderDetlPakin orderDetl:orderDetlPakinListAll){ |
| | | if (!boxType3List.contains(orderDetl.getBoxType3())){ |
| | | boxType3List.add(orderDetl.getBoxType3()); |
| | | } |
| | | String name = ToSortLineUtils.MergerParameter(orderDetl.getMatnr(),orderDetl.getStandby1(),orderDetl.getStandby2()); |
| | | int maxCapacity = number; |
| | | int stock = orderDetl.getAnfme().intValue(); |
| | | items.add(new ItemUtilParam.Item(name, maxCapacity, stock)); |
| | | } |
| | | for (String boxType3 : boxType3List){ |
| | | List<OrderDetlPakin> orderDetlPakinList = orderDetlPakinService.selectList(new EntityWrapper<OrderDetlPakin>().eq("order_no",orderNo).eq("box_type3",boxType3).eq("inspect",0)); |
| | | if (orderDetlPakinList.size()<1){ |
| | | continue; |
| | | } |
| | | List<ItemUtilParam.Item> items = new ArrayList<>(); |
| | | for (OrderDetlPakin orderDetl:orderDetlPakinList){ |
| | | Integer number = basArmRulesService.getNumber(orderDetl.getWeight(),orderDetl.getVolume(),orderDetl.getManLength(),orderDetl.getWidth(),orderDetl.getHeight()); |
| | | if (number == null) { |
| | | BasArmRules basArmRules = new BasArmRules(); |
| | | basArmRules.setMaterialHeight(orderDetl.getHeight()); |
| | | basArmRules.setMaterialWeight(orderDetl.getWeight()); |
| | | basArmRules.setMaterialLength(orderDetl.getManLength()); |
| | | basArmRules.setMaterialWidth(orderDetl.getWidth()); |
| | | basArmRulesService.insert(basArmRules); |
| | | return; |
| | | } else if (number == 0){ |
| | | return; |
| | | } |
| | | String name = ToSortLineUtils.MergerParameter(orderDetl.getMatnr(),orderDetl.getStandby3(),orderDetl.getStandby1(),orderDetl.getStandby2()); |
| | | int maxCapacity = number; |
| | | int stock = orderDetl.getAnfme().intValue(); |
| | | items.add(new ItemUtilParam.Item(name, maxCapacity, stock)); |
| | | } |
| | | |
| | | OrderToLine orderToLine = new OrderToLine(); |
| | | orderToLine.setOrderNo(orderNo); //单据编号 |
| | | orderToLine.setCreateTime(System.currentTimeMillis()); //创建时间 |
| | | OrderToLine orderToLineR = ToSortLineUtils.GetOrderToLine(items, orderToLine,"Opt3"); |
| | | OrderToLine orderToLine = new OrderToLine(); |
| | | orderToLine.setOrderNo(boxType3); //单据编号 |
| | | orderToLine.setCreateTime(System.currentTimeMillis()); //创建时间 |
| | | OrderToLine orderToLineR = ToSortLineUtils.GetOrderToLine(items, orderToLine,"Opt3"); |
| | | |
| | | try{ |
| | | ReturnT<String> returnT = orderToLineHandler.start(orderToLineR); |
| | | if (!returnT.isSuccess()) { |
| | | try{ |
| | | ReturnT<String> returnT = orderToLineHandler.start(orderToLineR); |
| | | if (!returnT.isSuccess()) { |
| | | // log.error("下发单据失败===>"+ JSON.toJSON(orderToLineR)); |
| | | } else { |
| | | try{ |
| | | for (OrderToLine.MatList matList:orderToLineR.getMatList()){ |
| | | BasArmMastSign basArmMastSign = new BasArmMastSign(); |
| | | basArmMastSign.setMatnr(matList.getSku()); |
| | | basArmMastSign.setOrderNo(orderNo); |
| | | basArmMastSign.setSku(matList.getSku()); |
| | | basArmMastSign.setPo(matList.getPo()); |
| | | basArmMastSign.setUpc(matList.getUpc()); |
| | | basArmMastSign.setSupplier(matList.getSupplier()); |
| | | basArmMastSign.setStatus(0); |
| | | basArmMastSign.setAnfme(matList.getCtns()); |
| | | basArmMastSign.setCreateTime(matList.getBindingTags()); |
| | | basArmMastSignService.insert(basArmMastSign); |
| | | } |
| | | }catch (Exception e){} |
| | | } else { |
| | | try{ |
| | | for (OrderToLine.MatList matList:orderToLineR.getMatList()){ |
| | | BasArmMastSign basArmMastSign = new BasArmMastSign(); |
| | | basArmMastSign.setMatnr(matList.getItem()); |
| | | basArmMastSign.setOrderNo(boxType3);//b3 |
| | | basArmMastSign.setSku(matList.getSku());//s3 |
| | | basArmMastSign.setPo(matList.getPo());//s1 |
| | | basArmMastSign.setUpc(matList.getUpc());//s2 |
| | | // basArmMastSign.setSupplier(matList.getSupplier()); |
| | | basArmMastSign.setStatus(0); |
| | | basArmMastSign.setAnfme(matList.getCtns()); |
| | | basArmMastSign.setCreateTime(matList.getBindingTags()); |
| | | basArmMastSignService.insert(basArmMastSign); |
| | | } |
| | | for (OrderDetlPakin orderDetl:orderDetlPakinList){ |
| | | orderDetl.setInspect(1); |
| | | orderDetlPakinService.updateById(orderDetl); |
| | | } |
| | | }catch (Exception e){} |
| | | } |
| | | } catch (Exception e){ |
| | | log.error("下发单据异常===>"+e.getMessage()); |
| | | } |
| | | } catch (Exception e){ |
| | | log.error("下发单据异常===>"+e.getMessage()); |
| | | } |
| | | |
| | | } catch (Exception e){ |
| | | log.error("下发单据异常,跳转下一个订单===>"+e.getMessage()); |
| | | } |
| | |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | if (jsonObject.getInteger("code").equals(200)) { |
| | | success = true; |
| | | orderPakinService.updateOrderStatus(orderToline.getOrderNo()); //更新订单状态 0 -> 1 |
| | | // orderPakinService.updateOrderStatus(orderToline.getOrderNo()); //更新订单状态 0 -> 1 |
| | | } else { |
| | | log.error("下发单据!!!url:{};request:{};response:{}", URL+Path, JSON.toJSONString(orderToline), response); |
| | | throw new CoolException("下发单据失败"); |
| | |
| | | System.out.println("\n" + solution); |
| | | } |
| | | |
| | | public static String MergerParameter(String sku,String po,String upc){ |
| | | return sku+sign_F+po+sign_F+upc; |
| | | public static String MergerParameter(String item,String sku,String po,String upc){ |
| | | return item+sign_F+sku+sign_F+po+sign_F+upc; |
| | | } |
| | | |
| | | public static OrderToLine GetOrderToLine(List<ItemUtilParam.Item> items, OrderToLine orderToLine,String sign){ |
| | |
| | | for (OptimizedLockerPackingUtils.Locker locker:packingSolution.lockers) { |
| | | for (String mantnr : locker.contents.keySet()){ |
| | | System.out.println(mantnr+"<===>"+locker.contents.get(mantnr)); |
| | | String[] split = mantnr.split(Pattern.quote(sign_F)); |
| | | String[] split = mantnr.split(Pattern.quote(sign_F),-1); |
| | | OrderToLine.MatList mat = new OrderToLine.MatList( |
| | | split[0], // matnr -> sku |
| | | split[1], // supp -> po -> s1 |
| | | split[0], // matnr -> matnr -> item |
| | | split[1], // sku -> sku |
| | | split[2], // standby1 -> po -> s1 |
| | | locker.contents.get(mantnr).doubleValue(), //整料 |
| | | split[2], //barcode -> upc -> s2 |
| | | split[3], //standby2 -> upc -> s2 |
| | | 1, |
| | | null, //origin -> supplier 货源 |
| | | locker.bindingTags |
| | | ); |
| | | matLists.add(mat); |
| | |
| | | // System.out.println(mantnr+"<===>"+locker.contents.get(mantnr)); |
| | | String[] split = mantnr.split(Pattern.quote(sign_F),-1); |
| | | OrderToLine.MatList mat = new OrderToLine.MatList( |
| | | split[0], // matnr -> sku |
| | | split[1], // supp -> po -> s1 |
| | | split[0], // matnr -> item -> matnr |
| | | split[1], // standby3 -> sku -> standby3 |
| | | split[2], // standby1 -> po -> standby1 |
| | | locker.contents.get(mantnr).doubleValue(), //整料 |
| | | split[2], //barcode -> upc -> s2 |
| | | split[3], //standby2 -> upc -> standby2 |
| | | 1, |
| | | null, //origin -> supplier 货源 |
| | | locker.bindingTags |
| | | ); |
| | | matLists.add(mat); |