Browse Source

11月14日 库存扣减更新

XMLWAN 3 years ago
parent
commit
aeb2407869

+ 24 - 0
src/api/supply.js View File

@@ -312,3 +312,27 @@ export function deleteGoodOrderById(params) {
312 312
     params: params
313 313
   })
314 314
 }
315
+
316
+export function deleteReturnOrder(id, params) {
317
+  return request({
318
+    url: '/api/supply/deletereturnorder?id=' + id,
319
+    method: 'Get',
320
+    params: params
321
+  })
322
+}
323
+
324
+export function deleteReturnOrderById(id, params) {
325
+  return request({
326
+    url: '/api/supply/deletereturnorderbyid?id=' + id,
327
+    method: 'get',
328
+    params: params
329
+  })
330
+}
331
+
332
+export function modefyReturnOrder(params) {
333
+  return request({
334
+    url: '/api/supply/modefyreturnorder',
335
+    method: 'get',
336
+    params: params
337
+  })
338
+}

+ 58 - 70
src/xt_pages/supply/components/addGoodReturn.vue View File

@@ -40,22 +40,8 @@
40 40
             align="right"
41 41
             format="yyyy-MM-dd"
42 42
             value-format="yyyy-MM-dd"
43
-            @change="startTimeChange"
44 43
           ></el-date-picker>
45
-          <!-- <span>交货日期:</span>
46
-        <el-date-picker
47
-            size="small"
48
-            v-model="end_time"
49
-            prefix-icon="el-icon-date"
50
-            :editable="false"
51
-            style="width: 196px;"
52
-            type="date"
53
-            placeholder="选择日期时间"
54
-            align="right"
55
-            format="yyyy-MM-dd"
56
-            value-format="yyyy-MM-dd"
57
-            @change="endTimeChange"
58
-        ></el-date-picker> -->
44
+         
59 45
           <span>单据编码:{{ number }}</span>
60 46
         </div>
61 47
         <div>
@@ -69,11 +55,11 @@
69 55
           <el-button
70 56
             size="small"
71 57
             type="primary"
72
-            @click=""
58
+            @click="updateGoodReturn"
73 59
             v-show="showTwo"
74 60
             >保存</el-button
75 61
           >
76
-          <el-button size="small" type="primary" @click="updatePurchaseOrder">审核</el-button>
62
+          <el-button size="small" type="primary" @click="checkReturnOrder">审核</el-button>
77 63
           <!-- <el-button size="small" type="primary" @click="toPrint">打印</el-button>
78 64
         <el-button size="small" type="primary" v-if="is_check == 2" @click="checkPurchaseOrder">审核</el-button>
79 65
         <el-button size="small" type="primary" v-if="is_check == 1" @click="checkPurchaseOrder">反审核</el-button> -->
@@ -385,6 +371,8 @@ import {
385 371
   getInitOrder,
386 372
   getGoodOrderDetail,
387 373
   saveGoodReturnOrder,
374
+  checkReturnOrder,
375
+  updateGoodReturn
388 376
 } from "@/api/supply";
389 377
 export default {
390 378
   name: "addPurchaseOrder",
@@ -444,6 +432,7 @@ export default {
444 432
       is_check: 0,
445 433
       dialogVisible: false,
446 434
       return_remark: "",
435
+      warehouse_out_id:0,
447 436
     };
448 437
   },
449 438
   methods: {
@@ -639,12 +628,6 @@ export default {
639 628
         this.recordInfo.tableList.splice(index, 1);
640 629
       }
641 630
     },
642
-
643
-    changeTypeName() {},
644
-    startTimeChange() {},
645
-    endTimeChange() {},
646
-    search() {},
647
-
648 631
     getWarehoseInfo(arr, max_unit, min_unit, min_number) {
649 632
       var total = 0;
650 633
       var max_str = "";
@@ -693,53 +676,7 @@ export default {
693 676
       }
694 677
       return uParseTime(time, "{y}-{m}-{d}");
695 678
     },
