Przeglądaj źródła

11月14日 库存扣减更新

XMLWAN 3 lat temu
rodzic
commit
aeb2407869

+ 24 - 0
src/api/supply.js Wyświetl plik

312
     params: params
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 Wyświetl plik

40
             align="right"
40
             align="right"
41
             format="yyyy-MM-dd"
41
             format="yyyy-MM-dd"
42
             value-format="yyyy-MM-dd"
42
             value-format="yyyy-MM-dd"
43
-            @change="startTimeChange"
44
           ></el-date-picker>
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
           <span>单据编码:{{ number }}</span>
45
           <span>单据编码:{{ number }}</span>
60
         </div>
46
         </div>
61
         <div>
47
         <div>
69
           <el-button
55
           <el-button
70
             size="small"
56
             size="small"
71
             type="primary"
57
             type="primary"
72
-            @click=""
58
+            @click="updateGoodReturn"
73
             v-show="showTwo"
59
             v-show="showTwo"
74
             >保存</el-button
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
           <!-- <el-button size="small" type="primary" @click="toPrint">打印</el-button>
63
           <!-- <el-button size="small" type="primary" @click="toPrint">打印</el-button>
78
         <el-button size="small" type="primary" v-if="is_check == 2" @click="checkPurchaseOrder">审核</el-button>
64
         <el-button size="small" type="primary" v-if="is_check == 2" @click="checkPurchaseOrder">审核</el-button>
79
         <el-button size="small" type="primary" v-if="is_check == 1" @click="checkPurchaseOrder">反审核</el-button> -->
65
         <el-button size="small" type="primary" v-if="is_check == 1" @click="checkPurchaseOrder">反审核</el-button> -->
385
   getInitOrder,
371
   getInitOrder,
386
   getGoodOrderDetail,
372
   getGoodOrderDetail,
387
   saveGoodReturnOrder,
373
   saveGoodReturnOrder,
374
+  checkReturnOrder,
375
+  updateGoodReturn
388
 } from "@/api/supply";
376
 } from "@/api/supply";
389
 export default {
377
 export default {
390
   name: "addPurchaseOrder",
378
   name: "addPurchaseOrder",
444
       is_check: 0,
432
       is_check: 0,
445
       dialogVisible: false,
433
       dialogVisible: false,
446
       return_remark: "",
434
       return_remark: "",
435
+      warehouse_out_id:0,
447
     };
436
     };
448
   },
437
   },
449
   methods: {
438
   methods: {
639
         this.recordInfo.tableList.splice(index, 1);
628
         this.recordInfo.tableList.splice(index, 1);
640
       }
629
       }
641
     },
630
     },
642
-
643
-    changeTypeName() {},
644
-    startTimeChange() {},
645
-    endTimeChange() {},
646
-    search() {},
647
-
648
     getWarehoseInfo(arr, max_unit, min_unit, min_number) {
631
     getWarehoseInfo(arr, max_unit, min_unit, min_number) {
649
       var total = 0;
632
       var total = 0;
650
       var max_str = "";
633
       var max_str = "";
693
       }
676
       }
