| | |
| | | import com.zy.asrs.entity.param.LocMastInitParam; |
| | | import com.zy.asrs.service.LocDetlService; |
| | | import com.zy.asrs.service.LocMastService; |
| | | import com.zy.asrs.utils.Utils; |
| | | 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.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.*; |
| | |
| | | } |
| | | |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){ |
| | | boolean sign = false; |
| | | for (Map.Entry<String, Object> entry : map.entrySet()){ |
| | | String val = String.valueOf(entry.getValue()); |
| | | if (val.contains(RANGE_TIME_LINK)){ |
| | | String[] dates = val.split(RANGE_TIME_LINK); |
| | | wrapper.ge(entry.getKey(), DateUtils.convert(dates[0])); |
| | | wrapper.le(entry.getKey(), DateUtils.convert(dates[1])); |
| | | } else { |
| | | } else if (entry.getKey().equals("loc_no")){ |
| | | wrapper.like(entry.getKey(), val); |
| | | } else { |
| | | if (entry.getKey().equals("loc_type1")){ |
| | | sign=true; |
| | | } |
| | | wrapper.eq(entry.getKey(), val); |
| | | } |
| | | } |
| | | if (sign){ |
| | | wrapper.and().ne("loc_sts","Y"); |
| | | } |
| | | } |
| | | |
| | |
| | | return R.error(); |
| | | } |
| | | LocMast oldLocMast = locMastService.selectById(locMast.getLocNo()); |
| | | if (locMast.getLocSts().equals("F") && (oldLocMast.getLocSts().equals("D") || oldLocMast.getLocSts().equals("O"))) { |
| | | return R.error("当前操作已被阻止,请联系管理员"); |
| | | } |
| | | // 有物料时修改为空库位或者空板库位,则删除库存明细 |
| | | if (oldLocMast.getLocType().equals("R") || oldLocMast.getLocType().equals("F")) { |
| | | if (locMast.getLocType().equals("O") || locMast.getLocType().equals("D")) { |
| | | if (oldLocMast.getLocSts().equals("R") || oldLocMast.getLocSts().equals("F")) { |
| | | if (locMast.getLocSts().equals("O") || locMast.getLocSts().equals("D")) { |
| | | locDetlService.delete(new EntityWrapper<LocDetl>().eq("loc_no", locMast.getLocNo())); |
| | | } |
| | | } |
| | |
| | | break; |
| | | } |
| | | } |
| | | Date now = new Date(); |
| | | LocMast locMast = new LocMast(); |
| | | locMast.setLocNo(locNo); |
| | | locMast.setLocType("O"); |
| | | locMast.setLocSts("O"); |
| | | locMast.setRow1(r); // 排 |
| | | locMast.setBay1(b); // 列 |
| | | locMast.setLev1(l); // 层 |
| | | locMast.setCrnNo(crnNo); // 堆垛机 |
| | | if (null != param.getWhsType()) { |
| | | locMast.setWhsType(Long.valueOf(param.getWhsType())); |
| | | } |
| | | locMast.setLocType1(!Cools.isEmpty(param.getLocType1()) ? param.getLocType1() : 1); |
| | | locMast.setLocType2(param.getLocType2()); |
| | | locMast.setLocType3(param.getLocType3()); |
| | | locMast.setAppeUser(getUserId()); |
| | | locMast.setAppeTime(new Date()); |
| | | locMast.setAppeTime(now); |
| | | locMast.setModiUser(getUserId()); |
| | | locMast.setModiTime(new Date()); |
| | | locMast.setModiTime(now); |
| | | list.add(locMast); |
| | | } |
| | | } |
| | |
| | | locMastService.insertBatch(list); |
| | | return R.ok("初始化成功"); |
| | | } |
| | | |
| | | @RequestMapping(value = "/locMast/convert/size/auth") |
| | | @ManagerAuth(memo = "大小库位转换") |
| | | @Transactional |
| | | public R convertSize(@RequestParam String param) { |
| | | List<LocMast> list = JSONArray.parseArray(param, LocMast.class); |
| | | if (Cools.isEmpty(list)){ |
| | | return R.error(); |
| | | } |
| | | for (LocMast entity : list){ |
| | | if (!entity.getCrnNo().equals(1) && !entity.getCrnNo().equals(4)){ |
| | | return R.error("请选择1号、4号堆垛机的货位!!!不符合条件库位:"+entity.getLocNo()); |
| | | } |
| | | if (!entity.getLocSts().equals("O") && !entity.getLocSts().equals("Y")){ |
| | | return R.error("请选择空闲、被合并的货位!!!不符合条件库位:"+entity.getLocNo()); |
| | | } |
| | | } |
| | | List<String> innermostSideLoc = Utils.getInnermostSideLoc(list); |
| | | StringBuilder msg=new StringBuilder(); |
| | | for (String locNo : innermostSideLoc){ |
| | | String innermostSideLocLBR = Utils.getInnermostSideLocLBR(locNo); |
| | | LocMast locMast1 = locMastService.selectById(innermostSideLocLBR);//浅 |
| | | if (Cools.isEmpty(locMast1)){ |
| | | msg.append("请选择浅库位存在的货位!!!不符合条件库位:").append(innermostSideLocLBR).append("/n"); |
| | | continue; |
| | | } |
| | | if (!locMast1.getLocSts().equals("O")){ |
| | | msg.append("请选择浅库位空闲的货位!!!不符合条件库位:").append(locMast1.getLocNo()).append("/n"); |
| | | continue; |
| | | } |
| | | LocMast locMast = locMastService.selectById(locNo);//深 |
| | | if (Cools.isEmpty(locMast)){ |
| | | msg.append("请选择深库位存在的货位!!!不符合条件库位:").append(locNo).append("/n"); |
| | | continue; |
| | | } |
| | | if (!Cools.isEmpty(locMast) && locMast.getLocSts().equals("O")){ |
| | | locMast1.setLocType1((short)2); |
| | | locMast.setLocType1((short)2); |
| | | locMast.setLocSts("Y"); |
| | | }else if (!Cools.isEmpty(locMast) && locMast.getLocSts().equals("Y")){ |
| | | locMast1.setLocType1((short)1); |
| | | locMast.setLocType1((short)1); |
| | | locMast.setLocSts("O"); |
| | | }else { |
| | | msg.append("请选择深库位库位空闲、被合并的货位!!!不符合条件库位:").append(locMast.getLocNo()).append("/n"); |
| | | continue; |
| | | } |
| | | locMastService.updateById(locMast1); |
| | | locMastService.updateById(locMast); |
| | | } |
| | | return R.ok(msg); |
| | | } |
| | | } |