浏览代码

出入库(采购入库判断重复)、排产委外(两个弹窗)

liqianyi 2 年之前
父节点
当前提交
1b8222ef51

+ 8 - 0
src/api/warehouse.js

@@ -219,3 +219,11 @@ export function getMaterialTypes (params) {
     params
   })
 }
+// 根据物品零件名称检索查询是否重复
+export function infoByNameAndCode (params) {
+  return request({
+    url: request.adornUrl(`/biz-service/stock-mg-ctl/infoByNameAndCode`),
+    method: 'get',
+    params
+  })
+}

+ 2 - 2
src/views/common/login.vue

@@ -3,11 +3,11 @@
       <div class="site-content__wrapper">
         <div class="site-content">
           <div class="brand-info">
-            <h2 class="brand-info__text">重庆木之科技有限公司</h2>
+            <h2 class="brand-info__text">MZ 云平台</h2>
             <p class="brand-info__intro">即时生产ERP,服务于各类生产型企业</p>
           </div>
           <div class="login-main">
-            <h3 class="login-title">管理员登录</h3>
+            <h3 class="login-title">用户登录</h3>
             <el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" status-icon>
               <el-form-item prop="userName">
                 <el-input v-model="dataForm.userName" placeholder="帐号"></el-input>

+ 394 - 0
src/views/modules/production/scheduling-outsource.vue

