diff --git a/src/api/mes/planInfo/index.ts b/src/api/mes/planInfo/index.ts
index 042395c..f4158d0 100644
--- a/src/api/mes/planInfo/index.ts
+++ b/src/api/mes/planInfo/index.ts
@@ -75,3 +75,28 @@ export function getPlanInfoList (query) {
params: query
});
};
+
+// 获取工艺路线的所有工艺步骤
+export function getBaseRouteProcesses(query) {
+ return request({
+ url: '/mes/planInfo/getBaseRouteProcesses' ,
+ method: 'get',
+ params: query
+ })
+}
+
+// 获取派工编号
+export function getDispatchCode() {
+ return request({
+ url: '/mes/planInfo/getDispatchCode',
+ method: 'get'
+ })
+}
+// 查询生产派工列表
+export function selectProductPlans(query) {
+ return request({
+ url: '/mes/planInfo/selectProductPlans',
+ method: 'get',
+ params: query
+ })
+}
diff --git a/src/views/mes/orderInfo/editProductPlan.vue b/src/views/mes/orderInfo/editProductPlan.vue
index fc8d629..57174d4 100644
--- a/src/views/mes/orderInfo/editProductPlan.vue
+++ b/src/views/mes/orderInfo/editProductPlan.vue
@@ -22,7 +22,7 @@
{{ form.materialName }}
{{ form.planEndTime }}
-
+
@@ -35,7 +35,7 @@
-
新增
@@ -58,7 +58,7 @@
label="删除"
type=""
>
-
+
@@ -70,7 +70,7 @@
-
+
@@ -84,32 +84,32 @@
-
+
-
+
-
+
-
+
-
+
-
-
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
-
+
{{scope.row.planStatus}}
@@ -172,10 +190,10 @@
-
+
{
let results = []
@@ -594,6 +621,8 @@ export default {
SOP: "2",//附件类别:SOP
},
processUsers: [],
+ processStations:[],
+
//物料BOMList
attachInfoList: [],
//选中的BOMList
@@ -608,19 +637,22 @@ export default {
}
},
created() {
- // const productOrderId = this.$route.params && this.$route.params.productOrderId;
- // if (productOrderId) {
- // // 获取表详细信息
- // getProductOrder(productOrderId).then(res => {
- // this.form = res.data;
- // this.getProcessUsers(productOrderId);
- // });
- // }
- //
- //
- // this.getConfigValues();
+ this.fetchOrderInfo();
},
methods: {
+ async fetchOrderInfo() {
+ const productOrderId = this.$route.params.productOrderId;
+ console.log("productOrderId", productOrderId);
+ if (productOrderId) {
+ try {
+ const response = await getOrderInfo(productOrderId);
+ this.form = response.data;
+ this.getProcessJoin(productOrderId);
+ } catch (error) {
+ console.error("Failed to fetch order info:", error);
+ }
+ }
+ },
getConfigValues(){
//图纸支持格式
getConfigKey("mes.drawing.allowedExtension").then(res => {
@@ -649,8 +681,8 @@ export default {
},
- getProcessUsers(productOrderId) {
- getProcessUsers(this.form.dispatchId).then(res => {
+/* getProcessUsers(productOrderId) {
+ getProdBaseProcessUserList(this.form.dispatchId).then(res => {
res.data.forEach(processUser => {
if (!this.processUsers[processUser.processId]) {
this.processUsers[processUser.processId] = [];
@@ -667,6 +699,36 @@ export default {
// })
})
});
+ },*/
+ async getProcessJoin(productOrderId) {
+ const routeId = this.form.dispatchId;
+ const processId = this.form.processId;
+ try {
+ const res = await getProdBaseProcessUserList({ routeId });
+ res.data.forEach(processUser => {
+ if (!this.processUsers[processUser.processId]) {
+ this.processUsers[processUser.processId] = [];
+ }
+ this.processUsers[processUser.processId].push(processUser);
+ });
+ console.log("this.processUsers", this.processUsers);
+
+
+ const station = await getStationInfoList({ processId });
+ console.log("getStationInfoList", station);
+ station.data.forEach(processStation => {
+ if (!this.processStations[processStation.processId]){
+ this.processStations[processStation.processId] = [];
+ }
+ this.processStations[processStation.processId].push(processStation);
+ });
+
+ const productPlansResponse = await selectProductPlans({ productOrderId: productOrderId });
+ this.groupProductPlans(productPlansResponse.data);
+
+ } catch (error) {
+ console.error("Failed to fetch process users or product plans:", error);
+ }
},
groupProductPlans(productPlans) {
@@ -708,7 +770,7 @@ export default {
groupedProductPlan.id = this.id;
this.id = this.id + 1;
groupedProductPlan.productionTime = parseFloat((groupedProductPlan.productionTime / 60 / 60).toFixed(1));
- obj.sopId = groupedProductPlan.sopId;
+/* obj.sopId = groupedProductPlan.sopId;*/
obj.attachId = groupedProductPlan.attachId;
obj.productionTime = parseFloat((groupedProductPlan.processProductionTime / 60 / 60).toFixed(1));
@@ -721,10 +783,10 @@ export default {
obj.lastProcessId = groupedProductPlan.lastProcessId;
obj.processType = groupedProductPlan.processType;
obj.processOrder = groupedProductPlan.processOrder;
- obj.displayFlag = groupedProductPlan.displayFlag;
+/* obj.displayFlag = groupedProductPlan.displayFlag;*/
obj.finalProcessFlag = groupedProductPlan.finalProcessFlag;
obj.attachId = groupedProductPlan.attachId;
- obj.sopId = groupedProductPlan.sopId;
+/* obj.sopId = groupedProductPlan.sopId;*/
obj.planBeginTime = this.form.planBeginTime;
obj.planEndTime = this.form.planEndTime;
@@ -763,7 +825,7 @@ export default {
},
- getId(arr) {
+ async getId(arr) {
arr.forEach(element => {
this.id = this.id + 1;
if (Array.isArray(element.children)) {
@@ -1047,94 +1109,88 @@ export default {
/** 生产计划添加按钮操作 */
- handleAddMesProductPlan() {
+ async handleAddMesProductPlan() {
let dispatchCode = "";
- getDispatchCode().then(res => {
- dispatchCode = res.msg;
- getBaseRouteProcesses({routeId: this.form.dispatchId}).then(res => {
- // if (res.data.length === 0) {
- // this.$modal.msgError("工艺路线未维护工位信息!");
- // }
- let lastProcessId = null;
- let i = 0;
- res.data.forEach((e, index) => {
- let obj = {};
- if (i === 0) {
- obj.firstFlag = "1";//设置第一条标识,代表只能此派工单号只有第一条记录上有删除按钮,删除时同意删除此派工单号的派工,第一条有派工数量即可
- i++;
- }
- obj.id = this.id
- this.id = this.id + 1;
- obj.dispatchCode = dispatchCode;
- obj.processId = e.processId;
- obj.processName = e.processName;
- obj.processType = e.processType;
- obj.processOrder = e.processOrder;
- obj.finalProcessFlag = e.finalProcessFlag;
- obj.productionTime = e.productionTime ? parseFloat((e.productionTime / 60 / 60).toFixed(1)) : 0;
+ dispatchCode = await getDispatchCode().then(res => res.msg);
+ console.log("dispatchCode", dispatchCode);
- obj.planBeginTime = this.form.planBeginTime;
- obj.planEndTime = this.form.planEndTime;
- obj.planStatus = '1';
- // obj.dispatchAmount = this.form.planAmount - this.form.dispatchAmount;
- obj.dispatchFlag = null;
+ const baseRouteProcesses = await getBaseRouteProcesses({ routeId: this.form.dispatchId });
+ let lastProcessId = null;
+ let i = 0;
- if (this.form.saleType === this.SALE_TYPE.INTERNAL) {
- obj.materialId = this.form.produceMaterialId;
- } else {
- obj.materialId = this.form.materialId;
- }
+ for (const e of baseRouteProcesses.data) {
+ let obj = {};
+ if (i === 0) {
+ obj.firstFlag = "1"; // 设置第一条标识
+ i++;
+ }
+ obj.id = this.id;
+ this.id = this.id + 1;
+ obj.dispatchCode = dispatchCode;
+ obj.processId = e.processId;
+ obj.processName = e.processName;
+ obj.processType = e.processType;
+ obj.processOrder = e.processOrder;
+ obj.productionTime = e.productionTime ? parseFloat((e.productionTime / 60 / 60).toFixed(1)) : 0;
- obj.materialBomId = this.form.materialBomId;
- obj.productOrderId = this.form.productOrderId;
- obj.saleOrderId = this.form.saleOrderId;
- obj.saleorderCode = this.form.saleorderCode;
+ obj.planBeginTime = this.form.planBeginTime;
+ obj.planEndTime = this.form.planEndTime;
+ obj.planStatus = '1';
- obj.newFlag = "1";//代表新增
- obj.addFlag = "1";
+ if (this.form.saleType === this.SALE_TYPE.INTERNAL) {
+ obj.materialId = this.form.produceMaterialId;
+ } else {
+ obj.materialId = this.form.materialId;
+ }
- // e.mesBaseProcessUserList.forEach((mesBaseProcessUser, index) => {
- // mesBaseProcessUser.id = this.id + 1;
- // mesBaseProcessUser.dispatchFlag = null;
- // mesBaseProcessUser.planBeginTime = null;
- // mesBaseProcessUser.planEndTime = null;
- // this.id = this.id + 1;
- // });
+ obj.materialBomId = this.form.materialBomId;
+ obj.productOrderId = this.form.productOrderId;
+ obj.saleOrderId = this.form.saleOrderId;
+ obj.saleorderCode = this.form.saleorderCode;
- if (e.processType === this.PROCESS_TYPE.AUTO) {
- obj.children = [];
- } else {
- obj.children = [{
- id: this.id,
- dispatchCode: obj.dispatchCode,
- processId: obj.processId,
- materialBomId: obj.materialBomId,
- planStatus: this.PLAN_STATUS.DISPATCHED,
- productionTime: obj.productionTime,
- userId: null
- }]
- }
+ obj.newFlag = "1"; // 代表新增
+ obj.addFlag = "1";
+ if (e.processType === this.PROCESS_TYPE.AUTO) {
+ obj.children = [];
+ } else {
+ obj.children = [{
+ id: this.id,
+ dispatchCode: obj.dispatchCode,
+ processId: obj.processId,
+ materialBomId: obj.materialBomId,
+ planStatus: this.PLAN_STATUS.DISPATCHED,
+ productionTime: obj.productionTime,
+ userId: null
+ }]
+ }
- this.id += 1;
+ this.id += 1;
- // 上一工序ID
- if (lastProcessId == null) {
- obj.lastProcessId = 0;
- } else if (lastProcessId === obj.processId) {
- obj.lastProcessId = this.mesProductPlanList[index - 1].lastProcessId;
- } else {
- obj.lastProcessId = lastProcessId;
- }
- lastProcessId = e.processId;
- // 新添加列标识 false=新添加,true=历史行
- obj.oldRowFlag = false;
- this.mesProductPlanList.push(obj);
- })
+ // 获取当前 processId 对应的工位信息
+ const stationResponse = await getStationInfoList({ processId: e.processId });
+ if (stationResponse.data && stationResponse.data.length > 0) {
+ this.processStations[e.processId] = stationResponse.data.map(station => ({
+ stationId: station.stationId,
+ stationName: station.stationName
+ }));
+ }
- this.getId(this.mesProductPlanList)
- })
- })
+ // 上一工序ID
+ if (lastProcessId == null) {
+ obj.lastProcessId = 0;
+ } else if (lastProcessId === obj.processId) {
+ obj.lastProcessId = this.mesProductPlanList[this.mesProductPlanList.length - 1].lastProcessId;
+ } else {
+ obj.lastProcessId = lastProcessId;
+ }
+ lastProcessId = e.processId;
+ obj.oldRowFlag = false;
+ this.mesProductPlanList.push(obj);
+ }
+
+ this.getId(this.mesProductPlanList);
+ console.log(this.mesProductPlanList);
},
@@ -1537,12 +1593,41 @@ export default {
},
+ dispatchTypeList:[],
+ async dispatchTypeFunction () {
+
+ const dispatchTypeRes = await proxy?.getConfigKey('sys.orderInfo.dispatchType');
+ initFormData.dispatchType = dispatchTypeRes.data;
+ if (dispatchTypeRes.data === '1'){
+ dispatchTypeName.value = "产线";
+ const res = await getProdLineList(null);
+ dispatchTypeList.value = res.data.map(item => ({
+ id: item.prodLineId,
+ name: item.prodLineName
+ }));
+ } else if (dispatchTypeRes.data === '2'){
+ dispatchTypeName.value = "工艺路线";
+ const res = await getBaseRouteList(null);
+ dispatchTypeList.value = res.data.map(item => ({
+ id: item.routeId,
+ name: item.routeName
+ }));
+ } else if (dispatchTypeRes.data === '3'){
+ dispatchTypeName.value = "工序";
+ const res = await getProcessInfoList(null);
+ dispatchTypeList.value = res.data.map(item => ({
+ id: item.processId,
+ name: item.processName
+ }));
+ }
+ },
- mounted() {
- }
}
;
+onMounted(() => {
+ dispatchTypeFunction(); //派工类型(1产线 2工艺路线 3工序)
+});