因现场需要将货架拉走进行物料的绑定 所以不限制货架绑定工位的情况下可以进行物料的绑定

This commit is contained in:
hehaibing-1996
2025-03-07 19:55:09 +08:00
parent f0693b0b2b
commit 425dd58852
3 changed files with 154 additions and 121 deletions

View File

@ -14,7 +14,7 @@
<view class="uni-input-wrapper" style="flex: 60;"> <view class="uni-input-wrapper" style="flex: 60;">
<input id="inputMatCode" class="uni-input" style="font-size: 50rpx; padding: 10rpx;" <input id="inputMatCode" class="uni-input" style="font-size: 50rpx; padding: 10rpx;"
:placeholder="placeholderText" v-model="matCodeCondition" ></input> :placeholder="placeholderText" v-model="matCodeCondition"></input>
</view> </view>
<view style="flex: 3;"> <view style="flex: 3;">
@ -30,6 +30,9 @@
</view> </view>
</view> </view>
<view class="diy-flex-column" style="margin-top: 20rpx;"> <view class="diy-flex-column" style="margin-top: 20rpx;">
<view class="diy-flex-inforow" style="flex: 1;"> <view class="diy-flex-inforow" style="flex: 1;">
<view style="flex: 5;"></view> <view style="flex: 5;"></view>
@ -50,6 +53,7 @@
<button class="mini-btn" type="warn" size="mini" @click="callEmptyShelf">呼叫货架</button> <button class="mini-btn" type="warn" size="mini" @click="callEmptyShelf">呼叫货架</button>
</view> </view>
</view> </view>
<view style="border-bottom: 1rpx solid #e0e0e0; /* 分隔线的颜色和粗细 */"></view>
<view class="diy-flex-inforow" style="flex: 1;"> <view class="diy-flex-inforow" style="flex: 1;">
<view style="flex: 5;"></view> <view style="flex: 5;"></view>
@ -92,7 +96,7 @@
<view style="flex: 90;overflow:hidden;">{{matName}}</view> <view style="flex: 90;overflow:hidden;">{{matName}}</view>
</view> </view>
<view class="diy-flex-inforow" style="flex: 1;"> <view class="diy-flex-inforow" style="flex: 1;">
@ -104,19 +108,19 @@
<view style="flex: 90;overflow:hidden;">{{matSpec}}</view> <view style="flex: 90;overflow:hidden;">{{matSpec}}</view>
</view> </view>
<view class="diy-flex-inforow" style="flex: 1;"> <view class="diy-flex-inforow" style="flex: 1;">
<view style="flex: 5;"></view> <view style="flex: 5;"></view>
<view style="flex: 35;">物料批次</view> <view style="flex: 35;">物料批次</view>
<view class="uni-input-wrapper" style="flex: 80;"> <view class="uni-input-wrapper" style="flex: 80;">
<input class="uni-input" style="font-size: 40rpx; " placeholder="请输入批次" v-model="matBatch"></input> <input class="uni-input" style="font-size: 40rpx; " placeholder="请输入批次" v-model="matBatch"></input>
</view> </view>
<view style="flex: 10;"></view> <view style="flex: 10;"></view>
</view> </view>
<view class="diy-flex-inforow" style="flex: 1;"> <view class="diy-flex-inforow" style="flex: 1;">
@ -126,7 +130,8 @@
<view style="flex: 35;">物料数量</view> <view style="flex: 35;">物料数量</view>
<view class="uni-input-wrapper" style="flex: 50;"> <view class="uni-input-wrapper" style="flex: 50;">
<input class="uni-input" type="number" style="font-size: 40rpx; " placeholder="请输入物料数量" v-model="matQty"></input> <input class="uni-input" type="number" style="font-size: 40rpx; " placeholder="请输入物料数量"
v-model="matQty"></input>
</view> </view>
<view style="flex: 40;"> <view style="flex: 40;">
@ -135,6 +140,7 @@
</view> </view>
</view> </view>
<view style="border-bottom: 1rpx solid #e0e0e0; /* 分隔线的颜色和粗细 */"></view>
<view style="flex: 1;"> <view style="flex: 1;">
<view style="flex: 40;text-align: center;"> <view style="flex: 40;text-align: center;">
@ -152,7 +158,7 @@
</view> </view>
</view> </view>
</view> </view>
</view> </view>
</template> </template>
@ -199,7 +205,7 @@
shelfCode: '', shelfCode: '',
matCode: '', matCode: '',
matName: '', matName: '',
matBatch:'', matBatch: '',
matSpec: '', matSpec: '',
matQty: 0, //默认数量值 matQty: 0, //默认数量值
@ -273,27 +279,30 @@
//接口返回数据为200 表示获取成功! //接口返回数据为200 表示获取成功!
if (res.data.code == 200) { if (res.data.code == 200) {
this.matCodeCondition = ''; this.matCodeCondition = '';
this.locationId = res.data.data.locationId; this.locationId = res.data.data.locationId;
this.locationCode = res.data.data.locationCode; this.locationCode = res.data.data.locationCode;
this.shelfId = res.data.data.shelfId; this.shelfId = res.data.data.shelfId;
this.shelfCode = res.data.data.shelfCode; this.shelfCode = res.data.data.shelfCode;
this.shelfTypeOptions = res.data.data.shelfTypes; 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; this.shelfAreaOptions = res.data.data.locationArea;
var index = getConfig("bindSelectedShelfAreaIndex", 0); var index = getConfig("bindSelectedShelfAreaIndex", 0);
if (index + 1 < this.shelfAreaOptions.length) { if (index + 1 < this.shelfAreaOptions.length) {
this.selectedShelfAreaIndex = index; this.selectedShelfAreaIndex = index;
} }
// if (this.shelfId == null) {
if (this.shelfId == null) { // this.shelfCode = '(工位无货架,请呼叫!)';
this.shelfCode = '(工位无货架,请呼叫!)'; // this.isNeedScanLocationCode = false;
this.isNeedScanLocationCode = false; // this.isNeedCallShelfCode = true;
this.isNeedCallShelfCode = true; // this.placeholderText = '请呼叫货架';
this.placeholderText = '请呼叫货架'; // } else
} else if (this.shelfId != null && this.shelfCode != null && this if (this.shelfId != null && this.shelfCode != null && this
.shelfCode.includes('运输中')) { .shelfCode.includes('运输中')) {
this.placeholderText = '请等待货架运输'; this.placeholderText = '请等待货架运输';
@ -456,7 +465,7 @@
} else { } else {
this.clearMatInfo(); this.clearMatInfo();
saveConfig('matCodeCondition', this.matCodeCondition); saveConfig('matCodeCondition', this.matCodeCondition);
this.$refs.proup.show(); this.$refs.proup.show();
} }
}, },
@ -552,7 +561,7 @@
return; return;
} }
if (this.shelfId == null) { if (this.shelfId == null || this.shelfId == 0) {
uni.showToast({ uni.showToast({
title: '当前工位无货架!无法送货架!', title: '当前工位无货架!无法送货架!',
icon: 'none', icon: 'none',

View File

@ -818,10 +818,10 @@ if (uni.restoreGlobal) {
this.userName = getConfig("userName", "admin"); this.userName = getConfig("userName", "admin");
const self = this; const self = this;
recive(function(res) { 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); self.analysisScanCode(res.data);
}, function(err) { }, 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: { methods: {
@ -829,11 +829,11 @@ if (uni.restoreGlobal) {
cameraScanCode() { cameraScanCode() {
uni.scanCode({ uni.scanCode({
success: (res) => { 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); this.analysisScanCode(res.result);
}, },
fail: (err) => { 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.shelfId = res.data.data.shelfId;
this.shelfCode = res.data.data.shelfCode; this.shelfCode = res.data.data.shelfCode;
this.shelfTypeOptions = res.data.data.shelfTypes; 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; this.shelfAreaOptions = res.data.data.locationArea;
var index = getConfig("bindSelectedShelfAreaIndex", 0); var index = getConfig("bindSelectedShelfAreaIndex", 0);
if (index + 1 < this.shelfAreaOptions.length) { if (index + 1 < this.shelfAreaOptions.length) {
this.selectedShelfAreaIndex = index; this.selectedShelfAreaIndex = index;
} }
if (this.shelfId == null) { if (this.shelfId != null && this.shelfCode != null && this.shelfCode.includes("运输中")) {
this.shelfCode = "(工位无货架,请呼叫!)";
this.isNeedScanLocationCode = false;
this.isNeedCallShelfCode = true;
this.placeholderText = "请呼叫货架";
} else if (this.shelfId != null && this.shelfCode != null && this.shelfCode.includes("运输中")) {
this.placeholderText = "请等待货架运输"; this.placeholderText = "请等待货架运输";
} else { } else {
this.isNeedScanLocationCode = false; this.isNeedScanLocationCode = false;
@ -926,12 +924,12 @@ if (uni.restoreGlobal) {
} }
}, },
complete: (event) => { complete: (event) => {
formatAppLog("log", "at pages/bind/bind.vue:349", "请求完成", event); formatAppLog("log", "at pages/bind/bind.vue:358", "请求完成", event);
} }
}); });
}, },
bindSelectedMat: function(item) { 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.matCode = item.matCode;
this.matName = item.matName; this.matName = item.matName;
this.matSpec = item.matSpec; this.matSpec = item.matSpec;
@ -996,7 +994,7 @@ if (uni.restoreGlobal) {
}); });
}, },
complete: (event) => { 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) => { 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; return;
} }
if (this.shelfId == null) { if (this.shelfId == null || this.shelfId == 0) {
uni.showToast({ uni.showToast({
title: "当前工位无货架!无法送货架!", title: "当前工位无货架!无法送货架!",
icon: "none", icon: "none",
@ -1192,7 +1190,7 @@ if (uni.restoreGlobal) {
}); });
}, },
complete: (event) => { 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; this.matQty = 0;
}, },
handlePopupClose() { 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", { vue.createElementVNode("view", {
class: "diy-flex-inforow", class: "diy-flex-inforow",
style: { "flex": "1" } 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": "1" } }, [
vue.createElementVNode("view", { style: { "flex": "40", "text-align": "center" } }, [ vue.createElementVNode("view", { style: { "flex": "40", "text-align": "center" } }, [
vue.createElementVNode("view", { class: "picker-container" }, [ vue.createElementVNode("view", { class: "picker-container" }, [

View File

@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using NPOI.SS.Formula.Functions;
using WCS.BLL.DbModels; using WCS.BLL.DbModels;
using WCS.BLL.Manager; using WCS.BLL.Manager;
using WCS.BLL.Services.IService; 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() return new ResponseCommon()
{ {
@ -52,12 +54,11 @@ namespace WCS.WebApi.Controllers
//获取是否存在当前工位 //获取是否存在当前工位
//扫的工位码 //扫的工位码
LocationInfo? location; LocationInfo? location = null;
ShelfInfo? shelf; ShelfInfo? shelf;
if (!string.IsNullOrEmpty(request.LocationCode)) if (!string.IsNullOrEmpty(request.LocationCode))
{ {
//TO DO 在哪些物料区域才能进行物料绑定
location = await DbHelp.db.Queryable<LocationInfo>() location = await DbHelp.db.Queryable<LocationInfo>()
.Where(t => t.LocationCode == request.LocationCode) .Where(t => t.LocationCode == request.LocationCode)
.Where(t => t.IsEnable == true) .Where(t => t.IsEnable == true)
@ -109,29 +110,29 @@ namespace WCS.WebApi.Controllers
}; };
} }
if (shelf.CurrentLocationId == 0 || string.IsNullOrEmpty(shelf.CurrentLocaiotnCode)) //if (shelf.CurrentLocationId == 0 || string.IsNullOrEmpty(shelf.CurrentLocaiotnCode))
{ //{
return new ResponseCommon() // return new ResponseCommon()
{ // {
Code = 201, // Code = 201,
Message = $"货架[{request.ShelfCode}]未绑定工位!请尝试将货架与位置绑定后进行操作!", // Message = $"货架[{request.ShelfCode}]未绑定工位!请尝试将货架与位置绑定后进行操作!",
Data = null, // Data = null,
}; // };
} //}
location = await DbHelp.db.Queryable<LocationInfo>() location = await DbHelp.db.Queryable<LocationInfo>()
.Where(t => t.LocationCode == shelf.CurrentLocaiotnCode) .Where(t => t.LocationCode == shelf.CurrentLocaiotnCode)
.Where(t => t.IsEnable == true) .Where(t => t.IsEnable == true)
.FirstAsync(); .FirstAsync();
if (location == null) //if (location == null)
{ //{
return new ResponseCommon() // return new ResponseCommon()
{ // {
Code = 201, // Code = 201,
Message = $"工位[{shelf.CurrentLocaiotnCode}]不存在或已被禁用!\r\n请联系系统管理人员维护工位信息", // Message = $"工位[{shelf.CurrentLocaiotnCode}]不存在或已被禁用!\r\n请联系系统管理人员维护工位信息",
Data = null, // Data = null,
}; // };
} //}
} }
if (shelf != null && shelf.TransStatus == TransStatusEnum.) if (shelf != null && shelf.TransStatus == TransStatusEnum.)
@ -141,31 +142,54 @@ namespace WCS.WebApi.Controllers
//允许放置的货架类型 //允许放置的货架类型
var shelfTypes = new List<ShelfTypeModel>(); var shelfTypes = new List<ShelfTypeModel>();
shelfTypes.Add(new ShelfTypeModel()
if (location != null)
{ {
Id = 0, shelfTypes.Add(new ShelfTypeModel()
ShelfTypeName = "请选择" {
}); Id = 0,
var shelfTypeInDb = await DbHelp.db.Queryable<ShelfTypeInfo>() ShelfTypeName = "请选择"
.WhereIF(location.AllowShelfTypes != null && location.AllowShelfTypes.Count > 0, t => location.AllowShelfTypes.Contains(t.Id)) });
.ToListAsync(); var shelfTypeInDb = await DbHelp.db.Queryable<ShelfTypeInfo>()
shelfTypeInDb.ForEach(t => .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<LocationAreaInfoModel>(); var locationAreas = new List<LocationAreaInfoModel>();
locationAreas.Add(new LocationAreaInfoModel { if (location != null)
Id = 0,
LocationAreaName = "请选择"
});
var locationAreaInDb = await DbHelp.db.Queryable<LocationAreaInfo>()
.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 }); //货架送回的区域
});
locationAreas.Add(new LocationAreaInfoModel
{
Id = 0,
LocationAreaName = "请选择"
});
var locationAreaInDb = await DbHelp.db.Queryable<LocationAreaInfo>()
.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<GetShelfInfoByLocationReturnData>() return new ResponseBase<GetShelfInfoByLocationReturnData>()
{ {
@ -173,8 +197,8 @@ namespace WCS.WebApi.Controllers
Message = $"success", Message = $"success",
Data = new GetShelfInfoByLocationReturnData() Data = new GetShelfInfoByLocationReturnData()
{ {
LocationId = location.Id, LocationId = location == null ? 0 : location.Id,
LocationCode = location.LocationCode, LocationCode = location?.LocationCode,
ShelfId = shelf?.Id, ShelfId = shelf?.Id,
ShelfCode = shelf?.ShelfCode, ShelfCode = shelf?.ShelfCode,
ShelfTypes = shelfTypes, ShelfTypes = shelfTypes,
@ -235,15 +259,15 @@ namespace WCS.WebApi.Controllers
{ {
#region #region
//判断参数 //判断参数
if (request.LocationId == 0 || string.IsNullOrEmpty(request.LocationCode)) //if (request.LocationId == 0 || string.IsNullOrEmpty(request.LocationCode))
{ //{
return new ResponseCommon() // return new ResponseCommon()
{ // {
Code = 201, // Code = 201,
Message = "工位或工位编码为空!", // Message = "工位或工位编码为空!",
Data = null, // Data = null,
}; // };
} //}
if (request.ShelfId == 0 || string.IsNullOrEmpty(request.ShelfCode)) if (request.ShelfId == 0 || string.IsNullOrEmpty(request.ShelfCode))
{ {
@ -289,36 +313,36 @@ namespace WCS.WebApi.Controllers
#region #region
//判断参数 //判断参数
if (string.IsNullOrEmpty(request.LocationCode)) //if (string.IsNullOrEmpty(request.LocationCode))
{ //{
return new ResponseCommon() // return new ResponseCommon()
{ // {
Code = 201, // Code = 201,
Message = "工位编码为空!", // Message = "工位编码为空!",
Data = null, // Data = null,
}; // };
} //}
//获取是否存在当前工位 ////获取是否存在当前工位
var location = await DbHelp.db.Queryable<LocationInfo>() //var location = await DbHelp.db.Queryable<LocationInfo>()
.Where(t => t.Id == request.LocationId) // .Where(t => t.Id == request.LocationId)
.Where(t => t.IsEnable == true) // .Where(t => t.IsEnable == true)
.FirstAsync(); // .FirstAsync();
if (location == null) //if (location == null)
{ //{
return new ResponseCommon() // return new ResponseCommon()
{ // {
Code = 201, // Code = 201,
Message = $"工位[{request.LocationCode}]不存在或已被禁用!\r\n请联系系统管理人员维护工位信息", // Message = $"工位[{request.LocationCode}]不存在或已被禁用!\r\n请联系系统管理人员维护工位信息",
Data = null, // Data = null,
}; // };
} //}
//获取当前工位的货架 //获取当前工位的货架
var shelf = await DbHelp.db.Queryable<ShelfInfo>() var shelf = await DbHelp.db.Queryable<ShelfInfo>()
.Where(t => t.Id == request.ShelfId) .Where(t => t.Id == request.ShelfId)
.Where(t => t.CurrentLocationId == location.Id && t.TransStatus == TransStatusEnum. //.Where(t => t.CurrentLocationId == location.Id && t.TransStatus == TransStatusEnum.静
|| t.DestinationLocationId == location.Id && t.TransStatus == TransStatusEnum.)//解决产线人员 呼叫后货架未到的时候绑定的问题 // || t.DestinationLocationId == location.Id && t.TransStatus == TransStatusEnum.运输中)
.Where(t => t.IsEnable == true) .Where(t => t.IsEnable == true)
.FirstAsync(); .FirstAsync();
if (shelf == null) if (shelf == null)
@ -326,7 +350,7 @@ namespace WCS.WebApi.Controllers
return new ResponseCommon() return new ResponseCommon()
{ {
Code = 205, Code = 205,
Message = $"货架[{request.ShelfCode}],已不在工位上!\r\n请进行【货架呼叫】", Message = $"货架[{request.ShelfCode}]已被禁用",
Data = null, Data = null,
}; };
} }