| | |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.common.entity.Parameter; |
| | | import com.zy.common.model.Shelves; |
| | | import com.zy.common.service.CommonService; |
| | | import com.zy.common.web.BaseController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | |
| | | @Resource |
| | | private LocDetlMapper locDetlMapper; |
| | | |
| | | @Resource |
| | | private CommonService commonService; |
| | | |
| | | @Resource |
| | | private WrkMastLogService wrkMastLogService; |
| | | |
| | | @Resource |
| | | private WrkDetlLogService wrkDetlLogService; |
| | | |
| | | @RequestMapping(value = "/locMast/init/pwd") |
| | | public R locMastInitPwd(@RequestParam(required = false) String pwd) { |
| | |
| | | excludeTrash(param); |
| | | EntityWrapper<LocMast> wrapper = new EntityWrapper<>(); |
| | | convert(param, wrapper); |
| | | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} |
| | | return R.ok(locMastService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | | @RequestMapping(value = "/locMast/emptyList/auth") |
| | | @ManagerAuth |
| | | public R emptyList(@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){ |
| | | excludeTrash(param); |
| | | EntityWrapper<LocMast> wrapper = new EntityWrapper<>(); |
| | | convert(param, wrapper); |
| | | wrapper.in("loc_sts","Z","M"); |
| | | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} |
| | | return R.ok(locMastService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | } |
| | |
| | | return R.error(); |
| | | } |
| | | |
| | | WrkMast wrkMast = wrkMastService.selectOne(new EntityWrapper<WrkMast>() |
| | | .eq("source_loc_no", locMast.getLocNo()) |
| | | .or().eq("loc_no", locMast.getLocNo())); |
| | | if(!Cools.isEmpty(wrkMast)){ |
| | | return R.error("该库位正在作业,请先处理工作档"); |
| | | } |
| | | // WrkMast wrkMast = wrkMastService.selectOne(new EntityWrapper<WrkMast>() |
| | | // .eq("source_loc_no", locMast.getLocNo()) |
| | | // .or().eq("loc_no", locMast.getLocNo())); |
| | | // if(!Cools.isEmpty(wrkMast)){ |
| | | // return R.error("该库位正在作业,请先处理工作档"); |
| | | // } |
| | | |
| | | LocMast oldLocMast = locMastService.selectById(locMast.getLocNo()); |
| | | if (locMast.getLocSts().equals("F") && (oldLocMast.getLocSts().equals("D") || oldLocMast.getLocSts().equals("O"))) { |
| | |
| | | if (oldLocMast.getLocSts().equals("R") || oldLocMast.getLocSts().equals("F") || oldLocMast.getLocSts().equals("S")) { |
| | | if (locMast.getLocSts().equals("O") || locMast.getLocSts().equals("D")) { |
| | | List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>().eq("loc_no", locMast.getLocNo())); |
| | | // 添加历史工作主档 |
| | | WrkMastLog wrkMastLog = new WrkMastLog(); |
| | | wrkMastLog.setWrkNo(commonService.getWorkNo(3)); |
| | | wrkMastLog.setIoTime(now); |
| | | wrkMastLog.setWrkSts(5); |
| | | wrkMastLog.setIoType(19); |
| | | wrkMastLog.setIoPri(13D); // 优先级 |
| | | wrkMastLog.setCrnNo(locMast.getCrnNo()); |
| | | wrkMastLog.setSourceLocNo(locMast.getLocNo()); |
| | | wrkMastLog.setLocNo(locMast.getLocNo()); |
| | | wrkMastLog.setBarcode(locMast.getBarcode()); // 托盘码 |
| | | wrkMastLog.setFullPlt("Y"); // 满板:Y |
| | | wrkMastLog.setPicking("N"); // 拣料 |
| | | wrkMastLog.setExitMk("N"); // 退出 |
| | | wrkMastLog.setEmptyMk("N"); // 空板 |
| | | wrkMastLog.setLinkMis("Y"); |
| | | // 操作人员数据 |
| | | wrkMastLog.setAppeTime(now); |
| | | wrkMastLog.setModiTime(now); |
| | | wrkMastLog.setAppeUser(getUserId()); |
| | | wrkMastLog.setModiUser(getUserId()); |
| | | boolean res = wrkMastLogService.insert(wrkMastLog); |
| | | if (!res) { |
| | | throw new CoolException("保存工作档失败"); |
| | | } |
| | | for (LocDetl locDetl : locDetls) { |
| | | // 保存调整记录 |
| | | AdjDetl adjDetl = new AdjDetl(); |
| | |
| | | if (!adjDetlService.insert(adjDetl)) { |
| | | throw new CoolException("服务器错误,请联系管理员"); |
| | | } |
| | | |
| | | // 添加历史工作明细 |
| | | WrkDetlLog wrkDetl = new WrkDetlLog(); |
| | | wrkDetl.sync(locDetl); |
| | | wrkDetl.setWrkNo(wrkMastLog.getWrkNo()); |
| | | wrkDetl.setIoTime(wrkMastLog.getIoTime()); |
| | | wrkDetl.setAnfme(0.0); |
| | | wrkDetl.setAppeTime(now); |
| | | wrkDetl.setModiTime(now); |
| | | wrkMastLog.setAppeUser(getUserId()); |
| | | wrkMastLog.setModiUser(getUserId()); |
| | | if (!wrkDetlLogService.insert(wrkDetl)) { |
| | | throw new CoolException("保存工作明细失败"); |
| | | } |
| | | } |
| | | if (!locDetlService.delete(new EntityWrapper<LocDetl>().eq("loc_no", locMast.getLocNo()))) { |
| | | throw new CoolException("服务器错误,请联系管理员"); |