|
@@ -121,6 +121,7 @@ public class OutboundSaleReturnService extends BaseService<Outbound> {
|
|
|
*/
|
|
*/
|
|
|
@Transactional(rollbackFor = {Exception.class})
|
|
@Transactional(rollbackFor = {Exception.class})
|
|
|
public void updatePrimaryTotal(OutboundVO outboundVO, Boolean posNegFlag) {
|
|
public void updatePrimaryTotal(OutboundVO outboundVO, Boolean posNegFlag) {
|
|
|
|
|
+
|
|
|
//region 原入库单
|
|
//region 原入库单
|
|
|
Map<String, List<OutboundItemVO>> outboundItemVOListOutPri = outboundVO.getItemList().stream().collect(Collectors.groupingBy(OutboundItemVO::getSOutId));
|
|
Map<String, List<OutboundItemVO>> outboundItemVOListOutPri = outboundVO.getItemList().stream().collect(Collectors.groupingBy(OutboundItemVO::getSOutId));
|
|
|
for (String str : outboundItemVOListOutPri.keySet()) {
|
|
for (String str : outboundItemVOListOutPri.keySet()) {
|
|
@@ -415,11 +416,10 @@ public class OutboundSaleReturnService extends BaseService<Outbound> {
|
|
|
//查询库存批次最近一条入库价
|
|
//查询库存批次最近一条入库价
|
|
|
InboundItemResponse inboundItemResponse = this.selectPriceInto(outboundItemVO);
|
|
InboundItemResponse inboundItemResponse = this.selectPriceInto(outboundItemVO);
|
|
|
//todo 2024年7月5日15:57:01 priceOut和outingAmt 前台传 z确认修改
|
|
//todo 2024年7月5日15:57:01 priceOut和outingAmt 前台传 z确认修改
|
|
|
- //todo 2024年7月9日08:52:55 入库价和入库价总和后台计算 z确认修改
|
|
|
|
|
|
|
+// outboundItemVO.setPriceOut(inboundItemResponse != null ? inboundItemResponse.getPriceInto() : BigDecimal.ZERO);
|
|
|
|
|
+// outboundItemVO.setOutingAmt(inboundItemResponse != null ? inboundItemResponse.getPriceInto().multiply(outboundItemVO.getOutingQty()).setScale(2, BigDecimal.ROUND_HALF_UP) : BigDecimal.ZERO);
|
|
|
outboundItemVO.setCostPrice(inboundItemResponse != null ? inboundItemResponse.getCostPrice() : BigDecimal.ZERO);
|
|
outboundItemVO.setCostPrice(inboundItemResponse != null ? inboundItemResponse.getCostPrice() : BigDecimal.ZERO);
|
|
|
outboundItemVO.setCostAmt(inboundItemResponse != null ? inboundItemResponse.getCostPrice().multiply(outboundItemVO.getOutingQty()).setScale(2, BigDecimal.ROUND_HALF_UP) : BigDecimal.ZERO);
|
|
outboundItemVO.setCostAmt(inboundItemResponse != null ? inboundItemResponse.getCostPrice().multiply(outboundItemVO.getOutingQty()).setScale(2, BigDecimal.ROUND_HALF_UP) : BigDecimal.ZERO);
|
|
|
- outboundItemVO.setPriceOut(inboundItemResponse != null ? inboundItemResponse.getCostPrice() : BigDecimal.ZERO);
|
|
|
|
|
- outboundItemVO.setOutingAmt(inboundItemResponse != null ? inboundItemResponse.getCostPrice().multiply(outboundItemVO.getOutingQty()).setScale(2, BigDecimal.ROUND_HALF_UP) : BigDecimal.ZERO);
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
if (priceIntoFlag) {
|
|
if (priceIntoFlag) {
|
|
@@ -447,10 +447,8 @@ public class OutboundSaleReturnService extends BaseService<Outbound> {
|
|
|
}
|
|
}
|
|
|
//endregion
|
|
//endregion
|
|
|
|
|
|
|
|
- //region 原入库单 原销售订单
|
|
|
|
|
- if (outboundVO.getFromId() != null) {
|
|
|
|
|
- this.updatePrimaryTotal(outboundVO, true);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ //region 新建多业务归属
|
|
|
|
|
+ outCommon.insertMultiOwner(outboundVO);
|
|
|
//endregion
|
|
//endregion
|
|
|
|
|
|
|
|
//region 总单
|
|
//region 总单
|
|
@@ -487,9 +485,6 @@ public class OutboundSaleReturnService extends BaseService<Outbound> {
|
|
|
outboundMapper.insert(outbound);
|
|
outboundMapper.insert(outbound);
|
|
|
//endregion
|
|
//endregion
|
|
|
|
|
|
|
|
- //region 新建多业务归属
|
|
|
|
|
- outCommon.insertMultiOwner(outboundVO);
|
|
|
|
|
- //endregion
|
|
|
|
|
|
|
|
|
|
//region 明细
|
|
//region 明细
|
|
|
for (OutboundItemVO outboundItemVO : outboundVO.getItemList()) {
|
|
for (OutboundItemVO outboundItemVO : outboundVO.getItemList()) {
|
|
@@ -542,6 +537,12 @@ public class OutboundSaleReturnService extends BaseService<Outbound> {
|
|
|
}
|
|
}
|
|
|
//endregion
|
|
//endregion
|
|
|
|
|
|
|
|
|
|
+ //region 原入库单 原销售订单
|
|
|
|
|
+ if (outboundVO.getFromId() != null) {
|
|
|
|
|
+ this.updatePrimaryTotal(outboundVO, true);
|
|
|
|
|
+ }
|
|
|
|
|
+ //endregion
|
|
|
|
|
+
|
|
|
//region 账款
|
|
//region 账款
|
|
|
if (Constant.OutStatus.YICHUKU.getName().equals(outboundVO.getOutStatus())) {
|
|
if (Constant.OutStatus.YICHUKU.getName().equals(outboundVO.getOutStatus())) {
|
|
|
accountService.accReceivable(outboundVO.getOutId(), Constant.InventoryDocCode.OUTBOUND.getTableName());
|
|
accountService.accReceivable(outboundVO.getOutId(), Constant.InventoryDocCode.OUTBOUND.getTableName());
|
|
@@ -601,9 +602,8 @@ public class OutboundSaleReturnService extends BaseService<Outbound> {
|
|
|
BigDecimal sumAmt = outboundVO.getItemList().stream().map(OutboundItemVO::getOutingAmt).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
BigDecimal sumAmt = outboundVO.getItemList().stream().map(OutboundItemVO::getOutingAmt).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
//endregion
|
|
//endregion
|
|
|
|
|
|
|
|
- //region 自动办理参数为true 已出库编辑
|
|
|
|
|
- //自动办理参数为true
|
|
|
|
|
- if (Constant.FlgHandleSetting.TRUE.getValue().equals(outboundVO.getFlgHandleSetting())) {
|
|
|
|
|
|
|
+ //region 已出库编辑
|
|
|
|
|
+ if (Constant.OutStatus.YICHUKU.getName().equals(outboundVO.getOutStatus())) {
|
|
|
//region 退账
|
|
//region 退账
|
|
|
if (outboundVO.getReceivableId() != null) {
|
|
if (outboundVO.getReceivableId() != null) {
|
|
|
accountService.reverseReceivable(outboundVO.getOutId(), Constant.InventoryDocCode.OUTBOUND.getTableName());
|
|
accountService.reverseReceivable(outboundVO.getOutId(), Constant.InventoryDocCode.OUTBOUND.getTableName());
|
|
@@ -737,14 +737,12 @@ public class OutboundSaleReturnService extends BaseService<Outbound> {
|
|
|
invMap.put("delOutDetail", outboundVO.getDeleteItemList());
|
|
invMap.put("delOutDetail", outboundVO.getDeleteItemList());
|
|
|
inventoryService.operatingInventoryInformation(invMap);
|
|
inventoryService.operatingInventoryInformation(invMap);
|
|
|
//endregion
|
|
//endregion
|
|
|
- } else {
|
|
|
|
|
- throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.FLG_HANDLE_SETTING_NOT_ENABLED_OUT.getMessage());
|
|
|
|
|
}
|
|
}
|
|
|
//endregion
|
|
//endregion
|
|
|
|
|
|
|
|
- //region 自动办理参数false 出库中编辑
|
|
|
|
|
- //自动办理标识为false 并且 自动办理参数为false 出库中
|
|
|
|
|
- if (!outboundVO.getFlgAutoHandle() && Constant.FlgHandleSetting.FALSE.getValue().equals(outboundVO.getFlgHandleSetting())) {
|
|
|
|
|
|
|
+ //region 出库中编辑
|
|
|
|
|
+ if (Constant.OutStatus.CHUKUZHONG.getName().equals(outboundVO.getOutStatus()) ||
|
|
|
|
|
+ Constant.OutStatus.DAICHUKU.getName().equals(outboundVO.getOutStatus())) {
|
|
|
|
|
|
|
|
//region 反写出库总单和明细 反写订单总单和明细
|
|
//region 反写出库总单和明细 反写订单总单和明细
|
|
|
this.rollBackTotalAndDetail(outboundVO.getItemList());
|
|
this.rollBackTotalAndDetail(outboundVO.getItemList());
|
|
@@ -829,8 +827,6 @@ public class OutboundSaleReturnService extends BaseService<Outbound> {
|
|
|
//region 反写出库总单 反写订单总单
|
|
//region 反写出库总单 反写订单总单
|
|
|
this.updatePrimaryTotal(outboundVO, true);
|
|
this.updatePrimaryTotal(outboundVO, true);
|
|
|
//endregion
|
|
//endregion
|
|
|
- } else {
|
|
|
|
|
- throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.FLG_HANDLE_SETTING_NOT_ENABLED_OUT.getMessage());
|
|
|
|
|
}
|
|
}
|
|
|
//endregion
|
|
//endregion
|
|
|
}
|
|
}
|