改版2.0:
1.自动出库200站
2.自动出空板100站
3.自动移库
| | |
| | | @TableField("out_enable") |
| | | private String outEnable; |
| | | |
| | | @ApiModelProperty(value= "") |
| | | @ApiModelProperty(value= "入库时间") |
| | | @TableField("io_time") |
| | | private Date ioTime; |
| | | |
| | |
| | | package com.zy.asrs.task; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.zy.asrs.entity.BasDevp; |
| | | import com.zy.asrs.entity.WrkMast; |
| | | import com.zy.asrs.service.BasDevpService; |
| | | import com.zy.asrs.service.WrkMastService; |
| | | import com.zy.asrs.task.handler.AutomaticLibraryTransferHandler; |
| | | import com.zy.system.entity.Config; |
| | |
| | | private WrkMastService wrkMastService; |
| | | @Autowired |
| | | private AutomaticLibraryTransferHandler automaticLibraryTransferHandler; |
| | | @Autowired |
| | | private BasDevpService basDevpService; |
| | | |
| | | @Scheduled(cron = "0/3 * * * * ? ") |
| | | private void execute(){ |
| | |
| | | if(WrkCount>0){ |
| | | return; |
| | | } |
| | | //自动出满托200 |
| | | Config configBoundShipment = configService.selectConfigByCode("AutomaticOutboundShipment"); |
| | | //自动出空板100 |
| | | Config configAutoEmpty = configService.selectConfigByCode("AutoEmpty"); |
| | | BasDevp basDevp100 = basDevpService.selectOne(new EntityWrapper<BasDevp>().eq("dev_no",100)); |
| | | BasDevp basDevp200 = basDevpService.selectOne(new EntityWrapper<BasDevp>().eq("dev_no",200)); |
| | | if((configAutoEmpty.getStatus()==1&&!basDevp100.getLoading().equals("Y"))||(configBoundShipment.getStatus()==1&&!basDevp200.getLoading().equals("Y"))){ |
| | | return; |
| | | } |
| | | if(config.getValue().equals("1")){ |
| | | automaticLibraryTransferHandler.startOne(); |
| | | }else if(config.getValue().equals("2")){ |
New file |
| | |
| | | package com.zy.asrs.task; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.core.common.Cools; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.service.BasDevpService; |
| | | import com.zy.asrs.service.StaDescService; |
| | | import com.zy.asrs.service.WrkDetlService; |
| | | import com.zy.asrs.service.WrkMastService; |
| | | import com.zy.asrs.service.impl.LocDetlServiceImpl; |
| | | import com.zy.asrs.service.impl.LocMastServiceImpl; |
| | | import com.zy.asrs.task.handler.AutomaticLibraryTransferHandler; |
| | | import com.zy.common.model.LocDetlDto; |
| | | import com.zy.common.model.enums.WorkNoType; |
| | | import com.zy.common.service.CommonService; |
| | | import com.zy.system.entity.Config; |
| | | import com.zy.system.service.ConfigService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Component |
| | | public class AutomaticOutboundShipment { |
| | | @Autowired |
| | | private ConfigService configService; |
| | | @Autowired |
| | | private WrkMastService wrkMastService; |
| | | @Autowired |
| | | private AutomaticLibraryTransferHandler automaticLibraryTransferHandler; |
| | | @Autowired |
| | | private BasDevpService basDevpService; |
| | | @Autowired |
| | | private LocDetlServiceImpl locDetlService; |
| | | @Autowired |
| | | private LocMastServiceImpl locMastService; |
| | | @Autowired |
| | | private StaDescService staDescService; |
| | | @Autowired |
| | | private CommonService commonService; |
| | | @Autowired |
| | | private WrkDetlService wrkDetlService; |
| | | |
| | | /** |
| | | * 自动出满托 |
| | | */ |
| | | @Scheduled(cron = "0/3 * * * * ? ") |
| | | private void execute(){ |
| | | Config config = configService.selectConfigByCode("AutomaticOutboundShipment"); |
| | | if(config.getStatus()==0){ |
| | | return; |
| | | } |
| | | |
| | | BasDevp basDevp = basDevpService.selectOne(new EntityWrapper<BasDevp>().eq("dev_no", 200)); |
| | | if (Cools.isEmpty(basDevp.getLoading())||basDevp.getLoading().equals("N")) { |
| | | //找到入库最早的 |
| | | LocMast locMastIoTime=locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_sts", "F").orderBy("io_time")); |
| | | //最早入库的可能不是最靠近出库口的,所以需要再去找这层最靠近出库口的货 |
| | | LocMast locMast =locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_sts", "F").eq("lev1",locMastIoTime.getLev1()).orderBy("bay1",false)); |
| | | |
| | | boolean res1 = false; |
| | | List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | .eq("lev1", locMast.getLev1()) |
| | | .orderBy("bay1", res1)); |
| | | for (LocMast locMast1 : locMasts) { |
| | | if (locMast1.getLocNo().equals(locMast.getLocNo())) { |
| | | break; |
| | | } |
| | | if (locMast1.getLocSts().equals("D") || locMast1.getLocSts().equals("F")) { |
| | | throw new CoolException(locMast.getLocNo() + "库位堵塞,禁止出库"); |
| | | }else if(!locMast1.getLocSts().equals("O")){ |
| | | return; |
| | | } |
| | | } |
| | | // 获取源站 |
| | | Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>() |
| | | .eq("type_no", 101) |
| | | .eq("stn_no", 200) |
| | | .eq("crn_no", locMast.getCrnNo()); |
| | | StaDesc staDesc = staDescService.selectOne(wrapper); |
| | | if (Cools.isEmpty(staDesc)) { |
| | | throw new CoolException("检索源站失败"); |
| | | } |
| | | Date now = new Date(); |
| | | |
| | | List<LocDetl> locDetls=locDetlService.selectList(new EntityWrapper<LocDetl>().eq("loc_no", locMast.getLocNo())); |
| | | |
| | | if(Cools.isEmpty(locDetls)){ |
| | | throw new CoolException("库存明细为空---locNo:"+locMast.getLocNo()); |
| | | } |
| | | // 生成工作号 |
| | | int workNo = commonService.getWorkNo(WorkNoType.getWorkNoType(101)); |
| | | // 生成工作档 |
| | | WrkMast wrkMast = new WrkMast(); |
| | | wrkMast.setWrkNo(workNo); |
| | | wrkMast.setIoTime(now); |
| | | wrkMast.setWrkSts(0L); // 工作状态:0.待接收 |
| | | wrkMast.setIoType(101); // 入出库状态 |
| | | wrkMast.setIoPri(15D); // 优先级:15 |
| | | wrkMast.setCrnNo(locMast.getCrnNo()); |
| | | wrkMast.setSourceStaNo(staDesc.getCrnStn()); // 源站 |
| | | wrkMast.setStaNo(staDesc.getStnNo()); // 目标站 |
| | | wrkMast.setSourceLocNo(locMast.getLocNo()); // 源库位 |
| | | wrkMast.setFullPlt("Y"); // 满板:Y |
| | | wrkMast.setPicking("N"); // 拣料 |
| | | wrkMast.setExitMk("N"); // 退出 |
| | | wrkMast.setEmptyMk("N"); // 空板 |
| | | wrkMast.setLinkMis("N"); |
| | | wrkMast.setBarcode(locMast.getBarcode()); |
| | | wrkMast.setAppeUser(9945L); // 操作人员数据 |
| | | wrkMast.setAppeTime(now); |
| | | wrkMast.setModiUser(9945L); |
| | | wrkMast.setModiTime(now); |
| | | if (!wrkMastService.insert(wrkMast)) { |
| | | throw new CoolException("保存工作档失败,出库库位号:"+locMast.getLocNo()); |
| | | } |
| | | // 生成工作档明细 |
| | | for (LocDetl l : locDetls) { |
| | | WrkDetl wrkDetl = new WrkDetl(); |
| | | wrkDetl.sync(l); |
| | | wrkDetl.setOrderNo(""); // 手动出库不需要带出库存中的单据编号 |
| | | wrkDetl.setWrkNo(workNo); |
| | | wrkDetl.setIoTime(now); |
| | | wrkDetl.setAnfme(l.getAnfme()); // 数量 |
| | | wrkDetl.setAppeTime(now); |
| | | wrkDetl.setAppeUser(9945L); |
| | | wrkDetl.setModiTime(now); |
| | | wrkDetl.setModiUser(9945L); |
| | | if (!wrkDetlService.insert(wrkDetl)) { |
| | | throw new CoolException("保存工作档明细失败"); |
| | | } |
| | | } |
| | | // 修改库位状态: F.在库 ====>>> R.出库预约/P.拣料/盘点/并板出库中 |
| | | locMast = locMastService.selectById(locMast.getLocNo()); |
| | | if (locMast.getLocSts().equals("F")) { |
| | | locMast.setLocSts("R"); |
| | | locMast.setModiUser(9945L); |
| | | locMast.setModiTime(now); |
| | | if (!locMastService.updateById(locMast)) { |
| | | throw new CoolException("预约库位状态失败,库位号:"+locMast.getLocNo()); |
| | | } |
| | | } else { |
| | | throw new CoolException(locMast.getLocNo() + "库位不是在库状态"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.core.common.Cools; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.BasDevp; |
| | | import com.zy.asrs.entity.LocMast; |
| | | import com.zy.asrs.entity.StaDesc; |
| | | import com.zy.asrs.entity.WrkMast; |
| | | import com.zy.asrs.service.BasDevpService; |
| | | import com.zy.asrs.service.LocMastService; |
| | | import com.zy.asrs.service.StaDescService; |
| | | import com.zy.asrs.service.WrkMastService; |
| | |
| | | private CommonService commonService; |
| | | @Autowired |
| | | ConfigService configService; |
| | | @Autowired |
| | | private BasDevpService basDevpService; |
| | | |
| | | |
| | | /** |
| | | * 自动出空板 |
| | | */ |
| | | @Scheduled(cron = "0/3 * * * * ? ") |
| | | private void execute() { |
| | | Config config = configService.selectConfigByCode("AutoEmpty"); |
| | | if(config.getStatus()==0){ |
| | | return; |
| | | } |
| | | int count = wrkMastService.selectCount(new EntityWrapper<WrkMast>().eq("io_type", 110)); |
| | | if (count > 0) { |
| | | WrkMast wrkMast = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("io_type", 110).eq("wrk_sts", 7)); |
| | | if (Cools.isEmpty(wrkMast)) { |
| | | return; |
| | | } |
| | | WrkMast wrkMast1 = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("io_type", 1).eq("wrk_sts", 2).eq("full_plt", "N")); |
| | | if (Cools.isEmpty(wrkMast1)) { |
| | | return; |
| | | } |
| | | wrkMast1.setFullPlt("Y"); |
| | | wrkMastService.updateById(wrkMast1); |
| | | wrkMast.setWrkSts(14L); |
| | | wrkMastService.updateById(wrkMast); |
| | | } else { |
| | | BasDevp basDevp = basDevpService.selectOne(new EntityWrapper<BasDevp>().eq("dev_no", 100)); |
| | | if (Cools.isEmpty(basDevp.getLoading())||basDevp.getLoading().equals("N")) { |
| | | List<LocMast> locMastss =locMastService.selectList(new EntityWrapper<LocMast>().eq("loc_sts", "D").orderBy("bay1")); |
| | | if (Cools.isEmpty(locMastss)) { |
| | | return; |
| | |
| | | } |
| | | if (locMast1.getLocSts().equals("D") || locMast1.getLocSts().equals("F")) { |
| | | throw new CoolException(locMasta.getLocNo()+"库位堵塞,禁止出库"); |
| | | }else if(!locMast1.getLocSts().equals("O")){ |
| | | return; |
| | | } |
| | | } |
| | | // 获取源站 |
| | |
| | | wrkMast.setIoTime(now); |
| | | wrkMast.setWrkSts(0L); // 工作状态:0.待发送 |
| | | wrkMast.setIoType(110); // 入出库状态: 110.空板出库 |
| | | wrkMast.setIoPri(10D); |
| | | wrkMast.setIoPri(13D); //优先级排序 15.出库>14.入库>13.空板出库>12.空板入库>11.移库 |
| | | wrkMast.setSourceStaNo(sourceStaNo); // 源站 |
| | | wrkMast.setStaNo(100); // 目标站 |
| | | wrkMast.setCrnNo(locMast.getCrnNo()); |
| | |
| | | } |
| | | break; |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | |
| | | List<LocMast> locMastsO=locMastService.selectList(new EntityWrapper<LocMast>() |
| | | .eq("loc_sts","O").eq("lev1",1).orderBy("bay1",false)); |
| | | if(Cools.isEmpty(locMastsO)){ |
| | | log.info("自动移库没有空库位,请关闭自动库位功能"); |
| | | return FAIL; |
| | | } |
| | | LocMast locMast1 = locMastsO.get(0); |
| | |
| | | List<LocMast> locMastsO=locMastService.selectList(new EntityWrapper<LocMast>() |
| | | .eq("loc_sts","O").eq("lev1",2).orderBy("bay1",false)); |
| | | if(Cools.isEmpty(locMastsO)){ |
| | | log.info("自动移库没有空库位,请关闭自动库位功能"); |
| | | return FAIL; |
| | | } |
| | | LocMast locMast1 = locMastsO.get(0); |
| | |
| | | List<LocMast> locMastsO=locMastService.selectList(new EntityWrapper<LocMast>() |
| | | .eq("loc_sts","O").eq("lev1",3).orderBy("bay1",true)); |
| | | if(Cools.isEmpty(locMastsO)){ |
| | | log.info("自动移库没有空库位,请关闭自动库位功能"); |
| | | return FAIL; |
| | | } |
| | | LocMast locMast1 = locMastsO.get(0); |
| | |
| | | List<LocMast> locMastsF=locMastService.selectList(new EntityWrapper<LocMast>() |
| | | .eq("loc_sts",sts).eq("lev1",i).orderBy("bay1",boo)); |
| | | List<LocMast> locMastsO=locMastService.selectList(new EntityWrapper<LocMast>() |
| | | .eq("loc_sts",sts).eq("lev1",i).orderBy("bay1",boo)); |
| | | .eq("loc_sts","O").eq("lev1",i).orderBy("bay1",boo)); |
| | | if(Cools.isEmpty(locMastsO)){ |
| | | log.info("自动移库没有空库位,请关闭自动库位功能"); |
| | | return FAIL; |
| | | continue; |
| | | } |
| | | LocMast locMast1 = locMastsO.get(0); |
| | | |
| | | LocMast locMast2 = locMastsF.get(locMastsF.size()-1); |
| | | if(locMast2.getBay1()>locMast1.getBay1()){ |
| | | return FAIL; |
| | | if(i!=3&&locMast2.getBay1()>locMast1.getBay1()){ |
| | | continue; |
| | | }else if(i==3&&locMast2.getBay1()<locMast1.getBay1()){ |
| | | continue; |
| | | } |
| | | |
| | | String locNo=null; |
| | | for(LocMast locMast:locMastsF){ |
| | | if(locMast.getBay1()<locMast1.getBay1()){ |
| | | if(i!=3&&locMast.getBay1()<locMast1.getBay1()){ |
| | | locNo=locMast1.getLocNo(); |
| | | }else if(i==3&&locMast.getBay1()>locMast1.getBay1()){ |
| | | locNo=locMast1.getLocNo(); |
| | | } |
| | | //生成移库任务 |
| | |
| | | wrkMast.setCrnNo(1); |
| | | wrkMast.setSourceLocNo(locMast.getLocNo()); // 源库位 |
| | | wrkMast.setLocNo(locNo); // 目标库位 |
| | | if(i!=3){ |
| | | wrkMast.setFullPlt("Y"); // 满板 |
| | | wrkMast.setEmptyMk("N"); // 空板 |
| | | }else{ |
| | | wrkMast.setFullPlt("N"); // 满板 |
| | | wrkMast.setEmptyMk("Y"); // 空板 |
| | | } |
| | | wrkMast.setPicking("N"); // 拣料 |
| | | wrkMast.setExitMk("N"); // 退出 |
| | | wrkMast.setEmptyMk("N"); // 空板 |
| | | |
| | | wrkMast.setBarcode(locMast.getBarcode()); // 托盘码 |
| | | wrkMast.setLinkMis("N"); |
| | | wrkMast.setAppeTime(new Date()); |
| | |
| | | List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>().eq("loc_no", locMast.getLocNo())); |
| | | for (LocDetl locDetl : locDetls) { |
| | | WrkDetl wrkDetl = new WrkDetl(); |
| | | wrkDetl.sync(locDetl); |
| | | wrkDetl.setWrkNo(workNo); |
| | | wrkDetl.setIoTime(new Date()); |
| | | wrkDetl.setAnfme(locDetl.getAnfme()); |
| | |
| | | task.setTaskId(wrkMast.getWrkNo().toString()); |
| | | task.setBarCode(wrkMast.getBarcode()); |
| | | task.setOrder(i); |
| | | |
| | | //优先级排序 15.出库>14.入库>13.空板出库>12.空板入库>11.移库 |
| | | if(wrkMast.getIoType() == 1 ){//入库 |
| | | workIssuedResult.setPriorityCode(14);//优先级 |
| | | task.setTaskType(0);//入库 |
| | | task.setStartNode(inDevp); |
| | | task.setEndNode(wrkMast.getLocNo());//目标库位 |
| | | |
| | | }else if(wrkMast.getIoType() == 10 ){//空板入库 |
| | | workIssuedResult.setPriorityCode(12);//优先级 |
| | | task.setTaskType(0);//入库 |
| | | task.setStartNode("200"); |
| | | task.setEndNode(wrkMast.getLocNo());//目标库位 |
| | | |
| | | }else if(wrkMast.getIoType() == 101 ){//出库 |
| | | workIssuedResult.setPriorityCode(15);//优先级 |
| | | task.setTaskType(1);//出库 |
| | | task.setStartNode(wrkMast.getSourceLocNo());//源库位 |
| | | task.setEndNode(outDevp); |
| | | |
| | | }else if(wrkMast.getIoType() == 11){//移库 |
| | | workIssuedResult.setPriorityCode(11);//优先级 |
| | | task.setTaskType(2);//移库 |
| | | task.setStartNode(wrkMast.getSourceLocNo());//源库位 |
| | | task.setEndNode(wrkMast.getLocNo());//目标库位 |
| | | |
| | | } else {//空板出库 |
| | | workIssuedResult.setPriorityCode(13);//优先级 |
| | | task.setTaskType(1);//出库 |
| | | task.setStartNode(wrkMast.getSourceLocNo());//源库位 |
| | | task.setEndNode("100"); |
| | |
| | | private WaitPakinService waitPakinService; |
| | | @Autowired |
| | | private OrderDetlService orderDetlService; |
| | | @Autowired |
| | | private BasDevpService basDevpService; |
| | | |
| | | public ReturnT<String> start(WrkMast wrkMast) { |
| | | // 4.入库完成 |
| | |
| | | private ReturnT<String> doIn(WrkMast wrkMast){ |
| | | Date now = new Date(); |
| | | LocMast locMast = locMastService.selectById(wrkMast.getLocNo()); |
| | | BasDevp basDevp = new BasDevp(); |
| | | try { |
| | | if (null == locMast) { |
| | | // exceptionHandle("工作档[workNo={0}]库位号错误[locNo={1}]", wrkMast.getWrkNo(), wrkMast.getLocNo()); |
| | |
| | | return FAIL.setMsg("空板入库 ===>> 修改库位状态失败; [workNo=" + wrkMast.getWrkNo() + "],[locNo=" + wrkMast.getLocNo() + "]"); |
| | | } |
| | | } |
| | | basDevp=basDevpService.selectOne(new EntityWrapper<BasDevp>().eq("dev_no",wrkMast.getSourceLocNo())); |
| | | break; |
| | | // 全板入库 |
| | | case 1: |
| | |
| | | return FAIL.setMsg("全板入库 ===>> 修改库位状态失败; [workNo=" + wrkMast.getWrkNo() + "],[locNo=" + wrkMast.getLocNo() + "]"); |
| | | } |
| | | } |
| | | basDevp=basDevpService.selectOne(new EntityWrapper<BasDevp>().eq("dev_no",wrkMast.getSourceLocNo())); |
| | | break; |
| | | // 拣料入库 |
| | | case 53: |
| | |
| | | default: |
| | | break; |
| | | } |
| | | if(!Cools.isEmpty(basDevp)){ |
| | | basDevp.setLoading("N"); |
| | | basDevp.setModiTime(now); |
| | | basDevpService.update(basDevp,new EntityWrapper<BasDevp>().eq("dev_no",wrkMast.getSourceLocNo())); |
| | | } |
| | | // 修改工作主档状态 |
| | | wrkMast.setWrkSts(5L); |
| | | wrkMast.setModiTime(now); |
| | |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return FAIL.setMsg("工作档库位号错误; [workNo=" + wrkMast.getWrkNo() + "],[locNo=" + wrkMast.getLocNo() + "]"); |
| | | } |
| | | BasDevp basDevp = basDevpService.selectOne(new EntityWrapper<BasDevp>().eq("dev_no",wrkMast.getStaNo())); |
| | | if(Cools.isEmpty(basDevp)){ |
| | | return FAIL.setMsg("没有找到该出库站点; [workNo=" + wrkMast.getWrkNo() + "],[devNo=" + wrkMast.getLocNo() + "]"); |
| | | } |
| | | basDevp.setLoading("Y"); |
| | | basDevp.setModiTime(now); |
| | | basDevpService.updateById(basDevp); |
| | | assert locMast != null; |
| | | switch (wrkMast.getIoType()) { |
| | | // 全板出库 |
| | |
| | | default: |
| | | break; |
| | | } |
| | | |
| | | // 修改工作主档状态 |
| | | wrkMast.setWrkSts(15L); |
| | | wrkMast.setModiTime(now); |
| | |
| | | |
| | | /** |
| | | * 生成工作号 |
| | | * |
| | | * @param wrkMk |
| | | * @return workNo(工作号) |
| | | */ |
| | |
| | | * 库型 1: 标准堆垛机库 2: 平库 3: 穿梭板 4: 四向车 5: AGV 0: 未知 |
| | | */ |
| | | switch (rowLastnoType.getType()){ |
| | | case 1: |
| | | return getLocNoRun(whsType,staDescId,sourceStaNo,matnr,batch,grade,0,locTypeDto,0); |
| | | case 2: |
| | | log.error("站点={} 未查询到对应的规则",sourceStaNo); |
| | | break; |
| | | case 3: |
| | | log.error("站点={} 未查询到对应的规则",sourceStaNo); |
| | | break; |
| | | case 4: |
| | | return getLocNoRun4(whsType,staDescId,sourceStaNo,matnr,batch,grade,4,locTypeDto,0); |
| | | case 5: |
| | | return getLocNoRun5(whsType,staDescId,sourceStaNo,matnr,batch,grade,0,locTypeDto,0); |
| | | default: |
| | | log.error("站点={} 未查询到对应的规则",sourceStaNo); |
| | | break; |
| | | } |
| | | |
| | | }catch (Exception e){ |
| | |
| | | |
| | | if (!Cools.isEmpty(matnr) && staDescId != 10){ |
| | | int lev = 0; |
| | | List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>().eq("matnr", matnr)); |
| | | if (!Cools.isEmpty(locDetls)){ |
| | | for (LocDetl locDetl : locDetls){ |
| | | if (locMast != null){ |
| | | break; |
| | | } |
| | | LocMast locMast1 = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", locDetl.getLocNo())); |
| | | if (Cools.isEmpty(locMast1)) { |
| | | continue; |
| | | } |
| | | if (locMast1.getLev1() != lev && locMast1.getLev1() !=3) { |
| | | List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | .eq("lev1", locMast1.getLev1()) |
| | | .orderBy("bay1",false)); |
| | | if (Cools.isEmpty(locMasts)){ |
| | | throw new CoolException("数据异常,请联系管理员===》库位未知"); |
| | | } |
| | | for (LocMast locMast2 : locMasts) { |
| | | if (locMast2.getLocSts().equals("O") ) { |
| | | if (locMast == null){ |
| | | locMast = locMast2; |
| | | } |
| | | }else if (locMast2.getLocSts().equals("F")){ |
| | | locMast = null; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | if(Cools.isEmpty(locMast)){ |
| | | List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | .eq("lev1", 1) |
| | | .orderBy("bay1",false)); |
| | | for (LocMast locMast2 : locMasts) { |
| | | if (locMast2.getLocSts().equals("O") ) { |
| | | if (locMast == null){ |
| | | locMast = locMast2; |
| | | } |
| | | }else if (locMast2.getLocSts().equals("F")){ |
| | | locMast = null; |
| | | } |
| | | } |
| | | } |
| | | if(Cools.isEmpty(locMast)){ |
| | | List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | .eq("lev1", 2) |
| | | .orderBy("bay1",false)); |
| | | for (LocMast locMast2 : locMasts) { |
| | | if (locMast2.getLocSts().equals("O") ) { |
| | | if (locMast == null){ |
| | | locMast = locMast2; |
| | | } |
| | | }else if (locMast2.getLocSts().equals("F")){ |
| | | locMast = null; |
| | | } |
| | | } |
| | | } |
| | | }else { |
| | | // List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>().eq("matnr", matnr)); |
| | | // if (!Cools.isEmpty(locDetls)){ |
| | | // for (LocDetl locDetl : locDetls){ |
| | | // if (locMast != null){ |
| | | // break; |
| | | // } |
| | | // LocMast locMast1 = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", locDetl.getLocNo())); |
| | | // if (Cools.isEmpty(locMast1)) { |
| | | // continue; |
| | | // } |
| | | // if (locMast1.getLev1() != lev && locMast1.getLev1() !=3) { |
| | | // List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | // .eq("lev1", locMast1.getLev1()) |
| | | // .orderBy("bay1",false)); |
| | | // if (Cools.isEmpty(locMasts)){ |
| | | // throw new CoolException("数据异常,请联系管理员===》库位未知"); |
| | | // } |
| | | // for (LocMast locMast2 : locMasts) { |
| | | // if (locMast2.getLocSts().equals("O") ) { |
| | | // if (locMast == null){ |
| | | // locMast = locMast2; |
| | | // } |
| | | // }else if (locMast2.getLocSts().equals("F")){ |
| | | // locMast = null; |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | // if(Cools.isEmpty(locMast)){ |
| | | // List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | // .eq("lev1", 1) |
| | | // .orderBy("bay1",false)); |
| | | // for (LocMast locMast2 : locMasts) { |
| | | // if (locMast2.getLocSts().equals("O") ) { |
| | | // if (locMast == null){ |
| | | // locMast = locMast2; |
| | | // } |
| | | // }else if (locMast2.getLocSts().equals("F")){ |
| | | // locMast = null; |
| | | // } |
| | | // } |
| | | // } |
| | | // if(Cools.isEmpty(locMast)){ |
| | | // List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | // .eq("lev1", 2) |
| | | // .orderBy("bay1",false)); |
| | | // for (LocMast locMast2 : locMasts) { |
| | | // if (locMast2.getLocSts().equals("O") ) { |
| | | // if (locMast == null){ |
| | | // locMast = locMast2; |
| | | // } |
| | | // }else if (locMast2.getLocSts().equals("F")){ |
| | | // locMast = null; |
| | | // } |
| | | // } |
| | | // } |
| | | // }else { |
| | | for (int i = 1; i<=2;i++){ |
| | | if (locMast != null){ |
| | | break; |
| | | } |
| | | List<LocMast> locMastsF = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | .eq("lev1", i) |
| | | .eq("loc_sts","F")); |
| | | if (!Cools.isEmpty(locMastsF)){ |
| | | continue; |
| | | } |
| | | // List<LocMast> locMastsF = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | // .eq("lev1", i) |
| | | // .eq("loc_sts", "F")); |
| | | // if (!Cools.isEmpty(locMastsF)) { |
| | | // continue; |
| | | // } |
| | | List<LocMast> locMastsR = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | .eq("lev1", i) |
| | | .eq("loc_sts","R")); |
| | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | // } |
| | | }else { |
| | | //空板入库 |
| | | List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | .eq("lev1", 3) |
| | | .orderBy("bay1",true)); |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | // 递归查询 |
| | |
| | | startupDto.setLocNo(locNo); |
| | | return startupDto; |
| | | } |
| | | |
| | | public StartupDto getLocNoRun5(Integer whsType, Integer staDescId, Integer sourceStaNo, String matnr, String batch, String grade, Integer moveCrnNo, LocTypeDto locTypeDto, int times) { |
| | | if (Cools.isEmpty(matnr)) { //物料号 |
| | | matnr = ""; |
| | |
| | | } |
| | | }else { |
| | | //有满板出库时禁止空板入库 |
| | | int wrkCount = wrkMastService.selectCount(new EntityWrapper<WrkMast>().eq("io_type",101).or().eq("io_type",110)); |
| | | int wrkCount = wrkMastService.selectCount(new EntityWrapper<WrkMast>().eq("sta_no",200).andNew().eq("io_type",101).or().eq("io_type",110)); |
| | | if(wrkCount > 0){ |
| | | return Re.error("有满板出库时禁止空板入库"); |
| | | } |
| | |
| | | // wrkMast.setWrkSts(7L);//6.放货完成 |
| | | if(wrkMast.getIoType()==1 || wrkMast.getIoType() == 10 || wrkMast.getIoType() == 11){ |
| | | wrkMast.setWrkSts(4L);//4.入库完成 |
| | | }else if (wrkMast.getIoType()==101){ |
| | | }else if (wrkMast.getIoType()==101 || wrkMast.getIoType()==110){ |
| | | wrkMast.setWrkSts(14L);//14.已出库未确认 |
| | | } else if (wrkMast.getIoType()==110) { |
| | | wrkMast.setWrkSts(7L); |
| | | } |
| | | } |
| | | wrkMastService.updateById(wrkMast); |
| | |
| | | select * from asr_wrk_mast |
| | | where wrk_sts=5 |
| | | or (wrk_sts=15 and ove_mk='Y' and wrk_no not in (select wrk_no from asr_bas_devp)) |
| | | or (wrk_sts=15 and dateadd(mi,15,crn_end_time) <= getdate() and wrk_no not in (select wrk_no from asr_bas_devp)) |
| | | or (wrk_sts=15 and wrk_no not in (select wrk_no from asr_bas_devp)) |
| | | or (wrk_sts=15 and crn_end_time is null and wrk_no not in (select wrk_no from asr_bas_devp)) |
| | | order by io_time,wrk_no asc |
| | | </select> |