| | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.Cools; |
| | | import com.core.common.DateUtils; |
| | | import com.core.common.R; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.entity.param.GlobleParameter; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.asrs.utils.PlaExcelListener; |
| | | import com.zy.asrs.utils.SaasUtils; |
| | |
| | | excludeTrash(param); |
| | | EntityWrapper<Pla> wrapper = new EntityWrapper<>(); |
| | | convert(param, wrapper); |
| | | wrapper.orderBy("pakin_time",false); |
| | | wrapper.orderBy("modify_time",false); |
| | | allLike(Pla.class, param.keySet(), wrapper, condition); |
| | | return R.ok(plaService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | } |
| | |
| | | System.out.println(plas.toString()); |
| | | plas.forEach(pla -> { |
| | | Pla plaSave = plaService.selectById(pla.getId()); |
| | | pla.setModifyTime(new Date()); |
| | | plaService.updateById(pla); |
| | | |
| | | PlaLog plaLog = new PlaLog(); |
| | | BeanUtils.copyProperties(plaSave,plaLog); |
| | | plaLog.setId(null); |
| | | plaLog.setCreateTime(new Date()); |
| | | plaLogService.insert(plaLog); |
| | | plaService.updateById(pla); |
| | | |
| | | }); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/pla/delete/auth") |
| | | @ManagerAuth |
| | | public R delete(@RequestBody List<Pla> plas) { |
| | | System.out.println(plas.toString()); |
| | | plas.forEach(pla -> { |
| | | if(!pla.getStatus().equals(GlobleParameter.PLA_STATUS_00) || pla.getStatus().equals(GlobleParameter.PLA_STATUS_0)){ |
| | | throw new CoolException("非待入库的数据无法被删除"); |
| | | } |
| | | Pla plaSave = plaService.selectById(pla.getId()); |
| | | pla.setModifyTime(new Date()); |
| | | plaService.deleteById(pla.getId()); |
| | | |
| | | PlaLog plaLog = new PlaLog(); |
| | | BeanUtils.copyProperties(plaSave,plaLog); |
| | | plaLog.setId(null); |
| | | plaLog.setCreateTime(new Date()); |
| | | plaLogService.insert(plaLog); |
| | | |
| | | }); |
| | | return R.ok(); |
| | | } |
| | |
| | | |
| | | for (Pla pla : plas){ |
| | | |
| | | if(pla.getStockFreeze() == 0){ |
| | | throw new CoolException("库存已被冻结,请重新选择库存"); |
| | | } |
| | | |
| | | allOrderWeight += pla.getOrderWeight(); |
| | | |
| | | if(pla.getWeightAnfme() - pla.getQtyAnfme() - pla.getOrderWeight() < 0){ |
| | |
| | | } |
| | | pla.setQtyAnfme(pla.getQtyAnfme() + pla.getOrderWeight()); |
| | | pla.setHandlerBy(getUser().getUsername()); |
| | | pla.setStatus("待出库"); |
| | | pla.setStatus(GlobleParameter.PLA_STATUS_2); |
| | | pla.setModifyTime(new Date()); |
| | | pla.setPakoutTime(pla.getPakoutTime().split("\\(")[0]); |
| | | //生成此次作业信息 |
| | | PlaQty plaQty = new PlaQty(); |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/pla/viladate/auth") |
| | | @ManagerAuth |
| | | public R viladate(@RequestBody List<Pla> plas) { |
| | | plaService.viladate(plas,getUser()); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/pla/rework/auth") |
| | | @ManagerAuth |
| | | public R rework(@RequestBody List<Pla> plas) { |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/pla/updateStockFreeze") |
| | | @Transactional |
| | | @ManagerAuth(memo = "库位冻结") |
| | | public R updateStockFreeze(@RequestBody List<Pla> plas){ |
| | | if (Cools.isEmpty(plas)){ |
| | | return R.error("无数据"); |
| | | } |
| | | for (Pla pla : plas){ |
| | | if (pla.getStockFreeze() == 0){ |
| | | throw new CoolException("库存已被冻结!"); |
| | | } |
| | | pla.setStockFreeze(0); |
| | | pla.setStockFreezeBy(getUser().getUsername()); |
| | | pla.setStockFreezeDate(new Date()); |
| | | pla.setModifyTime(new Date()); |
| | | plaService.updateById(pla); |
| | | } |
| | | return R.ok("冻结成功"); |
| | | } |
| | | |
| | | @RequestMapping(value = "/pla/updateStockDisFreeze") |
| | | @ManagerAuth(memo = "库位解冻") |
| | | public R updateStockDisFreeze(@RequestBody List<Pla> plas){ |
| | | if (Cools.isEmpty(plas)){ |
| | | return R.error("无数据"); |
| | | } |
| | | for (Pla pla : plas){ |
| | | if (pla.getStockFreeze() == 1){ |
| | | throw new CoolException("库位未冻结,无需解冻"); |
| | | } |
| | | if(!Cools.eq(pla.getStockFreezeBy(),getUser().getUsername())){ |
| | | throw new CoolException("无法解冻其他用户冻结的库位"); |
| | | } |
| | | pla.setStockFreeze(1); |
| | | pla.setStockFreezeBy(getUser().getUsername()); |
| | | pla.setStockFreezeDate(new Date()); |
| | | pla.setModifyTime(new Date()); |
| | | plaService.updateById(pla); |
| | | |
| | | } |
| | | return R.ok("解除冻结成功"); |
| | | } |
| | | |
| | | /** |
| | | * excel导入模板下载 |
| | | */ |