| | |
| | | > |
| | | <div class="elForm" style="display: flex;flex-direction: column;justify-content: flex-start"> |
| | | <div style="display: flex"> |
| | | <el-form-item label="单据类型" required style=" display: flex;"> |
| | | <el-select |
| | | v-model="form.issouceorder" |
| | | :popper-append-to-body="false" |
| | | :style="{minWidth:'100px',width:formItemWidth+'px'}" |
| | | placeholder="请选择" |
| | | > |
| | | <el-option |
| | | v-for="item in issouceorderTypeArr" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="生产车间" required style=" display: flex;"> |
| | | <el-select |
| | | v-model="form.wkshopcode" |
| | |
| | | :style="{minWidth:'100px',width:formItemWidth+'px'}" |
| | | /> |
| | | </el-form-item> |
| | | |
| | | </div> |
| | | |
| | | <div style="display: flex"> |
| | | <el-form-item |
| | | label="销售订单" |
| | | style="display: flex;" |
| | |
| | | :style="{minWidth:'100px',width:formItemWidth+'px'}" |
| | | /> |
| | | </el-form-item> |
| | | </div> |
| | | |
| | | <div style="display: flex"> |
| | | <el-form-item label="产品编码" style=" display: flex;"> |
| | | <el-input v-model="form.partcode" placeholder="请输入" :style="{minWidth:'100px',width:formItemWidth+'px'}" /> |
| | | <el-input |
| | | v-model="form.partcode" |
| | | placeholder="请输入" |
| | | :style="{minWidth:'100px',width:formItemWidth+'px'}" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="产品名称" style=" display: flex;"> |
| | | <el-input v-model="form.partname" :style="{minWidth:'100px',width:formItemWidth+'px'}" placeholder="请输入" /> |
| | | <el-input |
| | | v-model="form.partname" |
| | | :style="{minWidth:'100px',width:formItemWidth+'px'}" |
| | | placeholder="请输入" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="产品规格" style=" display: flex;"> |
| | | <el-input v-model="form.partspec" :style="{minWidth:'100px',width:formItemWidth+'px'}" placeholder="请输入" /> |
| | | <el-input |
| | | v-model="form.partspec" |
| | | :style="{minWidth:'100px',width:formItemWidth+'px'}" |
| | | placeholder="请输入" |
| | | /> |
| | | </el-form-item> |
| | | </div> |
| | | |
| | |
| | | highlight-current-row |
| | | :header-cell-style="this.$headerCellStyle" |
| | | :cell-style="this.$cellStyle" |
| | | @row-click="rowClick" |
| | | @selection-change="handleSelectionChange" |
| | | > |
| | | <!-- @selection-change="handleSelectionChange"--> |
| | | <!-- @cell-dblclick="cellDblclick"--> |
| | | <!-- @cell-click="cellClick"--> |
| | | <!-- <el-table-column--> |
| | | <!-- type="selection"--> |
| | | <!-- width="50"--> |
| | | <!-- fixed--> |
| | | <!-- />--> |
| | | |
| | | <el-table-column |
| | | type="selection" |
| | | width="50" |
| | | fixed |
| | | > |
| | | <template slot-scope="{row}"> |
| | | <el-radio |
| | | v-model="radioSelected" |
| | | :label="row.sbid" |
| | | style="color: transparent;padding-left: 10px;" |
| | | /> |
| | | </template> |
| | | </el-table-column> |
| | | |
| | | /> |
| | | <el-table-column |
| | | type="index" |
| | | width="50" |
| | |
| | | |
| | | import { PrentOrganizationNoCompany, WareHouse } from '@/api/GeneralBasicData' |
| | | import { |
| | | DeptSelectData, |
| | | ProductInHouseOrderCodeSearch, |
| | | ProductInHouseOrderSearch, TProductInHouseOrderSpSeave |
| | | ProductInHouseOrderSearch, |
| | | InHouseOrderSpSeave |
| | | } from '@/api/WorkOrder' |
| | | import { TSecLocaTree } from '@/api/basicSettings' |
| | | import { getTPlusToken, handleDatetime, handleDatetime2 } from '@/utils/global' |
| | |
| | | partname: '', // 产品名称 |
| | | partspec: '', // 规格型号 |
| | | |
| | | issouceorder: 'Y', // 是否有源单 |
| | | |
| | | deptno: '', // 入库部门 |
| | | saleOrderCode: '', // 销售订单 |
| | | stockcode: '' // 入库仓库 |
| | |
| | | buttonSize: '', |
| | | formItemWidth: 0, |
| | | |
| | | radioSelected: '' |
| | | issouceorderTypeArr: [ |
| | | { value: 'Y', label: '有源单' }, |
| | | { value: 'N', label: '无源单' } |
| | | ] |
| | | |
| | | } |
| | | }, |
| | | watch: {}, |
| | | created() { |
| | | }, |
| | | mounted() { |
| | | async mounted() { |
| | | window.addEventListener('resize', this.getHeight) |
| | | this.getHeight() |
| | | |
| | | this.getPrentOrganizationNoCompany() |
| | | this.getTSecLocaTree() |
| | | this.getProductInHouseOrderCodeSearch() |
| | | await this.getPrentOrganizationNoCompany() |
| | | await this.getTSecLocaTree() |
| | | await this.getProductInHouseOrderCodeSearch() |
| | | // this.getDeptSelectData() |
| | | |
| | | // this.getProductInHouseOrderSearch() |
| | | }, |
| | | methods: { |
| | | // 获取入库部门 |
| | | |
| | | async getDeptSelectData() { |
| | | const { data: res } = await DeptSelectData() |
| | | this.departmentArr = res |
| | | }, |
| | | // 获取单据编号(入库单号)、流水号 |
| | | async getProductInHouseOrderCodeSearch() { |
| | | const { data: res } = await ProductInHouseOrderCodeSearch({ rightcode: '0604' }) |
| | |
| | | return this.$message.info('生产车间不能为空!') |
| | | } |
| | | const data = { |
| | | issouceorder: this.form.issouceorder, |
| | | saleordercode: this.form.saleordercode, // 销售单号 |
| | | wkshopcode: this.form.wkshopcode, // 生产车间 |
| | | erpordercode: this.form.erpordercode, // 订单编号 |
| | |
| | | handleSelectionChange(val) { |
| | | this.multipleSelection = val |
| | | }, |
| | | // 行点击事件 |
| | | async rowClick(row, event, column) { |
| | | this.radioSelected = row.sbid |
| | | // const { data: res } = await SearchWorkStep({ wo_code: row.wo_code }) |
| | | // this.tableDataDetail = res |
| | | }, |
| | | // 递交 |
| | | async submit() { |
| | | if (this.form.stockcode === '') { |
| | | return this.$message.info('入库仓库不能为空!') |
| | | } |
| | | |
| | | const openToken = await getTPlusToken() // 获取TPlus token |
| | | |
| | | const obj = this.tableDataDetail.find(i => i.sbid === this.radioSelected) |
| | | |
| | | // 无源单 |
| | | if (!obj.saleOrderCode) { |
| | | // 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': [ |
| | | { |
| | | Code: 1, // 行号,从1开始自增长 |
| | | Inventory: { |
| | | Code: obj.partcode // 存货编码 |
| | | }, |
| | | BaseQuantity: obj.stinhouseqty, // 主计量单位数量 |
| | | SNObject: { |
| | | SnAccountDetails: [ |
| | | { |
| | | // SNCode: index.toString().padStart(4, '0') |
| | | SNCode: '0001' |
| | | } |
| | | ] |
| | | } |
| | | } |
| | | ] |
| | | } |
| | | } |
| | | |
| | | console.log(JSON.parse(JSON.stringify(data))) |
| | | |
| | | 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' |
| | | } |
| | | } |
| | | ) |
| | | console.log(res) |
| | | console.log(res.status) |
| | | } |
| | | }, |
| | | // 递交 |
| | | async submitBack() { |
| | | async submit() { |
| | | // usercode |
| | | // console.log(localStorage.getItem('username')) |
| | | |
| | |
| | | if (this.multipleSelection.find(i => i.stockid === '' || i.stockid === null)) { |
| | | return this.$message.info('表格内入库仓库不能为空!') |
| | | } |
| | | |
| | | const TableDetailData = [] |
| | | this.multipleSelection.forEach((i, index) => { |
| | | TableDetailData.push({ |
| | | 'hbillno': this.form.hbillno, // 入库单号 |
| | | 'wocode': i.wo_code, // 工单号 |
| | | 'rownumber': (index + 1).toString(), // 行号 |
| | | 'sourceVoucherId': i.mpoid.toString(), // 来源单据id |
| | | 'sourceVoucherCode': i.m_po, // 来源单据编号 |
| | | 'SourceVoucherDetailId': i.sbid.toString(), // 来源单据明细id |
| | | 'inbarcode': i.inbarcode, // 入库条码 |
| | | 'idinventory': i.materiel_id.toString(), // 存货id |
| | | 'inventorycode': i.partcode, // 存货编码 |
| | | 'idunit': i.unitid.toString(), // 计量单位id |
| | | 'unitcode': i.unitcode, // 计量单位编码 |
| | | idwarehouse: i.stockid.toString(), // 仓库id |
| | | warehousecode: i.stockcode, // 仓库编码 |
| | | 'saleOrderId': i.saleOrderid.toString(), // 销售单id |
| | | 'saleOrderCode': i.saleOrderCode, // 销售单号 |
| | | 'saleOrderDetailId': i.saleOrderDetailId.toString(), // 销售单明细id |
| | | 'qty': i.good_qty.toString(), // 入库数量 |
| | | 'stepcode': i.step_code, // 工序编码 |
| | | 'style': i.style, // 报工类型:B(自制) S(外协) |
| | | 'status': '0' // 入库单状态:0(未审核) 1(已审核) |
| | | }) |
| | | }) |
| | | |
| | | const data = { |
| | | 'rightcode': '0604', // 功能编号 |
| | | 'incbit': this.form.incbit, // 流水号 |
| | | 'TableData': [ |
| | | [ |
| | | { |
| | | 'hbillno': this.form.hbillno, // 入库单号 |
| | | 'madedate': handleDatetime(this.form.hbdate) + ' 00:00:00', // 制单日期(年月日 00:00:00) |
| | | 'hbdate': this.multipleSelection[this.multipleSelection.length - 1].voucherdate, |
| | | |
| | | sourceVoucherId: [...new Set(this.multipleSelection.map(i => i.mpoid))].length > 1 ? '' : this.multipleSelection[0].mpoid, |
| | | sourceVoucherCode: [...new Set(this.multipleSelection.map(i => i.m_po))].length > 1 ? '' : this.multipleSelection[0].m_po, |
| | | saleOrderCode: [...new Set(this.multipleSelection.map(i => i.saleOrderCode))].length > 1 ? '' : this.multipleSelection[0].saleOrderCode, |
| | | |
| | | 'iddepartment': this.multipleSelection[0].dept_id, // 部门id |
| | | 'departmentcode': this.multipleSelection[0].dept_code, // 部门编码 |
| | | |
| | | 'idwarehouse': this.stockcodeArr.find(i => i.code === this.form.stockcode).noid, // 仓库id |
| | | 'warehousecode': this.form.stockcode, // 仓库编码 |
| | | 'status': '0', // 入库单状态:0(未审核) 1(已审核) |
| | | PurchaseOrderCode: '', // 采购订单号 |
| | | 'remark': '', // 备注 |
| | | 'create_user': localStorage.getItem('username'), // 创建人员 |
| | | 'create_date': handleDatetime2(new Date()), |
| | | 'check_user': '', // 审核人员 |
| | | 'check_date': ''// 审核时间 |
| | | } |
| | | ], |
| | | TableDetailData// 表体 |
| | | ] |
| | | } |
| | | |
| | | // console.log(JSON.stringify(data)) |
| | | this.$store.state.app.buttonIsDisabled = true |
| | | const res = await TProductInHouseOrderSpSeave(data) |
| | | this.$store.state.app.buttonIsDisabled = false |
| | | if (res.code === '200') { |
| | | this.$message.success('入库成功!') |
| | | this.multipleSelection = [] |
| | | // this.form.deptno = '' |
| | | // this.form.stockcode = '' |
| | | this.reset() |
| | | // await this.getProductInHouseOrderSearch() |
| | | await this.getProductInHouseOrderCodeSearch() |
| | | const openToken = await getTPlusToken() // 获取TPlus token |
| | | |
| | | // console.log(openToken) |
| | | |
| | | let res |
| | | const a = 1 |
| | | if (openToken) { |
| | | if (a === 2) { |
| | | const RDRecordDetails = [] |
| | | this.multipleSelection.forEach((i, index) => { |
| | | RDRecordDetails.push({ |
| | | Code: index + 1, // 行号,从1开始自增长 |
| | | Warehouse: { |
| | | Code: i.stockcode |
| | | }, |
| | | Inventory: { |
| | | Code: i.partcode // 存货编码 |
| | | }, |
| | | BaseQuantity: i.stinhouseqty // 主计量单位数量 |
| | | // SNObject: { |
| | | // SnAccountDetails: [ |
| | | // { |
| | | // SNCode: '00001' |
| | | // }, |
| | | // { |
| | | // SNCode: '00002' |
| | | // } |
| | | // ] |
| | | // } |
| | | }) |
| | | }) |
| | | const D1 = { |
| | | '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.torg_code === this.form.wkshopcode).torg_name |
| | | }, |
| | | 'RDRecordDetails': RDRecordDetails |
| | | } |
| | | } |
| | | res = await axios.post(Vue.prototype.$chanjetBaseUrl + '/tplus/api/v2/productReceive/Create', |
| | | D1, { |
| | | headers: { |
| | | 'openToken': openToken, |
| | | 'appKey': Vue.prototype.$AppKey, |
| | | 'appSecret': Vue.prototype.$AppSecret, |
| | | 'Content-Type': 'application/json' |
| | | } |
| | | } |
| | | ) |
| | | } |
| | | |
| | | // 目前都执行的这个 |
| | | if (a === 1) { |
| | | const RDRecordDetails = [] |
| | | this.multipleSelection.forEach((i, index) => { |
| | | RDRecordDetails.push({ |
| | | Code: index + 1, // 行号,从1开始自增长 |
| | | SourceVoucherId: i.mpoid ? i.mpoid : '', // 来源单据的单据ID |
| | | BaseQuantity: i.stinhouseqty, // 主计量单位数量 |
| | | // SourceVoucherDetailId: i.sourceVoucherDetailId, // 来源单据的对应明细ID |
| | | SourceVoucherDetailId: i.sbid ? i.sbid : '', // 来源单据的对应明细ID |
| | | Inventory: { |
| | | Code: i.partcode // 存货编码 |
| | | }, |
| | | IdSourceVoucherType: i.sbid ? 69 : '' |
| | | }) |
| | | }) |
| | | const D2 = { |
| | | '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 // 业务员code |
| | | // // 'Code': '001' // 业务员code |
| | | // // 'Name': getCookie('username') |
| | | // }, |
| | | 'ExternalCode': this.form.hbillno, |
| | | 'VoucherType': { |
| | | 'Code': 'ST1002' |
| | | } |
| | | } |
| | | } |
| | | res = await axios.post(Vue.prototype.$chanjetBaseUrl + '/tplus/api/v2/ProductReceiveOpenApi/Create', |
| | | D2, { |
| | | headers: { |
| | | 'openToken': openToken, |
| | | 'appKey': Vue.prototype.$AppKey, |
| | | 'appSecret': Vue.prototype.$AppSecret, |
| | | 'Content-Type': 'application/json' |
| | | } |
| | | } |
| | | ) |
| | | } |
| | | |
| | | // console.log(res) |
| | | // console.log(res.data.code) |
| | | // || res.data === null |
| | | if (res.data.code === 0) { |
| | | const TableDetailData = [] |
| | | this.multipleSelection.forEach((i, index) => { |
| | | TableDetailData.push({ |
| | | 'hbillno': this.form.hbillno, // 入库单号 |
| | | 'wocode': i.wo_code, // 工单号 |
| | | 'rownumber': (index + 1).toString(), // 行号 |
| | | 'sourceVoucherId': i.mpoid ? i.mpoid.toString() : '', // 来源单据id |
| | | 'sourceVoucherCode': i.m_po, // 来源单据编号 |
| | | 'SourceVoucherDetailId': i.sbid ? i.sbid.toString() : '', // 来源单据明细id |
| | | 'inbarcode': i.inbarcode, // 入库条码 |
| | | 'idinventory': i.materiel_id ? i.materiel_id.toString() : '', // 存货id |
| | | 'inventorycode': i.partcode, // 存货编码 |
| | | 'idunit': i.unitid ? i.unitid.toString() : '', // 计量单位id |
| | | 'unitcode': i.unitcode, // 计量单位编码 |
| | | idwarehouse: i.stockid, // 仓库id |
| | | warehousecode: i.stockcode, // 仓库编码 |
| | | 'saleOrderId': i.saleOrderid ? i.saleOrderid.toString() : '', // 销售单id |
| | | 'saleOrderCode': i.saleOrderCode, // 销售单号 |
| | | 'saleOrderDetailId': i.saleOrderDetailId ? i.saleOrderDetailId.toString() : '', // 销售单明细id |
| | | 'qty': i.good_qty.toString(), // 入库数量 |
| | | 'stepcode': i.step_code, // 工序编码 |
| | | 'style': i.style, // 报工类型:B(自制) S(外协) |
| | | 'status': '0' // 入库单状态:0(未审核) 1(已审核) |
| | | }) |
| | | }) |
| | | |
| | | const data = { |
| | | 'rightcode': '0604', // 功能编号 |
| | | 'incbit': this.form.incbit, // 流水号 |
| | | 'TableData': [ |
| | | [ |
| | | { |
| | | 'hbillno': this.form.hbillno, // 入库单号 |
| | | 'madedate': handleDatetime(this.form.hbdate) + ' 00:00:00', // 制单日期(年月日 00:00:00) |
| | | 'hbdate': this.multipleSelection[this.multipleSelection.length - 1].voucherdate, |
| | | |
| | | sourceVoucherId: [...new Set(this.multipleSelection.map(i => i.mpoid))].length > 1 ? '' : this.multipleSelection[0].mpoid, |
| | | sourceVoucherCode: [...new Set(this.multipleSelection.map(i => i.m_po))].length > 1 ? '' : this.multipleSelection[0].m_po, |
| | | saleOrderCode: [...new Set(this.multipleSelection.map(i => i.saleOrderCode))].length > 1 ? '' : this.multipleSelection[0].saleOrderCode, |
| | | |
| | | 'iddepartment': this.multipleSelection[0].dept_id, // 部门id |
| | | 'departmentcode': this.multipleSelection[0].dept_code, // 部门编码 |
| | | |
| | | 'idwarehouse': this.stockcodeArr.find(i => i.code === this.form.stockcode).noid, // 仓库id |
| | | 'warehousecode': this.form.stockcode, // 仓库编码 |
| | | 'status': '0', // 入库单状态:0(未审核) 1(已审核) |
| | | PurchaseOrderCode: '', // 采购订单号 |
| | | 'remark': '', // 备注 |
| | | 'create_user': localStorage.getItem('username'), // 创建人员 |
| | | 'create_date': handleDatetime2(new Date()), |
| | | 'check_user': '', // 审核人员 |
| | | 'check_date': ''// 审核时间 |
| | | } |
| | | ], |
| | | TableDetailData// 表体 |
| | | ] |
| | | } |
| | | |
| | | // console.log(JSON.stringify(data)) |
| | | |
| | | // this.$store.state.app.buttonIsDisabled = true |
| | | const res = await InHouseOrderSpSeave(data) |
| | | this.$store.state.app.buttonIsDisabled = false |
| | | if (res.code === '200') { |
| | | this.$message.success('入库成功!') |
| | | this.multipleSelection = [] |
| | | // this.form.deptno = '' |
| | | // this.form.stockcode = '' |
| | | this.reset() |
| | | // await this.getProductInHouseOrderSearch() |
| | | await this.getProductInHouseOrderCodeSearch() |
| | | } |
| | | } else { |
| | | // console.log(res.data) |
| | | |
| | | this.$store.state.app.buttonIsDisabled = false |
| | | this.$message.error(res.data.message) |
| | | } |
| | | } else { |
| | | this.$store.state.app.buttonIsDisabled = false |
| | | } |
| | | }, |
| | | // 重置 |
| | | reset() { |
| | | // this.form.issouceorder = 'Y' |
| | | this.form.saleordercode = '' // 销售单号 |
| | | this.form.wkshopcode = '' // 生产车间 |
| | | this.form.erpordercode = ''// 订单编号 |
| | |
| | | |
| | | ::v-deep .el-tabs__item { |
| | | padding-right: 0; |
| | | } |
| | | |
| | | ::v-deep .el-radio.is-bordered + .el-radio.is-bordered { |
| | | margin: 10px 30px 0 0; |
| | | } |
| | | |
| | | ::v-deep .el-radio__label{ |
| | | display: none; |
| | | } |
| | | </style> |
| | | <style> |