| | |
| | | import com.zy.asrs.utils.CodeDetectionUtil; |
| | | import com.zy.asrs.utils.MatUtils; |
| | | import com.zy.asrs.utils.PostMesDataUtils; |
| | | import com.zy.asrs.utils.Utils; |
| | | import com.zy.common.model.DetlDto; |
| | | import com.zy.common.model.LocTypeDto; |
| | | import com.zy.common.model.StartupDto; |
| | |
| | | } |
| | | WaitPakin waitPakin = new WaitPakin(); |
| | | waitPakin.sync(mat); |
| | | waitPakin.setBatch(matList.getBatch()); //木箱编码 //批次 唯一值 箱号 |
| | | waitPakin.setBatch(matList.getBatch()); //木箱编码 //批次 唯一值 批次 |
| | | waitPakin.setModel(matList.getModel()); //卷号 唯一值 |
| | | waitPakin.setBrand(param.getBoxType()); //木箱类型 |
| | | waitPakin.setZpallet(param.getBarcode()); //托盘码 |
| | |
| | | waitPakin.setWeight(matList.getWeight()); //净重 |
| | | waitPakin.setVolume(matList.getRoughWeight()); //毛重 |
| | | waitPakin.setPrice(matList.getRollExtent()); //长度 |
| | | waitPakin.setSpecs(String.valueOf(matList.getJoint())); //接头 |
| | | waitPakin.setSpecs(String.valueOf(matList.getJoint())); //接头 MES订单号 |
| | | waitPakin.setIoStatus("N"); // 入出状态 |
| | | waitPakin.setAnfme(matList.getAnfme()); // 数量 |
| | | waitPakin.setStatus("Y"); // 状态 |
| | |
| | | if (Cools.isEmpty(basDevp.getCanining()) || !basDevp.getCanining().equals("Y")){ |
| | | throw new CoolException("码垛位编号 palletizingNo="+param.getStaNo()+" 所处站点不是能入状态"); |
| | | } |
| | | if (Cools.isEmpty(basDevp.getBarcode())){ |
| | | if (Cools.isEmpty(basDevp.getBarcode()) || basDevp.getBarcode().equals("00000000")){ |
| | | throw new CoolException("码垛位编号 palletizingNo="+param.getStaNo()+" 所处站点料箱码异常状态;料箱码==》为空"+basDevp.getBarcode()); |
| | | } |
| | | if (!basDevp.getInEnable().equals("Y")){ |
| | | try{ |
| | | Thread.sleep(500); |
| | | } catch (Exception e){ |
| | | |
| | | } |
| | | BasDevp basDevp1111 = basDevpService.selectById(param.getStaNo()); |
| | | if (!basDevp1111.getInEnable().equals("Y")){ |
| | | throw new CoolException("码垛位编号 palletizingNo="+param.getStaNo()+" 所处站点,请等待翻转完成;料箱码==》"+basDevp.getBarcode()); |
| | | } |
| | | |
| | | } |
| | | if (!CodeDetectionUtil.barcodeDetection(basDevp.getBarcode(),8)){ |
| | | throw new CoolException("码垛位编号 palletizingNo="+param.getStaNo()+" 所处站点料箱码异常状态;料箱码:"+basDevp.getBarcode()); |
| | |
| | | WaitPakin waitPakin = new WaitPakin(); |
| | | waitPakin.sync(mat); |
| | | waitPakin.setBatch(param.getBatch()); //木箱编码 //批次 唯一值 箱号 |
| | | waitPakin.setModel(param.getTaskNo()); //卷号 唯一值 |
| | | waitPakin.setModel(param.getTaskNo()); //卷号 唯一值 工作号 |
| | | // waitPakin.setBrand(param.getBoxType()); //木箱类型 |
| | | waitPakin.setZpallet(basDevp.getBarcode()); //托盘码 |
| | | // waitPakin.setOrigin(matList.getPosition()); //木箱在托盘上的位置 |
| | | waitPakin.setWeight(param.getWeight()); //净重 |
| | | // waitPakin.setVolume(matList.getRoughWeight()); //毛重 |
| | | // waitPakin.setPrice(matList.getRollExtent()); //长度 |
| | | waitPakin.setSpecs(param.getOrderNo()); //单号 借用 |
| | | waitPakin.setSpecs(param.getOrderNo()); //MES订单号 借用规格 |
| | | // waitPakin.setIoStatus("N"); // 入出状态 |
| | | // waitPakin.setAnfme(matList.getAnfme()); // 数量 |
| | | waitPakin.setColor(param.getColor()); // 颜色 |
| | |
| | | throw new CoolException("品号 matnr,请先下发基础档案!!!"); |
| | | } |
| | | if (Cools.isEmpty(mat.getUnits())){ |
| | | throw new CoolException("品号 matnr,重量范围偏移值为空!!!,请先下发基础档案!!!"); |
| | | throw new CoolException("品号 matnr,重量范围偏移值为空!!!,请先维护基础档案!!!"); |
| | | } |
| | | |
| | | ArrayList<Integer> crns =new ArrayList<>(); |
| | |
| | | } |
| | | |
| | | ArrayList<LocDetl> locDetlArrayList = new ArrayList<>(); |
| | | Wrapper<LocDetl> wrapper = new EntityWrapper<LocDetl>().eq("matnr", param.getMatnr()).eq("weight", param.getWeight()); |
| | | Wrapper<LocDetl> wrapper = new EntityWrapper<LocDetl>() |
| | | .eq("matnr", param.getMatnr()) |
| | | .eq("weight", param.getWeight()) |
| | | .orderBy("batch", true); |
| | | if (param.getDevNo() == 536) { |
| | | wrapper.eq("model", param.getModel()) |
| | | .eq("specs", param.getOrderNo()); |
| | |
| | | .lt("weight", param.getWeight() + mat.getUnits()) |
| | | .and() |
| | | .gt("weight", param.getWeight()) |
| | | .orderBy("batch", true) |
| | | .orderBy("weight", true); |
| | | if (param.getDevNo() == 536){ |
| | | locDetlWrapper.eq("model", param.getModel()) |
| | |
| | | .gt("weight", param.getWeight() - mat.getUnits()) |
| | | .and() |
| | | .lt("weight", param.getWeight()) |
| | | .orderBy("batch", true) |
| | | .orderBy("weight", false); |
| | | if (param.getDevNo() == 536){ |
| | | locDetlWrapper.eq("model", param.getModel()) |
| | |
| | | if (locDetlArrayList.size()<batchNum){ |
| | | throw new CoolException("库存数量:"+locDetlArrayList.size()+";小于需求数量:"+param.getBatchNum()); |
| | | } |
| | | ArrayList<String> locS = new ArrayList<>(); |
| | | |
| | | ArrayList<LocDetl> locDetlArrayAnd = new ArrayList<>(); |
| | | for (LocDetl locDetl : locDetlArrayList){ |
| | | if (!locS.contains(locDetl.getLocNo())){ |
| | | locDetlArrayAnd.add(locDetl); |
| | | locS.add(locDetl.getLocNo()); |
| | | if (crnList.contains(1) || crnList.contains(2)){ |
| | | String singleLoc = Utils.singleLoc(locDetl.getLocNo()); |
| | | if (Cools.isEmpty(singleLoc)){ |
| | | log.error("异常库位号:"+singleLoc+";输入库位号:"+locDetl.getLocNo()); |
| | | continue; |
| | | } |
| | | LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", singleLoc)); |
| | | if (locMast.getLocSts().equals("F")){ |
| | | LocDetl locDetl1 = locDetlService.selectOne(new EntityWrapper<LocDetl>().eq("loc_no", singleLoc)); |
| | | if (Cools.isEmpty(locDetl1)){ |
| | | throw new CoolException("库位"+locMast.getLocNo()+"异常,在库但是无库存!!!"); |
| | | } |
| | | if (!locS.contains(locDetl1.getLocNo())){ |
| | | if (locDetl1.getMatnr().equals(locDetl.getMatnr())){ |
| | | locDetlArrayAnd.add(locDetl1); |
| | | locS.add(locDetl1.getLocNo()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (locDetlArrayAnd.isEmpty()){ |
| | | throw new CoolException("未找到符合条件的物料明细:品号==》matnr:"+param.getMatnr()+";重量==》wright:"+param.getWeight()); |
| | | } |
| | | if (locDetlArrayAnd.size()<batchNum){ |
| | | throw new CoolException("库存数量:"+locDetlArrayAnd.size()+";小于需求数量:"+param.getBatchNum()); |
| | | } |
| | | |
| | | ArrayList<LocDetl> locDetlArraySou = new ArrayList<>(); |
| | | |
| | | for (LocDetl locDetl : locDetlArrayList){ |
| | | for (LocDetl locDetl : locDetlArrayAnd){ |
| | | if (batchNum <= 0){ |
| | | return; |
| | | break; |
| | | } |
| | | locDetlArraySou.add(locDetl); |
| | | batchNum --; |
| | |
| | | StockOutParam stockOutParam = new StockOutParam(param,locDetlArraySou); |
| | | workService.startupFullTakeStore(stockOutParam, userId); |
| | | } catch (Exception e){ |
| | | throw new CoolException("生成出库任务失败:出库数量:"+locDetlArraySou.size()); |
| | | // throw new CoolException("生成出库任务失败:出库数量:"+locDetlArraySou.size()); |
| | | throw new CoolException("生成出库任务失败:"+e.getMessage()); |
| | | } |
| | | |
| | | } |