696
-    updatePurchaseOrder() {
697
-      this.loading = true;
698
-      if (this.supplier_name == 0 || this.supplier_name == "") {
699
-        this.$message.error("供应商不能为空!");
700
-        this.loading = false;
701
-        return false;
702
-      }
703
-      this.$refs["tableForm"].validate((valid) => {
704
-        if (valid) {
705
-          for (let i = 0; i < this.recordInfo.tableList.length; i++) {
706
-            this.recordInfo.tableList[i].supply_count = parseInt(this.recordInfo.tableList[i].supply_count);
707
-            this.recordInfo.tableList[i].supply_license_number =this.recordInfo.tableList[i].supply_license_number.toString();
708
-            this.recordInfo.tableList[i].supply_total_price = (this.recordInfo.tableList[i].supply_count *this.recordInfo.tableList[i].supply_price).toString();
709
-            this.recordInfo.tableList[i].supply_total = this.recordInfo.tableList[i].supply_total.toString();
710
-            this.recordInfo.tableList[i].supply_price =this.recordInfo.tableList[i].supply_price.toString();
711
-            for (let j = 0; j < this.manufactuerList.length; j++) {
712
-              if (this.recordInfo.tableList[i].supply_manufacturer ==this.manufactuerList[j].manufacturer_name) {
713
-                this.recordInfo.tableList[i].manufacturer_id =this.manufactuerList[j].id;
714
-              }
715
-            }
716
-          }
717
-          var start = this.getTimes(this.start_time);
718
-          var end = this.getTimes(this.end_time);
719
-          const params = {
720
-            stockIn: this.recordInfo.tableList,
721
-          };
722
-          console.log("param23232332", params);
723
-
724
-          updatePurchaseOrder(
725
-            params,
726
-            this.supplier_name,
727
-            start,
728
-            end,
729
-            this.rate_of_concession,
730
-            this.discount_amount,
731
-            this.id,
732
-            this.number
733
-          ).then((response) => {
734
-            if (response.data.state == 1) {
735
-              this.loading = false;
736
-              var warehousingInfo = response.data.data.warehousingInfo;
737
-              this.$message.success("保存成功!");
738
-            }
739
-          });
740
-        }
741
-      });
742
-    },
679
+   
743 680
     getAllPrice() {
744 681
       var total_price = 0;
745 682
       for (let i = 0; i < this.recordInfo.tableList.length; i++) {
@@ -894,6 +831,7 @@ export default {
894 831
                 var warehouseCancel = response.data.data.warehouseCancel
895 832
                 var out = response.data.data.cancelOrder
896 833
                 this.id = out.id
834
+                this.warehouse_out_id = out.warehouse_out_id
897 835
                 this.supplier_name = out.supplier_id
898 836
                 this.rate_of_concession = out.rate_of_concession
899 837
                 this.discount_amount = out.discount_amount
@@ -946,6 +884,56 @@ export default {
946 884
           
947 885
         }
948 886
       })
887
+    },
888
+    updateGoodReturn(){
889
+      var warehouse_out_id = this.id;
890
+      this.$refs["tableForm"].validate((valid)=>{
891
+        if(valid){
892
+          this.loading = true
893
+          for(let i=0;i<this.recordInfo.tableList.length;i++){
894
+            this.recordInfo.tableList[i].supply_count = parseInt(this.recordInfo.tableList[i].supply_count)
895
+            this.recordInfo.tableList[i].supply_price = this.recordInfo.tableList[i].supply_price.toString()
896
+            this.recordInfo.tableList[i].supply_total = this.recordInfo.tableList[i].supply_total.toString()
897
+            
898
+            for(let j=0;j<this.manufactuerList.length;j++){
899
+                if(this.recordInfo.tableList[i].supply_manufacturer == this.manufactuerList[j].manufacturer_name){
900
+                  this.recordInfo.tableList[i].manufacturer_id = this.manufactuerList[j].id
901
+                }
902
+                if(this.recordInfo.tableList[i].supply_manufacturer == this.manufactuerList[j].id){
903
+                  this.recordInfo.tableList[i].supply_manufacturer = this.manufactuerList[j].manufacturer_name
904
+                }
905
+
906
+            }
907
+          }
908
+          var params = {
909
+            stockIn:this.recordInfo.tableList,
910
+            return_marke:this.return_remark,
911
+          }
912
+          console.log("start_time232233232",this.start_time)
913
+          console.log("arrage2323322323",params)
914
+          updateGoodReturn(params,warehouse_out_id,this.start_time,this.rate_of_concession,this.discount_amount,this.arrearage,this.payment,this.supplier_name,this.number).then(response=>{
915
+            if(response.data.state == 1){
916
+               var msg = response.data.msg
917
+               this.loading = false
918
+               this.$message.success("保存成功!")
919
+            }
920
+          })
921
+        }
922
+      })
923
+    },
924
+    checkReturnOrder(){
925
+      this.loading = true
926
+     var params = {
927
+       warehouse_out_id:this.warehouse_out_id,
928
+       id:this.id,
929
+     }
930
+     checkReturnOrder(params).then(response=>{
931
+       if(response.data.state == 1){
932
+        this.loading = false
933
+        var msg = response.data.data.msg
934
+        this.$message.success("保存成功!")
935
+       }
936
+     })
949 937
     }
