Compare commits

..

No commits in common. "466c822b0ffb18c0834b08e2fa6478ae40d7233d" and "d14dae86fc7b8664db78ef79936fb9011ba8e51d" have entirely different histories.

13 changed files with 350 additions and 610 deletions

View File

@ -161,12 +161,3 @@ export function createConCoreWOr(data) {
data: data data: data
}) })
} }
// 更新分配产量
export function updateBatch(data) {
return request({
url: '/base/core-order-con-work-order/updateBatch',
method: 'put',
data: data
})
}

View File

@ -1,16 +1,8 @@
import request from '@/utils/request' import request from '@/utils/request'
// 获得物料列表(包括产品) // 获得产品列表
export function getProductAll() { export function getProductAll() {
return request({ return request({
url: '/base/core-product-material/listAll', url: '/base/core-product-material/listAll',
method: 'get' method: 'get'
}) })
} }
// 获得产品列表
export function getProductList() {
return request({
url: '/base/core-product-material/listAllProduct',
method: 'get'
})
}

View File

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

View File

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

View File

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

View File

@ -81,7 +81,7 @@ export default {
this.chartList[i].workOrder.map(item => { this.chartList[i].workOrder.map(item => {
colorList.push(item.color) colorList.push(item.color)
}) })
let percentage = (this.chartList[i].sunNum/this.chartList[i].num*100).toFixed(2) let percentage = (this.chartList[i].sunNum/this.chartList[i].num*100).toFixed(0)
var option = { var option = {
color: colorList, color: colorList,
series: [ series: [

View File

@ -249,14 +249,14 @@ export default {
let sunNum = 0 let sunNum = 0
for (let i = 0; i < tempArr[key].length; i++) { for (let i = 0; i < tempArr[key].length; i++) {
let subObj = {} let subObj = {}
subObj.value = tempArr[key][i].actualAssignmentQuantity || 0 subObj.value = tempArr[key][i].actualAssignmentQuantity
subObj.name = tempArr[key][i].woName subObj.name = tempArr[key][i].woName
if (i < 5) { if (i < 5) {
subObj.color = color[i] subObj.color = color[i]
} else { } else {
subObj.color = color[i%5] subObj.color = color[i%5]
} }
sunNum+=(tempArr[key][i].actualAssignmentQuantity || 0) sunNum+=tempArr[key][i].actualAssignmentQuantity
tempArr3.push(subObj) tempArr3.push(subObj)
} }
tempArr3.push({ tempArr3.push({
@ -268,7 +268,6 @@ export default {
obj.workOrder = tempArr3 obj.workOrder = tempArr3
tempArr2.push(obj) tempArr2.push(obj)
} }
console.log(tempArr2)
this.chartList = tempArr2 this.chartList = tempArr2
if (this.activeName === 'barChart' && this.chartList.length > 0) { if (this.activeName === 'barChart' && this.chartList.length > 0) {
this.$nextTick(() => { this.$nextTick(() => {

View File

@ -43,8 +43,7 @@
<el-form-item label="产品规格" prop="specifications"> <el-form-item label="产品规格" prop="specifications">
<el-input <el-input
v-model="dataForm.specifications" v-model="dataForm.specifications"
placeholder="请输入产品规格" placeholder="请输入产品规格" />
disabled/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
@ -150,6 +149,11 @@
<el-radio :label="1">产品基础BOM</el-radio> <el-radio :label="1">产品基础BOM</el-radio>
<el-radio :label="2">工艺扩展BOM</el-radio> <el-radio :label="2">工艺扩展BOM</el-radio>
</el-radio-group> </el-radio-group>
<!-- <el-select v-model="dataForm.materialMethod" placeholder="请选择物料计算方式" style="width: 100%;"
@change="materialMethodChange">
<el-option key="1" label="产品基础BOM" :value="1" />
<el-option key="2" label="工艺扩展BOM" :value="2" />
</el-select> -->
</el-col> </el-col>
</el-row> </el-row>
<div v-if="dataForm.materialMethod === 1"> <div v-if="dataForm.materialMethod === 1">
@ -245,10 +249,17 @@
</el-col> </el-col>
</el-row> </el-row>
</div> </div>
<!-- <el-row>
<el-col :span='12'>
<el-form-item label="计划分配订单量" prop="planAssignmentQuantity">
<el-input-number v-model="form.planAssignmentQuantity" :min="0" :max="9999999999999" style="width: 100%;"></el-input-number>
</el-form-item>
</el-col>
</el-row> -->
</el-form> </el-form>
</template> </template>
<script> <script>
import { getProductList } from '@/api/base/product'; import { getProductAll } from '@/api/base/product';
import { getProcessFlowPage, workOrderList } from '@/api/base/orderManage'; import { getProcessFlowPage, workOrderList } from '@/api/base/orderManage';
import { import {
createCoreWO, createCoreWO,
@ -316,6 +327,7 @@ export default {
{ id: 1, name: '普通' }, { id: 1, name: '普通' },
{ id: 2, name: '特殊' }, { id: 2, name: '特殊' },
], ],
isBind: false,
workOrderList: [], workOrderList: [],
}; };
}, },
@ -330,6 +342,10 @@ export default {
this.dataForm.productLineIds = []; this.dataForm.productLineIds = [];
const obj = { lineId: null, processId: null, num: null }; const obj = { lineId: null, processId: null, num: null };
this.dataForm.productLineIds.push(obj); this.dataForm.productLineIds.push(obj);
// if (val === 2 && !this.dataForm.processFlowId) {
// this.dataForm.materialMethod = 1;
// this.$modal.msgError('');
// }
}, },
// 线 // 线
processLineIdChange(val) { processLineIdChange(val) {
@ -341,7 +357,6 @@ export default {
// //
getProcessFlowPage(params).then((res) => { getProcessFlowPage(params).then((res) => {
this.processFlowList = res.data.list || []; this.processFlowList = res.data.list || [];
console.log(this.processFlowList);
}); });
}, },
init(id) { init(id) {
@ -364,14 +379,6 @@ export default {
this.dataForm.priority = String(this.dataForm.priority); this.dataForm.priority = String(this.dataForm.priority);
} }
this.dataForm.priority; this.dataForm.priority;
// 线
if (this.dataForm.materialMethod === 2) {
this.dataForm.productLineIds.forEach((item) => {
if (item.lineId) {
this.processLineIdChange(item.lineId);
}
})
}
}); });
} else { } else {
if (this.urlOptions.isGetCode) { if (this.urlOptions.isGetCode) {
@ -416,7 +423,21 @@ export default {
this.urlOptions.createURL(this.dataForm).then((response) => { this.urlOptions.createURL(this.dataForm).then((response) => {
this.$modal.msgSuccess('新增成功'); this.$modal.msgSuccess('新增成功');
this.visible = false; this.visible = false;
this.$emit('refreshDataList'); this.$confirm('是否添加预使用主原料信息?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
console.log('121', this.dataForm.name);
this.$emit('refreshDataList', {
id: response.data,
name: this.dataForm.name,
});
})
.catch(() => {
this.$emit('refreshDataList');
});
}); });
} }
}); });
@ -431,7 +452,7 @@ export default {
}, },
getDict() { getDict() {
// //
getProductList().then((res) => { getProductAll().then((res) => {
this.productList = res.data || []; this.productList = res.data || [];
}); });
// 线 // 线

View File

@ -1,311 +0,0 @@
<!--
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: DY
* @LastEditTime: 2024-07-19 18:59:13
* @Description:
-->
<template>
<el-drawer
:visible.sync="visible"
:show-close="false"
:wrapper-closable="false"
class="drawer"
size="55%">
<small-title slot="title" :no-padding="true">
{{ '分配产量' }}
</small-title>
<div class="content">
<div class='formContainer'>
<el-row :gutter="20">
<el-col :span="12"><span class='label'>工单名称</span><span class='text'>{{ dataForm.name }}</span></el-col>
<el-col :span="12"><span class='label'>工单编码</span><span class='text'>{{ dataForm.code }}</span></el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12"><span class='label'>产品名称</span><span class='text'>{{ dataForm.productName }}</span></el-col>
<el-col :span="12"><span class='label'>产品规格</span><span class='text'>{{ dataForm.specifications }}</span></el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12"><span class='label'>实际生产数量</span><span class='text'>{{ dataForm.actualQuantity }}</span></el-col>
</el-row>
</div>
<div class="attr-list">
<!-- <el-button v-show="!isdetail" type="success" size="small" style="float: right" @click="addRow()">添加一行</el-button> -->
<el-table
border
:data="tableData"
:header-cell-style="{
background: '#F2F4F9',
color: '#606266'
}"
style="width: 100%">
<el-table-column type="index" label="序号" width='50' align="center" />
<el-table-column prop="orderName" label="订单名称" />
<el-table-column prop="orderCode" label="订单编码" />
<el-table-column prop="priority" label="优先级" />
<el-table-column prop="planAssignmentQuantity" label="计划分配数量" >
<template slot-scope="scope">
<el-input v-model="scope.row.planAssignmentQuantity" :disabled="scope.row.actualAssignmentQuantity"></el-input>
</template>
</el-table-column>
<el-table-column prop="actualAssignmentQuantity" label="实际分配数量">
<template slot-scope="scope">
<el-input v-model="scope.row.actualAssignmentQuantity" :disabled="scope.row.actualAssignmentQuantity"></el-input>
</template>
</el-table-column>
<el-table-column label="操作" width='50' align="center" fixed='right'>
<template slot-scope="scope">
<el-button type="text" size="small" @click="saveData(scope.row)">保存</el-button>
<!-- <el-tooltip v-if="!scope.row.isEdit" placement="top" content="编辑">
<el-button
type="text"
:style="{color:'#0B58FF'}"
size="mini"
@click="edit(scope.row)"
>
<svg-icon style="width: 18px; height: 18px" class="item-icon" icon-class="edit" />
</el-button>
</el-tooltip> -->
<!-- <el-tooltip placement="top" content="删除">
<el-button
type="text"
:style="{color:'#FF5454'}"
size="mini"
@click="deleteDetail(scope.row)"
>
<svg-icon style="width: 18px; height: 18px" class="item-icon" icon-class="table_delete" />
</el-button>
</el-tooltip> -->
</template>
</el-table-column>
</el-table>
<pagination
v-show="listQuery.total > 0"
:total="listQuery.total"
:page.sync="listQuery.pageNo"
:limit.sync="listQuery.pageSize"
:page-sizes="[5, 10, 15]"
@pagination="getList" />
</div>
<div class="drawer-body__footer">
<el-button style="" type="primary" @click="goback()">关闭</el-button>
<!-- <el-button v-if="isdetail" type="primary" @click="goEdit()">
编辑
</el-button>
<el-button v-else type="primary" @click="dataFormSubmit()">确定</el-button> -->
</div>
</div>
<!-- <attr-add
v-if="addOrUpdateVisible"
ref="addOrUpdate"
:material-id="dataForm.id"
@refreshDataList="getList" /> -->
</el-drawer>
</template>
<script>
import basicAdd from '../../core/mixins/basic-add';
import { getConOrderList, createConCoreWOr, getCoreWO } from '@/api/base/coreWorkOrder';
import SmallTitle from './SmallTitle';
// import { parseTime } from '../../core/mixins/code-filter';
// import attrAdd from './attr-add';
export default {
mixins: [basicAdd],
components: { SmallTitle },
data() {
return {
addOrUpdateVisible: false,
urlOptions: {
infoURL: getCoreWO,
},
listQuery: {
pageSize: 10,
pageNo: 1,
total: 0,
},
dataForm: {
id: undefined,
code: undefined,
productId: '',
remark: undefined,
},
productList: [],
materialAttrList: [],
materialList: [],
tableData: [],
visible: false,
isdetail: false,
idAttrShow: false
};
},
mounted() {},
methods: {
initData() {
// this.materialAttrList.splice(0);
this.listQuery.total = 0;
},
edit(row) {
row.isEdit = true
},
saveData(row) {
if (row.actualAssignmentQuantity) {
if (row.id) {
// updateMaterialPBDet({
// ...row
// }).then((response) => {
// this.$modal.msgSuccess('');
// // this.visible = false;
// this.getList();
// });
// return;
}
//
createConCoreWOr({
...row,
workOrderId: this.dataForm.id
}).then((response) => {
this.$modal.msgSuccess('分配成功');
// this.visible = false;
this.getList();
});
} else {
this.$message.warning('请填写实际分配数量');
}
},
getList() {
// Bom
getConOrderList({
...this.listQuery,
workOrderId: this.dataForm.id
}).then((response) => {
this.tableData = response.data.map(item => {
item.isEdit = false
return item
});
this.listQuery.total = response.data.total;
});
},
//
// addRow() {
// const row = {
// bomId: this.dataForm.id,
// materialId: '',
// num: 0,
// materialCode: undefined,
// unit: undefined,
// remark: '',
// isEdit: true
// }
// this.tableData.push(row)
// },
init(id, isdetail) {
this.initData();
this.isdetail = isdetail || false;
this.dataForm.id = id || undefined;
this.visible = true;
// if (id) {
// this.idAttrShow = true
// } else {
// this.idAttrShow = false
// }
this.$nextTick(() => {
// this.$refs['dataForm'].resetFields();
if (this.dataForm.id) {
//
this.urlOptions.infoURL(id).then(response => {
this.dataForm = response.data;
});
//
this.getList();
} else {}
});
},
goback() {
this.$emit('refreshDataList');
this.visible = false;
// this.initData();
},
goEdit() {
this.isdetail = false;
},
// /
addNew(id) {
this.addOrUpdateVisible = true;
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id);
});
}
}
};
</script>
<style scoped>
.drawer >>> .el-drawer {
border-radius: 8px 0 0 8px;
display: flex;
flex-direction: column;
}
.drawer >>> .el-form-item__label {
padding: 0;
}
.drawer >>> .el-drawer__header {
margin: 0;
padding: 32px 32px 24px;
border-bottom: 1px solid #dcdfe6;
}
.drawer >>> .el-drawer__body {
flex: 1;
height: 1px;
display: flex;
flex-direction: column;
}
.drawer >>> .content {
padding: 30px 24px;
flex: 1;
display: flex;
flex-direction: column;
/* height: 100%; */
}
.drawer >>> .visual-part {
flex: 1 auto;
max-height: 30vh;
overflow: hidden;
overflow-y: scroll;
padding-right: 10px; /* 调整滚动条样式 */
}
.drawer >>> .el-form {
padding: 0 16px;
}
.drawer-body__footer {
display: flex;
justify-content: flex-end;
padding: 18px;
}
.formContainer {
.label {
display: inline-block;
padding: 5px 0px;
font-size: 14px;
font-weight: 600;
}
.text {
display: inline-block;
padding: 5px 0px;
font-size: 14px;
color:rgba(102, 102, 102, 0.75);
}
margin-bottom: 10px;
}
</style>

View File

@ -31,6 +31,7 @@
</div> </div>
<div class="attr-list"> <div class="attr-list">
<!-- <el-button v-show="!isdetail" type="success" size="small" style="float: right" @click="addRow()">添加一行</el-button> -->
<el-table <el-table
border border
:data="tableData" :data="tableData"
@ -42,32 +43,76 @@
<el-table-column type="index" label="序号" width='50' align="center" /> <el-table-column type="index" label="序号" width='50' align="center" />
<el-table-column prop="orderName" label="订单名称" /> <el-table-column prop="orderName" label="订单名称" />
<el-table-column prop="orderCode" label="订单编码" /> <el-table-column prop="orderCode" label="订单编码" />
<el-table-column prop="priority" label="优先级"> <el-table-column prop="priority" label="优先级" />
<el-table-column prop="planAssignmentQuantity" label="计划分配数量" >
<template slot-scope="scope"> <template slot-scope="scope">
{{scope.row.priority == 1 ? '低' : scope.row.priority == 2 ? '正常' : scope.row.priority == 3 ? '高' : ''}} <el-input v-model="scope.row.planAssignmentQuantity" :disabled="scope.row.actualAssignmentQuantity"></el-input>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="planAssignmentQuantity" label="计划分配数量" />
<el-table-column prop="actualAssignmentQuantity" label="实际分配数量"> <el-table-column prop="actualAssignmentQuantity" label="实际分配数量">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input-number :disabled='isSaved' v-model="scope.row.actualAssignmentQuantity" style='width: 100%;' controls-position="right" :min="0" :max="dataForm.actualQuantity"></el-input-number> <el-input v-model="scope.row.actualAssignmentQuantity" :disabled="scope.row.actualAssignmentQuantity"></el-input>
</template>
</el-table-column>
<el-table-column label="操作" width='50' align="center" fixed='right'>
<template slot-scope="scope">
<el-button type="text" size="small" @click="saveData(scope.row)">保存</el-button>
<!-- <el-tooltip v-if="!scope.row.isEdit" placement="top" content="编辑">
<el-button
type="text"
:style="{color:'#0B58FF'}"
size="mini"
@click="edit(scope.row)"
>
<svg-icon style="width: 18px; height: 18px" class="item-icon" icon-class="edit" />
</el-button>
</el-tooltip> -->
<!-- <el-tooltip placement="top" content="删除">
<el-button
type="text"
:style="{color:'#FF5454'}"
size="mini"
@click="deleteDetail(scope.row)"
>
<svg-icon style="width: 18px; height: 18px" class="item-icon" icon-class="table_delete" />
</el-button>
</el-tooltip> -->
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<pagination
v-show="listQuery.total > 0"
:total="listQuery.total"
:page.sync="listQuery.pageNo"
:limit.sync="listQuery.pageSize"
:page-sizes="[5, 10, 15]"
@pagination="getList" />
</div> </div>
<div class="drawer-body__footer"> <div class="drawer-body__footer">
<el-button plain type="primary" @click="goback()">关闭</el-button> <el-button style="" type="primary" @click="goback()">关闭</el-button>
<el-button type="primary" @click="saveData()" :disabled='isSaved'>保存</el-button> <!-- <el-button v-if="isdetail" type="primary" @click="goEdit()">
编辑
</el-button>
<el-button v-else type="primary" @click="dataFormSubmit()">确定</el-button> -->
</div> </div>
</div> </div>
<!-- <attr-add
v-if="addOrUpdateVisible"
ref="addOrUpdate"
:material-id="dataForm.id"
@refreshDataList="getList" /> -->
</el-drawer> </el-drawer>
</template> </template>
<script> <script>
import basicAdd from '../../core/mixins/basic-add'; import basicAdd from '../../core/mixins/basic-add';
import { getConOrderList, updateBatch, getCoreWO } from '@/api/base/coreWorkOrder'; import { getConOrderList, createConCoreWOr, getCoreWO } from '@/api/base/coreWorkOrder';
import SmallTitle from './SmallTitle'; import SmallTitle from './SmallTitle';
// import { parseTime } from '../../core/mixins/code-filter';
// import attrAdd from './attr-add';
export default { export default {
mixins: [basicAdd], mixins: [basicAdd],
@ -78,51 +123,100 @@ export default {
urlOptions: { urlOptions: {
infoURL: getCoreWO, infoURL: getCoreWO,
}, },
listQuery: {
pageSize: 10,
pageNo: 1,
total: 0,
},
dataForm: { dataForm: {
id: undefined, id: undefined,
code: undefined, code: undefined,
productId: '', productId: '',
remark: undefined, remark: undefined,
}, },
productList: [],
materialAttrList: [],
materialList: [],
tableData: [], tableData: [],
visible: false, visible: false,
isSaved:false isdetail: false,
idAttrShow: false
}; };
}, },
mounted() {}, mounted() {},
methods: { methods: {
saveData() { initData() {
console.log(this.tableData) // this.materialAttrList.splice(0);
let sunNum = 0 this.listQuery.total = 0;
this.tableData.forEach(row => { },
sunNum+=(row.actualAssignmentQuantity || 0) edit(row) {
}) row.isEdit = true
if (sunNum > this.dataForm.actualQuantity) { },
this.$message.warning('各订单实际分配数量之和不能大于实际生产数量'); saveData(row) {
return if (row.actualAssignmentQuantity) {
if (row.id) {
// updateMaterialPBDet({
// ...row
// }).then((response) => {
// this.$modal.msgSuccess('');
// // this.visible = false;
// this.getList();
// });
// return;
}
//
createConCoreWOr({
...row,
workOrderId: this.dataForm.id
}).then((response) => {
this.$modal.msgSuccess('分配成功');
// this.visible = false;
this.getList();
});
} else {
this.$message.warning('请填写实际分配数量');
} }
updateBatch(this.tableData).then((response) => {
this.$modal.msgSuccess('分配成功');
this.isSaved = true;
});
}, },
getList() { getList() {
// Bom // Bom
getConOrderList({ getConOrderList({
...this.listQuery,
workOrderId: this.dataForm.id workOrderId: this.dataForm.id
}).then((response) => { }).then((response) => {
this.tableData = response.data.map(item => { this.tableData = response.data.map(item => {
item.actualAssignmentQuantity = item.actualAssignmentQuantity || 0 item.isEdit = false
item.workOrderId = this.dataForm.id
return item return item
}); });
this.listQuery.total = response.data.total;
}); });
}, },
init(id) { //
// addRow() {
// const row = {
// bomId: this.dataForm.id,
// materialId: '',
// num: 0,
// materialCode: undefined,
// unit: undefined,
// remark: '',
// isEdit: true
// }
// this.tableData.push(row)
// },
init(id, isdetail) {
this.initData();
this.isdetail = isdetail || false;
this.dataForm.id = id || undefined; this.dataForm.id = id || undefined;
this.visible = true; this.visible = true;
this.isSaved = false; // if (id) {
// this.idAttrShow = true
// } else {
// this.idAttrShow = false
// }
this.$nextTick(() => { this.$nextTick(() => {
// this.$refs['dataForm'].resetFields();
if (this.dataForm.id) { if (this.dataForm.id) {
// //
this.urlOptions.infoURL(id).then(response => { this.urlOptions.infoURL(id).then(response => {
@ -136,6 +230,17 @@ export default {
goback() { goback() {
this.$emit('refreshDataList'); this.$emit('refreshDataList');
this.visible = false; this.visible = false;
// this.initData();
},
goEdit() {
this.isdetail = false;
},
// /
addNew(id) {
this.addOrUpdateVisible = true;
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id);
});
} }
} }
}; };

View File

@ -27,7 +27,6 @@
<div class="content"> <div class="content">
<div> <div>
<h1 class='orderTitle'>工单编码{{ dataForm.code }}</h1> <h1 class='orderTitle'>工单编码{{ dataForm.code }}</h1>
<el-button type="primary" plain style='position: absolute;right: 16px;top:5px' v-show="workOrderButton.length === 0" @click='goWorkOrderList()'><svg-icon icon-class="return" />返回</el-button>
</div> </div>
<small-title style="margin: 16px 0" size="sm" :no-padding="true"> <small-title style="margin: 16px 0" size="sm" :no-padding="true">
基本信息 基本信息
@ -95,10 +94,10 @@
@clickBtn="handleClick" /> @clickBtn="handleClick" />
</base-table> </base-table>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="预计用料" name="material"> <!-- <el-tab-pane label="预计用料信息" name="material">
<base-table :max-height="tableH" :table-props="tableProps1" :page="listQuery1.pageNo" <base-table :max-height="tableH" :table-props="tableProps1" :page="listQuery1.pageNo"
:limit="listQuery1.pageSize" :table-data="materialList" /> :limit="listQuery1.pageSize" :table-data="materialList" />
</el-tab-pane> </el-tab-pane> -->
<el-tab-pane label="质量信息" name="quality"> <el-tab-pane label="质量信息" name="quality">
<base-table :max-height="tableH" :table-props="tablePropsQuality" :table-data="qualityList" :page="1" <base-table :max-height="tableH" :table-props="tablePropsQuality" :table-data="qualityList" :page="1"
:limit="10" /> :limit="10" />
@ -353,9 +352,6 @@ export default {
} }
}, },
methods: { methods: {
goWorkOrderList() {
this.$router.go(-1);
},
getId(val) { getId(val) {
this.workOrderId = val this.workOrderId = val
}, },

View File

@ -4,6 +4,7 @@
:formConfigs="formConfig" :formConfigs="formConfig"
ref="searchBarForm" ref="searchBarForm"
@headBtnClick="buttonClick" /> @headBtnClick="buttonClick" />
<el-button @click='testtest'>test测试分配产量的按钮</el-button>
<base-table <base-table
v-loading="dataListLoading" v-loading="dataListLoading"
:table-props="tableProps" :table-props="tableProps"
@ -130,7 +131,17 @@ export default {
{ {
name: 'status', name: 'status',
type: 'equal', type: 'equal',
value: 1 value: 2
},
{
name: 'status',
type: 'equal',
value: 3
},
{
name: 'status',
type: 'equal',
value: 4
} }
] ]
} }
@ -348,6 +359,12 @@ export default {
this.getDataList() this.getDataList()
}, },
methods: { methods: {
testtest() {
this.allocationVisible = true;
this.$nextTick(() => {
this.$refs.allocation.init("1854697306771206146", true);
});
},
getWorkOrder() { getWorkOrder() {
getCoreWOList().then(res => { getCoreWOList().then(res => {
this.formConfig[0].selectOptions = res.data.map(item => { this.formConfig[0].selectOptions = res.data.map(item => {
@ -472,6 +489,7 @@ export default {
switch (val.btnName) { switch (val.btnName) {
case 'search': case 'search':
this.listQuery.pageNo = 1; this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.name = val.name ? val.name : undefined; this.listQuery.name = val.name ? val.name : undefined;
this.listQuery.status = val.status ? val.status : undefined; this.listQuery.status = val.status ? val.status : undefined;
this.listQuery.startProduceTime = val.time ? val.time : undefined this.listQuery.startProduceTime = val.time ? val.time : undefined
@ -480,6 +498,7 @@ export default {
case 'reset': case 'reset':
this.$refs.searchBarForm.resetForm(); this.$refs.searchBarForm.resetForm();
this.listQuery = { this.listQuery = {
pageSize: 10,
pageNo: 1, pageNo: 1,
total: 1, total: 1,
}; };