派工添加NC下发

This commit is contained in:
shaoleiliu-netizen123 2026-08-06 11:47:24 +08:00
parent 65b3d20420
commit 8f9bf2bdf2
4 changed files with 200 additions and 177 deletions

View File

@ -101,3 +101,11 @@ export function exportNccode(params:any) {
params params
}) })
} }
//加载全部NC代码
export function loadAllNcCode() {
return request({
url: `biz/ncCode/loadAllNcCode`,
method: 'get'
})
}

View File

@ -35,8 +35,12 @@
value: '2' value: '2'
}, },
{ {
label: '其他异常', label: '设备异常',
value: '3' value: '3'
},
{
label: '其他异常',
value: '4'
} }
] ]
@ -170,16 +174,11 @@
<n-form inline :model="searchForm" label-placement="left"> <n-form inline :model="searchForm" label-placement="left">
<n-grid :x-gap="8" :cols="4"> <n-grid :x-gap="8" :cols="4">
<n-gi> <n-gi>
<n-form-item label="异常编号"> <n-form-item label="报警异常">
<n-input v-model:value="searchForm.abnormalCode" placeholder="请输入异常编号" clearable style="width: 200px"/>
</n-form-item>
</n-gi>
<n-gi>
<n-form-item label="操作人员">
<n-select <n-select
v-model:value="searchForm.abnormalType" v-model:value="searchForm.abnormalType"
:options="abnormalTypes" :options="abnormalTypes"
placeholder="请选择异常类型" placeholder="请选择报警异常"
clearable clearable
style="width: 200px" style="width: 200px"
/> />

View File