950 938
    
951 939
   },

+ 63 - 39
src/xt_pages/supply/components/editGoodReturn.vue View File

@@ -60,7 +60,8 @@
60 60
         </div>
61 61
         <div>
62 62
           <el-button size="small" type="primary" @click="updateGoodReturn">保存</el-button>
63
-          <el-button size="small" type="primary" @click="checkReturnOrder">审核</el-button>
63
+          <el-button size="small" type="primary" @click="checkReturnOrder" v-if="is_check == 2">审核</el-button>
64
+          <el-button size="small" type="primary" @click="modefyReturnOrder" v-if="is_check == 1">反审核</el-button>
64 65
         </div>
65 66
       </div>
66 67
 
@@ -159,7 +160,7 @@
159 160
           <el-table-column label="可退数量" align="center" width="200px">
160 161
             <template slot-scope="scope">
161 162
               <el-input
162
-                v-model="scope.row.supply_specification_name"
163
+                v-model="scope.row.count"
163 164
                 style="width: 150px"
164 165
                 :disabled="true"
165 166
               ></el-input>
@@ -168,7 +169,6 @@
168 169
           <el-table-column label="数量" align="center" width="120px">
169 170
             <template slot="header" slot-scope="scope">
170 171
               <span>数量<span style="color: red">*</span></span>
171
-
172 172
             </template>
173 173
             <template slot-scope="scope">
174 174
               <el-form-item
@@ -338,7 +338,9 @@ import {
338 338
   getInitOrder,
339 339
   getGoodReturnDetail,
340 340
   updateGoodReturn,
341
-  checkReturnOrder
341
+  checkReturnOrder,
342
+  deleteReturnOrderById,
343
+  modefyReturnOrder
342 344
 } from "@/api/supply";
