Browse Source

11月14日 库存扣减更新

XMLWAN 3 years ago
parent
commit
3dc44528e2

+ 11 - 0
src/xt_pages/supply/components/addGoodOrder.vue View File

@@ -73,6 +73,13 @@
73 73
             v-show="showTwo"
74 74
             >保存</el-button
75 75
           >
76
+          <el-button
77
+            size="small"
78
+            type="primary"
79
+            @click="toPrint"
80
+            v-show="showSix"
81
+            >打印</el-button
82
+          >
76 83
           <el-button size="small" type="primary" @click="checkGoodOrder" v-if="is_check == 2" >审核</el-button>
77 84
           <el-button size="small" type="primary" @click="MofyGoodOrder" v-if="is_check == 1">反审核</el-button>
78 85
           <el-button size="small" type="primary" @click="toClick" v-if="is_check == 1" >生成采购退货单</el-button>
@@ -497,6 +504,7 @@ export default {
497 504
       ],
498 505
       showTwo: true,
499 506
       showOne: false,
507
+      showSix:false,
500 508
       recordInfo: {
501 509
         tableList: [],
502 510
       },
@@ -1024,6 +1032,7 @@ export default {
1024 1032
               this.$message.success("保存成功!");
1025 1033
               this.showOne = false;
1026 1034
               this.showTwo = true;
1035
+              this.showSix = true
1027 1036
               var orderInfo = response.data.data.list;
1028 1037
               var warehouseOut = response.data.data.warehouseOut;
1029 1038
               this.is_check = 2
@@ -1147,6 +1156,7 @@ export default {
1147 1156
             if (response.data.state == 1) {
1148 1157
               this.loading = false;
1149 1158
               this.$message.success("保存成功!");
1159
+              
1150 1160
             }
1151 1161
           });
1152 1162
         }
