Browse Source

11月14日 库存扣减更新

XMLWAN 3 years ago
parent
commit
fcad8f33bd

+ 22 - 16
src/xt_pages/supply/components/addGoodOrder.vue View File

528
       showTwo: false,
528
       showTwo: false,
529
       warese_out_id: 0,
529
       warese_out_id: 0,
530
       return_remark: "",
530
       return_remark: "",
531
-      is_warehouse:0
531
+      is_warehouse:0,
532
+      tableDataList:[]
532
     };
533
     };
533
   },
534
   },
534
   methods: {
535
   methods: {
851
             orderInfo[i].supply_product_date = "";
852
             orderInfo[i].supply_product_date = "";
852
             orderInfo[i].supply_expiry_date = "";
853
             orderInfo[i].supply_expiry_date = "";
853
           }
854
           }
854
-          console.log("drugli323322332", orderInfo);
855
           var drugList = response.data.data.baseList;
855
           var drugList = response.data.data.baseList;
856
           var goodList = response.data.data.goodList;
856
           var goodList = response.data.data.goodList;
857
           for (let i = 0; i < orderInfo.length; i++) {
857
           for (let i = 0; i < orderInfo.length; i++) {
893
 
893
 
894
           this.recordInfo.tableList = [];
894
           this.recordInfo.tableList = [];
895
           this.recordInfo.tableList = orderInfo;
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
       }
912
       }
911
 
913
 
