| | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.common.Cools; |
| | | import com.core.common.DateUtils; |
| | | import com.core.common.R; |
| | | import com.core.common.SnowflakeIdWorker; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.*; |
| | |
| | | LabellerMatParam labellerMatParam = new LabellerMatParam(); |
| | | labellerMatParam.setDevNo(param.getDevNo()); |
| | | labellerMatParam.setLabNo(param.getLabNo()); |
| | | ArrayList<LabellerMatParam.CombMat> combMats = new ArrayList<>(); |
| | | String orderNo = ""; |
| | | labellerMatParam.setWrkNo(basDevp.getWrkNo().toString()); |
| | | // ArrayList<LabellerMatParam.CombMat> combMats = new ArrayList<>(); |
| | | ArrayList<LabellerMatParam.BoxNo> boxNos = new ArrayList<>(); |
| | | // String orderNo = ""; |
| | | |
| | | for (WrkDetl wrkDetl:wrkDetls){ |
| | | LabellerMatParam.CombMat combMat = new LabellerMatParam.CombMat(wrkDetl); |
| | | orderNo=wrkDetl.getOrderNo(); |
| | | combMat.setTemp1("1"); |
| | | combMats.add(combMat); |
| | | LabellerMatParam.BoxNo boxNo = new LabellerMatParam.BoxNo(); |
| | | boxNo.setBoxNo(wrkDetl.getBatch()); |
| | | boxNos.add(boxNo); |
| | | } |
| | | labellerMatParam.setBoxNos(boxNos); |
| | | // for (WrkDetl wrkDetl:wrkDetls){ |
| | | // LabellerMatParam.CombMat combMat = new LabellerMatParam.CombMat(wrkDetl); |
| | | // orderNo=wrkDetl.getOrderNo(); |
| | | // combMat.setTemp1("1"); |
| | | // combMats.add(combMat); |
| | | // } |
| | | |
| | | labellerMatParam.setCombMats(combMats); |
| | | labellerMatParam.setLabellingTime(DateUtils.convert(new Date())); |
| | | labellerMatParam.setWrkNo(basDevp.getWrkNo().toString()); |
| | | labellerMatParam.setLabTemplate("1"); |
| | | labellerMatParam.setOrderNo(orderNo); |
| | | // labellerMatParam.setCombMats(combMats); |
| | | // labellerMatParam.setLabellingTime(DateUtils.convert(new Date())); |
| | | // labellerMatParam.setLabTemplate("1"); |
| | | // labellerMatParam.setOrderNo(orderNo); |
| | | wrkMast.setWrkSts(53L); |
| | | if (!wrkMastService.updateById(wrkMast)){ |
| | | throw new CoolException("异常,请重新申请"); |
| | |
| | | |
| | | if (param.getLabResult().equals("OK")){ |
| | | wrkMast.setWrkSts(54L); |
| | | wrkMast.setStaNo(144); |
| | | if (!wrkMastService.updateById(wrkMast)){ |
| | | throw new CoolException("异常,请重新申请"); |
| | | } |
| | | }else if (param.getLabResult().equals("NG")){ |
| | | wrkMast.setWrkSts(52L); |
| | | wrkMast.setWrkSts(52L);//重新贴标 |
| | | if (!wrkMastService.updateById(wrkMast)){ |
| | | throw new CoolException("异常,请重新申请"); |
| | | } |
| | |
| | | throw new CoolException("参数:托盘码 barcode为空"); |
| | | }else if (Cools.isEmpty(param.getPalletizingNo())){ |
| | | throw new CoolException("参数:码垛位编号 palletizingNo为空"); |
| | | }else if (Cools.isEmpty(param.getBoxType())){ |
| | | throw new CoolException("参数:木箱类型 boxType为空"); |
| | | }else if (Cools.isEmpty(param.getMatLists()) || param.getMatLists().size()==0){ |
| | | throw new CoolException("参数:物料明细 matLists为空"); |
| | | } |
| | | |
| | | ArrayList<String> positions = new ArrayList<>(); //木箱位置查重 (orgin) |
| | | ArrayList<String> boxNos = new ArrayList<>(); //木箱唯一编码查重 (batch) |
| | | //判断matLists参数 |
| | | for (PalletizingCompleteParam.MatList matList:param.getMatLists()){ |
| | | if (Cools.isEmpty(matList.getMatnr())){ |
| | |
| | | throw new CoolException("物料编码:"+matList.getMatnr()+"、参数:木箱中铜箔数量 anfme为空"); |
| | | }else if (Cools.isEmpty(matList.getWeight()) || matList.getWeight().equals(0D)){ |
| | | throw new CoolException("物料编码:"+matList.getMatnr()+"、参数:重量 weight为空"); |
| | | } |
| | | |
| | | if (!positions.contains(matList.getPosition())){ |
| | | positions.add(matList.getPosition()); |
| | | }else { |
| | | throw new CoolException("参数:木箱编号 boxNo:"+matList.getBoxNo()+",木箱位置存在重复:"+matList.getPosition()); |
| | | } |
| | | |
| | | if (!boxNos.contains(matList.getBoxNo())){ |
| | | boxNos.add(matList.getBoxNo()); |
| | | }else { |
| | | throw new CoolException("参数:木箱编号 boxNo:"+matList.getBoxNo()+",木箱编码存在重复"); |
| | | } |
| | | } |
| | | |
| | |
| | | // } |
| | | |
| | | |
| | | WrkMast wrkMast = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("io_type",201).eq("barcode", param.getBarcode()).eq("sta_no",param.getDevNo$())); |
| | | if (Cools.isEmpty(wrkMast) || !wrkMast.getWrkSts().equals(42L)){ |
| | | throw new CoolException("查询托盘失败"); |
| | | }else { |
| | | wrkMast.setWrkSts(wrkMast.getWrkSts()+1); |
| | | } |
| | | |
| | | |
| | | if (locDetlService.selectCount(new EntityWrapper<LocDetl>().eq("zpallet", param.getBarcode()))!=0 |
| | | || wrkDetlService.selectCount(new EntityWrapper<WrkDetl>().eq("zpallet", param.getBarcode()))!=0 |
| | | || waitPakinService.selectCount(new EntityWrapper<WaitPakin>().eq("zpallet", param.getBarcode()))!=0){ |
| | |
| | | } |
| | | WaitPakin waitPakin = new WaitPakin(); |
| | | waitPakin.sync(mat); |
| | | waitPakin.setBatch(matList.getBatch()); //批次 |
| | | waitPakin.setModel(matList.getBatch()); //批次 |
| | | waitPakin.setSpecs(matList.getSpecs()); //规格 |
| | | waitPakin.setSku(matList.getBoxNo()); //木箱编码 |
| | | waitPakin.setBatch(matList.getBoxNo()); //木箱编码 |
| | | waitPakin.setBrand(param.getBoxType()); //木箱类型 |
| | | waitPakin.setZpallet(param.getBarcode()); //托盘码 |
| | | waitPakin.setOrigin(matList.getPosition()); //木箱在托盘上的位置 |
| | | waitPakin.setIoStatus("N"); // 入出状态 |
| | |
| | | throw new CoolException("保存入库通知档失败"); |
| | | } |
| | | } |
| | | if (!wrkMastService.updateById(wrkMast)){ |
| | | throw new CoolException("异常,请重新申请"); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | /* |
| | | *中控:出库完成月台相关 |
| | | * */ |
| | | @Override |
| | | @Transactional |
| | | public void balconyComplete(LabellerMatParam param) { |
| | | if (Cools.isEmpty(param.getWrkNo())){ |
| | | throw new CoolException("工作号为空!"); |
| | | } |
| | | WrkMast wrkMast = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("wrk_no", param.getWrkNo())); |
| | | if (Cools.isEmpty(wrkMast)){ |
| | | throw new CoolException("工作号为空!"); |
| | | } |
| | | wrkMast.setWrkSts(57L); |
| | | wrkMastService.updateById(wrkMast); |
| | | } |
| | | |
| | | /* |
| | |
| | | } |
| | | boolean sign=true; |
| | | for (WrkDetl wrkDetl:wrkDetls){ |
| | | if (wrkDetl.getSku().equals(matList.getBoxNo())){//木箱编码 |
| | | if (wrkDetl.getBatch().equals(matList.getBoxNo())){//木箱编码 |
| | | wrkDetl.setInspect(1); |
| | | wrkDetlService.updateById(wrkDetl); |
| | | wrkDetlService.update(wrkDetl,new EntityWrapper<WrkDetl>().eq("batch",wrkDetl.getBatch())); |
| | | wrkDetlsNew.add(wrkDetl); |
| | | sign=false; |
| | | break; |
| | |
| | | wrkMast.setIoTime(now); |
| | | wrkMast.setWrkSts(51L); // 工作状态:生成入库ID |
| | | wrkMast.setIoType(202); // 入出库状态:202.拆垛后出库 |
| | | wrkMast.setIoPri(13D); // 优先级 |
| | | wrkMast.setIoPri(99D); // 优先级 |
| | | wrkMast.setSourceStaNo(param.getDevNo$()); |
| | | wrkMast.setStaNo(140); //贴标站点 |
| | | // 操作人员数据 |
| | |
| | | wrkMast.setAppeTime(now); |
| | | wrkMast.setModiUser(userId); |
| | | wrkMast.setModiTime(now); |
| | | boolean res = wrkMastService.insert(wrkMast); |
| | | if (!res) { |
| | | throw new CoolException("生成工作档失败"); |
| | | if (!wrkMastService.insert(wrkMast)) { |
| | | throw new CoolException("生成工作档失败==》桁架上位软件:单次拆垛完成通知"); |
| | | } |
| | | |
| | | for (WrkDetl wrkDetl : wrkDetlsNew){ |
| | |
| | | wrkDetl.setAppeTime(now); |
| | | wrkDetl.setModiTime(now); |
| | | if (!wrkDetlService.insert(wrkDetl)) { |
| | | throw new CoolException("保存工作明细失败"); |
| | | throw new CoolException("保存工作明细失败==》桁架上位软件:单次拆垛完成通知"); |
| | | } |
| | | } |
| | | |
| | |
| | | @Transactional |
| | | public void singleMountUnstackingComplete(SingleMountUnstackingCompleteParam param) { |
| | | Long userId = 8888L;//桁架上位软件 |
| | | //判断param参数 |
| | | if (Cools.isEmpty(param.getBarcode())){ |
| | | throw new CoolException("参数:托盘码 barcode为空"); |
| | | }else if (Cools.isEmpty(param.getPalletizingNo())){ |
| | | throw new CoolException("参数:码垛位编号 palletizingNo为空"); |
| | | } |
| | | WrkMast wrkMastMatrix = wrkMastService.selectByBarcode(param.getBarcode()); |
| | | if (Cools.isEmpty(wrkMastMatrix)){ |
| | | throw new CoolException("参数:托盘码查询工作档失败:"+param.getBarcode()); |
| | | }else { |
| | | if (!wrkMastMatrix.getIoType().equals(101)){ |
| | | List<WrkDetl> wrkDetls = wrkDetlService.selectByWrkNoUnstacking(wrkMastMatrix.getWrkNo()); |
| | | if (Cools.isEmpty(param.getMatLists()) || param.getMatLists().size()==0 || param.getMatLists().size()!=wrkDetls.size()){ |
| | | throw new CoolException("返回物料明细数为"+param.getMatLists().size()+",托盘码:"+param.getBarcode()+"应剩余物料数:"+wrkDetls.size()); |
| | | } |
| | | |
| | | ArrayList<String> orgin = new ArrayList<>(); |
| | | //判断matLists参数 |
| | | for (SingleMountUnstackingCompleteParam.MatList matList : param.getMatLists()){ |
| | | if (Cools.isEmpty(matList.getPosition())){ |
| | | throw new CoolException("参数:码垛位置 position为空"); |
| | | }else if (Cools.isEmpty(matList.getBoxNo())){ |
| | | throw new CoolException("参数:木箱编号 boxNo为空"); |
| | | } |
| | | if (!orgin.contains(matList.getPosition())){ |
| | | orgin.add(matList.getPosition()); |
| | | }else { |
| | | throw new CoolException("参数:木箱编号 boxNo:"+matList.getBoxNo()+",木箱位置存在重复"); |
| | | } |
| | | boolean sign=true; |
| | | for (WrkDetl wrkDetl:wrkDetls){ |
| | | if (wrkDetl.getBatch().equals(matList.getBoxNo())){//木箱编码 |
| | | wrkDetl.setOrigin(matList.getPosition()); |
| | | wrkDetlService.update(wrkDetl,new EntityWrapper<WrkDetl>().eq("batch",wrkDetl.getBatch())); |
| | | sign=false; |
| | | break; |
| | | } |
| | | } |
| | | if (sign){ |
| | | throw new CoolException("参数:木箱编号 boxNo:"+matList.getBoxNo()+"未查询到对应的工作明细!"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | wrkMastMatrix.setSheetNo("1"); |
| | | if (!wrkMastService.updateById(wrkMastMatrix)){ |
| | | throw new CoolException("更新工作档失败==》桁架上位软件:单托拆垛完成通知"); |
| | | } |
| | | } |
| | | |
| | | /* |
| | | * |
| | | * */ |
| | | @Override |
| | | @Transactional |
| | | public void cs1(String barcode) { |
| | | BasDevp basDevp = basDevpService.selectById(216); |
| | | basDevp.setWrkNo(9992); |
| | | basDevp.setBarcode(barcode); |
| | | basDevpService.updateById(basDevp); |
| | | } |
| | | |
| | | /* |
| | | * |
| | | * */ |
| | | @Override |
| | | @Transactional |
| | | public void cs2() { |
| | | BasDevp basDevp = basDevpService.selectById(216); |
| | | basDevp.setWrkNo(0); |
| | | basDevp.setBarcode(""); |
| | | basDevpService.updateById(basDevp); |
| | | } |
| | | |
| | | /* |
| | | * |
| | | * */ |
| | | @Override |
| | | @Transactional |
| | | public void cs3() { |
| | | |
| | | } |
| | | |