|
|
@@ -574,11 +574,11 @@ public class InventoryService extends BaseService<Inventory> {
|
|
|
this.insertInboundRecord(inOutRecordVO);
|
|
|
//endregion
|
|
|
|
|
|
- //region 采购退货 出库成本 正数
|
|
|
- if (Constant.InventoryDocCode.PURCHASE_RETURN.getValue().equals(inOutRecordVO.getInventoryDocCode())) {
|
|
|
- this.insertOutboundItemCost(inOutRecordVO);
|
|
|
- }
|
|
|
- //endregion
|
|
|
+// //region 采购退货 出库成本 正数
|
|
|
+// if (Constant.InventoryDocCode.PURCHASE_RETURN.getValue().equals(inOutRecordVO.getInventoryDocCode())) {
|
|
|
+// this.insertOutboundItemCost(inOutRecordVO);
|
|
|
+// }
|
|
|
+// //endregion
|
|
|
}
|
|
|
//endregion
|
|
|
}
|
|
|
@@ -630,11 +630,10 @@ public class InventoryService extends BaseService<Inventory> {
|
|
|
if (inOutRecordVO.getSOutItemId() != null) {
|
|
|
List<OutboundItemCostResponse> outboundItemCostResponses = outboundItemCostMapper.selectByCond(new OutboundItemCostQuery().setOutItemId(inOutRecordVO.getSOutItemId()));
|
|
|
if (outboundItemCostResponses.size() > 0) {
|
|
|
- //出库单价
|
|
|
+ //出库单价 反写出库单成本单价、成本金额
|
|
|
inOutRecordVO.setPriceInto(outboundItemCostResponses.get(0).getCostPrice());
|
|
|
//金额
|
|
|
inOutRecordVO.setIntoAmt(outboundItemCostResponses.get(0).getCostPrice().multiply(inOutRecordVO.getIntoQty()).abs());
|
|
|
- //反写出库单成本单价、成本金额
|
|
|
|
|
|
} else {
|
|
|
//当前销售退货单无法获取源出库单数据
|
|
|
@@ -664,12 +663,12 @@ public class InventoryService extends BaseService<Inventory> {
|
|
|
this.insertInboundRecord(inOutRecordVO);
|
|
|
//endregion
|
|
|
|
|
|
- //region 出库成本
|
|
|
- //除了销售退货出库 其他类型出库要新建出库成本
|
|
|
- if (!Constant.InventoryDocCode.SALE_RETURN.getValue().equals(inOutRecordVO.getInventoryDocCode())) {
|
|
|
- this.insertOutboundItemCost(inOutRecordVO);
|
|
|
- }
|
|
|
- //endregion
|
|
|
+// //region 销售退货 其他类型出库
|
|
|
+// if (!Constant.InventoryDocCode.SALE_RETURN.getValue().equals(inOutRecordVO.getInventoryDocCode())) {
|
|
|
+// this.insertOutboundItemCost(inOutRecordVO);
|
|
|
+// }
|
|
|
+// //endregion
|
|
|
+
|
|
|
}
|
|
|
//endregion
|
|
|
|
|
|
@@ -983,8 +982,9 @@ public class InventoryService extends BaseService<Inventory> {
|
|
|
outboundItemCost.setCostAmt(inOutRecordVO.getIntoAmt());
|
|
|
}
|
|
|
}
|
|
|
- Map<String, Object> codeMap = commonService.getUniqueNoteCode(Constant.docNameConstant.OUTBOUNDCOST.getName(), false);
|
|
|
- outboundItemCost.setBatchId(codeMap.get("outId").toString());
|
|
|
+ /*Map<String, Object> codeMap = commonService.getUniqueNoteCode(Constant.docNameConstant.OUTBOUNDCOST.getName(), false);
|
|
|
+ outboundItemCost.setBatchId(codeMap.get("outId").toString());*/
|
|
|
+ outboundItemCost.setBatchId(inOutRecordVO.getBatchId());
|
|
|
//新建
|
|
|
outboundItemCostMapper.insert(outboundItemCost);
|
|
|
}
|
|
|
@@ -1032,7 +1032,7 @@ public class InventoryService extends BaseService<Inventory> {
|
|
|
//主键赋值
|
|
|
inventoryBatchVO.setBatchId(inventoryBatchResponse.getBatchId());
|
|
|
//库存数量
|
|
|
- inventoryBatchVO.setInvQty(inOutRecordVO.getIntoQty());
|
|
|
+ inventoryBatchVO.setInvQty(qty.abs());
|
|
|
//存货资产
|
|
|
inventoryBatchVO.setCostAmt(inventoryBatchVO.getInvQty().multiply(inventoryBatchResponse.getCostPrice()));
|
|
|
//清零标识
|
|
|
@@ -1068,6 +1068,16 @@ public class InventoryService extends BaseService<Inventory> {
|
|
|
inOutRecordVO.setIntoAmt(inOutRecordVO.getIntoQty().multiply(inventoryBatchResponse.getCostPrice()));
|
|
|
}
|
|
|
}
|
|
|
+ //todo 2024年5月20日15:46:01 库存批次有几条出库成本就有几条
|
|
|
+ //region 出库成本
|
|
|
+ //除了销售退货出库 其他类型出库要新建出库成本 采购退货 出库成本 正数
|
|
|
+ if (!Constant.InventoryDocCode.SALE_RETURN.getValue().equals(inOutRecordVO.getInventoryDocCode()) ||
|
|
|
+ Constant.InventoryDocCode.PURCHASE_RETURN.getValue().equals(inOutRecordVO.getInventoryDocCode())) {
|
|
|
+ //存货批次明细ID
|
|
|
+ inOutRecordVO.setBatchId(inventoryBatchResponse.getBatchId());
|
|
|
+ this.insertOutboundItemCost(inOutRecordVO);
|
|
|
+ }
|
|
|
+ //endregion
|
|
|
}
|
|
|
} else {
|
|
|
throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.CAN_OUTBOUND_QUANTITY_INSUFFICIENT.getMessage());
|
|
|
@@ -1420,6 +1430,7 @@ public class InventoryService extends BaseService<Inventory> {
|
|
|
|
|
|
//新建存货流水 一正一负
|
|
|
this.insertInboundRecord(inOutRecordVO);
|
|
|
+
|
|
|
//新建出库成本
|
|
|
this.insertOutboundItemCost(inOutRecordVO);
|
|
|
}
|