Bladeren bron

最终版

AlanWong 1 jaar geleden
bovenliggende
commit
db772e81a8
2 gewijzigde bestanden met toevoegingen van 81 en 40 verwijderingen
  1. 66 34
      src/views/audit/outbound/index.vue
  2. 15 6
      src/views/audit/store/index.vue

+ 66 - 34
src/views/audit/outbound/index.vue

@@ -18,6 +18,7 @@
 	import stockLook from "./components/stockLook.vue";
 	import SettingConfig from "../saleOrder/components/settingConfig.vue";
 	import { add } from '@/benyun/utils/accuracy'
+	import {getSingleData} from "@/api/omsOrder";
 	@Component({ components: { SettingConfig } })
 	export default class Outbound extends Vue {
 		// 左边
@@ -1126,41 +1127,72 @@
 						};
 						billConfig.tool.tools = { return: true, save: true, smt: true };
 						// 查销售订单数据
-						api.single({ id: e.purchaseOrderId }, 'supplyPurchaseOrder').then((val : any) => {
-							if (val.code === 200) {
-								parentData.suborderList.map((v : any, i : any) => {
-									v.outNumber = val.data.suborderList[i].outNumber;
-								});
-								let data : any = parentData.suborderList;
-								let array : any = [];
-								data.map((v : any) => {
-									v.deliveryNumber = v.number - v.outNumber;
-									if (v.deliveryNumber < v.number) v.number = v.deliveryNumber;
-									v.towInOne = v.storehouseName + ',' + v.storingLocationName; // 仓库仓位
-									array.push({
-										storidId: v.storingLocationId,
-										skuid: v.materialSku,
-									})
-								});
-								//  查库存
-								api.getInventoryByStoridsAndSkuids(array).then((res : any) => {
-									if (res.code === 200) {
-										let newData : any = [];
-										res.data.map((v : any, i : any) => {
-											newData.push(Object.assign(data[i], v))
+						if(e.purchaseOrderId){
+							api.single({ id: e.purchaseOrderId }, 'supplyPurchaseOrder').then((val : any) => {
+								if (val.code === 200) {
+									parentData.suborderList.map((v : any, i : any) => {
+										v.outNumber = val.data.suborderList[i].outNumber;
+									});
+									let data : any = parentData.suborderList;
+									let array : any = [];
+									data.map((v : any) => {
+										v.deliveryNumber = v.number - v.outNumber;
+										if (v.deliveryNumber < v.number) v.number = v.deliveryNumber;
+										v.towInOne = v.storehouseName + ',' + v.storingLocationName; // 仓库仓位
+										array.push({
+											storidId: v.storingLocationId,
+											skuid: v.materialSku,
 										})
-										this.tableData = newData;
-										(this.$refs.bill as any).setBillConfig(billConfig);
-										(this.$refs.bill as any).setBillFormValue(parentData);// 设置单据表单数据
-										(this.$refs.bill as any).setBillTableValue(newData, 0);// 设置第1张单据表格数据
-										this.isAdd = false;
-										this.dataId = '';
-										(this.$refs.bill as any).showTab = 'bill';
-										loading.close();
-									} else loading.close();
-								}).catch(() => loading.close());
-							} else loading.close();
-						}).catch(() => loading.close());
+									});
+									//  查库存
+									api.getInventoryByStoridsAndSkuids(array).then((res : any) => {
+										if (res.code === 200) {
+											let newData : any = [];
+											res.data.map((v : any, i : any) => {
+												newData.push(Object.assign(data[i], v))
+											})
+											this.tableData = newData;
+											(this.$refs.bill as any).setBillConfig(billConfig);
+											(this.$refs.bill as any).setBillFormValue(parentData);// 设置单据表单数据
+											(this.$refs.bill as any).setBillTableValue(newData, 0);// 设置第1张单据表格数据
+											this.isAdd = false;
+											this.dataId = '';
+											(this.$refs.bill as any).showTab = 'bill';
+											loading.close();
+										} else loading.close();
+									}).catch(() => loading.close());
+								} else loading.close();
+							}).catch(() => loading.close());
+						}else{
+							let data : any = parentData.suborderList;
+							let array : any = [];
+							data.map((v : any) => {
+								v.deliveryNumber = v.number;
+								// if (v.deliveryNumber < v.number) v.number = v.deliveryNumber;
+								v.towInOne = v.storehouseName + ',' + v.storingLocationName; // 仓库仓位
+								array.push({
+									storidId: v.storingLocationId,
+									skuid: v.materialSku,
+								})
+							});
+							//  查库存
+							api.getInventoryByStoridsAndSkuids(array).then((res : any) => {
+								if (res.code === 200) {
+									let newData : any = [];
+									res.data.map((v : any, i : any) => {
+										newData.push(Object.assign(data[i], v))
+									})
+									this.tableData = newData;
+									(this.$refs.bill as any).setBillConfig(billConfig);
+									(this.$refs.bill as any).setBillFormValue(parentData);// 设置单据表单数据
+									(this.$refs.bill as any).setBillTableValue(newData, 0);// 设置第1张单据表格数据
+									this.isAdd = false;
+									this.dataId = '';
+									(this.$refs.bill as any).showTab = 'bill';
+									loading.close();
+								} else loading.close();
+							}).catch(() => loading.close());
+						}
 					} else {
 						loading.close();
 						this.setReadonly(parentData);

+ 15 - 6
src/views/audit/store/index.vue

@@ -1,8 +1,8 @@
 <template>
 	<div class="my-container">
 		<div class="bill-main">
-			<module-view :propConfig="config" ref="moduleView" @pagination="getDataList" @search="getDataList"
-				@resert="onRefresh" @detail="shortBarge" @onRefresh="onRefresh">
+			<module-view :propConfig="config" ref="moduleView" @pagination="getDataList" @search="search" @resert="onRefresh"
+				@detail="shortBarge" @onRefresh="onRefresh">
 			</module-view>
 		</div>
 	</div>
@@ -15,6 +15,7 @@
 		timeNum = 0;
 		skuInfo : any = ''
 		storeHouseInfo : any = ''
+		tableInfo : any = ''
 		timer : any = null
 		config : any = {
 			attr: {
@@ -98,7 +99,7 @@
 			api.getMaterialInventory().then((res : any) => {
 				if (res.code === 200) {
 					this.skuInfo = res.data;
-				}else loading.close();
+				} else loading.close();
 			}).then(() => {
 				api.pageList({
 					pageNum: 1,
@@ -106,7 +107,7 @@
 				}, 'maindataStorehouse').then((res : any) => {
 					if (res.code === 200) {
 						this.storeHouseInfo = res.data.records;
-					}else loading.close();
+					} else loading.close();
 					if (res.code === 200) {
 						let moduleConfig = (this as any).$lodash.cloneDeep(this.config.table);
 						this.storeHouseInfo = res.data.records;
@@ -149,8 +150,8 @@
 									if (nowData[0]) res.data.records[i]['custom' + j] = nowData[0].inventory;
 								}
 							}
-							
 							(this.$refs.moduleView as any).setTableValue(res.data.records);
+							this.tableInfo = res.data.records;
 							loading.close();
 							// let page = {
 							// 	pageNo: res.data.current, //当前页
@@ -162,7 +163,15 @@
 					}).catch(() => loading.close());
 				}).catch(() => loading.close());
 			}).catch(() => loading.close());
-
+		}
+		// 查询
+		search() {
+			let searchID : any = (this as any).$refs.moduleView.searchID;
+			let value = (this as any).$refs.moduleView.$refs[searchID].value;
+			if (value.skuCode) {
+				let newData = this.tableInfo.filter((v : any) => v.skuCode == value.skuCode);
+				(this.$refs.moduleView as any).setTableValue(newData);
+			} else this.getDataList();
 		}
 		// 短驳
 		shortBarge(e : any) {