| | |
| | | * @version 1.0 |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R createByPo(Map<String, Object> params) { |
| | | Long purchaseId = Long.parseLong(params.get("purchaseId").toString()); |
| | | List<PurchaseItem> itemList = JSONArray.parseArray(JSONObject.toJSONString(params.get("items")), PurchaseItem.class); |
| | |
| | | String trackCode = SerialRuleUtils.generateRuleCode(SerialRuleCode.SYS_LABEL_CODE, item); |
| | | if (StringUtils.isBlank(trackCode)) { |
| | | throw new CoolException("单据跟踪码生成失败:请检查「sys_asn_mantr_label」是否配置完成!!"); |
| | | } |
| | | |
| | | PurchaseItem service = purchaseItemService.getById(item.getId()); |
| | | Double qty = service.getQty() + item.getAnfme(); |
| | | if (qty.compareTo(service.getAnfme()) > 0) { |
| | | throw new CoolException("新建单据数量不能大于计划数量!!"); |
| | | } |
| | | orderItem.setAnfme(item.getAnfme()) |
| | | .setAsnId(order.getId()) |
| | |
| | | } |
| | | } |
| | | |
| | | if (!asnOrderItemService.remove(new LambdaQueryWrapper<AsnOrderItem>() |
| | | .in(AsnOrderItem::getAsnId, ids))) { |
| | | throw new CoolException("Details Delete Fail"); |
| | | } |
| | | |
| | | if (!this.remove(new LambdaQueryWrapper<AsnOrder>() |
| | | .in(AsnOrder::getId, ids) |
| | | .eq(AsnOrder::getExceStatus, AsnExceStatus.ASN_EXCE_STATUS_UN_EXCE.val))) { |
| | | throw new CoolException("任务中单据不可删除!!"); |
| | | } |
| | | |
| | | |
| | | if (!asnOrderItemService.remove(new LambdaQueryWrapper<AsnOrderItem>() |
| | | .in(AsnOrderItem::getAsnId, ids))) { |
| | | // throw new CoolException("Details Delete Fail"); |
| | | } |
| | | |
| | | return R.ok("操作成功!!"); |
| | | } |
| | | |