@@ -0,0 +1,394 @@
+<!-- 排产、委外 -->
+<template>
+    <div>
+        <div class="my-title">委外</div>
+        <!-- 表单 -->
+        <el-form :model="dataForm" :rules="dataRule" ref="dataForm" label-width="auto">
+          <el-row class="my-row">
+            <el-col :span="8">
+              <el-form-item label="委外编码" prop="purchaseCode">
+                <el-input v-model="dataForm.purchaseCode" disabled placeholder="委外编码由系统生成"></el-input>
+              </el-form-item>
+            </el-col>
+            <el-col :span="16">
+              <el-form-item label="付款方式" prop="payType">
+                <el-radio-group v-model="dataForm.payType">
+                  <el-radio :label='"1"'>对公转账</el-radio>
+                  <el-radio :label='"2"'>先行垫付</el-radio>
+                  <el-radio :label='"3"'>财务预支</el-radio>
+                </el-radio-group>
+              </el-form-item>
+            </el-col>
+          </el-row>
+          <el-row class="my-row">
+            <el-col :span="8">
+              <el-form-item label="委外类别" prop="commissionType">
+                <el-select
+                  v-model="dataForm.commissionType"
+                  remote
+                  placeholder="请选择">
+                  <el-option
+                    v-for="item in optionsType"
+                    :key="item.code"
+                    :label="item.value"
+                    :value="item.code">
+                  </el-option>
+                </el-select>
+              </el-form-item>
+            </el-col>
+          </el-row>
+          <div class="title"><span style="color: red">*</span> 委外产品明细</div>
+          <el-row class="my-row">
+            <el-table
+              :data="productDetails"
+              border
+              style="width: 100%;">
+              <el-table-column
+                label="序号"
+                type="index"
+                width="50"
+                align="center">
+              </el-table-column>
+              <el-table-column
+                prop="detailId"
+                label="ID"
+                v-if="false">
+              </el-table-column>
+              <el-table-column
+                prop="productName"
+                header-align="center"
+                align="center"
+                width="140"
+                :show-tooltip-when-overflow="true"
+                label="产品名称">
+              </el-table-column>
+              <el-table-column
+                prop="prodCode"
+                header-align="center"
+                align="center"
+                width="120"
+                :show-tooltip-when-overflow="true"
+                label="产品编号">
+              </el-table-column>
+              <el-table-column
+                prop="productSpec"
+                header-align="center"
+                align="center"
+                width="120"
+                :show-tooltip-when-overflow="true"
+                label="型号及规格">
+              </el-table-column>
+              <el-table-column
+                prop="cnt"
+                header-align="center"
+                align="center"
+                label="数量">
+              </el-table-column>
+              <el-table-column
+                prop="unitName"
+                header-align="center"
+                align="center"
+                label="单位">
+              </el-table-column>
+              <el-table-column
+                prop="deadline"
+                header-align="center"
+                align="center"
+                width="140"
+                :show-tooltip-when-overflow="true"
+                label="委外期限">
+              </el-table-column>
+              <el-table-column
+                prop="batchNumber"
+                header-align="center"
+                align="center"
+                width="120"
+                :show-tooltip-when-overflow="true"
+                label="批次号">
+              </el-table-column>
+              <el-table-column
+                prop="specificationExplian"
+                header-align="center"
+                align="center"
+                width="120"
+                :show-tooltip-when-overflow="true"
+                label="要求说明">
+              </el-table-column>
+              <el-table-column
+                prop="arrivedTime"
+                header-align="center"
+                align="center"
+                width="140"
+                :show-tooltip-when-overflow="true"
+                label="到料时间">
+              </el-table-column>
+              <el-table-column
+                prop="qualifiedCnt"
+                header-align="center"
+                align="center"
+                label="合格数量">
+              </el-table-column>
+              <el-table-column
+                prop="technologyFile"
+                header-align="center"
+                align="center"
+                width="160"
+                :show-tooltip-when-overflow="true"
+                label="工艺文件">
+              </el-table-column>
+              <el-table-column
+                prop="attachList"
+                header-align="center"
+                align="center"
+                min-width="160"
+                label="附件">
+                <template slot-scope="scope">
+                  <div v-for="(item, index) in scope.row.attachList" style="display: inline">
+                    <span v-if="index > 0">,</span>
+                    <a :key="item.fileName + index" type="primary" href="#" @click="previewFile(item.fileName, item.url)">{{ item.fileName }}</a>
+                  </div>
+                </template>
+              </el-table-column>
+              <el-table-column
+                prop="price"
+                header-align="center"
+                align="center"
+                min-width="100"
+                label="不含税单价">
+              </el-table-column>
+              <el-table-column
+                prop="taxPrice"
+                header-align="center"
+                align="center"
+                label="含税单价">
+              </el-table-column>
+              <el-table-column
+                prop="taxAmount"
+                header-align="center"
+                align="center"
+                label="含税总价">
+              </el-table-column>
+              <el-table-column
+                prop="taxRate"
+                header-align="center"
+                align="center"
+                :formatter="formatPercent"
+                label="税率">
+              </el-table-column>
+              <el-table-column
+                prop="notes"
+                header-align="center"
+                align="center"
+                label="备注">
+              </el-table-column>
+              <el-table-column
+                fixed="right"
+                header-align="center"
+                align="center"
+                width="80"
+                label="操作">
+                <template slot-scope="scope">
+                  <el-button type="text" size="small" @click="addProductHandle(scope.row)">编辑</el-button>
+<!--                  <el-button style="color: red" type="text" size="small" @click="deleteProductHandle(scope.row.detailId)">删除</el-button>-->
+                </template>
+              </el-table-column>
+            </el-table>
+          </el-row>
+          <el-row style="margin-top: 20px">
+            <span>合计(含税): {{totalAmount}}</span>
+          </el-row>
+<!--          <el-row style="text-align: center; margin-top: 10px;">-->
+<!--            <el-button type="primary" icon="el-icon-plus" @click="addMaterial"></el-button>-->
+<!--          </el-row>-->
+        </el-form>
+        <span slot="footer" class="dialog-footer">
+          <el-button @click="onChose">取消</el-button>
+          <el-button type="primary" @click="dataFormSubmit()">确定</el-button>
+        </span>
+      <!-- 新增物品 -->
+      <Add v-show="addProductVisible" ref="comAddProduct" @addItem="addProductCallback"/>
+      <!-- 文件预览 -->
+      <preview-component v-if="previewVisible" ref="preview"/>
+    </div>
+</template>
+
+<script>
+  import { getOutsourceDetail, getOutsourceDetailByScheduleId } from '@/api/sale'
+  import { getDictList } from '@/api/dict'
+  import Add from '../sale/edit-product'
+  import ApproveComponent from '../common/approve-component'
+  import PreviewComponent from '../common/preview-component'
+
+export default {
+    name: 'scheduling-outsource',
+    components: {
+      PreviewComponent,
+      ApproveComponent,
+      Add
+    },
+    data () {
+      return {
+        id: 0,
+        dataForm: {},
+        dataRule: {
+          payType: [{ required: true, message: '请选择付款方式', trigger: 'change' }],
+          commissionType: [{ required: true, message: '请选择委外类别', trigger: 'change' }]
+        },
+        optionsType: [],
+        totalAmount: 0,
+        addProductVisible: false,
+        productDetails: [],
+        prodProductionIds: [], // 排产ID的集合
+        previewVisible: false
+      }
+    },
+    methods: {
+      onChose () {
+        this.$emit('onChose')
+      },
+      async init (id, prodProductionIds) {
+        if (prodProductionIds) {
+          this.prodProductionIds = prodProductionIds
+        }
+        this.productDetails = []
+        this.dataForm = {
+          payType: '1'
+        }
+        this.id = id || 0
+        // 获取委外类别列表
+        this.getType()
+        // 详情
+        if (!id) return
+        if (this.prodProductionIds.length > 0) {
+          await getOutsourceDetailByScheduleId({'prodProductionIds': this.prodProductionIds}).then(({data}) => {
+            if (data && data.code === '200' && data.data) {
+              this.productDetails = data.data
+              if (this.productDetails && this.productDetails.length > 0) {
+                this.productDetails.forEach((item) => {
+                  item.detailId = Math.round(Math.random() * 1000000)
+                })
+                this.calTotal()
+              }
+            }
+          })
+        } else {
+          await getOutsourceDetail(this.id).then(({data}) => {
+            if (data && data.code === '200' && data.data) {
+              this.dataForm = data.data
+              this.productDetails = data.data.purCommissionDetails
+              if (this.productDetails && this.productDetails.length > 0) {
+                this.productDetails.forEach((item) => {
+                  item.detailId = Math.round(Math.random() * 1000000)
+                })
+                this.calTotal()
+              }
+            }
+          })
+        }
+      },
+      // 获取类别
+      getType () {
+        getDictList({type: 'commission_type'}).then(({data}) => {
+          if (data) {
+            this.optionsType = data
+          }
+        })
+      },
+      validateField (type) {
+        this.$refs.dataForm.validateField(type)
+      },
+      // 表单提交
+      dataFormSubmit () {
+        this.$refs['dataForm'].validate((valid) => {
+          if (valid) {
+            let action = ''
+            if (this.prodProductionIds.length > 0) {
+              action = `/biz-service/purCommDetail/save`
+            } else {
+              action = `/biz-service/purCommDetail/${!this.id ? 'save' : 'update'}`
+            }
+            // 产品明细
+            this.$http({
+              url: this.$http.adornUrl(action),
+              method: 'post',
+              data: this.$http.adornData({
+                ...this.dataForm,
+                purCommissionDetails: this.productDetails,
+                applierId: this.$store.state.user.id,
+                orgId: this.$store.state.user.orgId
+              })
+            }).then(({data}) => {
+              if (data && data.code === '200') {
+                this.$message({
+                  message: '操作成功',
+                  type: 'success',
+                  duration: 1500,
+                  onClose: () => {
+                    this.onChose()
+                    this.$emit('refreshDataList')
+                  }
+                })
+              } else {
+                this.$message.error(data.msg)
+              }
+            })
+          }
+        })
+      },
+      addMaterial () {
+        this.addProductVisible = true
+        this.$nextTick(() => {
+          this.$refs.comAddProduct.init()
+        })
+      },
+      addProductHandle (row) {
+        this.addProductVisible = true
+        this.$nextTick(() => {
+          this.$refs.comAddProduct.init(row.detailId, row)
+        })
+      },
+      deleteProductHandle (detailId) {
+        if (!detailId) return
+        this.productDetails.splice(this.productDetails.findIndex((item) => item.detailId === detailId))
+        this.calTotal()
+      },
+      addProductCallback (data) {
+        if (!data) return
+        this.addProductVisible = false
+        let i = this.productDetails.findIndex((item) => item.detailId === data.detailId)
+        if (i > -1) {
+          this.productDetails.splice(i)
+        }
+        this.productDetails.push(data)
+        this.calTotal()
+      },
+      calTotal () {
+        let total = 0
+        if (this.productDetails) {
+          this.productDetails.forEach((item) => {
+            total += item.taxAmount ? Number(item.taxAmount) : 0
+          })
+        }
+        this.totalAmount = total
+      },
+      // 百分比
+      formatPercent (row) {
+        if (!row.taxRate) return ''
+        let str = (Number(row.taxRate * 100)).toFixed(0)
+        str += '%'
+        return str
+      },
+      // 预览
+      previewFile (fileName, url) {
+        this.previewVisible = true
+        this.$nextTick(() => {
+          this.$refs.preview.init(fileName, url)
+        })
+      }
+    }
+  }
+</script>
+
+<style scoped>
+
+</style>

