diff --git a/src/api/repair/stockOperate/stockOperate.js b/src/api/repair/stockOperate/stockOperate.js index 2ad2e32..1571dcb 100644 --- a/src/api/repair/stockOperate/stockOperate.js +++ b/src/api/repair/stockOperate/stockOperate.js @@ -36,3 +36,19 @@ export function getRepairSoById(id){ method: "get" }) } + +// 员工确认领料 +export function confirmGet(id){ + return request({ + url: preUrl + "/confirmGet?id=" + id, + method: 'get' + }) +} + +// 员工确认退料 +export function confirmBack(id){ + return request({ + url: preUrl + "/confirmBack?id=" + id, + method: 'get' + }) +} diff --git a/src/api/repair/stockOperate/stockOperateItem.js b/src/api/repair/stockOperate/stockOperateItem.js index 86553da..cd77133 100644 --- a/src/api/repair/stockOperate/stockOperateItem.js +++ b/src/api/repair/stockOperate/stockOperateItem.js @@ -18,3 +18,11 @@ export function getRepairSoiByIds(ids){ method: "get" }) } + +// 按主表ID查 +export function getRepairSoiBySoId(soId){ + return request({ + url: preUrl + "/getBySoId?soId=" + soId, + method: 'get' + }) +} diff --git a/src/views/repair/stockOperate/BackStock.vue b/src/views/repair/stockOperate/BackStock.vue new file mode 100644 index 0000000..b614033 --- /dev/null +++ b/src/views/repair/stockOperate/BackStock.vue @@ -0,0 +1,37 @@ + + + + + diff --git a/src/views/repair/stockOperate/Components/SoIndex.vue b/src/views/repair/stockOperate/Components/SoIndex.vue index 800b90b..415bbf4 100644 --- a/src/views/repair/stockOperate/Components/SoIndex.vue +++ b/src/views/repair/stockOperate/Components/SoIndex.vue @@ -2,7 +2,7 @@
- + - + - + @@ -88,15 +88,15 @@ - + - + - + @@ -159,6 +159,9 @@ export default { type: Boolean, defaultValue: false, required: false + }, + isBack:{ + type: Boolean } }, watch: { @@ -209,17 +212,22 @@ export default { methods: { // 分页 async pageSo() { + this.queryParams.soType = null + this.queryParams.purchaseType = null if (this.soByType && this.goodsYes){ this.queryParams.soType = "03" this.queryParams.purchaseType = "02" } - if (this.soByType && !this.goodsYes){ - this.queryParams.soType = "01" + else if (this.soByType && !this.goodsYes){ this.queryParams.soType = "01" + this.queryParams.purchaseType = "01" } - if (!this.soByType){ + else if (!this.soByType && !this.isBack){ this.queryParams.soType = "02" } + else if (this.isBack){ + this.queryParams.soType = '04' + } try { this.loading = true const res = await getRepairSoPage(this.queryParams) diff --git a/src/views/repair/stockOperate/Components/SoSow.vue b/src/views/repair/stockOperate/Components/SoSow.vue index 1bfc489..df14a9d 100644 --- a/src/views/repair/stockOperate/Components/SoSow.vue +++ b/src/views/repair/stockOperate/Components/SoSow.vue @@ -30,7 +30,7 @@ {{info.userName}} @@ -48,7 +48,7 @@ {{parseTime(info.soTime, '{y}-{m}-{d}')}} @@ -113,7 +113,7 @@ - + @@ -142,6 +142,9 @@ export default { soByType:{ type: Boolean, default: true, + }, + isBack:{ + type: Boolean } }, data() { diff --git a/src/views/repair/stockOperate/Components/SoVoid.vue b/src/views/repair/stockOperate/Components/SoVoid.vue index b31752e..52126ef 100644 --- a/src/views/repair/stockOperate/Components/SoVoid.vue +++ b/src/views/repair/stockOperate/Components/SoVoid.vue @@ -18,10 +18,10 @@ - + - + @@ -42,9 +42,9 @@ - + - + @@ -90,6 +90,9 @@ export default { defaultValue: true, required: true }, + isBack:{ + type: Boolean + } }, watch:{ 'queryParams.supplier'(val){ @@ -133,6 +136,9 @@ export default { methods: { async pageSo(){ try { + if (this.isBack){ + this.queryParams.soType = "04" + } this.loading = true const res = await getRepairSoPage(this.queryParams) this.list = res.data.records diff --git a/src/views/repair/stockOperate/Components/SoiTable.vue b/src/views/repair/stockOperate/Components/SoiTable.vue index 36e83f4..943489b 100644 --- a/src/views/repair/stockOperate/Components/SoiTable.vue +++ b/src/views/repair/stockOperate/Components/SoiTable.vue @@ -2,7 +2,7 @@
- + - + @@ -28,11 +28,11 @@ - - 导出 - - + + + + + @@ -44,7 +44,7 @@ - + @@ -62,7 +62,7 @@ - + @@ -90,6 +90,9 @@ export default { defaultValue: true, required: true }, + isBack:{ + type: Boolean + } }, watch:{ 'queryParams.corp'(val){ @@ -126,6 +129,9 @@ export default { }, // 分页 async pageSoi(){ + if (this.isBack){ + this.queryParams.soiType = "04" + } try { this.loading = true const res = await getSoiPage(this.queryParams) diff --git a/src/views/repair/stockOperate/Components/WaresItem.vue b/src/views/repair/stockOperate/Components/WaresItem.vue index b40808b..5542d59 100644 --- a/src/views/repair/stockOperate/Components/WaresItem.vue +++ b/src/views/repair/stockOperate/Components/WaresItem.vue @@ -57,20 +57,31 @@ - + +
+ + {{ scope.row.waresCount }} +
+
+ + +
{{ scope.row.waresCount }}
- @@ -179,7 +190,8 @@ export default { pageNo: 1, pageSize: 10, query: null, - type: this.type ? "01" : "02" + type: "01", + isBack: this.type ? null : true }, showSearch: true, loading: false, @@ -207,29 +219,30 @@ export default { methods:{ // 通过 true是全部、false是选择 async handlePass(){ - // 生成领料单 - if (this.type){ + // 生成领料单、退料单 this.formData.repairSo = { - soType: "02", - soNo: createUniqueCodeByHead("LL"), + soType: this.type ? "02" : "04", + soNo: createUniqueCodeByHead(this.type ? "LL" : "TL"), userId: this.formData.repairId, userName: this.formData.repairName, soTime: parseTime(Date.now(), '{y}-{m}-{d}'), - soStatus: "04", - purchaseType: "01" + soStatus: this.type ? "04" : "07", + // purchaseType: "01" } this.formData.repairSois = [...this.selections.map(item => { return { - soiType: '02', + soiType: this.type ? '02' : "04", goodsId: item.waresId, goodsCount: item.waresCount, } })] - this.formData.items = [...this.selections.map(item => { - return { - id: item.id, - } - })] + if (this.type){ + this.formData.items = [...this.selections.map(item => { + return { + id: item.id, + } + })] + } try { await pass(this.formData) this.$modal.msgSuccess("处理成功") @@ -237,23 +250,6 @@ export default { }finally { this.dialogVisible = false } - }else { - // 退料方法 - this.formData = {} - this.formData.items = [...this.selections.map(item => { - return { - id: item.id, - waresStatus: "05" - } - })] - try { - await passBackTicketWares(this.formData) - this.$modal.msgSuccess("处理成功") - await this.getList() - }finally { - this.dialogVisible = false - } - } }, // 生成采购 true是全部、false是选择 async handleCreate(flag){ @@ -310,19 +306,12 @@ export default { const data = {twId: row.id} const res = await listTwItem(data) this.items = res.data - // 库存判断 this.items.forEach(item => { - const count = item.waresAlreadyCount ? parseInt(item.waresCount) - parseInt(item.waresAlreadyCount) : item.waresCount - item.waresCount = count - item.isStock = count <= item.wares.stock - }) - // 只要未领料的 - if (this.type){ - this.items = this.items.filter(item => item.waresStatus === '02') - }else { - // 未领料的不要 - this.items = this.items.filter(item => item.waresStatus !== '02') - } + const count = item.waresAlreadyCount ? parseInt(item.waresCount) - parseInt(item.waresAlreadyCount) : item.waresCount + item.waresCount = this.type ? count : item.waresAlreadyCount + item.isStock = this.type ? count <= item.wares.stock : true + }) + this.items = this.items.filter(item => this.type ? item.waresStatus === '02' : item.waresAlreadyCount) }finally { this.dialogLoading = false } @@ -404,7 +393,11 @@ export default { /** 保存数据 */ save(row) { // 更新表格的数据 - row.isStock = row.waresCount <= row.wares.stock + row.isStock = this.type ? row.waresCount <= row.wares.stock : row.waresCount <= row.waresAlreadyCount + if (!this.type && !row.isStock){ + this.$modal.msgWarning("退料数量不能超过领取数量") + row.waresCount = row.waresAlreadyCount + } row.totalPrice = row.count * row.newPrice const id = row.id // 取消本行所有cell的编辑状态 @@ -412,6 +405,7 @@ export default { this.cancelEditable(cell) }) this.clickCellMap[id] = [] + this.selections = [] this.tableKey++ }, changeWare(row) { diff --git a/src/views/repair/tickets/Components/TicketWares.vue b/src/views/repair/tickets/Components/TicketWares.vue index 159e01c..9b99aa0 100644 --- a/src/views/repair/tickets/Components/TicketWares.vue +++ b/src/views/repair/tickets/Components/TicketWares.vue @@ -5,11 +5,12 @@ - - - - - + + + + + + 搜索 重置 @@ -25,30 +26,33 @@ {{ scope.$index + 1 }} - - - + + + - + @@ -59,18 +63,19 @@ - - + + @@ -85,18 +90,18 @@ import {listTwItem} from "@/api/repair/tickets/TWItem"; export default { name: "TicketWares", components: {TicketWaresShow}, - props:{ + props: { type: Boolean, userRole: String, }, - data(){ - return{ - queryParams:{ + data() { + return { + queryParams: { pageNo: 1, pageSize: 10, query: null, type: this.type ? "01" : "02", - status: null + status: "01" }, showSearch: true, loading: false, @@ -106,41 +111,41 @@ export default { dialogLoading: false, items: [], selections: [], - formData:{}, + formData: {}, dialogTitle: "" } }, mounted() { this.getList() }, - methods:{ - async getList(){ + methods: { + async getList() { try { this.loading = true const res = await getPage(this.queryParams) - if (res.data){ + if (res.data) { this.list = res.data.records this.total = res.data.total } - }finally { + } finally { this.loading = false } }, - handleQuery(){ + handleQuery() { this.queryParams.pageNo = 1 this.getList() }, - resetQuery(){ + resetQuery() { this.resetForm('queryForm') this.handleQuery() }, - handleShow(row){ + handleShow(row) { this.$refs.ticketWaresShow.open(row) }, - handleAudit(row){ + handleAudit(row) { this.handleShow(row) }, - async handleGet(row){ + async handleGet(row) { this.formData = { id: row.id, } @@ -152,29 +157,29 @@ export default { const res = await listTwItem(data) this.items = res.data // 只要可领料的 - if (this.type){ + if (this.type) { this.items = this.items.filter(item => item.waresStatus === '04') - }else { + } else { // 只要可退料的 this.items = this.items.filter(item => item.waresStatus === '05') } - }finally { + } finally { this.dialogLoading = false } }, - handleSelect(val){ + handleSelect(val) { this.selections = val }, - async handleDoGet(flag){ + async handleDoGet(flag) { this.formData.type = this.type ? "01" : "02" - if (flag){ + if (flag) { this.formData.items = [...this.items.map(item => { return { id: item.id, waresStatus: this.type ? "01" : "03" } })] - }else { + } else { this.formData.items = [...this.selections.map(item => { return { id: item.id, @@ -187,7 +192,8 @@ export default { this.dialogVisible = false this.$modal.msgSuccess(this.type ? "领料成功" : "退料成功") await this.getList() - }catch{} + } catch { + } } } } diff --git a/src/views/repair/tickets/TicketManager.vue b/src/views/repair/tickets/TicketManager.vue index 82abe3a..ae1ee13 100644 --- a/src/views/repair/tickets/TicketManager.vue +++ b/src/views/repair/tickets/TicketManager.vue @@ -7,9 +7,15 @@ - + + + + + + + @@ -21,10 +27,11 @@ import TicketManagerItem from "@/views/repair/tickets/Components/TicketManagerItem.vue"; import {getUserRole} from "@/api/repair/tickets/Tickets"; import TicketWares from "@/views/repair/tickets/Components/TicketWares.vue"; +import GetAndBackWares from "@/views/repair/tickets/form/GetAndBackWares.vue"; export default { name: "TicketManager", - components: {TicketWares, TicketManagerItem}, + components: {GetAndBackWares, TicketWares, TicketManagerItem}, data() { return { activeTab: 'unFinish', diff --git a/src/views/repair/tickets/form/GetAndBackWares.vue b/src/views/repair/tickets/form/GetAndBackWares.vue new file mode 100644 index 0000000..b89ac3c --- /dev/null +++ b/src/views/repair/tickets/form/GetAndBackWares.vue @@ -0,0 +1,165 @@ + + + + +