diff --git a/.eslintignore b/.eslintignore index ce49828..9814fb2 100644 --- a/.eslintignore +++ b/.eslintignore @@ -4,3 +4,4 @@ /*.js /test/unit/coverage/ /src/icons/iconfont.js +/*.vue diff --git a/src/api/prd.js b/src/api/prd.js index ff4bb55..e30d7b3 100644 --- a/src/api/prd.js +++ b/src/api/prd.js @@ -29,3 +29,6 @@ export const getShiftData=data => createAPI(`dailyPlan/getShiftData`, 'post', da export const saveNewShift =data => createAPI(`dailyPlan/saveNewShift`, 'post', data); export const deleteShift= data => createAPI(`dailyPlan/deleteShift`, 'post', data); + + +export const savePlans= data => createAPI(`dailyPlan/savePlans`, 'post', data); diff --git a/src/views/modules/production/dailyPlan.vue b/src/views/modules/production/dailyPlan.vue index 511eb8c..329f3d5 100644 --- a/src/views/modules/production/dailyPlan.vue +++ b/src/views/modules/production/dailyPlan.vue @@ -82,6 +82,7 @@ 查询 + 批量排产 @@ -267,7 +268,7 @@ - 取消 + 关闭 @@ -306,7 +307,39 @@ 保存并继续 保存 - 取消 + 关闭 + + + + + + + + + + + + + + + + + + + 保存 + 关闭 @@ -322,14 +355,15 @@ savePlan, getWorkPlanData, delPlan, - getShiftData + getShiftData, + savePlans } from '@/api/prd.js' export default { name: 'productionDispatch', data () { return { - + savePlansModalFlag:false, selectList: [], // 维护日计划界面 schedulingModalFlag: false, @@ -356,6 +390,10 @@ planAdd: 0, partNo: '' }, + schedulingModalData:{ + orderDate:'', + shiftId: '', + }, scheduledingDataFlag1: false, scheduledingDataFlag3: true, schedulingFlag: false, @@ -414,7 +452,7 @@ if (row.status == '已计划' || row.status == '已取消' || row.status == '已关闭') { return false } - if (row.schedulingSize >= row.orderQty) { + if (row.schedulingSize >= row.lotSize) { return false } return true @@ -622,7 +660,69 @@ this.selectList.push(resultData) } }) - } + }, + savePlansModal(){ + if(this.dataListSelections.length ==0){ + this.$alert('请选择订单!', '错误', { + confirmButtonText: '确定' + }) + return false + } + this.schedulingModalData.orderDate=''; + this.schedulingModalData.shiftId=''; + this.savePlansModalFlag=true; + }, + savePlans() { + if( this.schedulingModalData.orderDate==''){ + this.$alert('请选择排产日期!', '错误', { + confirmButtonText: '确定' + }) + return false + } + if( this.schedulingModalData.shiftId==''){ + this.$alert('请选择班次!', '错误', { + confirmButtonText: '确定' + }) + return false + } + let inList=[]; + for(let i = this.dataListSelections.length - 1; i >= 0; i--){ + let newlist={ + orderNo: this.dataListSelections[i].orderNo, + orderDate: this.schedulingModalData.orderDate, + orderQty: this.dataListSelections[i].lotSize-this.dataListSelections[i].schedulingSize, + shiftId: this.schedulingModalData.shiftId, + userName: this.$store.state.user.name, + lotSize: this.dataListSelections[i].lotSize, + planStartDate: this.dataListSelections[i].planStartDate, + needDate: this.dataListSelections[i].needDate, + site: this.$store.state.user.site, + productionType: '生产订单', + planAdd: 0, + partNo: this.dataListSelections[i].partNo + }; + inList.push(newlist); + } + console.log(JSON.parse(JSON.stringify(inList))) + savePlans(JSON.parse(JSON.stringify(inList))).then(({data}) => { + if (data && data.code === 0) { + this.savePlansModalFlag = false; + this.getData() + this.$message({ + message: '操作成功', + type: 'success', + duration: 1500, + + onClose: () => { + } + }) + } else { + this.$alert(data.msg, '错误', { + confirmButtonText: '确定' + }) + } + }) + }, }, created () { this.getSelectData() diff --git a/src/views/modules/production/dailyPlanCirculation.vue b/src/views/modules/production/dailyPlanCirculation.vue index e9772f4..40c647f 100644 --- a/src/views/modules/production/dailyPlanCirculation.vue +++ b/src/views/modules/production/dailyPlanCirculation.vue @@ -177,7 +177,7 @@ 流转 - 取消 + 关闭 diff --git a/src/views/modules/sys/shiftData.vue b/src/views/modules/sys/shiftData.vue index 6809660..d6f62a5 100644 --- a/src/views/modules/sys/shiftData.vue +++ b/src/views/modules/sys/shiftData.vue @@ -76,7 +76,7 @@ 保存 - 取消 + 关闭 @@ -86,94 +86,94 @@ getShiftData, saveNewShift, deleteShift - } from "@/api/prd.js"; - export default { + } from '@/api/prd.js' +export default { name: 'shiftData', data () { return { height: 200, - shiftData:[], - newShiftFlag:false, - newShiftFlag1:true, - newShiftData:{ - shiftno:'', - shiftdesc:'', - startexacttime:'', - endexacttime:'', - id:'', - site:this.$store.state.user.site, - }, + shiftData: [], + newShiftFlag: false, + newShiftFlag1: true, + newShiftData: { + shiftno: '', + shiftdesc: '', + startexacttime: '', + endexacttime: '', + id: '', + site: this.$store.state.user.site + } } }, - mounted() { - this.$nextTick(()=>{ - this.height = window.innerHeight - 210; + mounted () { + this.$nextTick(() => { + this.height = window.innerHeight - 210 }) }, methods: { newShift () { - this.newShiftFlag1 = false; - this.newShiftData.shiftno = ''; - this.newShiftData.shiftdesc = ''; - this.newShiftData.startexacttime = ''; - this.newShiftData.endexacttime = ''; - this.newShiftData.id = 0; - this.newShiftFlag = true; + this.newShiftFlag1 = false + this.newShiftData.shiftno = '' + this.newShiftData.shiftdesc = '' + this.newShiftData.startexacttime = '' + this.newShiftData.endexacttime = '' + this.newShiftData.id = 0 + this.newShiftFlag = true }, - editShift(row){ - this.newShiftData.shiftno = row.shiftno; - this.newShiftData.shiftdesc = row.shiftdesc; - this.newShiftData.startexacttime = row.startexacttime; - this.newShiftData.endexacttime = row.endexacttime; - this.newShiftData.id = row.id; - this.newShiftFlag1 = true; - this.newShiftFlag = true; + editShift (row) { + this.newShiftData.shiftno = row.shiftno + this.newShiftData.shiftdesc = row.shiftdesc + this.newShiftData.startexacttime = row.startexacttime + this.newShiftData.endexacttime = row.endexacttime + this.newShiftData.id = row.id + this.newShiftFlag1 = true + this.newShiftFlag = true }, - newShiftSave(){ - if (this.newShiftData.shiftno == "" || null == this.newShiftData.shiftno) { - this.$alert("请输入班次编码!", '错误', { - confirmButtonText: '确定', - }); - return false; + newShiftSave () { + if (this.newShiftData.shiftno == '' || this.newShiftData.shiftno == null) { + this.$alert('请输入班次编码!', '错误', { + confirmButtonText: '确定' + }) + return false } - if (this.newShiftData.shiftdesc == "" || null == this.newShiftData.shiftdesc) { - this.$alert("请输入班次名称!", '错误', { - confirmButtonText: '确定', - }); - return false; + if (this.newShiftData.shiftdesc == '' || this.newShiftData.shiftdesc == null) { + this.$alert('请输入班次名称!', '错误', { + confirmButtonText: '确定' + }) + return false } - if (this.newShiftData.startexacttime == "") { - this.$alert("请输入上班时间!", '错误', { - confirmButtonText: '确定', - }); - return false; + if (this.newShiftData.startexacttime == '') { + this.$alert('请输入上班时间!', '错误', { + confirmButtonText: '确定' + }) + return false } - if (this.newShiftData.endexacttime == "") { - this.$alert("请输入下班时间!", '错误', { - confirmButtonText: '确定', - }); - return false; + if (this.newShiftData.endexacttime == '') { + this.$alert('请输入下班时间!', '错误', { + confirmButtonText: '确定' + }) + return false } - let time1=this.newShiftData.startexacttime; - let time2=this.newShiftData.endexacttime; - let list={ - shiftno:this.newShiftData.shiftno, - shiftdesc:this.newShiftData.shiftdesc, - startexacttime:'2020-01-01 '+this.newShiftData.startexacttime+':00', - endexacttime:'2020-01-01 '+this.newShiftData.endexacttime+':00', - id:this.newShiftData.id, - site:this.$store.state.user.site, - }; - // this.newShiftData.startexacttime='2020-01-01 '+this.newShiftData.startexacttime+':00'; - // this.newShiftData.endexacttime='2020-01-01 '+this.newShiftData.endexacttime+':00'; + let time1 = this.newShiftData.startexacttime + let time2 = this.newShiftData.endexacttime + let list = { + shiftno: this.newShiftData.shiftno, + shiftdesc: this.newShiftData.shiftdesc, + startexacttime: '2020-01-01 ' + this.newShiftData.startexacttime + ':00', + endexacttime: '2020-01-01 ' + this.newShiftData.endexacttime + ':00', + id: this.newShiftData.id, + site: this.$store.state.user.site + } + // this.newShiftData.startexacttime='2020-01-01 '+this.newShiftData.startexacttime+':00'; + // this.newShiftData.endexacttime='2020-01-01 '+this.newShiftData.endexacttime+':00'; saveNewShift(list).then(({data}) => { - this.newShiftData.startexacttime=time1; - this.newShiftData.endexacttime=time2; + this.newShiftData.startexacttime = time1 + this.newShiftData.endexacttime = time2 if (data && data.code === 0) { - this.newShiftFlag=false; + this.newShiftFlag = false getShiftData().then(({data}) => { - this.shiftData = data.rows; + this.shiftData = data.rows }) this.$message({ message: '操作成功', @@ -184,30 +184,29 @@ }) } else { this.$alert(data.msg, '错误', { - confirmButtonText: '确定', - }); + confirmButtonText: '确定' + }) } }) }, - searchShift(){ + searchShift () { getShiftData().then(({data}) => { - this.shiftData = data.rows; + this.shiftData = data.rows }) }, - deleteShift(row){ - + deleteShift (row) { this.$confirm(`是否删除此条班次信息?`, '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' }).then(() => { - let inData={ - id:row.id + let inData = { + id: row.id } deleteShift(inData).then(({data}) => { if (data && data.code === 0) { getShiftData().then(({data}) => { - this.shiftData = data.rows; + this.shiftData = data.rows }) this.$message({ message: '操作成功', @@ -219,17 +218,17 @@ }) } else { this.$alert(data.msg, '错误', { - confirmButtonText: '确定', - }); + confirmButtonText: '确定' + }) } }) }).catch(() => { }) - }, + } }, - created() { - this.searchShift(); - } + created () { + this.searchShift() + } }