Browse Source

noorder 推送

master
常熟吴彦祖 2 months ago
parent
commit
6f0189557e
  1. 244
      src/views/modules/noOrderIssue/newNoOrderIssueNotify.vue

244
src/views/modules/noOrderIssue/newNoOrderIssueNotify.vue

@ -5,7 +5,8 @@
<el-col :span="20"> <el-col :span="20">
<el-button v-if="notifyNo===''" @click="addNotify()" type="primary" class="yzzButtonAn">新建申请单</el-button> <el-button v-if="notifyNo===''" @click="addNotify()" type="primary" class="yzzButtonAn">新建申请单</el-button>
<el-button v-if="notifyNo!=''" type="primary" @click="chooseSOSModal()" class="yzzButtonAn">新增物料</el-button>
<!-- 只允许一条明细记录 不然后续推送给wcs 立库可能会有问题-->
<el-button v-if="notifyNo!=''" type="primary" :disabled="dataList.length>0" @click="chooseSOSModal()" class="yzzButtonAn">新增物料</el-button>
<el-button v-if="notifyNo!=''" type="primary" @click="xiadaNotify()" class="yzzButtonAn">下达申请单</el-button> <el-button v-if="notifyNo!=''" type="primary" @click="xiadaNotify()" class="yzzButtonAn">下达申请单</el-button>
<el-button v-if="notifyNo!=''" type="primary" @click="deleteNotify()" class="yzzButtonAn">删除申请单</el-button> <el-button v-if="notifyNo!=''" type="primary" @click="deleteNotify()" class="yzzButtonAn">删除申请单</el-button>
@ -98,7 +99,7 @@
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="10"> <el-col :span="10">
<el-form-item label="订单类型"> <el-form-item label="订单类型">
<el-radio-group v-model="orderType" size="small">
<el-radio-group v-model="orderType" :disabled="seqNoList.length>0" size="small">
<el-radio label="slittingorder">分切订单</el-radio> <el-radio label="slittingorder">分切订单</el-radio>
<el-radio label="shipment">销售发货</el-radio> <el-radio label="shipment">销售发货</el-radio>
<el-radio label="shoporder">成品订单</el-radio> <el-radio label="shoporder">成品订单</el-radio>
@ -106,7 +107,35 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row :gutter="20">
<el-row :gutter="20">
<el-col :span="4">
<el-form-item :label="'Order No'">
<el-input v-model="seqNoData.orderNo" @keyup.enter.native="searchSOSRouting()"></el-input>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item :label="'Release No'">
<el-input v-model="seqNoData.releaseNo"></el-input>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item :label="'Sequence No'">
<el-input v-model="seqNoData.sequenceNo"></el-input>
</el-form-item>
</el-col>
<el-col :span="2">
<el-form-item :label="' '">
<el-button type="primary" @click="addOrderToList" :loading="addOrderLoading"
class="">订单添加</el-button>
</el-form-item>
</el-col>
<el-col :span="10">
<el-form-item :label="'已添加订单(不保存)'" style="width: 100%">
<el-input v-model="remark" style="width: 100%" readonly></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="6"> <el-col :span="6">
<el-form-item label="物料号"> <el-form-item label="物料号">
<el-input v-model="partNo" @keyup.enter.native="addRowFromQuery"></el-input> <el-input v-model="partNo" @keyup.enter.native="addRowFromQuery"></el-input>
@ -115,12 +144,12 @@
<el-col :span="6"> <el-col :span="6">
<el-form-item label=" "> <el-form-item label=" ">
<el-button type="primary" @click="addRowFromQuery()" :loading="addLineLoading" <el-button type="primary" @click="addRowFromQuery()" :loading="addLineLoading"
class="">添加行</el-button>
class="">添加物料</el-button>
<el-button type="primary" @click="openSelectMaterialModal()" <el-button type="primary" @click="openSelectMaterialModal()"
class="">添加</el-button>
class="">选择物料</el-button>
<!-- <el-button type="primary" @click="importModel()" <!-- <el-button type="primary" @click="importModel()"
class="">导入</el-button> -->
</el-form-item>
class="">导入</el-button> -->
</el-form-item>
</el-col> </el-col>
</el-row> </el-row>
</el-form> </el-form>
@ -385,7 +414,9 @@ import {
getSOSBOMForIssureNew, getSOSBOMForIssureNew,
searchOtherPart, searchOtherPart,
xiadaNotify, xiadaNotify,
getShopOrderAndMaterialByShoporder,
} from '../../../api/orderIssure/soIssueNotify' } from '../../../api/orderIssure/soIssueNotify'
import { getShipmentAndLineForIssure } from '../../../api/shipment/shipmentIssue'
import { getTableUserListLanguage } from '../../../api/table' import { getTableUserListLanguage } from '../../../api/table'
export default { export default {
@ -725,24 +756,24 @@ export default {
fixed: false, fixed: false,
columnWidth: 80, columnWidth: 80,
}, },
{
userId: this.$store.state.user.name,
functionId: 555001,
serialNumber: '555001Table2FinishDate',
tableId: '555001Table2',
tableName: '查询工单及物料',
columnProp: 'height',
headerAlign: 'center',
align: 'center',
columnLabel: '高度',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: false,
columnWidth: 110,
},
// {
// userId: this.$store.state.user.name,
// functionId: 555001,
// serialNumber: '555001Table2FinishDate',
// tableId: '555001Table2',
// tableName: '',
// columnProp: 'height',
// headerAlign: 'center',
// align: 'center',
// columnLabel: '',
// columnHidden: false,
// columnImage: false,
// columnSortable: false,
// sortLv: 0,
// status: true,
// fixed: false,
// columnWidth: 110,
// },
{ {
userId: this.$store.state.user.name, userId: this.$store.state.user.name,
functionId: 555001, functionId: 555001,
@ -1088,6 +1119,9 @@ export default {
clickrow:{}, clickrow:{},
partNo:'', partNo:'',
addLineLoading:false, addLineLoading:false,
addOrderLoading:false, // loading - rqrq
remark:'', // () - rqrq
addedOrderNoList: [], // - rqrq
} }
}, },
@ -1549,6 +1583,9 @@ export default {
endDate: this.dayjs().format('YYYY-MM-DD'), endDate: this.dayjs().format('YYYY-MM-DD'),
} }
this.seqNoList = [] this.seqNoList = []
// - rqrq
this.addedOrderNoList = []
this.remark = ''
this.seqNoModalFlag = true this.seqNoModalFlag = true
}, },
searchSOSRouting() { searchSOSRouting() {
@ -1607,18 +1644,168 @@ export default {
this.seqNoData.releaseNo = '' this.seqNoData.releaseNo = ''
this.seqNoData.sequenceNo = '' this.seqNoData.sequenceNo = ''
}, },
// - rqrq
addOrderToList() {
// 1. - rqrq
if (!this.seqNoData.orderNo || this.seqNoData.orderNo.trim() === '') {
this.$message.warning('请输入Order No!')
return
}
// 2. - rqrq
if (this.addedOrderNoList.includes(this.seqNoData.orderNo)) {
this.$message.warning('该订单已添加过,请勿重复添加!')
return
}
// 3. API - rqrq
let apiMethod = null
if (this.orderType === 'shipment') {
// 使getShipmentAndLineForIssure - rqrq
apiMethod = getShipmentAndLineForIssure
} else {
// 使getShopOrderAndMaterialByShoporder - rqrq
apiMethod = getShopOrderAndMaterialByShoporder
}
// 4. - rqrq
const requestParams = {
site: this.$store.state.user.site,
orderNo: this.seqNoData.orderNo.trim(),
releaseNo: this.seqNoData.releaseNo || '*',
sequenceNo: this.seqNoData.sequenceNo || '*',
}
// 5. API - rqrq
this.addOrderLoading = true
apiMethod(requestParams)
.then(({ data }) => {
if (data && data.code === 0) {
// - rqrq
let materialList = data.rows || []
if (!materialList || materialList.length === 0) {
this.$message.warning('该订单没有物料明细!')
return
}
// 5. - API - rqrq
console.log('原始返回数据:', materialList) // - rqrq
materialList.forEach(item => {
if (this.orderType === 'shipment') {
// API - rqrq
// inventoryPartNo -> partNo - rqrq
if (item.inventoryPartNo && !item.partNo) {
item.partNo = item.inventoryPartNo
}
// inventoryQty -> applyQty - rqrq
if (item.inventoryQty !== undefined && !item.applyQty) {
item.applyQty = item.inventoryQty
}
// inventoryUom -> uom - rqrq
if (item.inventoryUom && !item.uom) {
item.uom = item.inventoryUom
}
// partDesc - rqrq
} else {
// /API - rqrq
// qtyRequired -> applyQty - rqrq
if (item.qtyRequired !== undefined && !item.applyQty) {
item.applyQty = item.qtyRequired
}
}
})
console.log('字段映射后数据:', materialList) // - rqrq
// 6. - rqrq
const backendMaterialMap = new Map()
materialList.forEach(item => {
const partNo = item.partNo || item.componentPartNo
if (!partNo) return
if (backendMaterialMap.has(partNo)) {
// - rqrq
const existing = backendMaterialMap.get(partNo)
existing.applyQty = (parseFloat(existing.applyQty) || 0) + (parseFloat(item.applyQty) || 0)
} else {
// - rqrq
backendMaterialMap.set(partNo, {
partNo: partNo,
componentPartNo: partNo,
height: item.height || '',
isInWh: item.isInWh || '',
applyQty: parseFloat(item.applyQty) || 0,
componentPartDesc: item.componentPartDesc || item.partDesc || '',
uom: item.uom || '',
orderNo: this.seqNoData.orderNo,
releaseNo: this.seqNoData.releaseNo || '',
sequenceNo: this.seqNoData.sequenceNo || '',
lineItemNo: '',
materialLineStatus: '',
startDate: '',
finishDate: '',
needDate: '',
remark: this.seqNoData.orderNo, // - rqrq
})
}
})
// 7. seqNoList - rqrq
this.seqNoList.forEach(existingItem => {
const partNo = existingItem.partNo || existingItem.componentPartNo
if (!partNo) return
if (backendMaterialMap.has(partNo)) {
// - rqrq
const backendItem = backendMaterialMap.get(partNo)
backendItem.applyQty = (parseFloat(backendItem.applyQty) || 0) + (parseFloat(existingItem.applyQty) || 0)
// - rqrq
if (existingItem.remark) {
backendItem.remark = existingItem.remark + ';' + this.seqNoData.orderNo
}
} else {
// seqNoList - rqrq
backendMaterialMap.set(partNo, existingItem)
}
})
// 8. seqNoList - rqrq
this.seqNoList = Array.from(backendMaterialMap.values())
console.log('更新后的seqNoList:', this.seqNoList) // - rqrq
// 9. - rqrq
this.addedOrderNoList.push(this.seqNoData.orderNo)
// - rqrq
this.remark = this.addedOrderNoList.join(';')
this.$message.success(`订单 ${this.seqNoData.orderNo} 添加成功,共 ${materialList.length} 条物料,汇总后 ${this.seqNoList.length} 行!`)
// 10. - rqrq
this.seqNoData.orderNo = ''
} else {
this.$message.error(data.msg || '获取订单物料失败!')
}
})
.catch((error) => {
this.$message.error(error.msg || '获取订单物料失败,请稍后重试')
})
.finally(() => {
this.addOrderLoading = false
})
},
// //
addRowFromQuery() { addRowFromQuery() {
if(!this.partNo){ if(!this.partNo){
this.$message.warning('请输入物料号!') this.$message.warning('请输入物料号!')
return return
} }
// seqNoList // seqNoList
if (!this.seqNoList) { if (!this.seqNoList) {
this.seqNoList = [] this.seqNoList = []
} }
// //
const queryParams = { const queryParams = {
site: this.$store.state.user.site, site: this.$store.state.user.site,
@ -1987,6 +2174,9 @@ export default {
.then(({ data }) => { .then(({ data }) => {
if (data.code === 0) { if (data.code === 0) {
this.seqNoModalFlag = false this.seqNoModalFlag = false
// - rqrq
this.addedOrderNoList = []
this.remark = ''
this.getUserNotifyNo() this.getUserNotifyNo()
this.$message.success('操作成功') this.$message.success('操作成功')
} else { } else {

Loading…
Cancel
Save