343 345
 export default {
344 346
   name: "addPurchaseOrder",
@@ -584,22 +586,42 @@ export default {
584 586
       tempObj["supply_expiry_date"] = ""
585 587
       tempObj["warehousing_id"] =0
586 588
       tempObj["warehouse_info_id"] =0
589
+      tempObj["count"] = ""
587 590
       this.recordInfo.tableList.push(tempObj);
588 591
     },
589 592
     handleDelete: function (index, row) {
590
-      if (this.recordInfo.tableList.length <= 1) {
591
-        this.$message.error("只有一条记录的时候无法删除");
592
-        return;
593
-      } else {
594
-        this.recordInfo.tableList.splice(index, 1);
593
+      if(row.id == 0){
594
+        if (this.recordInfo.tableList.length <= 1) {
595
+          this.$message.error("只有一条记录的时候无法删除");
596
+          return;
597
+        } else {
598
+          this.recordInfo.tableList.splice(index, 1);
599
+        }
600
+      }
601
+      if(row.id >0){
602
+       if(this.is_check == 1){
603
+         this.$message.error("已审核单据,不能删除!")
604
+         return false
605
+       }
606
+       this.$confirm('确认删除吗?', '删除', {
607
+          confirmButtonText: '确 定',
608
+          cancelButtonText: '取 消',
609
+          type: 'warning'
610
+        }).then(() => {
611
+          deleteReturnOrderById(val.id).then(response => {
612
+            if (response.data.state == 1) {
613
+                var msg = response.data.data.msg
614
+                this.recordInfo.tableList.splice(index, 1);
615
+                this.$message.success("删除成功")
616
+            } else {
617
+                this.$message.error("删除失败")
618
+            }
619
+          })
620
+        }).catch(() => {
621
+       }) 
595 622
       }
623
+    
596 624
     },
597
-
598
-    changeTypeName() {},
599
-    startTimeChange() {},
600
-    endTimeChange() {},
601
-    search() {},
602
-
603 625
     getWarehoseInfo(arr, max_unit, min_unit, min_number) {
604 626
       var total = 0;
605 627
       var max_str = "";
@@ -716,24 +738,6 @@ export default {
716 738
       }
717 739
       return total_price.toFixed(2);
718 740
     },
719
-    checkPurchaseOrder(id, index) {
720
-      this.$confirm("是否审核?", {
721
-        confirmButtonText: "确 定",
722
-        cancelButtonText: "取 消",
723
-        type: "warning",
724
-      })
725
-        .then(() => {
726
-          checkPurchaseOrder(this.id).then((response) => {
727
-            if (response.data.state == 1) {
728
-              var info = response.data.data.info;
729
-              this.disabled = true;
730
-              this.$message.success("审核成功!");
731
-              this.getPurchaseOrderDetail();
732
-            }
733
-          });
734
-        })
735
-        .catch(() => {});
736
-    },
737 741
     getGoodReturnDetail(){
738 742
       
739 743
       var id = this.$route.query.id
@@ -742,6 +746,7 @@ export default {
742 746
           var out = response.data.data.cancelDetail
743 747
           console.log("out23322323232323",out)
744 748
           this.warehouse_out_id = out.warehouse_out_id
749
+          this.number = out.number
745 750
           this.is_check = out.is_check
746 751
           this.id = out.id
747 752
           this.supplier_name = out.supplier_id
@@ -751,12 +756,16 @@ export default {
751 756
           this.arrearage = out.arrearage
752 757
           this.start_time = this.getTimes(out.document_date)
753 758
           var orderInfo = response.data.data.orderCancelDetail
754
-          console.log("orderINFO233232232332",orderInfo)
759
+          if(out.is_check == 1){
760
+            this.disabled = true
761
+          }
762
+          console.log("退库单详情",orderInfo)
755 763
           var drugList = response.data.data.drugList
756 764
           var goodList = response.data.data.goodList
757 765
           for(let i=0;i< orderInfo.length;i++){
758
-              
766
+              orderInfo[i].id = orderInfo[i].id
759 767
               orderInfo[i].supply_count =  orderInfo[i].count
768
+              orderInfo[i].count = orderInfo[i].source_count
760 769
               orderInfo[i].supply_price =  orderInfo[i].price
761 770
               orderInfo[i].supply_remake =  orderInfo[i].remark
762 771
               orderInfo[i].type =  orderInfo[i].is_source
@@ -812,7 +821,7 @@ export default {
812 821
             this.recordInfo.tableList[i].supply_count = parseInt(this.recordInfo.tableList[i].supply_count)
813 822
             this.recordInfo.tableList[i].supply_price = this.recordInfo.tableList[i].supply_price.toString()
814 823
             this.recordInfo.tableList[i].supply_total = this.recordInfo.tableList[i].supply_total.toString()
815
-       
824
+            
816 825
             for(let j=0;j<this.manufactuerList.length;j++){
817 826
                 if(this.recordInfo.tableList[i].supply_manufacturer == this.manufactuerList[j].manufacturer_name){
818 827
                   this.recordInfo.tableList[i].manufacturer_id = this.manufactuerList[j].id
@@ -824,11 +833,11 @@ export default {
824 833
             }
825 834
           }
826 835
           var params = {
827
-            "stockIn":this.recordInfo.tableList,
828
-            "return_marke":this.return_remark,
836
+            stockIn:this.recordInfo.tableList,
837
+            return_marke:this.return_remark,
829 838
           }
830 839
           console.log("start_time232233232",this.start_time)
831
-          console.log("arrage2323322323",this.arrearage)
840
+          console.log("arrage2323322323",params)
832 841
           updateGoodReturn(params,warehouse_out_id,this.start_time,this.rate_of_concession,this.discount_amount,this.arrearage,this.payment,this.supplier_name,this.number).then(response=>{
833 842
             if(response.data.state == 1){
834 843
                var msg = response.data.msg
@@ -840,16 +849,30 @@ export default {
840 849
       })
841 850
     },
842 851
     checkReturnOrder(){
852
+      this.loading = true
843 853
      var params = {
844 854
        warehouse_out_id:this.warehouse_out_id,
845 855
        id:this.id,
846 856
      }
847 857
      checkReturnOrder(params).then(response=>{
848 858
        if(response.data.state == 1){
859
+        this.loading = false
849 860
         var msg = response.data.data.msg
850 861
         this.$message.success("保存成功!")
851 862
        }
852 863
      })
864
+    },
865
+    modefyReturnOrder(){
866
+      this.loading = true
867
+     var params = {
868
+       warehouse_out_id:this.warehouse_out_id,
869
+       id:this.id,
870
+     }
871
+     modefyReturnOrder(params).then(response=>{
872
+       if(response.data.state == 1){
873
+         
874
+       }
875
+     })
853 876
     }
854 877
   },
855 878
   created() {
@@ -875,6 +898,7 @@ export default {
875 898
     tempObj["supply_expiry_date"] = ""
876 899
     tempObj["warehousing_id"] =0
877 900
     tempObj["warehouse_info_id"] =0
901
+    tempObj["count"] = ""
878 902
     this.recordInfo.tableList.push(tempObj);
879 903
     this.getInitOrder();
880 904
     //获取购货单列表

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

@@ -120,7 +120,7 @@
120 120
        </el-table-column> -->
121 121
        <el-table-column label="源数量" align="center" width="200">
122 122
          <template slot-scope="scope">
123
-           <!-- {{getAllCount(scope.row.orderInfo)}} -->
123
+           {{scope.row.source_count}}
124 124
          </template>
125 125
        </el-table-column>
126 126
 
@@ -183,7 +183,7 @@
183 183
 <script>
184 184
 import BreadCrumb from "@/xt_pages/components/bread-crumb";
185 185
 
186
-import {getAllSupply,getAllGoodReturnOrderList} from "@/api/supply"
186
+import {getAllSupply,getAllGoodReturnOrderList,deleteReturnOrder} from "@/api/supply"
187 187
 import {uParseTime } from '@/utils/tools'
188 188
 export default {
189 189
   name: "stockIn",
@@ -324,6 +324,32 @@ export default {
324 324
      },
325 325
      editGoodReturn(id){
326 326
        this.$router.push({path:"/good/return/edit?id="+id})
327
+     },
328
+     toClickOne(val,index){
329
+       if(val.is_check == 1){
330
+         this.$message.error("已审核单据,不能删除!")
331
+         return false
332
+       }
333
+       if(val.cancelOut.length >0 ){
334
+         this.$message.error("已关联单据,不能删除!")
335
+         return false
336
+       }
337
+       this.$confirm('确认删除吗?', '删除', {
338
+          confirmButtonText: '确 定',
339
+          cancelButtonText: '取 消',
340
+          type: 'warning'
341
+        }).then(() => {
342
+          deleteReturnOrder(val.id).then(response => {
343
+            if (response.data.state == 1) {
344
+                var msg = response.data.data.msg
345
+                this.tableList.splice(index, 1);
346
+                this.$message.success("删除成功")
347
+            } else {
348
+                this.$message.error("删除失败")
349
+            }
350
+          })
351
+        }).catch(() => {
352
+       }) 
327 353
      }
328 354
   },
329 355
   created() {