|
|
@@ -261,9 +261,6 @@ public class OutboundSaleOrderService extends BaseService<Outbound> {
|
|
|
@Transactional(rollbackFor = {Exception.class})
|
|
|
public ResponseResultVO<?> saleOrderOutboundInsert(OutboundVO outboundVO) {
|
|
|
//region 如果没有客户id,要新建
|
|
|
-// if (outboundVO.getCusId() == null) {
|
|
|
-//
|
|
|
-// }
|
|
|
outboundVO = outCommon.insertCustomer(outboundVO);
|
|
|
//endregion
|
|
|
|
|
|
@@ -286,7 +283,7 @@ public class OutboundSaleOrderService extends BaseService<Outbound> {
|
|
|
outboundVO.setOutId(codeMap.get("outId").toString()).
|
|
|
setOutNo(codeMap.get("outNote").toString());
|
|
|
//出库类型
|
|
|
- outboundVO.setOutType(Constant.OutType.SALE.getName());
|
|
|
+ outboundVO.setOutType(Constant.OutType.SALE.getName()).setOutDate(LocalDate.now());
|
|
|
//自动入库标识
|
|
|
if (outboundVO.getFlgAutoHandle()) {
|
|
|
//已出库
|
|
|
@@ -1098,10 +1095,11 @@ public class OutboundSaleOrderService extends BaseService<Outbound> {
|
|
|
//region 编辑明细
|
|
|
if (outboundItemVO.getItemId() != null) {
|
|
|
outboundItemVO
|
|
|
- .setOutQty(outboundItemResponse.getOutQty().add(outboundItemVO.getOutingQty()))
|
|
|
- .setOutAmt(outboundItemResponse.getOutAmt().add(outboundItemVO.getOutingAmt()))
|
|
|
- .setOutingQty(outboundItemResponse.getOutingQty().subtract(outboundItemVO.getOutingQty()))
|
|
|
- .setOutingAmt(outboundItemResponse.getOutingAmt().subtract(outboundItemVO.getOutingAmt()))
|
|
|
+ .setOutQty(outboundItemVO.getOutingQty())
|
|
|
+ .setOutBox(outboundItemVO.getOutingBox()).setOutPiece(outboundItemVO.getOutingPiece())
|
|
|
+ .setOutAmt(outboundItemVO.getOutAmt())
|
|
|
+ .setOutingQty(BigDecimal.ZERO).setOutingBox(0).setOutingPiece(0)
|
|
|
+ .setOutingAmt(BigDecimal.ZERO)
|
|
|
.setCostPrice(outboundItemVO.getPriceOut())
|
|
|
.setCostAmt(outboundItemVO.getOutQty().multiply(outboundItemVO.getPriceOut()).setScale(2, BigDecimal.ROUND_HALF_UP))
|
|
|
;
|
|
|
@@ -1135,6 +1133,7 @@ public class OutboundSaleOrderService extends BaseService<Outbound> {
|
|
|
outboundItemVO
|
|
|
.setOutId(outboundItemVO.getOutId())
|
|
|
.setOutQty(outboundItemVO.getOutingQty())
|
|
|
+ .setOutBox(outboundItemVO.getOutingBox()).setOutPiece(outboundItemVO.getOutingPiece())
|
|
|
.setOutAmt(outboundItemVO.getOutingAmt())
|
|
|
.setCostPrice(outboundItemVO.getPriceOut())
|
|
|
.setCostAmt(outboundItemVO.getOutQty().multiply(outboundItemVO.getPriceOut()).setScale(2, BigDecimal.ROUND_HALF_UP))
|
|
|
@@ -1286,29 +1285,34 @@ public class OutboundSaleOrderService extends BaseService<Outbound> {
|
|
|
accountService.accReceivable(outboundResponse.getOutId(), Constant.InventoryDocCode.OUTBOUND.getTableName());
|
|
|
//endregion
|
|
|
|
|
|
- //region 外协品新建外协入库单
|
|
|
- //筛选出skuId为空的 走外协品逻辑
|
|
|
- List<OutboundItemVO> outsideGoods = outboundVO.getItemList().stream().filter(it -> it.getSkuId() == null).collect(Collectors.toList());
|
|
|
- //删除外协品生产外协入库单
|
|
|
- this.deleteOutsideGoodsInto(outboundVO, outsideGoods);
|
|
|
- //新建外协品生产外协入库单
|
|
|
- this.insertOutsideGoodsInto(outboundVO, outsideGoods);
|
|
|
- List<OutboundItemVO> delOutsideGoods = outboundVO.getDeleteItemList().stream().filter(it -> it.getSkuId() == null).collect(Collectors.toList());
|
|
|
- //删除外协品生产外协入库单
|
|
|
- this.deleteOutsideGoodsInto(outboundVO, delOutsideGoods);
|
|
|
- //endregion
|
|
|
+ //region 库存明细处理
|
|
|
+ if(outboundVO.getItemList()!=null && outboundVO.getItemList().size()>0){
|
|
|
+ Map<String, Object> map = new HashMap<>(); // 定义map值 修改库存用
|
|
|
+ // 获取外协数据
|
|
|
+ List<OutboundItemVO> outsideGoods = outboundVO.getItemList().stream().filter(it -> it.getSkuId() == null).collect(Collectors.toList());
|
|
|
+ //新建外协品生产外协入库单
|
|
|
+ this.insertOutsideGoodsInto(outboundVO, outsideGoods);
|
|
|
+ // 获取商品明细数据
|
|
|
+ List<OutboundItemVO> invList = outboundVO.getItemList().stream().filter(it -> it.getSkuId() != null).collect(Collectors.toList());
|
|
|
|
|
|
- //region 调用库存
|
|
|
- //筛选出skuId不为空的 走库存
|
|
|
- List<OutboundItemVO> invList = outboundVO.getItemList().stream().filter(it -> it.getSkuId() != null).collect(Collectors.toList());
|
|
|
- List<OutboundItemVO> invDelList = outboundVO.getDeleteItemList().stream().filter(it -> it.getSkuId() != null).collect(Collectors.toList());
|
|
|
- if ((invList != null && invList.size() > 0) || (invDelList != null && invDelList.size() > 0)) {
|
|
|
- Map<String, Object> map = new HashMap<>();
|
|
|
+ // 赋值修改明细
|
|
|
map.put("outDetail", invList);
|
|
|
- map.put("delOutDetail", invDelList);
|
|
|
+ // 删除的商品
|
|
|
+ if(outboundVO.getDeleteItemList()!=null && outboundVO.getDeleteItemList().size()>0){
|
|
|
+ // 获取外协删除数据
|
|
|
+ List<OutboundItemVO> invsideDelList = outboundVO.getDeleteItemList().stream().filter(it -> it.getSkuId() == null).collect(Collectors.toList());
|
|
|
+ //删除外协品生产外协入库单
|
|
|
+ this.deleteOutsideGoodsInto(outboundVO, invsideDelList);
|
|
|
+ // 获取删除商品数据
|
|
|
+ List<OutboundItemVO> invDelList = outboundVO.getDeleteItemList().stream().filter(it -> it.getSkuId() == null).collect(Collectors.toList());
|
|
|
+ // 赋值删除明细
|
|
|
+ map.put("delOutDetail", invDelList);
|
|
|
+ }
|
|
|
+ // 调用修改库存信息方法
|
|
|
inventoryService.operatingInventoryInformation(map);
|
|
|
}
|
|
|
//endregion
|
|
|
+
|
|
|
return ResponseResultUtil.success(outboundVO);
|
|
|
}
|
|
|
|