Browse Source

no message

FengChaoYu 4 weeks ago
parent
commit
06563ef2d4

+ 4 - 1
mall-server-api/src/main/java/com/gree/mall/manager/bean/material/stock/WebsitStockDTO.java

@@ -111,6 +111,9 @@ public class WebsitStockDTO {
     @ApiModelProperty(value = "单位")
     private String goodsStockUnit;
 
+    @ApiModelProperty(value = "是否允许负库存")
+    private Boolean allowLossStock = Boolean.FALSE;
+
     public WebsitStock createPartsStock() {
         WebsitStock websitStock = new WebsitStock();
         BeanUtils.copyProperties(this, websitStock);
@@ -137,7 +140,7 @@ public class WebsitStockDTO {
 //        if (closeQty.compareTo(BigDecimal.ZERO) < 0 && direct.compareTo(BigDecimal.ZERO) < 0 && !this.getRefType().equals("销售订单")) {
 //            throw new RemoteServiceException("\""+ websitStock.getGoodsName() + "\"商品库存不允许为负");
 //        }
-        if (closeQty.compareTo(BigDecimal.ZERO) < 0 && direct.compareTo(BigDecimal.ZERO) < 0) {
+        if (!allowLossStock && closeQty.compareTo(BigDecimal.ZERO) < 0 && direct.compareTo(BigDecimal.ZERO) < 0) {
             throw new RemoteServiceException("\""+ websitStock.getGoodsName() + "\"商品库存不允许为负");
         }
         // 注入三级帐

+ 1 - 0
mall-server-api/src/main/java/com/gree/mall/manager/logic/material/stock/WebitPurchaseStockLogic.java

@@ -125,6 +125,7 @@ public class WebitPurchaseStockLogic {
                 subStockDTO.setOperateTime(purchaseAdjustment.getConfirmTime());
                 subStockDTO.setObj("供应商");
                 subStockDTO.setStorageId(purchaseAdjustment.getStorageId());
+                subStockDTO.setAllowLossStock(Boolean.TRUE);
                 shopStockDTOS.add(subStockDTO);
             }