| | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.zy.asrs.entity.LocMast; |
| | | import com.zy.asrs.service.LocMastService; |
| | | import com.zy.common.web.BaseController; |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.BaseRes; |
| | | import com.core.common.Cools; |
| | | import com.core.common.DateUtils; |
| | | import com.core.common.R; |
| | | import com.zy.asrs.entity.LocMast; |
| | | import com.zy.asrs.entity.param.LocMastInitParam; |
| | | import com.zy.asrs.service.LocMastService; |
| | | 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.*; |
| | | |
| | |
| | | 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; |
| | | } |
| | | } |
| | | LocMast locMast = new LocMast(); |
| | | locMast.setLocNo(locNo); |
| | | locMast.setLocType("O"); |
| | | locMast.setRow1(r); // 排 |
| | | locMast.setBay1(b); // 列 |
| | | locMast.setLev1(l); // 层 |
| | | locMast.setCrnNo(crnNo); // 堆垛机 |
| | | if (null != param.getWhsType()) { |
| | | locMast.setWhsType(Long.valueOf(param.getWhsType())); |
| | | } |
| | | locMast.setAppeUser(getUserId()); |
| | | locMast.setAppeTime(new Date()); |
| | | locMast.setModiUser(getUserId()); |
| | | locMast.setModiTime(new Date()); |
| | | list.add(locMast); |
| | | } |
| | | } |
| | | } |
| | | locMastService.delete(new EntityWrapper<>()); |
| | | locMastService.insertBatch(list); |
| | | return R.ok("初始化成功"); |
| | | } |
| | | } |