| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.ArrayList; |
| | |
| | | @Autowired |
| | | private StaDescService staDescService; |
| | | |
| | | @PostMapping |
| | | @Transactional |
| | | public synchronized R getLocNo3(@RequestBody SearchLocParam param){ |
| | | log.info("收到WCS拣料入库接口请求====>>入参:{}", param); |
| | | WrkMast wrkMast = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("barcode", param.getBarcode())); |
| | | if (Cools.isEmpty(wrkMast)){ |
| | | return R.error("未找到任务"); |
| | | } |
| | | StartupDto dto = null; |
| | | // 获取目标站 |
| | | Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>() |
| | | .eq("type_no", wrkMast.getIoType() - 50) |
| | | .eq("stn_no", 31002) // 作业站点 = 拣料出库的目标站 |
| | | .eq("crn_no", wrkMast.getCrnNo()); // 堆垛机号 |
| | | StaDesc staDesc = staDescService.selectOne(wrapper); |
| | | if (Cools.isEmpty(staDesc)){ |
| | | return R.error("未找到站点路径"); |
| | | } |
| | | if (wrkMast.getWrkSts() == 14 && wrkMast.getIoType() == 103){ |
| | | try { |
| | | // 保存工作明细档历史档 |
| | | if (wrkMastService.saveWrkDetlLog(wrkMast.getWrkNo()) == 0) { |
| | | throw new CoolException("保存工作明细档历史档失败"); |
| | | } |
| | | // 保存工作主档历史档 |
| | | if (wrkMastService.saveWrkMastLog(wrkMast.getWrkNo()) == 0) { |
| | | throw new CoolException("保存工作主档历史档失败"); |
| | | } |
| | | |
| | | Date now = new Date(); |
| | | // 堆垛机站点(目标站) |
| | | Integer staNo = staDesc.getCrnStn(); |
| | | // 更新工作档数据状态 |
| | | wrkMast.setIoTime(now); |
| | | wrkMast.setIoType(wrkMast.getIoType() - 50); // 入出库类型: 103->53,104->54,107->57 |
| | | wrkMast.setWrkSts(2L); // 工作状态: 2.设备上走 |
| | | wrkMast.setSourceStaNo(wrkMast.getStaNo()); // 源站 |
| | | wrkMast.setStaNo(staNo); // 目标站 |
| | | wrkMast.setLocNo(wrkMast.getSourceLocNo()); // 目标库位 = 出库时的源库位 |
| | | wrkMast.setSourceLocNo(""); // 源库位清空 |
| | | wrkMast.setModiTime(now); |
| | | if (wrkMastService.updateById(wrkMast)) { |
| | | throw new CoolException("更新工作档数据状态失败"); |
| | | } |
| | | // 更新明细档io_time (历史档关联使用) |
| | | wrkDetlService.updateIoTime(wrkMast.getWrkNo(), now); |
| | | // 修改库位状态 Q.拣料/盘点/并板再入库 |
| | | LocMast locMast = locMastService.selectById(wrkMast.getLocNo()); |
| | | locMast.setLocSts("Q"); |
| | | locMast.setModiTime(new Date()); |
| | | if (!locMastService.updateById(locMast)) { |
| | | throw new CoolException("修改库位状态失败"); |
| | | } |
| | | dto.setWorkNo(wrkMast.getWrkNo()); |
| | | dto.setLocNo(wrkMast.getLocNo()); |
| | | return R.ok(dto); |
| | | } catch (Exception e) { |
| | | return R.error(e.getMessage()); |
| | | } |
| | | }else { |
| | | |
| | | } |
| | | return R.error(); |
| | | } |
| | | |
| | | @PostMapping("/pakin2/loc/v1") |
| | | @ResponseBody |
| | | @Transactional |