Parcourir la source

11月14日 库存扣减更新

XMLWAN il y a 3 ans
Parent
révision
fcad8f33bd

+ 22 - 16
src/xt_pages/supply/components/addGoodOrder.vue Voir le fichier

@@ -528,7 +528,8 @@ export default {
528 528
       showTwo: false,
529 529
       warese_out_id: 0,
530 530
       return_remark: "",
531
-      is_warehouse:0
531
+      is_warehouse:0,
532
+      tableDataList:[]
532 533
     };
533 534
   },
534 535
   methods: {
@@ -851,7 +852,6 @@ export default {
851 852
             orderInfo[i].supply_product_date = "";
852 853
             orderInfo[i].supply_expiry_date = "";
853 854
           }
854
-          console.log("drugli323322332", orderInfo);
855 855
           var drugList = response.data.data.baseList;
856 856
           var goodList = response.data.data.goodList;
857 857
           for (let i = 0; i < orderInfo.length; i++) {
@@ -893,8 +893,10 @@ export default {
893 893
 
894 894
           this.recordInfo.tableList = [];
895 895
           this.recordInfo.tableList = orderInfo;
896
-
897
-          console.log("orderINFO23323232", this.recordInfo.tableList);
896
+          //用来判断是否删除了从采购订单的数据
897
+          this.tableDataList = []
898
+          this.tableDataList = orderInfo
899
+         
898 900
         }
899 901
       });
900 902
     },
@@ -910,9 +912,7 @@ export default {
910 912
       }
911 913
 
