Selaa lähdekoodia

增加调拨打印单

lichao 3 vuotta sitten
vanhempi
commit
c7fd06fff4
1 muutettua tiedostoa jossa 287 lisäystä ja 125 poistoa
  1. 287 125
      src/views/warehouse/allocation/index.vue

+ 287 - 125
src/views/warehouse/allocation/index.vue

@@ -79,6 +79,7 @@
                   filterable
                   remote
                   clearable
+                  :disabled="formDisabled"
                 >
                   <el-option
                     v-for="(dict, index) in dataList.fGoodsid"
@@ -98,6 +99,7 @@
                   remote
                   @change="changeWarehouse(1)"
                   clearable
+                  :disabled="formDisabled"
                 >
                   <el-option
                     v-for="(dict, index) in dataList.fWarehouseid"
@@ -123,6 +125,7 @@
                   filterable
                   remote
                   clearable
+                  :disabled="formDisabled"
                 >
                   <el-option
                     v-for="(dict, index) in dataList.fProject"
@@ -142,6 +145,7 @@
                   remote
                   clearable
                   @change="changeWarehouse(2)"
+                  :disabled="formDisabled"
                 >
                   <el-option
                     v-for="(dict, index) in dataList.fAllotWarehouseid"
@@ -179,6 +183,88 @@
         :listData="listData"
       />
     </div>
+
+    <el-dialog
+      title="打印调拨"
+      :visible.sync="dialogVisible"
+      :fullscreen="true"
+      style="padding: 0;margin:0"
+      width="70%">
+      <el-radio v-model="radio" label="1">显示</el-radio>
+      <el-radio v-model="radio" label="2">隐藏</el-radio>
+      <div ref="print">
+        <table class="table table-striped table-bordered" align="center" valign="center" style="font-size: 12px;border-collapse: collapse; border: none;margin-top: 10px;" >
+          <tr>
+            <td style="font-size: 24px;font-weight:bold" class="column" colspan="11">仓库调拨</td>
+          </tr>
+          <tr>
+            <td class="column" style="width: 5%;">调出项目</td>
+            <td class="column" style="width: 5%;">{{formList.projectName}}</td>
+            <td class="column" style="width: 5%;">调入项目</td>
+            <td class="column" style="width: 5%;">{{formList.fProjectName}}</td>
+            <td class="column" style="width: 5%;">调出仓库</td>
+            <td class="column" style="width: 5%;">{{formList.projectName}}</td>
+            <td class="column" style="width: 5%;">调入仓库</td>
+            <td class="column" style="width: 5%;">{{formList.fAllotWarehouseName}}</td>
+<!--            <td class="column" style="width: 5%;">供应商</td>-->
+<!--            <td class="column" style="width: 5%;">{{ formList.corpsName }}</td>-->
+            <td class="column" style="width: 10%;" colspan="2">日期:{{formList.fBsdate}}</td>
+          </tr>
+        </table>
+        <table class="table table-striped table-bordered" align="center" valign="center">
+          <tr>
+            <td class="column" style="width: 5%;border-top: none;">品名</td>
+            <td class="column" style="width: 5%;border-top: none;">调出库区</td>
+            <td class="column" style="width: 5%;border-top: none;">供应商</td>
+            <td class="column" style="width: 5%;border-top: none;">库存数量</td>
+            <td class="column" style="width: 5%;border-top: none;">库存单价</td>
+            <td class="column" style="width: 5%;border-top: none;">调入库区</td>
+            <td class="column" style="width: 5%;border-top: none;" v-if="radio == 1">单价</td>
+            <!-- <td class="column" style="width: 15%;border-top: none;">采购计划</td> -->
+            <td class="column" style="width: 5%;border-top: none;">实际重量</td>
+            <td class="column" style="width: 5%;border-top: none;" v-if="radio == 1">金额</td>
+            <td class="column" style="width: 5%;border-top: none;">备注</td>
+          </tr>
+          <tr v-for="(item,index) in contentList" :key="index">
+            <td class="column">{{item.feeName}}</td>
+            <td class="column">{{item.fWarehouseName}}</td>
+            <td class="column">{{item.corpName}}</td>
+            <td class="column">{{item.fGrossweightblc}}</td>
+            <td class="column">{{item.fVolumnblc}}</td>
+            <td class="column">{{item.fAllotWarehouseName}}</td>
+            <td class="column" v-if="radio == 1">{{item.fUnitprice?Number(item.fUnitprice).toFixed(2):item.fUnitprice}}</td>
+            <!-- <td class="column">{{item.fPurchase}}({{item.fFeeunitName}})</td> -->
+            <td class="column">{{item.fQty}}({{item.fFeeunitName}})</td>
+            <td class="column" v-if="radio == 1">{{item.fAmount?Number(item.fAmount).toFixed(2):item.fAmount}}</td>
+            <td class="column">{{item.remark}}</td>
+          </tr>
+        </table>
+        <table class="table table-striped table-bordered" align="center" valign="center">
+          <tr>
+            <td colspan="6" style="border-top: none;" class="column"></td>
+          </tr>
+          <tr>
+            <td class="column" style="width: 33.333333%;">收货人签字</td>
+            <!-- <td class="column" style="width: 25%;">厨房主管签字</td> -->
+            <td class="column" style="width: 33.333333%;">验收人签字</td>
+            <td class="column" style="width: 33.333333%;">主管签字</td>
+          </tr>
+          <tr>
+            <td class="column" style="width: 33.333333%;height: 37px;"></td>
+            <!-- <td class="column" style="width: 25%;"></td> -->
+            <td class="column" style="width: 33.333333%;"></td>
+            <td class="column" style="width: 33.333333%;"></td>
+          </tr>
+          <tr>
+            <td colspan="4" style="border-top: none;font-weight:bold;text-align: right;padding-right: 10%;font-size: 16px;" class="column">{{ formList.fsbuName }}</td>
+          </tr>
+        </table>
+      </div>
+      <span slot="footer" class="dialog-footer">
+    <el-button @click="dialogVisible = false">取 消</el-button>
+    <el-button type="primary" @click="Printing">打印</el-button>
+  </span>
+    </el-dialog>
   </div>
 </template>
 
