695593266@qq.com 5 дней назад
Родитель
Сommit
11f5bcf87c

+ 23 - 0
src/api/beEntrusted/index.js

@@ -78,6 +78,17 @@ export async function getFactoryList(params) {
   return Promise.reject(new Error(res.data.message));
 }
 
+// 根据工艺路线id获取首工序对应的班组列表
+export async function listFirstTaskTeam(routingId) {
+  const res = await request.get(
+    `/main/factoryworkstation/listFirstTaskTeam/${routingId}`
+  );
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
 // 根据产品查询bom类型
 export async function listBomType(params) {
   const res = await request.get(`/main/bomCategory/listBomType`, { params });
@@ -214,6 +225,18 @@ export async function createProductionOrder(data) {
   return Promise.reject(new Error(res.data.message));
 }
 
+//批量受托转生产计划
+export async function transferProductionPlan(data) {
+  const res = await request.post(
+    `/mes/please_entrust_management/transferProductionPlan`,
+    data
+  );
+  if (res.data.code == 0) {
+    return res.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
 //驳回收货
 export async function rejectGoods(data) {
   const res = await request.post(

+ 9 - 0
src/api/mainData/index.js

@@ -139,6 +139,15 @@ export async function checkAssignConfirm(params) {
   return Promise.reject(new Error(res.data.message));
 }
 
+// 检查派单布点是否冲突
+export async function checkAssignSourceType(data) {
+  const res = await request.post('/aps/assign/checkAssignSourceType', data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
 // 获取工序的工作中心和班组列表
 export async function listByRoutingIds(data) {
   const res = await request.post(

+ 74 - 3
src/views/beEntrusted/components/create-order.vue

@@ -165,6 +165,28 @@
             </el-form-item>
           </el-col>
 
+          <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
+            <el-form-item label="首工序班组:" prop="teamId">
+              <el-select
+                style="width: 100%"
+                v-model="form.teamId"
+                placeholder="请选择首工序班组"
+                clearable
+                filterable
+                :disabled="!form.produceRoutingId"
+                :loading="firstTaskTeamLoading"
+                @change="teamChange"
+              >
+                <el-option
+                  v-for="item in firstTaskTeamList"
+                  :key="item.id"
+                  :label="item.name"
+                  :value="item.id"
+                />
+              </el-select>
+            </el-form-item>
+          </el-col>
+
           <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
             <el-form-item label="紧急程度:">
               <el-select
@@ -210,7 +232,11 @@
 
 <script>
   import ProcessRoute from '@/components/selectionDialog/processRoute.vue';
-  import { getFactoryList, createProductionOrder } from '@/api/beEntrusted';
+  import {
+    getFactoryList,
+    createProductionOrder,
+    listFirstTaskTeam
+  } from '@/api/beEntrusted';
   import { getByCode } from '@/api/system/dictionary-data';
   import { routeList } from '@/api/aps';
   import dayjs from 'dayjs';
@@ -251,6 +277,8 @@
           brandNo: '',
           produceRoutingId: '',
           produceRoutingName: '',
+          teamId: '',
+          teamName: '',
           sourceId: '',
           sourceCode: '',
           priority: '',
@@ -261,6 +289,9 @@
         rules: {
           produceRoutingName: [
             { required: true, message: '请选择工艺路线', trigger: 'change' }
+          ],
+          teamId: [
+            { required: true, message: '请选择首工序班组', trigger: 'change' }
           ]
         },
 
@@ -277,6 +308,8 @@
 
         routingList: [],
         factoryList: [],
+        firstTaskTeamList: [],
+        firstTaskTeamLoading: false,
 
         title: '受托转生产订单',
         pickerOptions: {
@@ -393,6 +426,8 @@
         row[0].bomType = '';
         row[0].produceRoutingId = '';
         row[0].produceRoutingName = '';
+        row[0].teamId = '';
+        row[0].teamName = '';
 
         this.form = this.deepCopy(row[0]);
         this.form.productCode = this.form.categoryCode;
@@ -400,7 +435,6 @@
         this.form.model = this.form.modelType;
         this.form.brandNo = this.form.brandNum;
         this.form.contractNum = this.form.totalCount;
-        this.form.measuringUnit = this.form.measuringUnit;
         this.form.sourceCode = this.form.code;
         this.form.sourceId = this.form.id;
         this.form.formingWeight = this.form.totalWeight;
@@ -452,10 +486,13 @@
           brandNo: '',
           produceRoutingId: '',
           produceRoutingName: '',
+          teamId: '',
+          teamName: '',
           sourceId: '',
           sourceCode: '',
           priority: ''
         };
+        this.firstTaskTeamList = [];
         this.$refs.form.clearValidate();
         this.visible = false;
       },
@@ -475,10 +512,14 @@
           //   (item) => item.id === this.form.produceRoutingId
           // )?.name;
 
-          this.form.planDeliveryTime = this.form.planDeliveryTime.split(' ')[0];
+          this.form.planDeliveryTime = this.form.planDeliveryTime
+            ? String(this.form.planDeliveryTime).split(' ')[0]
+            : '';
 
           let params = {
             ...this.form,
+            teamId: this.form.teamId,
+            teamName: this.form.teamName,
             sourceType: 3
           };
 
@@ -511,10 +552,40 @@
         this.$refs.processRouteRef.open();
       },
 
+      async getFirstTaskTeamList(routingId) {
+        this.firstTaskTeamLoading = true;
+        try {
+          const list = await listFirstTaskTeam(routingId);
+          if (String(this.form.produceRoutingId) !== String(routingId)) {
+            return;
+          }
+          this.firstTaskTeamList = Array.isArray(list) ? list : [];
+          if (!this.firstTaskTeamList.length) {
+            this.$message.warning('当前工艺路线未配置首工序班组');
+          }
+        } catch (err) {
+          this.firstTaskTeamList = [];
+          // this.$message.error(err.message);
+        } finally {
+          this.firstTaskTeamLoading = false;
+        }
+      },
+
+      teamChange(teamId) {
+        const team = this.firstTaskTeamList.find(
+          (item) => String(item.id) === String(teamId)
+        );
+        this.form.teamName = team ? team.name : '';
+      },
+
       // 选择工艺路线
       changeParent(item) {
         this.form.produceRoutingName = item.name;
         this.form.produceRoutingId = item.id;
+        this.form.teamId = '';
+        this.form.teamName = '';
+        this.firstTaskTeamList = [];
+        this.getFirstTaskTeamList(item.id);
 
         this.$nextTick(() => {
           this.$refs.form.clearValidate('produceRoutingName');

+ 51 - 22
src/views/beEntrusted/index.vue

@@ -5,10 +5,13 @@
       <seek-page :seekList="seekList" @search="search"></seek-page>
 
       <div class="btn_box">
-        <el-button type="primary" @click="salesToProductionOpen(2)"
+        <!-- <el-button type="primary" @click="salesToProductionOpen(2)"
           >转生产订单</el-button
-        ></div
-      >
+        > -->
+        <el-button type="primary" @click="salesToProductionOpen(1)"
+          >转生产计划</el-button
+        >
+      </div>
 
       <el-tabs v-model="tabValue" type="card" @tab-click="handleTabClick">
         <el-tab-pane label="受托任务" name="1"></el-tab-pane>
@@ -47,6 +50,9 @@
           <el-tag v-else-if="row.changeType == 2" type="success"
             >已转生产工单</el-tag
           >
+          <el-tag v-else-if="row.changeType == 3" type="success"
+            >已转生产计划</el-tag
+          >
         </template>
 
         <template v-slot:status="{ row }">
@@ -143,7 +149,6 @@
       </ele-pro-table>
     </el-card>
     <Create ref="create" @refresh="reload" />
-    <SalesToProduction ref="salesToProductionRef" @success="reload" />
     <ele-modal
       :visible.sync="visible"
       width="20vw"
@@ -177,9 +182,13 @@
   import OrderSearch from '@/views/entrust/components/order-search.vue';
   import dictMixins from '@/mixins/dictMixins';
   import Create from '@/views/entrust/components/create';
-  import SalesToProduction from './components/salesToProduction.vue';
   import createOrder from './components/create-order.vue';
-  import { getList, warehouseEntry, update } from '@/api/beEntrusted/index';
+  import {
+    getList,
+    warehouseEntry,
+    update,
+    transferProductionPlan
+  } from '@/api/beEntrusted/index';
   import goodsDetail from './components/goodsDetail.vue';
   import warehouseDefinition from '@/api/warehouseManagement/warehouseDefinition';
   import { getByCode } from '@/api/system/dictionary-data';
@@ -193,7 +202,6 @@
     components: {
       OrderSearch,
       Create,
-      SalesToProduction,
       createOrder,
       goodsDetail
     },
@@ -552,36 +560,57 @@
 
         this.factoryList = list || [];
       },
-      salesToProductionOpen(type) {
+      async salesToProductionOpen(type) {
+        const actionText = type == 1 ? '转生产计划' : '转生产订单';
         if (this.selection.length == 0) {
           return this.$message.warning('请选择一条数据');
         }
 
-        if (this.selection.length > 1) {
+        if (type == 2 && this.selection.length > 1) {
           return this.$message.warning('只能选择一条数据');
         }
 
-        if (
-          this.selection[0].approvalStatus == 2 &&
-          this.selection[0].sendStatus != 2
-        ) {
-          return this.$message.warning('请先收货再转生产订单');
+        const unreceived = this.selection.find(
+          (item) => item.approvalStatus == 2 && item.sendStatus != 2
+        );
+        if (unreceived) {
+          return this.$message.warning(`请先收货再${actionText}`);
         }
 
-        if (
-          this.selection[0].changeType == 1 ||
-          this.selection[0].changeType == 2
-        ) {
+        const converted = this.selection.find(
+          (item) => item.changeType == 1 || item.changeType == 2
+        );
+        if (converted) {
           return this.$message.warning('该工单已转换,不能重复转换');
         }
+
         if (type == 2) {
           this.$refs.createOrderRef.open(this.selection);
+          return;
         }
 
-        // if (type == 1) {
-        //   this.$refs.productionPlanRef.open();
-        // }
-        // this.$refs.salesToProductionRef.open(this.selection, type);
+        const ids = this.selection.map((item) => item.id);
+        try {
+          await this.$confirm(
+            `确认将已勾选的 ${ids.length} 条数据转为生产计划吗?`,
+            '提示',
+            {
+              confirmButtonText: '确定',
+              cancelButtonText: '取消',
+              type: 'warning'
+            }
+          );
+          this.loading = true;
+          await transferProductionPlan(ids);
+          this.$message.success('转生产计划成功');
+          this.reload();
+        } catch (err) {
+          if (err !== 'cancel' && err !== 'close') {
+            this.$message.error(err.message || '转生产计划失败');
+          }
+        } finally {
+          this.loading = false;
+        }
       },
 
       update(id) {

+ 32 - 23
src/views/produceOrder/components/releaseDialog/index.vue

@@ -304,6 +304,7 @@
     listWorkCenter,
     resetAssignee,
     taskAssignment,
+    checkAssignSourceType,
     taskRevoked,
     taskSave,
     listByFactoryId
@@ -1110,7 +1111,7 @@
       //     });
       // },
 
-      dispatch(row, type) {
+      async dispatch(row, type) {
         if (!row.selection || row.selection.length === 0) {
           return this.$message.warning('请最少选择一条数据');
         }
@@ -1183,29 +1184,37 @@
         const api =
           type === 1 ? taskAssignment : type === 2 ? taskRevoked : taskSave;
 
-        api(data)
-          .then(async (res) => {
-            if (res) {
-              // 等待当前页数据刷新完成,确保新增工位能回填 changeId
-              await this.setCurrentTab(row);
-
-              row.list.forEach((item) => {
-                if (item.isNew === 1) {
-                  item.status = {
-                    code: type === 1 ? 1 : 0,
-                    desc: type === 1 ? '已派单' : '已保存'
-                  };
-                }
-              });
-
-              this.$message.success('操作成功');
+        try {
+          if (type !== 2) {
+            const conflictRes = await checkAssignSourceType(data);
+            if (conflictRes?.result) {
+              this.$message.warning(
+                conflictRes.message || '当前派单布点存在冲突,请调整后再保存或派单'
+              );
             }
-            this.toolbarLoading = false;
-          })
-          .catch((err) => {
-            this.toolbarLoading = false;
-            this.$message.warning(err.message);
-          });
+          }
+
+          const res = await api(data);
+          if (res) {
+            // 等待当前页数据刷新完成,确保新增工位能回填 changeId
+            await this.setCurrentTab(row);
+
+            row.list.forEach((item) => {
+              if (item.isNew === 1) {
+                item.status = {
+                  code: type === 1 ? 1 : 0,
+                  desc: type === 1 ? '已派单' : '已保存'
+                };
+              }
+            });
+
+            this.$message.success('操作成功');
+          }
+        } catch (err) {
+          this.$message.warning(err.message);
+        } finally {
+          this.toolbarLoading = false;
+        }
       },
 
       cancel() {

+ 32 - 23
src/views/produceOrder/components/releaseDialog/planDotLineReleaseDialog.vue

@@ -379,6 +379,7 @@
     listUserByIds,
     resetAssignee,
     taskAssignment,
+    checkAssignSourceType,
     taskRevoked,
     taskSave,
     listByFactoryId
@@ -1199,7 +1200,7 @@
         });
         return isWithdraw;
       },
-      dispatch(row, type) {
+      async dispatch(row, type) {
         if (this.toolbarLoading) return;
         if (!row.selection || row.selection.length === 0) {
           return this.$message.warning('请最少选择一条数据');
@@ -1280,29 +1281,37 @@
         const api =
           type === 1 ? taskAssignment : type === 2 ? taskRevoked : taskSave;
 
-        api(data)
-          .then(async (res) => {
-            if (res) {
-              // 等待当前页数据刷新完成,确保新增工位能回填 changeId
-              await this.setCurrentTab(row);
-
-              row.list.forEach((item) => {
-                if (item.isNew === 1) {
-                  item.status = {
-                    code: type === 1 ? 1 : 0,
-                    desc: type === 1 ? '已派单' : '已保存'
-                  };
-                }
-              });
-
-              this.$message.success('操作成功');
+        try {
+          if (type !== 2) {
+            const conflictRes = await checkAssignSourceType(data);
+            if (conflictRes?.result) {
+              this.$message.warning(
+                conflictRes.message || '当前派单布点存在冲突,请调整后再保存或派单'
+              );
             }
-            this.toolbarLoading = false;
-          })
-          .catch((err) => {
-            this.toolbarLoading = false;
-            this.$message.warning(err.message);
-          });
+          }
+
+          const res = await api(data);
+          if (res) {
+            // 等待当前页数据刷新完成,确保新增工位能回填 changeId
+            await this.setCurrentTab(row);
+
+            row.list.forEach((item) => {
+              if (item.isNew === 1) {
+                item.status = {
+                  code: type === 1 ? 1 : 0,
+                  desc: type === 1 ? '已派单' : '已保存'
+                };
+              }
+            });
+
+            this.$message.success('操作成功');
+          }
+        } catch (err) {
+          this.$message.warning(err.message);
+        } finally {
+          this.toolbarLoading = false;
+        }
       },
 
       cancel() {

+ 1 - 0
src/views/produceOrder/workReport.vue

@@ -606,6 +606,7 @@
         if (!currentTask) {
           return deny(`未获取到当前工序,不能${actionName}`);
         }
+
         const executionTeamId = currentTask.executionTeamId;
 
         if (currentTask.taskId != -1) {

+ 1 - 1
src/views/productionPlan/components/gantt/project-gantt.utils.js

@@ -247,7 +247,7 @@ export function buildTooltipHtml(
     },
     {
       label: '批次号',
-      value: planMeta.batchNo || ''
+      value: task.batchNo || task.batchNum || planMeta.batchNo || ''
     },
     ...resourceRows,
     ...(resourceLabelMode === 'order'

+ 1 - 0
src/views/productionPlan/components/newFactoryProductionScheduling.vue

@@ -2338,6 +2338,7 @@
             mesWorkOrderCode: planInfo.mesWorkOrderCode || '',
             productionOrderNumber: planInfo.mesWorkOrderCode || '',
             workOrderCode: planInfo.mesWorkOrderCode || '',
+            batchNo: planInfo.batchNo || '',
             productionLineName,
             workstationName:
               item.workstationName ||

+ 13 - 0
src/views/productionPlan/components/newFactoryProductionScheduling/TaskConfigPanel.vue

@@ -621,6 +621,7 @@
   import { listPlanTaskDeviceByPlanIdAndTaskId } from '@/api/productionPlan/planDotLine.js';
   import {
     checkAssignConfirm,
+    checkAssignSourceType,
     getcheckLoginUserIsTeamLeader,
     listAssign,
     parameterGetByCode,
@@ -2263,6 +2264,15 @@
           assignees: this.buildDispatchAssignees(rows)
         };
       },
+      async checkDispatchSourceConflict(data) {
+        const checked = await checkAssignSourceType(data);
+        if (checked?.result) {
+          this.$message.warning(
+            checked.message || '当前派单布点存在冲突,请调整后再保存或派单'
+          );
+        }
+        return true;
+      },
       validateFirstTaskConfirmReportType() {
         return true;
       },
@@ -2392,6 +2402,9 @@
           type === 1 ? taskAssignment : type === 2 ? taskRevoked : taskSave;
         this.dispatchToolbarLoading = true;
         try {
+          if (type !== 2 && !(await this.checkDispatchSourceConflict(data))) {
+            return;
+          }
           await api(data);
           await this.loadDispatchAssignData();
           rows.forEach((row) => this.clearDispatchTaskBinding(row));

+ 2 - 2
vue.config.js

@@ -32,8 +32,8 @@ module.exports = {
       // 当我们的本地的请求 有/api的时候,就会代理我们的请求地址向另外一个服务器发出请求
       '/api': {
         // target: 'http://124.71.68.31:50001',
-        // target: 'http://192.168.1.125:18086',
-        target: 'http://192.168.1.251:18086',
+        target: 'http://192.168.1.125:18086',
+        // target: 'http://192.168.1.251:18086',
         // target: 'http://192.168.1.251:18186',
         // target: 'http://192.168.1.251:18086', // 开发环境
         // target: 'http://192.168.1.103:18086',192.168.1.116