Răsfoiți Sursa

生产子计划调整

zhuangdezheng 1 an în urmă
părinte
comite
09894bb4c9

+ 2 - 2
src/api/business/planDetailSubDetail.js

@@ -31,7 +31,7 @@ export function getDept() {
 // 新增生产子计划明细
 export function savePlanDetailSubDetail(data) {
   return request({
-    url: baseUrl + '/business/planDetailSubDetail',
+    url: baseUrl + '/business/planDetailSubDetail/save',
     method: 'post',
     data: data
   })
@@ -40,7 +40,7 @@ export function savePlanDetailSubDetail(data) {
 // 修改生产子计划明细
 export function updatePlanDetailSubDetail(data) {
   return request({
-    url: baseUrl + '/business/planDetailSubDetail',
+    url: baseUrl + '/business/planDetailSubDetail/save',
     method: 'put',
     data: data
   })

+ 31 - 27
src/views/business/productionBatch/form.vue

@@ -5,8 +5,8 @@
       <el-form ref="productRef" class="master-container" :model="form" :rules="rules" label-width="120px">
         <el-row>
           <el-col :span="12">
-            <el-form-item label="生产计划单号" prop="productionPlanNo">
-              <span>{{ form.productionPlanNo }}</span>
+            <el-form-item label="生产计划单号">
+              <span>{{ detailsRow.productionPlanNo }}</span>
             </el-form-item>
             <el-form-item label="当前投产批数" prop="lotNumber">
               <el-input-number v-model="form.lotNumber" controls-position="right" style="width: 150px" />
@@ -24,10 +24,10 @@
           </el-col>
           <el-col :span="12">
             <el-form-item label="产品描述" prop="productDescription">
-              <span>{{ form.productDescription }}</span>
+              <span>{{ detailsRow.productDescription }}</span>
             </el-form-item>
-            <el-form-item label="当前投产量" prop="productionVolume">
-              <span>{{ form.productionVolume }}</span>
+            <el-form-item label="当前投产量" prop="productionQuantity">
+              <span>{{ form.productionQuantity }}</span>
             </el-form-item>
           </el-col>
         </el-row>
@@ -74,6 +74,23 @@ const data = reactive({
 })
 const { form, rules } = toRefs(data)
 /***********************  方法区  ****************************/
+/** 表单重置 */
+function reset() {
+  form.value = {
+    id: null,
+    productionPlanId: 0,
+    productionPlanDetailId: '0',
+    productionQuantity: 0,
+    productId: '0',
+    technologicalProcessId: '0',
+    technologyVersion: '',
+    lotNumber: 0,
+    issuanceDate: proxy.moment().format('YYYY-MM-DD'),
+    remark: null
+  }
+  proxy.resetForm('productRef')
+}
+
 /** 打开抽屉 */
 function open(row) {
   reset()
@@ -82,31 +99,18 @@ function open(row) {
 
   if (row) {
     detailsRow.value = row
-    form.value.lotNumber = row.totalLotNumber
-    if (!form.value.issuanceDate) {
-      form.value.issuanceDate = proxy.moment().format('YYYY-MM-DD')
-    }
+    form.value.productionPlanNo = row.productionPlanNo
+    form.value.productionPlanDetailId = row.productionPlanDetailId
+    form.value.productionQuantity = row.productionQuantity
+    form.value.productId = row.productId
+    form.value.deptId = row.deptId
+    form.value.technologicalProcessId = row.technologicalProcessId
+    form.value.technologyVersion = row.technologyVersion
+    form.value.lotNumber = row.lotNumber
   }
   loading.value = false
 }
 
-/** 表单重置 */
-function reset() {
-  form.value = {
-    id: null,
-    productionPlanId: null,
-    productionPlanDetailId: null,
-    productionQuantity: null,
-    productId: null,
-    technologicalProcessId: null,
-    technologyVersion: null,
-    lotNumber: null,
-    issuanceDate: null,
-    remark: null
-  }
-  proxy.resetForm('productRef')
-}
-
 /** 提交按钮 */
 function handleSave() {
   proxy.$refs['productRef'].validate((valid) => {
@@ -116,7 +120,7 @@ function handleSave() {
         if (res.code == 200) {
           proxy.$modal.msgSuccess('保存成功!')
           visible.value = false
-          detailsRow.value.id = detailsRow.value.productionPlanDetailId
+          //detailsRow.value.id = detailsRow.value.productionPlanDetailId
           emit('handleSaveSuccess')
         }
       })

+ 35 - 33
src/views/business/productionBatch/index.vue

@@ -90,7 +90,7 @@
               <el-table-column type="index" label="行号" width="50" align="center" />
               <el-table-column label="生产计划单号" prop="productionPlanNo" width="110" align="center" />
               <el-table-column label="产品描述" prop="productDescription" align="center" />
-              <el-table-column label="当前投产量" prop="productionVolume" width="80" align="center" />
+              <el-table-column label="当前投产量" prop="productionQuantity" width="80" align="center" />
               <el-table-column label="当前投产批数" prop="lotNumber" width="100" align="center">
                 <template #default="scope">
                   <el-input-number
@@ -121,10 +121,12 @@
               </el-table-column>
               <el-table-column label="操作" width="150" align="center">
                 <template #default="scope">
-                  <el-button v-if="!scope.row.editStatus" icon="edit" link type="warning" @click="handleEditSubDetail(scope.row)">编辑 </el-button>
+                  <el-button v-if="!scope.row.editStatus" icon="edit" link type="warning" @click="handleShowSubDetailDialog(scope.row)"
+                    >编辑
+                  </el-button>
                   <el-button v-if="!scope.row.editStatus" icon="delete" link type="danger" @click="handleDelSubDetail(scope.row)">删除 </el-button>
                   <el-button v-if="scope.row.editStatus" icon="Check" link type="success" @click="handleSaveSubDetail(scope.row)">确认 </el-button>
-                  <el-button v-if="scope.row.editStatus" icon="close" link type="info" @click="handleEditSubDetail(scope.row)">取消 </el-button>
+                  <el-button v-if="scope.row.editStatus" icon="close" link type="info" @click="handleShowSubDetailDialog(scope.row)">取消 </el-button>
                 </template>
               </el-table-column>
             </el-table>
@@ -150,7 +152,7 @@
         <el-form class="list-search-container" :inline="true">
           <el-form-item class="section-title" label="设置设备" />
           <el-form-item>
-            <el-button icon="Plus" type="primary" :disabled="!processRow.id" @click="openEquipment">选择设备</el-button>
+            <el-button icon="Plus" type="primary" :disabled="!currentProcess.id" @click="openEquipment">选择设备</el-button>
           </el-form-item>
         </el-form>
         <div class="el-table-container">
@@ -179,7 +181,7 @@
       </section>
     </section>
     <!-- 表单 -->
-    <production-lot-form ref="productionRef" @handlerSaveSuccess="handlePlanDetailCurrentChange" />
+    <production-lot-form ref="productionRef" @handleSaveSuccess="handlePlanDetailCurrentChange(currentPlanDetail)" />
     <equipment ref="equipmentRef" :get-list="handleProcessCurrentChange" :multipleSelected="equipmentSelected" :multiple="true" />
   </div>
 </template>
@@ -205,11 +207,14 @@ const deptList = ref([])
 const planDetailTable = ref(null)
 const subDetailsTable = ref(null)
 const processTable = ref(null)
+
 /**生产计划批次点击对象 */
-const detailRow = ref({})
+const currentPlanDetail = ref({})
+
 /**子计划点击对象 */
-const subRow = ref({})
-const processRow = ref({})
+const currentSubDetail = ref({})
+const currentProcess = ref({})
+
 const subDetailsLoading = ref(false)
 const equipmentLoading = ref(false)
 const detailPlanList = ref([])
@@ -283,7 +288,7 @@ function handleEquipmentSelectionChange(selection) {
 /** 生产计划明细 current-change 事件 */
 function handlePlanDetailCurrentChange(row) {
   if (row) {
-    detailRow.value = row
+    currentPlanDetail.value = row
     subDetailsLoading.value = true
     listPlanDetailSubDetail({
       productionPlanDetailId: row.id,
@@ -305,7 +310,7 @@ function handlePlanDetailCurrentChange(row) {
 /** 生产子计划 current-change 事件 */
 function handleSubDetailCurrentChange(row) {
   if (row) {
-    subRow.value = row
+    currentSubDetail.value = row
     listTechnologicalProcessDetail({ technologicalProcessId: row.technologicalProcessId }).then((res) => {
       processList.value = res.rows
       if (processList.value.length > 0) {
@@ -319,15 +324,15 @@ function handleSubDetailCurrentChange(row) {
 }
 /**工段下拉框change事件 */
 function handleDeptChange() {
-  handlePlanDetailCurrentChange(detailRow.value)
+  handlePlanDetailCurrentChange(currentPlanDetail.value)
 }
 /** 工序 current-change 事件 */
 function handleProcessCurrentChange(row) {
   if (row) {
-    processRow.value = row
+    currentProcess.value = row
     equipmentLoading.value = true
     listEquipment({
-      productionPlanDetailSubDetailId: subRow.value.id,
+      productionPlanDetailSubDetailId: currentSubDetail.value.id,
       technologicalProcessId: row.technologicalProcessId,
       processId: row.id
     }).then((res) => {
@@ -347,8 +352,8 @@ function openEquipment() {
   for (var i = 0; i < equipmentList.value.length; i++) {
     equipmentCodeIds.value.push(equipmentList.value[i].equipmentDetailCode)
   }
-  subRow.value.equipmentCodeIds = equipmentCodeIds.value
-  proxy.$refs.equipmentRef.open(subRow.value)
+  currentSubDetail.value.equipmentCodeIds = equipmentCodeIds.value
+  proxy.$refs.equipmentRef.open(currentSubDetail.value)
 }
 
 /**新增按钮生产子计划 */
@@ -362,19 +367,16 @@ function handleAddSubDetail(row) {
   newDetail.productId = row.productId
   newDetail.productDescription = row.productDescription
   newDetail.deptId = queryParams.value.deptId
-  newDetail.drawingNumber = row.drawingNumber
-  newDetail.totalLotNumber = row.totalLotNumber
+  newDetail.lotNumber = row.totalLotNumber
   newDetail.technologicalProcessId = row.technologicalProcessId
-  //给下达日期一个当前日期的默认值
-  const date = new Date()
-  newDetail.issuanceDate = date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate()
+  newDetail.technologyVersion = row.technologyVersion
 
   // 打开 生产子计划 对话框
-  handleEditSubDetail(newDetail)
+  handleShowSubDetailDialog(newDetail)
 }
 
 /** 修改 生产子计划 事件 */
-function handleEditSubDetail(row) {
+function handleShowSubDetailDialog(row) {
   proxy.$refs.productionRef.open(row)
 }
 
@@ -383,7 +385,7 @@ function handleSaveSubDetail(row) {
   savePlanDetailSubDetail(row).then((res) => {
     if (res.code == 200) {
       proxy.$modal.msgSuccess('保存成功!')
-      handlePlanDetailCurrentChange(detailRow.value)
+      handlePlanDetailCurrentChange(currentPlanDetail.value)
     }
   })
 }
@@ -397,7 +399,7 @@ function handleDelSubDetail(row) {
       return delPlanDetailSubDetail(_ids)
     })
     .then(() => {
-      handlePlanDetailCurrentChange(detailRow.value)
+      handlePlanDetailCurrentChange(currentPlanDetail.value)
 
       proxy.$modal.msgSuccess('删除成功!')
     })
@@ -413,7 +415,7 @@ function handleEquipmentDelete(row) {
       return delEquipment(_ids)
     })
     .then(() => {
-      handleProcessCurrentChange(processRow.value)
+      handleProcessCurrentChange(currentProcess.value)
       proxy.$modal.msgSuccess('删除成功!')
     })
     .catch(() => {})
@@ -422,21 +424,21 @@ function equipmentSelected(selection) {
   const equipment = []
   for (let i = 0; i < selection.length; i++) {
     const item = {}
-    item.productionPlanId = detailRow.value.productionPlanId
-    item.productionPlanDetailId = detailRow.value.id
-    item.productionPlanDetailSubDetailId = subRow.value.id
-    item.productId = subRow.value.productId
-    item.technologicalProcessId = subRow.value.technologicalProcessId
-    item.processId = processRow.value.id
+    item.productionPlanId = currentPlanDetail.value.productionPlanId
+    item.productionPlanDetailId = currentPlanDetail.value.id
+    item.productionPlanDetailSubDetailId = currentSubDetail.value.id
+    item.productId = currentSubDetail.value.productId
+    item.technologicalProcessId = currentSubDetail.value.technologicalProcessId
+    item.processId = currentProcess.value.id
     item.equipmentDetailId = selection[i].id
     item.equipmentDetailCode = selection[i].equipmentCode
-    item.deptId = subRow.value.deptId
+    item.deptId = currentSubDetail.value.deptId
     equipment.push(item)
   }
   saveBatchEquipment(equipment).then((res) => {
     if (res.code == 200) {
       proxy.$modal.msgSuccess('保存成功!')
-      handleProcessCurrentChange(processRow.value)
+      handleProcessCurrentChange(currentProcess.value)
     }
   })
 }