Bläddra i källkod

Merge branch 'master' of http://120.46.159.163:7400/ezhizao/ezhizao_dms_vue

wangxin 1 år sedan
förälder
incheckning
73ed2be626

+ 8 - 0
src/api/business/p2.js

@@ -37,6 +37,14 @@ export function getP2NeedCheckProcess(type) {
     method: 'get'
   })
 }
+// 查询p2中计划单的单批重量
+export function getProductionLotAmount(data) {
+  return request({
+    url: baseUrl + '/business/sfc10500/getLotAmount',
+    method: 'get',
+    params: data
+  })
+}
 // 查询productionPlan详细
 export function getProductionPlan(id) {
   return request({

+ 81 - 248
src/views/business/daywork/index.vue

@@ -3,261 +3,99 @@
     <!-- 左侧区域 -->
     <section class="list-part-container" style="flex: 3">
       <!-- 搜索区 -->
-      <el-form
-        class="list-search-container"
-        :model="queryDayworkParams"
-        ref="queryRef"
-        :inline="true"
-        style="margin-right: 0px"
-      >
+      <el-form class="list-search-container" :model="queryDayworkParams" ref="queryRef" :inline="true"
+        style="margin-right: 0px">
         <el-form-item class="section-title" label="生产批次" />
         <el-form-item label="生产计划单号:">
-          <el-input
-            placeholder="请输入生产计划单号/批次号"
-            v-model.trim="queryDayworkParams.productionPlanNo"
-            @keydown.enter.prevent
-            clearable
-            style="width: 200px"
-          />
+          <el-input placeholder="请输入生产计划单号/批次号" v-model.trim="queryDayworkParams.productionPlanNo"
+            @keydown.enter.prevent clearable style="width: 200px" />
         </el-form-item>
         <el-form-item label="产品描述:">
-          <el-input
-            placeholder="请输入产品描述"
-            v-model.trim="queryDayworkParams.productDescription"
-            @keydown.enter.prevent
-            clearable
-            style="width: 130px"
-          />
+          <el-input placeholder="请输入产品描述" v-model.trim="queryDayworkParams.productDescription" @keydown.enter.prevent
+            clearable style="width: 130px" />
         </el-form-item>
         <el-form-item class="section-title" label="请选择当前工段:">
-          <el-select-v2
-            v-model="queryDayworkParams.deptId"
-            :options="deptList"
-            placeholder="请选择工段"
-            style="width: 140px"
-            @change="handleDeptChange"
-          />
+          <el-select-v2 v-model="queryDayworkParams.deptId" :options="deptList" placeholder="请选择工段" style="width: 140px"
+            @change="handleDeptChange" />
         </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>
       </el-form>
       <div class="el-table-container">
         <div class="el-table-inner-container">
-          <el-table
-            ref="dayworkTable"
-            :data="dayworkList"
-            v-loading="dayworkLoading"
-            highlight-current-row
-            height="100%"
-            @current-change="handleDayworkCurrentChange"
-          >
-            <el-table-column
-              label="客户简称"
-              prop="companyAlias"
-              width="120"
-              align="center"
-            />
-            <el-table-column
-              label="生产计划单号"
-              prop="productionPlanNo"
-              width="100"
-              align="center"
-            />
-            <el-table-column
-              label="批次号"
-              min-width="120"
-              prop="lotCode"
-              align="center"
-            >
+          <el-table ref="dayworkTable" :data="dayworkList" v-loading="dayworkLoading" highlight-current-row
+            height="100%" @current-change="handleDayworkCurrentChange">
+            <el-table-column label="客户简称" prop="companyAlias" width="120" align="center" />
+            <el-table-column label="生产计划单号" prop="productionPlanNo" width="100" align="center" />
+            <el-table-column label="批次号" min-width="120" prop="lotCode" align="center">
               <template #default="scope">
-                <el-button
-                  link
-                  type="primary"
-                  v-hasPermi="['business:productionPlan:query']"
-                  @click="handleColumnClick(scope.row)"
-                  ><span>{{ scope.row.lotCode }}</span></el-button
-                >
+                <el-button link type="primary" v-hasPermi="['business:productionPlan:query']"
+                  @click="handleColumnClick(scope.row)"><span>{{ scope.row.lotCode }}</span></el-button>
               </template>
             </el-table-column>
-            <el-table-column
-              label="产品描述"
-              prop="productDescription"
-              align="center"
-            />
-            <el-table-column
-              label="图纸版本"
-              prop="technologyVersion"
-              width="60"
-              align="center"
-            />
-            <el-table-column
-              label="投产量"
-              prop="productionQuantity"
-              width="60"
-              align="center"
-            />
-            <el-table-column
-              label="下达日期"
-              prop="createTime"
-              width="100"
-              align="center"
-            >
+            <el-table-column label="产品描述" prop="productDescription" align="center" />
+            <el-table-column label="图纸版本" prop="technologyVersion" width="60" align="center" />
+            <el-table-column label="投产量" prop="productionQuantity" width="60" align="center" />
+            <el-table-column label="下达日期" prop="createTime" width="100" align="center">
               <template #default="scope">
                 <span>{{
-                  proxy.moment(scope.row.createTime).format("YYYY-MM-DD")
-                }}</span>
+        proxy.moment(scope.row.createTime).format("YYYY-MM-DD")
+      }}</span>
               </template>
             </el-table-column>
-            <el-table-column
-              label="报工总时长"
-              prop="totalWorkingHours"
-              width="150"
-              align="center"
-            />
+            <el-table-column label="报工总时长" prop="totalWorkingHours" width="150" align="center" />
           </el-table>
         </div>
       </div>
       <!-- 分页 -->
-      <pagination
-        v-show="total > 0"
-        :total="total"
-        v-model:page="queryDayworkParams.pageNum"
-        v-model:limit="queryDayworkParams.pageSize"
-        @pagination="getDayworks"
-      />
+      <pagination v-show="total > 0" :total="total" v-model:page="queryDayworkParams.pageNum"
+        v-model:limit="queryDayworkParams.pageSize" @pagination="getDayworks" />
     </section>
     <!-- 右侧区域 -->
     <section class="list-part-container" style="flex: 2">
       <el-form class="list-search-container" :inline="true">
         <el-form-item class="section-title" label="报工信息" />
-        <el-form-item
-          class="section-title"
-          label="请选择工序:"
-          prop="processId"
-        >
-          <el-select-v2
-            v-model="queryItemParams.processId"
-            clearable
-            :options="processList"
-            placeholder="请选择工序"
-            style="width: 100%"
-            @change="handleProcessChange"
-          />
+        <el-form-item class="section-title" label="请选择工序:" prop="processId">
+          <el-select-v2 v-model="queryItemParams.processId" clearable :options="processList" placeholder="请选择工序"
+            style="width: 100%" @change="handleProcessChange" />
         </el-form-item>
       </el-form>
 
       <div class="el-table-container">
         <div class="el-table-inner-container">
-          <el-table
-            :data="dayworkItemList"
-            v-loading="dayworkItemLoading"
-            height="100%"
-          >
-            <el-table-column
-              label="操作者"
-              prop="nickName"
-              width="60"
-              align="center"
-            />
-            <el-table-column
-              label="工序名称"
-              prop="processAlias"
-              align="center"
-            />
-            <el-table-column
-              label="投产量"
-              prop="prodNum"
-              width="60"
-              align="center"
-            />
-            <el-table-column
-              label="合格数"
-              prop="qualifiedNum"
-              width="60"
-              align="center"
-            />
-            <el-table-column
-              label="废品数"
-              prop="rejectNum"
-              width="60"
-              align="center"
-            />
-            <el-table-column
-              label="开始时间"
-              prop="startTime"
-              width="160"
-              align="center"
-            />
-            <el-table-column
-              label="结束时间"
-              prop="endTime"
-              width="160"
-              align="center"
-            />
-            <el-table-column
-              label="总工时"
-              prop="workingHours"
-              width="160"
-              align="center"
-            />
-            <el-table-column
-              label="生产状态"
-              prop="status"
-              width="100"
-              align="center"
-            >
+          <el-table :data="dayworkItemList" v-loading="dayworkItemLoading" height="100%">
+            <el-table-column label="操作者" prop="nickName" width="60" align="center" />
+            <el-table-column label="工序名称" prop="processAlias" align="center" />
+            <el-table-column label="投产量" prop="prodNum" width="60" align="center" />
+            <el-table-column label="合格数" prop="qualifiedNum" width="60" align="center" />
+            <el-table-column label="废品数" prop="rejectNum" width="60" align="center" />
+            <el-table-column label="开始时间" prop="startTime" width="160" align="center" />
+            <el-table-column label="结束时间" prop="endTime" width="160" align="center" />
+            <el-table-column label="总工时" prop="workingHours" width="160" align="center" />
+            <el-table-column label="生产状态" prop="status" width="100" align="center">
               <template #default="scope">
                 <dict-tag :options="daywork_status" :value="scope.row.status" />
               </template>
             </el-table-column>
-            <el-table-column
-              fixed="right"
-              label="操作"
-              align="center"
-              width="140px"
-            >
+            <el-table-column fixed="right" label="操作" align="center" width="140px">
               <template #default="scope">
-                <el-button
-                  v-show="
-                    scope.row.deptProcessStatus &&
-                    (scope.row.status == 2 || scope.row.status == 3) &&
-                    scope.row.processId == latestProcessId
-                  "
-                  link
-                  type="warning"
-                  icon="Edit"
-                  @click="handleUpdateDayworkItem(scope.row)"
-                  >编辑
+                <el-button v-show="scope.row.deptProcessStatus &&
+        (scope.row.status == 2 || scope.row.status == 3) &&
+        scope.row.processId == latestProcessId
+        " link type="warning" icon="Edit" @click="handleUpdateDayworkItem(scope.row)">编辑
                 </el-button>
-                <el-button
-                  v-show="!(scope.row.deptProcessStatus &&
-                    (scope.row.status == 2 || scope.row.status == 3) &&
-                    scope.row.processId == latestProcessId)"
-                  link
-                  type="primary"
-                  icon="View"
-                  @click="handleCheckDayworkItem(scope.row)"
-                  >查看
-                </el-button>	
-                <el-button
-                  v-show="
-                    scope.row.deptProcessStatus &&
-                    (scope.row.status == 2 || scope.row.status == 3) &&
-                    scope.row.processId == latestProcessId
-                  "
-                  v-hasPermi="['business:daywork:remove']"
-                  link
-                  type="danger"
-                  icon="Delete"
-                  @click="handleDeletedItem(scope.row.id)"
-                  >删除
+                <el-button v-show="!(scope.row.deptProcessStatus &&
+        (scope.row.status == 2 || scope.row.status == 3) &&
+        scope.row.processId == latestProcessId)" link type="primary" icon="View"
+                  @click="handleCheckDayworkItem(scope.row)">查看
+                </el-button>
+                <el-button v-show="scope.row.deptProcessStatus &&
+        (scope.row.status == 2 || scope.row.status == 3) &&
+        scope.row.processId == latestProcessId
+        " v-hasPermi="['business:daywork:remove']" link type="danger" icon="Delete"
+                  @click="handleDeletedItem(scope.row.id)">删除
                 </el-button>
               </template>
             </el-table-column>
