ソースを参照

销售列表增加库存类型

周箭河 5 年 前
コミット
0a673cfa4a

+ 24 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SellOrderServiceImpl.java

@@ -66,6 +66,9 @@ public class SellOrderServiceImpl extends BaseServiceImpl<Integer, SellOrder> im
         BigDecimal hasRouteBalance = BigDecimal.ZERO;
         BigDecimal goodsTotalBalance = goodsTotalPrice.multiply(balance).divide(totalAmount, 2, BigDecimal.ROUND_HALF_UP);
         List<SellOrder> sellOrders = new ArrayList<>();
+
+        AccountType accountType = sysPaymentConfigService.checkAccountType(PaymentChannelEnum.valueOf(order.getPaymentChannel()), order.getMerNos());
+
         for (Integer goodsId : goodsIds) {
             SellOrder sellOrder = new SellOrder();
             BigDecimal goodsPrice = BigDecimal.ZERO;
@@ -115,6 +118,24 @@ public class SellOrderServiceImpl extends BaseServiceImpl<Integer, SellOrder> im
             } else {
                 sellOrder.setType(SellTypeEnum.OTHER);
             }
+
+            StockType goodsStockType = StockType.INTERNAL;
+            for (Goods goods : goodies) {
+                if (goods.getId().equals(goodsId)) {
+                    goodsStockType = goods.getStockType();
+                    break;
+                }
+            }
+            //库存类型
+            if(goodsStockType.equals(StockType.ALL) && accountType.equals(AccountType.INTERNAL)){
+                sellOrder.setStockType(StockType.INTERNAL);
+            }else if(goodsStockType.equals(StockType.ALL) && accountType.equals(AccountType.EXTERNAL)){
+                sellOrder.setStockType(StockType.EXTERNAL);
+            }else {
+                sellOrder.setStockType(goodsStockType);
+            }
+            //批次号 TODO
+
             sellOrders.add(sellOrder);
             i++;
         }
@@ -137,7 +158,9 @@ public class SellOrderServiceImpl extends BaseServiceImpl<Integer, SellOrder> im
 
         int i = 1;
         BigDecimal detailRouteBalance = BigDecimal.ZERO;
+
         AccountType accountType = sysPaymentConfigService.checkAccountType(PaymentChannelEnum.valueOf(studentPaymentOrder.getPaymentChannel()), studentPaymentOrder.getMerNos());
+
         for (StudentPaymentOrderDetail orderDetail : orderDetails) {
 
             BigDecimal detailBalance = orderDetail.getPrice().compareTo(BigDecimal.ZERO) <= 0 ? BigDecimal.ZERO :
@@ -220,7 +243,7 @@ public class SellOrderServiceImpl extends BaseServiceImpl<Integer, SellOrder> im
                 }else {
                     sellOrder.setStockType(goods.getStockType());
                 }
-                //批次号
+                //批次号 TODO
 
                 sellOrders.add(sellOrder);
             }