+ 1 - 1
src/views/modules/production/scheduling.vue

@@ -116,7 +116,7 @@
 
 <script>
   import Detail from './scheduling-details'
-  import Outsource from '../sale/outsource-add-or-update'
+  import Outsource from './scheduling-outsource'
   import { getSchedulingList, batchPlan } from '@/api/production'
   export default {
     name: 'scheduling',

+ 106 - 0
src/views/modules/sale/edit-product.vue

@@ -0,0 +1,106 @@
+<template>
+  <div>
+    <el-dialog
+      :title="!id ? '新增': '新增或修改'"
+      width="70%"
+      :close-on-click-modal="false"
+      :visible.sync="visible">
+      <el-form :model="dataForm" :rules="dataRule" ref="dataForm" label-width="100px">
+        <el-row class="my-row">
+          <el-form-item label="工艺文件" prop="docId">
+            <doc-component v-model="dataForm.docId" :doc-id.sync="dataForm.docId" @change="docChanged"></doc-component>
+          </el-form-item>
+        </el-row>
+        <el-row class="my-row">
+          <el-form-item label="要求说明" prop="specificationExplian">
+            <el-input v-model="dataForm.specificationExplian" :disabled="false" placeholder="要求说明"></el-input>
+          </el-form-item>
+        </el-row>
+        <el-row class="my-row">
+          <upload-component :title="'附件'" :accept="'*'" :file-obj-list="fileList" @uploadSuccess="uploadSuccess"/>
+        </el-row>
+      </el-form>
+      <span slot="footer">
+        <el-button @click="visible = false">取消</el-button>
+        <el-button type="primary" @click="dataFormSubmit()">确定</el-button>
+      </span>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+  import UploadComponent from '../common/upload-component'
+  import DocComponent from '../common/doc-component'
+  export default {
+    name: 'edit-product',
+    components: {DocComponent, UploadComponent},
+    data () {
+      return {
+        visible: false,
+        dataList: [],
+        transferData: {},
+        dataForm: {},
+        id: 0,
+        taxRateVal: 0,
+        dataRule: {
+          specificationExplian: [{ required: true, message: '要求说明不能为空', trigger: 'blur' }],
+          docId: [{ required: true, message: '请选择工艺文件', trigger: 'change' }]
+        },
+        fileList: [] // 附件
+      }
+    },
+    methods: {
+      async init (id, transferData) {
+        this.fileList = []
+        this.visible = true
+        this.id = id || Math.round(Math.random() * 1000000)
+        if (!id) return
+        this.dataForm = transferData
+        // 附件
+        if (transferData.attachList && transferData.attachList.length > 0) {
+          transferData.attachList.forEach((item) => {
+            this.fileList.push({
+              name: item.fileName,
+              url: item.url,
+              id: item.url
+            })
+          })
+        }
+      },
+      // 表单提交
+      dataFormSubmit () {
+        let fList = this.fileList
+        if (fList.length > 0) {
+          this.dataForm.attachList = []
+          for (let i = 0; i < fList.length; i++) {
+            this.dataForm.attachList.push({
+              fileName: fList[i].name,
+              url: fList[i].url
+            })
+          }
+        } else {
+          this.$message.error('请上传附件')
+          return
+        }
+        this.$refs['dataForm'].validate((valid) => {
+          if (valid) {
+            this.dataForm.detailId = this.id
+            this.visible = false
+            this.$emit('addItem', this.dataForm)
+          }
+        })
+      },
+      uploadSuccess (fileList) {
+        this.fileList = fileList
+      },
+      docChanged (item) {
+        if (!item) return
+        this.dataForm.technologyFile = item.label
+      }
+    }
+  }
+</script>
+
+<style scoped>
+
+</style>

+ 0 - 87
src/views/modules/warehouse/inventory-detail.vue

@@ -34,93 +34,6 @@
         <e-desc-item label="复核员">{{dataForm.dcheckerName}}</e-desc-item>
         <e-desc-item label="备注说明" span="3">{{dataForm.notes}}</e-desc-item>
       </e-desc>
-      <el-row style="margin-top: 20px">
-        <el-form :inline="true" :model="dataForm1" @keyup.enter.native="queryData()">
-          <el-form-item label="仓库名称" prop="warehouseId">
-            <warehouse-component v-model="dataForm1.warehouseId" :warehouse-id="dataForm1.warehouseId" @warehouseSelected="warehouseChanged"/>
-          </el-form-item>
-          <el-form-item label="货架名称" prop="shelveId">
-            <shelve-component ref="shelveCom" v-model="dataForm1.shelveId" :warehouse-id="dataForm1.warehouseId" :shelve-id="dataForm1.shelveId"/>
-          </el-form-item>
-          <el-form-item>
-            <el-button @click="queryData()">查询</el-button>
-          </el-form-item>
-        </el-form>
-        <el-table
-          :data="dataList"
-          border
-          v-loading="dataListLoading"
-          @selection-change="selectionChangeHandle"
-          style="width: 100%;">
-          <el-table-column
-            label="序号"
-            type="index"
-            width="50"
-            align="center">
-          </el-table-column>
-          <el-table-column
-            prop="warehouseName"
-            header-align="center"
-            align="center"
-            label="仓库名称">
-          </el-table-column>
-          <el-table-column
-            prop="materialName"
-            header-align="center"
-            align="center"
-            min-width="160"
-            label="物品名称">
-          </el-table-column>
-          <el-table-column
-            prop="specifications"
-            header-align="center"
-            align="center"
-            min-width="160"
-            label="规格">
-          </el-table-column>
-          <el-table-column
-            prop="unitName"
-            header-align="center"
-            align="center"
-            label="单位">
-          </el-table-column>
-          <el-table-column
-            prop="cnt"
-            header-align="center"
-            align="center"
-            label="仓库库存数量">
-          </el-table-column>
-          <el-table-column
-            prop="inventoryCnt"
-            header-align="center"
-            align="center"
-            label="数量">
-          </el-table-column>
-          <el-table-column
-            prop="inventoryState"
-            header-align="center"
-            align="center"
-            :formatter="formatState"
-            label="盘库状态">
-          </el-table-column>
-          <el-table-column
-            prop="materialState"
-            header-align="center"
-            align="center"
-            :formatter="formatMs"
-            label="物品状态">
-          </el-table-column>
-        </el-table>
-        <el-pagination
-          @size-change="sizeChangeHandle"
-          @current-change="currentChangeHandle"
-          :current-page="pageIndex"
-          :page-sizes="[10, 20, 50, 100]"
-          :page-size="pageSize"
-          :total="totalPage"
-          layout="total, sizes, prev, pager, next, jumper">
-        </el-pagination>
-      </el-row>
     </div>
     <span slot="footer" class="dialog-footer">
       <el-button @click="onChose">返回</el-button>

+ 24 - 2
src/views/modules/warehouse/inventory.vue

@@ -59,6 +59,19 @@
           :formatter="formatState"
           label="状态">
         </el-table-column>
+        <el-table-column
+          prop="approverState"
+          header-align="center"
+          align="center"
+          :formatter="formatApproveState"
+          label="审批状态">
+        </el-table-column>
+        <el-table-column
+          prop="approver"
+          header-align="center"
+          align="center"
+          label="当前处理人">
+        </el-table-column>
         <el-table-column
           prop="checkerName"
           header-align="center"
@@ -86,7 +99,7 @@
           width="100"
           label="操作">
           <template slot-scope="scope">
-            <el-button v-if="isAuth('wh:inventory:info') && Number(scope.row.state) === 1" type="text" size="small" @click="detailHandle(scope.row.inventoryId)">查看</el-button>
+            <el-button v-if="isAuth('wh:inventory:info')" type="text" size="small" @click="detailHandle(scope.row.inventoryId)">查看</el-button>
             <el-button v-if="isAuth('wh:inventory:start') && Number(scope.row.state) === 0" type="text" size="small" @click="addOrUpdateHandle(scope.row.inventoryId, false)">盘点</el-button>
           </template>
         </el-table-column>
@@ -138,10 +151,13 @@
             code: '1',
             value: '完成'
           }