912
       for (let i = 0; i < this.recordInfo.tableList.length; i++) {
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
         this.recordInfo.tableList[i].supply_price =
916
         this.recordInfo.tableList[i].supply_price =
917
           this.recordInfo.tableList[i].supply_price.toString();
917
           this.recordInfo.tableList[i].supply_price.toString();
918
         this.recordInfo.tableList[i].supply_total_price =
918
         this.recordInfo.tableList[i].supply_total_price =
942
         if (valid) {
942
         if (valid) {
943
           this.loading = true;
943
           this.loading = true;
944
           var warehousing_id = this.$route.query.id;
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
           var params = {
954
           var params = {
946
             stockIn: this.recordInfo.tableList,
955
             stockIn: this.recordInfo.tableList,
947
             return_remake: this.return_remark,
956
             return_remake: this.return_remark,
1089
     checkGoodOrder() {
1098
     checkGoodOrder() {
1090
       var id = this.warese_out_id;
1099
       var id = this.warese_out_id;
1091
       var warehousing_id = this.warehousing_id;
1100
       var warehousing_id = this.warehousing_id;
1092
-      console.log("hhh2323232323232323",id,warehousing_id)
1101
+      
1093
       getGoodOrderCountList(id, warehousing_id).then((response) => {
1102
       getGoodOrderCountList(id, warehousing_id).then((response) => {
1094
         if (response.data.state == 1) {
1103
         if (response.data.state == 1) {
1095
           this.$message.success("审核成功!");
1104
           this.$message.success("审核成功!");
1098
           this.showTwo = true;
1107
           this.showTwo = true;
1099
           this.showThree = true;
1108
           this.showThree = true;
1100
           var purcaseOrder = response.data.data.purcaseOrder;
1109
           var purcaseOrder = response.data.data.purcaseOrder;
1101
-          console.log("采购订单", purcaseOrder);
1102
-
1103
           var goodOrder = response.data.data.goodOrder;
1110
           var goodOrder = response.data.data.goodOrder;
1104
-          console.log("采购单", goodOrder);
1105
           var drugList = response.data.data.drugList;
1111
           var drugList = response.data.data.drugList;
1106
-          console.log("druglist23323223", drugList);
1112
+     
1107
           var is_warehouse = 0;
1113
           var is_warehouse = 0;
1108
           for (let i = 0; i < purcaseOrder.length; i++) {
1114
           for (let i = 0; i < purcaseOrder.length; i++) {
1109
             for (let j = 0; j < drugList.length; j++) {
1115
             for (let j = 0; j < drugList.length; j++) {
1173
                 }
1179
                 }
1174
               }
1180
               }
1175
               //如果total的长度等于 采购单的长度,怎表示该采购订单已经全部生成,全部入库
1181
               //如果total的长度等于 采购单的长度,怎表示该采购订单已经全部生成,全部入库
1176
-
1182
+             console.log("审核长度2332322323323332",arr)
1177
               if (arr.length == 0) {
1183
               if (arr.length == 0) {
1178
                 this.is_warehouse = 1;
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
                 this.is_warehouse = 3;
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 View File

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

+ 22 - 12
src/xt_pages/supply/components/editGoodOrder.vue View File

59
           <span>单据编码:{{ good_number }}</span>
59
           <span>单据编码:{{ good_number }}</span>
60
         </div>
60
         </div>
61
         <div>
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
           <el-button
63
           <el-button
66
             size="small"
64
             size="small"
67
             type="primary"
65
             type="primary"
542
       orderInfo: [],
540
       orderInfo: [],
543
       warese_out_id: 0,
541
       warese_out_id: 0,
544
       return_remark: "",
542
       return_remark: "",
543
+      tableDataList:[],
545
     };
544
     };
546
   },
545
   },
547
   methods: {
546
   methods: {
845
         confirmButtonText: "确 定",
844
         confirmButtonText: "确 定",
846
         cancelButtonText: "取 消",
845
         cancelButtonText: "取 消",
847
         type: "warning",
846
         type: "warning",
848
-      })
849
-        .then(() => {
847
+      }).then(() => {
850
           checkPurchaseOrder(this.id).then((response) => {
848
           checkPurchaseOrder(this.id).then((response) => {
851
             if (response.data.state == 1) {
849
             if (response.data.state == 1) {
852
               var info = response.data.data.info;
850
               var info = response.data.data.info;
932
 
930
 
933
           this.recordInfo.tableList = [];
931
           this.recordInfo.tableList = [];
934
           this.recordInfo.tableList = orderInfo;
932
           this.recordInfo.tableList = orderInfo;
933
+          this.tableDataList = []
934
+          this.tableDataList = orderInfo
935
+          
935
         }
936
         }
936
       });
937
       });
937
     },
938
     },
971
             stockIn: this.recordInfo.tableList,
972
             stockIn: this.recordInfo.tableList,
972
             return_remake: this.return_remark,
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
           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) => {
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
             if (response.data.state == 1) {
988
             if (response.data.state == 1) {
978
               this.loading = false;
989
               this.loading = false;
1015
             for (let j = 0; j < drugList.length; j++) {
1026
             for (let j = 0; j < drugList.length; j++) {
1016
               if (goodOrder[i].is_source == 1) {
1027
               if (goodOrder[i].is_source == 1) {
1017
                 if (goodOrder[i].supply_unit == drugList[j].max_unit) {
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
                   if (purcaseOrder[i].project_id == newArr[j].project_id) {
1072
                   if (purcaseOrder[i].project_id == newArr[j].project_id) {
1063
                     //根据商品ID比较数量大小,把数量不足的商品ID储存,表示采购单的数量未满足采购订单的数据,部分入库
1073
                     //根据商品ID比较数量大小,把数量不足的商品ID储存,表示采购单的数量未满足采购订单的数据,部分入库
1064
                     if (purcaseOrder[i].count > newArr[j].count) {
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
               //如果total的长度等于 采购单的长度,怎表示该采购订单已经全部生成,全部入库
1080
               //如果total的长度等于 采购单的长度,怎表示该采购订单已经全部生成,全部入库
1071
-
1081
+              console.log("审核23232323323",arr)
1072
               if (arr.length == 0) {
1082
               if (arr.length == 0) {
1073
-                is_warehouse = 1;
1083
+                 is_warehouse = 1;
1074
                 this.ModefySupplyWarehousing(is_warehouse, warehousing_id);
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
                 is_warehouse = 3;
1090
                 is_warehouse = 3;
1081
                 this.ModefySupplyWarehousing(is_warehouse, warehousing_id);
1091
                 this.ModefySupplyWarehousing(is_warehouse, warehousing_id);

+ 10 - 11
src/xt_pages/supply/components/editPurchaseOrder.vue View File

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