@@ -265,19 +103,11 @@
         </div>
       </div>
       <!-- 分页 -->
-      <pagination
-        v-show="itemTotal > 0"
-        :total="itemTotal"
-        v-model:page="queryItemParams.pageNum"
-        v-model:limit="queryItemParams.pageSize"
-        @pagination="getDayworkItems"
-      />
+      <pagination v-show="itemTotal > 0" :total="itemTotal" v-model:page="queryItemParams.pageNum"
+        v-model:limit="queryItemParams.pageSize" @pagination="getDayworkItems" />
     </section>
     <!-- 报工信息表单 -->
-    <daywork-item-form
-      ref="dayworkItemRef"
-      @handleSaveSuccess="handleGetDayworkItems"
-    />
+    <daywork-item-form ref="dayworkItemRef" @handleSaveSuccess="handleGetDayworkItems" />
   </div>
 </template>
 
@@ -434,25 +264,25 @@ function handleDeletedItem(id) {
   proxy.$modal
     .confirm("是否确认删除选中的数据项?")
     .then(function () {
-      delDayworkItem(id).then(res =>{
-    if(res.code == 200) {
-      proxy.$modal.msgSuccess("删除成功")
-      listDaywork(queryDayworkParams.value).then((res) => {
-    dayworkList.value = res.rows;
-    for (var i = 0; i < dayworkList.value.length; i++) {
-      let timeStamp = dayworkList.value[i].totalWorkingHours;
-      let seconds = Math.floor((timeStamp / 1000) % 60);
-      let minutes = Math.floor((timeStamp / (1000 * 60)) % 60);
-      let hours = Math.floor(timeStamp / (1000 * 60 * 60));
-      let time = `${hours}小时${minutes}分钟${seconds}秒`;
-      dayworkList.value[i].totalWorkingHours = time;
-    }
-    total.value = res.total;
-    // 批次
-      proxy.$refs.dayworkTable.setCurrentRow(dayworkList.value[dayworkList.value.findIndex(daywork => daywork.id== currentDaywork.value.id)]);
-  });
-    }
-  })
+      delDayworkItem(id).then(res => {
+        if (res.code == 200) {
+          proxy.$modal.msgSuccess("删除成功")
+          listDaywork(queryDayworkParams.value).then((res) => {
+            dayworkList.value = res.rows;
+            for (var i = 0; i < dayworkList.value.length; i++) {
+              let timeStamp = dayworkList.value[i].totalWorkingHours;
+              let seconds = Math.floor((timeStamp / 1000) % 60);
+              let minutes = Math.floor((timeStamp / (1000 * 60)) % 60);
+              let hours = Math.floor(timeStamp / (1000 * 60 * 60));
+              let time = `${hours}小时${minutes}分钟${seconds}秒`;
+              dayworkList.value[i].totalWorkingHours = time;
+            }
+            total.value = res.total;
+            // 批次
+            proxy.$refs.dayworkTable.setCurrentRow(dayworkList.value[dayworkList.value.findIndex(daywork => daywork.id == currentDaywork.value.id)]);
+          });
+        }
+      })
     })
 }
 //修改报工信息