@ -742,7 +742,7 @@ const dispatchLoading = ref(false)
const dispatchformRef = ref() const dispatchformRef = ref()
const dispatchform = reactive<any>({ const dispatchform = reactive<any>({
id: '', name: '', beginTime: '', endTime: '', quantity: '', sectionId: null as number | null, workshopId: null as number | null, id: '', name: '', beginTime: '', endTime: '', quantity: '', sectionId: null as number | null, workshopId: null as number | null,
list: [{ sectionId:'',deviceId:'', quantity: '' }], list: [{ sectionId:'',deviceId:'', quantity: '', ncId:'' }],
}) })
const dispatchrules = {} const dispatchrules = {}
@ -1267,11 +1267,11 @@ function disphand(process: ProcessPlanItemVO, order?: OrderProcessPlanVO) {
dispatchform.sort = entity.sort dispatchform.sort = entity.sort
dispatchform.sectionId = entity.sectionId ?? process.sectionId ?? null dispatchform.sectionId = entity.sectionId ?? process.sectionId ?? null
dispatchform.workshopId = entity.workshopId ?? process.workshopId ?? order?.workshopId ?? null dispatchform.workshopId = entity.workshopId ?? process.workshopId ?? order?.workshopId ?? null
dispatchform.list = [{ sectionId: '', deviceId: '', quantity: remainQty || '' }] dispatchform.list = [{ sectionId: '', deviceId: '', quantity: remainQty || '',ncId:'' }]
} }
function addpgnum() { function addpgnum() {
dispatchform.list.push({ sectionId: '', deviceId: '', quantity: '' }) dispatchform.list.push({ sectionId: '', deviceId: '', quantity: '',ncId:'' })
} }
function deletenum(index: number) { function deletenum(index: number) {

View File

@ -1,195 +1,211 @@
<template> <template>
<div> <div>
<n-grid> <n-grid>
<n-gi :span="10"> <n-gi :span="10">
<n-form-item <n-form-item
label="指派工段" label="指派工段"
:path="`${listname}[${index}].sectionId`" :path="`${listname}[${index}].sectionId`"
> >
<n-select <n-select
v-model:value="obj.sectionId" v-model:value="obj.sectionId"
filterable filterable
placeholder="请选择工段" placeholder="请选择工段"
:options="sectionList" :options="sectionList"
:loading="loadingRef" :loading="loadingRef"
disabled disabled
remote remote
:clear-filter-after-select="false" :clear-filter-after-select="false"
/> />
</n-form-item> </n-form-item>
</n-gi> </n-gi>
<n-gi :span="10"> <n-gi :span="10">
<n-form-item <n-form-item
label="指派工位" label="指派工位"
:path="`${listname}[${index}].deviceId`" :path="`${listname}[${index}].deviceId`"
:rule="{ :rule="{
required:true, required:true,
message:`请选择工位`, message:`请选择工位`,
trigger: 'blur' trigger: 'blur'
}" }"
> >
<n-select <n-select
v-model:value="obj.deviceId" v-model:value="obj.deviceId"
filterable filterable
placeholder="请选择工位" placeholder="请选择工位"
:options="deviceList" :options="deviceList"
:loading="loadingRef" :loading="loadingRef"
clearable clearable
remote remote
:clear-filter-after-select="false" :clear-filter-after-select="false"
/> />
</n-form-item> </n-form-item>
</n-gi> </n-gi>
</n-grid>
</n-grid> <n-grid>
<n-grid> <n-gi :span="10">
<n-form-item
<n-gi :span="10"> label="数量"
<n-form-item :path="`${listname}[${index}].quantity`"
label="数量" :rule="{
:path="`${listname}[${index}].quantity`"
:rule="{
required: true, required: true,
message: `请输入数量`, message: `请输入数量`,
trigger: 'blur', trigger: 'blur',
}" }"
> >
<n-input v-model:value="obj.quantity" /> <n-input v-model:value="obj.quantity"/>
</n-form-item> </n-form-item>
</n-gi> </n-gi>
<n-gi :span="4" style="padding-left:10px;"> <n-gi :span="10">
<n-icon <n-form-item
v-if="index == 0" label="NC下发"
size="25" :path="`${listname}[${index}].ncId`"
style="padding-top: 5px;cursor: pointer;" color="#1060c9" >
@click="addpgnum" <n-select
> v-model:value="obj.ncId"
<AddOutline /> filterable
</n-icon> placeholder="请选择下发NC"
:options="ncList"
clearable
remote
:clear-filter-after-select="false"
/>
</n-form-item>
</n-gi>
<n-gi :span="4" style="padding-left:10px;">
<n-icon
v-if="index == 0"
size="25"
style="padding-top: 5px;cursor: pointer;" color="#1060c9"
@click="addpgnum"
>
<AddOutline/>
</n-icon>
<n-icon <n-icon
v-else v-else
size="18" size="18"
style="padding:7px 0 0 2px;cursor: pointer;" color="#d03050" style="padding:7px 0 0 2px;cursor: pointer;" color="#d03050"
@click="deletenum(index)" @click="deletenum(index)"
> >
<TrashOutline /> <TrashOutline/>
</n-icon> </n-icon>
</n-gi> </n-gi>
</n-grid> </n-grid>
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref,reactive } from 'vue' import {ref, reactive} from 'vue'
import { userApi } from '@/api/system' import {userApi} from '@/api/system'
import {sectionApi, type Section} from '@/api/section' import {sectionApi, type Section} from '@/api/section'
import { import {
AddOutline, AddOutline,
TrashOutline, TrashOutline,
} from '@vicons/ionicons5' } from '@vicons/ionicons5'
import {loadAllNcCode} from '@/api/nccode.ts'
const props = withDefaults(defineProps<{ const props = withDefaults(defineProps<{
listname:any listname: any
obj:any, obj: any,
index:any index: any
sectionId?: number | string | null sectionId?: number | string | null
workshopId?: number | string | null workshopId?: number | string | null
}>(), { }>(), {
obj:{} obj: {}
}) })
const emit = defineEmits<{ const emit = defineEmits<{
addhand:[], addhand: [],
delehand:[index:any], delehand: [index: any],
update: [index:any,obj:any] update: [index: any, obj: any]
}>() }>()
// function updatehand() { // function updatehand() {
// emit('update') // emit('update')
// } // }
function addpgnum() { function addpgnum() {
emit('addhand') emit('addhand')
} }
function deletenum(index:any){
emit('delehand',index)
}
let sectionList = reactive<{label:string,value:any}[]>([]) function deletenum(index: any) {
let yglist = ref<any>([]) emit('delehand', index)
}
let loadingRef = ref(false) let sectionList = reactive<{ label: string, value: any }[]>([])
let yglist = ref<any>([])
let deviceList = ref<any>([]) let loadingRef = ref(false)
function slehand(v?:any) { let deviceList = ref<any>([])
loadingRef.value = true
yglist.value.splice(0) let ncList = ref<any>([])
// dispatchform.userlist = [{
// id:'', function slehand(v?: any) {
// num:'' loadingRef.value = true
// }] yglist.value.splice(0)
userApi.page({ // dispatchform.userlist = [{
page: 1, // id:'',
pageSize: 100, // num:''
username: v, // }]
}).then((rps:any) =>{ userApi.page({
if(rps.list && rps.list.length > 0){ page: 1,
yglist.value = rps.list.map((n:any) => { pageSize: 100,
return { username: v,
label:n.username, }).then((rps: any) => {
value:n.id+'' if (rps.list && rps.list.length > 0) {
} yglist.value = rps.list.map((n: any) => {
}) return {
} label: n.username,
console.log(yglist.value,'12') value: n.id + ''
loadingRef.value = false
}).catch(() => {
loadingRef.value = false
})
} }
})
}
console.log(yglist.value, '12')
loadingRef.value = false
}).catch(() => {
loadingRef.value = false
})
}
// sectionId // sectionId
async function loadSection() { async function loadSection() {
if (props.sectionId == null || props.sectionId === '') return if (props.sectionId == null || props.sectionId === '') return
const res = await sectionApi.list({sectionId: props.sectionId}) const res = await sectionApi.list({sectionId: props.sectionId})
const mesSection = res?.MesSection; const mesSection = res?.MesSection;
const mesDevice = res?.MesDevice || [] const mesDevice = res?.MesDevice || []
if (!mesSection) return if (!mesSection) return
sectionList.push({ sectionList.push({
label:mesSection.deptName, label: mesSection.deptName,
value:mesSection.id value: mesSection.id
}) })
props.obj.sectionId = mesSection.id props.obj.sectionId = mesSection.id
deviceList.value = mesDevice.map((n:any)=>{ deviceList.value = mesDevice.map((n: any) => {
return { return {
label:n.deviceName, label: n.deviceName,
value:n.id+'' value: n.id + ''
} }
}) })
} }
// function searchSection(sectionId?:number){ //
// if(!sectionId) return async function loadNc() {
// props.obj.deviceId = '' const res = await loadAllNcCode()
// deviceList.value = [] ncList.value = res.map((n: any) => {
// deviceApi.list(sectionId).then(res=>{ return {
// deviceList.value = res.map((n:any)=>{ label: n.ncName,
// return { value: n.id
// label:n.name, }
// value:n.id+'' })
// } console.log(ncList.value)
// }) }
// })
// }
loadSection()
slehand()
loadNc()
loadSection()
slehand()
// handleDevice()
</script> </script>