| | |
| | | package com.zy.asrs.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.core.common.Cools; |
| | | import com.core.common.DateUtils; |
| | | import com.core.common.R; |
| | |
| | | import com.zy.asrs.entity.param.*; |
| | | import com.zy.asrs.entity.result.OpenOrderCompeteResult; |
| | | import com.zy.asrs.entity.result.StockVo; |
| | | import com.zy.asrs.entity.vo.JarMastTableVo; |
| | | 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; |
| | | import com.zy.asrs.utils.Utils; |
| | | import com.zy.common.model.DetlDto; |
| | | import com.zy.common.model.LocTypeDto; |
| | | import com.zy.common.model.StartupDto; |
| | | import com.zy.common.model.enums.WorkNoType; |
| | | import com.zy.common.service.CommonService; |
| | | import com.zy.common.utils.NodeUtils; |
| | | import com.zy.common.web.WcsController; |
| | | import com.zy.common.web.param.SearchLocParam; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | |
| | | private WaitPakinService waitPakinService; |
| | | @Autowired |
| | | private CommonService commonService; |
| | | @Autowired |
| | | private LocDetlRullUpDetailService locDetlRullUpDetailService; |
| | | @Autowired |
| | | private WrkDetlSingleService wrkDetlSingleService; |
| | | @Autowired |
| | | private WrkMastStaService wrkMastStaService; |
| | | @Autowired |
| | | private WrkMastStaLogService wrkMastStaLogService; |
| | | @Autowired |
| | | private StaDescService staDescService; |
| | | @Autowired |
| | | private LocMastService locMastService; |
| | | @Autowired |
| | | private WorkService workService; |
| | | @Autowired |
| | | private BareBoardHandler bareBoardHandler; |
| | | @Autowired |
| | | private BasJarMastService basJarMastService; |
| | | @Autowired |
| | | private BasCrnpService basCrnpService; |
| | | |
| | | @Override |
| | | @Transactional |
| | |
| | | } else { |
| | | tagId = tagService.getTop().getId(); |
| | | } |
| | | mat.sync(param); |
| | | mat.sync(matParam); |
| | | // mat.setMatnr(param.getMatnr()); |
| | | // mat.setMaktx(param.getMaktx()); |
| | | // mat.setSpecs(param.getSpecs()); |
| | |
| | | log.info("同步新物料[商品编号:{}]", mat.getMatnr()); |
| | | } |
| | | } else { |
| | | mat.sync(param); |
| | | mat.sync(matParam); |
| | | if (!matService.update(mat, new EntityWrapper<Mat>().eq("matnr",matParam.getMatnr()))) { |
| | | throw new CoolException("更新已存在商品信息失败,请联系管理员"); |
| | | } |
| | |
| | | * */ |
| | | @Override |
| | | @Transactional |
| | | public void palletizingComplete(PalletizingCompleteParam param) { |
| | | public void PalletizingCompleteTwoFloorParam(PalletizingCompleteTwoFloorParam param) { |
| | | Long userId = 7777L;//中控 |
| | | //判断param参数 |
| | | if (Cools.isEmpty(param.getBarcode())){ |
| | | 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为空"); |
| | | // }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.getMatList()) || param.getMatList().size()==0){ |
| | | throw new CoolException("参数:物料明细 matList为空"); |
| | | } |
| | | |
| | | ArrayList<String> positions = new ArrayList<>(); //木箱位置查重 (orgin) |
| | | ArrayList<String> boxNos = new ArrayList<>(); //木箱唯一编码查重 (batch) |
| | | // String matnrOne = "";//木箱相同位置 规格 matnr校验 1、左 |
| | | // String matnrTwo = "";//木箱相同位置 规格 matnr校验 2、右 |
| | | // ArrayList<String> boxNos = new ArrayList<>(); //木箱唯一编码查重 (batch) |
| | | //判断matLists参数 |
| | | for (PalletizingCompleteParam.MatList matList:param.getMatLists()){ |
| | | for (PalletizingCompleteTwoFloorParam.MatList matList:param.getMatList()){ |
| | | if (Cools.isEmpty(matList.getMatnr())){ |
| | | throw new CoolException("参数:物料编码 matnr为空"); |
| | | }else if (Cools.isEmpty(matList.getPosition())){ |
| | | throw new CoolException("物料编码:"+matList.getMatnr()+"、参数:码垛位置 position为空"); |
| | | }else if (Cools.isEmpty(matList.getBoxNo())){ |
| | | throw new CoolException("物料编码:"+matList.getMatnr()+"、参数:木箱编号 boxNo为空"); |
| | | }else if (Cools.isEmpty(matList.getAnfme()) || matList.getAnfme().equals(0)){ |
| | | throw new CoolException("物料编码:"+matList.getMatnr()+"、参数:木箱中铜箔数量 anfme为空"); |
| | | }else if (Cools.isEmpty(matList.getWeight()) || matList.getWeight().equals(0D)){ |
| | | throw new CoolException("物料编码:"+matList.getMatnr()+"、参数:重量 weight为空"); |
| | | throw new CoolException("参数:规格 matnr为空"); |
| | | // }else if (Cools.isEmpty(matList.getPosition())){ |
| | | // throw new CoolException("规格:"+matList.getMatnr()+"、参数:码垛位置 position为空"); |
| | | // }else if (Cools.isEmpty(matList.getBatch())){ |
| | | // throw new CoolException("规格:"+matList.getMatnr()+"、参数:木箱编号 batch为空"); |
| | | // }else if (Cools.isEmpty(matList.getModel())){ |
| | | // throw new CoolException("规格:"+matList.getMatnr()+"、参数:卷号 model为空"); |
| | | // }else if (Cools.isEmpty(matList.getBatch())){ |
| | | // throw new CoolException("规格:"+matList.getMatnr()+"、参数:木箱编号 boxNo为空"); |
| | | // }else if (Cools.isEmpty(matList.getWeight()) || matList.getWeight().equals(0D)){ |
| | | // throw new CoolException("规格:"+matList.getMatnr()+"、参数:净重 weight为空"); |
| | | // }else if (Cools.isEmpty(matList.getRoughWeight()) || matList.getRoughWeight().equals(0D)){ |
| | | // throw new CoolException("规格:"+matList.getMatnr()+"、参数:毛重 roughWeight"); |
| | | // }else if (Cools.isEmpty(matList.getRollExtent()) || matList.getRollExtent().equals(0D)){ |
| | | // throw new CoolException("规格:"+matList.getMatnr()+"、参数:卷长度 rollExtent"); |
| | | // } |
| | | // else if (Cools.isEmpty(matList.getJoint()) || matList.getJoint()==0){ |
| | | // throw new CoolException("规格:"+matList.getMatnr()+"、参数:接头数 joint"); |
| | | } |
| | | |
| | | 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()+",木箱编码存在重复"); |
| | | } |
| | | // if (matList.getPosition().equals("1")){//1、左 2、右 |
| | | // if (!matnrOne.equals("")){ |
| | | // if (!matnrOne.equals(matList.getMatnr())){ |
| | | // throw new CoolException("木箱位置:"+matList.getPosition()+"存在不同规格卷信息"); |
| | | // } |
| | | // }else { |
| | | // matnrOne=matList.getMatnr(); |
| | | // } |
| | | // }else if (matList.getPosition().equals("2")){ |
| | | // if (!matnrTwo.equals("")){ |
| | | // if (!matnrTwo.equals(matList.getMatnr())){ |
| | | // throw new CoolException("木箱位置:"+matList.getPosition()+"存在不同规格卷信息"); |
| | | // } |
| | | // }else { |
| | | // matnrTwo=matList.getMatnr(); |
| | | // } |
| | | // }else { |
| | | // throw new CoolException("参数:木箱编号 boxNo:"+matList.getBatch()+",木箱位置错误:"+matList.getPosition()); |
| | | // } |
| | | // |
| | | // if (!boxNos.contains(matList.getBatch())){ |
| | | // boxNos.add(matList.getBatch()); |
| | | // }else { |
| | | // throw new CoolException("参数:木箱编号 boxNo:"+matList.getBatch()+",木箱编码存在重复"); |
| | | // } |
| | | } |
| | | |
| | | // BasDevp basDevp = basDevpService.selectById(Integer.parseInt(param.getDevNo$())); |
| | |
| | | |
| | | |
| | | Date now = new Date(); |
| | | for (PalletizingCompleteParam.MatList matList:param.getMatLists()){ |
| | | for (PalletizingCompleteTwoFloorParam.MatList matList:param.getMatList()){ |
| | | Mat mat = matService.selectByMatnr(matList.getMatnr()); |
| | | if (Cools.isEmpty(mat)) { |
| | | throw new CoolException(matList.getMatnr() + "商品档案不存在"); |
| | | mat = new Mat(); |
| | | mat.setMatnr(matList.getMatnr()); |
| | | mat.setMaktx(matList.getMatnr()); |
| | | mat.setTagId(tagService.getTop().getId()); |
| | | mat.setCreateBy(userId); |
| | | mat.setCreateTime(now); |
| | | mat.setUpdateBy(userId); |
| | | mat.setUpdateTime(now); |
| | | mat.setStatus(1); |
| | | if (!matService.insert(mat)) { |
| | | throw new CoolException("规格添加失败,请联系管理员"); |
| | | } |
| | | } |
| | | WaitPakin waitPakin = new WaitPakin(); |
| | | waitPakin.sync(mat); |
| | | waitPakin.setModel(matList.getBatch()); //批次 |
| | | waitPakin.setSpecs(matList.getSpecs()); //规格 |
| | | waitPakin.setBatch(matList.getBoxNo()); //木箱编码 |
| | | waitPakin.setBatch(matList.getBatch()); //木箱编码 //批次 唯一值 批次 |
| | | waitPakin.setModel(matList.getModel()); //卷号 唯一值 |
| | | waitPakin.setBrand(param.getBoxType()); //木箱类型 |
| | | waitPakin.setZpallet(param.getBarcode()); //托盘码 |
| | | waitPakin.setOrigin(matList.getPosition()); //木箱在托盘上的位置 |
| | | waitPakin.setWeight(matList.getWeight()); //净重 |
| | | waitPakin.setVolume(matList.getRoughWeight()); //毛重 |
| | | waitPakin.setPrice(matList.getRollExtent()); //长度 |
| | | waitPakin.setSpecs(String.valueOf(matList.getJoint())); //接头 MES订单号 |
| | | waitPakin.setIoStatus("N"); // 入出状态 |
| | | waitPakin.setAnfme(matList.getAnfme().doubleValue()); // 木箱中铜箔数量 |
| | | waitPakin.setAnfme(matList.getAnfme()); // 数量 |
| | | waitPakin.setStatus("Y"); // 状态 |
| | | waitPakin.setAppeUser(userId); |
| | | waitPakin.setAppeTime(now); |
| | |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | /* |
| | | * 松盛(1楼):码垛完成下发入库信息 |
| | | * */ |
| | | @Override |
| | | @Transactional |
| | | public void palletizingCompleteS(PalletizingCompleteParam param) { |
| | | //判断param参数 |
| | | if (Cools.isEmpty(param.getBarcode())){ |
| | | throw new CoolException("参数:托盘码 barcode为空"); |
| | | } |
| | | |
| | | WrkMast wrkMast = wrkMastService.selectByBarcode(param.getBarcode()); |
| | | if (Cools.isEmpty(wrkMast) || wrkMast.getWrkSts()!=2){ |
| | | log.error("退库码垛完成,返回托盘码未查询到工作档案!"); |
| | | throw new CoolException("参数:托盘码 barcode未查询到工作档案"); |
| | | } |
| | | wrkMast.setSheetNo("4"); |
| | | wrkMastService.updateById(wrkMast); |
| | | } |
| | | |
| | | |
| | |
| | | public void singleUnstackingComplete(SingleUnstackingCompleteParam param) { |
| | | Long userId = 8888L;//桁架上位软件 |
| | | //判断param参数 |
| | | if (Cools.isEmpty(param.getBarcode())){ |
| | | throw new CoolException("参数:托盘码 barcode为空"); |
| | | }else if (Cools.isEmpty(param.getPalletizingNo())){ |
| | | if (Cools.isEmpty(param.getPalletizingNo())){ |
| | | throw new CoolException("参数:码垛位编号 palletizingNo为空"); |
| | | }else if (Cools.isEmpty(param.getMatLists()) || param.getMatLists().size()==0){ |
| | | }else if (Cools.isEmpty(param.getMatList()) || param.getMatList().size()==0){ |
| | | throw new CoolException("参数:物料明细 matLists为空"); |
| | | } |
| | | WrkMast wrkMastMatrix = wrkMastService.selectByBarcode(param.getBarcode()); |
| | | if (Cools.isEmpty(wrkMastMatrix)){ |
| | | throw new CoolException("参数:托盘码查询工作档失败:"+param.getBarcode()); |
| | | } |
| | | |
| | | List<WrkDetl> wrkDetls = wrkDetlService.selectByWrkNoUnstacking(wrkMastMatrix.getWrkNo()); |
| | | ArrayList<WrkDetl> wrkDetlsNew = new ArrayList<>(); |
| | | ArrayList<WrkDetlSingle> wrkDetlsOld = new ArrayList<>(); |
| | | //判断matLists参数 |
| | | for (SingleUnstackingCompleteParam.MatList matList:param.getMatLists()){ |
| | | for (SingleUnstackingCompleteParam.MatList matList:param.getMatList()){ |
| | | if (Cools.isEmpty(matList.getPosition())){ |
| | | throw new CoolException("参数:码垛位置 position为空"); |
| | | }else if (Cools.isEmpty(matList.getBoxNo())){ |
| | | throw new CoolException("参数:木箱编号 boxNo为空"); |
| | | } |
| | | WrkDetlSingle wrkDetlSingleOne = wrkDetlSingleService.selectOne(new EntityWrapper<WrkDetlSingle>().eq("batch", matList.getBoxNo())); |
| | | List<WrkDetlSingle> wrkDetlSingles = wrkDetlSingleService.selectList(new EntityWrapper<WrkDetlSingle>() |
| | | .eq("wrk_no", wrkDetlSingleOne.getWrkNo()).eq("io_time", wrkDetlSingleOne.getIoTime())); |
| | | boolean sign=true; |
| | | for (WrkDetl wrkDetl:wrkDetls){ |
| | | if (wrkDetl.getBatch().equals(matList.getBoxNo())){//木箱编码 |
| | | wrkDetl.setInspect(1); |
| | | wrkDetlService.update(wrkDetl,new EntityWrapper<WrkDetl>().eq("batch",wrkDetl.getBatch())); |
| | | wrkDetlsNew.add(wrkDetl); |
| | | sign=false; |
| | | break; |
| | | } |
| | | for (WrkDetlSingle wrkDetlSingle:wrkDetlSingles){ |
| | | WrkDetl wrkDetl = new WrkDetl(); |
| | | wrkDetl.sync(wrkDetlSingle); |
| | | wrkDetlsNew.add(wrkDetl); |
| | | wrkDetlsOld.add(wrkDetlSingle); |
| | | sign=false; |
| | | break; |
| | | } |
| | | if (sign){ |
| | | throw new CoolException("参数:木箱编号 boxNo未查询到对应的工作明细!"); |
| | |
| | | wrkMast.setIoType(202); // 入出库状态:202.拆垛后出库 |
| | | wrkMast.setIoPri(99D); // 优先级 |
| | | wrkMast.setSourceStaNo(param.getDevNo$()); |
| | | wrkMast.setStaNo(140); //贴标站点 |
| | | wrkMast.setStaNo(144); //贴标站点 直接到尾端 |
| | | // 操作人员数据 |
| | | wrkMast.setAppeUser(userId); |
| | | wrkMast.setAppeTime(now); |
| | |
| | | } |
| | | } |
| | | |
| | | for (WrkDetlSingle wrkDetlSingle : wrkDetlsOld) { |
| | | wrkDetlSingleService.delete(new EntityWrapper<WrkDetlSingle>() |
| | | .eq("batch",wrkDetlSingle.getBatch()) |
| | | .eq("wrk_no",wrkDetlSingle.getWrkNo()) |
| | | .eq("io_time",wrkDetlSingle.getIoTime())); |
| | | } |
| | | |
| | | } |
| | | |
| | | /* |
| | |
| | | @Override |
| | | @Transactional |
| | | public void singleMountUnstackingComplete(SingleMountUnstackingCompleteParam param) { |
| | | Long userId = 8888L;//桁架上位软件 |
| | | // 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"); |
| | | wrkMastMatrix.setSheetNo("2"); |
| | | 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); |
| | | // int[] staNos =new int[]{122}; |
| | | // for (Integer staNo:staNos){ |
| | | // int[] crnNos =new int[]{6}; |
| | | // for (Integer crnNo:crnNos){ |
| | | // descSta(staNo,crnNo); |
| | | // } |
| | | // } |
| | | |
| | | } |
| | | |
| | | /* |
| | | * |
| | | * */ |
| | | @Override |
| | | @Transactional |
| | | public void cs3() { |
| | | private void descSta(Integer staNo,Integer crnNo){ |
| | | // int[] typeNos =new int[]{1,10,53,101,103,110}; |
| | | int[] typeNos =new int[]{10,110}; |
| | | for (Integer typeNo:typeNos){ |
| | | descSta3(staNo,crnNo,typeNo); |
| | | } |
| | | } |
| | | |
| | | private void descSta3(Integer staNo,Integer crnNo,Integer typeNo){ |
| | | StaDesc staDesc = new StaDesc(); |
| | | staDesc.setTypeNo(typeNo); |
| | | staDesc.setStnNo(staNo); |
| | | staDesc.setCrnNo(crnNo); |
| | | staDesc.setCrnStn(CrnNoRC(crnNo,staDesc.getTypeNo()>100)); |
| | | descSta2(staDesc); |
| | | } |
| | | |
| | | private void descSta2(StaDesc staDesc){ |
| | | Date now = new Date(); |
| | | //入库 |
| | | int sameRes = staDescService.selectCount(new EntityWrapper<StaDesc>() |
| | | .eq("type_no", staDesc.getTypeNo()) |
| | | .eq("stn_no", staDesc.getStnNo()) |
| | | .eq("crn_no", staDesc.getCrnNo()) |
| | | .eq("crn_stn", staDesc.getCrnStn())); |
| | | if (sameRes == 0) { |
| | | staDesc.setModiUser(9527L); |
| | | staDesc.setModiTime(now); |
| | | staDesc.setAppeUser(9527L); |
| | | staDesc.setAppeTime(now); |
| | | staDescService.insert(staDesc); |
| | | } |
| | | } |
| | | |
| | | private Integer CrnNoRC(Integer crnNo,boolean sign){ |
| | | Integer crnStn = 0; |
| | | switch (crnNo){ |
| | | case 1: |
| | | crnStn = 102; |
| | | break; |
| | | case 2: |
| | | crnStn = 105; |
| | | break; |
| | | case 3: |
| | | crnStn = 108; |
| | | break; |
| | | case 4: |
| | | crnStn = 111; |
| | | break; |
| | | case 5: |
| | | crnStn = 114; |
| | | break; |
| | | case 6: |
| | | crnStn = 117; |
| | | break; |
| | | } |
| | | if (sign){ |
| | | return crnStn-2; |
| | | } |
| | | return crnStn; |
| | | } |
| | | |
| | | /*...........................上饶江铜..............以上.............徐工汉云...........................*/ |
| | | |
| | | |
| | | /*...........................亳州煜星..............以下.............亳州煜星...........................*/ |
| | | /* |
| | | * 亳州煜星任务下发 // |
| | | * */ |
| | | @Override |
| | | @Transactional |
| | | public void smallContainers(SmallCompleteParam param) { |
| | | try{ |
| | | //判断param参数 |
| | | if (Cools.isEmpty(param.getType())){ |
| | | throw new CoolException("参数:类型 type为空"); |
| | | } |
| | | if (param.getType()==0){//直接入库 |
| | | smallContainersSmall(param); |
| | | } else if (param.getType()==1){//库内供产线 //出库 |
| | | smallContainersBig(param); |
| | | } else if (param.getType()==2){//入库 途径 硫化罐 |
| | | smallContainersJar(param); |
| | | } else if (param.getType()==3){//直供产线 |
| | | smallContainersSta(param); |
| | | } |
| | | // else if (param.getType()==99){//库内供产线 //出库 测试 |
| | | // smallContainersBig99(param); |
| | | // } |
| | | } catch (Exception e){ |
| | | throw new CoolException("失败!!!原因:"+e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /* |
| | | * 小料箱投料完成组托 |
| | | * */ |
| | | public void smallContainersSmall(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为空"); |
| | | } |
| | | |
| | | Mat mat = matService.selectByMatnr(param.getMatnr()); |
| | | if (Cools.isEmpty(mat)) { |
| | | // mat = new Mat(); |
| | | // mat.setMatnr(param.getMatnr()); |
| | | // mat.setMaktx(param.getMatnr()); |
| | | // mat.setTagId(tagService.getTop().getId()); |
| | | // mat.setCreateBy(userId); |
| | | // mat.setCreateTime(now); |
| | | // mat.setUpdateBy(userId); |
| | | // mat.setUpdateTime(now); |
| | | // mat.setStatus(1); |
| | | // if (!matService.insert(mat)) { |
| | | // throw new CoolException("规格添加失败,请联系管理员"); |
| | | // } |
| | | throw new CoolException("物料:"+param.getMatnr()+" 不存在,请先下发物料基础信息"); |
| | | } |
| | | |
| | | |
| | | BasDevp basDevp = basDevpService.selectById(param.getStaNo()); |
| | | if (Cools.isEmpty(basDevp.getAutoing()) || !basDevp.getAutoing().equals("Y")){ |
| | | throw new CoolException("码垛位编号 palletizingNo="+param.getStaNo()+" 所处站点不是自动状态"); |
| | | } |
| | | if (Cools.isEmpty(basDevp.getLoading()) || !basDevp.getLoading().equals("Y")){ |
| | | throw new CoolException("码垛位编号 palletizingNo="+param.getStaNo()+" 所处站点不是有物状态"); |
| | | } |
| | | if (Cools.isEmpty(basDevp.getCanining()) || !basDevp.getCanining().equals("Y")){ |
| | | throw new CoolException("码垛位编号 palletizingNo="+param.getStaNo()+" 所处站点不是能入状态"); |
| | | } |
| | | 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()); |
| | | } |
| | | |
| | | |
| | | if (locDetlService.selectCount(new EntityWrapper<LocDetl>().eq("zpallet", basDevp.getBarcode()))!=0 |
| | | || wrkDetlService.selectCount(new EntityWrapper<WrkDetl>().eq("zpallet", basDevp.getBarcode()))!=0 |
| | | || waitPakinService.selectCount(new EntityWrapper<WaitPakin>().eq("zpallet", basDevp.getBarcode()))!=0){ |
| | | throw new CoolException("托盘条码:"+basDevp.getBarcode()+"已存在,请勿重复组托"); |
| | | } |
| | | |
| | | |
| | | Date now = new Date(); |
| | | |
| | | WaitPakin waitPakin = new WaitPakin(); |
| | | waitPakin.sync(mat); |
| | | waitPakin.setBatch(param.getBatch()); //木箱编码 //批次 唯一值 箱号 |
| | | 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()); //MES订单号 借用规格 |
| | | // waitPakin.setIoStatus("N"); // 入出状态 |
| | | // waitPakin.setAnfme(matList.getAnfme()); // 数量 |
| | | waitPakin.setColor(param.getColor()); // 颜色 |
| | | waitPakin.setStatus("Y"); // 状态 |
| | | waitPakin.setAppeUser(userId); |
| | | waitPakin.setAppeTime(now); |
| | | waitPakin.setModiUser(userId); |
| | | waitPakin.setModiTime(now); |
| | | if (!waitPakinService.insert(waitPakin)) { |
| | | throw new CoolException("保存入库通知档失败"); |
| | | } |
| | | } |
| | | /* |
| | | * 出库 |
| | | * 直供产线 |
| | | * */ |
| | | public void smallContainersBig(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为空"); |
| | | } |
| | | |
| | | Mat mat = matService.selectByMatnr(param.getMatnr()); |
| | | if (Cools.isEmpty(mat)){ |
| | | throw new CoolException("品号 matnr,请先下发基础档案!!!"); |
| | | } |
| | | if (Cools.isEmpty(mat.getUnits())){ |
| | | throw new CoolException("品号 matnr,重量范围偏移值为空!!!,请先维护基础档案!!!"); |
| | | } |
| | | |
| | | ArrayList<Integer> crns =new ArrayList<>(); |
| | | ArrayList<Integer> crnList =new ArrayList<>(); |
| | | |
| | | crns.add(1);crns.add(2);crns.add(3);crns.add(4);crns.add(5);crns.add(6);crns.add(7); |
| | | |
| | | for (Integer crnNo : crns){ |
| | | // 检测路径 |
| | | Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>() |
| | | .eq("type_no", 101) |
| | | .eq("stn_no", param.getDevNo()) |
| | | .eq("crn_no", crnNo); |
| | | StaDesc staDesc = staDescService.selectOne(wrapper); |
| | | if (Cools.isEmpty(staDesc)){ |
| | | continue; |
| | | } |
| | | BasCrnp basCrnp = basCrnpService.selectById(crnNo); |
| | | if (basCrnp.getCrnSts()!=3 || !basCrnp.getOutEnable().equals("Y")){ |
| | | continue; |
| | | } |
| | | if (!basCrnpService.checkSiteError(crnNo, false)){ |
| | | continue; |
| | | } |
| | | crnList.add(crnNo); |
| | | } |
| | | |
| | | if (crnList.isEmpty()){ |
| | | throw new CoolException("无可用堆垛机"); |
| | | } |
| | | |
| | | ArrayList<LocDetl> locDetlArrayList = new ArrayList<>(); |
| | | 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()); |
| | | } |
| | | |
| | | 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")){ |
| | | if (crnList.contains(locMast.getCrnNo())){ |
| | | if (locDetlArrayList.size()<param.getBatchNum()) {//下 |
| | | locDetlArrayList.add(locDetl); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | Integer batchNum = param.getBatchNum(); |
| | | 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("batch", 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")){ |
| | | if (crnList.contains(locMast.getCrnNo())){ |
| | | if (locDetlArrayList.size()<batchNum) {//下 |
| | | locDetlArrayList.add(locDetl); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | 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("batch", true) |
| | | .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")){ |
| | | if (crnList.contains(locMast.getCrnNo())){ |
| | | if (locDetlArrayList.size()<batchNum) {//下 |
| | | locDetlArrayList.add(locDetl); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | if (locDetlArrayList.isEmpty()){ |
| | | throw new CoolException("未找到符合条件的物料明细:品号==》matnr:"+param.getMatnr()+";重量==》wright:"+param.getWeight()); |
| | | } |
| | | 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 : locDetlArrayAnd){ |
| | | if (batchNum <= 0){ |
| | | break; |
| | | } |
| | | locDetlArraySou.add(locDetl); |
| | | batchNum --; |
| | | } |
| | | try{ |
| | | StockOutParam stockOutParam = new StockOutParam(param,locDetlArraySou); |
| | | workService.startupFullTakeStore(stockOutParam, userId); |
| | | } catch (Exception e){ |
| | | // throw new CoolException("生成出库任务失败:出库数量:"+locDetlArraySou.size()); |
| | | throw new CoolException("生成出库任务失败:"+e.getMessage()); |
| | | } |
| | | |
| | | } |
| | | |
| | | public void smallContainersJar(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为空"); |
| | | } |
| | | Mat mat = matService.selectByMatnr(param.getMatnr()); |
| | | if (Cools.isEmpty(mat)) { |
| | | // mat = new Mat(); |
| | | // mat.setMatnr(param.getMatnr()); |
| | | // mat.setMaktx(param.getMatnr()); |
| | | // mat.setTagId(tagService.getTop().getId()); |
| | | // mat.setCreateBy(userId); |
| | | // mat.setCreateTime(now); |
| | | // mat.setUpdateBy(userId); |
| | | // mat.setUpdateTime(now); |
| | | // mat.setStatus(1); |
| | | // if (!matService.insert(mat)) { |
| | | // throw new CoolException("规格添加失败,请联系管理员"); |
| | | // } |
| | | throw new CoolException("物料:"+param.getMatnr()+" 不存在,请先下发物料基础信息"); |
| | | } |
| | | |
| | | |
| | | BasDevp basDevp = basDevpService.selectById(param.getStaNo()); |
| | | if (Cools.isEmpty(basDevp.getAutoing()) || !basDevp.getAutoing().equals("Y")){ |
| | | throw new CoolException("码垛位编号 palletizingNo="+param.getStaNo()+" 所处站点不是自动状态"); |
| | | } |
| | | if (Cools.isEmpty(basDevp.getLoading()) || !basDevp.getLoading().equals("Y")){ |
| | | throw new CoolException("码垛位编号 palletizingNo="+param.getStaNo()+" 所处站点不是有物状态"); |
| | | } |
| | | if (Cools.isEmpty(basDevp.getCanining()) || !basDevp.getCanining().equals("Y")){ |
| | | throw new CoolException("码垛位编号 palletizingNo="+param.getStaNo()+" 所处站点不是能入状态"); |
| | | } |
| | | if (Cools.isEmpty(basDevp.getBarcode())){ |
| | | throw new CoolException("码垛位编号 palletizingNo="+param.getStaNo()+" 所处站点料箱码异常状态;料箱码==》为空"+basDevp.getBarcode()); |
| | | } |
| | | if (!CodeDetectionUtil.barcodeDetection(basDevp.getBarcode(),8)){ |
| | | throw new CoolException("码垛位编号 palletizingNo="+param.getStaNo()+" 所处站点料箱码异常状态;料箱码:"+basDevp.getBarcode()); |
| | | } |
| | | |
| | | |
| | | if (locDetlService.selectCount(new EntityWrapper<LocDetl>().eq("zpallet", basDevp.getBarcode()))!=0 |
| | | || wrkDetlService.selectCount(new EntityWrapper<WrkDetl>().eq("zpallet", basDevp.getBarcode()))!=0 |
| | | || waitPakinService.selectCount(new EntityWrapper<WaitPakin>().eq("zpallet", basDevp.getBarcode()))!=0){ |
| | | throw new CoolException("托盘条码:"+basDevp.getBarcode()+"已存在,请勿重复组托"); |
| | | } |
| | | |
| | | |
| | | Date now = new Date(); |
| | | |
| | | WaitPakin waitPakin = new WaitPakin(); |
| | | waitPakin.sync(mat); |
| | | waitPakin.setBatch(param.getBatch()); //木箱编码 //批次 唯一值 箱号 |
| | | 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.setIoStatus("N"); // 入出状态 |
| | | // waitPakin.setAnfme(matList.getAnfme()); // 数量 |
| | | waitPakin.setColor(param.getColor()); // 颜色 |
| | | waitPakin.setStatus("Y"); // 状态 |
| | | waitPakin.setAppeUser(userId); |
| | | waitPakin.setAppeTime(now); |
| | | waitPakin.setModiUser(userId); |
| | | waitPakin.setModiTime(now); |
| | | if (!waitPakinService.insert(waitPakin)) { |
| | | throw new CoolException("保存入库通知档失败"); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | public void smallContainersSta(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为空"); |
| | | } |
| | | |
| | | Mat mat = matService.selectByMatnr(param.getMatnr()); |
| | | if (Cools.isEmpty(mat)) { |
| | | throw new CoolException("物料:"+param.getMatnr()+" 不存在,请先下发物料基础信息"); |
| | | } |
| | | |
| | | Date now = new Date(); |
| | | |
| | | BasDevp basDevp = basDevpService.selectById(param.getStaNo()); |
| | | if (Cools.isEmpty(basDevp.getAutoing()) || !basDevp.getAutoing().equals("Y")){ |
| | | throw new CoolException("码垛位编号 palletizingNo="+param.getStaNo()+" 所处站点不是自动状态"); |
| | | } |
| | | if (Cools.isEmpty(basDevp.getLoading()) || !basDevp.getLoading().equals("Y")){ |
| | | throw new CoolException("码垛位编号 palletizingNo="+param.getStaNo()+" 所处站点不是有物状态"); |
| | | } |
| | | if (Cools.isEmpty(basDevp.getCanining()) || !basDevp.getCanining().equals("Y")){ |
| | | throw new CoolException("码垛位编号 palletizingNo="+param.getStaNo()+" 所处站点不是能入状态"); |
| | | } |
| | | if (Cools.isEmpty(basDevp.getBarcode())){ |
| | | throw new CoolException("码垛位编号 palletizingNo="+param.getStaNo()+" 所处站点料箱码异常状态;料箱码==》为空"+basDevp.getBarcode()); |
| | | } |
| | | if (!CodeDetectionUtil.barcodeDetection(basDevp.getBarcode(),8)){ |
| | | throw new CoolException("码垛位编号 palletizingNo="+param.getStaNo()+" 所处站点料箱码异常状态;料箱码:"+basDevp.getBarcode()); |
| | | } |
| | | |
| | | |
| | | if (locDetlService.selectCount(new EntityWrapper<LocDetl>().eq("zpallet", basDevp.getBarcode()))!=0 |
| | | || wrkDetlService.selectCount(new EntityWrapper<WrkDetl>().eq("zpallet", basDevp.getBarcode()))!=0 |
| | | || waitPakinService.selectCount(new EntityWrapper<WaitPakin>().eq("zpallet", basDevp.getBarcode()))!=0){ |
| | | throw new CoolException("托盘条码:"+basDevp.getBarcode()+"已存在,请勿重复组托"); |
| | | } |
| | | |
| | | // 生成工作号 |
| | | int workNo = commonService.getWorkNo(WorkNoType.getWorkNoType(202)); |
| | | |
| | | // 生成工作档 |
| | | WrkMast wrkMast = new WrkMast(); |
| | | wrkMast.setWrkNo(workNo); |
| | | wrkMast.setIoTime(now); |
| | | wrkMast.setWrkSts(51L); // 工作状态:生成ID |
| | | wrkMast.setIoType(202); // 入出库状态:202.直供产线 |
| | | wrkMast.setIoPri(99D); // 优先级 |
| | | wrkMast.setSourceStaNo(param.getStaNo()); |
| | | wrkMast.setStaNo(param.getDevNo()); |
| | | wrkMast.setBarcode(basDevp.getBarcode()); |
| | | // 操作人员数据 |
| | | wrkMast.setAppeUser(userId); |
| | | wrkMast.setAppeTime(now); |
| | | wrkMast.setModiUser(userId); |
| | | wrkMast.setModiTime(now); |
| | | if (!wrkMastService.insert(wrkMast)) { |
| | | throw new CoolException("生成工作档失败==》小料箱直供产线任务生成"); |
| | | } |
| | | WrkDetl wrkDetl = new WrkDetl(); |
| | | wrkDetl.setWrkNo(wrkMast.getWrkNo()); |
| | | wrkDetl.setIoTime(wrkMast.getIoTime()); |
| | | wrkDetl.setMatnr(param.getMatnr()); |
| | | wrkDetl.setModel(param.getTaskNo()); |
| | | wrkDetl.setBatch(param.getBatch()); |
| | | wrkDetl.setSpecs(param.getOrderNo()); |
| | | wrkDetl.setAnfme(1D); |
| | | wrkDetl.setWeight(param.getWeight()); |
| | | wrkDetl.setBarcode(basDevp.getBarcode()); |
| | | wrkDetl.setZpallet(basDevp.getBarcode()); |
| | | wrkDetl.setAppeTime(now); |
| | | wrkDetl.setModiTime(now); |
| | | if (!wrkDetlService.insert(wrkDetl)) { |
| | | throw new CoolException("保存工作明细失败==》小料箱直供产线任务明细生成"); |
| | | } |
| | | } |
| | | |
| | | public Integer getStaEnd(Integer staNo){ |
| | | switch (staNo){ |
| | | case 118: |
| | | case 119: |
| | | return 131; |
| | | case 120: |
| | | case 121: |
| | | return 135; |
| | | default: |
| | | return 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); |
| | | } |
| | | } |
| | | |
| | | /* |
| | | * 获取硫化罐任务信息 // |
| | | * */ |
| | | @Override |
| | | @Transactional |
| | | public List<JarMastTableVo> getJatIdList(Integer id) { |
| | | List<BasJarMast> jarMasts = basJarMastService.selectList(new EntityWrapper<BasJarMast>().eq("jar_id", id)); |
| | | if (Cools.isEmpty(jarMasts)){ |
| | | return new ArrayList<JarMastTableVo>(); |
| | | } |
| | | ArrayList<JarMastTableVo> jarMastTableVos = new ArrayList<>(); |
| | | for (BasJarMast jarMast : jarMasts) { |
| | | JarMastTableVo jarMastTableVo = new JarMastTableVo(); |
| | | WrkMast wrkMast = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("wrk_no", jarMast.getWrkNo())); |
| | | List<WrkDetl> wrkDetls = wrkDetlService.selectList(new EntityWrapper<WrkDetl>().eq("wrk_no", jarMast.getWrkNo())); |
| | | if (wrkDetls.isEmpty()){ |
| | | WrkDetl wrkDetl = new WrkDetl(); |
| | | wrkDetls.add(wrkDetl); |
| | | } |
| | | if (Cools.isEmpty(wrkMast) || Cools.isEmpty(wrkDetls)){ |
| | | continue; |
| | | } |
| | | jarMastTableVo.setJarId(jarMast.getJarId()); |
| | | jarMastTableVo.setJarWrkNo(jarMast.getWrkNo().toString()); |
| | | jarMastTableVo.setStatus(jarMast.getStatus()); |
| | | jarMastTableVo.setStatus$(jarMast.getStatus$()); |
| | | jarMastTableVo.setMatnr(wrkDetls.get(0).getMatnr()); |
| | | jarMastTableVo.setMaktx(wrkDetls.get(0).getMaktx()); |
| | | jarMastTableVo.setWeight(wrkDetls.get(0).getWeight()); |
| | | jarMastTableVos.add(jarMastTableVo); |
| | | } |
| | | return jarMastTableVos; |
| | | } |
| | | |
| | | /*...........................亳州煜星..............以上.............亳州煜星...........................*/ |
| | | } |