소스 검색

Merge branch 'master' of http://47.107.53.207:3000/ymy/oms

ymy 1 년 전
부모
커밋
13278070ba
4개의 변경된 파일151개의 추가작업 그리고 113개의 파일을 삭제
  1. 1 1
      src/api/currency.ts
  2. 1 1
      src/benyun/components/moduleView/moduleView.vue
  3. 66 34
      src/views/audit/outbound/index.vue
  4. 83 77
      src/views/audit/store/index.vue

+ 1 - 1
src/api/currency.ts

@@ -87,7 +87,7 @@ function WMSPushProducts(data : any) {
 	})
 }
 // 获取所有物料所在仓库库存
-function getMaterialInventory(data : any) {
+function getMaterialInventory(data? : any) {
 	return request({
 		url: '/maindata/maindataStorehouse/getMaterialInventory',
 		method: 'GET',

+ 1 - 1
src/benyun/components/moduleView/moduleView.vue

@@ -88,7 +88,7 @@ export default class ModuleView extends ModuleViewHandle {
     })
   }
   //设置表格配置
-  setTableCOnfig(config:any){
+  setTableConfig(config:any){
     if(this.$refs[this.tableID]){
       (this.$refs[this.tableID] as any).setConfig(config)
     }

+ 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);

+ 83 - 77
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>
@@ -13,6 +13,9 @@
 	@Component
 	export default class Store extends Vue {
 		timeNum = 0;
+		skuInfo : any = ''
+		storeHouseInfo : any = ''
+		tableInfo : any = ''
 		timer : any = null
 		config : any = {
 			attr: {
@@ -70,75 +73,15 @@
 						title: '物料编码',
 						field: 'skuCode',
 					},
-					{
-						width: '140px',
-						title: '',
-						field: 'financialCode2',
-					},
-					{
-						width: '140px',
-						title: '',
-						field: 'financialCode3',
-					},
-					{
-						width: '140px',
-						title: '',
-						field: 'financialCode4',
-					},
-					{
-						width: '140px',
-						title: '',
-						field: 'financialCode5',
-					},
-					{
-						width: '140px',
-						title: '',
-						field: 'financialCode6',
-					},
-					{
-						width: '140px',
-						title: '',
-						field: 'financialCode7',
-					},
-					{
-						width: 120,
-						title: '操作',
-						action: true,
-						plugins: [{
-							name: '短驳',
-							event: {
-								click: (item : any) => {
-									(this as any).shortBarge(item)
-								}
-							}
-						}, {
-							name: '调拨',
-							event: {
-								click: (item : any) => (this as any).allocate(item)
-							}
-						}]
-					}]
+
+				]
 			},
 		}
 		mounted() {
 			this.timer = setInterval(() => {
-				this.getMaindataStorehouse()
 				this.getDataList()
 			}, 300)
 		}
-		// 获取仓库信息
-		getMaindataStorehouse(){
-			let moduleConfig = (this as any).$lodash.cloneDeep(this.config.table);
-			moduleConfig.columns.push({
-				width: '140px',
-				title: '财务编号2',
-				field: 'financialCode2',
-			})
-			console.log(moduleConfig);
-			api.pageList({}, 'maindataStorehouse').then(res => {
-				console.log(res);
-			})
-		}
 		// 获取列表数据
 		getDataList() {
 			if (!this.$refs.moduleView) {
@@ -149,24 +92,87 @@
 				return
 			}
 			clearInterval(this.timer)
-			let query = (this.$refs.moduleView as any).getQuery();
-			this.getPageList(query);
+			this.getPageList();
 		}
-		getPageList(query : any) {
+		getPageList() {
 			let loading = this.$loading({ target: '.main-container' });
-			api.pageList(query, 'maindataMaterialSku').then((res : any) => {
-				loading.close();
+			api.getMaterialInventory().then((res : any) => {
 				if (res.code === 200) {
-					(this.$refs.moduleView as any).setTableValue(res.data.records);
-					let page = {
-						pageNo: res.data.current, //当前页
-						pageSize: res.data.size, //每页条数
-						total: res.data.total //总条数
-					};
-					(this.$refs.moduleView as any).setPage(page);
-				} else this.$message.error(res.msg);
+					this.skuInfo = res.data;
+				} else loading.close();
+			}).then(() => {
+				api.pageList({
+					pageNum: 1,
+					pageSize: 9999,
+				}, 'maindataStorehouse').then((res : any) => {
+					if (res.code === 200) {
+						this.storeHouseInfo = res.data.records;
+					} else loading.close();
+					if (res.code === 200) {
+						let moduleConfig = (this as any).$lodash.cloneDeep(this.config.table);
+						this.storeHouseInfo = res.data.records;
+						res.data.records.map((v : any, i : any) => {
+							moduleConfig.columns.push({
+								width: '140px',
+								title: v.name,
+								field: 'custom' + i,
+							});
+						});
+						moduleConfig.columns.push({
+							width: 120,
+							title: '操作',
+							action: true,
+							plugins: [{
+								name: '短驳',
+								event: {
+									click: (item : any) => {
+										(this as any).shortBarge(item)
+									}
+								}
+							}, {
+								name: '调拨',
+								event: {
+									click: (item : any) => (this as any).allocate(item)
+								}
+							}]
+						});
+						(this as any).$refs.moduleView.setTableConfig(moduleConfig);
+					}
+				}).then(() => {
+					api.pageList({
+						pageNum: 1,
+						pageSize: 9999
+					}, 'maindataMaterialSku').then((res : any) => {
+						if (res.code === 200) {
+							for (let i = 0; i < res.data.records.length; i++) {
+								for (let j = 0; j < this.storeHouseInfo.length; j++) {
+									let nowData = this.skuInfo.filter((v : any) => v.skuId == res.data.records[i].id && v.storeHouseId == this.storeHouseInfo[j].id);
+									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, //当前页
+							// 	pageSize: res.data.size, //每页条数
+							// 	total: res.data.total //总条数
+							// }; 	
+							// (this.$refs.moduleView as any).setPage(page);
+						} else loading.close();
+					}).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) {
 			console.log(e);