|
|
@@ -899,58 +899,129 @@ const _MachineWorkOrderList = async () => {
|
|
|
chejianData.value = MachineWorkOrderList_search.data['排程'];
|
|
|
}
|
|
|
};
|
|
|
-//加入排产按钮
|
|
|
+// //加入排产按钮
|
|
|
+// const onjrpcClick = async () => {
|
|
|
+// searchInfo.value = '';
|
|
|
+// if(_PC_gdbh.value == null || _PC_gdbh.value == ''){
|
|
|
+// ElMessage({type: 'warning',message: '请勾选排程中工单'})
|
|
|
+// }else{
|
|
|
+// if (_PC_xscn.value === '' || _PC_xscn.value === null || _PC_xscn.value === '0') {
|
|
|
+// ElMessage({type: 'warning',message: '选择中小时产量为 0'})
|
|
|
+// return false;
|
|
|
+// }else{
|
|
|
+// let params = {}
|
|
|
+// params.workOrder = _PC_gdbh.value;
|
|
|
+// params.machine = _machine.value;
|
|
|
+// params.printCode = _PC_yjno.value;
|
|
|
+// params.processCode = _PC_gxh.value;
|
|
|
+// console.log(params)
|
|
|
+// const ProductionSchedulingAdd_add = await ProductionSchedulingAdd(params);
|
|
|
+// if (ProductionSchedulingAdd_add.code === 0) {
|
|
|
+// const pc_zc_table = await MachineWorkOrderList({machine:_machine.value});
|
|
|
+// chejianData.value = pc_zc_table.data['排程'];
|
|
|
+// chejianfuData.value = pc_zc_table.data['制程'];
|
|
|
+// ElMessage({type: 'success',message: '加入排产 更新成功'});
|
|
|
+// } else {
|
|
|
+// ElMessage({ type: 'error',message: '更新失败'})
|
|
|
+// }
|
|
|
+// }
|
|
|
+
|
|
|
+// }
|
|
|
+// };
|
|
|
+// 加入排产按钮 - 优化为正确格式
|
|
|
const onjrpcClick = async () => {
|
|
|
searchInfo.value = '';
|
|
|
- if(_PC_gdbh.value == null || _PC_gdbh.value == ''){
|
|
|
- ElMessage({type: 'warning',message: '请勾选排程中工单'})
|
|
|
- }else{
|
|
|
- if (_PC_xscn.value === '' || _PC_xscn.value === null || _PC_xscn.value === '0') {
|
|
|
- ElMessage({type: 'warning',message: '选择中小时产量为 0'})
|
|
|
- return false;
|
|
|
- }else{
|
|
|
- let params = {}
|
|
|
- params.workOrder = _PC_gdbh.value;
|
|
|
- params.machine = _machine.value;
|
|
|
- params.printCode = _PC_yjno.value;
|
|
|
- params.processCode = _PC_gxh.value;
|
|
|
- console.log(params)
|
|
|
- const ProductionSchedulingAdd_add = await ProductionSchedulingAdd(params);
|
|
|
- if (ProductionSchedulingAdd_add.code === 0) {
|
|
|
- const pc_zc_table = await MachineWorkOrderList({machine:_machine.value});
|
|
|
- chejianData.value = pc_zc_table.data['排程'];
|
|
|
- chejianfuData.value = pc_zc_table.data['制程'];
|
|
|
- ElMessage({type: 'success',message: '加入排产 更新成功'});
|
|
|
- } else {
|
|
|
- ElMessage({ type: 'error',message: '更新失败'})
|
|
|
- }
|
|
|
- }
|
|
|
+ if (!_PC_gdbh.value || _PC_gdbh.value.length === 0) {
|
|
|
+ ElMessage({type: 'warning', message: '请勾选排程中工单'});
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (_PC_xscn.value.some(xscn => !xscn || xscn === '0')) {
|
|
|
+ ElMessage({type: 'warning', message: '选择中小时产量为 0'});
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
+ try {
|
|
|
+ // 构建符合接口要求的工单数组
|
|
|
+ const requestData = jitaiArr.value.map(item => ({
|
|
|
+ workOrder: item['工单编号'],
|
|
|
+ machine: _machine.value,
|
|
|
+ printCode: item['yjno'],
|
|
|
+ processCode: item['gxh'],
|
|
|
+ // 如果接口需要小时产能,添加下面这行
|
|
|
+ // hourlyCapacity: item['小时产能'] // 根据接口实际需求决定是否保留
|
|
|
+ }));
|
|
|
+
|
|
|
+ // 直接发送数组,不需要包装成 { workOrders: [...] } 形式
|
|
|
+ const result = await ProductionSchedulingAdd(requestData);
|
|
|
+
|
|
|
+ if (result.code === 0) {
|
|
|
+ const pc_zc_table = await MachineWorkOrderList({machine: _machine.value});
|
|
|
+ chejianData.value = pc_zc_table.data['排程'];
|
|
|
+ chejianfuData.value = pc_zc_table.data['制程'];
|
|
|
+ ElMessage({type: 'success', message: '加入排产 更新成功'});
|
|
|
+ } else {
|
|
|
+ ElMessage({type: 'error', message: '工单更新失败: ' + (result.message || '未知错误')});
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ ElMessage({type: 'error', message: '更新失败: ' + error.message});
|
|
|
}
|
|
|
-};
|
|
|
-//暂停排产按钮
|
|
|
+}
|
|
|
+// //暂停排产按钮
|
|
|
+// const onztwgClick = async () => {
|
|
|
+// searchInfo.value = '';
|
|
|
+// if(_ZC_gdbh.value == null || _ZC_gdbh.value == ''){
|
|
|
+// ElMessage({type: 'warning', message: '请勾选制程中工单'})
|
|
|
+// }else{
|
|
|
+// let params = {}
|
|
|
+// params.workOrder = _ZC_gdbh.value;
|
|
|
+// params.machine = _machine.value;
|
|
|
+// params.printCode = _ZC_yjno.value;
|
|
|
+// params.processCode = _ZC_gxh.value;
|
|
|
+// console.log(params)
|
|
|
+// const ProductionSchedulingAdd_stop = await ProductionSchedulingPause(params);
|
|
|
+// if (ProductionSchedulingAdd_stop.code === 0) {
|
|
|
+// const pc_zc_table = await MachineWorkOrderList({machine:_machine.value});
|
|
|
+// chejianData.value = pc_zc_table.data['排程'];
|
|
|
+// chejianfuData.value = pc_zc_table.data['制程'];
|
|
|
+// ElMessage({type: 'success',message: '暂停排产 更新成功'});
|
|
|
+// } else {
|
|
|
+// ElMessage({ type: 'error',message: '更新失败'})
|
|
|
+// }
|
|
|
+// }
|
|
|
+// };
|
|
|
+// 暂停排产按钮 - 优化为正确格式
|
|
|
const onztwgClick = async () => {
|
|
|
searchInfo.value = '';
|
|
|
- if(_ZC_gdbh.value == null || _ZC_gdbh.value == ''){
|
|
|
- ElMessage({type: 'warning', message: '请勾选制程中工单'})
|
|
|
- }else{
|
|
|
- let params = {}
|
|
|
- params.workOrder = _ZC_gdbh.value;
|
|
|
- params.machine = _machine.value;
|
|
|
- params.printCode = _ZC_yjno.value;
|
|
|
- params.processCode = _ZC_gxh.value;
|
|
|
- console.log(params)
|
|
|
- const ProductionSchedulingAdd_stop = await ProductionSchedulingPause(params);
|
|
|
- if (ProductionSchedulingAdd_stop.code === 0) {
|
|
|
- const pc_zc_table = await MachineWorkOrderList({machine:_machine.value});
|
|
|
+ if (!_ZC_gdbh.value || _ZC_gdbh.value.length === 0) {
|
|
|
+ ElMessage({type: 'warning', message: '请勾选制程中工单'});
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ try {
|
|
|
+ // 构建符合接口要求的工单数组
|
|
|
+ const requestData = _ZC_gdbh.value.map((gdbh, index) => ({
|
|
|
+ workOrder: gdbh,
|
|
|
+ machine: _machine.value,
|
|
|
+ printCode: _ZC_yjno.value[index],
|
|
|
+ processCode: _ZC_gxh.value[index]
|
|
|
+ }));
|
|
|
+
|
|
|
+ // 直接发送数组
|
|
|
+ const result = await ProductionSchedulingPause(requestData);
|
|
|
+
|
|
|
+ if (result.code === 0) {
|
|
|
+ const pc_zc_table = await MachineWorkOrderList({machine: _machine.value});
|
|
|
chejianData.value = pc_zc_table.data['排程'];
|
|
|
chejianfuData.value = pc_zc_table.data['制程'];
|
|
|
- ElMessage({type: 'success',message: '暂停排产 更新成功'});
|
|
|
+ ElMessage({type: 'success', message: '暂停排产 更新成功'});
|
|
|
} else {
|
|
|
- ElMessage({ type: 'error',message: '更新失败'})
|
|
|
+ ElMessage({type: 'error', message: '工单更新失败: ' + (result.message || '未知错误')});
|
|
|
}
|
|
|
+ } catch (error) {
|
|
|
+ ElMessage({type: 'error', message: '更新失败: ' + error.message});
|
|
|
}
|
|
|
-};
|
|
|
+}
|
|
|
//工序完工按钮
|
|
|
const ongxwgClick = async () => {
|
|
|
searchInfo.value = '';
|
|
|
@@ -972,37 +1043,61 @@ const ongxwgClick = async () => {
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
-//加入排程【上面到下面】
|
|
|
+// //加入排程【上面到下面】
|
|
|
+// const _PC_gxh = ref(null)
|
|
|
+// const _PC_yjno = ref(null)
|
|
|
+// const _PC_gdbh = ref(null)
|
|
|
+// const _PC_xscn = ref(null)
|
|
|
+// const jitaiArr = ref([])
|
|
|
+// const PC_handleChange = (arr) => {
|
|
|
+// let gxh = arr.map((val) => val['gxh']).join(",");
|
|
|
+// let yjno = arr.map((val) => val['yjno']).join(",");
|
|
|
+// let str = arr.map((val) => val['工单编号']).join(",");
|
|
|
+// let xscn = arr.map((val) => val['小时产能']).join(",");
|
|
|
+// _PC_gxh.value = gxh;
|
|
|
+// _PC_yjno.value = yjno;
|
|
|
+// _PC_gdbh.value = str;
|
|
|
+// _PC_xscn.value = xscn;
|
|
|
+// jitaiArr.value = arr
|
|
|
+// }
|
|
|
+// 加入排程【上面到下面】
|
|
|
const _PC_gxh = ref(null)
|
|
|
const _PC_yjno = ref(null)
|
|
|
const _PC_gdbh = ref(null)
|
|
|
const _PC_xscn = ref(null)
|
|
|
const jitaiArr = ref([])
|
|
|
const PC_handleChange = (arr) => {
|
|
|
- let gxh = arr.map((val) => val['gxh']).join(",");
|
|
|
- let yjno = arr.map((val) => val['yjno']).join(",");
|
|
|
- let str = arr.map((val) => val['工单编号']).join(",");
|
|
|
- let xscn = arr.map((val) => val['小时产能']).join(",");
|
|
|
- _PC_gxh.value = gxh;
|
|
|
- _PC_yjno.value = yjno;
|
|
|
- _PC_gdbh.value = str;
|
|
|
- _PC_xscn.value = xscn;
|
|
|
jitaiArr.value = arr
|
|
|
+ _PC_gxh.value = arr.map(val => val['gxh'])
|
|
|
+ _PC_yjno.value = arr.map(val => val['yjno'])
|
|
|
+ _PC_gdbh.value = arr.map(val => val['工单编号'])
|
|
|
+ _PC_xscn.value = arr.map(val => val['小时产能'])
|
|
|
}
|
|
|
-//加入制程【下面到上面】
|
|
|
+// //加入制程【下面到上面】
|
|
|
+// const _ZC_gxh = ref(null)
|
|
|
+// const _ZC_yjno = ref(null)
|
|
|
+// const _ZC_gdbh = ref(null)
|
|
|
+// const _ZC_xscn = ref(null)
|
|
|
+// const ZP_handleChange = (arr) => {
|
|
|
+// let gxh = arr.map((val) => val['gxh']).join(",");
|
|
|
+// let yjno = arr.map((val) => val['yjno']).join(",");
|
|
|
+// let str = arr.map((val) => val['工单编号']).join(",");
|
|
|
+// let xscn = arr.map((val) => val['小时产能']).join(",");
|
|
|
+// _ZC_gxh.value = gxh;
|
|
|
+// _ZC_yjno.value = yjno;
|
|
|
+// _ZC_gdbh.value = str;
|
|
|
+// _ZC_xscn.value = xscn;
|
|
|
+// }
|
|
|
+// 加入制程【下面到上面】
|
|
|
const _ZC_gxh = ref(null)
|
|
|
const _ZC_yjno = ref(null)
|
|
|
const _ZC_gdbh = ref(null)
|
|
|
const _ZC_xscn = ref(null)
|
|
|
const ZP_handleChange = (arr) => {
|
|
|
- let gxh = arr.map((val) => val['gxh']).join(",");
|
|
|
- let yjno = arr.map((val) => val['yjno']).join(",");
|
|
|
- let str = arr.map((val) => val['工单编号']).join(",");
|
|
|
- let xscn = arr.map((val) => val['小时产能']).join(",");
|
|
|
- _ZC_gxh.value = gxh;
|
|
|
- _ZC_yjno.value = yjno;
|
|
|
- _ZC_gdbh.value = str;
|
|
|
- _ZC_xscn.value = xscn;
|
|
|
+ _ZC_gxh.value = arr.map(val => val['gxh'])
|
|
|
+ _ZC_yjno.value = arr.map(val => val['yjno'])
|
|
|
+ _ZC_gdbh.value = arr.map(val => val['工单编号'])
|
|
|
+ _ZC_xscn.value = arr.map(val => val['小时产能'])
|
|
|
}
|
|
|
|
|
|
//=========工序产量核查===========
|
|
|
@@ -1282,8 +1377,9 @@ const saveJizuTiaozheng = async () => {
|
|
|
ElMessage.warning('请先勾选机组')
|
|
|
return
|
|
|
}
|
|
|
- const uid = jitaiArr.value.map(item => item.GYUID).join(' ')
|
|
|
+ const uid = jitaiArr.value.map(item => item.GYUID).join(',')
|
|
|
const jizu = jizuSelection.value.map(item=>item.value).join(' ')
|
|
|
+ console.log(uid,jizu)
|
|
|
try {
|
|
|
const res = await MachineTeamEdit({UniqId: uid, machine: jizu})
|
|
|
if (res.code == 0) ElMessage.success('调整成功')
|