From a93255e0a0334b51ecbaf3d8f496ad0fae1ed747 Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期三, 07 六月 2023 10:38:00 +0800
Subject: [PATCH] 1.生产入库有源单提交测试OK
---
src/views/makeModel/meterPrice.vue | 10
src/views/produceManager/productWarehouse.vue | 316 +++++++++++++++++++++++++++++++++++++++-------------
2 files changed, 242 insertions(+), 84 deletions(-)
diff --git a/src/views/makeModel/meterPrice.vue b/src/views/makeModel/meterPrice.vue
index da32517..f8c506f 100644
--- a/src/views/makeModel/meterPrice.vue
+++ b/src/views/makeModel/meterPrice.vue
@@ -16,7 +16,7 @@
style="display: flex;"
>
<div class="elForm">
- <el-form-item label="浜у搧鍚嶇О" style=" display: flex;">
+ <el-form-item label="浜у搧鍚嶇О/缂栫爜" style=" display: flex;">
<el-select
v-model="form.partcode"
filterable
@@ -30,7 +30,7 @@
<el-option
v-for="item in partArr"
:key="item.partcode"
- :label="item.partname"
+ :label="item.partname+'/'+item.partcode"
:value="item.partcode"
/>
</el-select>
@@ -289,10 +289,10 @@
@closed="handleClose"
@close="handleClose"
>
- <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="80px">
+ <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="100px">
<div style="display: flex;align-items: center">
<i class="el-icon-s-comment" :style="{color:$store.state.settings.theme}" style="margin-top: -20px" />
- <el-form-item prop="partcode" label="浜у搧鍚嶇О">
+ <el-form-item prop="partcode" label="浜у搧鍚嶇О/缂栫爜">
<el-select
v-show="operation==='add'"
v-model="dialogForm.partcode"
@@ -306,7 +306,7 @@
<el-option
v-for="item in partArr2"
:key="item.partcode"
- :label="item.partname"
+ :label="item.partname+'/'+item.partcode"
:value="item.partcode"
/>
</el-select>
diff --git a/src/views/produceManager/productWarehouse.vue b/src/views/produceManager/productWarehouse.vue
index b5a692f..16fec01 100644
--- a/src/views/produceManager/productWarehouse.vue
+++ b/src/views/produceManager/productWarehouse.vue
@@ -220,7 +220,7 @@
/>
</el-form-item>
- <el-form-item label="鍏ュ簱浠撳簱" style=" display: flex;">
+ <el-form-item label="鍏ュ簱浠撳簱" required style=" display: flex;">
<el-select
v-model="form.stockcode"
:popper-append-to-body="false"
@@ -247,7 +247,7 @@
v-waves
type="primary"
icon="el-icon-s-promotion"
-
+ :disabled="$store.state.app.buttonIsDisabled"
@click="submit"
>鍏ュ簱鎻愪氦
</el-button>
@@ -303,32 +303,33 @@
label="搴忓彿"
/>
- <el-table-column
- prop="stockcode"
- label="浠撳簱"
- width="160"
- show-tooltip-when-overflow
- >
- <template slot-scope="{row}">
- <div
- v-if="!(row.index === tabClickIndex && tabClickLabel === '浠撳簱')"
- >
- {{ row.stockcode ? stockcodeArr.find(i => i.code === row.stockcode).name : '/' }}
- </div>
- <el-select
- v-if="row.index === tabClickIndex && tabClickLabel === '浠撳簱'"
- v-model="row.stockcode"
- placeholder="璇烽�夋嫨"
- >
- <el-option
- v-for="item in stockcodeArr"
- :key="item.code"
- :label="item.name"
- :value="item.code"
- />
- </el-select>
- </template>
- </el-table-column>
+ <!-- <el-table-column-->
+ <!-- prop="stockcode"-->
+ <!-- label="浠撳簱"-->
+ <!-- width="160"-->
+ <!-- show-tooltip-when-overflow-->
+ <!-- >-->
+ <!-- <template slot-scope="{row}">-->
+ <!-- <div>{{ row.stockcode ? stockcodeArr.find(i => i.code === row.stockcode).name : '/' }}</div>-->
+ <!-- <!– <div–>-->
+ <!-- <!– v-if="!(row.index === tabClickIndex && tabClickLabel === '浠撳簱')"–>-->
+ <!-- <!– >–>-->
+ <!-- <!– {{ row.stockcode ? stockcodeArr.find(i => i.code === row.stockcode).name : '/' }}–>-->
+ <!-- <!– </div>–>-->
+ <!-- <!– <el-select–>-->
+ <!-- <!– v-if="row.index === tabClickIndex && tabClickLabel === '浠撳簱'"–>-->
+ <!-- <!– v-model="row.stockcode"–>-->
+ <!-- <!– placeholder="璇烽�夋嫨"–>-->
+ <!-- <!– >–>-->
+ <!-- <!– <el-option–>-->
+ <!-- <!– v-for="item in stockcodeArr"–>-->
+ <!-- <!– :key="item.code"–>-->
+ <!-- <!– :label="item.name"–>-->
+ <!-- <!– :value="item.code"–>-->
+ <!-- <!– />–>-->
+ <!-- <!– </el-select>–>-->
+ <!-- </template>-->
+ <!-- </el-table-column>-->
<el-table-column
prop="inbarcode"
label="鍏ュ簱鏉$爜"
@@ -992,66 +993,223 @@
this.tableDataSummary = newData.flat()
},
- async submit() {
+ async submit() {
+ if (!this.form.stockcode) {
+ return this.$message.error('鍏ュ簱浠撳簱涓嶈兘涓虹┖锛�')
+ }
+ if (this.multipleSelection.length === 0) {
+ return this.$message.error('鏈�夋嫨浜у搧锛�')
+ }
await this.tabClick()
- // const openToken = await getTPlusToken() // 鑾峰彇TPlus token
- const openToken = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJpc3YiLCJpc3MiOiJjaGFuamV0IiwidXNlcklkIjoiMzkwNTU0MDg2NTMwMjYxIiwib3JnSWQiOiIxMjM0OTc5MDE3MjIxMDM3IiwiYWNjZXNzX3Rva2VuIjoiYmstOGIwNDUxNzEtMDk5Yy00ODFlLTgyZDEtY2Q5NWQ2MjUzZGUwIiwiYXVkIjoiaXN2IiwibmJmIjoxNjg2MDQ3NTgyLCJhcHBJZCI6IjU4Iiwic2NvcGUiOiJhdXRoX2FsbCIsImlkIjoiNjA5Y2ZhYzItNzZmOC00NzJiLWI2NGEtMDg1NmRjMWZmYTg4IiwiZXhwIjoxNjg2NTY1OTgyLCJpYXQiOjE2ODYwNDc1ODIsIm9yZ0FjY291bnQiOiJ1dXhicGtzbTBibmgifQ.slZ_ix3DoGBX2WUX1TOiwe7jCEqDHf9Kc-Gn6cVCFZk'
+ const openToken = await getTPlusToken() // 鑾峰彇TPlus token
+ // const openToken = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJpc3YiLCJpc3MiOiJjaGFuamV0IiwidXNlcklkIjoiMzkwNTU0MDg2NTMwMjYxIiwib3JnSWQiOiIxMjM0OTc5MDE3MjIxMDM3IiwiYWNjZXNzX3Rva2VuIjoiYmstOGIwNDUxNzEtMDk5Yy00ODFlLTgyZDEtY2Q5NWQ2MjUzZGUwIiwiYXVkIjoiaXN2IiwibmJmIjoxNjg2MDQ3NTgyLCJhcHBJZCI6IjU4Iiwic2NvcGUiOiJhdXRoX2FsbCIsImlkIjoiNjA5Y2ZhYzItNzZmOC00NzJiLWI2NGEtMDg1NmRjMWZmYTg4IiwiZXhwIjoxNjg2NTY1OTgyLCJpYXQiOjE2ODYwNDc1ODIsIm9yZ0FjY291bnQiOiJ1dXhicGtzbTBibmgifQ.slZ_ix3DoGBX2WUX1TOiwe7jCEqDHf9Kc-Gn6cVCFZk'
+
+ this.$store.state.app.buttonIsDisabled = true
// 鏈夋簮鍗�
- const RDRecordDetails = []
- this.tableDataSummary.forEach((i, index) => {
- RDRecordDetails.push({
- Code: index + 1, // 琛屽彿锛屼粠1寮�濮嬭嚜澧為暱
- SourceVoucherId: this.tableDataDetail[0].mpoid, // 鏉ユ簮鍗曟嵁鐨勫崟鎹甀D
- BaseQuantity: i.stinhouseqty, // 涓昏閲忓崟浣嶆暟閲�
- SourceVoucherDetailId: i.sourceVoucherDetailId, // 鏉ユ簮鍗曟嵁鐨勫搴旀槑缁咺D
- Inventory: {
- Code: i.materiel_code // 瀛樿揣缂栫爜
- },
- IdSourceVoucherType: 69
+ if (this.form.documentType === 'Y') {
+ const RDRecordDetails = []
+ this.tableDataSummary.forEach((i, index) => {
+ RDRecordDetails.push({
+ Code: index + 1, // 琛屽彿锛屼粠1寮�濮嬭嚜澧為暱
+ SourceVoucherId: this.tableDataDetail[0].mpoid, // 鏉ユ簮鍗曟嵁鐨勫崟鎹甀D
+ BaseQuantity: i.stinhouseqty, // 涓昏閲忓崟浣嶆暟閲�
+ SourceVoucherDetailId: i.sourceVoucherDetailId, // 鏉ユ簮鍗曟嵁鐨勫搴旀槑缁咺D
+ Inventory: {
+ Code: i.materiel_code // 瀛樿揣缂栫爜
+ },
+ IdSourceVoucherType: 69
+ })
})
- })
-
- const data = {
- 'dto': {
- 'Warehouse': {
- 'Code': '03'// 浠撳簱缂栫爜
- },
- 'Code': this.form.hbillno, // 鍗曟嵁缂栫爜
- 'IsModifiedCode': true,
- 'BusiType': {
- 'Code': '03'// 涓氬姟绫诲瀷缂栫爜
- },
- 'Department': {
- 'Code': this.form.wkshopcode// 閮ㄩ棬缂栫爜
- },
- 'VoucherDate': handleDatetime(new Date().getTime()), // 鍗曟嵁鏃ユ湡
- 'RdStyle': {
- 'Code': '21'// 鍑哄簱绫诲埆缂栫爜
- },
- 'RDRecordDetails': RDRecordDetails,
- 'Clerk': {
- 'Code': this.userArr.find(i => i.name === getCookie('username')).code // 涓氬姟鍛榗ode
- },
- 'ExternalCode': this.form.hbillno,
- 'VoucherType': {
- 'Code': 'ST1002'
+ const data = {
+ 'dto': {
+ 'Warehouse': {
+ 'Code': this.form.stockcode// 浠撳簱缂栫爜
+ },
+ 'Code': this.form.hbillno, // 鍗曟嵁缂栫爜
+ 'IsModifiedCode': true,
+ 'BusiType': {
+ 'Code': '03'// 涓氬姟绫诲瀷缂栫爜
+ },
+ 'Department': {
+ 'Code': this.form.wkshopcode// 閮ㄩ棬缂栫爜
+ },
+ 'VoucherDate': handleDatetime(new Date().getTime()), // 鍗曟嵁鏃ユ湡
+ 'RdStyle': {
+ 'Code': '21'// 鍑哄簱绫诲埆缂栫爜
+ },
+ 'RDRecordDetails': RDRecordDetails,
+ // 'Clerk': {
+ // 'Code': this.userArr.find(i => i.name === getCookie('username')).code // 涓氬姟鍛榗ode
+ // // 'Code': '001' // 涓氬姟鍛榗ode
+ // // 'Name': getCookie('username')
+ // },
+ 'ExternalCode': this.form.hbillno,
+ 'VoucherType': {
+ 'Code': 'ST1002'
+ }
}
+ }
+ const res = await axios.post(Vue.prototype.$chanjetBaseUrl + '/tplus/api/v2/ProductReceiveOpenApi/Create',
+ data, {
+ headers: {
+ 'openToken': openToken,
+ 'appKey': Vue.prototype.$AppKey,
+ 'appSecret': Vue.prototype.$AppSecret,
+ 'Content-Type': 'application/json'
+ }
+ }
+ )
+ if (res.data.code === 0) {
+ this.multipleSelection.forEach(i => {
+ i.stockname = this.stockcodeArr.find(j => j.code === i.stockcode).name
+ i.id = this.stockcodeArr.find(j => j.code === i.stockcode).id
+ })
+
+ const head = {
+ rightcode: '2064',
+ hbillno: this.form.hbillno,
+ incbit: this.form.incbit,
+ wkshpcode: this.form.wkshopcode,
+ sourceVoucherId: this.form.documentType === 'Y' ? this.tableDataDetail[0].mpoid : '',
+ sourceVoucherCode: this.form.documentType === 'Y' ? this.tableDataDetail[0].m_po : this.tableDataDetail[0].wo_code,
+ saleOrderId: this.tableDataDetail[0].saleOrderid,
+ saleOrderCode: this.tableDataDetail[0].saleOrderCode,
+ rdDirectionFlag: 1,
+ makerid: this.userArr.find(i => i.name === getCookie('username')).id,
+ maker: getCookie('username'),
+ accountingyear: new Date().getFullYear(),
+ VoucherYear: new Date().getFullYear(),
+ VoucherPeriod: new Date().getMonth() + 1,
+ ManufactureOrderCode: this.form.documentType === 'Y' ? this.tableDataDetail[0].m_po : this.tableDataDetail[0].wo_code,
+ idbusitype: '03',
+ iddepartment: this.WorkShopArr.find(i => i.code === this.form.wkshopcode).id,
+ idrdstyle: 21,
+ idwarehouse: '',
+ voucherState: 181,
+ idvouchertype: 15,
+ voucherdate: handleDatetime(new Date().getTime()),
+ madedate: handleDatetime(new Date().getTime()),
+ createdtime: handleDatetime2(new Date().getTime()),
+ DataSource: '56133',
+ idsourcevouchertype: 69
+ }
+
+ const subsum = []
+ this.tableDataSummary.forEach((i, index) => {
+ subsum.push({
+ code: index.toString().padStart(4, '0'),
+ rownumber: index + 1,
+ arrivalQuantity: i.qty,
+ quantity: i.stinhouseqty,
+ compositionQuantity: i.stinhouseqty + i.unitname,
+ baseQuantity: i.stinhouseqty,
+ sourceVoucherId: this.form.documentType === 'Y' ? this.tableDataDetail[0].mpoid : '',
+ sourceVoucherCode: this.form.documentType === 'Y' ? this.tableDataDetail[0].m_po : this.tableDataDetail[0].wo_code,
+ sourceVoucherDetailId: i.sourceVoucherDetailId,
+ idsourcevouchertype: 69,
+ saleOrderId: this.tableDataDetail[0].saleOrderid,
+ saleOrderCode: this.tableDataDetail[0].saleOrderCode,
+ saleOrderDetailId: i.saleOrderDetailId,
+ ManufactureOrderId: this.form.documentType === 'Y' ? this.tableDataDetail[0].mpoid : '',
+ ManufactureOrderCode: this.form.documentType === 'Y' ? this.tableDataDetail[0].m_po : this.tableDataDetail[0].wo_code,
+ ManufactureOrderDetailId: i.ManufactureOrderDetailId,
+ idbusiTypeByMergedFlow: 3,
+ idinventory: i.materiel_id,
+ idbaseunit: i.unitid,
+ idunit: i.unitid,
+ idwarehouse: i.stck_id,
+ SourceVoucherIdByMergedFlow: this.tableDataDetail[0].mpoid,
+ SourceVoucherCodeByMergedFlow: this.tableDataDetail[0].m_po,
+ SourceVoucherDetailIdByMergedFlow: i.SourceVoucherDetailIdByMergedFlow,
+ idsourceVoucherTypeByMergedFlow: 69,
+ createdtime: handleDatetime2(new Date().getTime()),
+ DataSource: '56133',
+ materiel_code: i.materiel_code,
+ warehouse: i.warehouse
+ })
+ })
+
+ const data = {
+ head, sub: this.multipleSelection, subsum
+ }
+
+ const r1 = await ProductInHouseOrderSeave(data)
+ if (r1.code === '200') {
+ this.$message.success('鍏ュ簱鎴愬姛锛�')
+ this.$store.state.app.buttonIsDisabled = false
+ await this.getProductInHouseOrderCodeSearch()
+ await this.wkshopcodeChange(this.form.wkshopcode)
+ this.tableDataDetail = []
+ this.tableDataSummary = []
+ this.multipleSelection = []
+ this.form.stockcode = ''
+ }
+ } else {
+ this.$message.error('鍏ュ簱澶辫触锛�')
+ this.$store.state.app.buttonIsDisabled = false
}
}
- const res = await axios.post(Vue.prototype.$chanjetBaseUrl + '/tplus/api/v2/ProductReceiveOpenApi/Create',
- data, {
- headers: {
- 'openToken': openToken,
- 'appKey': Vue.prototype.$AppKey,
- 'appSecret': Vue.prototype.$AppSecret,
- 'Content-Type': 'application/json'
+
+ // 鏃犳簮鍗�
+ if (this.form.documentType === 'N') {
+ const RDRecordDetails = []
+ this.tableDataSummary.forEach((i, index) => {
+ RDRecordDetails.push({
+ Code: index + 1, // 琛屽彿锛屼粠1寮�濮嬭嚜澧為暱
+ Inventory: {
+ Code: i.materiel_code // 瀛樿揣缂栫爜
+ },
+ BaseQuantity: i.stinhouseqty, // 涓昏閲忓崟浣嶆暟閲�
+ SNObject: {
+ SnAccountDetails: [
+ {
+ SNCode: index.toString().padStart(4, '0')
+ }
+ ]
+ }
+ })
+ })
+ const data = {
+ 'dto': {
+ 'IsModifiedCode': true,
+ 'ExternalCode': this.form.hbillno,
+ 'Code': this.form.hbillno,
+ 'VoucherType': {
+ 'Code': 'ST1002'
+ },
+ 'VoucherDate': handleDatetime(new Date().getTime()),
+ 'BusiType': {
+ 'Code': '03'
+ },
+ 'Warehouse': {
+ 'Code': this.form.stockcode
+ },
+ 'Department': {
+ 'Code': this.form.wkshopcode,
+ 'Name': this.WorkShopArr.find(i => i.code === this.form.wkshopcode).name
+ },
+ 'RDRecordDetails': RDRecordDetails
}
}
- )
- if (res.data.code === 0) {
- this.$message.success('鍏ュ簱鎴愬姛锛�')
- // 鍐嶅姞涓�浜涘叆搴撴垚鍔熶箣鍚庣殑閫昏緫
+ const res = await axios.post(Vue.prototype.$chanjetBaseUrl + '/tplus/api/v2/productReceive/Create',
+ data, {
+ headers: {
+ 'openToken': openToken,
+ 'appKey': Vue.prototype.$AppKey,
+ 'appSecret': Vue.prototype.$AppSecret,
+ 'Content-Type': 'application/json'
+ }
+ }
+ )
+
+ if (res.data === null) {
+ this.$message.success('鍏ュ簱鎴愬姛锛�')
+ this.$store.state.app.buttonIsDisabled = false
+ } else {
+ this.$message.error('鍏ュ簱澶辫触锛�')
+ this.$store.state.app.buttonIsDisabled = false
+ }
}
},
// 鍏ュ簱鎻愪氦
--
Gitblit v1.9.3