guoyujia 1 year ago
parent
commit
53a34ece79

+ 41 - 26
src/views/business/daywork/index.vue

@@ -42,7 +42,11 @@
           />
         </el-form-item>
         <el-form-item style="margin-left: 0">
-          <el-button type="info" icon="Search" :disabled="deptList.length === 0" @click="handleQuery"
+          <el-button
+            type="info"
+            icon="Search"
+            :disabled="deptList.length === 0"
+            @click="handleQuery"
             >搜索
           </el-button>
         </el-form-item>
@@ -222,7 +226,8 @@
                 <el-button
                   v-if="
                     scope.row.deptProcessStatus &&
-                    (scope.row.status == 2 || scope.row.status == 3)
+                    (scope.row.status == 2 || scope.row.status == 3) &&
+                    scope.row.processId == latestProcessId
                   "
                   link
                   type="warning"
@@ -230,7 +235,7 @@
                   @click="handleUpdateDayworkItem(scope.row)"
                   >编辑</el-button
                 >
-                <el-button v-model="flag"
+                <el-button
                   v-else
                   link
                   type="primary"
@@ -252,7 +257,7 @@
         @pagination="getDayworkItems"
       />
     </section>
-    <dayworkItem-form
+    <daywork-item-form
       ref="dayworkItemRef"
       @handleSaveSuccess="handleGetDayworkItems"
     />