694
       return uParseTime(time, "{y}-{m}-{d}");
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
     getAllPrice() {
680
     getAllPrice() {
744
       var total_price = 0;
681
       var total_price = 0;
745
       for (let i = 0; i < this.recordInfo.tableList.length; i++) {
682
       for (let i = 0; i < this.recordInfo.tableList.length; i++) {
894
                 var warehouseCancel = response.data.data.warehouseCancel
831
                 var warehouseCancel = response.data.data.warehouseCancel
895
                 var out = response.data.data.cancelOrder
832
                 var out = response.data.data.cancelOrder
896
                 this.id = out.id
833
                 this.id = out.id
834
+                this.warehouse_out_id = out.warehouse_out_id
897
                 this.supplier_name = out.supplier_id
835
                 this.supplier_name = out.supplier_id
898
                 this.rate_of_concession = out.rate_of_concession
836
                 this.rate_of_concession = out.rate_of_concession
899
                 this.discount_amount = out.discount_amount
837
                 this.discount_amount = out.discount_amount
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 Wyświetl plik

60
         </div>
60
         </div>
61
         <div>
61
         <div>
62
           <el-button size="small" type="primary" @click="updateGoodReturn">保存</el-button>
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
         </div>
65
         </div>
65
       </div>
66
       </div>
66
 
67
 
159
           <el-table-column label="可退数量" align="center" width="200px">
160
           <el-table-column label="可退数量" align="center" width="200px">
160
             <template slot-scope="scope">
161
             <template slot-scope="scope">
161
               <el-input
162
               <el-input
162
-                v-model="scope.row.supply_specification_name"
163
+                v-model="scope.row.count"
163
                 style="width: 150px"
164
                 style="width: 150px"
164
                 :disabled="true"
165
                 :disabled="true"
165
               ></el-input>
166
               ></el-input>
168
           <el-table-column label="数量" align="center" width="120px">
169
           <el-table-column label="数量" align="center" width="120px">
169
             <template slot="header" slot-scope="scope">
170
             <template slot="header" slot-scope="scope">
170
               <span>数量<span style="color: red">*</span></span>
171
               <span>数量<span style="color: red">*</span></span>
171
-
172
             </template>
172
             </template>
173
             <template slot-scope="scope">
173
             <template slot-scope="scope">
174
               <el-form-item
174
               <el-form-item
338
   getInitOrder,
338
   getInitOrder,
339
   getGoodReturnDetail,
339
   getGoodReturnDetail,
340
   updateGoodReturn,
340
   updateGoodReturn,
341
-  checkReturnOrder
341
+  checkReturnOrder,
342
+  deleteReturnOrderById,
343
+  modefyReturnOrder
342
 } from "@/api/supply";
344
 } from "@/api/supply";
343
 export default {
345
 export default {
344
   name: "addPurchaseOrder",
346
   name: "addPurchaseOrder",
584
       tempObj["supply_expiry_date"] = ""
586
       tempObj["supply_expiry_date"] = ""
585
       tempObj["warehousing_id"] =0
587
       tempObj["warehousing_id"] =0
586
       tempObj["warehouse_info_id"] =0
588
       tempObj["warehouse_info_id"] =0
589
+      tempObj["count"] = ""
587
       this.recordInfo.tableList.push(tempObj);
590
       this.recordInfo.tableList.push(tempObj);
588
     },
591
     },
589
     handleDelete: function (index, row) {
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
     getWarehoseInfo(arr, max_unit, min_unit, min_number) {
625
     getWarehoseInfo(arr, max_unit, min_unit, min_number) {
604
       var total = 0;
626
       var total = 0;
605
       var max_str = "";
627
       var max_str = "";
716
       }
738
       }
717
       return total_price.toFixed(2);
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
     getGoodReturnDetail(){
741
     getGoodReturnDetail(){
738
       
742
       
739
       var id = this.$route.query.id
743
       var id = this.$route.query.id
742
           var out = response.data.data.cancelDetail
746
           var out = response.data.data.cancelDetail
743
           console.log("out23322323232323",out)
747
           console.log("out23322323232323",out)
744
           this.warehouse_out_id = out.warehouse_out_id
748
           this.warehouse_out_id = out.warehouse_out_id
749
+          this.number = out.number
745
           this.is_check = out.is_check
750
           this.is_check = out.is_check
746
           this.id = out.id
751
           this.id = out.id
747
           this.supplier_name = out.supplier_id
752
           this.supplier_name = out.supplier_id
751
           this.arrearage = out.arrearage
756
           this.arrearage = out.arrearage
752
           this.start_time = this.getTimes(out.document_date)
757
           this.start_time = this.getTimes(out.document_date)
753
           var orderInfo = response.data.data.orderCancelDetail
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
           var drugList = response.data.data.drugList
763
           var drugList = response.data.data.drugList
756
           var goodList = response.data.data.goodList
764
           var goodList = response.data.data.goodList
757
           for(let i=0;i< orderInfo.length;i++){
765
           for(let i=0;i< orderInfo.length;i++){
758
-              
766
+              orderInfo[i].id = orderInfo[i].id
759
               orderInfo[i].supply_count =  orderInfo[i].count
767
               orderInfo[i].supply_count =  orderInfo[i].count
768
+              orderInfo[i].count = orderInfo[i].source_count
760
               orderInfo[i].supply_price =  orderInfo[i].price
769
               orderInfo[i].supply_price =  orderInfo[i].price
761
               orderInfo[i].supply_remake =  orderInfo[i].remark
770
               orderInfo[i].supply_remake =  orderInfo[i].remark
762
               orderInfo[i].type =  orderInfo[i].is_source
771
               orderInfo[i].type =  orderInfo[i].is_source
812
             this.recordInfo.tableList[i].supply_count = parseInt(this.recordInfo.tableList[i].supply_count)
821
             this.recordInfo.tableList[i].supply_count = parseInt(this.recordInfo.tableList[i].supply_count)
813
             this.recordInfo.tableList[i].supply_price = this.recordInfo.tableList[i].supply_price.toString()
822
             this.recordInfo.tableList[i].supply_price = this.recordInfo.tableList[i].supply_price.toString()
814
             this.recordInfo.tableList[i].supply_total = this.recordInfo.tableList[i].supply_total.toString()
823
             this.recordInfo.tableList[i].supply_total = this.recordInfo.tableList[i].supply_total.toString()
815
-       
824
+            
816
             for(let j=0;j<this.manufactuerList.length;j++){
825
             for(let j=0;j<this.manufactuerList.length;j++){
817
                 if(this.recordInfo.tableList[i].supply_manufacturer == this.manufactuerList[j].manufacturer_name){
826
                 if(this.recordInfo.tableList[i].supply_manufacturer == this.manufactuerList[j].manufacturer_name){
818
                   this.recordInfo.tableList[i].manufacturer_id = this.manufactuerList[j].id
827
                   this.recordInfo.tableList[i].manufacturer_id = this.manufactuerList[j].id
824
             }
833
             }
825
           }
834
           }
826
           var params = {
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
           console.log("start_time232233232",this.start_time)
839
           console.log("start_time232233232",this.start_time)
831
-          console.log("arrage2323322323",this.arrearage)
840
+          console.log("arrage2323322323",params)
832
           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=>{
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
             if(response.data.state == 1){
842
             if(response.data.state == 1){
834
                var msg = response.data.msg
843
                var msg = response.data.msg
840
       })
849
       })
841
     },
850
     },
842
     checkReturnOrder(){
851
     checkReturnOrder(){
852
+      this.loading = true
843
      var params = {
853
      var params = {
844
        warehouse_out_id:this.warehouse_out_id,
854
        warehouse_out_id:this.warehouse_out_id,
845
        id:this.id,
855
        id:this.id,
846
      }
856
      }
847
      checkReturnOrder(params).then(response=>{
857
      checkReturnOrder(params).then(response=>{
848
        if(response.data.state == 1){
858
        if(response.data.state == 1){
859
+        this.loading = false
849
         var msg = response.data.data.msg
860
         var msg = response.data.data.msg
850
         this.$message.success("保存成功!")
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
   created() {
878
   created() {
875
     tempObj["supply_expiry_date"] = ""
898
     tempObj["supply_expiry_date"] = ""
876
     tempObj["warehousing_id"] =0
899
     tempObj["warehousing_id"] =0
877
     tempObj["warehouse_info_id"] =0
900
     tempObj["warehouse_info_id"] =0
901
+    tempObj["count"] = ""
878
     this.recordInfo.tableList.push(tempObj);
902
     this.recordInfo.tableList.push(tempObj);
879
     this.getInitOrder();
903
     this.getInitOrder();
880
     //获取购货单列表
904
     //获取购货单列表

+ 28 - 2
src/xt_pages/supply/goodreturn.vue Wyświetl plik

120
        </el-table-column> -->
120
        </el-table-column> -->
121
        <el-table-column label="源数量" align="center" width="200">
121
        <el-table-column label="源数量" align="center" width="200">
122
          <template slot-scope="scope">
122
          <template slot-scope="scope">
123
-           <!-- {{getAllCount(scope.row.orderInfo)}} -->
123
+           {{scope.row.source_count}}
124
          </template>
124
          </template>
125
        </el-table-column>
125
        </el-table-column>
126
 
126
 
183
 <script>
183
 <script>
184
 import BreadCrumb from "@/xt_pages/components/bread-crumb";
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
 import {uParseTime } from '@/utils/tools'
187
 import {uParseTime } from '@/utils/tools'
188
 export default {
188
 export default {
189
   name: "stockIn",
189
   name: "stockIn",
324
      },
324
      },
325
      editGoodReturn(id){
325
      editGoodReturn(id){
326
        this.$router.push({path:"/good/return/edit?id="+id})
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
   created() {
355
   created() {