@@ -556,9 +386,12 @@ function getDayworkItems() {
         }
       }
       //拿到最新一条报工信息的工序id,只能编辑当前序
-      if (res.rows[i] == res.rows[res.rows.length - 1]) {
-        latestProcessId.value = res.rows[i].processId;
-      }
+      // if (res.rows[i] == res.rows[res.rows.length - 1]) {
+      //   latestProcessId.value = res.rows[i].processId;
+      // }
+    }
+    if (res.others != null && res.others.latestProcessId != null) {
+      latestProcessId.value = latestProcessId
     }
     for (var i = 0; i < res.rows.length; i++) {
       let timeStamp = res.rows[i].workingHours;

+ 145 - 0
src/views/business/productionBatch/computedMaterialForm.vue

@@ -0,0 +1,145 @@
+<template>
+  <el-drawer
+    title="外协投产计算"
+    :with-header="false"
+    v-model="visible"
+    direction="rtl"
+    size="25%"
+  >
+    <div class="form-container column-container">
+      <div style="display: flex; justify-content: center; font-size: 28px">
+        外协投产计算
+      </div>
+      <el-form
+        ref="formRef"
+        class="master-container"
+        :model="form"
+        label-width="120px"
+      >
+        <el-row :gutter="20">
+          <el-col :span="18">
+            <el-form-item
+              label="领料量(KG)"
+              prop="materialpickUpQuantity"
+              label-width="100px"
+            >
+              <el-input-number
+                v-model="form.materialpickUpQuantity"
+                :min="0"
+                :precision="2"
+                controls-position="right"
+                style="width: 200px; margin-left: 30px"
+                @input="handleInputMaterialpickUpQuantity"
+              />
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row :gutter="20">
+          <el-col :span="18">
+            <el-form-item
+              label="单批量(KG)"
+              v-model="form.peqty"
+              prop="peqty"
+              label-width="100px"
+              style="margin-top: 30px"
+            >
+              <span style="margin-left: 40px">{{ form.peqty }}</span>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row :gutter="20">
+          <el-col :span="18">
+            <el-form-item
+              label="批数"
+              v-model="form.lotNumber"
+              prop="lotNumber"
+              label-width="100px"
+              style="margin-top: 30px"
+            >
+              <span style="margin-left: 50px">{{ form.lotNumber }}</span>
+            </el-form-item>
+          </el-col>
+        </el-row>
+      </el-form>
+      <div class="bottom-buttons">
+        <el-button size="large" style="width: 200px;height: 50px;" type="info"  @click="cancel">取 消</el-button>
+      <el-button size="large" style="width: 200px;height: 50px;" type="primary"  @click="handleInputLotNumber"
+        >填入</el-button
+      >
+    </div>
+    </div>
+  </el-drawer>
+</template>
+<script setup>
+import {getProductionLotAmount} from "@/api/business/p2.js"
+const { proxy } = getCurrentInstance();
+/** 父组件传参 */
+const props = defineProps({
+  singleSelected: {
+    type: Function,
+    default: null,
+  },
+});
+
+const { singleSelected } = toRefs(props);
+/** 字典数组区 */
+/** 表单抽屉 页变量 */
+const form = ref({});
+const visible = ref(false);
+const detailInfo = ref({})
+
+/***********************  方法区  ****************************/
+/** 打开抽屉 */
+function open(data) {
+  reset();
+  detailInfo.value = proxy.deepClone(data);
+  getProductionLotAmount({lotno:detailInfo.value.productionPlanNo,lotseq:detailInfo.value.lineNumber}).then(res =>{
+    if(res.code == 200) {
+      form.value.peqty = res.data[0].peqty
+       visible.value = true;
+    }
+  }
+)
+ 
+}
+
+/** 取消按钮 */
+function cancel() {
+  visible.value = false;
+  reset();
+}
+
+/** 表单重置 */
+function reset() {
+  form.value = {
+    lotNumber: 0,
+    materialpickUpQuantity:0
+  };
+  proxy.resetForm("formRef");
+}
+//填写领料量
+function handleInputMaterialpickUpQuantity(data) {
+   form.value.lotNumber = Math.ceil(data / form.value.peqty);
+}
+
+// 投产批数带回
+function handleInputLotNumber(){
+  singleSelected.value(form.value.lotNumber)
+  visible.value = false
+};
+
+/** 暴露给父组件的方法 */
+defineExpose({
+  open,
+});
+</script>
+<style scoped>
+.bottom-buttons {
+  position: absolute;
+  bottom: 0; /* 定位到页面底部 */
+  left: 50%; /* 向左移动50% */
+  transform: translateX(-50%); /* 向左移动自身宽度的50%,实现居中 */
+  text-align: center; /* 使按钮水平居中 */
+  width: 100%; /* 宽度设为100% */
+}
+</style>

+ 13 - 1
src/views/business/productionBatch/form.vue

@@ -29,6 +29,8 @@
                 @input="handleUpdateLotNumber"
                 :min="0"
               />
+              <el-button style="margin-left: 10px;" type="primary" @click="handleComputedMaterial"
+        >外协投料计算</el-button>
             </el-form-item>
             <el-form-item label="下达日期" prop="issuanceDate">
               <el-date-picker
@@ -77,6 +79,8 @@
           </el-col>
         </el-row>
       </el-form>
+      <!-- 计算外协领料 -->
+      <form-computed-material ref="formComputedMaterialRef" :single-selected="handleInputLotNumber"/>
     </div>
     <template #footer>
       <el-button type="primary" icon="Check" @click="handleSave"
@@ -92,7 +96,7 @@ import {
   getLastLotStatus,
 } from "@/api/business/planDetailSubDetail.js";
 import { updateLotCodeStatus } from "@/api/business/productionPlanDetail.js";
-
+import formComputedMaterial from "./computedMaterialForm.vue"
 const { proxy } = getCurrentInstance();
 const emit = defineEmits(["handleSaveSuccess"]);
 
@@ -307,6 +311,10 @@ function handleUpdateLotNumber(data) {
     }
   }
 }
+function handleInputLotNumber(data) {
+  form.value.lotNumber = data
+  handleUpdateLotNumber(data)
+}
 //当尾批switch状态改变时
 function handleUpdateLastLotStatus() {
   handleUpdateLotNumber(form.value.lotNumber);
@@ -334,6 +342,10 @@ function handleSave() {
     }
   });
 }
+//外协投料计算
+function handleComputedMaterial() {
+  proxy.$refs.formComputedMaterialRef.open(detailsRow.value);
+}
 /** 取消按钮 */
 function handleCancel() {
   visible.value = false;

+ 1 - 0
src/views/business/productionBatch/index.vue

@@ -469,6 +469,7 @@ function handleAddSubDetail(row) {
   newDetail.productionPlanId = row.productionPlanId;
   newDetail.productionPlanDetailId = row.id;
   newDetail.productionPlanNo = row.productionPlanNo;
+  newDetail.lineNumber = row.lineNumber
   //生产计划总投产量
   newDetail.productionQuantityTotal = row.productionQuantity;
   newDetail.productId = row.productId;