订单管理

This commit is contained in:
2024-02-23 17:01:48 +08:00
parent 2ee2b2bfc7
commit 71fc98b0bb
14 changed files with 786 additions and 862 deletions

View File

@@ -27,14 +27,19 @@
<el-option
v-for="item in productList"
:key="item.id"
:label="item.name+' | '+item.specifications"
:label="item.name"
: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-form-item>
</el-col>
<el-col :span='6'>
<el-form-item label="产品规格" prop="specifications">
<el-input v-model="form.specifications" disabled></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span='6'>
<el-form-item label="计划开始时间">
<el-date-picker
@@ -47,8 +52,6 @@
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span='6'>
<el-form-item label="计划完成时间">
<el-date-picker
@@ -71,9 +74,11 @@
<el-input-number v-model="form.planQuantity" :min="0" :max="9999999999999" :disabled="isBind" style="width: 100%;"></el-input-number>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span='6'>
<el-form-item label="关联工艺" prop="processFlowId">
<el-select v-model="form.processFlowId" placeholder="请选择" disabled style="width: 100%;">
<el-select v-model="form.processFlowId" placeholder="请选择" :disabled="isBind" style="width: 100%;">
<el-option
v-for="item in processFlowList"
:key="item.id"
@@ -83,11 +88,9 @@
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span='6'>
<el-form-item label="物料计算方式" prop="materialMethod">
<el-select v-model="form.materialMethod" placeholder="请选择" style="width: 100%;" disabled>
<el-select v-model="form.materialMethod" placeholder="请选择" style="width: 100%;" :disabled="isBind" @change='selectMethod'>
<el-option label="产品基础BOM" :value="1"></el-option>
<el-option label="工艺扩展BOM" :value="2"></el-option>
</el-select>
@@ -117,42 +120,42 @@
</el-select>
</el-form-item>
</el-col>
<el-col :span='6'>
<el-form-item label="优先级" prop="priority">
<el-select v-model="form.priority" placeholder="请选择" style="width: 100%;" :disabled="isBind">
<el-option
v-for="item in getDictDatas(DICT_TYPE.WORK_SHOP)"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span='6'>
<el-form-item label="关联产线" prop="productLineId">
<el-select v-model="form.productLineId" placeholder="请选择" multiple style="width: 100%;" :disabled="isBind">
<el-option
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="workers">
<el-input v-model="form.workers" :disabled="isBind"></el-input>
</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-form-item label="关联产线" prop="productLineId">
<el-select v-model="form.productLineId" placeholder="请选择" multiple style="width: 100%;" :disabled="isBind">
<el-option
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="roomNameDict">
<el-select v-model="form.roomNameDict" placeholder="请选择" style="width: 100%;" :disabled="isBind">
<el-option
v-for="item in getDictDatas(DICT_TYPE.WORK_SHOP)"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span='6'>
<el-form-item label="负责人" prop="workers">
<el-input v-model="form.workers" :disabled="isBind"></el-input>
</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-row>
</el-form>
</template>
@@ -171,6 +174,7 @@ export default {
name: '',
code: '',
planProductId: '',
specifications: '',
planStartTime: '',
planFinishTime: '',
planAssignQuantity: 0,
@@ -179,6 +183,7 @@ export default {
materialMethod: 1,
priority: '',
productLineId: [],
roomNameDict: '',
type: '',
workers: '',
planAssignmentQuantity: ''
@@ -188,7 +193,9 @@ export default {
planProductId: [{ required: true, message: "产品名称不能为空", trigger: "change" }],
planAssignQuantity: [{ required: true, message: "计划投入数量不能为空", trigger: "blur" }],
planQuantity: [{ required: true, message: "计划生产数量不能为空", trigger: "blur" }],
materialMethod: [{ required: true, message: "物料计算方式不能为空", trigger: "change" }],
productLineId: [{ required: true, message: "产线不能为空", trigger: "change" }],
roomNameDict: [{ required: true, message: "负责车间不能为空", trigger: "change" }],
planAssignmentQuantity: [{ required: true, message: "计划分配订单量不能为空", trigger: "blur" }]
},
productList: [],
@@ -214,8 +221,8 @@ export default {
this.form.code = res.data || ''
})
this.form.planProductId = data.planProductId
this.form.processFlowId = data.processFlowId
this.form.materialMethod = data.materialMethod
// this.form.processFlowId = data.processFlowId
// this.form.materialMethod = data.materialMethod
}else{//绑定
this.isBind = true
}
@@ -224,6 +231,9 @@ export default {
// 产品
getProductAll().then(res => {
this.productList = res.data || []
if (this.form.planProductId) {
this.getSpecifications(this.form.planProductId)
}
})
// 产线
getLineAll().then(res => {
@@ -240,44 +250,60 @@ export default {
this.workOrderList = res.data || []
})
},
// 物料变动
selectMethod(val) {
if (val === 2 && !this.form.processFlowId ) {
this.form.materialMethod = 1
this.$modal.msgError("请先选择关联工艺");
}else if (val === 1) {
this.form.processFlowId = ''
}
},
addWorkOrderSubmit() {
this.$refs['addWorkOrder'].validate((valid) => {
if (valid) {
if (this.isBind) {
//绑定工单
orderIssue({
workOrderId: this.form.workOrderId,
orderId: this.form.orderId,
planAssignmentQuantity: this.form.planAssignmentQuantity
}).then((res) => {
if (res.code === 0) {
this.$modal.msgSuccess("操作成功")
this.$emit('addWorkOrderSubmit')
}
})
} else {
// 新增工单
let _this = this
_this.form.planStartTime = _this.planStartTime ? new Date(_this.planStartTime).valueOf() : ''
_this.form.planFinishTime = _this.planFinishTime ? new Date(_this.planFinishTime).valueOf() : ''
orderIssue({ ..._this.form }).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)
})
})
}
})
}
} else {
if (this.isBind) {//绑定工单
if (!this.form.workOrderId) {
this.$modal.msgError("工单名称不能为空");
return false
}
})
if (!this.form.planAssignmentQuantity) {
this.$modal.msgError("计划分配订单量不能为空");
return false
}
orderIssue({
workOrderId: this.form.workOrderId,
orderId: this.form.orderId,
planAssignmentQuantity: this.form.planAssignmentQuantity
}).then((res) => {
if (res.code === 0) {
this.$modal.msgSuccess("操作成功")
this.$emit('addWorkOrderSubmit')
}
})
}else{// 新增工单
this.$refs['addWorkOrder'].validate((valid) => {
if (valid) {
// 新增工单
let _this = this
_this.form.planStartTime = _this.planStartTime ? new Date(_this.planStartTime).valueOf() : ''
_this.form.planFinishTime = _this.planFinishTime ? new Date(_this.planFinishTime).valueOf() : ''
orderIssue({ ..._this.form }).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)
})
})
}
})
} else {
return false
}
})
}
},
formClear() {
this.$refs.addWorkOrder.resetFields()
@@ -307,9 +333,23 @@ export default {
this.form.productLineId = res.data.productLineIds
this.form.type = res.data.type
this.form.workers = res.data.workers
this.form.roomNameDict = (res.data.roomNameDict || res.data.roomNameDict === 0) ? res.data.roomNameDict + '' : ''
setTimeout(() => {
this.getSpecifications(this.form.planProductId)
}, 300);
}
})
}
},
// 获取产品规格
getSpecifications(val) {
for (let i of this.productList) {
if (i.id === val) {
this.form.specifications = i.specifications
return
}
}
this.form.specifications = ''
}
}
}

