chris vor 1 Jahr
Ursprung
Commit
37c95703b9

+ 9 - 0
src/api/production.js

@@ -161,3 +161,12 @@ export function reSchedule (recordId) {
     method: 'get'
   })
 }
+
+// 核料
+export function updateCheck (data) {
+  return request({
+    url: request.adornUrl(`/biz-service/ProdProduction/updateCheck`),
+    method: 'post',
+    data
+  })
+}

+ 35 - 312
src/views/modules/production/scheduling-check.vue

@@ -6,286 +6,65 @@
         <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="materialId">
-                <material-component v-model="dataForm.materialId" :material-id="dataForm.materialId"/>
+              <el-form-item prop="materialId">
+                <label slot="label"><span style="color:red">*</span> 物品(零件)名称</label>
+                <material-component v-model="material" @materialSelected="materialSelected"/>
               </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 label="物品(零件)规格" prop="specifications">
+                <el-input v-model="specifications" placeholder="物品(零件)规格" disabled></el-input>
+              </el-form-item>
+            </el-col>
+            <el-col :span="8">
+              <el-form-item label="物品(零件)单位" prop="unitName">
+                <el-input v-model="unitName" placeholder="物品(零件)单位" disabled></el-input>
+              </el-form-item>
+            </el-col>
+            <el-col :span="8">
+              <el-form-item label="物品(零件)核定数量" prop="inventoryCnt">
+                <el-input-number v-model="dataForm.inventoryCnt" :step="1" :min="0" :max="Number(dataForm.cnt)"></el-input-number>
               </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'
+  import { updateCheck } from '@/api/production'
   import MaterialComponent from '@/views/modules/common/material-component'
 
 export default {
-    name: 'scheduling-outsource',
+    name: 'scheduling-check',
     components: {
-      MaterialComponent,
-      PreviewComponent,
-      ApproveComponent,
-      Add
+      MaterialComponent
     },
     data () {
       return {
         id: 0,
         dataForm: {},
+        material: {},
+        specifications: '',
+        unitName: '',
         dataRule: {
-          payType: [{ required: true, message: '请选择付款方式', trigger: 'change' }],
-          commissionType: [{ required: true, message: '请选择委外类别', trigger: 'change' }]
-        },
-        optionsType: [],
-        totalAmount: 0,
-        addProductVisible: false,
-        productDetails: [],
-        prodProductionIds: [], // 排产ID的集合
-        previewVisible: false
+          inventoryCnt: [{ required: true, message: '请输入核定数量', trigger: 'change' }]
+        }
       }
     },
     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
-          }
-        })
+      async init (scheduleId, materialId) {
+        this.dataForm.id = scheduleId || ''
+        this.dataForm.materialId = materialId || ''
       },
       validateField (type) {
         this.$refs.dataForm.validateField(type)
@@ -294,23 +73,11 @@ export default {
       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'}`
+            if (this.dataForm.materialId === '') {
+              this.$message.error('请选择物品!')
+              return
             }
-            // 产品明细
-            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}) => {
+            updateCheck(this.dataForm).then(({data}) => {
               if (data && data.code === '200') {
                 this.$message({
                   message: '操作成功',
@@ -328,55 +95,11 @@ export default {
           }
         })
       },
-      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), 1)
-        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, 1)
-        }
-        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)
-        })
+      materialSelected (item) {
+        this.unitName = item.unitName
+        this.specifications = item.specifications
+        this.dataForm.cnt = item.cnt
+        this.dataForm.materialId = item.materialId
       }
     }
   }

+ 105 - 0
src/views/modules/production/scheduling-pre-check.vue

@@ -0,0 +1,105 @@
+<!-- 试制前检查 -->
+<template>
+    <div>
+        <div class="my-title">试制前检查</div>
+        <!-- 表单 -->
+        <el-form :model="dataForm" :rules="dataRule" ref="dataForm" label-width="auto">
+          <el-row class="my-row">
+            <el-form-item>
+              <upload-component
+                :title="'试制前准备状态检查报告'"
+                :accept="'*'"
+                :file-obj-list="attachList"
+                @uploadSuccess="uploadSuccess1"
+              />
+            </el-form-item>
+          </el-row>
+          <el-row class="my-row">
+            <el-form-item>
+              <upload-component
+                :title="'试制前准备状态自查表'"
+                :accept="'*'"
+                :file-obj-list="attachListExamine"
+                @uploadSuccess="uploadSuccess2"
+              />
+            </el-form-item>
+          </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>
+    </div>
+</template>
+
+<script>
+  import { updateCheck } from '@/api/production'
+  import MaterialComponent from '@/views/modules/common/material-component'
+  import UploadComponent from '@/views/modules/common/upload-component-v2'
+
+export default {
+    name: 'scheduling-pre-check',
+    components: {
+      UploadComponent,
+      MaterialComponent
+    },
+    data () {
+      return {
+        id: 0,
+        dataForm: {},
+        attachList: [],
+        attachListExamine: [],
+        dataRule: {
+        }
+      }
+    },
+    methods: {
+      onChose () {
+        this.$emit('onChose')
+      },
+      async init (scheduleId, materialId) {
+        this.dataForm.id = scheduleId || ''
+        this.dataForm.materialId = materialId || ''
+      },
+      validateField (type) {
+        this.$refs.dataForm.validateField(type)
+      },
+      // 表单提交
+      dataFormSubmit () {
+        this.$refs['dataForm'].validate((valid) => {
+          if (valid) {
+            if (this.dataForm.materialId === '') {
+              this.$message.error('请选择物品!')
+              return
+            }
+            updateCheck(this.dataForm).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)
+              }
+            })
+          }
+        })
+      },
+      materialSelected (item) {
+        this.unitName = item.unitName
+        this.specifications = item.specifications
+        this.dataForm.cnt = item.cnt
+        this.dataForm.materialId = item.materialId
+      }
+    }
+  }
+</script>
+
+<style scoped>
+
+</style>

