| | |
| | | } |
| | | |
| | | /* |
| | | 启动入库,组托 + 生产工作档 |
| | | 启动入库,组托 + 生成工作档 |
| | | */ |
| | | @PostMapping("/start/pakin/auth") |
| | | @Synchronized |
| | |
| | | @Transactional |
| | | public void success(AgvWrkMast agvWrkMast, AgvTaskCallBackParam param) { |
| | | |
| | | //入库任务 || 拣料入库任务 ||盘点再入库 ||空板入库 |
| | | if(agvWrkMast.getIoType() == 1 || agvWrkMast.getIoType() == 53 || agvWrkMast.getIoType() == 57 || agvWrkMast.getIoType() == 10){ |
| | | //修改源站点状态为O.空,以及解绑托盘条码 |
| | | agvBasDevpService.updateLocStsAndBarcodeByDevNo(agvWrkMast.getSourceLocNo(),"O","",null); |
| | | switch(agvWrkMast.getIoType()) { |
| | | //入库任务 |
| | | case 1: |
| | | // 空板入库 |
| | | case 10: |
| | | // 拣料入库任务 |
| | | case 53: |
| | | // 盘点再入库 |
| | | case 57: |
| | | agvBasDevpService.updateLocStsAndBarcodeByDevNo(agvWrkMast.getSourceLocNo(),"O","",null); |
| | | break; |
| | | } |
| | | //if(agvWrkMast.getIoType() == 1 || agvWrkMast.getIoType() == 53 || agvWrkMast.getIoType() == 57 || agvWrkMast.getIoType() == 10){ |
| | | // //修改源站点状态为O.空,以及解绑托盘条码 |
| | | // agvBasDevpService.updateLocStsAndBarcodeByDevNo(agvWrkMast.getSourceLocNo(),"O","",null); |
| | | //} |
| | | |
| | | //修改AGV工作档的工作状态为203.RCS放货中 |
| | | agvWrkMastService.updateWrkStsByWrkNo(agvWrkMast.getWrkNo(),204); |
| | |
| | | // return R.ok(orderDetlService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | | @RequestMapping(value = "/order/wait/detls/pakin/page/auth") |
| | | @ManagerAuth |
| | | public R waitOrderDetls(@RequestParam(defaultValue = "1")Integer curr, |
| | | @RequestParam(defaultValue = "100")Integer limit, |
| | | @RequestParam(required = false)String orderByField, |
| | | @RequestParam(required = false)String orderByType, |
| | | @RequestParam Map<String, Object> param){ |
| | | EntityWrapper<OrderDetl> wrapper = new EntityWrapper<>(); |
| | | excludeTrash(param); |
| | | convert(param, wrapper); |
| | | // return R.ok(orderDetlService.getPakoutPage(toPage(curr, limit, param, OrderDetl.class))); |
| | | List<DocType> pakins = docTypeService.selectList(new EntityWrapper<DocType>().eq("pakin", 1)); |
| | | List<Long> docIds = new ArrayList<>(); |
| | | for (DocType pakin : pakins) { |
| | | if (pakin.getDocId() == 36) { |
| | | docIds.add(pakin.getDocId()); |
| | | } |
| | | } |
| | | wrapper.in("source",docIds); |
| | | return R.ok(orderDetlService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | | // 所有入库订单明细 |
| | | @RequestMapping(value = "/order/bcp/detls/pakin/page/auth") |
| | | @ManagerAuth |
| | |
| | | return R.ok(page); |
| | | } |
| | | |
| | | @RequestMapping(value = "/orderDetl/pakout/list/authV6") |
| | | @ManagerAuth |
| | | public R pakoutList6(@RequestParam(defaultValue = "1")Integer curr, |
| | | @RequestParam(defaultValue = "10")Integer limit, |
| | | @RequestParam(required = false)String orderByField, |
| | | @RequestParam(required = false)String orderByType, |
| | | @RequestParam Map<String, Object> param){ |
| | | EntityWrapper<OrderDetl> wrapper = new EntityWrapper<>(); |
| | | excludeTrash(param); |
| | | convertLike(param, wrapper); |
| | | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} else { |
| | | wrapper.orderBy("create_time", false); |
| | | } |
| | | List<DocType> pakins = docTypeService.selectList(new EntityWrapper<DocType>().eq("pakout", 1)); |
| | | List<Long> docIds = new ArrayList<>(); |
| | | for (DocType pakin : pakins) { |
| | | if (pakin.getDocId() == 37) { |
| | | docIds.add(pakin.getDocId()); |
| | | } |
| | | } |
| | | |
| | | wrapper.in("source",docIds); |
| | | Page<OrderDetl> page = orderDetlService.selectPage(new Page<>(curr, limit), wrapper); |
| | | for (OrderDetl record : page.getRecords()) { |
| | | Double sumAnfme = agvLocDetlService.getSumAnfme(record.getMatnr(), record.getThreeCode()); |
| | | record.setStock(sumAnfme == null ? 0 : sumAnfme); |
| | | } |
| | | |
| | | return R.ok(page); |
| | | } |
| | | |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){ |
| | | for (Map.Entry<String, Object> entry : map.entrySet()){ |
| | | String val = String.valueOf(entry.getValue()); |
| | |
| | | if(!staNoList.contains(locDto.getAgvStaNo())){ |
| | | return R.error(locDto.getAgvStaNo()+"该站点已有出库任务,无法选择该站点出库"); |
| | | } |
| | | |
| | | } |
| | | //如果所有库都没有库存,则返回 |
| | | for (LocDto locDto : locDtos) { |
| | |
| | | package com.zy.asrs.entity.param; |
| | | |
| | | import com.zy.asrs.entity.AgvWrkDetl; |
| | | import com.zy.asrs.entity.WrkDetl; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | |
| | | |
| | | private List<CombParam> combParams; |
| | | |
| | | private List<AgvWrkDetl> wrkDetls; |
| | | |
| | | // private List<CombParam> combParam; |
| | | |
| | | |
| | |
| | | List<String> selectCacheShelvesStationCodeByLocType(@Param("locType") Short locType, @Param("floor") int floor); |
| | | |
| | | @Select("SELECT\n" + |
| | | "\tdev_no \n" + |
| | | "FROM\n" + |
| | | "\tagv_bas_devp\n" + |
| | | "\tLEFT JOIN agv_wrk_mast ON agv_bas_devp.dev_no = agv_wrk_mast.source_loc_no \n" + |
| | | "WHERE\n" + |
| | | "\tagv_wrk_mast.loc_no IS NULL \n" + |
| | | "\tAND agv_bas_devp.loc_type1 = #{locType} \n" + |
| | | "\tAND agv_bas_devp.floor = #{floor} \n" + |
| | | "\tAND agv_bas_devp.out_enable = 'Y'") |
| | | List<String> selectCacheShelvesStationCodeByLocType2(@Param("locType") Short locType, @Param("floor") int floor); |
| | | |
| | | @Select("SELECT\n" + |
| | | "\tbas.dev_no,\n" + |
| | | "\tCOUNT ( mast.loc_no ) AS num \n" + |
| | | "FROM\n" + |
| | |
| | | @Select("select sum(a.anfme) as sum from agv_loc_detl a left join agv_loc_mast b on a.loc_no = b.loc_no where b.loc_sts = 'F' and a.matnr = #{matnr} AND a.three_code = #{threeCode} AND a.process_sts = 1") |
| | | Double selectSumAnfmeByMatnrProcess(@Param("matnr") String matnr,@Param("threeCode") String threeCode); |
| | | |
| | | @Select("select sum(a.anfme) as sum from agv_loc_detl a left join agv_loc_mast b on a.loc_no = b.loc_no where b.loc_sts = 'F' and a.matnr = #{matnr} AND a.three_code = #{threeCode} AND a.process_sts != 1 AND b.lev1 != 2") |
| | | @Select("select sum(a.anfme) as sum from agv_loc_detl a left join agv_loc_mast b on a.loc_no = b.loc_no where b.loc_sts = 'F' and a.matnr = #{matnr} AND a.three_code = #{threeCode} AND a.process_sts != 1 AND b.floor != 1") |
| | | Double selectSumAnfmeByMatnrProcessed(@Param("matnr") String matnr,@Param("threeCode") String threeCode); |
| | | |
| | | @Select("select sum(a.anfme) as sum from agv_loc_detl a left join agv_loc_mast b on a.loc_no = b.loc_no where (b.loc_sts = 'F' or b.loc_sts = 'R') and b.floor = #{floor} and a.matnr = #{matnr} AND a.three_code = #{threeCode} AND a.process_sts != 1") |
| | |
| | | |
| | | List<String> selectCacheShelvesStationCodeByFloor(int floor); |
| | | List<String> selectCacheShelvesStationCodeByLocType(short locType, int floor); |
| | | List<String> selectCacheShelvesStationCodeByLocType2(short locType, int floor); |
| | | |
| | | public List<Map<String,Object>> selectDevNoAndNumBystationCode(String stationCode); |
| | | |
| | |
| | | public List<String> selectCacheShelvesStationCodeByLocType(short locType, int floor) { |
| | | return this.baseMapper.selectCacheShelvesStationCodeByLocType(locType,floor); |
| | | } |
| | | @Override |
| | | public List<String> selectCacheShelvesStationCodeByLocType2(short locType, int floor) { |
| | | return this.baseMapper.selectCacheShelvesStationCodeByLocType2(locType,floor); |
| | | } |
| | | |
| | | public List<Map<String,Object>> selectDevNoAndNumBystationCode(String stationCode){ |
| | | return this.baseMapper.selectDevNoAndNumBystationCode(stationCode); |
| | |
| | | |
| | | List<AgvWrkDetl> agvWrkDetls = agvWrkDetlService.selectList(new EntityWrapper<AgvWrkDetl>().eq("supp_code",param.getBarcode())); |
| | | agvWrkDetls.forEach(agvWrkDetl -> { |
| | | for (AgvWrkDetl wrkDetl : param.getWrkDetls()) { |
| | | if (wrkDetl.getMatnr().equals(agvWrkDetl.getMatnr()) && wrkDetl.getThreeCode().equals(agvWrkDetl.getThreeCode())) { |
| | | agvWrkDetl.setAnfme(wrkDetl.getAnfme()); |
| | | break; |
| | | } |
| | | } |
| | | agvWrkDetl.setProcessSts(2); |
| | | agvWrkDetl.setOrderNo(agvWrkDetl.getOrderNo().substring(2)); |
| | | agvWrkDetl.setModiUser(userId); |
| | |
| | | import com.zy.common.model.TaskDto; |
| | | import com.zy.common.service.AgvCommonService; |
| | | import com.zy.common.web.BaseController; |
| | | import com.zy.system.entity.Config; |
| | | import com.zy.system.service.ConfigService; |
| | | import lombok.Synchronized; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.junit.Test; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | private AgvWrkDetlLogService agvWrkDetlLogService; |
| | | @Autowired |
| | | private WrkMastExecuteService wrkMastExecuteService; |
| | | @Autowired |
| | | private ConfigService configService; |
| | | |
| | | |
| | | /* |
| | |
| | | } |
| | | } |
| | | }); |
| | | if (isCurrLev.get()) { |
| | | agvLocMast = agvCommonService.getLocNo(locType,agvBasDevp.getFloor(),false,true); |
| | | |
| | | |
| | | Config config = configService.selectOne(new EntityWrapper<Config>().eq("code", "elevatorTasks")); |
| | | if (Cools.isEmpty(config)) { |
| | | if (isCurrLev.get()) { |
| | | agvLocMast = agvCommonService.getLocNo(locType,agvBasDevp.getFloor(),false,true); |
| | | } else { |
| | | agvLocMast = agvCommonService.getLocNo(locType,agvBasDevp.getFloor(),false,false); |
| | | } |
| | | } else { |
| | | agvLocMast = agvCommonService.getLocNo(locType,agvBasDevp.getFloor(),false,false); |
| | | List<AgvWrkMast> agvWrkMasts = agvWrkMastService.selectList(new EntityWrapper<AgvWrkMast>().like("loc_no", "02F1").like("source_loc_no", "F1")); |
| | | if (Integer.parseInt(config.getValue()) <= agvWrkMasts.size()) { |
| | | agvLocMast = agvCommonService.getLocNo(locType,agvBasDevp.getFloor(),false,true); |
| | | } else { |
| | | if (isCurrLev.get()) { |
| | | agvLocMast = agvCommonService.getLocNo(locType,agvBasDevp.getFloor(),false,true); |
| | | } else { |
| | | agvLocMast = agvCommonService.getLocNo(locType,agvBasDevp.getFloor(),false,false); |
| | | } |
| | | //agvLocMast = agvCommonService.getLocNo(locType,agvBasDevp.getFloor(),false,false); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | String devNo = agvBasDevp.getDevNo(); |
| | | String locNo = agvLocMast.getLocNo(); |
| | |
| | | updateAgvLocMast(agvLocMast,"S"); |
| | | return agvLocMast.getLocNo(); |
| | | } |
| | | |
| | | /* |
| | | 空板出库 |
| | | */ |
| | |
| | | if (Cools.isEmpty(wrkMast)){ |
| | | throw new CoolException(workNo+"工作档不存在"); |
| | | } |
| | | |
| | | if (wrkMast.getIoType() == 113 && (wrkMast.getWrkSts() != 212L || wrkMast.getWrkSts() != 213L || wrkMast.getWrkSts() != 214L)) { |
| | | throw new CoolException(workNo+"不支持手动维护"); |
| | | } |
| | | if (wrkMast.getIoType()==121){ |
| | | if (wrkMast.getWrkSts()<12L){ |
| | | agvWrkMastService.updateWrkStsByWrkNo(wrkMast.getWrkNo(),205,"手动完成",userId); |
| | |
| | | |
| | | } |
| | | |
| | | } |
| | | } |
| | |
| | | try{ |
| | | agvWrkMastHandler.startPutWayWrk(agvWrkMast); |
| | | } catch (Exception e){ |
| | | log.error("工作号"+agvWrkMast.getWrkNo()+"定时处理AGV工作档中工作状态为206,处理失败:===》异常原因:"+e.getMessage()); |
| | | log.error("工作号"+agvWrkMast.getWrkNo()+"定时处理AGV工作档中工作状态为201,处理失败:===》异常原因:"+e.getMessage()); |
| | | } |
| | | }); |
| | | } |
| | |
| | | package com.zy.asrs.task; |
| | | |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.common.Cools; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.AgvBasDevp; |
| | | import com.zy.asrs.entity.AgvLocMast; |
| | | import com.zy.asrs.entity.AgvWrkMast; |
| | |
| | | import com.zy.asrs.service.AgvWrkMastService; |
| | | import com.zy.asrs.task.core.ReturnT; |
| | | import com.zy.asrs.task.handler.AutoMoveHandler; |
| | | import com.zy.system.entity.Config; |
| | | import com.zy.system.service.ConfigService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | |
| | | private AgvWrkMastService agvWrkMastService; |
| | | @Autowired |
| | | private AgvBasDevpService agvBasDevpService; |
| | | @Autowired |
| | | private ConfigService configService; |
| | | |
| | | // 调拨出库 |
| | | // @Scheduled(cron = "0/2 * * * * ? ") |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 自动移库 |
| | | * |
| | | */ |
| | | @Scheduled(cron = "0/2 * * * * ? ") |
| | | private void autoEmptyBack7() throws ParseException { |
| | | Date now = new Date(); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | String currentDay = sdf.format(now); |
| | | Config config = configService.selectOne(new EntityWrapper<Config>().eq("code", "autoTime")); |
| | | if (Cools.isEmpty(config)) { |
| | | |
| | | } else { |
| | | if (config.getStatus().intValue() == 0) { |
| | | return; |
| | | } |
| | | JSONObject jsonObject = JSON.parseObject(config.getValue().toString()); |
| | | Integer maxTansk = jsonObject.getInteger("maxTansk"); |
| | | //Integer startTime = jsonObject.getInteger("startTime"); |
| | | String startTime = jsonObject.getString("startTime"); |
| | | long time1 = new SimpleDateFormat("yyyy-MM-dd HH:mm").parse(currentDay + " " + startTime).getTime(); |
| | | long time = now.getTime(); |
| | | long time3 = time - time1; |
| | | |
| | | |
| | | |
| | | if (time3 > 0 && time3 < (1000* 60 * 10)) { |
| | | |
| | | List<AgvWrkMast> agvWrkMasts = agvWrkMastService.selectList(new EntityWrapper<AgvWrkMast>().like("loc_no", "02F1").like("source_loc_no", "F1")); |
| | | if (maxTansk <= agvWrkMasts.size()){ |
| | | return; |
| | | } |
| | | |
| | | List<AgvLocMast> agvLocMasts = agvLocMastService.selectList( |
| | | new EntityWrapper<AgvLocMast>() |
| | | .eq("floor", 1) |
| | | .eq("lev1", 1) |
| | | .eq("loc_sts","F") |
| | | .eq("loc_type1",3)); |
| | | if (agvLocMasts.isEmpty()) { |
| | | return; |
| | | } |
| | | for (AgvLocMast agvLocMast : agvLocMasts) { |
| | | try{ |
| | | autoMoveHandler.autoTransfers(agvLocMast,maxTansk); |
| | | } catch (Exception e){ |
| | | log.error("库位号"+agvLocMast.getLocNo()+"空板自动回库 库位-接驳点 库位-吸塑车间,处理失败:===》异常原因:"+e.getMessage()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | return SUCCESS; |
| | | } |
| | | |
| | | public ReturnT<String> autoTransfers(AgvLocMast agvLocMast,Integer maxTansk) { |
| | | Date now = new Date(); |
| | | List<AgvLocDetl> locDetls = agvLocDetlService.selectList(new EntityWrapper<AgvLocDetl>().eq("loc_no", agvLocMast.getLocNo())); |
| | | locDetls.forEach(agvLocDetl -> { |
| | | if (agvLocDetl.getProcessSts().equals(1)) { |
| | | throw new CoolException("当前库位有库存未加工"); |
| | | } |
| | | }); |
| | | //查询工作档 |
| | | AgvWrkMast agvWrkMast = agvWrkMastService.selectByContainerCode(agvLocMast.getBarcode()); |
| | | if(!Cools.isEmpty(agvWrkMast)){ |
| | | throw new CoolException("当前"+agvLocMast.getBarcode()+"货架码已在工作档中"); |
| | | } |
| | | //检索库位,选择合适的库位 |
| | | AgvLocMast LocMast = agvCommonService.getLocNo(3,1,false,false); |
| | | if (LocMast.getLev1() != 2) { |
| | | throw new CoolException("目标楼层不是吸塑二楼"); |
| | | } |
| | | //生成工作档 |
| | | AgvWrkMast mast = new AgvWrkMast(); |
| | | //工作状态 |
| | | mast.setWrkSts(201L); |
| | | //入出库类型 |
| | | mast.setIoType(12); |
| | | mast.setIoTime(now); |
| | | //优先级 |
| | | mast.setIoPri(300.0); |
| | | //源站点 |
| | | mast.setSourceLocNo(agvLocMast.getLocNo()); |
| | | //目标站点 |
| | | mast.setLocNo(LocMast.getLocNo()); |
| | | //货架编码 |
| | | mast.setBarcode(agvLocMast.getBarcode()); |
| | | //货架类型 |
| | | mast.setWhsType(30); |
| | | |
| | | mast.setAppeUser(9527L); |
| | | mast.setAppeTime(now); |
| | | mast.setModiUser(9527L); |
| | | mast.setModiTime(now); |
| | | mast.setLogErrMemo("doAutoMove"); |
| | | if (!agvWrkMastService.insertByIncrease(mast)) { |
| | | throw new CoolException("保存工作档失败"); |
| | | } |
| | | |
| | | AgvWrkMast mast1 = agvWrkMastService.selectOne(new EntityWrapper<AgvWrkMast>().eq("loc_no", LocMast.getLocNo()).eq("source_loc_no",agvLocMast.getLocNo())); |
| | | //生成工作档明细 |
| | | List<AgvLocDetl> agvLocDetls = agvLocDetlService.selectList(new EntityWrapper<AgvLocDetl>().eq("loc_no", agvLocMast.getLocNo())); |
| | | agvLocDetls.forEach(agvLocDetl -> { |
| | | AgvWrkDetl wrkDetl = new AgvWrkDetl(); |
| | | wrkDetl.setWrkNo(mast1.getWrkNo()); |
| | | wrkDetl.sync(agvLocDetl); |
| | | wrkDetl.setSuppCode(agvLocDetl.getSuppCode()); |
| | | wrkDetl.setIoTime(now); |
| | | wrkDetl.setAppeUser(9527L); |
| | | wrkDetl.setAppeTime(now); |
| | | wrkDetl.setModiUser(9527L); |
| | | wrkDetl.setModiTime(now); |
| | | if (!agvWrkDetlService.insert(wrkDetl)) { |
| | | throw new CoolException("保存工作明细失败"); |
| | | } |
| | | }); |
| | | //更新目标库位状态 |
| | | updateAgvLocMast(agvLocMast,"R"); |
| | | updateAgvLocMast(LocMast,"S"); |
| | | |
| | | return SUCCESS; |
| | | } |
| | | } |