View File

@@ -7,7 +7,7 @@
</el-form-item>
</el-col>
<el-col :span='6'>
<el-form-item label="订单" prop="code">
<el-form-item label="订单编码" prop="code">
<el-input v-model="form.code"></el-input>
</el-form-item>
</el-col>
@@ -36,17 +36,15 @@
<el-option
v-for="item in productList"
:key="item.id"
:label="item.name+' | '+(item.specifications || '')"
:label="item.name"
: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-form-item>
</el-col>
<el-col :span='6'>
<el-form-item label="产品规格" prop="specifications">
<el-input v-model="form.specifications"></el-input>
<el-input v-model="form.specifications" disabled></el-input>
</el-form-item>
</el-col>
<el-col :span='6'>
@@ -126,9 +124,11 @@ export default {
this.form.planProductId = res.data.planProductId
this.form.priority = res.data.priority ? res.data.priority + '' : ''
this.form.planStartTime = res.data.planStartTime ? res.data.planStartTime : null
this.getSpecifications(this.form.planProductId)
this.form.planFinishTime = res.data.planFinishTime ? res.data.planFinishTime : null
this.form.remark = res.data.remark
setTimeout(() => {
this.getSpecifications(this.form.planProductId)
}, 300);
}
})
} else {

View File

@@ -0,0 +1,108 @@
<template>
<div class="topTab">
<div class="arr leftArr" @click='toLeft'></div>
<div class="arr rightArr" @click='toRight'></div>
<el-scrollbar ref="groupTeamScroll" :vertical="false" class="scrollTab">
<ul class="tabBox">
<li :class="{'active':orderId===item.id}" v-for="(item, index) in orderIdList" :key='index' @click='toggleName(item.id)'>{{item.name}}</li>
</ul>
</el-scrollbar>
</div>
</template>
<script>
export default {
name: 'TopTab',
data() {
return {
}
},
props:['orderIdList','orderId'],
computed: {
scrollWrapper() {
return this.$refs.groupTeamScroll.$refs.wrap
}
},
methods:{
toLeft() {
const container = this.scrollWrapper
container.scrollLeft-=100
},
toRight() {
const container = this.scrollWrapper
container.scrollLeft+=100
},
toggleName(val) {
this.$emit('emitFun',val)
}
}
}
</script>
<style lang="scss" scoped>
.topTab {
height: 56px;
padding: 0px 48px 0px 56px;
position: relative;
.arr {
position: absolute;
width: 48px;
height: 48px;
line-height: 48px;
background-color: #fff;
border-radius: 8px;
cursor: pointer;
}
.leftArr{
left: 0;
padding-left: 10px;
}
.leftArr::before{
display: inline-block;
content: '';
width: 0;
height: 0;
border-width: 8px;
border-style: solid;
border-color: transparent #0B58FF transparent transparent;
}
.rightArr{
right: 0;
top:0;
padding-left: 22px;
}
.rightArr::before{
display: inline-block;
content: '';
width: 0;
height: 0;
border-width: 8px;
border-style: solid;
border-color: transparent transparent transparent #0B58FF;
}
.scrollTab{
white-space: nowrap;
overflow: hidden;
font-size: 16px;
width: 100%;
height: 100%;
ul,li{
list-style: none;
margin: 0;
padding: 0;
}
.tabBox >.active {
border-bottom: 4px solid #0B58FF;
}
.tabBox>li {
display: inline-block;
height: 48px;
line-height: 48px;
background: #FFFFFF;
border-radius: 8px;
padding: 0px 10px;
margin-right: 8px;
cursor: pointer;
}
}
}
</style>

View File

@@ -70,17 +70,13 @@ const tableProps = [
{
prop: 'name',
label: '订单名称',
minWidth: 120,
minWidth: 140,
showOverflowtooltip: true
},
{
prop: 'code',
label: '订单编码',
minWidth: 180
},
{
prop: 'customerId',
label: '客户',
minWidth: 150,
showOverflowtooltip: true
},
{
@@ -111,6 +107,7 @@ const tableProps = [
{
prop: 'productName',
label: '产品',
width: 200,
showOverflowtooltip: true
},
{
@@ -187,7 +184,7 @@ export default {
},
total: 0,
tableProps,
list: [{name: '111111'}],
list: [],
tableH: this.tableHeight(260),
tableBtn: [
this.$auth.hasPermi('base:order-manage:addWorkOrder')
@@ -195,26 +192,16 @@ export default {
type: 'add',
btnName: '新增',
showTip: '新增工单',
// showParam: {
// type: '|',
// data: [
// {
// type: 'equal',
// name: 'status',
// value: 1
// },
// {
// type: 'equal',
// name: 'status',
// value: 2
// },
// {
// type: 'equal',
// name: 'status',
// value: 3
// }
// ]
// }
showParam: {
type: '&',
data: [
{
type: 'less',
name: 'status',
value: 3
}
]
}
}
: undefined,
this.$auth.hasPermi('base:order-manage:bindWorkOrder')
@@ -222,41 +209,26 @@ export default {
type: 'bind',
btnName: '绑定',
showTip: '绑定工单',
// showParam: {
// type: '|',
// data: [
// {
// type: 'equal',
// name: 'status',
// value: 1
// },
// {
// type: 'equal',
// name: 'status',
// value: 2
// },
// {
// type: 'equal',
// name: 'status',
// value: 3
// }
// ]
// }
showParam: {
type: '&',
data: [
{
type: 'less',
name: 'status',
value: 3
}
]
}
}
: undefined,
this.$auth.hasPermi('base:order-manage:bindWorkOrder')
this.$auth.hasPermi('base:order-manage:complete')
? {
type: 'complete',
btnName: '完成',
showTip: '完成订单',
showParam: {
type: '|',
type: '&',
data: [
{
type: 'equal',
name: 'status',
value: 2
},
{
type: 'equal',
name: 'status',
@@ -266,16 +238,43 @@ export default {
}
}
: undefined,
this.$auth.hasPermi('base:order-manage:detail')
this.$auth.hasPermi('base:order-manage:termination')
? {
type: 'termination',
btnName: '终止'
btnName: '终止',
showTip: '终止',
showParam: {
type: '|',
data: [
{
type: 'equal',
name: 'status',
value: 2
},
{
type: 'equal',
name: 'status',
value: 3
}
]
}
}
: undefined,
this.$auth.hasPermi('base:order-manage:detail')
this.$auth.hasPermi('base:order-manage:cancel')
? {
type: 'cancel',
btnName: '作废'
btnName: '作废',
showTip: '作废',
showParam: {
type: '&',
data: [
{
type: 'less',
name: 'status',
value: 2
}
]
}
}
: undefined,
this.$auth.hasPermi('base:order-manage:detail')
@@ -292,14 +291,9 @@ export default {
type: '&',
data: [
{
type: 'equal',
name: 'triggerOrigin',
value: 1
},
{
type: 'equal',
type: 'less',
name: 'status',
value: 1
value: 3
}
]
}
@@ -319,7 +313,7 @@ export default {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(260)
})
// this.getList()
this.getList()
},
methods: {
getList() {
@@ -336,7 +330,7 @@ export default {
item.customerId = i.name
}
}
item.price = item.price.toFixed(2)
item.price = item.price ? item.price.toFixed(2) : '0.00'
})
this.list = arr
}
@@ -407,12 +401,38 @@ export default {
},
// 完成,终止,作废
handleEditStatus(val, tip, status) {
this.$modal.confirm('是否确认'+tip+'"' + val.name + '"?').then(function() {
return orderStatusSet({ id: val.id })
console.log(val)
if (val.workOrderNum > 0) {//有下级工单
this.$confirm('是否将"'+tip+'"操作同步至下级工单?','确认信息', {
type: 'warning',
distinguishCancelAndClose: true,
confirmButtonText: '同步',
cancelButtonText: '不同步'
}).then(function() {
console.log('同步')
orderStatusSet({ id: val.id, status: status, isSync: true}).then(() => {
this.getList();
this.$modal.msgSuccess("操作成功");
})
}).catch(action => {
if (action === 'cancel') {
console.log('不同步')
orderStatusSet({ id: val.id, status: status, isSync: false}).then(() => {
this.getList();
this.$modal.msgSuccess("操作成功");
})
}else {
return console.log('关闭')
}
})
}else{// 无下级工单
this.$modal.confirm('是否确认"'+tip+'"厂务订单名称为"' + val.name + '"的数据项?').then(function() {
return orderStatusSet({ id: val.id, status: status})
}).then(() => {
this.getList();
this.$modal.msgSuccess("操作成功");
}).catch(() => {});
}
},
// 新增
handleCancel() {

View File

@@ -1,11 +1,15 @@
<template>
<div class="orderDetailData">
<div v-show="!isSingle" style="position: relative;padding-right: 90px;">
<TopTab :orderIdList='orderIdList' :orderId="orderId" @emitFun='toggleName'/>
<el-button type="primary" plain size="small" style="position: absolute;right: 0; top: 0;height: 48px;font-size: 14px;" @click="returnOrderManage"><svg-icon icon-class="return"/> 返回</el-button>
</div>
<div class="box1">
<div class="boxTitle">
<span class="blueTitle"></span>
<span>订单编码: {{orderMsg.code}}</span>
</div>
<el-button type="primary" plain size="small" style="float: right;" @click="returnOrderManage"><svg-icon icon-class="return"/> 返回</el-button>
<el-button v-show="isSingle" type="primary" plain size="small" style="float: right;" @click="returnOrderManage"><svg-icon icon-class="return"/> 返回</el-button>
<div style="padding-left: 14px;">
<el-row>
<el-col :span='4'>
@@ -70,7 +74,7 @@
</el-col>
<el-col :span='4'>
<div class="blodTip">废片数量</div>
<div class="lightTip">{{orderMsg.nokQuantity}}</div>
<div class="lightTip">该字段未绑定</div>
</el-col>
</el-row>
</div>
@@ -89,26 +93,13 @@
:max-height="tableH"
/>
</div>
<div class="box3">
<div class="boxTitle">
<span class="blueTitle"></span>
<span>预计用料信息</span>
</div>
<!-- 列表 -->
<base-table
:page="queryParams.pageNo"
:limit="queryParams.pageSize"
:table-props="tableProps2"
:table-data="list2"
:max-height="tableH"
/>
</div>
</div>
</template>
<script>
import { parseTime } from '@/utils/ruoyi'
import { publicFormatter } from '@/utils/dict'
import { getProcessFlowList } from '@/api/base/orderManage'
import TopTab from './components/topTab'
const tableProps1 = [
{
prop: 'issueTime',
@@ -119,7 +110,7 @@ const tableProps1 = [
{
prop: 'name',
label: '工单名',
minWidth: 100,
minWidth: 160,
showOverflowtooltip: true
},
{
@@ -134,7 +125,7 @@ const tableProps1 = [
filter: publicFormatter('workshop')
},
{
prop: 'planAssignmentQuantity',
prop: 'planQuantity',
label: '计划加工量',
width: 100
},
@@ -173,39 +164,26 @@ const tableProps1 = [
},
{
prop: 'workers',
label: '负责人'
label: '负责人',
showOverflowtooltip: true
},
{
prop: 'remark',
label: '备注'
label: '备注',
showOverflowtooltip: true
}
]
const tableProps2 = [
{
prop: 'materialName',
label: '物料名称'
},
{
prop: 'unit',
label: '单位',
filter: publicFormatter('unit_dict')
},
{
prop: 'num',
label: '剩余生产预计消耗'
}
]
import { orderDetail, bomUseNum } from '@/api/base/orderManage'
import { orderDetail, getOrderList } from '@/api/base/orderManage'
export default {
name: 'OrderDetailData',
data() {
return {
orderId: '',
orderIdList: [], //订单监控跳转过来
isSingle: true,//单个详情false是多个详情
tableProps1,
tableProps2,
list1: [],
list2: [],
tableH: this.tableHeight(510) / 2,
tableH: this.tableHeight(420),
// 查询参数
queryParams: {
pageNo: 1,
@@ -215,45 +193,38 @@ export default {
processFlowName: ''
}
},
components:{ TopTab },
mounted() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(510) / 2
})
this.orderId = location.href.split('?')[1].split('=')[1]
this.getMsg()
},
watch: {
$route: 'initData'
if (this.$route.query.orderIdString && this.$route.query.orderIdString!=='undefined') {
getOrderList({ids:this.$route.query.orderIdString}).then(res => {
this.orderIdList = res.data.map(item => {
return {
id: item.id,
name: item.name
}
})
this.orderId = this.orderIdList[0].id
this.getMsg()
})
this.isSingle = false
console.log('aaaaa')
}else{
this.orderId = this.$route.query.orderId
this.isSingle = true
this.getMsg()
console.log('bbbbbbbbbb')
}
},
methods: {
initData(to) {
if (to.name === 'OrderDetailData') {
this.orderId = location.href.split('?')[1].split('=')[1]
this.getMsg()
}
},
getMsg() {
orderDetail({
id: this.orderId
}).then(res => {
this.orderMsg = res.data
this.list1 = res.data.coreWorkOrderRespVOS
bomUseNum({
productId: this.orderMsg.planProductId
}).then(res2 => {
if (res2.data && res2.data.length > 0) {
let arr = res2.data
arr.map(item => {
if (item) {
let a = item.num * this.orderMsg.remainingQuantity
item.num = !isNaN(parseFloat(a)) && isFinite(a) ? a : ''
}
})
this.list2 = arr
}else {
this.list2 = []
}
})
// 工艺
getProcessFlowList().then(res => {
let arr = res.data || []
@@ -269,7 +240,12 @@ export default {
},
// 返回
returnOrderManage() {
this.$router.push({path: '/order/base/order-manage'})
this.$router.go(-1)
},
// 切换tab获取订单详情
toggleName(val) {
this.orderId = val
this.getMsg()
}
}
}
@@ -277,14 +253,14 @@ export default {
<style lang='scss' scoped>
.orderDetailData {
background-color: rgb(242, 244, 249);
.box1, .box2, .box3 {
.box1, .box2{
background-color: #fff;
border-radius: 9px;
}
.box2 {
height: calc((100vh - 360px) / 2);
height: calc(100vh - 351px);
padding: 12px 16px 0;
margin: 8px 0;
margin-top: 8px;
}
.box1 {
height: 215px;
@@ -304,10 +280,6 @@ export default {
margin-bottom: 12px;
}
}
.box3 {
padding: 16px;
height: calc((100vh - 360px) / 2);
}
.boxTitle {
display: inline-block;
font-size: 16px;