| | |
| | | import com.zy.asrs.entity.param.LocMastInitParam; |
| | | import com.zy.asrs.mapper.LocDetlMapper; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.asrs.utils.LocAliasUtils; |
| | | import com.zy.common.entity.Parameter; |
| | | import com.zy.common.model.Shelves; |
| | | import com.zy.common.service.CommonService; |
| | |
| | | if (entry.getKey().equals("loc_type1")){ |
| | | sign=true; |
| | | } |
| | | wrapper.like(entry.getKey(), val); |
| | | if (entry.getKey().equals("loc_no")){ |
| | | wrapper.andNew().like("loc_no", val).or().like("loc_alias", val); |
| | | } else if (entry.getKey().equals("area_id")) { |
| | | wrapper.eq(entry.getKey(), val); |
| | | } else { |
| | | wrapper.like(entry.getKey(), val); |
| | | } |
| | | } |
| | | } |
| | | if (sign){ |
| | |
| | | locMast.setModiTime(new Date()); |
| | | locMast.setAppeUser(getUserId()); |
| | | locMast.setAppeTime(new Date()); |
| | | locMastService.prepareAreaAlias(locMast); |
| | | locMastService.insert(locMast); |
| | | return R.ok(); |
| | | } |
| | |
| | | } |
| | | |
| | | LocMast oldLocMast = locMastService.selectById(locMast.getLocNo()); |
| | | if (locMast.getAreaId() == null && oldLocMast != null) { |
| | | locMast.setAreaId(oldLocMast.getAreaId()); |
| | | } |
| | | if (locMast.getFrozen() == null && oldLocMast != null) { |
| | | locMast.setFrozen(oldLocMast.getFrozen()); |
| | | } |
| | | if (locMast.getFrozenMemo() == null && oldLocMast != null) { |
| | | locMast.setFrozenMemo(oldLocMast.getFrozenMemo()); |
| | | } |
| | | if (locMast.getLocSts().equals("F") && (oldLocMast.getLocSts().equals("D") || oldLocMast.getLocSts().equals("O"))) { |
| | | return R.error("当前操作已被阻止,请联系管理员"); |
| | | } |
| | |
| | | } |
| | | locMast.setModiUser(getUserId()); |
| | | locMast.setModiTime(now); |
| | | locMastService.prepareAreaAlias(locMast); |
| | | AdjDetl adjDetl = new AdjDetl(); |
| | | adjDetl.setLocNo(locMast.getLocNo()); |
| | | adjDetl.setMatnr("原库位状态:" + oldLocMast.getLocSts()); |
| | |
| | | throw new CoolException("库位调整记录失败"); |
| | | } |
| | | // 库位冻结->冻结所有库存 |
| | | if (locMast.getFrozen() == 1 && oldLocMast.getFrozen() == 0 && locMast.getLocSts().equals("F") && oldLocMast.getLocSts().equals("F")) { |
| | | if (Integer.valueOf(1).equals(locMast.getFrozen()) |
| | | && Integer.valueOf(0).equals(oldLocMast.getFrozen()) |
| | | && locMast.getLocSts().equals("F") |
| | | && oldLocMast.getLocSts().equals("F")) { |
| | | locDetlMapper.updateDetlFrozenByLocNo(oldLocMast.getLocNo()); |
| | | } |
| | | if(!locMastService.updateById(locMast)) { |
| | | throw new CoolException("服务器错误,请联系管理员"); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PostMapping(value = "/locMast/batch/area/auth") |
| | | @ManagerAuth(memo = "批量修改库区") |
| | | public R batchArea(@RequestBody JSONObject param) { |
| | | if (Cools.isEmpty(param) || Cools.isEmpty(param.getJSONArray("locNos"))) { |
| | | return R.error("请选择库位"); |
| | | } |
| | | List<String> locNos = JSONObject.parseArray(param.getJSONArray("locNos").toJSONString(), String.class); |
| | | Integer areaId = param.getInteger("areaId"); |
| | | locMastService.batchUpdateArea(locNos, areaId, getUserId()); |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | @ManagerAuth |
| | | public R query(String condition) { |
| | | EntityWrapper<LocMast> wrapper = new EntityWrapper<>(); |
| | | wrapper.like("loc_no", condition); |
| | | wrapper.andNew().like("loc_no", condition).or().like("loc_alias", condition); |
| | | Page<LocMast> page = locMastService.selectPage(new Page<>(0, 10), wrapper); |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | for (LocMast locMast : page.getRecords()){ |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("id", locMast.getLocNo()); |
| | | map.put("value", locMast.getLocNo()); |
| | | map.put("value", LocAliasUtils.displayLocNo(locMast)); |
| | | result.add(map); |
| | | } |
| | | return R.ok(result); |
| | |
| | | } |
| | | } |
| | | } |
| | | locMastService.fillAreaAlias(list); |
| | | if (!Cools.isEmpty(param.getEnable()) && param.getEnable() == 1){ |
| | | locMastService.delete(new EntityWrapper<>()); |
| | | } |