Procházet zdrojové kódy

仓库出库添加库存数量和库存单价

lichao před 4 roky
rodič
revize
a1b6eb3c2b
1 změnil soubory, kde provedl 183 přidání a 20 odebrání
  1. 183 20
      src/views/warehouse/outStock/index.vue

+ 183 - 20
src/views/warehouse/outStock/index.vue

@@ -165,6 +165,8 @@ import Cookies from 'js-cookie'
 import { getliable } from '@/api/project'
 import { queryItem } from '@/api/purchaseRequest'
 import moment from 'moment'
+import { company } from '@/api/purchaseRequest/index'
+import { getStockNumPrice } from '@/api/allocation/index'
 export default {
   name: 'inStock',
   data(){
@@ -187,6 +189,7 @@ export default {
         fUnits:[],
         fStoreEnv:[],
         fIsfilles:[],
+        fCorpid: [],
       },
       selection:[],
       isItHidden:true,
@@ -450,6 +453,56 @@ export default {
           data:[],
         },
         {
+          surface: "6",
+          label: "fFeeunitid",
+          name: "*计量单位",
+          checked: 0,
+          width: 100,
+          changeable:1,
+          operation:2,
+          data:[],
+          disabled:false
+        },
+        {
+          surface: "7",
+          label: "fWarehouseid",
+          name: "*库区",
+          checked: 0,
+          width: 100,
+          operation:2,
+          changeable:1,
+          data:[],
+          disabled:false
+        },
+        // {
+        //   surface: '5',
+        //   label: 'fCorpid',
+        //   name: '供应商',
+        //   checked: 0,
+        //   width: 100,
+        //   onabort: '',
+        //   changeable: 1,
+        //   disabled:true
+        // },
+        {
+          surface: '7',
+          label: 'fGrossweightblc',
+          name: '库存数量',
+          checked: 0,
+          width: 100,
+          onabort: '',
+          disabled: true
+        },
+        {
+          surface: '8',
+          label: 'fVolumnblc',
+          name: '库存单价',
+          checked: 0,
+          width: 100,
+          onabort: '',
+          disabled: true
+        },
+        {
           surface: "3",
           label: "fCurrencyName",
           name: "*规格",
@@ -477,26 +530,6 @@ export default {
           disabled:false,
           onabort:'this.value=this.value.replace(/[^\\d^\\.]+/g,\'\')'
         },{
-          surface: "6",
-          label: "fFeeunitid",
-          name: "*计量单位",
-          checked: 0,
-          width: 100,
-          changeable:1,
-          operation:2,
-          data:[],
-          disabled:false
-        },{
-          surface: "7",
-          label: "fWarehouseid",
-          name: "*库区",
-          checked: 0,
-          width: 100,
-          operation:2,
-          changeable:1,
-          data:[],
-          disabled:false
-        },{
           surface: "8",
           label: "fAmount",
           name: "*金额",
@@ -873,6 +906,9 @@ export default {
       for(let li in this.detailStyle){
         if(!this.detailStyle[li].doNot){
           this.detailStyle[li].disabled = false
+          if (this.detailStyle[li].name == '供应商') {
+            this.detailStyle[li].disabled = true
+          }
         }
       }
       for(let item in this.detailOption){
@@ -907,6 +943,7 @@ export default {
     // this.query(list)
     this.getList()
     this.selectMethods()
+    this.fCompany(1)
   },
   methods:{
     //返回列表
@@ -922,6 +959,24 @@ export default {
           }
         }
       }
+      console.log(scope)
+      if (scope.row.fFeeid === null || scope.row.fFeeunitid === null || scope.row.fWarehouseid === null || scope.row.fCorpid === null) {
+        return;
+      } else {
+        const data = {
+          fGoodsid: scope.row.fFeeid,
+          fBillingway: scope.row.fFeeunitid,
+          fWarehouseLocationid: scope.row.fWarehouseid,
+          fCorpid: this.detailForm.fCorpid,
+        }
+        getStockNumPrice(data).then(res => {
+          scope.row.fGrossweightblc = res.data.fGrossweightblc
+          scope.row.fVolumnblc = res.data.fVolumnblc
+        }).catch(e => {
+          scope.row.fGrossweightblc = 0
+          scope.row.fVolumnblc = 0
+        })
+      }
     },
     //确认打印
     Printing(){
@@ -933,6 +988,34 @@ export default {
         this.tableData = res.rows
       })
     },
+    //查询公司
+    fCompany(name) {
+      company(name).then(res => {
+        if (name == 1) {
+          // this.dataList.fCorpid = []
+          // for (let item in res.data) {
+          //   this.dataList.fCorpid.push({
+          //     label: res.data[item].fName,
+          //     value: res.data[item].fId
+          //   })
+          // }
+          for (let item in res.data) {
+            this.listData.fCorpid.push({
+              label: res.data[item].fName,
+              value: res.data[item].fId
+            })
+          }
+        } else if (name == 2) {
+          this.dataList.fSbu = []
+          for (let item in res.data) {
+            this.dataList.fSbu.push({
+              label: res.data[item].fName,
+              value: res.data[item].fId
+            })
+          }
+        }
+      })
+    },
     //更换仓库
     changeWarehouse(item){
       if (item.label == "fWarehouseid"){
@@ -951,6 +1034,33 @@ export default {
           }
         })
       }
+      // 供应商
+      if (item.label == 'fCorpid') {
+        if (this.detailData.length != 0) {
+          for(let li in this.detailData){
+            this.detailData[li].fCorpid = this.detailForm.fCorpid
+          }
+          this.detailData.forEach(item => {
+            if (item.fFeeid === null || item.fFeeunitid === null || item.fWarehouseid === null || item.fCorpid === null) {
+              return;
+            } else {
+              const data = {
+                fGoodsid: item.fFeeid,
+                fBillingway: item.fFeeunitid,
+                fWarehouseLocationid: item.fWarehouseid,
+                fCorpid: this.detailForm.fCorpid,
+              }
+              getStockNumPrice(data).then(res => {
+                item.fGrossweightblc = res.data.fGrossweightblc
+                item.fVolumnblc = res.data.fVolumnblc
+              }).catch(e => {
+                item.fGrossweightblc = 0
+                item.fVolumnblc = 0
+              })
+            }
+          })
+        }
+      }
     },
     //自动合计金额
     totalAmount(scope,item) {
@@ -1069,6 +1179,7 @@ export default {
                 value:res.data[item].fId
               })
             }
