派工添加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

@ -40,10 +40,8 @@
/> />
</n-form-item> </n-form-item>
</n-gi> </n-gi>
</n-grid> </n-grid>
<n-grid> <n-grid>
<n-gi :span="10"> <n-gi :span="10">
<n-form-item <n-form-item
label="数量" label="数量"
@ -54,7 +52,23 @@
trigger: 'blur', trigger: 'blur',
}" }"
> >
<n-input v-model:value="obj.quantity" /> <n-input v-model:value="obj.quantity"/>
</n-form-item>
</n-gi>
<n-gi :span="10">
<n-form-item
label="NC下发"
:path="`${listname}[${index}].ncId`"
>
<n-select
v-model:value="obj.ncId"
filterable
placeholder="请选择下发NC"
:options="ncList"
clearable
remote
:clear-filter-after-select="false"
/>
</n-form-item> </n-form-item>
</n-gi> </n-gi>
<n-gi :span="4" style="padding-left:10px;"> <n-gi :span="4" style="padding-left:10px;">
@ -64,7 +78,7 @@
style="padding-top: 5px;cursor: pointer;" color="#1060c9" style="padding-top: 5px;cursor: pointer;" color="#1060c9"
@click="addpgnum" @click="addpgnum"
> >
<AddOutline /> <AddOutline/>
</n-icon> </n-icon>
<n-icon <n-icon
@ -73,7 +87,7 @@
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>
@ -82,51 +96,53 @@
</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() {
// emit('update')
// }
// function updatehand() { function addpgnum() {
// emit('update')
// }
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)
let deviceList = ref<any>([])
function slehand(v?:any) { let ncList = ref<any>([])
function slehand(v?: any) {
loadingRef.value = true loadingRef.value = true
yglist.value.splice(0) yglist.value.splice(0)
// dispatchform.userlist = [{ // dispatchform.userlist = [{
@ -137,24 +153,24 @@
page: 1, page: 1,
pageSize: 100, pageSize: 100,
username: v, username: v,
}).then((rps:any) =>{ }).then((rps: any) => {
if(rps.list && rps.list.length > 0){ if (rps.list && rps.list.length > 0) {
yglist.value = rps.list.map((n:any) => { yglist.value = rps.list.map((n: any) => {
return { return {
label:n.username, label: n.username,
value:n.id+'' value: n.id + ''
} }
}) })
} }
console.log(yglist.value,'12') console.log(yglist.value, '12')
loadingRef.value = false loadingRef.value = false
}).catch(() => { }).catch(() => {
loadingRef.value = false 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;
@ -162,34 +178,34 @@
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 + ''
} }
}) })
}
//
async function loadNc() {
const res = await loadAllNcCode()
ncList.value = res.map((n: any) => {
return {
label: n.ncName,
value: n.id
} }
})
console.log(ncList.value)
}
// function searchSection(sectionId?:number){
// if(!sectionId) return
// props.obj.deviceId = ''
// deviceList.value = []
// deviceApi.list(sectionId).then(res=>{
// deviceList.value = res.map((n:any)=>{
// return {
// label:n.name,
// value:n.id+''
// }
// })
// })
// }
loadSection() loadSection()
slehand() slehand()
// handleDevice() loadNc()
</script> </script>