-        ]
+        ],
+        // 审批状态:0 待提交 1 待审批 2 审批中 3 审批完成 4 审批不通过
+        optionsApproveState: []
       }
     },
     created () {
+      this.optionsApproveState = this.$store.state.common.approveStates
       this.getDataList()
     },
     methods: {
@@ -210,6 +226,12 @@
         const item1 = this.optionsState.find((item) => item.code === row.state.toString())
         return item1 ? item1.value : ''
       },
+      // 转换属性“审批状态”
+      formatApproveState (row) {
+        if (!row.approverState) return ''
+        const item1 = this.optionsApproveState.find((item) => item.code === row.approverState.toString())
+        return item1 ? item1.value : ''
+      },
       detailHandle (id) {
         this.detailVisible = true
         this.$nextTick(() => {

+ 14 - 2
src/views/modules/warehouse/stock-order-inbound.vue

@@ -21,7 +21,7 @@
               <el-col :span="8">
                 <el-form-item label="名称" prop="materialId" :rules="{required: false, message: '名称不能为空', trigger: 'blur'}">
                   <el-input v-if="item.buttonType === '1'" placeholder="请输入" v-model="item.materialName"
-                            :disabled="display" style="width: 200px; margin-right: 10px"/>
+                            :disabled="display" @blur="blurMaterialName(item)" style="width: 200px; margin-right: 10px"/>
                   <material-component v-else
                                       v-model="dataList[index]"
                                       :material-id="item.materialId">
@@ -125,7 +125,7 @@
 <script>
   import UserComponent from '../common/user-component'
   import DictSelect from '../sys/dict-select'
-  import { inboundBatch, getBoundDetails } from '@/api/warehouse'
+  import { inboundBatch, getBoundDetails, infoByNameAndCode } from '@/api/warehouse'
   import ConvertComponent from '../common/convert-component'
   import MaterialComponent from '../common/material-component'
   import MaterialTypeComponent from '../common/material-type-component'
@@ -245,6 +245,18 @@
         this.$nextTick(() => {
           this.$forceUpdate()
         })
+      },
+      // 检查物品是否重复
+      blurMaterialName (item) {
+        let params = {
+          materialName: item.materialName,
+          specifications: item.specifications
+        }
+        infoByNameAndCode(params).then(({data}) => {
+          if (data && data.code === '200' && data.data.length > 0) {
+            this.$message.error('库存内已有重名物品,请选择!')
+          }
+        })
       }
     }
   }