生产管理bug修改

This commit is contained in:
2024-12-27 15:00:43 +08:00
parent 492b591fa9
commit 031e3098b7
13 changed files with 603 additions and 343 deletions

View File

@@ -8,7 +8,7 @@
<el-row :gutter="20">
<el-col :span="6">
<el-form-item label="工单模式">
<el-radio-group v-model="isBind">
<el-radio-group v-model="isBind" @input='toggleWay'>
<el-radio :label="true">绑定工单</el-radio>
<el-radio :label="false">新增工单</el-radio>
</el-radio-group>
@@ -48,16 +48,19 @@
<el-option
v-for="item in productList"
:key="item.id"
:label="item.name + ' | ' + item.specifications"
:value="item.id">
<span style="float: left">{{ item.name }}</span>
<span style="float: right; color: #8492a6; font-size: 13px">
{{ item.specifications }}
</span>
</el-option>
:label="item.name"
:value="item.id"/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="产品规格" prop="specifications">
<el-input
v-model="form.specifications"
placeholder="请输入产品规格"
disabled />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="计划开始时间">
<el-date-picker
@@ -100,33 +103,6 @@
style="width: 100%"></el-input-number>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="关联工艺" prop="processFlowId">
<el-select
v-model="form.processFlowId"
placeholder="请选择"
disabled
style="width: 100%">
<el-option
v-for="item in processFlowList"
:key="item.id"
:label="item.name"
:value="item.id"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="物料计算方式" prop="materialMethod">
<el-select
v-model="form.materialMethod"
placeholder="请选择"
style="width: 100%"
disabled>
<el-option label="产品基础BOM" :value="1"></el-option>
<el-option label="工艺扩展BOM" :value="2"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="优先级" prop="priority">
<el-select
@@ -158,15 +134,14 @@
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="关联产线" prop="productLineId">
<el-form-item label="负责部门" prop="deptId">
<el-select
v-model="form.productLineId"
placeholder="请选择"
multiple
v-model="form.deptId"
placeholder="请选择关联产线"
style="width: 100%"
:disabled="isBind">
<el-option
v-for="item in productLineList"
v-for="item in deptList"
:key="item.id"
:label="item.name"
:value="item.id"></el-option>
@@ -178,37 +153,123 @@
<el-input v-model="form.workers" :disabled="isBind"></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="负责部门" prop="deptId">
</el-row>
<el-row :gutter="20">
<el-col :span="24">
<span class="add-type">物料计算方式</span>
<el-radio-group
v-model="form.materialMethod"
:disabled="isBind"
@change="materialMethodChange">
<el-radio :label="1">产品基础BOM</el-radio>
<el-radio :label="2">工艺扩展BOM</el-radio>
</el-radio-group>
</el-col>
</el-row>
<div v-if="form.materialMethod === 1">
<el-row :gutter="20">
<el-col :span="24">
<span style="margin: 8px 0;" class="add-type">关联产线</span>
<el-button style="margin-left: 20px" type="text" @click="addBind" :disabled="isBind">
新增
</el-button>
</el-col>
</el-row>
<el-row
:gutter="20"
v-for="(item, index) in form.productLineIds"
:key="index + 'line'"
style="margin-bottom: 8px">
<el-col :span="8">
<el-select
v-model="form.deptId"
placeholder="请选择关联产线"
v-model="item.lineId"
placeholder="请选择产线"
:disabled="isBind"
style="width: 100%">
<el-option
v-for="item in deptList"
v-for="item in productLineList"
:key="item.id"
:label="item.name"
:value="item.id"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="计划分配订单量" prop="planAssignmentQuantity">
</el-col>
<el-col :span="8">
<el-tooltip effect="dark" content="该产线分配生产数量" placement="top-end">
<el-input-number
v-model="form.planAssignmentQuantity"
style="width: 100%"
v-model="item.num"
placeholder="请输入数量"
:step="1"
:min="0"
:max="9999999999999"
style="width: 100%"></el-input-number>
</el-form-item>
</el-col>
</el-row>
:disabled="isBind"
step-strictly />
</el-tooltip>
</el-col>
</el-row>
</div>
<div v-else>
<el-row :gutter="20">
<el-col :span="24">
<span style="margin: 8px 0; display: inline-block">
关联产线及工艺
</span>
<el-button style="margin-left: 20px" type="text" @click="addBind" :disabled="isBind">
新增
</el-button>
</el-col>
</el-row>
<el-row
:gutter="20"
v-for="(item, index) in form.productLineIds"
:key="index + 'process'"
style="margin-bottom: 8px">
<el-col :span="8">
<el-select
v-model="item.lineId"
placeholder="请选择产线"
style="width: 100%"
:disabled="isBind"
@change="processLineIdChange">
<el-option
v-for="item in productLineList"
:key="item.id"
:label="item.name"
:value="item.id"></el-option>
</el-select>
</el-col>
<el-col :span="8">
<el-select
v-model="item.processId"
placeholder="请选择工艺"
filterable
:disabled="isBind"
style="width: 100%">
<el-option
v-for="item in processFlowList"
:key="item.id"
:label="item.name"
:value="item.id"></el-option>
</el-select>
</el-col>
<el-col :span="8">
<el-tooltip effect="dark" content="该产线分配生产数量" placement="top-end">
<el-input-number
style="width: 100%"
v-model="item.num"
:step="1"
:min="0"
:disabled="isBind"
step-strictly />
</el-tooltip>
</el-col>
</el-row>
</div>
</el-form>
</template>
<script>
import { getProductAll } from '@/api/base/product';
import { getProductList } from '@/api/base/product';
import {
getProcessFlowList,
getWorkOrderCode,
getProcessFlowPage,
orderIssue,
workOrderList,
getWorkOrderById,
@@ -216,13 +277,13 @@ import {
import { getLineAll } from '@/api/base/productionLine';
import { listDept } from '@/api/system/dept';
import moment from 'moment';
import { getCode } from '@/api/base/coreWorkOrder';
export default {
name: 'AddWorkOrder',
data() {
return {
form: {
workOrderId: '',
orderId: '',
name: '',
code: '',
planProductId: '',
@@ -231,10 +292,9 @@ export default {
planAssignQuantity: 0,
deptId: undefined,
planQuantity: 0,
processFlowId: '',
materialMethod: 1,
priority: '',
productLineId: [],
productLineIds: [{ lineId: null, processId: null, num: null }],
type: '',
workers: '',
planAssignmentQuantity: '',
@@ -253,9 +313,6 @@ export default {
planQuantity: [
{ required: true, message: '计划生产数量不能为空', trigger: 'blur' },
],
productLineId: [
{ required: true, message: '产线不能为空', trigger: 'change' },
],
planAssignmentQuantity: [
{
required: true,
@@ -271,58 +328,73 @@ export default {
processFlowList: [],
productLineList: [],
workOrderTypeList: [
{ id: 1, name: '标准工单' },
{ id: 2, name: '特殊工单' },
{ id: 1, name: '普通' },
{ id: 2, name: '特殊' },
],
planStartTime: '',
planFinishTime: '',
isBind: false,
isBind: true,
workOrderList: [],
orderData: {},
};
},
methods: {
// 工艺变更
materialMethodChange(val) {
console.log(val);
this.processFlowList = [];
this.form.productLineIds = [];
const obj = { lineId: null, processId: null, num: null };
this.form.productLineIds.push(obj);
},
// 产线工艺关联
processLineIdChange(val) {
const params = {
pageNo: 1,
pageSize: 100,
lineId: val,
};
// 工艺
getProcessFlowPage(params).then((res) => {
this.processFlowList = res.data.list || [];
console.log(this.processFlowList);
});
},
init(data, param) {
this.isBind = true;
this.orderData = data;
this.form.orderId = data.id;
this.getList();
},
changeAdd() {
if (this.isBind) {
this.isBind = false;
getWorkOrderCode().then((res) => {
this.form.code = res.data || '';
});
this.form.orderId = null;
this.form.planProductId = this.orderData.planProductId;
this.form.processFlowId = this.orderData.processFlowId;
this.form.materialMethod = this.orderData.materialMethod;
} else {
this.isBind = true;
this.form.orderId = this.orderData.id;
this.form.planProductId = null;
this.form.processFlowId = null;
this.form.materialMethod = null;
this.form.code = null;
toggleWay(val) {
console.log(val);
this.formClear()
if (!val) {
// 获取工单编码
getCode().then((res) => {
this.form.code = res.data;
this.form.planProductId = this.orderData.planProductId;
this.form.name = '';
this.selectProduct(this.form.planProductId)
})
}else{
this.form.code = '';
this.form.planProductId = '';
}
this.form.materialMethod = 1;
this.form.productLineIds = [];
},
getList() {
listDept().then((res) => {
this.deptList = res.data || [];
});
// 产品
getProductAll().then((res) => {
getProductList().then((res) => {
this.productList = res.data || [];
});
// 产线
getLineAll().then((res) => {
this.productLineList = res.data || [];
});
// 工艺
getProcessFlowList().then((res) => {
this.processFlowList = res.data || [];
});
// 工单list
workOrderList({
status: 1,
@@ -330,6 +402,18 @@ export default {
this.workOrderList = res.data || [];
});
},
// 选产品带出规格
selectProduct(val) {
if (val) {
this.productList.map((item) => {
if (val === item.id) {
this.form.specifications = item.specifications;
}
});
} else {
this.form.specifications = '';
}
},
addWorkOrderSubmit() {
this.$refs['addWorkOrder'].validate((valid) => {
if (valid) {
@@ -337,8 +421,7 @@ export default {
//绑定工单
orderIssue({
workOrderId: this.form.workOrderId,
orderId: this.form.orderId,
planAssignmentQuantity: this.form.planAssignmentQuantity,
orderId: this.orderData.id,
}).then((res) => {
if (res.code === 0) {
this.$modal.msgSuccess('操作成功');
@@ -347,24 +430,19 @@ export default {
});
} else {
// 新增工单
let _this = this;
_this.form.planStartTime = _this.planStartTime
? new Date(_this.planStartTime).valueOf()
this.form.planStartTime = this.planStartTime
? new Date(this.planStartTime).valueOf()
: '';
_this.form.planFinishTime = _this.planFinishTime
? new Date(_this.planFinishTime).valueOf()
this.form.planFinishTime = this.planFinishTime
? new Date(this.planFinishTime).valueOf()
: '';
orderIssue({ ..._this.form }).then((res) => {
orderIssue({
...this.form,
orderId: this.orderData.id,
}).then((res) => {
if (res.code === 0) {
_this.$modal.msgSuccess('操作成功');
let name = this.form.name;
_this.$emit('addWorkOrderSubmit');
// 询问是否添加预使用主原料
// _this.$modal.confirm('是否添加预使用主原料信息?').then(function() {
// _this.$router.push({
// path: '/core/core-work-order?workOrderName='+encodeURI(name)
// })
// })
this.$modal.msgSuccess('操作成功');
this.$emit('addWorkOrderSubmit');
}
});
}
@@ -382,39 +460,52 @@ export default {
this.planStartTime = '';
this.form.planFinishTime = '';
this.form.planStartTime = '';
this.isBind = false;
},
// 绑定工单,选择工单时获取工单信息
getWorkOrderMsg() {
if (this.form.workOrderId) {
getWorkOrderById({ id: this.form.workOrderId }).then((res) => {
if (res.code === 0) {
this.form.code = res.data.code;
this.form.planProductId = res.data.planProductId;
this.form = res.data;
this.form.workOrderId = res.data.id;
this.planStartTime = res.data.planStartTime
? moment
.unix(res.data.planStartTime)
? moment(res.data.planStartTime)
.format('YYYY-MM-DD HH:mm:ss')
: null;
this.planFinishTime = res.data.planFinishTime
? moment
.unix(res.data.planFinishTime)
? moment(res.data.planFinishTime)
.format('YYYY-MM-DD HH:mm:ss')
: null;
this.form.planAssignQuantity = res.data.planAssignQuantity;
this.form.planQuantity = res.data.planQuantity;
this.form.processFlowId = res.data.processFlowId;
this.form.materialMethod = res.data.materialMethod;
this.form.priority = res.data.priority
? res.data.priority + ''
: '';
this.form.productLineId = res.data.productLineIds;
this.form.type = res.data.type;
this.form.workers = res.data.workers;
// 根据产线获取工艺
if (this.form.materialMethod === 2) {
this.form.productLineIds.forEach((item) => {
if (item.lineId) {
this.processLineIdChange(item.lineId);
}
})
}
}
});
}
},
addBind() {
const obj = { lineId: null, processId: null, num: null };
this.form.productLineIds.push(obj);
},
},
};
</script>
<style scoped>
.add-type {
margin: 0 20px 15px 0;
display: inline-block;
}
.add-type::before {
content: '*';
color: #ff4949;
margin-right: 4px;
}
</style>

View File

@@ -19,6 +19,12 @@
</el-col>
<el-col :span='6'>
<el-form-item label="产品名称" prop="planProductId">
<el-select @change="getSpec" v-model="form.planProductId" placeholder="请选择" style="width: 100%;" filterable>
<el-option v-for="item in productList" :key="item.id" :label="item.name"
:value="item.id"/>
</el-select>
</el-form-item>
<!-- <el-form-item label="产品名称" prop="planProductId">
<el-select @change="getSpec" v-model="form.planProductId" placeholder="请选择" style="width: 100%;" filterable>
<el-option v-for="item in productList" :key="item.id" :label="item.name+' | '+(item.specifications || '')"
:value="item.id">
@@ -26,7 +32,7 @@
<span style="float: right; color: #8492a6; font-size: 13px">{{ item.specifications }}</span>
</el-option>
</el-select>
</el-form-item>
</el-form-item> -->
</el-col>
</el-row>
<el-row :gutter="20">
@@ -79,7 +85,7 @@
</template>
<script>
import { getOrderCode, getOrderById, getProcessFlowList, orderUpdate, orderCreate } from '@/api/base/orderManage'
import { getProductAll } from '@/api/base/product'
import { getProductList } from '@/api/base/product'
import { getCustomerList } from '@/api/base/customer'
export default {
name: 'OrderAdd',
@@ -160,7 +166,7 @@ export default {
},
getList() {
// 产品
getProductAll().then(res => {
getProductList().then(res => {
this.productList = res.data || []
})
// 客户

View File

@@ -69,7 +69,7 @@ const tableProps = [
showOverflowtooltip: true,
},
{
prop: 'specifications',
prop: 'productSpec',
label: '产品规格',
showOverflowtooltip: true,
},

View File

@@ -117,14 +117,14 @@
<el-button
type="text"
:disabled="
!(scope.row.status === 1 && scope.row.triggerOrigin === 1)
!(scope.row.status === 1)
"
@click="handleClick({ data: scope.row, type: 'edit' })"
v-hasPermi="['base:order-manage:edit']">
<span
class="iconfont icon-edit"
:class="
!(scope.row.status === 1 && scope.row.triggerOrigin === 1)
!(scope.row.status === 1)
? ''
: 'primary-color'
" />
@@ -193,7 +193,6 @@
import { parseTime } from '@/utils/ruoyi';
import {
getOrderPage,
orderDelete,
orderAssignmentList,
orderFinish,
orderVoid,
@@ -380,7 +379,6 @@ export default {
}
},
handleClick(val) {
console.log(val);
switch (val.type) {
case 'edit':
this.addOrEditTitle = '编辑';
@@ -389,21 +387,11 @@ export default {
this.$refs.orderAdd.init(val.data.id);
});
break;
case 'delete':
this.handleDelete(val.data);
break;
case 'detail':
this.$router.push({
path: 'order-detail-data?orderId=' + val.data.id,
});
break;
case 'add':
this.workIssueTitle = '新增工单';
this.addWorkOrdervisible = true;
this.$nextTick(() => {
this.$refs.addWorkOrder.init(val.data, 'add');
});
break;
case 'void':
orderVoid({ id: val.data.id }).then((res) => {
console.log(res);
@@ -437,19 +425,6 @@ export default {
default:
}
},
// 删除
handleDelete(val) {
this.$modal
.confirm('是否确认删除"' + val.name + '"的数据项?')
.then(function () {
return orderDelete({ id: val.id });
})
.then(() => {
this.getList();
this.$modal.msgSuccess('操作成功');
})
.catch(() => {});
},
// 完成
handleComplete(val) {
this.$modal