diff --git a/PDA/PDA/pages/bind/bind.vue b/PDA/PDA/pages/bind/bind.vue index 195c9fd..d980149 100644 --- a/PDA/PDA/pages/bind/bind.vue +++ b/PDA/PDA/pages/bind/bind.vue @@ -14,7 +14,7 @@ + :placeholder="placeholderText" v-model="matCodeCondition"> @@ -30,6 +30,9 @@ + + + @@ -50,6 +53,7 @@ + @@ -92,7 +96,7 @@ {{matName}} - + @@ -104,19 +108,19 @@ {{matSpec}} - + - + - + 物料批次: - + - + - + @@ -126,7 +130,8 @@ 物料数量: - + @@ -135,6 +140,7 @@ + @@ -152,7 +158,7 @@ - + @@ -199,7 +205,7 @@ shelfCode: '', matCode: '', matName: '', - matBatch:'', + matBatch: '', matSpec: '', matQty: 0, //默认数量值 @@ -273,27 +279,30 @@ //接口返回数据为200 表示获取成功! if (res.data.code == 200) { this.matCodeCondition = ''; - + this.locationId = res.data.data.locationId; this.locationCode = res.data.data.locationCode; this.shelfId = res.data.data.shelfId; this.shelfCode = res.data.data.shelfCode; + this.shelfTypeOptions = res.data.data.shelfTypes; - this.selectedShelfTypeIndex = getConfig("bindSelectedShelfTypeIndex", 0); - + var typeIndex = getConfig("bindSelectedShelfTypeIndex", 0); + if (typeIndex + 1 < this.shelfTypeOptions.length) { + this.selectedShelfTypeIndex = typeIndex; + } + this.shelfAreaOptions = res.data.data.locationArea; - var index = getConfig("bindSelectedShelfAreaIndex", 0); if (index + 1 < this.shelfAreaOptions.length) { this.selectedShelfAreaIndex = index; } - - if (this.shelfId == null) { - this.shelfCode = '(工位无货架,请呼叫!)'; - this.isNeedScanLocationCode = false; - this.isNeedCallShelfCode = true; - this.placeholderText = '请呼叫货架'; - } else if (this.shelfId != null && this.shelfCode != null && this + // if (this.shelfId == null) { + // this.shelfCode = '(工位无货架,请呼叫!)'; + // this.isNeedScanLocationCode = false; + // this.isNeedCallShelfCode = true; + // this.placeholderText = '请呼叫货架'; + // } else + if (this.shelfId != null && this.shelfCode != null && this .shelfCode.includes('运输中')) { this.placeholderText = '请等待货架运输'; @@ -456,7 +465,7 @@ } else { this.clearMatInfo(); saveConfig('matCodeCondition', this.matCodeCondition); - + this.$refs.proup.show(); } }, @@ -552,7 +561,7 @@ return; } - if (this.shelfId == null) { + if (this.shelfId == null || this.shelfId == 0) { uni.showToast({ title: '当前工位无货架!无法送货架!', icon: 'none', diff --git a/PDA/PDA/unpackage/dist/dev/app-plus/app-service.js b/PDA/PDA/unpackage/dist/dev/app-plus/app-service.js index 9f5bc3c..bcf1162 100644 --- a/PDA/PDA/unpackage/dist/dev/app-plus/app-service.js +++ b/PDA/PDA/unpackage/dist/dev/app-plus/app-service.js @@ -818,10 +818,10 @@ if (uni.restoreGlobal) { this.userName = getConfig("userName", "admin"); const self = this; recive(function(res) { - formatAppLog("log", "at pages/bind/bind.vue:228", "Success:" + res.data); + formatAppLog("log", "at pages/bind/bind.vue:234", "Success:" + res.data); self.analysisScanCode(res.data); }, function(err) { - formatAppLog("log", "at pages/bind/bind.vue:231", "Error:", JSON.stringify(err)); + formatAppLog("log", "at pages/bind/bind.vue:237", "Error:", JSON.stringify(err)); }); }, methods: { @@ -829,11 +829,11 @@ if (uni.restoreGlobal) { cameraScanCode() { uni.scanCode({ success: (res) => { - formatAppLog("log", "at pages/bind/bind.vue:239", "扫码结果:", res.result); + formatAppLog("log", "at pages/bind/bind.vue:245", "扫码结果:", res.result); this.analysisScanCode(res.result); }, fail: (err) => { - formatAppLog("error", "at pages/bind/bind.vue:243", "扫码失败:", err); + formatAppLog("error", "at pages/bind/bind.vue:249", "扫码失败:", err); } }); }, @@ -869,18 +869,16 @@ if (uni.restoreGlobal) { this.shelfId = res.data.data.shelfId; this.shelfCode = res.data.data.shelfCode; this.shelfTypeOptions = res.data.data.shelfTypes; - this.selectedShelfTypeIndex = getConfig("bindSelectedShelfTypeIndex", 0); + var typeIndex = getConfig("bindSelectedShelfTypeIndex", 0); + if (typeIndex + 1 < this.shelfTypeOptions.length) { + this.selectedShelfTypeIndex = typeIndex; + } this.shelfAreaOptions = res.data.data.locationArea; var index = getConfig("bindSelectedShelfAreaIndex", 0); if (index + 1 < this.shelfAreaOptions.length) { this.selectedShelfAreaIndex = index; } - if (this.shelfId == null) { - this.shelfCode = "(工位无货架,请呼叫!)"; - this.isNeedScanLocationCode = false; - this.isNeedCallShelfCode = true; - this.placeholderText = "请呼叫货架"; - } else if (this.shelfId != null && this.shelfCode != null && this.shelfCode.includes("运输中")) { + if (this.shelfId != null && this.shelfCode != null && this.shelfCode.includes("运输中")) { this.placeholderText = "请等待货架运输"; } else { this.isNeedScanLocationCode = false; @@ -926,12 +924,12 @@ if (uni.restoreGlobal) { } }, complete: (event) => { - formatAppLog("log", "at pages/bind/bind.vue:349", "请求完成", event); + formatAppLog("log", "at pages/bind/bind.vue:358", "请求完成", event); } }); }, bindSelectedMat: function(item) { - formatAppLog("log", "at pages/bind/bind.vue:355", "用户选择了项目:", item); + formatAppLog("log", "at pages/bind/bind.vue:364", "用户选择了项目:", item); this.matCode = item.matCode; this.matName = item.matName; this.matSpec = item.matSpec; @@ -996,7 +994,7 @@ if (uni.restoreGlobal) { }); }, complete: (event) => { - formatAppLog("log", "at pages/bind/bind.vue:424", "请求完成", event); + formatAppLog("log", "at pages/bind/bind.vue:433", "请求完成", event); } }); }, @@ -1101,7 +1099,7 @@ if (uni.restoreGlobal) { }); }, complete: (event) => { - formatAppLog("log", "at pages/bind/bind.vue:538", "请求完成", event); + formatAppLog("log", "at pages/bind/bind.vue:547", "请求完成", event); } }); }, @@ -1115,7 +1113,7 @@ if (uni.restoreGlobal) { }); return; } - if (this.shelfId == null) { + if (this.shelfId == null || this.shelfId == 0) { uni.showToast({ title: "当前工位无货架!无法送货架!", icon: "none", @@ -1192,7 +1190,7 @@ if (uni.restoreGlobal) { }); }, complete: (event) => { - formatAppLog("log", "at pages/bind/bind.vue:640", "请求完成", event); + formatAppLog("log", "at pages/bind/bind.vue:649", "请求完成", event); } }); }, @@ -1220,7 +1218,7 @@ if (uni.restoreGlobal) { this.matQty = 0; }, handlePopupClose() { - formatAppLog("log", "at pages/bind/bind.vue:672", "弹出层已关闭"); + formatAppLog("log", "at pages/bind/bind.vue:681", "弹出层已关闭"); } } }; @@ -1318,6 +1316,7 @@ if (uni.restoreGlobal) { }, "呼叫货架") ]) ]), + vue.createElementVNode("view", { style: { "border-bottom": "1rpx solid #e0e0e0" } }), vue.createElementVNode("view", { class: "diy-flex-inforow", style: { "flex": "1" } @@ -1452,6 +1451,7 @@ if (uni.restoreGlobal) { }, "绑定") ]) ]), + vue.createElementVNode("view", { style: { "border-bottom": "1rpx solid #e0e0e0" } }), vue.createElementVNode("view", { style: { "flex": "1" } }, [ vue.createElementVNode("view", { style: { "flex": "40", "text-align": "center" } }, [ vue.createElementVNode("view", { class: "picker-container" }, [ diff --git a/WCS.WebApi/Controllers/PDAMatBindController.cs b/WCS.WebApi/Controllers/PDAMatBindController.cs index 14b0cc6..39e0bc6 100644 --- a/WCS.WebApi/Controllers/PDAMatBindController.cs +++ b/WCS.WebApi/Controllers/PDAMatBindController.cs @@ -1,4 +1,5 @@ using Microsoft.AspNetCore.Mvc; +using NPOI.SS.Formula.Functions; using WCS.BLL.DbModels; using WCS.BLL.Manager; using WCS.BLL.Services.IService; @@ -40,7 +41,8 @@ namespace WCS.WebApi.Controllers } //判断参数 - if (string.IsNullOrEmpty(request.LocationCode) && string.IsNullOrEmpty(request.ShelfCode)) + //if (string.IsNullOrEmpty(request.LocationCode) && string.IsNullOrEmpty(request.ShelfCode)) + if (string.IsNullOrEmpty(request.ShelfCode)) { return new ResponseCommon() { @@ -52,12 +54,11 @@ namespace WCS.WebApi.Controllers //获取是否存在当前工位 //扫的工位码 - LocationInfo? location; + LocationInfo? location = null; ShelfInfo? shelf; if (!string.IsNullOrEmpty(request.LocationCode)) { - //TO DO 在哪些物料区域才能进行物料绑定 location = await DbHelp.db.Queryable() .Where(t => t.LocationCode == request.LocationCode) .Where(t => t.IsEnable == true) @@ -109,29 +110,29 @@ namespace WCS.WebApi.Controllers }; } - if (shelf.CurrentLocationId == 0 || string.IsNullOrEmpty(shelf.CurrentLocaiotnCode)) - { - return new ResponseCommon() - { - Code = 201, - Message = $"货架[{request.ShelfCode}]未绑定工位!请尝试将货架与位置绑定后进行操作!", - Data = null, - }; - } + //if (shelf.CurrentLocationId == 0 || string.IsNullOrEmpty(shelf.CurrentLocaiotnCode)) + //{ + // return new ResponseCommon() + // { + // Code = 201, + // Message = $"货架[{request.ShelfCode}]未绑定工位!请尝试将货架与位置绑定后进行操作!", + // Data = null, + // }; + //} location = await DbHelp.db.Queryable() .Where(t => t.LocationCode == shelf.CurrentLocaiotnCode) .Where(t => t.IsEnable == true) .FirstAsync(); - if (location == null) - { - return new ResponseCommon() - { - Code = 201, - Message = $"工位[{shelf.CurrentLocaiotnCode}]不存在或已被禁用!\r\n请联系系统管理人员维护工位信息!", - Data = null, - }; - } + //if (location == null) + //{ + // return new ResponseCommon() + // { + // Code = 201, + // Message = $"工位[{shelf.CurrentLocaiotnCode}]不存在或已被禁用!\r\n请联系系统管理人员维护工位信息!", + // Data = null, + // }; + //} } if (shelf != null && shelf.TransStatus == TransStatusEnum.运输中) @@ -141,31 +142,54 @@ namespace WCS.WebApi.Controllers //允许放置的货架类型 var shelfTypes = new List(); - shelfTypes.Add(new ShelfTypeModel() + + + if (location != null) { - Id = 0, - ShelfTypeName = "请选择" - }); - var shelfTypeInDb = await DbHelp.db.Queryable() - .WhereIF(location.AllowShelfTypes != null && location.AllowShelfTypes.Count > 0, t => location.AllowShelfTypes.Contains(t.Id)) - .ToListAsync(); - shelfTypeInDb.ForEach(t => + shelfTypes.Add(new ShelfTypeModel() + { + Id = 0, + ShelfTypeName = "请选择" + }); + var shelfTypeInDb = await DbHelp.db.Queryable() + .WhereIF(location.AllowShelfTypes != null && location.AllowShelfTypes.Count > 0, t => location.AllowShelfTypes.Contains(t.Id)) + .ToListAsync(); + shelfTypeInDb.ForEach(t => + { + shelfTypes.Add(new ShelfTypeModel() { Id = t.Id, ShelfTypeName = t.ShelfTypeName }); + }); + } + else { - shelfTypes.Add(new ShelfTypeModel() { Id = t.Id, ShelfTypeName = t.ShelfTypeName }); - }); - //货架送回的区域 + shelfTypes.Add(new ShelfTypeModel() + { + Id = 0, + ShelfTypeName = "请先获取工位码" + }); + } + var locationAreas = new List(); - locationAreas.Add(new LocationAreaInfoModel { - Id = 0, - LocationAreaName = "请选择" - }); - var locationAreaInDb = await DbHelp.db.Queryable() - .WhereIF(location.AllowDestinationLocationArea != null && location.AllowDestinationLocationArea.Count > 0, t => location.AllowDestinationLocationArea.Contains(t.Id)) - .ToListAsync(); - locationAreaInDb.ForEach(t => + if (location != null) { - locationAreas.Add(new LocationAreaInfoModel() { Id = t.Id, LocationAreaName = t.LocationAreaName }); - }); + //货架送回的区域 + + locationAreas.Add(new LocationAreaInfoModel + { + Id = 0, + LocationAreaName = "请选择" + }); + var locationAreaInDb = await DbHelp.db.Queryable() + .WhereIF(location.AllowDestinationLocationArea != null && location.AllowDestinationLocationArea.Count > 0, t => location.AllowDestinationLocationArea.Contains(t.Id)) + .ToListAsync(); + locationAreaInDb.ForEach(t => + { + locationAreas.Add(new LocationAreaInfoModel() { Id = t.Id, LocationAreaName = t.LocationAreaName }); + }); + } + else + { + locationAreas.Add(new LocationAreaInfoModel() { Id = 0, LocationAreaName = "请先获取工位码" }); + } return new ResponseBase() { @@ -173,8 +197,8 @@ namespace WCS.WebApi.Controllers Message = $"success", Data = new GetShelfInfoByLocationReturnData() { - LocationId = location.Id, - LocationCode = location.LocationCode, + LocationId = location == null ? 0 : location.Id, + LocationCode = location?.LocationCode, ShelfId = shelf?.Id, ShelfCode = shelf?.ShelfCode, ShelfTypes = shelfTypes, @@ -235,15 +259,15 @@ namespace WCS.WebApi.Controllers { #region 参数校验 //判断参数 - if (request.LocationId == 0 || string.IsNullOrEmpty(request.LocationCode)) - { - return new ResponseCommon() - { - Code = 201, - Message = "工位或工位编码为空!", - Data = null, - }; - } + //if (request.LocationId == 0 || string.IsNullOrEmpty(request.LocationCode)) + //{ + // return new ResponseCommon() + // { + // Code = 201, + // Message = "工位或工位编码为空!", + // Data = null, + // }; + //} if (request.ShelfId == 0 || string.IsNullOrEmpty(request.ShelfCode)) { @@ -289,36 +313,36 @@ namespace WCS.WebApi.Controllers #region 数据校验 //判断参数 - if (string.IsNullOrEmpty(request.LocationCode)) - { - return new ResponseCommon() - { - Code = 201, - Message = "工位编码为空!", - Data = null, - }; - } + //if (string.IsNullOrEmpty(request.LocationCode)) + //{ + // return new ResponseCommon() + // { + // Code = 201, + // Message = "工位编码为空!", + // Data = null, + // }; + //} - //获取是否存在当前工位 - var location = await DbHelp.db.Queryable() - .Where(t => t.Id == request.LocationId) - .Where(t => t.IsEnable == true) - .FirstAsync(); - if (location == null) - { - return new ResponseCommon() - { - Code = 201, - Message = $"工位[{request.LocationCode}]不存在或已被禁用!\r\n请联系系统管理人员维护工位信息!", - Data = null, - }; - } + ////获取是否存在当前工位 + //var location = await DbHelp.db.Queryable() + // .Where(t => t.Id == request.LocationId) + // .Where(t => t.IsEnable == true) + // .FirstAsync(); + //if (location == null) + //{ + // return new ResponseCommon() + // { + // Code = 201, + // Message = $"工位[{request.LocationCode}]不存在或已被禁用!\r\n请联系系统管理人员维护工位信息!", + // Data = null, + // }; + //} //获取当前工位的货架 var shelf = await DbHelp.db.Queryable() .Where(t => t.Id == request.ShelfId) - .Where(t => t.CurrentLocationId == location.Id && t.TransStatus == TransStatusEnum.静止 - || t.DestinationLocationId == location.Id && t.TransStatus == TransStatusEnum.运输中)//解决产线人员 呼叫后货架未到的时候绑定的问题 + //.Where(t => t.CurrentLocationId == location.Id && t.TransStatus == TransStatusEnum.静止 + // || t.DestinationLocationId == location.Id && t.TransStatus == TransStatusEnum.运输中) .Where(t => t.IsEnable == true) .FirstAsync(); if (shelf == null) @@ -326,7 +350,7 @@ namespace WCS.WebApi.Controllers return new ResponseCommon() { Code = 205, - Message = $"货架[{request.ShelfCode}],已不在工位上!\r\n请进行【货架呼叫】!", + Message = $"货架[{request.ShelfCode}]已被禁用!", Data = null, }; }