Browse Source

11月14日 库存扣减更新

XMLWAN 3 years ago
parent
commit
192f193c88

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

@@ -865,9 +865,7 @@ export default {
865 865
             orderInfo[i].project_id = orderInfo[i].project_id;
866 866
             orderInfo[i].supply_unit = orderInfo[i].supply_unit;
867 867
             orderInfo[i].order_number = orderInfo[i].order_number;
868
-            orderInfo[i].supply_total_price = (
869
-              orderInfo[i].count * orderInfo[i].price
870
-            ).toFixed(2);
868
+            orderInfo[i].supply_total_price = (orderInfo[i].count * orderInfo[i].price).toFixed(2);
871 869
             if (orderInfo[i].is_source == 1) {
872 870
               for (let j = 0; j < drugList.length; j++) {
873 871
                 if (orderInfo[i].project_id == drugList[j].id) {

+ 22 - 30
src/xt_pages/supply/components/addGoodReturn.vue View File

@@ -348,9 +348,7 @@ export default {
348 348
       ],
349 349
       showTwo: false,
350 350
       showOne: true,
351
-      recordInfo: {
352
-        tableList: [1],
353
-      },
351
+      recordInfo: {tableList: []},
354 352
       keywords: "",
355 353
       total: 0,
356 354
       multipleSelection: [],
@@ -572,6 +570,7 @@ export default {
572 570
       tempObj["is_total"] = 1;
573 571
       tempObj["project_id"] = 0;
574 572
       tempObj["supply_unit"] = "";
573
+      tempObj["order_number"] = ""
575 574
       this.recordInfo.tableList.push(tempObj);
576 575
     },
577 576
     handleDelete: function (index, row) {
@@ -646,26 +645,14 @@ export default {
646 645
       this.$refs["tableForm"].validate((valid) => {
647 646
         if (valid) {
648 647
           for (let i = 0; i < this.recordInfo.tableList.length; i++) {
649
-            this.recordInfo.tableList[i].supply_count = parseInt(
650
-              this.recordInfo.tableList[i].supply_count
651
-            );
652
-            this.recordInfo.tableList[i].supply_license_number =
653
-              this.recordInfo.tableList[i].supply_license_number.toString();
654
-            this.recordInfo.tableList[i].supply_total_price = (
655
-              this.recordInfo.tableList[i].supply_count *
656
-              this.recordInfo.tableList[i].supply_price
657
-            ).toString();
658
-            this.recordInfo.tableList[i].supply_total =
659
-              this.recordInfo.tableList[i].supply_total.toString();
660
-            this.recordInfo.tableList[i].supply_price =
661
-              this.recordInfo.tableList[i].supply_price.toString();
648
+            this.recordInfo.tableList[i].supply_count = parseInt(this.recordInfo.tableList[i].supply_count);
649
+            this.recordInfo.tableList[i].supply_license_number =this.recordInfo.tableList[i].supply_license_number.toString();
650
+            this.recordInfo.tableList[i].supply_total_price = (this.recordInfo.tableList[i].supply_count *this.recordInfo.tableList[i].supply_price).toString();
651
+            this.recordInfo.tableList[i].supply_total = this.recordInfo.tableList[i].supply_total.toString();
652
+            this.recordInfo.tableList[i].supply_price =this.recordInfo.tableList[i].supply_price.toString();
662 653
             for (let j = 0; j < this.manufactuerList.length; j++) {
663
-              if (
664
-                this.recordInfo.tableList[i].supply_manufacturer ==
665
-                this.manufactuerList[j].manufacturer_name
666
-              ) {
667
-                this.recordInfo.tableList[i].manufacturer_id =
668
-                  this.manufactuerList[j].id;
654
+              if (this.recordInfo.tableList[i].supply_manufacturer ==this.manufactuerList[j].manufacturer_name) {
655
+                this.recordInfo.tableList[i].manufacturer_id =this.manufactuerList[j].id;
669 656
               }
670 657
             }
671 658
           }
@@ -698,9 +685,7 @@ export default {
698 685
     getAllPrice() {
699 686
       var total_price = 0;
700 687
       for (let i = 0; i < this.recordInfo.tableList.length; i++) {
701
-        total_price +=
702
-          this.recordInfo.tableList[i].supply_price *
703
-          this.recordInfo.tableList[i].supply_count;
688
+        total_price += this.recordInfo.tableList[i].supply_price *this.recordInfo.tableList[i].supply_count;
704 689
       }
705 690
       this.total_price = total_price;
706 691
       return total_price.toFixed(2);
@@ -726,7 +711,8 @@ export default {
726 711
     getGoodOrderDetail(){
727 712
       
728 713
         var id = this.$route.query.id
729
-      getGoodOrderDetail(id).then(response=>{
714
+        var ids = this.$route.query.ids
715
+      getGoodOrderDetail(id,ids).then(response=>{
730 716
         if(response.data.state == 1){
731 717
           var out = response.data.data.out
732 718
           this.is_check = out.is_check
@@ -811,8 +797,8 @@ export default {
811 797
             }
812 798
           }
813 799
           var params = {
814
-            "stockIn":this.recordInfo.tableList,
815
-            "return_marke":this.return_remark,
800
+            stockIn:this.recordInfo.tableList,
801
+            return_marke:this.return_remark,
816 802
           }
817 803
           console.log("start_time232233232",this.start_time)
818 804
           
@@ -895,10 +881,16 @@ export default {
895 881
     tempObj["is_total"] = 1;
896 882
     tempObj["project_id"] = 0;
897 883
     tempObj["supply_unit"] = "";
884
+    tempObj["order_number"] = ""
898 885
     this.recordInfo.tableList.push(tempObj);
886
+    console.log("即哪里地方2",this.recordInfo.tableList)
899 887
     this.getInitOrder();
900
-    //获取购货单列表
901
-    this.getGoodOrderDetail();
888
+    if(parseInt(this.$route.query.id) > 0){
889
+     
890
+     //获取购货单列表
891
+      this.getGoodOrderDetail();
892
+    }
893
+ 
902 894
   },
903 895
 };
904 896
 </script>

+ 17 - 13
src/xt_pages/supply/components/editGoodOrder.vue View File

@@ -39,7 +39,6 @@
39 39
             align="right"
40 40
             format="yyyy-MM-dd"
41 41
             value-format="yyyy-MM-dd"
42
-            @change="startTimeChange"
43 42
           ></el-date-picker>
44 43
           <!-- <span>交货日期:</span> -->
45 44
           <!-- <el-date-picker
@@ -1084,8 +1083,9 @@ export default {
1084 1083
           console.log("drugList233223232323232", drugList);
1085 1084
           var cancelOrderList = response.data.data.cancelOrderList;
1086 1085
           console.log("cancelOrderList2323322322332", cancelOrderList);
1086
+          var ids =""
1087 1087
           if(cancelList.length == 0){
1088
-            this.$router.push({ path: "/good/return/add?id=" + this.id });
1088
+            this.$router.push({ path: "/good/return/add?id=" + this.id+"&ids="+ids });
1089 1089
           }
1090 1090
           if (cancelList.length > 0) {
1091 1091
             var outList = response.data.data.outList;
@@ -1134,15 +1134,18 @@ export default {
1134 1134
                 }
1135 1135
               }
1136 1136
               console.log("newAr2332232323", newArr)
1137
-
1137
+           
1138
+            var arr = []
1139
+            var total = 0;
1140
+            var str = "";
1138 1141
                 //如果采购单有数据,则需要比较数量
1139 1142
             if (newArr.length > 0) {
1140
-              for (let i = 0; i < purcaseOrder.length; i++) {
1143
+              for (let i = 0; i < outList.length; i++) {
1141 1144
                 for (let j = 0; j < newArr.length; j++) {
1142
-                  if (purcaseOrder[i].project_id == newArr[j].project_id) {
1143
-                    //根据商品ID比较数量大小,把数量不足的商品ID储存,表示采购单的数量未满足采购订单的数据,可以继续生成采购
1144
-                    if (purcaseOrder[i].count > newArr[j].count) {
1145
-                      arr.push(purcaseOrder[i].project_id);
1145
+                  if (outList[i].project_id == newArr[j].project_id) {
1146
+                    //根据商品ID比较数量大小,把数量不足的商品ID储存,表示退货单的数量未满足采购单的数据,可以继续生成退货
1147
+                    if (outList[i].count > newArr[j].count) {
1148
+                      arr.push(outList[i].project_id);
1146 1149
                     }
1147 1150
                   }
1148 1151
                 }
@@ -1154,9 +1157,9 @@ export default {
1154 1157
                 return;
1155 1158
               }
1156 1159
 
1157
-              if (total != goodOrder.length) {
1160
+              if (total != cancelOrderList.length) {
1158 1161
                 str = arr.join(",");
1159
-                this.$router.push({ path: "/good/order/add?id=" + id + "&ids=" + str});
1162
+                this.$router.push({ path: "/good/return/edit?id=" + id + "&ids=" + str});
1160 1163
               }
1161 1164
              }
1162 1165
             }
@@ -1181,12 +1184,14 @@ export default {
1181 1184
             this.$message.success("反审核成功!");
1182 1185
           }
1183 1186
           if (msg == 2) {
1187
+            var cancelList = response.data.data.cancelList
1188
+            console.log("cancelLIST2332322332232323",cancelList)
1184 1189
             this.$message.error("该单有自动出库或生成了退货单,反审核失败!");
1190
+            return 
1185 1191
           }
1186 1192
 
1187 1193
           var purcaseOrder = response.data.data.purcaseOrder;
1188 1194
           console.log("采购订单", purcaseOrder);
1189
-
1190 1195
           var goodOrder = response.data.data.goodOrder;
1191 1196
           console.log("采购单", goodOrder);
1192 1197
           var drugList = response.data.data.drugList;
@@ -1202,8 +1207,7 @@ export default {
1202 1207
             for (let j = 0; j < drugList.length; j++) {
1203 1208
               if (purcaseOrder[i].is_source == 1) {
1204 1209
                 if (purcaseOrder[i].supply_unit == drugList[j].max_unit) {
1205
-                  purcaseOrder[i].count =
1206
-                    purcaseOrder[i].count * drugList[j].min_number;
1210
+                  purcaseOrder[i].count = purcaseOrder[i].count * drugList[j].min_number;
1207 1211
                 }
1208 1212
               }
1209 1213
             }

+ 14 - 52
src/xt_pages/supply/components/editPurchaseOrder.vue View File

@@ -344,20 +344,6 @@
344 344
       </div>
345 345
     </div>
346 346
 
347
-    <!-- <el-dialog
348
-  title="系统提示"
349
-  :visible.sync="dialogVisible"
350
-  width="30%">
351
-  <span>
352
-    采购订单{{number}}已有以下关联数据,不能反审核
353
-    <div v-for="(item,index) in orderList" :key="index">
354
-        <li>采购单{{item.good_number}}</li> <a @click="toClick(item.id)">点击查看</a>
355
-    </div>
356
-  </span>
357
-  <span slot="footer" class="dialog-footer">
358
-    <el-button @click="dialogVisible = false">取 消</el-button>
359
-  </span>
360
-  </el-dialog> -->
361 347
   </div>
362 348
 </template>
363 349
 
@@ -540,19 +526,11 @@ export default {
540 526
                 goodList[i].good_type_id = this.goodTypeList[y].type_name;
541 527
               }
542 528
             }
543
-            goodList[i].supply_name =
544
-              goodList[i].good_name +
545
-              " " +
546
-              goodList[i].specification_name +
547
-              " " +
548
-              goodList[i].manufacturer;
529
+            goodList[i].supply_name =goodList[i].good_name +" " +goodList[i].specification_name +" " + goodList[i].manufacturer;
549 530
             goodList[i].supply_type = goodList[i].good_type_id;
550
-            goodList[i].supply_specification_name =
551
-              goodList[i].specification_name;
531
+            goodList[i].supply_specification_name =goodList[i].specification_name;
552 532
             goodList[i].supply_price = goodList[i].buy_price;
553
-            goodList[i].supply_total = this.getTotalStockCount(
554
-              goodList[i].good_warehouse_info
555
-            );
533
+            goodList[i].supply_total = this.getTotalStockCount(goodList[i].good_warehouse_info);
556 534
             goodList[i].supply_count = "";
557 535
             goodList[i].supply_total_price = "";
558 536
             goodList[i].supply_manufacturer = goodList[i].manufacturer;
@@ -583,8 +561,7 @@ export default {
583 561
           this.recordInfo.tableList[i].name = val.name;
584 562
           this.recordInfo.tableList[i].supply_name = val.supply_name;
585 563
           this.recordInfo.tableList[i].supply_type = val.supply_type;
586
-          this.recordInfo.tableList[i].supply_specification_name =
587
-            val.supply_specification_name;
564
+          this.recordInfo.tableList[i].supply_specification_name =val.supply_specification_name;
588 565
           this.recordInfo.tableList[i].supply_total = val.supply_total;
589 566
           if (val.supply_count == NaN) {
590 567
             this.recordInfo.tableList[i].supply_count = "";
@@ -594,15 +571,10 @@ export default {
594 571
               : "";
595 572
           }
596 573
 
597
-          this.recordInfo.tableList[i].supply_price = val.supply_price
598
-            ? val.supply_price
599
-            : "";
600
-          this.recordInfo.tableList[i].supply_total_price =
601
-            val.supply_total_price ? val.supply_total_price : "";
602
-          this.recordInfo.tableList[i].supply_manufacturer =
603
-            val.supply_manufacturer;
604
-          this.recordInfo.tableList[i].supply_license_number =
605
-            val.supply_license_number;
574
+          this.recordInfo.tableList[i].supply_price = val.supply_price? val.supply_price: "";
575
+          this.recordInfo.tableList[i].supply_total_price =val.supply_total_price ? val.supply_total_price : "";
576
+          this.recordInfo.tableList[i].supply_manufacturer =val.supply_manufacturer;
577
+          this.recordInfo.tableList[i].supply_license_number =val.supply_license_number;
606 578
           this.recordInfo.tableList[i].supply_remake = val.supply_remake;
607 579
           this.recordInfo.tableList[i].is_total = val.is_total;
608 580
           this.recordInfo.tableList[i].supply_unit = val.supply_unit;
@@ -709,19 +681,11 @@ export default {
709 681
           console.log("生产厂商", this.recordInfo.tableList);
710 682
           console.log("生产上次", this.manufactuerList);
711 683
           for (let i = 0; i < this.recordInfo.tableList.length; i++) {
712
-            this.recordInfo.tableList[i].supply_count = parseInt(
713
-              this.recordInfo.tableList[i].supply_count
714
-            );
715
-            this.recordInfo.tableList[i].supply_license_number =
716
-              this.recordInfo.tableList[i].supply_license_number.toString();
717
-            this.recordInfo.tableList[i].supply_total_price = (
718
-              this.recordInfo.tableList[i].supply_count *
719
-              this.recordInfo.tableList[i].supply_price
720
-            ).toString();
721
-            this.recordInfo.tableList[i].supply_total =
722
-              this.recordInfo.tableList[i].supply_total.toString();
723
-            this.recordInfo.tableList[i].supply_price =
724
-              this.recordInfo.tableList[i].supply_price.toString();
684
+            this.recordInfo.tableList[i].supply_count = parseInt(this.recordInfo.tableList[i].supply_count);
685
+            this.recordInfo.tableList[i].supply_license_number =this.recordInfo.tableList[i].supply_license_number.toString();
686
+            this.recordInfo.tableList[i].supply_total_price = (this.recordInfo.tableList[i].supply_count *this.recordInfo.tableList[i].supply_price).toString();
687
+            this.recordInfo.tableList[i].supply_total =this.recordInfo.tableList[i].supply_total.toString();
688
+            this.recordInfo.tableList[i].supply_price = this.recordInfo.tableList[i].supply_price.toString();
725 689
             for (let j = 0; j < this.manufactuerList.length; j++) {
726 690
               if (
727 691
                 this.recordInfo.tableList[i].supply_manufacturer ==
@@ -974,9 +938,7 @@ export default {
974 938
 
975 939
               if (total != goodOrder.length) {
976 940
                 str = arr.join(",");
977
-                this.$router.push({
978
-                  path: "/good/order/add?id=" + id + "&ids=" + str,
979
-                });
941
+                this.$router.push({path: "/good/order/add?id=" + id + "&ids=" + str});
980 942
               }
981 943
             }
982 944
           }

+ 2 - 2
src/xt_pages/supply/goodreturn.vue View File

@@ -95,12 +95,12 @@
95 95
          </el-table-column>
96 96
         <el-table-column label="关联购货订单号" align="center" width="200">
97 97
           <template slot-scope="scope">
98
-            <span v-if="scope.row.cancelOrder.length >0">{{scope.row.cancelOrder[0].order_number}}</span>
98
+            <span v-if="scope.row.cancelOrder!=undefined && scope.row.cancelOrder.length >0">{{scope.row.cancelOrder[0].order_number}}</span>
99 99
           </template>
100 100
         </el-table-column>
101 101
            <el-table-column label="源采购单号" align="center" width="200">
102 102
           <template slot-scope="scope">
103
-             <span v-if="scope.row.cancelOrder.length >0">{{scope.row.cancelOrder[0].good_number}}</span>
103
+             <span v-if="scope.row.cancelOrder!=undefined && scope.row.cancelOrder.length >0">{{scope.row.cancelOrder[0].good_number}}</span>
104 104
           </template>
105 105
         </el-table-column>
106 106
         <el-table-column label="购货金额" align="center" width="200">