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

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;">
<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 style="flex: 3;">
@ -30,6 +30,9 @@
</view>
</view>
<view class="diy-flex-column" style="margin-top: 20rpx;">
<view class="diy-flex-inforow" style="flex: 1;">
<view style="flex: 5;"></view>
@ -50,6 +53,7 @@
<button class="mini-btn" type="warn" size="mini" @click="callEmptyShelf">呼叫货架</button>
</view>
</view>
<view style="border-bottom: 1rpx solid #e0e0e0; /* 分隔线的颜色和粗细 */"></view>
<view class="diy-flex-inforow" style="flex: 1;">
<view style="flex: 5;"></view>
@ -126,7 +130,8 @@
<view style="flex: 35;">物料数量</view>
<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 style="flex: 40;">
@ -135,6 +140,7 @@
</view>
</view>
<view style="border-bottom: 1rpx solid #e0e0e0; /* 分隔线的颜色和粗细 */"></view>
<view style="flex: 1;">
<view style="flex: 40;text-align: center;">
@ -199,7 +205,7 @@
shelfCode: '',
matCode: '',
matName: '',
matBatch:'',
matBatch: '',
matSpec: '',
matQty: 0, //默认数量值
@ -278,22 +284,25 @@
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 = '请等待货架运输';
@ -552,7 +561,7 @@
return;
}
if (this.shelfId == null) {
if (this.shelfId == null || this.shelfId == 0) {
uni.showToast({
title: '当前工位无货架!无法送货架!',
icon: 'none',

View File

@ -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" }, [

View File

@ -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<LocationInfo>()
.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<LocationInfo>()
.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<ShelfTypeModel>();
shelfTypes.Add(new ShelfTypeModel()
if (location != null)
{
Id = 0,
ShelfTypeName = "请选择"
});
var shelfTypeInDb = await DbHelp.db.Queryable<ShelfTypeInfo>()
.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<ShelfTypeInfo>()
.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>();
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 =>
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<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>()
{
@ -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<LocationInfo>()
.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<LocationInfo>()
// .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<ShelfInfo>()
.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,
};
}