| | |
| | | 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; |
| | |
| | | |
| | | for (Pla pla : plas){ |
| | | |
| | | if(pla.getStockFreeze() == 0){ |
| | | throw new CoolException("库存已被冻结,请重新选择库存"); |
| | | } |
| | | |
| | | allOrderWeight += pla.getOrderWeight(); |
| | | |
| | | if(pla.getWeightAnfme() - pla.getQtyAnfme() - pla.getOrderWeight() < 0){ |
| | |
| | | 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导入模板下载 |
| | | */ |