| | |
| | | import com.zy.asrs.mapper.TagMapper; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.asrs.task.core.ReturnT; |
| | | import com.zy.asrs.task.handler.BareBoardHandler; |
| | | import com.zy.asrs.utils.CodeDetectionUtil; |
| | | import com.zy.asrs.utils.MatUtils; |
| | | import com.zy.asrs.utils.PostMesDataUtils; |
| | |
| | | private LocMastService locMastService; |
| | | @Autowired |
| | | private WorkService workService; |
| | | @Autowired |
| | | private BareBoardHandler bareBoardHandler; |
| | | |
| | | @Override |
| | | @Transactional |
| | |
| | | smallContainersJar(param); |
| | | } else if (param.getType()==3){//直供产线 |
| | | smallContainersSta(param); |
| | | } else if (param.getType()==99){//库内供产线 //出库 测试 |
| | | smallContainersBig99(param); |
| | | } |
| | | } catch (Exception e){ |
| | | throw new CoolException("失败!!!原因:"+e.getMessage()); |
| | |
| | | throw new CoolException("参数:出库数量 batchNum为空"); |
| | | } |
| | | |
| | | Mat mat = matService.selectByMatnr(param.getMatnr()); |
| | | if (Cools.isEmpty(mat)){ |
| | | throw new CoolException("品号 matnr,请先下发基础档案!!!"); |
| | | } |
| | | if (Cools.isEmpty(mat.getUnits())){ |
| | | throw new CoolException("品号 matnr,重量范围偏移值为空!!!,请先下发基础档案!!!"); |
| | | } |
| | | |
| | | |
| | | ArrayList<LocDetl> locDetlArrayList = new ArrayList<>(); |
| | | List<LocDetl> locDetls = locDetlService.selectList(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()); |
| | | if (param.getDevNo() == 536) { |
| | | wrapper.eq("model", param.getModel()) |
| | | .eq("specs", param.getOrderNo()); |
| | | } |
| | | |
| | | List<LocDetl> locDetls = locDetlService.selectList(wrapper); |
| | | if (locDetls.isEmpty()){ |
| | | locDetls = new ArrayList<LocDetl>(); |
| | | } |
| | | for (LocDetl locDetl:locDetls){ |
| | | LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", locDetl.getLocNo())); |
| | | if (locMast.getLocSts().equals("F")){ |
| | | locDetlArrayList.add(locDetl); |
| | | break; |
| | | } |
| | | } |
| | | |
| | | if (param.getDevNo() == 536){ |
| | | locDetlArrayList = new ArrayList<>(); |
| | | locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>().eq("matnr", param.getMatnr()) |
| | | .eq("weight", param.getWeight()) |
| | | .eq("specs", param.getOrderNo()) |
| | | .eq("model", param.getTaskNo())); |
| | | if (locDetls.isEmpty()){ |
| | | locDetls = new ArrayList<LocDetl>(); |
| | | } |
| | | for (LocDetl locDetl:locDetls){ |
| | | LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", locDetl.getLocNo())); |
| | | if (locMast.getLocSts().equals("F")){ |
| | | if (locDetlArrayList.size()<param.getBatchNum()) {//下 |
| | | locDetlArrayList.add(locDetl); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (locDetlArrayList.isEmpty()){ |
| | | throw new CoolException("未找到符合条件的物料明细:品号==》matnr:"+param.getMatnr()+";重量==》wright:"+param.getWeight()); |
| | | } |
| | | |
| | | Integer batchNum = param.getBatchNum(); |
| | | if (locDetlArrayList.size()<batchNum){//上5 |
| | | locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>().eq("matnr", param.getMatnr()) |
| | | .eq("specs", param.getOrderNo()) |
| | | .eq("model", param.getTaskNo()) |
| | | .lt("weight", param.getWeight()+5) |
| | | if (locDetlArrayList.size()<batchNum){//上 |
| | | Wrapper<LocDetl> locDetlWrapper = new EntityWrapper<LocDetl>().eq("matnr", param.getMatnr()) |
| | | .lt("weight", param.getWeight() + mat.getUnits()) |
| | | .and() |
| | | .gt("weight", param.getWeight()) |
| | | .orderBy("weight",true)); |
| | | .orderBy("weight", true); |
| | | if (param.getDevNo() == 536){ |
| | | locDetlWrapper.eq("model", param.getModel()) |
| | | .eq("specs", param.getOrderNo()); |
| | | } |
| | | locDetls = locDetlService.selectList(locDetlWrapper); |
| | | if (locDetls.isEmpty()){ |
| | | locDetls = new ArrayList<LocDetl>(); |
| | | } |
| | | for (LocDetl locDetl:locDetls){ |
| | | LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", locDetl.getLocNo())); |
| | | if (locMast.getLocSts().equals("F")){ |
| | | locDetlArrayList.add(locDetl); |
| | | break; |
| | | if (locDetlArrayList.size()<batchNum) {//下 |
| | | locDetlArrayList.add(locDetl); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | if (locDetlArrayList.size()<batchNum){//下5 |
| | | locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>().eq("matnr", param.getMatnr()) |
| | | |
| | | .eq("specs", param.getOrderNo()) |
| | | .eq("model", param.getTaskNo()) |
| | | .gt("weight", param.getWeight()-5) |
| | | if (locDetlArrayList.size()<batchNum){//下 |
| | | Wrapper<LocDetl> locDetlWrapper = new EntityWrapper<LocDetl>().eq("matnr", param.getMatnr()) |
| | | .gt("weight", param.getWeight() - mat.getUnits()) |
| | | .and() |
| | | .lt("weight", param.getWeight()) |
| | | .orderBy("weight",false)); |
| | | .orderBy("weight", false); |
| | | if (param.getDevNo() == 536){ |
| | | locDetlWrapper.eq("model", param.getModel()) |
| | | .eq("specs", param.getOrderNo()); |
| | | } |
| | | locDetls = locDetlService.selectList(locDetlWrapper); |
| | | |
| | | if (locDetls.isEmpty()){ |
| | | locDetls = new ArrayList<LocDetl>(); |
| | |
| | | for (LocDetl locDetl:locDetls){ |
| | | LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", locDetl.getLocNo())); |
| | | if (locMast.getLocSts().equals("F")){ |
| | | locDetlArrayList.add(locDetl); |
| | | break; |
| | | if (locDetlArrayList.size()<batchNum) {//下 |
| | | locDetlArrayList.add(locDetl); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | if (!wrkDetlService.insert(wrkDetl)) { |
| | | throw new CoolException("保存工作明细失败==》小料箱直供产线任务明细生成"); |
| | | } |
| | | |
| | | } |
| | | |
| | | public Integer getStaEnd(Integer staNo){ |
| | |
| | | } |
| | | } |
| | | |
| | | /* |
| | | * 出库 |
| | | * 直供产线 |
| | | * */ |
| | | public void smallContainersBig99(SmallCompleteParam param) {//直供产线//出库 |
| | | Long userId = 7777L;//mes |
| | | //判断param参数 |
| | | if (Cools.isEmpty(param.getType())){ |
| | | throw new CoolException("参数:类型 type为空"); |
| | | // }else if (Cools.isEmpty(param.getStaNo())){ |
| | | // throw new CoolException("参数:投料点位 staNo为空"); |
| | | }else if (Cools.isEmpty(param.getDevNo())){ |
| | | throw new CoolException("参数:产线点位 devNo为空"); |
| | | }else if (Cools.isEmpty(param.getMatnr())){ |
| | | throw new CoolException("参数:品号 matnr为空"); |
| | | }else if (Cools.isEmpty(param.getWeight())){ |
| | | throw new CoolException("参数:物料重量 wright为空"); |
| | | }else if (Cools.isEmpty(param.getBatchNum())){ |
| | | throw new CoolException("参数:出库数量 batchNum为空"); |
| | | } |
| | | Integer devNo = param.getDevNo(); |
| | | Integer batchNum = param.getBatchNum(); |
| | | |
| | | |
| | | for (int i =0;i<batchNum;i++){ |
| | | bareBoardHandler.startYx(devNo,99); |
| | | } |
| | | } |
| | | |
| | | /*...........................亳州煜星..............以上.............亳州煜星...........................*/ |
| | | } |