diff --git a/src/i18n/lang/cn.ts b/src/i18n/lang/cn.ts index c00888e..14399b4 100644 --- a/src/i18n/lang/cn.ts +++ b/src/i18n/lang/cn.ts @@ -422,6 +422,7 @@ export default { Warehouse_Tip7: '盘点未完成,确定继续吗', selectCode: '请先选择编码', standard: '条码长度必须是20位', + Total_scanned:'已扫总数', Warehouse_Tip8: '请输入成本中心', barCodeLength:'条码长度不足20位', Warehouse_Tip9: '操作成功', diff --git a/src/i18n/lang/en.ts b/src/i18n/lang/en.ts index 8222260..e11ae75 100644 --- a/src/i18n/lang/en.ts +++ b/src/i18n/lang/en.ts @@ -84,6 +84,7 @@ export default { materials: 'Please return all materials', po_OddNumbers: 'PO No', po_Supplier: 'Supplier', + Total_scanned:'Total', po_OrderType: 'Order type', po_Location: 'Inventory', po_PleaseScan: 'Please scan PO', diff --git a/src/pages/raw/warehouse/rowInventory/index.vue b/src/pages/raw/warehouse/rowInventory/index.vue index 3a1ff1a..8db8652 100644 --- a/src/pages/raw/warehouse/rowInventory/index.vue +++ b/src/pages/raw/warehouse/rowInventory/index.vue @@ -7,33 +7,35 @@ {{ $t('message.raw_Inventory') }} - + - + + + + + - - - - - + + - - - + + - - - + + + - - - + + + + + + + @@ -57,12 +59,6 @@ import { Component, Ref } from 'vue-property-decorator'; import { BasePage } from '@/components/base/page'; import { VForm, VFormRules } from 'vue/types/form'; import model from './model'; - -// interface OptionType { -// label: string; -// value: string; -// } - @Component export default class rawMaterialInventory extends BasePage { @Ref('form') readonly $form!: VForm; @@ -70,76 +66,84 @@ export default class rawMaterialInventory extends BasePage { index() { this.toPage(this.page.raw.index); } - status = false; - form = { - // 盘点单号 - pddNo: null, - // 物料号 - productCode: null, - productDescZh: null, - // 盘点数量 - spQty: null, - }; - originWl: any = {}; - list: any = []; - cboPlaceSelect = false; - rules: VFormRules = { - pddNo: [{ required: true, message: this.$t('message.dn_PleaseScan') as string }], - // cboPlace: [{ required: true, message: this.$t('message.Warehouse_Tip10') as string }], - }; - value = ''; - show = false; + pddNo: any = ''; + spQty: any = ''; + productItem: any = {}; + allNum: number = 0; originWlSelect = false; - // 扫描物料号检查 - async checkRawProductCode(productCode: string) { - let result = await model.checkRawProductCode({ - productCode, - pddNo: this.form.pddNo, - }); - console.log('result:::', result); - this.status = result.isState; - } - checkRawCreateInfo() { - if (this.status) { - model.checkRawProductComplete(this.form); - } else { - model.checkRawCreateInfo(this.form); - } - } - async checkRawOrderComplete() { - await model.checkRawOrderComplete(this.form.pddNo); - } - // 必须要在onReady生命周期,因为onLoad生命周期组件可能尚未创建完毕 + // 页面初始化 onReady() { - this.$form.setRules(this.rules); - //this.model.queryLocation(); - //清空数据项 - this.$form.resetFields(); + this.empty(); + } + empty() { this.model.orderInInfo.carNo = ''; this.model.orderInInfo.bookingTime = ''; this.model.orderInInfo.supplyCode = ''; this.model.orderInInfo.poType = ''; this.model.orderInInfo.location = ''; + this.spQty = ''; + this.productItem = {}; + this.allNum = 0; } + //单号查询 + async rawMaterialInventoryCheckRaw() { + if (!this.pddNo) { + uni.showToast({ title: this.$t('message.Commission_tips1') as any }); + return; + } + await this.model.rawMaterialInventoryCheckRaw(this.pddNo); + this.allNum = 0; + if (this.model.InventoryList.length != 0) { + this.model.InventoryList.forEach((item: any) => { + this.allNum += parseFloat(item.spQty); + }); + this.productItem = this.model.InventoryList[0]; + } + } + //选择其中一条物料 + onchange(e: any) { + this.model.InventoryList.forEach((item: any) => { + if (item.productCode == e[0].label) { + this.productItem = item; + } + }); + } + //点击确定 + async checkRawCreateInfo() { + if (!this.spQty) { + uni.showToast({ title: this.$t('message.Summary_PleaseInputNumber') as any }); + return; + } + if (!this.pddNo) { + uni.showToast({ title: this.$t('message.Commission_tips1') as any }); + return; + } + let params = { + factoryCode: this.session.factoryCode, + loginName: this.session.loginName, + pddNo: this.pddNo, + productCode: this.productItem.productCode, + productDescZh: this.productItem.productDescZh, + spQty: this.spQty, + }; + await model.checkRawProductComplete(params); + if (this.model.code == '1') { + this.empty(); + await this.rawMaterialInventoryCheckRaw(); + } + } + //点击完成 + async checkRawOrderComplete() { + await model.checkRawOrderComplete(this.pddNo); + if (this.model.code == '1') { + this.empty(); + this.pddNo = ''; + } + } + //返回 back() { uni.navigateBack({ delta: 1 }); } - async onSubmit() { - this.$form.validate((valid: boolean) => { - if (!valid) return; - if (!this.model.hasDnInfo) { - this.customToast(this.$t('message.dn_PleaseScan') as string); - return; - } - // sessionStorage.setItem( - // "dnNo", - // JSON.stringify(this.form.pddNo) as any - // ); - - // this.toPage(this.page.raw.ingoods.dnReceipt.detail); - }); - await this.model.submitOrderInEnter(); - } } diff --git a/src/pages/raw/warehouse/rowInventory/model.ts b/src/pages/raw/warehouse/rowInventory/model.ts index 366ca7a..09a4ec7 100644 --- a/src/pages/raw/warehouse/rowInventory/model.ts +++ b/src/pages/raw/warehouse/rowInventory/model.ts @@ -1,16 +1,9 @@ -import { - Action, - getModule, - Module, - Mutation, - MutationAction, - VuexModule, -} from "vuex-module-decorators"; -import store from "@/store"; -import http from "@/utils/request"; -import { url } from "@/utils/url"; -import { session } from "@/store/modules/session"; -import httpjson from "@/utils/location"; +import { Action, getModule, Module, Mutation, MutationAction, VuexModule } from 'vuex-module-decorators'; +import store from '@/store'; +import http from '@/utils/request'; +import { url } from '@/utils/url'; +import { session } from '@/store/modules/session'; +import httpjson from '@/utils/location'; class OrderInInfo { checked?: boolean; @@ -29,12 +22,13 @@ class OrderInInfo { namespaced: true, dynamic: true, store, - name: "raw.ingoods.dnReceipt", + name: 'raw.ingoods.dnReceipt', }) export class ReceiptModule extends VuexModule { // 是否有 isState = true; - sendSpot = ""; + sendSpot = ''; + code: any = ''; /** * sap库存地点列表 */ @@ -42,7 +36,7 @@ export class ReceiptModule extends VuexModule { /** * 隐藏看单号 */ - dnNo = ""; + dnNo = ''; /** * 看单号查询结果 */ @@ -55,6 +49,8 @@ export class ReceiptModule extends VuexModule { * 看单明细未通过明细 */ orderInInfoListEx: OrderInInfo[] = []; + InventoryList: any = []; + InventoryItemList: any = []; /** * 库位列表 @@ -129,7 +125,7 @@ export class ReceiptModule extends VuexModule { loginName: session.loginName, userDefined3: 1, }); - console.log("result", result); + console.log('result', result); const cboPlaceList = result.data.records.map((_: any) => ({ label: _.sendSpot, value: _.sendSpot, @@ -150,16 +146,12 @@ export class ReceiptModule extends VuexModule { loginName: session.loginName, }); const orderInInfo = list[0] || {}; - const orderInInfoList = list.filter( - (_: OrderInInfo) => _.userDefined10 === "1" - ); - const orderInInfoListEx = list.filter( - (_: OrderInInfo) => _.userDefined10 === "0" - ); + const orderInInfoList = list.filter((_: OrderInInfo) => _.userDefined10 === '1'); + const orderInInfoListEx = list.filter((_: OrderInInfo) => _.userDefined10 === '0'); // orderInInfoList.forEach((item: any) => { // item.receiptAmount = item.requestAmount; // }); - localStorage.setItem("sendSpot", JSON.stringify(list[0].sendSpot) as any); + localStorage.setItem('sendSpot', JSON.stringify(list[0].sendSpot) as any); return { dnNo, orderInInfo, orderInInfoList, orderInInfoListEx }; } @@ -168,20 +160,27 @@ export class ReceiptModule extends VuexModule { * 查询盘点单号 * @param pddNo */ - @Action + @MutationAction async rawMaterialInventoryCheckRaw(pddNo: string) { - const { msg }: any = await http.post( - url.material.rawMaterialInventory.checkRaw, - { - pddNo, - factoryCode: session.factoryCode, - loginName: session.loginName, - } - ); - uni.showToast({ - icon: "none", - title: msg, + const res: any = await http.post(url.material.rawMaterialInventory.checkRaw, { + pddNo, + factoryCode: session.factoryCode, + loginName: session.loginName, }); + const InventoryList = res.data; + const InventoryItemList = []; + InventoryList.forEach((item: any) => { + let arr = { + value: item.productCode, + label: item.productCode, + }; + InventoryItemList.push(arr); + }); + return { InventoryList, InventoryItemList }; + // uni.showToast({ + // icon: "none", + // title: msg, + // }); } /** @@ -193,20 +192,17 @@ export class ReceiptModule extends VuexModule { */ @Action async checkRawProductCode(form: any) { - const { code, msg }: any = await http.post( - url.material.rawMaterialInventory.productCode, - { - productCode: form.productCode, - pddNo: form.pddNo, - factoryCode: session.factoryCode, - loginName: session.loginName, - } - ); + const { code, msg }: any = await http.post(url.material.rawMaterialInventory.productCode, { + productCode: form.productCode, + pddNo: form.pddNo, + factoryCode: session.factoryCode, + loginName: session.loginName, + }); uni.showToast({ - icon: "none", + icon: 'none', title: msg, }); - console.log("code:::", code, msg); + console.log('code:::', code, msg); const isState = !!+code; return { isState }; } @@ -219,16 +215,13 @@ export class ReceiptModule extends VuexModule { */ @Action async checkRawCreateInfo(form: any) { - const { msg }: any = await http.post( - url.material.rawMaterialInventory.createInfo, - { - ...form, - factoryCode: session.factoryCode, - loginName: session.loginName, - } - ); + const { msg }: any = await http.post(url.material.rawMaterialInventory.createInfo, { + ...form, + factoryCode: session.factoryCode, + loginName: session.loginName, + }); uni.showToast({ - icon: "none", + icon: 'none', title: msg, }); } @@ -240,20 +233,15 @@ export class ReceiptModule extends VuexModule { * @param {string} pddNo * @memberof ReceiptModule */ - @Action + @MutationAction async checkRawProductComplete(form: any) { - const { msg }: any = await http.post( - url.material.rawMaterialInventory.productComplete, - { - ...form, - factoryCode: session.factoryCode, - loginName: session.loginName, - } - ); - uni.showToast({ - icon: "none", - title: msg, + const res: any = await http.post(url.material.rawMaterialInventory.productComplete, { + ...form, + factoryCode: session.factoryCode, + loginName: session.loginName, }); + const code = res.code; + return { code }; } /** @@ -263,20 +251,15 @@ export class ReceiptModule extends VuexModule { * @param {string} pddNo * @memberof ReceiptModule */ - @Action + @MutationAction async checkRawOrderComplete(pddNo?: string | null) { - const { msg }: any = await http.post( - url.material.rawMaterialInventory.orderComplete, - { - pddNo, - factoryCode: session.factoryCode, - loginName: session.loginName, - } - ); - uni.showToast({ - icon: "none", - title: msg, + const res: any = await http.post(url.material.rawMaterialInventory.orderComplete, { + pddNo, + factoryCode: session.factoryCode, + loginName: session.loginName, }); + const code = res.code; + return { code }; } /** @@ -285,7 +268,7 @@ export class ReceiptModule extends VuexModule { @MutationAction async submitOrderInEnter() { const list = (this.state as any).orderInInfoList.map((item: any) => { - item.orderStatus = item.checked ? "2" : "1"; + item.orderStatus = item.checked ? '2' : '1'; return item; }); const result: any = await http.post(url.material.DNorderin.enter, { @@ -295,22 +278,19 @@ export class ReceiptModule extends VuexModule { list, }); uni.showToast({ - icon: "none", + icon: 'none', title: result.msg, }); - const orderInInfoList = result.list.sort( - (a: any, b: any) => - Number(a.accountingStatus) - Number(b.accountingStatus) - ); + const orderInInfoList = result.list.sort((a: any, b: any) => Number(a.accountingStatus) - Number(b.accountingStatus)); return { orderInInfoList }; } /** * 修改库位 */ - @Action({ commit: "updateCheckedOrderInInfoListKw" }) + @Action({ commit: 'updateCheckedOrderInInfoListKw' }) async changeOrderInLocation(kw: string) { - await http.post("/wmspda/material/orderin/enter", { + await http.post('/wmspda/material/orderin/enter', { warehouseCode: session.warehouseCode, factoryCode: session.factoryCode, loginName: session.loginName, @@ -318,12 +298,9 @@ export class ReceiptModule extends VuexModule { }); return kw; } - @Action({ commit: "updateCheckedOrderInInfoListKw" }) + @Action({ commit: 'updateCheckedOrderInInfoListKw' }) async queryByFactoryCodeAndWorkAreaCode(content: any) { - let res = await http.post( - "/wmspda/fg/queryByFactoryCodeAndWorkAreaCode", - content - ); + let res = await http.post('/wmspda/fg/queryByFactoryCodeAndWorkAreaCode', content); return res; } }