+            console.log(this.formOption[li].data)
           })
         }
         if(this.detailOption[li].name == '开票公司'){
@@ -1239,6 +1350,7 @@ export default {
               disabled: false
             })
           }
+          this.getStockNumPrice();
           if(iem === undefined){
             this.detailButton.forEach(item => item.disabled = false)
             this.detailForm.fId = ''
@@ -1517,6 +1629,9 @@ export default {
           fFeeid:null,
           fUnitprice:null,
           fQty:null,
+          // fCorpid: this.detailForm.fCorpid,
+          fGrossweightblc: 0,
+          fVolumnblc: 0,
           fFeeunitid:null,
           fWarehouseid:null,
           fAmount:null,
@@ -1571,6 +1686,16 @@ export default {
       }
     },
     backSave(valid,i){
+      let pass = false;
+      this.detailData.forEach(item => {
+        if (item.fGrossweightblc === 0) {
+          pass = true
+        }
+      })
+      if (pass) {
+        this.$message.error('当前库存数量为0,请修改调拨信息')
+        return
+      }
       if(valid){
         if(this.detailForm.fBillstatus < 4 || !this.detailForm.fBillstatus){
           this.detailForm.fMoney = 0
@@ -1660,6 +1785,9 @@ export default {
               for(let li in this.detailStyle){
                 if(!this.detailStyle[li].doNot){
                   this.detailStyle[li].disabled = false
+                  if (this.detailStyle[li].name == '供应商') {
+                    this.detailStyle[li].disabled = true
+                  }
                 }
               }
               for(let item in this.detailOption){
@@ -1683,6 +1811,9 @@ export default {
             for(let li in this.detailStyle){
               if(!this.detailStyle[li].doNot){
                 this.detailStyle[li].disabled = false
+                if (this.detailStyle[li].name == '供应商') {
+                  this.detailStyle[li].disabled = true
+                }
               }
             }
             for(let item in this.detailOption){
@@ -1710,6 +1841,16 @@ export default {
           if(this.detailData.length == 0){
             this.$message.error("请维护明细")
           }else{
+            let pass = false;
+            this.detailData.forEach(item => {
+              if (item.fGrossweightblc === 0) {
+                pass = true
+              }
+            })
+            if (pass) {
+              this.$message.error('当前库存数量为0,请修改调拨信息')
+              return
+            }
             for(let item in this.detailData) {
               let num = Number(item) + 1
               if (!this.detailData[item].fFeeid) {
@@ -1904,6 +2045,28 @@ export default {
         }
       })
     },
+    // 品名、计量单位、调出库区和供应商变化获得库存数量和库存单价
+    getStockNumPrice() {
+      this.contentList.forEach((item, index) => {
+        if (item.fFeeid === null || item.fFeeunitid === null || item.fWarehouseid === null || item.fCorpid === null) {
+          return;
+        } else {
+          const data = {
+            fGoodsid: item.fFeeid,
+            fBillingway: item.fFeeunitid,
+            fWarehouseLocationid: item.fWarehouseid,
+            fCorpid: this.detailForm.fCorpid,
+          }
+          getStockNumPrice(data).then(res => {
+            item.fGrossweightblc = res.data.fGrossweightblc
+            item.fVolumnblc = res.data.fVolumnblc
+          }).catch(e => {
+            item.fGrossweightblc = 0
+            item.fVolumnblc = 0
+          })
+        }
+      })
+    },
   }
 }
 </script>