| | |
| | | import java.io.IOException; |
| | | import java.net.URLEncoder; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @RestController |
| | | @Slf4j |
| | |
| | | @Autowired |
| | | private SnowflakeIdWorker snowflakeIdWorker; |
| | | |
| | | @GetMapping(value = "/pla/dropdownValues/list") |
| | | @ManagerAuth(memo = "获取下拉选择框值列表") |
| | | public R list() { |
| | | List<DropdownValuesDto> list = plaService.getDropdownValues(); |
| | | Map<String, List<String>> map = new HashMap<>(); |
| | | |
| | | // owner 去重并加入 map |
| | | List<String> owners = list.stream() |
| | | .filter(dropdownValuesDto -> dropdownValuesDto.getType().equals("owner")) |
| | | .map(DropdownValuesDto::getValue) |
| | | .collect(Collectors.toList()); |
| | | map.put("owner", owners); |
| | | |
| | | // workshop 去重并加入 map |
| | | List<String> workshops = list.stream() |
| | | .filter(dropdownValuesDto -> dropdownValuesDto.getType().equals("workshop")) |
| | | .map(DropdownValuesDto::getValue) |
| | | .collect(Collectors.toList()); |
| | | map.put("workshop", workshops); |
| | | return R.ok(map); |
| | | } |
| | | |
| | | |
| | | @RequestMapping(value = "/pla/list/auth") |
| | | @ManagerAuth |
| | |
| | | if (!Cools.isEmpty(param.get("brand"))) { |
| | | wrapper.eq("brand", param.get("brand")); |
| | | param.remove("brand"); |
| | | } |
| | | // 仓库精确匹配 |
| | | if (!Cools.isEmpty(param.get("stash"))) { |
| | | wrapper.eq("stash", param.get("stash")); |
| | | param.remove("stash"); |
| | | } |
| | | // 没有选择的时候默认不显示已出库的物料 |
| | | if (Cools.isEmpty(param.get("status"))) { |
| | |
| | | } |
| | | |
| | | @RequestMapping(value = "/pla/sellout/auth") |
| | | @ManagerAuth |
| | | @ManagerAuth(memo = "sellout") |
| | | @Transactional |
| | | @Synchronized |
| | | public R sellout(@RequestBody List<Pla> plas) { |
| | |
| | | OrderDetl orderDetl = orderDetlService.selectByOrderNoAndMaktx(orderNo, maktx); |
| | | |
| | | for (Pla pla : plas) { |
| | | |
| | | // 获取最新冻结状态 |
| | | Pla pla1 = plaService.selectOne(new EntityWrapper<Pla>().setSqlSelect("stock_freeze as stockFreeze,stock_freeze_by as stockFreezeBy,stock_freeze_date as stockFreezeDate").eq("id", pla.getId())); |
| | | pla.setStockFreeze(pla1.getStockFreeze()); |
| | | pla.setStockFreezeBy(pla1.getStockFreezeBy()); |
| | | pla.setStockFreezeDate(pla1.getStockFreezeDate()); |
| | | if (pla.getStockFreeze() == 0) { |
| | | // throw new CoolException("库存已被冻结,请重新选择库存"); |
| | | log.info("该库存已被其他用户冻结,请重新选择;{},{}", pla.getStockFreezeBy(), getUser().getUsername()); |
| | |
| | | if (pla.getWeightAnfme() - pla.getQtyAnfme() - pla.getOrderWeight() < 0) { |
| | | throw new CoolException("批号:" + pla.getBatch() + ",包号:" + pla.getPackageNo() + " 剩余可出库重量不足,请调整出库重量"); |
| | | } |
| | | if (Cools.isEmpty(pla.getMassState())){ |
| | | throw new CoolException("质量指标为上传"); |
| | | } |
| | | pla.setQtyAnfme(pla.getQtyAnfme() + pla.getOrderWeight()); |
| | | pla.setHandlerBy(getUser().getUsername()); |
| | | pla.setStatus(GlobleParameter.PLA_STATUS_2); |
| | | log.info("修改为待出库,地址:{},数据:{}","/pla/sellout/auth", pla); |
| | | pla.setModifyTime(new Date()); |
| | | pla.setPakoutTime(pla.getPakoutTime().split("\\(")[0]); |
| | | //生成此次作业信息 |