+ 14 - 34
src/views/modules/production/scheduling.vue

@@ -1,7 +1,7 @@
 <!-- 任务处理中心 -->
 <template>
   <div class="production">
-    <template v-if="!detailsVisible && !outsourceVisible">
+    <template v-if="!detailsVisible && !outsourceVisible && !checkVisible">
       <el-header style="font-size: large;text-align: center">任务处理中心</el-header>
       <el-table
         :data="dataList"
@@ -127,7 +127,7 @@
           width="280"
           label="操作">
           <template slot-scope="scope">
-            <el-button type="text" size="small" @click="check(scope.row.id)">核料</el-button>
+            <el-button type="text" size="small" @click="check(scope.row)">核料</el-button>
             <el-button type="text" size="small" @click="check(scope.row.id)">转采购</el-button>
             <el-button type="text" size="small" @click="check(scope.row.id)">转委外</el-button>
             <el-button type="text" size="small" @click="check(scope.row.id)">试制前检查</el-button>
@@ -150,20 +150,24 @@
     <detail v-if="detailsVisible" ref="details" @close="closeDialogEvent" @refreshDataList="getDataList" @onChose="onChose"/>
     <!-- 委外 -->
     <outsource v-if="outsourceVisible" ref="outsource" @refreshDataList="getDataList" @onChose="onChose"/>
+    <!-- 核料 -->
+    <scheduling-check v-if="checkVisible" ref="check" @refreshDataList="getDataList" @onChose="onChose"/>
   </div>
 </template>
 
 <script>
   import Detail from './scheduling-details'
   import Outsource from './scheduling-outsource'
-  import { getSchedulingList, batchPlan } from '@/api/production'
+  import { getSchedulingList } from '@/api/production'
+  import SchedulingCheck from '@/views/modules/production/scheduling-check'
   export default {
     name: 'scheduling',
-    components: {Detail, Outsource},
+    components: {SchedulingCheck, Detail, Outsource},
     data () {
       return {
         detailsVisible: false,
         outsourceVisible: false,
+        checkVisible: false,
         dataForm: {},
         dataList: [],
         pageIndex: 1,
@@ -231,28 +235,7 @@
       onChose () {
         this.detailsVisible = false
         this.outsourceVisible = false
-      },
-      handleSelectionChange (val) {
-        this.multipleSelection = val
-      },
-      // 批量排产
-      batchPlan () {
-        let ids = this.multipleSelection.map(item => item.id)
-        // eslint-disable-next-line standard/object-curly-even-spacing
-        batchPlan({ productionIds: ids}).then(({data}) => {
-          if (data && data.code === '200') {
-            this.$message({
-              type: 'success',
-              message: '批量排产成功!'
-            })
-            this.getDataList()
-          } else {
-            this.$message({
-              type: 'error',
-              message: data.msg
-            })
-          }
-        })
+        this.checkVisible = false
       },
       // 查询
       queryPage () {
@@ -264,9 +247,7 @@
         this.dataListLoading = true
         let params = {
           'current': this.pageIndex,
-          'size': this.pageSize,
-          'customerName': this.dataForm.customerName ? this.dataForm.customerName : null,
-          'orderCode': this.dataForm.orderCode ? this.dataForm.orderCode : null
+          'size': this.pageSize
         }
         getSchedulingList(params).then(({data}) => {
           if (data && data.code === '200') {
@@ -337,12 +318,11 @@
           this.$refs.outsource.init(id, ids)
         })
       },
-      // 批量委外生产
-      outsourceHandle2 () {
-        let ids = this.multipleSelection.map(item => item.id)
-        this.outsourceVisible = true
+      // 核料
+      check (row) {
+        this.checkVisible = true
         this.$nextTick(() => {
-          this.$refs.outsource.init(-1, ids)
+          this.$refs.check.init(row.id, row.materialId)
         })
       }
     }