|
|
|
@ -1,6 +1,6 @@
|
|
|
|
|
import request from '@/utils/request'
|
|
|
|
|
import { VXETable } from 'vxe-table'
|
|
|
|
|
import XLSX from 'xlsx'
|
|
|
|
|
import {EventBus} from "@/event-bus";
|
|
|
|
|
const init=function (that){
|
|
|
|
|
|
|
|
|
|
const butClick=function (){
|
|
|
|
@ -14,92 +14,58 @@ const init=function (that){
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const 核对=function (){
|
|
|
|
|
const dcCh=that.$refs.xqProjectSelectRef.getDcch();
|
|
|
|
|
const dcPl=data.options.formConfig.data.xqpl
|
|
|
|
|
if (!dcCh||!dcPl){
|
|
|
|
|
VXETable.modal.message({ content: '请选择需求船号和批量', status: 'warning' })
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
const table=that.$refs.vGrid
|
|
|
|
|
const list=table.getCheckboxRecords()
|
|
|
|
|
if (list.length===0){
|
|
|
|
|
VXETable.modal.message({ content: '请选择数据', status: 'warning' })
|
|
|
|
|
return
|
|
|
|
|
const 入库=()=>{
|
|
|
|
|
const {insertRecords,updateRecords}=that.$refs.vGrid.getRecordset()
|
|
|
|
|
const data=[]
|
|
|
|
|
if (insertRecords.length>=0){
|
|
|
|
|
data.push(...insertRecords)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const _data={
|
|
|
|
|
dcCh:dcCh,
|
|
|
|
|
dcPl:dcPl,
|
|
|
|
|
ylList:list
|
|
|
|
|
if (updateRecords.length>=0){
|
|
|
|
|
data.push(...updateRecords)
|
|
|
|
|
}
|
|
|
|
|
核对数据(_data).then(res=>{
|
|
|
|
|
const data=res.data
|
|
|
|
|
VXETable.modal.message({ content: `核对结束,匹配${data.length}张套料图`, status: 'warning' })
|
|
|
|
|
for (const item of data) {
|
|
|
|
|
for (let it of list) {
|
|
|
|
|
if (it.id===item.id){
|
|
|
|
|
it=Object.assign(it,item)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (!item.垛位){
|
|
|
|
|
that.$refs.vGrid.setCurrentRow(item)
|
|
|
|
|
VXETable.modal.message({ content: `${item.余料编号}请选择摆放位置`, status: 'warning' })
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if (!item.入库日期){
|
|
|
|
|
that.$refs.vGrid.setCurrentRow(item)
|
|
|
|
|
VXETable.modal.message({ content: `${item.余料编号}请选择入库日期`, status: 'warning' })
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const 保存=()=>{
|
|
|
|
|
const list=that.$refs.vGrid.getCheckboxRecords()
|
|
|
|
|
if (list.length>0){
|
|
|
|
|
edit(list).then(res=>{
|
|
|
|
|
rk(data).then(res=>{
|
|
|
|
|
VXETable.modal.message({ content: '成功', status: 'success' })
|
|
|
|
|
butClick()
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const 打印=()=>{
|
|
|
|
|
const list=that.$refs.vGrid.getCheckboxRecords()
|
|
|
|
|
if (list.length>0){
|
|
|
|
|
print(list).then(res=>{
|
|
|
|
|
const workBook = XLSX.utils.book_new();
|
|
|
|
|
const _data=list.map(item=>{
|
|
|
|
|
return {
|
|
|
|
|
船号:item.使用船号,
|
|
|
|
|
批量:item.使用批量,
|
|
|
|
|
图纸编号:item.使用图纸,
|
|
|
|
|
余料编号:item.余料编号,
|
|
|
|
|
垛位:item.垛位
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
const sheet=XLSX.utils.json_to_sheet(_data)
|
|
|
|
|
XLSX.utils.book_append_sheet(workBook, sheet, "sheet");
|
|
|
|
|
XLSX.writeFile(workBook, `${data.options.formConfig.dcCh}-${data.options.formConfig.dcPl}余料上料计划.xlsx`)
|
|
|
|
|
butClick()
|
|
|
|
|
const 移垛=()=>{
|
|
|
|
|
const data=that.$refs.vGrid.getCheckboxRecords()
|
|
|
|
|
if (data.length>0){
|
|
|
|
|
const list=data.map(item=>{
|
|
|
|
|
return {id:item.id,垛位:item.垛位,层数:item.层数}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const 退回=()=>{
|
|
|
|
|
const list=that.$refs.vGrid.getCheckboxRecords()
|
|
|
|
|
if(list.length>0){
|
|
|
|
|
rollback(list).then(()=>{
|
|
|
|
|
edit(list).then(res=>{
|
|
|
|
|
VXETable.modal.message({ content: '成功', status: 'success' })
|
|
|
|
|
butClick()
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const 提取=()=>{
|
|
|
|
|
that.$refs.ylModal.show()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const useStatus=[
|
|
|
|
|
{label:'未使用',value:'0'},
|
|
|
|
|
{label:'未打印',value:'1'},
|
|
|
|
|
{label:'已打印',value:'2'},
|
|
|
|
|
{label:'已切割',value:'3'},
|
|
|
|
|
{label:'未使用',value:'1'},
|
|
|
|
|
{label:'未出库',value:'2'},
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
const formatUseStatus=({cellValue})=>{
|
|
|
|
|
for (const item of useStatus) {
|
|
|
|
|
if(item.value===cellValue){
|
|
|
|
|
if(item.value===cellValue+''){
|
|
|
|
|
return item.label
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -116,6 +82,7 @@ const init=function (that){
|
|
|
|
|
size:'mini',
|
|
|
|
|
showOverflow: true,
|
|
|
|
|
showHeaderOverflow:true,
|
|
|
|
|
scrollY:{enable:true},
|
|
|
|
|
editConfig:{trigger: 'click', mode: 'cell', showStatus: true},
|
|
|
|
|
highlightCurrentRow:true,
|
|
|
|
|
formConfig:{
|
|
|
|
@ -123,49 +90,40 @@ const init=function (that){
|
|
|
|
|
dcCh:'',
|
|
|
|
|
dcPl:'',
|
|
|
|
|
tzbh:'',
|
|
|
|
|
status:'0',
|
|
|
|
|
xqch:'',
|
|
|
|
|
xqpl:'',
|
|
|
|
|
status:'1',
|
|
|
|
|
},
|
|
|
|
|
items:[
|
|
|
|
|
{ field: 'dcCh', title: '来源船只', span: 3,slots: { default: 'name_czbh' } },
|
|
|
|
|
{ field: 'dcPl', title: '来源批量', span: 3 ,itemRender: {name: '$input'}},
|
|
|
|
|
{ field: 'tzbh', title: '来源图号', span: 3 ,itemRender: {name: '$input'}},
|
|
|
|
|
{ field: 'dcCh', title: '来源船只', span: 4,slots: { default: 'name_czbh' } },
|
|
|
|
|
{ field: 'dcPl', title: '来源批量', span: 4 ,itemRender: {name: '$input'}},
|
|
|
|
|
{ field: 'tzbh', title: '来源图号', span: 4 ,itemRender: {name: '$input'}},
|
|
|
|
|
{ field: 'status', title: '使用状态', span: 3 ,
|
|
|
|
|
itemRender: {name: '$select',props:{options:useStatus}}
|
|
|
|
|
},
|
|
|
|
|
{span: 12,
|
|
|
|
|
{span: 9,
|
|
|
|
|
children:[
|
|
|
|
|
{ span: 15,align:'right',itemRender: {
|
|
|
|
|
name: '$button', props: {content:'查询',status:'primary'},events:{click:butClick}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{ align:'right',itemRender: {
|
|
|
|
|
name: '$button', props: {content:'核对',status:'primary'},events:{click:核对}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{ align:'right',itemRender: {
|
|
|
|
|
name: '$button', props: {content:'保存',status:'primary'},events:{click:保存}
|
|
|
|
|
name: '$button', props: {content:'提取',status:'success'},events:{click:提取}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{ align:'right',itemRender: {
|
|
|
|
|
name: '$button', props: {content:'打印',status:'primary'},events:{click:打印}
|
|
|
|
|
name: '$button', props: {content:'入库',status:'primary'},events:{click:入库}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{ align:'right',itemRender: {
|
|
|
|
|
name: '$button', props: {content:'退回',status:'primary'},events:{click:退回}
|
|
|
|
|
name: '$button', props: {content:'移垛',status:'warning'},events:{click:移垛}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{ field: 'xqch', title: '需求船只', span: 3,slots: { default: 'name_xqch' } },
|
|
|
|
|
{ field: 'xqpl', title: '需求批量', span: 3 ,itemRender: {name: '$input'}},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
columns:[
|
|
|
|
|
{type:'checkbox',title:'序号'},
|
|
|
|
|
{type:'seq',title:''},
|
|
|
|
|
// { field: 'id', title: 'ID', width: 150 },
|
|
|
|
|
{ field: '余料编号', title: '余料编号', width: 150,
|
|
|
|
|
filters: [{ data: { checks: [], sVal: '', sMenu: '', fType1: '', fVal1: '', fMode: 'and', fType2: '', fVal2: '' } }],
|
|
|
|
|
filterRender: { name: 'FilterCombination' }
|
|
|
|
@ -198,38 +156,21 @@ const init=function (that){
|
|
|
|
|
filters: [{ data: { checks: [], sVal: '', sMenu: '', fType1: '', fVal1: '', fMode: 'and', fType2: '', fVal2: '' } }],
|
|
|
|
|
filterRender: { name: 'FilterCombination' }
|
|
|
|
|
},
|
|
|
|
|
{ field: '垛位', title: '垛位', width: 100,
|
|
|
|
|
{ field: '入库日期', title: '入库日期', width: 150,
|
|
|
|
|
editRender:{name:'$input',props: {type:'date', labelFormat:'yyyy/MM/dd',valueFormat:'yyyy/MM/dd',placeholder: '请选择日期' }},
|
|
|
|
|
filters: [{ data: { checks: [], sVal: '', sMenu: '', fType1: '', fVal1: '', fMode: 'and', fType2: '', fVal2: '' } }],
|
|
|
|
|
filterRender: { name: 'FilterCombination' }
|
|
|
|
|
},
|
|
|
|
|
{ field: '层数', title: '层数', width: 80,
|
|
|
|
|
filters: [{ data: { checks: [], sVal: '', sMenu: '', fType1: '', fVal1: '', fMode: 'and', fType2: '', fVal2: '' } }],
|
|
|
|
|
filterRender: { name: 'FilterCombination' }
|
|
|
|
|
},
|
|
|
|
|
{ field: '使用船号', title: '使用船号', width: 120,
|
|
|
|
|
editRender:{name:'$input'},
|
|
|
|
|
filters: [{ data: { checks: [], sVal: '', sMenu: '', fType1: '', fVal1: '', fMode: 'and', fType2: '', fVal2: '' } }],
|
|
|
|
|
filterRender: { name: 'FilterCombination' }
|
|
|
|
|
},
|
|
|
|
|
{ field: '使用批量', title: '使用批量', width: 120,
|
|
|
|
|
editRender:{name:'$input'},
|
|
|
|
|
filters: [{ data: { checks: [], sVal: '', sMenu: '', fType1: '', fVal1: '', fMode: 'and', fType2: '', fVal2: '' } }],
|
|
|
|
|
filterRender: { name: 'FilterCombination' }
|
|
|
|
|
},
|
|
|
|
|
{ field: '使用分段', title: '使用分段', width: 120,
|
|
|
|
|
editRender:{name:'$input'},
|
|
|
|
|
{ field: '垛位', title: '垛位', width: 100,
|
|
|
|
|
editRender:{name:'$select',options:[]},
|
|
|
|
|
filters: [{ data: { checks: [], sVal: '', sMenu: '', fType1: '', fVal1: '', fMode: 'and', fType2: '', fVal2: '' } }],
|
|
|
|
|
filterRender: { name: 'FilterCombination' }
|
|
|
|
|
},
|
|
|
|
|
{ field: '使用图纸', title: '使用图纸', width: 150,
|
|
|
|
|
{ field: '层数', title: '层数', width: 80,
|
|
|
|
|
editRender:{name:'$input'},
|
|
|
|
|
filters: [{ data: { checks: [], sVal: '', sMenu: '', fType1: '', fVal1: '', fMode: 'and', fType2: '', fVal2: '' } }],
|
|
|
|
|
filterRender: { name: 'FilterCombination' }
|
|
|
|
|
},
|
|
|
|
|
{ field: '使用日期', title: '使用日期', width: 150,
|
|
|
|
|
filters: [{ data: { checks: [], sVal: '', sMenu: '', fType1: '', fVal1: '', fMode: 'and', fType2: '', fVal2: '' } }],
|
|
|
|
|
filterRender: { name: 'FilterCombination' }
|
|
|
|
|
},
|
|
|
|
|
{ field: '来源船号', title: '来源船号', width: 120,
|
|
|
|
|
filters: [{ data: { checks: [], sVal: '', sMenu: '', fType1: '', fVal1: '', fMode: 'and', fType2: '', fVal2: '' } }],
|
|
|
|
|
filterRender: { name: 'FilterCombination' }
|
|
|
|
@ -260,6 +201,23 @@ const init=function (that){
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getDw().then(res=>{
|
|
|
|
|
const 垛位=that.$refs.vGrid.getColumnByField('垛位')
|
|
|
|
|
垛位.editRender.options=res.data.map(item=>{
|
|
|
|
|
return {label:item.bmsm,value:item.bm}
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const tmpSelectId=[]
|
|
|
|
|
EventBus.$on('ylrkSelect', _data=>{
|
|
|
|
|
_data.forEach(item=>{
|
|
|
|
|
if (tmpSelectId.includes(item.id)){
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
tmpSelectId.push(item.id)
|
|
|
|
|
that.$refs.vGrid.insert(item)
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
return data
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -271,9 +229,9 @@ const getData=(data)=>{
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const 核对数据=(data)=>{
|
|
|
|
|
const rk=(data)=>{
|
|
|
|
|
return request({
|
|
|
|
|
url: "/yl/gdsl",
|
|
|
|
|
url: "/yl/rk",
|
|
|
|
|
method: "post",
|
|
|
|
|
data,
|
|
|
|
|
});
|
|
|
|
@ -287,19 +245,11 @@ const edit=(data)=>{
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const print=(data)=>{
|
|
|
|
|
const getDw=()=>{
|
|
|
|
|
return request({
|
|
|
|
|
url: "/yl/print",
|
|
|
|
|
url: "/api/sy/getZhbmList",
|
|
|
|
|
method: "post",
|
|
|
|
|
data,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const rollback=(data)=>{
|
|
|
|
|
return request({
|
|
|
|
|
url: "/yl/rollback",
|
|
|
|
|
method: "post",
|
|
|
|
|
data,
|
|
|
|
|
data:{bmlb:'yldw'}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|