作者 雷海东

生产计划派工、验收状态更改

... ... @@ -110,7 +110,7 @@
<a-divider type="vertical" />
<a @click="handleAddpg(record)" :disabled="record.totalWorkingHours - record.dispatchedWorkingHours === 0">派工</a>
<a-divider type="vertical" />
<a @click="handleYans(record)">验收</a>
<a @click="handleYans(record)" :disabled="record.totalWorkingHours - record.dispatchedWorkingHours === 0 && record.verifyStatus==1">验收</a>
</span>
</a-table>
</div>
... ...
... ... @@ -160,7 +160,6 @@ export default {
})
},
add(record) {
console.log('产品类型:', record.productType)
this.productType = record.productType
this.panduan = record
... ... @@ -169,12 +168,12 @@ export default {
if (ress) {
//如果已派工时为0总工时*工时比例,否则(总工时-已派工时)*工时比例
console.log(record.dispatchedWorkingHours)
if (record.dispatchedWorkingHours <= 0 || record.dispatchedWorkingHours==='') {
if (record.dispatchedWorkingHours <= 0 || record.dispatchedWorkingHours === '') {
console.log('aa', ress.result)
console.log(record.totalWorkingHours)
// 将获取到的工序列表添加到数据源中
this.res = ress.result.map((item) => ({
workingProcedure: item.gongxu + " (" + (item.bili * 100).toFixed() + "%)",
workingProcedure: item.gongxu + ' (' + (item.bili * 100).toFixed() + '%)',
undertaker: '', // 初始为空,等待用户输入
workHours: parseFloat((record.totalWorkingHours * item.bili).toFixed(2))
.toString()
... ... @@ -212,11 +211,15 @@ export default {
// 触发表单验证
this.$refs.form.validate((valid) => {
if (valid) {
if (!this.res.some((record) => !record.undertaker) && !this.res.some((record)=>!record.workHours)) {
// 过滤出承接人不为空的记录
const nonEmptyUndertakerRecords = this.res.filter((record) => record.undertaker)
if (nonEmptyUndertakerRecords.length>0) {
// 检查是否所有输入框的值都是数字
const allNumeric = this.res.every((record) => /^\d+(\.\d+)?$/.test(record.workHours));
if(allNumeric){
const allNumeric = this.res.every((record) => /^\d+(\.\d+)?$/.test(record.workHours))
if (allNumeric) {
that.confirmLoading = true
data=nonEmptyUndertakerRecords;
console.log('res:', this.res)
// 使用 reduce 方法累加工时字段值
const zong = this.res.reduce((acc, current) => {
... ... @@ -224,15 +227,15 @@ export default {
return acc + parseFloat(current.workHours)
}, 0)
console.log(this.panduan.dispatchedWorkingHours)
if(this.panduan.dispatchedWorkingHours==='' || this.panduan.dispatchedWorkingHours===null){
this.panduan.dispatchedWorkingHours=0
if (this.panduan.dispatchedWorkingHours === '' || this.panduan.dispatchedWorkingHours === null) {
this.panduan.dispatchedWorkingHours = 0
}
console.log(this.panduan.dispatchedWorkingHours)
const zongpaifa = parseFloat(this.panduan.dispatchedWorkingHours) + zong
console.log('派发工时和:', zong)
console.log('已派发工时:', zongpaifa)
if (zongpaifa <= this.panduan.totalWorkingHours) {
addPg(this.url.add, this.res)
addPg(this.url.add, data)
.then((res) => {
if (res.success) {
that.$message.success(res.message)
... ... @@ -248,12 +251,12 @@ export default {
that.$message.error('派发工时超过总工时')
that.confirmLoading = false
}
}else{
} else {
that.$message.error('工时格式错误')
that.confirmLoading = false
}
} else {
that.$message.error('页面字段不能为空')
that.$message.error('没有派工给承接人')
that.confirmLoading = false
}
}
... ...
... ... @@ -160,6 +160,7 @@ export default {
yanshouList(this.url.queryByNumber, { orderId: record.orderId }).then((ress) => {
if (ress) {
this.res = ress.result.map((item) => ({
orderNumber:item.orderNumber,
id: item.id,
workingProcedure: item.workingProcedure,
undertaker: item.undertaker,
... ...