@@ -268,7 +273,6 @@ import {
 import { listDeptProcess } from "@/api/business/deptProcess";
 import { getDept } from "@/api/business/planDetailSubDetail.js";
 import dayworkItemForm from "./form";
-import { get } from "@vueuse/core";
 const { proxy } = getCurrentInstance();
 
 /** 字典 */
@@ -276,20 +280,19 @@ const { daywork_status } = proxy.useDict("daywork_status");
 
 /** daywork 列表 */
 const dayworkList = ref([]);
-const dayworkItemList = ref([]);
 const dayworkTable = ref(null);
 const deptList = ref([]);
-
-/** daywork 批次 */
 const currentDaywork = ref({});
 const dayworkLoading = ref(false);
-const loading = ref(false);
+const total = ref(0);
+/** daywork 批次 */
+const dayworkItemList = ref([]);
 const dayworkItemLoading = ref(false);
 const processList = ref([]);
 const deptProcessList = ref([]);
-const total = ref(0);
 const itemTotal = ref(0);
 const flag = ref(false);
+const latestProcessId = ref(null);
 
 /** 查询对象 */
 const queryDayworkParams = ref({
@@ -309,7 +312,6 @@ const queryItemParams = ref({
 /***********************  方法区  ****************************/
 
 function getList() {
-  loading.value = true;
   getDept().then((response) => {
     deptList.value = response.data;
     if (deptList.value.length > 0) {
@@ -319,7 +321,6 @@ function getList() {
       dayworkList.value = [];
     }
   });
-  loading.value = false;
 }
 /** 查询计划明细 */
 function getDayworks() {
@@ -375,21 +376,27 @@ function handleDeptChange() {
 //修改
 function handleUpdateDayworkItem(row) {
   //同工序下状态是否有工序已完成
-  let processFinish = false
+  let processFinish = false;
   //除了编辑此条以外的同工序合格数
   let totalQuailifiedNum = 0;
   for (let i = 0; i < dayworkItemList.value.length; i++) {
-    if (row.processId == dayworkItemList.value[i].processId &&(dayworkItemList.value[i].status == 2 ||dayworkItemList.value[i].status == 3) 
-    &&row.id != dayworkItemList.value[i].id) {
+    if (
+      row.processId == dayworkItemList.value[i].processId &&
+      (dayworkItemList.value[i].status == 2 ||
+        dayworkItemList.value[i].status == 3) &&
+      row.id != dayworkItemList.value[i].id
+    ) {
       totalQuailifiedNum += dayworkItemList.value[i].qualifiedNum;
     }
-    if(row.processId == dayworkItemList.value[i].processId && dayworkItemList.value[i].status == 3&&row.id != dayworkItemList.value[i].id) {
-      processFinish = true 
+    if (
+      row.processId == dayworkItemList.value[i].processId &&
+      dayworkItemList.value[i].status == 3 &&
+      row.id != dayworkItemList.value[i].id
+    ) {
+      processFinish = true;
     }
   }
-  let maxQuailifiedNum = Math.floor(
-    row.prodNum * 1.03 - totalQuailifiedNum
-  );
+  let maxQuailifiedNum = Math.floor(row.prodNum * 1.03 - totalQuailifiedNum);
   //该daywork合格数总数不能超过投产数的103%
   row.technologicalProcessId = queryItemParams.value.technologicalProcessId;
   row.deptId = queryDayworkParams.value.deptId;
@@ -425,9 +432,14 @@ function handleCheckDayworkItem(row) {
   }
   //修改向form表单传一个状态值
   row.editStatus = false;
+  // row.returnFlag = false;
+  // //如果是最新工序的已接收,则传一个状态值,给form表单一个退回按钮
+  // if (row.processId == latestProcessId.value && row.status == 7) {
+  //   row.returnFlag = true;
+  // }
   proxy.$refs.dayworkItemRef.open(row);
 }
-
+/**切换工序 */
 function handleProcessChange() {
   getDayworkItems();
 }
@@ -435,6 +447,7 @@ function handleProcessChange() {
 /** 查询报工详情列表 */
 function getDayworkItems() {
   dayworkItemLoading.value = true;
+  //查询该工段在工段资源分配时绑定的工序
   listDeptProcess({ deptId: queryDayworkParams.value.deptId, flag: 1 }).then(
     (res) => {
       deptProcessList.value = res.rows;
@@ -445,6 +458,10 @@ function getDayworkItems() {
       if (res.rows[i].prodNum == 0) {
         res.rows[i].prodNum = currentDaywork.value.oneLotQuantity;
       }
+      //拿到最新一条报工信息的工序id,只能编辑当前序
+      if (res.rows[i] == res.rows[res.rows.length - 1]) {
+        latestProcessId.value = res.rows[i].processId;
+      }
     }
     for (var i = 0; i < res.rows.length; i++) {
       let timeStamp = res.rows[i].workingHours;
@@ -454,16 +471,15 @@ function getDayworkItems() {
       let time = `${hours}小时${minutes}分钟${seconds}秒`;
       res.rows[i].workingHours = time;
       res.rows[i].deptProcessStatus = false;
+      //报工记录的工序id是该工段绑定的工序时,允许编辑
       for (var item = 0; item < deptProcessList.value.length; item++) {
-        if (
-          res.rows[i].processId ==
-          deptProcessList.value[item].processId
-        ) {
+        if (res.rows[i].processId == deptProcessList.value[item].processId) {
           res.rows[i].deptProcessStatus = true;
         }
       }
     }
     dayworkItemList.value = res.rows;
+    //工序下拉框
     getProcessList({
       technologicalProcessId: queryItemParams.value.technologicalProcessId,
     }).then((res) => {
@@ -475,7 +491,6 @@ function getDayworkItems() {
 }
 /** 搜索按钮操作 */
 function handleQuery() {
-  //queryDayworkParams.value.pageNum = 1
   getDayworks();
 }
 

+ 5 - 9
src/views/business/resourcePlan/form.vue

@@ -15,7 +15,7 @@
       </el-form>
   
       <el-table ref="dialogTable" :data="subDetailList" :row-key="getRowKey" size="small" v-loading="loading" border height="360px" header-row-class-name="list-header-row" row-class-name="list-row" @selection-change="handleSelectionChange">
-        <el-table-column type="selection" width="40" align="center" :reserve-selection="true" :selectable="(row) => !planDetailIds.includes(row.id)"/>
+        <el-table-column type="selection" width="40" align="center" :reserve-selection="true" />
         <el-table-column type="index" label="行号" width="50" align="center" />
         <el-table-column label="生产计划单号" prop="productionPlanNo" width="110" align="center" />
         <el-table-column label="序号" width="60" prop="lineNumber" align="center" />
@@ -36,7 +36,7 @@
       <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
       <template #footer>
         <div class="dialog-footer">
-          <el-button type="primary" icon="Check" :disabled="selections.length === 0" @click="handleMultipleSelected">确定</el-button>
+          <el-button type="primary" icon="Check" :disabled="selections.length == 0" @click="handleMultipleSelected">确定</el-button>
           <el-button icon="Close" @click="close">取 消</el-button>
         </div>
       </template>
@@ -84,12 +84,6 @@
   function getRowKey(row) {
     return row.id
   }
-  function getPendingLots(row) {
-    if(row.lotTotalNumber) {
-      row.lotTotalNumber = 0
-    }
-    return (row.totalLotNumber - row.lotTotalNumber) > 0 ? (row.totalLotNumber - row.lotTotalNumber) : 0;
-    };
   
   /**
    * 对话框打开 事件
@@ -100,8 +94,9 @@
     if(row) {
       planDetailIds.value = row.planDetailIds
       queryParams.value.deptId = row.deptId
+      queryParams.value.resourceGroupId = row.resourceGroupId
+      getList()
     }
-    getList()
   }
   
   /**
@@ -110,6 +105,7 @@
   function close() {
     proxy.$refs.dialogForm.resetFields()
     proxy.$refs.dialogTable.clearSelection()
+    total.value = 0
     visible.value = false
   }
   /**

+ 5 - 6
src/views/business/resourcePlan/index.vue

@@ -104,7 +104,6 @@ const planDetailList = ref([])
 const planDetailLoading = ref(false)
 const planDetailIds = ref([])
 const currentResourceGroup = ref({})
-const total = ref(0)
 const itemTotal = ref(0)
 /**当前工段列表 */
 const deptList = ref([])
@@ -141,6 +140,7 @@ function getList() {
   })
   loading.value = false
 }
+/**选择工段 */
 function handleChangeDeptId(row) {
   queryParams.value.deptId = row
   getResourceGroup()
@@ -168,9 +168,11 @@ const getPlanDetail = () => {
   })
 }
 
+/**查询生产计划 */
 function handleQueryPlanDetails () {
   getPlanDetail()
 }
+/**查询资源组 */
 function handleQuery() {
   getResourceGroup()
 }
@@ -189,18 +191,15 @@ function handleResourceGroupCurrentChange(row) {
 /** 新增生产子计划 */
 function handleOpenPlanDetailDialog() {
   var info = {}
-  info.planDetailIds = []
+  info.resourceGroupId = currentResourceGroup.value.id
   info.deptId = queryParams.value.deptId
-  planDetailList.value.map((item) => {
-    info.planDetailIds.push(item.productionPlanDetailId)
-  })
   proxy.$refs.planDetailRef.open(info)
 }
 /** 生产计划批量删除*/
   function handleSelectionChange(selection) {
   planDetailIds.value = selection.map((item) => item.id)
 }
-
+/**多选删除生产计划 */
   function handleDeletePlanDetail() {
     delResourcePlan(planDetailIds.value).then((res) => {
     if (res.code === 200) {