| | |
| | | import com.vincent.rsf.server.api.entity.dto.PoItemsDto; |
| | | import com.vincent.rsf.server.api.service.ReceiveMsgService; |
| | | import com.vincent.rsf.server.api.service.ReportMsgService; |
| | | import com.vincent.rsf.server.manager.controller.params.AsnOrderAndItemsParams; |
| | | import com.vincent.rsf.server.manager.entity.AsnOrderItem; |
| | | import com.vincent.rsf.server.manager.mapper.AsnOrderItemMapper; |
| | | import com.vincent.rsf.server.manager.mapper.AsnOrderMapper; |
| | |
| | | |
| | | return this.listByIds(longList); |
| | | } |
| | | |
| | | @Override |
| | | public R saveOrderAndItems(AsnOrderAndItemsParams params) { |
| | | if (Objects.isNull(params.getOrders())) { |
| | | throw new CoolException("主单信息不能为空"); |
| | | } |
| | | AsnOrder orders = params.getOrders(); |
| | | |
| | | String ruleCode = SerialRuleUtils.generateRuleCode(SerialRuleCode.SYS_ASN_ORDER, orders); |
| | | if (Objects.isNull(ruleCode)) { |
| | | throw new CoolException("收货通知单编码生成失败!!"); |
| | | } |
| | | orders.setCode(ruleCode); |
| | | if (!this.save(orders)) { |
| | | throw new CoolException("主单保存失败!!"); |
| | | } |
| | | if (params.getItems().isEmpty()) { |
| | | throw new CoolException("收货通知单明细不能为寒食节!!"); |
| | | } |
| | | params.getItems().forEach(item -> { |
| | | item.put("asnId", orders.getId()); |
| | | item.put("asnCode", orders.getCode()); |
| | | item.put("poCode", orders.getPoCode()); |
| | | |
| | | if (!asnOrderItemService.fieldsSave(item)) { |
| | | throw new CoolException("明细保存失败!!"); |
| | | } |
| | | |
| | | }); |
| | | return R.ok("保存成功!!"); |
| | | } |
| | | } |