|
|
@@ -194,7 +194,7 @@ public class InboundPurchaseService extends BaseService<Inbound> {
|
|
|
}
|
|
|
//入库状态
|
|
|
String intoStatus = this.setIntoStatus(purchaseResponse.getIntoingQty().add(purchaseUpdate.getIntoingQty()),
|
|
|
- purchaseResponse.getIntoQty().add(purchaseUpdate.getIntoQty()),purchaseResponse.getSumQuantity());
|
|
|
+ purchaseResponse.getIntoQty().add(purchaseUpdate.getIntoQty()), purchaseResponse.getSumQuantity());
|
|
|
purchaseUpdate.setIntoStatus(intoStatus);
|
|
|
//修改
|
|
|
int countRow = purchaseMapper.updateById(purchaseUpdate);
|
|
|
@@ -265,7 +265,7 @@ public class InboundPurchaseService extends BaseService<Inbound> {
|
|
|
}
|
|
|
//入库状态
|
|
|
String intoStatus = this.setIntoStatus(purchaseItemResponse.getIntoingQty().add(purchaseItem.getIntoingQty()),
|
|
|
- purchaseItemResponse.getIntoQty().add(purchaseItem.getIntoQty()),purchaseItemResponse.getItemQty());
|
|
|
+ purchaseItemResponse.getIntoQty().add(purchaseItem.getIntoQty()), purchaseItemResponse.getItemQty());
|
|
|
purchaseItem.setIntoStatus(intoStatus);
|
|
|
int countRow = purchaseItemMapper.updateById(purchaseItem);
|
|
|
//数量超出
|
|
|
@@ -362,21 +362,43 @@ public class InboundPurchaseService extends BaseService<Inbound> {
|
|
|
//编辑之后的数
|
|
|
inboundItemVO.setIntoQty(inboundItemVO.getIntoQty());
|
|
|
inboundItemVO.setIntoAmt(inboundItemVO.getIntoAmt());
|
|
|
+ //endregion
|
|
|
|
|
|
+ //region 编辑明细 赋值
|
|
|
+ if (inboundItemVO.getItemId() != null) {
|
|
|
+ InboundItem inboundItem = new InboundItem();
|
|
|
+ inboundItem.setItemId(inboundItemVO.getItemId());
|
|
|
+ inboundItem.setIntoQty(inboundItemVO.getIntoingQty());
|
|
|
+ inboundItem.setIntoAmt(inboundItemVO.getIntoingAmt());
|
|
|
+ inboundItem.setCostPrice(inboundItemVO.getPriceInto());
|
|
|
+ inboundItem.setCostAmt(inboundItemVO.getIntoQty().multiply(inboundItemVO.getPriceInto()).setScale(6, BigDecimal.ROUND_HALF_UP));
|
|
|
+ //修改
|
|
|
+ inboundItemMapper.update(inboundItem,
|
|
|
+ new UpdateWrapper<InboundItem>().lambda()
|
|
|
+ .eq(InboundItem::getItemId, UUID.fromString(inboundItem.getItemId()))
|
|
|
+ );
|
|
|
+ }
|
|
|
//endregion
|
|
|
|
|
|
- //赋值
|
|
|
- InboundItem inboundItem = new InboundItem();
|
|
|
- inboundItem.setItemId(inboundItemVO.getItemId());
|
|
|
- inboundItem.setIntoQty(inboundItemVO.getIntoingQty());
|
|
|
- inboundItem.setIntoAmt(inboundItemVO.getIntoingAmt());
|
|
|
- inboundItem.setCostPrice(inboundItemVO.getPriceInto());
|
|
|
- inboundItem.setCostAmt(inboundItemVO.getIntoQty().multiply(inboundItemVO.getPriceInto()).setScale(6, BigDecimal.ROUND_HALF_UP));
|
|
|
- //修改
|
|
|
- inboundItemMapper.update(inboundItem,
|
|
|
- new UpdateWrapper<InboundItem>().lambda()
|
|
|
- .eq(InboundItem::getItemId, UUID.fromString(inboundItem.getItemId()))
|
|
|
- );
|
|
|
+ //region 新建明细
|
|
|
+ else {
|
|
|
+ inboundItemVO
|
|
|
+ .setIntoQty(inboundItemVO.getIntoingQty())
|
|
|
+ .setIntoAmt(inboundItemVO.getIntoingAmt())
|
|
|
+ .setIntoingQty(BigDecimal.ZERO)
|
|
|
+ .setIntoingAmt(BigDecimal.ZERO)
|
|
|
+ .setCostPrice(inboundItemVO.getPriceInto())
|
|
|
+ .setCostAmt(inboundItemVO.getOutQty().multiply(inboundItemVO.getPriceInto()).setScale(2, BigDecimal.ROUND_HALF_UP))
|
|
|
+ ;
|
|
|
+ inboundItemVO.setIntoId(inboundVO.getIntoId());
|
|
|
+ //入库状态
|
|
|
+ inboundItemVO.setIntoStatus(inboundVO.getIntoStatus());
|
|
|
+ inboundItemVO.setIntoType(Constant.IntoType.SALE.getName());
|
|
|
+ //实体转换
|
|
|
+ InboundItem inboundItem = inboundItemConvert.convertToPo(inboundItemVO);
|
|
|
+ inboundItemMapper.insert(inboundItem);
|
|
|
+ }
|
|
|
+ //endregion
|
|
|
|
|
|
//region 销售明细
|
|
|
if (inboundItemVO.getFromItemId() != null) {
|
|
|
@@ -395,6 +417,40 @@ public class InboundPurchaseService extends BaseService<Inbound> {
|
|
|
}
|
|
|
//endregion
|
|
|
|
|
|
+ //region 删除明细
|
|
|
+ BigDecimal delIntoQty = BigDecimal.ZERO;
|
|
|
+ BigDecimal delIntoAmt = BigDecimal.ZERO;
|
|
|
+ if (inboundVO.getDeleteItemList() != null) {
|
|
|
+ delIntoQty = inboundVO.getDeleteItemList().stream().map(InboundItemVO::getIntoingQty).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(6, BigDecimal.ROUND_HALF_UP);
|
|
|
+ delIntoAmt = inboundVO.getDeleteItemList().stream().map(InboundItemVO::getIntoingAmt).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ for (InboundItemVO inboundItemVO : inboundVO.getDeleteItemList()) {
|
|
|
+ if (inboundItemVO.getItemId() != null) {
|
|
|
+ InboundItem inboundItem = inboundItemConvert.convertToPo(inboundItemVO);
|
|
|
+ inboundItem.setFlgValid(false);
|
|
|
+ //修改
|
|
|
+ inboundItemMapper.update(inboundItem,
|
|
|
+ new UpdateWrapper<InboundItem>().lambda()
|
|
|
+ .eq(InboundItem::getItemId, UUID.fromString(inboundItem.getItemId()))
|
|
|
+ );
|
|
|
+ }
|
|
|
+ //region 销售明细
|
|
|
+ if (inboundItemVO.getFromItemId() != null) {
|
|
|
+ //根据id查询
|
|
|
+ PurchaseItem purchaseItem = new PurchaseItem();
|
|
|
+ purchaseItem.setItemId(inboundItemVO.getFromItemId());
|
|
|
+ purchaseItem.setIntoQty(inboundItemVO.getIntoingQty().negate());
|
|
|
+ purchaseItem.setIntoAmt(inboundItemVO.getIntoingAmt().negate());
|
|
|
+ int countRow = purchaseItemMapper.updateById(purchaseItem);
|
|
|
+ //数量超出
|
|
|
+ if (countRow == 0) {
|
|
|
+ throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.INVENTORY_QUANTITY_EXCEEDED.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //endregion
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //endregion
|
|
|
+
|
|
|
//region 修改入库总单
|
|
|
Inbound inbound = new Inbound();
|
|
|
inbound.setIntoId(inboundVO.getIntoId());
|
|
|
@@ -409,8 +465,8 @@ public class InboundPurchaseService extends BaseService<Inbound> {
|
|
|
//region 修改销售总单
|
|
|
Purchase purchase = new Purchase();
|
|
|
purchase.setPurId(inboundVO.getFromId());
|
|
|
- purchase.setIntoQty(inboundResponse.getIntoQty().negate().add(sumQty));
|
|
|
- purchase.setIntoAmt(inboundResponse.getIntoAmt().negate().add(sumAmt));
|
|
|
+ purchase.setIntoQty(inboundResponse.getIntoQty().negate().add(sumQty).subtract(delIntoQty));
|
|
|
+ purchase.setIntoAmt(inboundResponse.getIntoAmt().negate().add(sumAmt).subtract(delIntoAmt));
|
|
|
//修改
|
|
|
int countRow = purchaseMapper.updateById(purchase);
|
|
|
//数量超出
|
|
|
@@ -449,16 +505,38 @@ public class InboundPurchaseService extends BaseService<Inbound> {
|
|
|
}
|
|
|
//endregion
|
|
|
|
|
|
- //赋值
|
|
|
- InboundItem inboundItem = new InboundItem();
|
|
|
- inboundItem.setItemId(inboundItemVO.getItemId());
|
|
|
- inboundItem.setIntoingQty(inboundItemVO.getIntoingQty());
|
|
|
- inboundItem.setIntoingAmt(inboundItemVO.getIntoingAmt());
|
|
|
- //修改
|
|
|
- inboundItemMapper.update(inboundItem,
|
|
|
- new UpdateWrapper<InboundItem>().lambda()
|
|
|
- .eq(InboundItem::getItemId, UUID.fromString(inboundItem.getItemId()))
|
|
|
- );
|
|
|
+ //region 编辑明细
|
|
|
+ if (inboundItemVO.getItemId() != null) {
|
|
|
+ InboundItem inboundItem = new InboundItem();
|
|
|
+ inboundItem.setItemId(inboundItemVO.getItemId());
|
|
|
+ inboundItem.setIntoingQty(inboundItemVO.getIntoingQty());
|
|
|
+ inboundItem.setIntoingAmt(inboundItemVO.getIntoingAmt());
|
|
|
+ //修改
|
|
|
+ inboundItemMapper.update(inboundItem,
|
|
|
+ new UpdateWrapper<InboundItem>().lambda()
|
|
|
+ .eq(InboundItem::getItemId, UUID.fromString(inboundItem.getItemId()))
|
|
|
+ );
|
|
|
+ }
|
|
|
+ //endregion
|
|
|
+
|
|
|
+ //region 新建明细
|
|
|
+ else {
|
|
|
+ inboundItemVO
|
|
|
+ .setIntoQty(BigDecimal.ZERO)
|
|
|
+ .setIntoAmt(BigDecimal.ZERO)
|
|
|
+ .setCostPrice(inboundItemVO.getPriceInto())
|
|
|
+ .setCostAmt(inboundItemVO.getIntoingQty().multiply(inboundItemVO.getPriceInto()).setScale(2, BigDecimal.ROUND_HALF_UP))
|
|
|
+ ;
|
|
|
+ inboundItemVO.setIntoId(inboundVO.getIntoId());
|
|
|
+ //入库状态
|
|
|
+ inboundItemVO.setIntoStatus(inboundVO.getIntoStatus());
|
|
|
+ inboundItemVO.setIntoType(Constant.IntoType.SALE.getName());
|
|
|
+ //实体转换
|
|
|
+ InboundItem inboundItem = inboundItemConvert.convertToPo(inboundItemVO);
|
|
|
+ inboundItemMapper.insert(inboundItem);
|
|
|
+ }
|
|
|
+ //endregion
|
|
|
+
|
|
|
//region 销售明细
|
|
|
if (inboundItemVO.getFromItemId() != null) {
|
|
|
//根据id查询
|
|
|
@@ -477,6 +555,44 @@ public class InboundPurchaseService extends BaseService<Inbound> {
|
|
|
}
|
|
|
//endregion
|
|
|
|
|
|
+ //region 删除明细
|
|
|
+ BigDecimal delIntoQty = BigDecimal.ZERO;
|
|
|
+ BigDecimal delIntoAmt = BigDecimal.ZERO;
|
|
|
+ if (inboundVO.getDeleteItemList() != null) {
|
|
|
+ delIntoQty = inboundVO.getDeleteItemList().stream().map(InboundItemVO::getIntoingQty).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(6, BigDecimal.ROUND_HALF_UP);
|
|
|
+ delIntoAmt = inboundVO.getDeleteItemList().stream().map(InboundItemVO::getIntoingAmt).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ for (InboundItemVO inboundItemVO : inboundVO.getDeleteItemList()) {
|
|
|
+ //region 明细
|
|
|
+ if (inboundItemVO.getItemId() != null) {
|
|
|
+ InboundItem inboundItem = inboundItemConvert.convertToPo(inboundItemVO);
|
|
|
+ inboundItem.setFlgValid(false);
|
|
|
+ //修改
|
|
|
+ inboundItemMapper.update(inboundItem,
|
|
|
+ new UpdateWrapper<InboundItem>().lambda()
|
|
|
+ .eq(InboundItem::getItemId, UUID.fromString(inboundItem.getItemId()))
|
|
|
+ );
|
|
|
+ }
|
|
|
+ //endregion
|
|
|
+
|
|
|
+ //region 销售明细
|
|
|
+ if (inboundItemVO.getFromItemId() != null) {
|
|
|
+ //根据id查询
|
|
|
+ PurchaseItem purchaseItem = new PurchaseItem();
|
|
|
+ purchaseItem.setItemId(inboundItemVO.getFromItemId());
|
|
|
+ purchaseItem.setIntoQty(inboundItemVO.getIntoingQty().negate());
|
|
|
+ purchaseItem.setIntoAmt(inboundItemVO.getIntoingAmt().negate());
|
|
|
+ int countRow = purchaseItemMapper.updateById(purchaseItem);
|
|
|
+ //数量超出
|
|
|
+ if (countRow == 0) {
|
|
|
+ throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.INVENTORY_QUANTITY_EXCEEDED.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //endregion
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //endregion
|
|
|
+
|
|
|
+
|
|
|
//region 修改入库总单
|
|
|
Inbound inbound = new Inbound();
|
|
|
inbound.setIntoId(inboundVO.getIntoId());
|
|
|
@@ -491,8 +607,8 @@ public class InboundPurchaseService extends BaseService<Inbound> {
|
|
|
//region 修改采购总单
|
|
|
Purchase purchase = new Purchase();
|
|
|
purchase.setPurId(inboundVO.getFromId());
|
|
|
- purchase.setIntoingQty(inboundResponse.getIntoingQty().negate().add(sumQty));
|
|
|
- purchase.setIntoingAmt(inboundResponse.getIntoingAmt().negate().add(sumAmt));
|
|
|
+ purchase.setIntoingQty(inboundResponse.getIntoingQty().negate().add(sumQty).subtract(delIntoQty));
|
|
|
+ purchase.setIntoingAmt(inboundResponse.getIntoingAmt().negate().add(sumAmt).subtract(delIntoAmt));
|
|
|
//修改
|
|
|
int countRow = purchaseMapper.updateById(purchase);
|
|
|
//数量超出
|
|
|
@@ -687,6 +803,7 @@ public class InboundPurchaseService extends BaseService<Inbound> {
|
|
|
ErrorCodeEnum.ITEMS_THAT_ARE_NOT_AVAILABLE_HANDLE.getMessage());
|
|
|
}
|
|
|
//endregion
|
|
|
+
|
|
|
//入库明细根据id查询
|
|
|
InboundItemResponse inboundItemResponse = inboundItemMapper.selectById(inboundItemVO.getItemId());
|
|
|
//region 校验数量是否超出
|
|
|
@@ -695,10 +812,12 @@ public class InboundPurchaseService extends BaseService<Inbound> {
|
|
|
ErrorCodeEnum.CANNOT_EXCEED_THE_QUANTITY_IN_THE_OUTBOUND_SHIPMENT.getMessage());
|
|
|
}
|
|
|
//endregion
|
|
|
+
|
|
|
//region 将库存需要的参数赋值
|
|
|
inboundItemResponse.setInventoryType(Constant.InventoryType.INBOUND.getName());
|
|
|
inboundItemResponse.setInventoryDocCode(Constant.InventoryDocCode.PURCHASE_ORDER.getValue());
|
|
|
//endregion
|
|
|
+
|
|
|
//region 采购明细
|
|
|
//根据id查询
|
|
|
PurchaseItemResponse purchaseItemResponse = purchaseItemMapper.selectById(inboundItemVO.getFromItemId());
|
|
|
@@ -711,7 +830,7 @@ public class InboundPurchaseService extends BaseService<Inbound> {
|
|
|
purchaseItem.setIntoAmt(inboundItemVO.getIntoAmt());
|
|
|
//入库状态
|
|
|
String purItemIntoStatus = this.setIntoStatus(purchaseItemResponse.getIntoingQty().add(purchaseItem.getIntoingQty()),
|
|
|
- purchaseItemResponse.getIntoQty().add(purchaseItem.getIntoQty()),purchaseItemResponse.getItemQty());
|
|
|
+ purchaseItemResponse.getIntoQty().add(purchaseItem.getIntoQty()), purchaseItemResponse.getItemQty());
|
|
|
purchaseItem.setIntoStatus(purItemIntoStatus);
|
|
|
int countRow = purchaseItemMapper.updateById(purchaseItem);
|
|
|
//数量超出
|
|
|
@@ -719,31 +838,64 @@ public class InboundPurchaseService extends BaseService<Inbound> {
|
|
|
throw new BaseBusinessException(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.INVENTORY_QUANTITY_EXCEEDED.getMessage());
|
|
|
}
|
|
|
//endregion
|
|
|
+
|
|
|
//region 编辑入库明细
|
|
|
- inboundItemVO
|
|
|
- .setIntoQty(inboundItemResponse.getIntoQty().add(inboundItemVO.getIntoingQty()))
|
|
|
- .setIntoAmt(inboundItemResponse.getIntoAmt().add(inboundItemVO.getIntoingAmt()))
|
|
|
- .setIntoingQty(BigDecimal.ZERO)
|
|
|
- .setIntoingAmt(BigDecimal.ZERO)
|
|
|
- .setCostPrice(inboundItemVO.getPriceInto())
|
|
|
- .setCostAmt(inboundItemVO.getIntoQty().multiply(inboundItemVO.getPriceInto()).setScale(2, BigDecimal.ROUND_HALF_UP))
|
|
|
- ;
|
|
|
- //入库状态
|
|
|
- String intoStatus = this.setIntoStatus(inboundItemVO.getIntoingQty(), inboundItemVO.getIntoQty());
|
|
|
- inboundItemVO.setIntoStatus(intoStatus);
|
|
|
- //实体转换
|
|
|
- InboundItem inboundItem = inboundItemConvert.convertToPo(inboundItemVO);
|
|
|
- //修改
|
|
|
- inboundItemMapper.update(inboundItem,
|
|
|
- new UpdateWrapper<InboundItem>().lambda()
|
|
|
- .eq(InboundItem::getItemId, UUID.fromString(inboundItem.getItemId()))
|
|
|
- );
|
|
|
+ if(inboundItemVO.getItemId()!=null){
|
|
|
+ inboundItemVO
|
|
|
+ .setIntoQty(inboundItemResponse.getIntoQty().add(inboundItemVO.getIntoingQty()))
|
|
|
+ .setIntoAmt(inboundItemResponse.getIntoAmt().add(inboundItemVO.getIntoingAmt()))
|
|
|
+ .setIntoingQty(BigDecimal.ZERO)
|
|
|
+ .setIntoingAmt(BigDecimal.ZERO)
|
|
|
+ .setCostPrice(inboundItemVO.getPriceInto())
|
|
|
+ .setCostAmt(inboundItemVO.getIntoQty().multiply(inboundItemVO.getPriceInto()).setScale(2, BigDecimal.ROUND_HALF_UP))
|
|
|
+ ;
|
|
|
+ //入库状态
|
|
|
+ String intoStatus = this.setIntoStatus(inboundItemVO.getIntoingQty(), inboundItemVO.getIntoQty());
|
|
|
+ inboundItemVO.setIntoStatus(intoStatus);
|
|
|
+ //实体转换
|
|
|
+ InboundItem inboundItem = inboundItemConvert.convertToPo(inboundItemVO);
|
|
|
+ //修改
|
|
|
+ inboundItemMapper.update(inboundItem,
|
|
|
+ new UpdateWrapper<InboundItem>().lambda()
|
|
|
+ .eq(InboundItem::getItemId, UUID.fromString(inboundItem.getItemId()))
|
|
|
+ );
|
|
|
+ }
|
|
|
+ //endregion
|
|
|
+
|
|
|
+ //region 新建明细
|
|
|
+ else{
|
|
|
+ inboundItemVO
|
|
|
+ .setIntoQty(inboundItemVO.getIntoingQty())
|
|
|
+ .setIntoAmt(inboundItemVO.getIntoingAmt())
|
|
|
+ .setIntoId(inboundVO.getIntoId())
|
|
|
+ .setCostPrice(inboundItemVO.getPriceInto())
|
|
|
+ .setCostAmt(inboundItemVO.getIntoQty().multiply(inboundItemVO.getPriceInto()).setScale(2, BigDecimal.ROUND_HALF_UP))
|
|
|
+ .setIntoType(Constant.IntoType.SALE.getName())
|
|
|
+ .setIntoingQty(BigDecimal.ZERO)
|
|
|
+ .setIntoingAmt(BigDecimal.ZERO)
|
|
|
+ ;
|
|
|
+ //入库状态
|
|
|
+ String intoStatus = this.setIntoStatus(inboundItemVO.getIntoingQty(), inboundItemVO.getIntoQty());
|
|
|
+ inboundItemVO.setIntoStatus(intoStatus);
|
|
|
+ //实体转换
|
|
|
+ InboundItem inboundItem = inboundItemConvert.convertToPo(inboundItemVO);
|
|
|
+ //新建
|
|
|
+ inboundItemMapper.insert(inboundItem);
|
|
|
+ }
|
|
|
//endregion
|
|
|
}
|
|
|
//endregion
|
|
|
|
|
|
//region 删除明细
|
|
|
+ BigDecimal delIntoingQty = BigDecimal.ZERO;
|
|
|
+ BigDecimal delIntoingAmt = BigDecimal.ZERO;
|
|
|
+ BigDecimal delIntoQty = BigDecimal.ZERO;
|
|
|
+ BigDecimal delIntoAmt = BigDecimal.ZERO;
|
|
|
if (inboundVO.getDeleteItemList() != null) {
|
|
|
+ delIntoingAmt = inboundVO.getDeleteItemList().stream().map(InboundItemVO::getIntoingQty).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(6, BigDecimal.ROUND_HALF_UP);
|
|
|
+ delIntoingAmt = inboundVO.getDeleteItemList().stream().map(InboundItemVO::getIntoingAmt).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ delIntoQty = inboundVO.getDeleteItemList().stream().map(InboundItemVO::getIntoQty).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(6, BigDecimal.ROUND_HALF_UP);
|
|
|
+ delIntoAmt = inboundVO.getDeleteItemList().stream().map(InboundItemVO::getIntoingAmt).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
for (InboundItemVO inboundItemVO : inboundVO.getDeleteItemList()) {
|
|
|
if (inboundItemVO.getItemId() != null) {
|
|
|
InboundItem inboundItem = inboundItemConvert.convertToPo(inboundItemVO);
|
|
|
@@ -754,6 +906,7 @@ public class InboundPurchaseService extends BaseService<Inbound> {
|
|
|
.eq(InboundItem::getItemId, UUID.fromString(inboundItem.getItemId()))
|
|
|
);
|
|
|
}
|
|
|
+
|
|
|
//region 采购
|
|
|
if (inboundItemVO.getFromItemId() != null) {
|
|
|
//region 采购订单明细
|
|
|
@@ -768,7 +921,7 @@ public class InboundPurchaseService extends BaseService<Inbound> {
|
|
|
PurchaseItemResponse purchaseItemResponse = purchaseItemMapper.selectById(inboundItemVO.getFromItemId());
|
|
|
//入库状态
|
|
|
String intoStatus = this.setIntoStatus(purchaseItemResponse.getIntoingQty().add(purchaseItem.getIntoingQty()),
|
|
|
- purchaseItemResponse.getIntoQty().add(purchaseItem.getIntoQty()),purchaseItemResponse.getItemQty());
|
|
|
+ purchaseItemResponse.getIntoQty().add(purchaseItem.getIntoQty()), purchaseItemResponse.getItemQty());
|
|
|
purchaseItem.setIntoStatus(intoStatus);
|
|
|
int countRow = purchaseItemMapper.updateById(purchaseItem);
|
|
|
//数量超出
|
|
|
@@ -806,17 +959,17 @@ public class InboundPurchaseService extends BaseService<Inbound> {
|
|
|
//赋值(这里重写了更新方法,数量在更新方法中有数据库院士数量+本次数量)
|
|
|
Purchase purchase = new Purchase();
|
|
|
purchase.setPurId(inboundVO.getFromId());
|
|
|
- purchase.setIntoQty(sumIntoQty);
|
|
|
- purchase.setIntoAmt(sumIntoAmt);
|
|
|
+ purchase.setIntoQty(sumIntoQty.subtract(delIntoQty));
|
|
|
+ purchase.setIntoAmt(sumIntoAmt.subtract(delIntoAmt));
|
|
|
if (inboundResponse != null) {
|
|
|
- purchase.setIntoingQty(inboundResponse.getIntoingQty().negate());
|
|
|
- purchase.setIntoingAmt(inboundResponse.getIntoingAmt().negate());
|
|
|
+ purchase.setIntoingQty(inboundResponse.getIntoingQty().negate().subtract(delIntoingQty));
|
|
|
+ purchase.setIntoingAmt(inboundResponse.getIntoingAmt().negate().subtract(delIntoingAmt));
|
|
|
}
|
|
|
//根据id查询
|
|
|
PurchaseResponse purchaseResponse = purchaseMapper.selectById(inboundVO.getFromId());
|
|
|
//入库状态
|
|
|
String purIntoStatus = this.setIntoStatus(purchaseResponse.getIntoingQty().add(purchase.getIntoingQty()),
|
|
|
- purchaseResponse.getIntoQty().add(purchase.getIntoQty()),purchase.getSumQuantity());
|
|
|
+ purchaseResponse.getIntoQty().add(purchase.getIntoQty()), purchase.getSumQuantity());
|
|
|
purchase.setIntoStatus(purIntoStatus);
|
|
|
//修改
|
|
|
int countRow = purchaseMapper.updateById(purchase);
|
|
|
@@ -872,7 +1025,7 @@ public class InboundPurchaseService extends BaseService<Inbound> {
|
|
|
PurchaseResponse purchaseResponse = purchaseMapper.selectById(inboundVO.getFromId());
|
|
|
//入库状态
|
|
|
String intoStatus = this.setIntoStatus(purchaseResponse.getIntoingQty().add(purchase.getIntoingQty()),
|
|
|
- purchaseResponse.getIntoQty().add(purchase.getIntoQty()),purchaseResponse.getSumQuantity());
|
|
|
+ purchaseResponse.getIntoQty().add(purchase.getIntoQty()), purchaseResponse.getSumQuantity());
|
|
|
purchase.setIntoStatus(intoStatus);
|
|
|
int countRow = purchaseMapper.updateById(purchase);
|
|
|
//数量超出
|
|
|
@@ -915,7 +1068,7 @@ public class InboundPurchaseService extends BaseService<Inbound> {
|
|
|
PurchaseItemResponse purchaseItemResponse = purchaseItemMapper.selectById(inboundItemResponse.getFromItemId());
|
|
|
//入库状态
|
|
|
String intoStatus = this.setIntoStatus(purchaseItemResponse.getIntoingQty().add(purchaseItem.getIntoingQty()),
|
|
|
- purchaseItemResponse.getIntoQty().add(purchaseItem.getIntoQty()),purchaseItemResponse.getItemQty());
|
|
|
+ purchaseItemResponse.getIntoQty().add(purchaseItem.getIntoQty()), purchaseItemResponse.getItemQty());
|
|
|
purchaseItem.setIntoStatus(intoStatus);
|
|
|
//修改
|
|
|
int countRow = purchaseItemMapper.updateById(purchaseItem);
|
|
|
@@ -996,15 +1149,15 @@ public class InboundPurchaseService extends BaseService<Inbound> {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * @desc : 上游单据入库状态通用(目前本页面)
|
|
|
- * @date : 2024/4/1 17:14
|
|
|
+ * @desc : 上游单据入库状态通用(目前本页面)
|
|
|
+ * @date : 2024/4/1 17:14
|
|
|
* @author : 寇珊珊
|
|
|
*/
|
|
|
- public String setIntoStatus(BigDecimal intoingQty, BigDecimal intoQty,BigDecimal sumQty) {
|
|
|
+ public String setIntoStatus(BigDecimal intoingQty, BigDecimal intoQty, BigDecimal sumQty) {
|
|
|
//入库状态
|
|
|
String intoStatus = null;
|
|
|
//入库中+已入库 小于 总数
|
|
|
- if (intoingQty.add(intoingQty).compareTo(sumQty) < 0 ) {
|
|
|
+ if (intoingQty.add(intoingQty).compareTo(sumQty) < 0) {
|
|
|
//入库中
|
|
|
intoStatus = Constant.IntoStatus.RUKUZHONG.getName();
|
|
|
}
|