| | |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.asrs.utils.VersionUtils; |
| | | import com.zy.common.model.LocDetlDto; |
| | | import com.zy.common.model.LocTypeDto; |
| | | import com.zy.common.model.OutLocDto; |
| | | import com.zy.common.model.StartupDto; |
| | | import com.zy.common.service.CommonService; |
| | | import com.zy.ints.entity.WaitMatchk; |
| | | import com.zy.ints.entity.WaitMatout; |
| | | import com.zy.ints.service.IoCompleteService; |
| | | import com.zy.ints.service.WaitMatchkLogService; |
| | | import com.zy.ints.service.WaitMatchkService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | private WrkMastLogService wrkMastLogService; |
| | | @Autowired |
| | | private WrkDetlLogService wrkDetlLogService; |
| | | |
| | | @Autowired |
| | | private WaitMatchkService waitMatchkService; |
| | | @Autowired |
| | | private WaitMatchkLogService waitMatchkLogService; |
| | | @Autowired |
| | | private IoCompleteService ioCompleteService; |
| | | |
| | | @Override |
| | | @Transactional |
| | | //入库 |
| | | public String startupFullPutStore(FullStoreParam param, Long userId) { |
| | | // 参数非空判断 |
| | | if (Cools.isEmpty(param.getDevpNo(), param.getList())) { |
| | |
| | | int workNo = commonService.getWorkNo(DEFAULT_WORK_NO_TYPE); |
| | | // 检索库位 |
| | | List<String> matNos = param.getList().stream().map(FullStoreParam.MatCodeStore::getMatNo).distinct().collect(Collectors.toList()); |
| | | StartupDto dto = commonService.getLocNo(DEFAULT_ROW_NO_TYPE, 1, param.getDevpNo(), matNos, 0); |
| | | LocTypeDto locTypeDto = new LocTypeDto(sourceStaNo); |
| | | locTypeDto.setLocType1((short) 1); |
| | | StartupDto dto = commonService.getLocNo(DEFAULT_ROW_NO_TYPE, 1, param.getDevpNo(),false, matNos,locTypeDto, 0); |
| | | // 生成工作档 |
| | | WrkMast wrkMast = new WrkMast(); |
| | | wrkMast.setWrkNo(workNo); |
| | |
| | | } |
| | | } |
| | | if (!locDetlDtos.isEmpty()) { |
| | | // 启动出库开始 101.出库 |
| | | // 启动出库开始 101.103出库 |
| | | stockOut(staNo, locDetlDtos, null, userId); |
| | | } else { |
| | | throw new CoolException("库位产品不存在"); |
| | |
| | | |
| | | @Override |
| | | @Transactional |
| | | //出库作业 |
| | | public void stockOut(BasDevp staNo, List<LocDetlDto> locDetlDtos, Integer ioType, Long userId) { |
| | | |
| | | // 合并同类项 |
| | |
| | | } |
| | | } |
| | | dtos.add(new OutLocDto(locNo, list)); |
| | | } |
| | | //生成盘点文档 |
| | | for (LocDetlDto locDetlDto : locDetlDtos) { |
| | | |
| | | String id=""; |
| | | //获取当前时间戳 |
| | | SimpleDateFormat sf = new SimpleDateFormat("yyyyMMddHHmmss"); |
| | | String temp = sf.format(new Date()); |
| | | //获取6位随机数 |
| | | int random=(int) ((Math.random()+1)*1000); |
| | | id=temp+random; |
| | | |
| | | // String replace = UUID.randomUUID().toString().replace("-", ""); |
| | | LocDetl locDetl = locDetlDto.getLocDetl(); |
| | | //生成盘点档 |
| | | WaitMatchk waitMatchk = new WaitMatchk(); |
| | | waitMatchk.setBillNo(id);//订单编号 |
| | | waitMatchk.setLocNo(locDetl.getLocNo());//库位号 |
| | | waitMatchk.setStockQty(locDetl.getQty()); |
| | | waitMatchk.setMatNo(locDetl.getMatNo());//产品编号 |
| | | waitMatchk.setMatName(locDetl.getMatName());//铲平名称 |
| | | waitMatchk.setSeqNo(i); |
| | | waitMatchk.setIoTime(new Date()); |
| | | waitMatchk.setZpallet(locDetl.getZpallet()); |
| | | waitMatchk.setAppeUser(userId); // 操作人员数据 |
| | | waitMatchk.setAppeTime(new Date()); |
| | | waitMatchk.setModiUser(userId); |
| | | waitMatchk.setModiTime(new Date()); |
| | | if (!waitMatchkService.insert(waitMatchk)){ |
| | | throw new CoolException("保存盘点档失败"); |
| | | } |
| | | i++; |
| | | } |
| | | |
| | | // 生成工作档 |
| | |
| | | throw new CoolException("出库路径不存在"); |
| | | } |
| | | // 生成工作号 |
| | | int workNo = commonService.getWorkNo(DEFAULT_WORK_NO_TYPE); |
| | | |
| | | int rok; |
| | | if(ioType==103||ioType==107){ |
| | | rok=2; |
| | | }else{ |
| | | rok=1; |
| | | } |
| | | int workNo = commonService.getWorkNo(rok); |
| | | |
| | | // 生成工作档 |
| | | WrkMast wrkMast = new WrkMast(); |
| | |
| | | } else { |
| | | throw new CoolException(dto.getLocNo() + "库位不是在库状态"); |
| | | } |
| | | |
| | | if(ioType == 107) { |
| | | //获取当前时间戳 |
| | | SimpleDateFormat sf = new SimpleDateFormat("yyyyMMddHHmmss"); |
| | | String temp = sf.format(new Date()); |
| | | //获取3位随机数 |
| | | Random rand = new Random(); |
| | | Integer r = rand.nextInt(900) + 100; |
| | | String billNo = temp + r; |
| | | //生成盘点通知档 |
| | | for (LocDetlDto locDetlDto : locDetlDtos) { |
| | | // String replace = UUID.randomUUID().toString().replace("-", ""); |
| | | LocDetl locDetl = locDetlDto.getLocDetl(); |
| | | |
| | | //////插入盘点档前,将通知档之前相同库位数据转历史档 |
| | | List<WaitMatchk> waitMatchks = waitMatchkService.selectList(new EntityWrapper<WaitMatchk>().eq("loc_no",locDetl.getLocNo())); |
| | | for(WaitMatchk one : waitMatchks){ |
| | | waitMatchkLogService.save(one.getBillNo(),one.getLocNo(),one.getMatNo()); |
| | | waitMatchkService.delete(new EntityWrapper<WaitMatchk>().eq("bill_no",one.getBillNo()).eq("loc_no",one.getLocNo()).eq("mat_no",one.getMatNo())); |
| | | } |
| | | |
| | | //生成盘点档 |
| | | WaitMatchk waitMatchk = new WaitMatchk(); |
| | | waitMatchk.setBillNo(billNo);//订单编号 |
| | | waitMatchk.setLocNo(locDetl.getLocNo());//库位号 |
| | | waitMatchk.setStockQty(locDetl.getQty()); |
| | | waitMatchk.setMatNo(locDetl.getMatNo());//产品编号 |
| | | waitMatchk.setMatName(locDetl.getMatName());//铲平名称 |
| | | waitMatchk.setSeqNo(i); |
| | | // waitMatchk.setIoTime(new Date()); |
| | | waitMatchk.setZpallet(locDetl.getZpallet()); |
| | | waitMatchk.setAppeUser(userId); // 操作人员数据 |
| | | waitMatchk.setAppeTime(new Date()); |
| | | waitMatchk.setModiUser(userId); |
| | | waitMatchk.setModiTime(new Date()); |
| | | if (!waitMatchkService.insert(waitMatchk)) { |
| | | throw new CoolException("保存盘点档失败"); |
| | | } |
| | | i++; |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | //空板入库 |
| | | public String emptyPlateIn(Integer devpNo, Long userId) { |
| | | // 源站点状态检测 |
| | | BasDevp sourceStaNo = basDevpService.checkSiteStatus(devpNo, true); |
| | | // 生成工作号 |
| | | int workNo = commonService.getWorkNo(DEFAULT_WORK_NO_TYPE); |
| | | // 检索库位 |
| | | StartupDto dto = commonService.getLocNo(DEFAULT_ROW_NO_TYPE, 10, devpNo, null, 0); |
| | | LocTypeDto locTypeDto = new LocTypeDto(sourceStaNo); |
| | | locTypeDto.setLocType1((short) 1); |
| | | StartupDto dto = commonService.getLocNo(DEFAULT_ROW_NO_TYPE, 10, devpNo, true,null,locTypeDto, 0); |
| | | // 生成工作档 |
| | | WrkMast wrkMast = new WrkMast(); |
| | | wrkMast.setWrkNo(workNo); |
| | |
| | | |
| | | @Override |
| | | @Transactional |
| | | //空板出库 |
| | | public void emptyPlateOut(EmptyPlateOutParam param, Long userId) { |
| | | if (Cools.isEmpty(param.getOutSite())) { |
| | | throw new CoolException("站点不存在"); |
| | | } |
| | | for (String locNo : param.getLocNos()) { |
| | | // 获取工作号 |
| | | int workNo = commonService.getWorkNo(DEFAULT_WORK_NO_TYPE); |
| | | int workNo = commonService.getWorkNo(1); |
| | | // 获取库位 |
| | | LocMast locMast = locMastService.selectById(locNo); |
| | | if (Cools.isEmpty(locMast)) { |
| | | throw new CoolException(locNo+"库位不存在"); |
| | | } |
| | | |
| | | // 获取源站 |
| | | Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>() |
| | | .eq("type_no", 110) |
| | |
| | | |
| | | @Override |
| | | @Transactional |
| | | //盘点出库 |
| | | public void locCheckOut(StockOutParam param, Long userId) { |
| | | // 目标站点状态检测 |
| | | BasDevp staNo = basDevpService.checkSiteStatus(param.getOutSite()); |
| | |
| | | } else if (wrkMast.getWrkSts() > 10) { |
| | | wrkMast.setWrkSts(14L); |
| | | } |
| | | |
| | | // 完成操作人员记录 |
| | | wrkMast.setManuType("手动完成"); |
| | | Date now = new Date(); |
| | |
| | | throw new CoolException("库位不存在"); |
| | | } |
| | | //查询库位状态 |
| | | if (locMast.getLocSts().equals("O")){ |
| | | if (locMast.getLocSts().equals("O") || locMast.getLocSts().equals("D")){ |
| | | //更新库位状态 |
| | | locMast.setLocSts("F"); |
| | | // boolean b = locMastService.updateById(locMast); |