@@ -1167,6 +1177,7 @@ export default {
1167 1177
           this.showOne = false;
1168 1178
           this.showTwo = true;
1169 1179
           this.showThree = true;
1180
+          this.showSix = true
1170 1181
           this.loading = false
1171 1182
           var purcaseOrder = response.data.data.purcaseOrder;
1172 1183
           var goodOrder = response.data.data.goodOrder;

+ 72 - 6
src/xt_pages/supply/components/addGoodReturn.vue View File

@@ -796,9 +796,7 @@ export default {
796 796
   getAllPrice() {
797 797
       var total_price = 0;
798 798
       for (let i = 0; i < this.recordInfo.tableList.length; i++) {
799
-        total_price +=
800
-          this.recordInfo.tableList[i].supply_price *
801
-          this.recordInfo.tableList[i].supply_count;
799
+        total_price += this.recordInfo.tableList[i].supply_price *this.recordInfo.tableList[i].supply_count - (this.recordInfo.tableList[i].supply_price**this.recordInfo.tableList[i].supply_count*(this.recordInfo.tableList[i].deposit_rate/100));
802 800
       }
803 801
       this.total_price = total_price;
804 802
       // this.discount_amount = (this.total_price * this.rate_of_concession * 0.01).toFixed(2);
@@ -932,20 +930,27 @@ export default {
932 930
                   orderInfo[i].max_unit =drugList[j].max_unit
933 931
                   orderInfo[i].min_unit =drugList[j].min_unit
934 932
                 }
935
-
933
+                
934
+                orderInfo[i].count = this.getWarehoseInfoSix(orderInfo[i].drug_warehouse_info,orderInfo[i].drug.max_unit,orderInfo[i].drug.min_unit,orderInfo[i].drug.min_number,orderInfo[i].warehouse_out_id)
936 935
               }
937
-              orderInfo[i].count = orderInfo[i].count + orderInfo[i].supply_unit
936
+
937
+              // orderInfo[i].count = orderInfo[i].count + orderInfo[i].supply_unit
938 938
             }
939
+
940
+
939 941
             if (orderInfo[i].is_source == 2) {
940 942
               for (let j = 0; j < goodList.length; j++) {
941 943
                 if (orderInfo[i].project_id == goodList[j].id) {
942 944
                   orderInfo[i].unitList = [{ id: 1, name: "" }];
943 945
                   orderInfo[i].unitList[0].name = goodList[j].packing_unit;
944 946
                 }
947
+
948
+                orderInfo[i].count =  this.getTotalStockCountSix(orderInfo[i].good_warehouse_info,orderInfo[i].warehouse_out_id)
945 949
               }
946 950
               orderInfo[i].sum_count = orderInfo[i].count
947 951
               orderInfo[i].min_number = 0
948
-              orderInfo[i].count = orderInfo[i].count;
952
+
953
+             // orderInfo[i].count = orderInfo[i].count;
949 954
               orderInfo[i].max_unit =""
950 955
               orderInfo[i].min_unit =""
951 956
             }
@@ -1165,6 +1170,7 @@ export default {
1165 1170
        id:this.id,
1166 1171
      }
1167 1172
      console.log("审核2322323232323",params)
1173
+ 
1168 1174
      checkReturnOrder(params).then(response=>{
1169 1175
        if(response.data.state == 1){
1170 1176
 
@@ -1266,6 +1272,66 @@ export default {
1266 1272
     toPrint() {
1267 1273
       this.$router.push({ path: "/good/return/print?&id=" + this.id });
1268 1274
     },
1275
+
1276
+   getWarehoseInfoSix(arr, max_unit, min_unit, min_number,warehouse_out_id) {
1277
+      var total = 0;
1278
+      var max_str = "";
1279
+      var min_str = "";
1280
+      var newArr = []
1281
+      if (arr.length > 0) {
1282
+        for (let i = 0; i < arr.length; i++) {
1283
+          if(warehouse_out_id == arr[i].supply_warehouse_id){
1284
+              newArr.push(arr[i])
1285
+          }
1286
+          
1287
+        }
1288
+      }
1289
+     
1290
+      if(newArr.length > 0){
1291
+         for(let i=0;i<newArr.length;i++){
1292
+           total += parseInt(newArr[i].stock_max_number+ newArr[i].stock_min_number);
1293
+         }
1294
+      }
1295
+     console.log("total232323232",total)
1296
+      if (total < min_number) {
1297
+        min_str = total + min_unit;
1298
+      }
1299
+      if (total == 0) {
1300
+        min_str = "";
1301
+        max_str = "";
1302
+      }
1303
+      if (total >= min_number) {
1304
+        if (parseInt(total / min_number) != 0) {
1305
+          max_str = parseInt(total / min_number) + max_unit;
1306
+        }
1307
+        if (total % min_number != 0) {
1308
+          min_str = (total % min_number) + min_unit;
1309
+        }
1310
+      }
1311
+      console.log("hh2332232332",max_str + min_str)
1312
+      return max_str + min_str;
1313
+    },
1314
+    getTotalStockCountSix(arr,warehouse_out_id) {
1315
+      var total_count = 0;
1316
+      var newArr =[]
1317
+      for (let i = 0; i < arr.length; i++) {
1318
+        if(arr[i].supply_warehouse_id == warehouse_out_id){
1319
+           newArr.push(arr[i])
1320
+        }
1321
+      }
1322
+      if(newArr.length > 0){
1323
+        for(let i=0;i<newArr.length;i++){
1324
+          total_count += arr[i].stock_count;
1325
+        }
1326
+      }
1327
+     
1328
+      if(total_count > 0){
1329
+       return total_count;
1330
+      }else{
1331
+        return ""
1332
+      }
1333
+
1334
+    },
1269 1335
   },
1270 1336
   created() {
1271 1337
     const tempObj = {};

+ 1 - 1
src/xt_pages/supply/components/addPurchaseOrder.vue View File

@@ -915,7 +915,7 @@ export default {
915 915
             if (response.data.state == 1) {
916 916
               var info = response.data.data.info;
917 917
               this.is_check = info.is_check
918
-              this.showOne = true
918
+              this.showOne = false
919 919
               this.showTwo = false
920 920
               this.showThree = true
921 921
               this.disabled = true;

+ 1 - 3
src/xt_pages/supply/components/editGoodReturn.vue View File

@@ -953,9 +953,7 @@ export default {
953 953
   getAllPrice() {
954 954
       var total_price = 0;
955 955
       for (let i = 0; i < this.recordInfo.tableList.length; i++) {
956
-        total_price +=
957
-          this.recordInfo.tableList[i].supply_price *
958
-          this.recordInfo.tableList[i].supply_count;
956
+        total_price += this.recordInfo.tableList[i].supply_price *this.recordInfo.tableList[i].supply_count - (this.recordInfo.tableList[i].supply_price**this.recordInfo.tableList[i].supply_count*(this.recordInfo.tableList[i].deposit_rate/100));
959 957
       }
960 958
       this.total_price = total_price;
961 959
       // this.discount_amount = (this.total_price * this.rate_of_concession * 0.01).toFixed(2);

+ 24 - 1
src/xt_pages/supply/components/goodReturnPrint.vue View File

@@ -111,6 +111,16 @@
111 111
             >
112 112
               优惠金额:<span v-if="discount_amount>0">{{discount_amount}}</span>
113 113
             </div>
114
+            <!-- <div
115
+              style="
116
+                width: 25%;
117
+                text-align: left;
118
+                margin-bottom: 1px;
119
+                font-size: 18px;
120
+              "
121
+            >
122
+            优惠后金额:<span v-if="getAllPriceTwo()>0">{{getAllPriceTwo()}}</span>
123
+            </div> -->
114 124
             <div
115 125
               style="
116 126
                 width: 25%;
@@ -369,12 +379,25 @@ export default {
369 379
       }
370 380
      
371 381
     },
372
-   getAllPriceTwo() {
382
+    getAllPriceTwo() {
373 383
       var total_price = 0;
374 384
       for (let i = 0; i < this.tableList.length; i++) {
375 385
         total_price +=(this.tableList[i].price *this.tableList[i].supply_count - (this.tableList[i].price * this.tableList[i].supply_count*this.tableList[i].deposit_rate/100))
376 386
       }
377 387
       this.total_price = total_price;
388
+      if(total_price > 0){
389
+         return this.smallToBIG(total_price.toFixed(2));
390
+      }else{
391
+        return ""
392
+      }
393
+     
394
+    },
395
+   getAllPriceTwo() {
396
+      var total_price = 0;
397
+      for (let i = 0; i < this.tableList.length; i++) {
398
+        total_price +=(this.tableList[i].price *this.tableList[i].supply_count)
399
+      }
400
+      this.total_price = total_price;
378 401
       if(total_price > 0){
379 402
          return total_price.toFixed(2);
380 403
       }else{