| | |
| | | import com.zy.asrs.framework.common.R;
|
| | | import com.zy.asrs.wms.asrs.entity.Loc;
|
| | | import com.zy.asrs.wms.asrs.entity.enums.LocStsType;
|
| | | import com.zy.asrs.wms.asrs.entity.param.LocMastInitParam;
|
| | | import com.zy.asrs.wms.asrs.service.LocService;
|
| | | import com.zy.asrs.wms.common.annotation.OperationLog;
|
| | | import com.zy.asrs.wms.common.domain.BaseParam;
|
| | |
| | | @GetMapping("/locMap/getData/{lev}/auth")
|
| | | public R getMapData(@PathVariable("lev") Integer lev) {
|
| | | LocMap locMap = locMapService.getOne(new LambdaQueryWrapper<LocMap>().eq(LocMap::getMapLev, lev));
|
| | | if (locMap == null) {
|
| | | return R.ok();
|
| | | }
|
| | | //解析json地图数据
|
| | | List<ArrayList> arrayLists = JSON.parseArray(locMap.getData(), ArrayList.class);
|
| | |
|
| | |
| | | @OperationLog("初始化库位")
|
| | | @PostMapping("/locMap/init")
|
| | | @Transactional
|
| | | public R init(@RequestBody LocMap locMap) {
|
| | | Integer mapLev = locMap.getMapLev();
|
| | | public R init(@RequestBody LocMastInitParam param) {
|
| | | // Integer mapLev = locMap.getMapLev();
|
| | |
|
| | | locService.remove(new LambdaQueryWrapper<Loc>().eq(Loc::getLev1, mapLev));
|
| | | // locService.remove(new LambdaQueryWrapper<Loc>().eq(Loc::getLev1, mapLev));
|
| | |
|
| | | //解析json地图数据
|
| | | List<ArrayList> arrayLists = JSON.parseArray(locMap.getData(), ArrayList.class);
|
| | | int rowIdx = 0;
|
| | | for (ArrayList row : arrayLists) {
|
| | | int bayIdx = 0;
|
| | | for (Object bay : row) {
|
| | | JSONObject data = JSON.parseObject(JSON.toJSONString(bay));
|
| | | if (data.getInteger("value") == 0) {
|
| | | // List<ArrayList> arrayLists = JSON.parseArray(locMap.getData(), ArrayList.class);
|
| | | // int rowIdx = 0;
|
| | | // for (ArrayList row : arrayLists) {
|
| | | // int bayIdx = 0;
|
| | | // for (Object bay : row) {
|
| | | // JSONObject data = JSON.parseObject(JSON.toJSONString(bay));
|
| | | // if (data.getInteger("value") == 0) {
|
| | | // Loc loc = new Loc();
|
| | | // loc.setRow1(rowIdx);
|
| | | // loc.setBay1(bayIdx);
|
| | | // loc.setLev1(mapLev);
|
| | | // loc.setLocStsId(LocStsType.O.val());
|
| | | // loc.setLocNo(Utils.getPlatLocNo(rowIdx, bayIdx, mapLev));
|
| | | // locService.save(loc);
|
| | | // }
|
| | | // bayIdx++;
|
| | | // }
|
| | | // rowIdx++;
|
| | | // }
|
| | |
|
| | | List<Loc> list = new ArrayList<>();
|
| | | Integer chanl = 0; //默认第一巷道
|
| | | for (int r = param.getStartRow(); r <= param.getEndRow(); r++) {
|
| | | // if (r % param.getChannel() == 1) {
|
| | | // chanl ++;
|
| | | // }
|
| | | for (int b = param.getStartBay(); b <= param.getEndBay(); b++) {
|
| | | for (int l = param.getStartLev(); l <= param.getEndLev(); l++) {
|
| | | // 获取库位号
|
| | | String locNo = Utils.getPlatLocNo(r, b, l);
|
| | | Loc loc = new Loc();
|
| | | loc.setRow1(rowIdx);
|
| | | loc.setBay1(bayIdx);
|
| | | loc.setLev1(mapLev);
|
| | | loc.setRow1(r);
|
| | | loc.setBay1(b);
|
| | | loc.setLev1(l);
|
| | | loc.setLocStsId(LocStsType.O.val());
|
| | | loc.setLocNo(Utils.getLocNo(rowIdx, bayIdx, mapLev));
|
| | | loc.setLocNo(locNo);
|
| | | locService.save(loc);
|
| | | list.add(loc);
|
| | | }
|
| | | bayIdx++;
|
| | | }
|
| | | rowIdx++;
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | | return R.ok("添加成功");
|
| | | }
|
| | |
|