@@ -271,9 +357,9 @@ export default {
         {
           index:'5',
           span: 6,
-          label: 'fBsdate',
+          label: 'timeInterval',
           name: '调拨日期',
-          inputType: 6,
+          inputType: 3,
           width: 200,
           labelSize: '80',
           rules: [{ required: false, message: ' ' }]
@@ -432,13 +518,13 @@ export default {
         //   name: '修改',
         //   disabled: false
         // },
-        {
-          type: 'danger',
-          size: 'mini',
-          icon: 'el-icon-delete',
-          name: '删除',
-          disabled: false
-        },
+        // {
+        //   type: 'danger',
+        //   size: 'mini',
+        //   icon: 'el-icon-delete',
+        //   name: '删除',
+        //   disabled: false
+        // },
         {
           type: 'warning',
           size: 'mini',
@@ -451,6 +537,7 @@ export default {
           size: 'mini',
           icon: 'el-icon-c-scale-to-original',
           name: '复制新单',
+          // nameTwo:'详情页',
           disabled: false,
           hasPermi:['anpin:stockControl:generateReceipts']
         },
@@ -827,6 +914,7 @@ export default {
       // 选择框选择的数据
       selection: [],
       formDataList:{
+        fBilltype: 'DB',
         pageSize:10,
         pageNum:1,
       },
@@ -860,6 +948,10 @@ export default {
         fProject: [{required: true, message: '不能为空', trigger: 'change'}],
         fAllotWarehouseid: [{required: true, message: '不能为空', trigger: 'change'}],
       },
+      formDisabled: false,
+      formList: {},
+      dialogVisible: false,
+      radio:'1',
     }
   },
   created() {
@@ -1028,6 +1120,7 @@ export default {
         })
       }else{
         this.contentOption.forEach(item => item.disabled = true)
+        this.formDisabled = true
         this.contentStyle.forEach(item => item.disabled = true)
       }
       selectMessage(scope.row.fId).then(res => {
@@ -1042,20 +1135,6 @@ export default {
         console.log(list)
         this.getRow(data,list,'',i)
       })
-      // viewSingle(scope.row.fId).then(res => {
-      //   if (res.code === 200) {
-      //     let data = {
-      //       tableName: this.purchaseList.tableName,
-      //       userId: Cookies.get('userName')
-      //     }
-      //     let list ={
-      //       warehouseBills:res.data.warehouseBills,
-      //       tWarehousebillsfees:res.data.tWarehousebillsfees
-      //     }
-      //     // this.$refs.avatar.form = {}
-      //     this.getRow(data,list,'',i)
-      //   }
-      // })
     },
     //修改
     modification(scope) {
@@ -1096,6 +1175,7 @@ export default {
       switch (row.name) {
         case '新单':
           if(row.nameTwo == '详情页'){
+            this.formDisabled = false
             if(this.$refs.avatar.form.fId){
               this.contentList = []
               data = {
@@ -1119,6 +1199,7 @@ export default {
               this.$message.error("当前数据未保存,请先保存")
             }
           }else{
+            this.formDisabled = false
             this.contentList = []
             data = {
               tableName: this.purchaseList.tableName,
@@ -1157,38 +1238,58 @@ export default {
           // this.$refs.avatar.submitForm('submit')
           break
         case '打印':
-          console.log(this.listData.fFeeid,this.contentList)
-          for (let item in this.contentList){
-            for (let li in this.listData.fFeeid){
-              if (this.contentList[item].fFeeid == this.listData.fFeeid[li].value){
-                this.contentList[item].feeName = this.listData.fFeeid[li].label
-              }
-            }
-            for(let i in this.listData.fFeeunitid){
-              if (this.contentList[item].fFeeunitid == this.listData.fFeeunitid[i].value){
-                this.contentList[item].fFeeunitName = this.listData.fFeeunitid[i].label
+          let formData = new window.FormData()
+          formData.append('tWarehousebills', JSON.stringify(Object.assign({},this.$refs.avatar.form, this.formOut, this.formIn)))
+          formData.append('tWarehousebillsfees', JSON.stringify(this.contentList))
+          formData.append('fBilltype', 'DB')
+          submit(formData).then(res => {
+            if (res.code == 200) {
+              if(res){
+                this.$refs.avatar.form = res.data.warehouseBills
               }
+              this.contentList = res.data.tWarehousebillsCntrs
+              selectMessage(this.$refs.avatar.form.fId).then(res1 => {
+                this.contentList = res1.data.tWarehousebillsfees
+                this.$refs.avatar.form = res1.data.warehouseBills
+                this.formList = this.$refs.avatar.form
+                this.dialogVisible = true
+              })
             }
-          }
-          if (!this.$refs.avatar.form.fId){
-            this.$message.error('未保存,不允许打印');
-          }else if (this.$refs.avatar.form.fBillstatus >= 4){
-            this.formList = this.$refs.avatar.form
-            this.dialogVisible = true
-          }else {
-            this.formList = this.$refs.avatar.form
-            console.log(this.$refs.avatar.form.fBillstatus)
-            this.submitAndSave(1)
-          }
+          })
+
+          // this.formList = Object.assign({}, this.$refs.avatar.form, this.formIn, this.formOut)
+
+          // console.log(this.listData.fFeeid,this.contentList)
+          // for (let item in this.contentList){
+          //   for (let li in this.listData.fFeeid){
+          //     if (this.contentList[item].fFeeid == this.listData.fFeeid[li].value){
+          //       this.contentList[item].feeName = this.listData.fFeeid[li].label
+          //     }
+          //   }
+          //   for(let i in this.listData.fFeeunitid){
+          //     if (this.contentList[item].fFeeunitid == this.listData.fFeeunitid[i].value){
+          //       this.contentList[item].fFeeunitName = this.listData.fFeeunitid[i].label
+          //     }
+          //   }
+          // }
+          // if (!this.$refs.avatar.form.fId){
+          //   this.$message.error('未保存,不允许打印');
+          // }else if (this.$refs.avatar.form.fBillstatus >= 4){
+          //   this.formList = this.$refs.avatar.form
+          //   this.dialogVisible = true
+          // }else {
+          //   this.formList = this.$refs.avatar.form
+          //   console.log(this.$refs.avatar.form.fBillstatus)
+          //   this.submitAndSave(1)
+          // }
           break
         case '修改':
           // this.purchaseList.columnList.forEach(item => item.disabled = false)
           this.purchaseList.columnList.forEach(item => {
             this.$set(item,'disabled',false)
           })
-          console.log(this.purchaseList.columnList)
-          console.log(this.$refs.listComponent.queryList.columnList)
           this.contentStyle.forEach(item => item.disabled = false)
+          this.formDisabled = false;
           this.contentOption.forEach(item => {
             if (item.label == 'personNaem' || item.label == 'corpsName' || item.label == 'createBy' || item.label == 'fBillno') {
               item.disabled = true
@@ -1293,6 +1394,18 @@ export default {
                     fTypeid: 1
                   }
                   isAllocation(data).then(res => {
+                    this.contentButton.forEach(item => {
+                      if (item.name === '撤销调拨') {
+                        item.disabled = false
+                      }
+                      if (item.name === '调拨确认' || item.name === '修改' || item.name === '录入明细' || item.name === '保存') {
+                        item.disabled = true
+                      }
+                    })
+                    selectMessage(this.$refs.avatar.form.fId).then(res => {
+                      this.contentList = res.data.tWarehousebillsfees
+                      this.$refs.avatar.form = res.data.warehouseBills
+                    })
                     this.$message({
                       message: '调拨成功',
                       type: 'success',
@@ -1301,6 +1414,60 @@ export default {
                   })
                 }
               })
+            } else {
+              let pass = false;
+              this.contentList.forEach(item => {
+                if (item.fGrossweightblc === 0) {
+                  pass = true
+                }
+              })
+              if (pass) {
+                this.$message.error('当前库存数量为0,请修改调拨信息')
+                return
+              }
+              for(let item in this.contentList) {
+                let num = Number(item) + 1
+                if (!this.contentList[item].fUnitprice) {
+                  this.$message.error("请维护第" + num + "行单价")
+                  return false
+                }
+                if(!this.contentList[item].fQty){
+                  this.$message.error("请维护第" + num + "数量")
+                  return false
+                }
+                if (!this.contentList[item].fFeeunitid) {
+                  this.$message.error("请维护第" + num + "行计量单位")
+                  return false
+                }
+                if (!this.contentList[item].fAmount) {
+                  this.$message.error("请维护第" + num + "行金额")
+                  return false
+                }
+              }
+              // fTypeid 1确认 2撤销
+              let data = {
+                fId: this.$refs.avatar.form.fId,
+                fTypeid: 1
+              }
+              isAllocation(data).then(res => {
+                this.contentButton.forEach(item => {
+                  if (item.name === '撤销调拨') {
+                    item.disabled = false
+                  }
+                  if (item.name === '调拨确认' || item.name === '修改' || item.name === '录入明细' || item.name === '保存') {
+                    item.disabled = true
+                  }
+                })
+                selectMessage(this.$refs.avatar.form.fId).then(res => {
+                  this.contentList = res.data.tWarehousebillsfees
+                  this.$refs.avatar.form = res.data.warehouseBills
+                })
+                this.$message({
+                  message: '调拨成功',
+                  type: 'success',
+                  showClose:true
+                });
+              })
             }
           }
           break
@@ -1319,47 +1486,9 @@ export default {
             this.pageDisplay = true;
           })
           break
-        case '生成入库单':
-          let listData = {
-            fId:this.$refs.avatar.form.fId,
-            fBilltype:'RK'
-          }
-          copyNew(listData).then(res=>{
-            this.$message({
-              message: '生成成功',
-              type: 'success',
-              showClose:true
-            });
-          })
-          break
-        case '生成销售单':
-          let liste = {
-            fId:this.$refs.avatar.form.fId,
-            fBilltype:'XS'
-          }
-          copyNew(liste).then(res=>{
-            this.$message({
-              message: '生成成功',
-              type: 'success',
-              showClose:true
-            });
-          })
-          break
-        case '生成出库单':
-          let listd = {
-            fId:this.$refs.avatar.form.fId,
-            fBilltype:'CK'
-          }
-          copyNew(listd).then(res=>{
-            this.$message({
-              message: '生成成功',
-              type: 'success',
-              showClose:true
-            });
-          })
-          break
         case '复制新单':
           if (row.nameTwo === '详情页'){
+            this.formDisabled = false
             this.$refs.avatar.submitForm('submit',3)
           }else {
             if (this.selection.length > 0){
@@ -1375,48 +1504,27 @@ export default {
             }
           }
           break
-        case '撤销审批':
-          let date = new Date()
-          let y = date.getFullYear()
-          let m = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1)
-          let d = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate())
-          data = {
-            actId:520,
-            id:this.$refs.avatar.form.fId,
-            billId:this.$refs.avatar.form.fId,
-            auditItem:y + '-' + m + '-' + d
-          }
-          console.log(data)
-          revoke(data).then(res=>{
-            if (res.code === 200){
-              this.$message({
-                showClose: true,
-                message: '撤销成功',
-                type: 'success'
-              })
-              data = {
-                tableName: this.queryList.tableName,
-                userId: Cookies.get('userName')
+        case '刷新':
+          let formData1 = new window.FormData()
+          formData1.append('tWarehousebills', JSON.stringify(Object.assign({},this.$refs.avatar.form, this.formOut, this.formIn)))
+          formData1.append('tWarehousebillsfees', JSON.stringify(this.contentList))
+          formData1.append('fBilltype', 'DB')
+          submit(formData1).then(res => {
+            if (res.code == 200) {
+              console.log(res)
+              if(res){
+                this.$refs.avatar.form = res.data.warehouseBills
               }
-              this.getRow(data)
-              this.query(this.formDataList)
-            }
-          })
-          break
-        case '撤销采购':
-          withdrawBy(this.$refs.avatar.form.fId).then(res=>{
-            if (res.code === 200){
-              this.$message({
-                showClose: true,
-                message: '撤销成功',
-                type: 'success'
+              this.contentList = res.data.tWarehousebillsCntrs
+              selectMessage(this.$refs.avatar.form.fId).then(res => {
+                this.contentList = res.data.tWarehousebillsfees
+                this.$refs.avatar.form = res.data.warehouseBills
+                this.$message({
+                  message: '刷新成功',
+                  type: 'success',
+                  showClose:true
+                });
               })
-              data = {
-                tableName: this.queryList.tableName,
-                userId: Cookies.get('userName')
-              }
-              this.getRow(data)
-              this.query(this.formDataList)
             }
           })
           break
@@ -1510,6 +1618,7 @@ export default {
     backToList(){
       let data
       if (!this.$refs.avatar.form.fId && this.contentList !== 0 || this.$refs.avatar.form.fBillstatus > 3 && !this.$route.query.data) {
+        console.log(888)
         data = {
           tableName: this.queryList.tableName,
           userId: Cookies.get('userName')
@@ -1518,9 +1627,11 @@ export default {
         // this.pageDisplay = true
         this.query(this.formDataList)
       } else if(this.$route.query.data){
+        console.log(777)
         this.cancelTwo();
         // this.$router.push({path:'/index'})
       }else {
+        console.log(666)
         this.$confirm('当前数据是否保存?', '提示', {
           confirmButtonText: '保存',
           cancelButtonText: '取消',
@@ -1539,9 +1650,13 @@ export default {
     },
     //查询列数据
     getRow(data,list,add,i) {
+      console.log('????')
       // console.log(data,list,add)
       select(data).then((res) => {
+        console.log(123)
         this.$refs.avatar.form = {}
+        console.log(data.tableName)
+        console.log(res)
         if (data.tableName === '仓库调拨详情') {
           if (res.data.length != 0) {
             this.purchaseList.columnList = res.data.filter((e) => e.checked == 0)
@@ -1555,6 +1670,7 @@ export default {
             this.setRowList = this.$options.data().contentStyle
           }
           if(add){
+            console.log(321)
             this.listData.fWarehouseid = []
             this.listData.fAllotWarehouseid = []
             this.formIn = {
@@ -1573,6 +1689,7 @@ export default {
           this.isItHidden = false
           this.inDex = this.contentOption.length
         } else {
+          console.log(98787)
           if (res.data.length != 0) {
             this.queryList.columnList = res.data.filter((e) => e.checked == 0)
             this.queryList.columnList = res.data
@@ -1684,6 +1801,27 @@ export default {
         if (i == 1) this.submitAnd()
       })
     },
+    submitAnd() {
+      this.$refs.avatar.form.fId = ''
+      this.$refs.avatar.form.fBillno = ''
+      this.$refs.avatar.form.fCreateLog = ''
+      this.$refs.avatar.form.fPrintLog = ''
+      this.$refs.avatar.form.fReviewDate = ''
+      this.$refs.avatar.form.fBillstatus = 2
+      this.$refs.avatar.form.fPrint = 0
+      this.contentList.forEach(item => item.fId = '')
+      this.contentOption.forEach(item => {
+        if (item.label == 'personNaem' || item.label == 'corpsName' || item.label == 'createBy' || item.label == 'fBillno') {
+          item.disabled = true
+        } else {
+          item.disabled = false
+        }
+      })
+      this.formDisabled = false
+      this.purchaseList.columnList.forEach(item => item.disabled = false)
+      this.contentButton.forEach(item => item.disabled = false)
+      this.contentStyle.forEach(item => item.disabled = false)
+    },
     //请核
     writeOff(){
       let formData = new window.FormData()
@@ -1885,6 +2023,10 @@ export default {
       }
 
     },
+    //确认打印
+    Printing(){
+      this.$print(this.$refs.print)
+    },
     // 品名、计量单位、调出库区和供应商变化获得库存数量和库存单价
     getStockNumPrice() {
       this.contentList.forEach((item, index) => {
@@ -1917,4 +2059,24 @@ export default {
   font-size: 18px;
   margin-bottom: 10px;
 }
+.table {
+  border-collapse: collapse;
+  border-spacing: 0;
+  background-color: transparent;
+  display: table;
+  width: 100%;
+  max-width: 100%;
+  margin: 0 auto;
+}
+
+.table td {
+  text-align: center;
+  vertical-align: middle;
+  font-size: 14px;
+  color: #000000;
+  padding: 8px 12px;
+}
+.column {
+  border: 1px solid #000;
+}
 </style>