| | |
| | | import com.core.common.Cools; |
| | | import com.core.common.DateUtils; |
| | | import com.core.common.R; |
| | | import com.zy.asrs.entity.LocDetl; |
| | | import com.zy.asrs.entity.LocMast; |
| | | import com.zy.asrs.entity.param.LocMastInitParam; |
| | | import com.zy.asrs.service.LocDetlService; |
| | | import com.zy.asrs.service.LocMastService; |
| | | import com.zy.asrs.service.WrkMastService; |
| | | import com.zy.common.entity.Parameter; |
| | | import com.zy.common.model.Shelves; |
| | | import com.zy.common.web.BaseController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | |
| | | @Autowired |
| | | private LocMastService locMastService; |
| | | @Autowired |
| | | private LocDetlService locDetlService; |
| | | |
| | | @RequestMapping(value = "/locMast/init/pwd") |
| | | public R locMastInitPwd(@RequestParam(required = false) String pwd) { |
| | | if (Cools.isEmpty(pwd)) { |
| | | return R.error("请输入口令"); |
| | | } |
| | | return R.ok().add(Parameter.get().getLocMastInitPwd().equals(pwd)); |
| | | } |
| | | |
| | | @PostMapping(value = "/group/empty/stock") |
| | | @ManagerAuth(memo = "获取同组货架的空库位") |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/locMast/update/auth") |
| | | @ManagerAuth(memo = "库位修改") |
| | | public R update(LocMast locMast){ |
| | | if (Cools.isEmpty(locMast) || null==locMast.getLocNo()){ |
| | | return R.error(); |
| | | } |
| | | if (!Cools.isEmpty(locMast.getContainerCode())){ |
| | | locMast.setBarcode(locMast.getContainerCode()); |
| | | } |
| | | |
| | | if (locMast.getEmptyContainer$().equals("N") ){ |
| | | if (locMast.getContainerCode().isEmpty() || locMast.getContainerTypeCode().isEmpty()){ |
| | | return R.error("容器编码或容器类型有误"); |
| | | } |
| | | } |
| | | if (locMast.getLocSts().equals("O")){ |
| | | locMast.setBarcode(null); |
| | | } |
| | | locMast.setModiUser(getUserId()); |
| | | locMast.setModiTime(new Date()); |
| | | locMastService.updateById(locMast); |
| | | locMastService.toWmsLocStatus(locMast); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/locMast/init/auth") |
| | | @ManagerAuth(memo = "初始化库位") |
| | | // @Transactional |
| | | public R init(LocMastInitParam param) { |
| | | List<LocMast> list = new ArrayList<>(); |
| | | for (int r=param.getStartRow(); r<=param.getEndRow(); r++){ |
| | | for (int b=param.getStartBay(); b<=param.getEndBay(); b++) { |
| | | for (int l=param.getStartLev(); l<=param.getEndLev(); l++) { |
| | | // 获取库位号 |
| | | String locNo = String.format("%02d", r) + String.format("%03d", b) + String.format("%02d", l); |
| | | // 获取堆垛机号 |
| | | int crnNo = 0; |
| | | // Shelves shelves = new Shelves(param.getEndRow() - param.getStartRow() + 1, param.getCrnAmount()); |
| | | // for (List<Integer> node : shelves.nodes){ |
| | | // if (node.contains(r)) { |
| | | // crnNo = shelves.nodes.indexOf(node) + 1; |
| | | // break; |
| | | // } |
| | | // } |
| | | Date now = new Date(); |
| | | LocMast locMast = new LocMast(); |
| | | locMast.setLocNo(locNo); |
| | | locMast.setLocSts("O"); |
| | | locMast.setRow1(r); // 排 |
| | | locMast.setBay1(b); // 列 |
| | | locMast.setLev1(l); // 层 |
| | | locMast.setCrnNo(crnNo); // 堆垛机 |
| | | locMast.setLocType1(!Cools.isEmpty(param.getLocType1()) ? param.getLocType1() : 1); |
| | | locMast.setLocType2(param.getLocType2()); |
| | | locMast.setLocType3(param.getLocType3()); |
| | | locMast.setAppeUser(getUserId()); |
| | | locMast.setAppeTime(now); |
| | | locMast.setModiUser(getUserId()); |
| | | locMast.setModiTime(now); |
| | | list.add(locMast); |
| | | } |
| | | } |
| | | } |
| | | locMastService.delete(new EntityWrapper<>()); |
| | | locDetlService.delete(new EntityWrapper<>()); |
| | | locMastService.insertBatch(list); |
| | | return R.ok("初始化成功"); |
| | | } |
| | | |
| | | } |