912 914
       for (let i = 0; i < this.recordInfo.tableList.length; i++) {
913
-        this.recordInfo.tableList[i].supply_count = parseInt(
914
-          this.recordInfo.tableList[i].supply_count
915
-        );
915
+        this.recordInfo.tableList[i].supply_count = parseInt(this.recordInfo.tableList[i].supply_count);
916 916
         this.recordInfo.tableList[i].supply_price =
917 917
           this.recordInfo.tableList[i].supply_price.toString();
918 918
         this.recordInfo.tableList[i].supply_total_price =
@@ -942,6 +942,15 @@ export default {
942 942
         if (valid) {
943 943
           this.loading = true;
944 944
           var warehousing_id = this.$route.query.id;
945
+          //判断是否在采购订单数据中做了删除,如果长度相等则代表没有删除,如果不等则代表做了删除或者新增
946
+        
947
+          if(this.tableDataList.length != this.recordInfo.tableList){
948
+             warehousing_id = 0
949
+             for(let i=0;i<this.recordInfo.tableList.length;i++){
950
+              this.recordInfo.tableList[i].id = 0
951
+              this.number = ""
952
+             }
953
+          }
945 954
           var params = {
946 955
             stockIn: this.recordInfo.tableList,
947 956
             return_remake: this.return_remark,
@@ -1089,7 +1098,7 @@ export default {
1089 1098
     checkGoodOrder() {
1090 1099
       var id = this.warese_out_id;
1091 1100
       var warehousing_id = this.warehousing_id;
1092
-      console.log("hhh2323232323232323",id,warehousing_id)
1101
+      
1093 1102
       getGoodOrderCountList(id, warehousing_id).then((response) => {
1094 1103
         if (response.data.state == 1) {
1095 1104
           this.$message.success("审核成功!");
@@ -1098,12 +1107,9 @@ export default {
1098 1107
           this.showTwo = true;
1099 1108
           this.showThree = true;
1100 1109
           var purcaseOrder = response.data.data.purcaseOrder;
1101
-          console.log("采购订单", purcaseOrder);
1102
-
1103 1110
           var goodOrder = response.data.data.goodOrder;
1104
-          console.log("采购单", goodOrder);
1105 1111
           var drugList = response.data.data.drugList;
1106
-          console.log("druglist23323223", drugList);
1112
+     
1107 1113
           var is_warehouse = 0;
1108 1114
           for (let i = 0; i < purcaseOrder.length; i++) {
1109 1115
             for (let j = 0; j < drugList.length; j++) {
@@ -1173,17 +1179,17 @@ export default {
1173 1179
                 }
1174 1180
               }
1175 1181
               //如果total的长度等于 采购单的长度,怎表示该采购订单已经全部生成,全部入库
1176
-
1182
+             console.log("审核长度2332322323323332",arr)
1177 1183
               if (arr.length == 0) {
1178 1184
                 this.is_warehouse = 1;
1179
-                this.ModefySupplyWarehousing(is_warehouse, warehousing_id);
1185
+                this.ModefySupplyWarehousing(this.is_warehouse, warehousing_id);
1180 1186
               }
1181 1187
 
1182 1188
               //部分入库
1183
-              if (total != goodOrder.length) {
1189
+              if (arr.length > 0) {
1184 1190
                 //修改订购单
1185 1191
                 this.is_warehouse = 3;
1186
-                this.ModefySupplyWarehousing(is_warehouse, warehousing_id);
1192
+                this.ModefySupplyWarehousing(this.is_warehouse, warehousing_id);
1187 1193
               }
1188 1194
             }
1189 1195
           }

+ 31 - 7
src/xt_pages/supply/components/addPurchaseOrder.vue Voir le fichier

@@ -74,9 +74,16 @@
74 74
             size="small"
75 75
             type="primary"
76 76
             @click="checkPurchaseOrder"
77
-            v-show="showOne"
78
-            >审核</el-button
79
-          >
77
+            v-show="showOne">审核
78
+         </el-button>
79
+
80
+         <!-- <el-button
81
+            size="small"
82
+            type="primary"
83
+            @click="checkReturnOrder"
84
+            v-if="is_check == 1">反审核
85
+         </el-button> -->
86
+         
80 87
           <el-button
81 88
             size="small"
82 89
             type="primary"
@@ -357,6 +364,7 @@ import {
357 364
   savePurchaseOrder,
358 365
   updatePurchaseOrder,
359 366
   checkPurchaseOrder,
367
+  getReturnOrder
360 368
 } from "@/api/supply";
361 369
 import { getDataConfig } from "@/utils/data";
362 370
 export default {
@@ -427,6 +435,7 @@ export default {
427 435
       goodList: [{ id: 1, name: "" }],
428 436
       total_price: 0,
429 437
       return_remark:"",
438
+      is_check:2,
430 439
     };
431 440
   },
432 441
   methods: {
@@ -519,7 +528,7 @@ export default {
519 528
         this.tabList.push(goodList[i])
520 529
         }
521 530
         this.goodList = goodList
522
-        console.log(this.goodList,'oo')
531
+        
523 532
     } 
524 533
     })
525 534
 },
@@ -631,7 +640,7 @@ export default {
631 640
             return_remake:this.return_remark,
632 641
           };
633 642
 
634
-          console.log("params23322323", params);
643
+         
635 644
           savePurchaseOrder(
636 645
             params,
637 646
             this.supplier_name,
@@ -645,8 +654,10 @@ export default {
645 654
               this.loading = false;
646 655
               this.$message.success("保存成功!");
647 656
               var warehouseInfo = response.data.data.warehouseInfo;
657
+              this.is_check = warehouseInfo.is_check
648 658
               if(warehouseInfo.is_check == 1){
649 659
                 this.Reviewed = true
660
+               
650 661
               }
651 662
               this.number = warehouseInfo.number;
652 663
               this.id = warehouseInfo.id;
@@ -682,7 +693,7 @@ export default {
682 693
                 orderInfo[i].project_id = orderInfo[i].project_id;
683 694
                 orderInfo[i].supply_unit = orderInfo[i].supply_unit;
684 695
               }
685
-              console.log("orderINFO23323232", orderInfo);
696
+            
686 697
               this.recordInfo.tableList = orderInfo;
687 698
               for(let i=0;i<orderInfo.length;i++){
688 699
                  orderInfo[i].name = ""
@@ -797,7 +808,7 @@ export default {
797 808
             stockIn: this.recordInfo.tableList,
798 809
             return_remake:this.return_remark,
799 810
           };
800
-          console.log("params23232233223", params);
811
+         
801 812
 
802 813
           updatePurchaseOrder(
803 814
             params,
@@ -838,6 +849,7 @@ export default {
838 849
           checkPurchaseOrder(this.id).then((response) => {
839 850
             if (response.data.state == 1) {
840 851
               var info = response.data.data.info;
852
+              this.is_check = info.is_check
841 853
               this.disabled = true;
842 854
               this.$message.success("审核成功!");
843 855
               this.Reviewed = true
@@ -863,6 +875,18 @@ export default {
863 875
       }
864 876
       this.discount_amount = discount_amount;
865 877
     },
878
+    checkReturnOrder() {
879
+      var id = this.id;
880
+      getReturnOrder(id).then((response) => {
881
+        if (response.data.state == 1) {
882
+          var msg = response.data.data.msg;
883
+          this.disabled = false;
884
+          this.showOne = true
885
+          this.is_check =2 
886
+          this.$message.success("反审核成功!");
887
+        }
888
+      });
889
+    },
866 890
   },
867 891
 
868 892
   created() {

+ 22 - 12
src/xt_pages/supply/components/editGoodOrder.vue Voir le fichier

@@ -59,9 +59,7 @@
59 59
           <span>单据编码:{{ good_number }}</span>
60 60
         </div>
61 61
         <div>
62
-          <el-button size="small" type="primary" @click="updateGoodOrder"
63
-            >保存</el-button
64
-          >
62
+          <el-button size="small" type="primary" @click="updateGoodOrder">保存</el-button>
65 63
           <el-button
66 64
             size="small"
67 65
             type="primary"
@@ -542,6 +540,7 @@ export default {
542 540
       orderInfo: [],
543 541
       warese_out_id: 0,
544 542
       return_remark: "",
543
+      tableDataList:[],
545 544
     };
546 545
   },
547 546
   methods: {
@@ -845,8 +844,7 @@ export default {
845 844
         confirmButtonText: "确 定",
846 845
         cancelButtonText: "取 消",
847 846
         type: "warning",
848
-      })
849
-        .then(() => {
847
+      }).then(() => {
850 848
           checkPurchaseOrder(this.id).then((response) => {
851 849
             if (response.data.state == 1) {
852 850
               var info = response.data.data.info;
@@ -932,6 +930,9 @@ export default {
932 930
 
933 931
           this.recordInfo.tableList = [];
934 932
           this.recordInfo.tableList = orderInfo;
933
+          this.tableDataList = []
934
+          this.tableDataList = orderInfo
935
+          
935 936
         }
936 937
       });
937 938
     },
@@ -971,8 +972,18 @@ export default {
971 972
             stockIn: this.recordInfo.tableList,
972 973
             return_remake: this.return_remark,
973 974
           }
974
-          console.log("param23322332323",params)
975
+          //判断是否在采购订单数据中做了删除,如果长度相等则代表没有删除,如果不等则代表做了删除或者新增
975 976
         
977
+          if(this.tableDataList.length != this.recordInfo.tableList){
978
+             warehousing_id = 0
979
+             for(let i=0;i<this.recordInfo.tableList.length;i++){
980
+              this.recordInfo.tableList[i].id = 0
981
+              this.recordInfo.tableDataList[i].order_number = ""
982
+              this.number = ""
983
+             }
984
+          }
985
+          console.log("param23322332323",params)
986
+          return
976 987
           updateGoodOrder(params,this.supplier_name,start,this.arrearage,this.payment,warehose_out_id,this.number,this.rate_of_concession,this.discount_amount,this.good_number).then((response) => {
977 988
             if (response.data.state == 1) {
978 989
               this.loading = false;
@@ -1015,8 +1026,7 @@ export default {
1015 1026
             for (let j = 0; j < drugList.length; j++) {
1016 1027
               if (goodOrder[i].is_source == 1) {
1017 1028
                 if (goodOrder[i].supply_unit == drugList[j].max_unit) {
1018
-                  goodOrder[i].count =
1019
-                    goodOrder[i].count * drugList[j].min_number;
1029
+                  goodOrder[i].count = goodOrder[i].count * drugList[j].min_number;
1020 1030
                 }
1021 1031
               }
1022 1032
             }
@@ -1062,20 +1072,20 @@ export default {
1062 1072
                   if (purcaseOrder[i].project_id == newArr[j].project_id) {
1063 1073
                     //根据商品ID比较数量大小,把数量不足的商品ID储存,表示采购单的数量未满足采购订单的数据,部分入库
1064 1074
                     if (purcaseOrder[i].count > newArr[j].count) {
1065
-                      arr.push(purcaseOrder[i].project_id);
1075
+                       arr.push(purcaseOrder[i].project_id);
1066 1076
                     }
1067 1077
                   }
1068 1078
                 }
1069 1079
               }
1070 1080
               //如果total的长度等于 采购单的长度,怎表示该采购订单已经全部生成,全部入库
1071
-
1081
+              console.log("审核23232323323",arr)
1072 1082
               if (arr.length == 0) {
1073
-                is_warehouse = 1;
1083
+                 is_warehouse = 1;
1074 1084
                 this.ModefySupplyWarehousing(is_warehouse, warehousing_id);
1075 1085
               }
1076 1086
 
1077 1087
               //部分入库
1078
-              if (total != goodOrder.length) {
1088
+              if (arr.length >0) {
1079 1089
                 //修改订购单
1080 1090
                 is_warehouse = 3;
1081 1091
                 this.ModefySupplyWarehousing(is_warehouse, warehousing_id);

+ 10 - 11
src/xt_pages/supply/components/editPurchaseOrder.vue Voir le fichier

@@ -569,7 +569,7 @@ export default {
569 569
             this.tabList.push(goodList[i]);
570 570
           }
571 571
           this.goodList = goodList;
572
-          console.log(this.goodList, "oo");
572
+          
573 573
         }
574 574
       });
575 575
     },
@@ -730,8 +730,7 @@ export default {
730 730
       this.$refs["tableForm"].validate((valid) => {
731 731
         if (valid) {
732 732
           this.loading = true;
733
-          console.log("生产厂商", this.recordInfo.tableList);
734
-          console.log("生产上次", this.manufactuerList);
733
+         
735 734
           for (let i = 0; i < this.recordInfo.tableList.length; i++) {
736 735
             this.recordInfo.tableList[i].supply_count = parseInt(this.recordInfo.tableList[i].supply_count);
737 736
             this.recordInfo.tableList[i].supply_license_number =this.recordInfo.tableList[i].supply_license_number.toString();
@@ -761,7 +760,7 @@ export default {
761 760
             stockIn: this.recordInfo.tableList,
762 761
             return_remake: this.return_remark,
763 762
           };
764
-          console.log("param23232332", params);
763
+         
765 764
 
766 765
           updatePurchaseOrder(
767 766
             params,
@@ -845,7 +844,7 @@ export default {
845 844
             this.showTwo = false;
846 845
             this.showThree = true;
847 846
           }
848
-          console.log("drugli323322332", this.drugList);
847
+         
849 848
           var drugList = response.data.data.baseList;
850 849
           var goodList = response.data.data.goodList;
851 850
           for (let i = 0; i < orderInfo.length; i++) {
@@ -882,7 +881,7 @@ export default {
882 881
               }
883 882
             }
884 883
           }
885
-          console.log("orderINFO23323232", orderInfo);
884
+         
886 885
           this.recordInfo.tableList = [];
887 886
           this.recordInfo.tableList = orderInfo;
888 887
         }
@@ -902,12 +901,11 @@ export default {
902 901
       getAllOrderCountList(id).then((response) => {
903 902
         if (response.data.state == 1) {
904 903
           var purcaseOrder = response.data.data.purcaseOrder;
905
-          console.log("采购订单", purcaseOrder);
906 904
 
907 905
           var goodOrder = response.data.data.goodOrder;
908
-          console.log("采购单", goodOrder);
906
+         
909 907
           var drugList = response.data.data.drugList;
910
-          console.log("druglist23323223", drugList);
908
+      
911 909
           var ids = "";
912 910
           // 如果采购单没有数据,则代表改订单第一次生成采购订单数据
913 911
           if (goodOrder.length == 0) {
@@ -954,7 +952,7 @@ export default {
954 952
                 }
955 953
               }
956 954
             }
957
-            console.log("newAr2332232323", newArr);
955
+     
958 956
 
959 957
             for (let i = 0; i < newArr.length; i++) {
960 958
               for (let j = 0; j < newArr[i].child.length; j++) {
@@ -1008,7 +1006,7 @@ export default {
1008 1006
       getGoodOrderList(id).then((response) => {
1009 1007
         if (response.data.state == 1) {
1010 1008
           var list = response.data.data.list
1011
-          console.log("list23232323",list)
1009
+        
1012 1010
           this.orderList = list
1013 1011
           //如果长度大于0,有购货单不能反审核
1014 1012
           if (list.length > 0) {
@@ -1030,6 +1028,7 @@ export default {
1030 1028
         if (response.data.state == 1) {
1031 1029
           var msg = response.data.data.msg;
1032 1030
           this.disabled = false;
1031
+          this.Reviewed = false
1033 1032
           this.$message.success("反审核成功!");
1034 1033
           this.getPurchaseOrderDetail();
1035 1034
         }