| | |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.entity.param.CombParam; |
| | | import com.zy.asrs.entity.param.MobileAdjustParam; |
| | | import com.zy.asrs.entity.param.OffSaleParam; |
| | | import com.zy.asrs.entity.result.MobileAdjustResult; |
| | | import com.zy.asrs.mapper.ManLocDetlMapper; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.common.model.LocDto; |
| | | import com.zy.common.model.TaskDto; |
| | | import com.zy.common.model.WrkDto; |
| | | import com.zy.common.model.enums.WorkNoType; |
| | | import com.zy.common.service.CommonService; |
| | | import com.zy.common.web.BaseController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | private BasDevpService basDevpService; |
| | | @Autowired |
| | | private PackService packService; |
| | | @Autowired |
| | | private ManLocDetlMapper manLocDetlMapper; |
| | | @Autowired |
| | | private CommonService commonService; |
| | | @Autowired |
| | | private StaDescService staDescService; |
| | | |
| | | |
| | | // 商品上架 |
| | | @RequestMapping("/mat/onSale/auth") |
| | | @ManagerAuth |
| | | public R matOnSale(@RequestBody CombParam combParam){ |
| | | mobileService.onSale(combParam); |
| | | return R.ok("上架成功"); |
| | | } |
| | | // 商品下架 |
| | | @RequestMapping("/mat/offSale/auth") |
| | | //@ManagerAuth |
| | | public R matOffSale(@RequestBody OffSaleParam offSaleParam){ |
| | | mobileService.offSale(offSaleParam); |
| | | return R.ok("下架成功"); |
| | | } |
| | | |
| | | |
| | | |
| | | // 组托 ---------------------------------------------------------------------------------------------------- |
| | | |
| | |
| | | } |
| | | |
| | | /** |
| | | * 出库确认 - 拣料出库 - 选择具体条码商品 |
| | | * 出库确认完成 |
| | | * @param list |
| | | * @return |
| | | */ |
| | | @RequestMapping("/pakout/confirm/pick/auth") |
| | | @ManagerAuth |
| | | public R pakoutQueryByBarcode(@RequestParam(required = false) Integer wrkNo |
| | | , @RequestParam(required = false) String matnr){ |
| | | if (Cools.isEmpty(wrkNo)) { |
| | | return R.ok(); |
| | | } |
| | | if (Cools.isEmpty(matnr)) { |
| | | return R.ok(); |
| | | } |
| | | WrkMast wrkMast = wrkMastService.selectById(wrkNo); |
| | | if (wrkMast == null) { |
| | | return R.ok(); |
| | | } |
| | | String orderNo = null; |
| | | List<WrkDetl> wrkDetls = wrkDetlService.selectByWrkNo(wrkMast.getWrkNo()); |
| | | for (WrkDetl wrkDetl : wrkDetls) { |
| | | if (Cools.isEmpty(orderNo)) { |
| | | orderNo = wrkDetl.getOrderNo(); |
| | | } |
| | | if ((wrkDetl.getMatnr() + "-" + wrkDetl.getBatch()).equals(matnr)) { |
| | | return R.ok().add(wrkDetl); |
| | | } |
| | | } |
| | | // 替换 明细 |
| | | List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>().eq("loc_no", wrkMast.getSourceLocNo())); |
| | | for (LocDetl locDetl : locDetls) { |
| | | if ((locDetl.getMatnr() + "-" + locDetl.getBatch()).equals(matnr)) { |
| | | WrkDetl wrkDetl = new WrkDetl(); |
| | | wrkDetl.sync(locDetl); |
| | | wrkDetl.setOrderNo(orderNo); |
| | | wrkDetl.setIoTime(wrkMast.getIoTime()); |
| | | wrkDetl.setWrkNo(wrkNo); |
| | | return R.ok().add(wrkDetl); |
| | | } |
| | | } |
| | | return R.error("系统错误,条码不存在"); |
| | | } |
| | | |
| | | |
| | | @RequestMapping("/pakout/confirm/auth") |
| | | @ManagerAuth |
| | | @Transactional |
| | |
| | | |
| | | for (Integer wrkNo : wrkNos) { |
| | | WrkMast wrkMast = wrkMastService.selectById(wrkNo); |
| | | if (wrkMast.getWrkSts() == 14 && (Cools.isEmpty(wrkMast.getInvWh()) || wrkMast.getInvWh().equals("N"))) { |
| | | if (wrkMast.getWrkSts() == 15 && (Cools.isEmpty(wrkMast.getInvWh()) || wrkMast.getInvWh().equals("N"))) { |
| | | List<WrkDetl> wrkDetls = wrkDetlService.selectByWrkNo(wrkNo); |
| | | boolean complete = true; |
| | | for (WrkDetl wrkDetl : wrkDetls) { |
| | |
| | | } |
| | | return R.ok("完成确认"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 补空托盘到入库缓存位 |
| | | * @param map |
| | | * @return |
| | | */ |
| | | @RequestMapping("/supplementEmpty") |
| | | @ManagerAuth |
| | | @Transactional |
| | | public R supplementEmpty(@RequestBody HashMap<String,Object> map){ |
| | | if (Cools.isEmpty(map)) { |
| | | return R.error("补空托盘库位为空"); |
| | | } |
| | | List<LocMast> locMastList=locMastService.selectList(new EntityWrapper<LocMast>().eq("loc_sts", "D")); |
| | | if (locMastList.isEmpty()) { |
| | | return R.error("立库里没有空托盘"); |
| | | } |
| | | // 获取工作号 |
| | | int workNo = commonService.getWorkNo(WorkNoType.PAKOUT.type); |
| | | |
| | | // 获取源站 |
| | | Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>() |
| | | .eq("type_no", 110) |
| | | .eq("stn_no", 102) |
| | | .eq("crn_no", locMastList.get(0).getCrnNo()); |
| | | StaDesc staDesc = staDescService.selectOne(wrapper); |
| | | Integer sourceStaNo = staDesc.getCrnStn(); |
| | | if (Cools.isEmpty(sourceStaNo)) { |
| | | throw new CoolException("检索源站失败"); |
| | | } |
| | | Date now = new Date(); |
| | | // 保存工作档 |
| | | WrkMast wrkMast = new WrkMast(); |
| | | wrkMast.setWrkNo(workNo); |
| | | wrkMast.setIoTime(now); |
| | | wrkMast.setWrkSts(11L); // 工作状态:11.生成出库ID |
| | | wrkMast.setIoType(110); // 入出库状态: 110.空板出库 |
| | | wrkMast.setIoPri(10D); |
| | | wrkMast.setSourceStaNo(sourceStaNo); // 源站 |
| | | wrkMast.setStaNo(102); // 目标站 |
| | | wrkMast.setCrnNo(locMastList.get(0).getCrnNo()); |
| | | wrkMast.setSourceLocNo(locMastList.get(0).getLocNo()); // 源库位 |
| | | wrkMast.setFullPlt("N"); // 满板:Y |
| | | wrkMast.setPicking("N"); // 拣料 |
| | | wrkMast.setExitMk("N"); // 退出 |
| | | wrkMast.setEmptyMk("Y"); // 空板 |
| | | wrkMast.setLinkMis("N"); |
| | | wrkMast.setAppeUser(getUserId()); |
| | | wrkMast.setAppeTime(now); |
| | | wrkMast.setModiUser(getUserId()); |
| | | wrkMast.setModiTime(now); |
| | | wrkMast.setMemo((String) map.get("locNo"));//agv放货位 |
| | | boolean res = wrkMastService.insert(wrkMast); |
| | | if (!res) { |
| | | throw new CoolException("保存工作档失败"); |
| | | } |
| | | // 更新库位状态 D.空板 -> R.出库预约 |
| | | if (locMastList.get(0).getLocSts().equals("D")){ |
| | | locMastList.get(0).setLocSts("R"); |
| | | locMastList.get(0).setModiUser(getUserId()); |
| | | locMastList.get(0).setModiTime(now); |
| | | if (!locMastService.updateById(locMastList.get(0))) { |
| | | throw new CoolException("更新库位状态失败"); |
| | | } |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | // 根据库位码和商品码搜索商品 |
| | | @RequestMapping("/mat/find/auth") |
| | | public R find(@RequestParam(required = false) String locNo |
| | | , @RequestParam(required = false) String matnr){ |
| | | //List<ManLocDetl> manLocDetls = manLocDetlMapper.selectItem0(locNo, matnr); |
| | | ManLocDetl manLocDetl = manLocDetlMapper.selectLocNo0(locNo, matnr); |
| | | return R.ok(manLocDetl); |
| | | //return R.ok(manLocDetlMapper.selectItem0(locNo, matnr)); |
| | | } |
| | | |
| | | /** |
| | | * 出库确认 - 拣料出库 - 选择具体条码商品 |
| | | */ |
| | | @RequestMapping("/pakout/confirm/pick/auth") |
| | | @ManagerAuth |
| | | public R pakoutQueryByBarcode(@RequestParam(required = false) Integer wrkNo |
| | | , @RequestParam(required = false) String matnr){ |
| | | if (Cools.isEmpty(wrkNo)) { |
| | | return R.ok(); |
| | | } |
| | | if (Cools.isEmpty(matnr)) { |
| | | return R.ok(); |
| | | } |
| | | WrkMast wrkMast = wrkMastService.selectById(wrkNo); |
| | | if (wrkMast == null) { |
| | | return R.ok(); |
| | | } |
| | | String orderNo = null; |
| | | List<WrkDetl> wrkDetls = wrkDetlService.selectByWrkNo(wrkMast.getWrkNo()); |
| | | for (WrkDetl wrkDetl : wrkDetls) { |
| | | if (Cools.isEmpty(orderNo)) { |
| | | orderNo = wrkDetl.getOrderNo(); |
| | | } |
| | | if ((wrkDetl.getMatnr() + "-" + wrkDetl.getBatch()).equals(matnr)) { |
| | | return R.ok().add(wrkDetl); |
| | | } |
| | | } |
| | | // 替换 明细 |
| | | List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>().eq("loc_no", wrkMast.getSourceLocNo())); |
| | | for (LocDetl locDetl : locDetls) { |
| | | if ((locDetl.getMatnr() + "-" + locDetl.getBatch()).equals(matnr)) { |
| | | WrkDetl wrkDetl = new WrkDetl(); |
| | | wrkDetl.sync(locDetl); |
| | | wrkDetl.setOrderNo(orderNo); |
| | | wrkDetl.setIoTime(wrkMast.getIoTime()); |
| | | wrkDetl.setWrkNo(wrkNo); |
| | | return R.ok().add(wrkDetl); |
| | | } |
| | | } |
| | | return R.error("系统错误,条码不存在"); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | // 盘点 ---------------------------------------------------------------------------------------------------- |
| | |
| | | } |
| | | |
| | | @PostMapping("/order/out/pakout/auth") |
| | | // @ManagerAuth(memo = "根据订单出库") |
| | | @ManagerAuth(memo = "订单出库") |
| | | public synchronized R pakoutByOrder(@RequestBody JSONObject param) { |
| | | if(!param.containsKey("staNo") || !param.containsKey("orderNo")){ |
| | | return R.parse(BaseRes.PARAM); |
| | | } |
| | | mobileService.pakoutByOrder(param,getUserId()); |
| | | return R.ok("出库成功"); |
| | | |
| | | // if (Cools.isEmpty(locDtos)) { |
| | | // return R.parse(BaseRes.PARAM); |
| | | // } |
| | | // boolean lack = true; |
| | | // for (LocDto locDto : locDtos) { |
| | | // if (!locDto.isLack()) { |
| | | // lack = false; |
| | | // break; |
| | | // } |
| | | // } |
| | | // if (lack) { |
| | | // return R.error("库存不足"); |
| | | // } |
| | | // |
| | | // Thread.sleep(1000L); |
| | | // |
| | | // List<TaskDto> taskDtos = new ArrayList<>(); |
| | | // // 根据 (库位 & 出库站) 分组; 理想状态:一组为一次出库任务 |
| | | // for (LocDto locDto : locDtos) { |
| | | // if (locDto.isLack()) { continue; } |
| | | // TaskDto taskDto = new TaskDto(locDto.getLocNo(), locDto.getStaNo(), locDto); |
| | | // if (TaskDto.has(taskDtos, taskDto)) { |
| | | // TaskDto dto = TaskDto.find(taskDtos, taskDto); |
| | | // assert dto != null; |
| | | // dto.getLocDtos().addAll(taskDto.getLocDtos()); |
| | | // } else { |
| | | // taskDtos.add(taskDto); |
| | | // } |
| | | // } |
| | | // // ----------------------------------------------------------------------------------------------- |
| | | // for (TaskDto taskDto : taskDtos) { |
| | | // BasDevp staNo = basDevpService.checkSiteStatus(taskDto.getStaNo()); |
| | | // workService.stockOut(staNo, taskDto, getUserId()); |
| | | // } |
| | | // return R.ok(); |
| | | } |
| | | |
| | | } |