位置管理 前后端功能

This commit is contained in:
hehaibing-1996
2025-01-13 14:10:32 +08:00
parent f9a1dab76a
commit 6bd77a559b
29 changed files with 917 additions and 190 deletions

View File

@ -17,6 +17,6 @@ namespace WCS.BLL.DbModels
public int Id { get; set; } public int Id { get; set; }
[SugarColumn(ColumnName = "location_area", Length = 64, IsNullable = false, ColumnDescription = "库位区域")] [SugarColumn(ColumnName = "location_area", Length = 64, IsNullable = false, ColumnDescription = "库位区域")]
public string LocationArea { get; set; } public string LocationAreaName { get; set; }
} }
} }

View File

@ -43,8 +43,8 @@ namespace WCS.DAL.DbModels
/// <summary> /// <summary>
/// 可放置货架类型 /// 可放置货架类型
/// </summary> /// </summary>
[SugarColumn(ColumnName = "allow_shelf_types", Length = 512, IsNullable = true, ColumnDescription = "可放置货架类型")] [SugarColumn(ColumnName = "allow_shelf_types", Length = 256, IsNullable = true, ColumnDescription = "可放置货架类型", IsJson = true)]
public string AllowShelfTypes { get; set; } public List<string> AllowShelfTypes { get; set; }
/// <summary> /// <summary>
/// 更新人 /// 更新人

View File

@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WCS.Model.ApiModel.User;
using WCS.Model;
using WCS.DAL.DbModels;
using WCS.Model.ApiModel.StoreInfo;
using WCS.BLL.DbModels;
using WCS.Model.ApiModel.MatBaseInfo;
namespace WCS.BLL.Services.IService
{
public interface ILocationInfoService
{
/// <summary>
/// 查询货架列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public Task<PageQueryResponse<LocationInfo>> GetLocationInfos(GetLocationInfosRequest request);
/// <summary>
/// 添加、更新、删除货架
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public Task<ResponseCommon<object>> addOrUpdateLocationInfo(AddLocaionInfoRequest<LocationInfo> request);
public Task<ResponseCommon<object>> deleteLocationInfo(DeleteInfosRequest request);
}
}

View File

@ -0,0 +1,217 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using TouchSocket.Core;
using WCS.BLL.Config;
using WCS.BLL.DbModels;
using WCS.BLL.HardWare;
using WCS.BLL.Manager;
using WCS.BLL.Services.IService;
using WCS.DAL;
using WCS.DAL.Db;
using WCS.DAL.DbModels;
using WCS.Model;
using WCS.Model.ApiModel;
using WCS.Model.ApiModel.InOutRecord;
using WCS.Model.ApiModel.MatBaseInfo;
using WCS.Model.ApiModel.StoreInfo;
using WCS.Model.ApiModel.User;
namespace WCS.BLL.Services.Service
{
public class LocationInfoService : ILocationInfoService
{
public async Task<PageQueryResponse<LocationInfo>> GetLocationInfos(GetLocationInfosRequest request)
{
try
{
var recordsQueryable = DbHelp.db.Queryable<LocationInfo>()
.WhereIF(request.LocationAreaId != null, t => t.LocationAreaId == request.LocationAreaId)
.WhereIF(request.IsEnable != null, t => t.IsEnable == request.IsEnable)
.WhereIF(!string.IsNullOrEmpty(request.LocationCode), t => t.LocationCode.Contains(request.LocationCode));
//分页
var totalCount = await recordsQueryable.CountAsync();
var records = await recordsQueryable
.Skip((request.PageNumber - 1) * request.PageSize).Take(request.PageSize)
.ToListAsync();
//生成序号
for (int i = 0; i < records.Count; i++)
{
records[i].RowNumber = (request.PageNumber - 1) * request.PageSize + i + 1;
}
return new PageQueryResponse<LocationInfo>()
{
Code = 200,
Message = $"success",
Data = new PageQueryResponseData<LocationInfo>()
{
TotalCount = totalCount,
MaxPage = request.PageSize == 0 ? 0 : (int)Math.Ceiling((decimal)totalCount / request.PageSize),
Count = records.Count,
Lists = records.ToList()
}
};
}
catch (Exception ex)
{
return new PageQueryResponse<LocationInfo>()
{
Code = 300,
Message = $"操作失败:{ex.Message}",
};
}
}
public async Task<ResponseCommon<object>> addOrUpdateLocationInfo(AddLocaionInfoRequest<LocationInfo> request)
{
try
{
var locationInfo = await DbHelp.db.Queryable<LocationInfo>()
.Where(t => t.LocationCode == request.LocationInfo.LocationCode)
.FirstAsync();
//修改位置信息
if (request.AddOrUpdate == AddOrUpdate.Update)
{
var existId = locationInfo == null ? 0 : locationInfo.Id;
locationInfo = await DbHelp.db.Queryable<LocationInfo>()
.Where(t => t.Id == request.LocationInfo.Id)
.FirstAsync();
if (locationInfo == null)
{
return new ResponseCommon<Object>
{
Code = 201,
Message = $"更新位置信息失败:该位置不存在!",
Data = null
};
}
else if (existId != locationInfo.Id)
{
return new ResponseCommon<Object>
{
Code = 201,
Message = $"更新位置信息失败:位置[{locationInfo.LocationCode}]已存在!",
Data = null
};
}
else
{
request.LocationInfo.ModifyUser = request.UserName;
request.LocationInfo.ModifyTime = DateTime.Now;
var rowNum = await DbHelp.db.Updateable(request.LocationInfo).ExecuteCommandAsync();
if (rowNum == 0)
{
return new ResponseCommon<Object>
{
Code = 201,
Message = $"更新位置信息失败:请重试!",
Data = null
};
}
else
{
return new ResponseCommon<Object>
{
Code = 200,
Message = $"更新位置信息成功!",
Data = null
};
}
}
}
else if (request.AddOrUpdate == AddOrUpdate.Add)
{
if (locationInfo != null)
{
return new ResponseCommon<Object>
{
Code = 201,
Message = $"新增位置信息失败:位置[{locationInfo.LocationCode}]已存在!",
Data = null
};
}
else
{
request.LocationInfo.ModifyUser = request.UserName;
var rowNum = await DbHelp.db.Insertable(request.LocationInfo).ExecuteCommandAsync();
if (rowNum == 0)
{
return new ResponseCommon<Object>
{
Code = 201,
Message = $"添加位置信息失败:请重试!",
Data = null
};
}
else
{
return new ResponseCommon<Object>
{
Code = 200,
Message = $"添加位置信息成功!",
Data = null
};
}
}
}
else
{
var response = new ResponseCommon<Object>
{
Code = 300,
Message = "不支持的操作!",
Data = null
};
return response;
}
}
catch (Exception ex)
{
var response = new ResponseCommon<Object>
{
Code = 300,
Message = $"操作失败:{ex.Message}",
Data = null
};
return response;
}
}
public async Task<ResponseCommon<object>> deleteLocationInfo(DeleteInfosRequest request)
{
//先查询出具体的Id
var locationInfos = await DbHelp.db.Queryable<LocationInfo>()
.Where(t => request.needDeleteIds.Contains(t.Id))
.ToListAsync();
//执行删除
try
{
var deleteRows = await DbHelp.db.Deleteable(locationInfos).ExecuteCommandAsync();
return new ResponseCommon<Object>
{
Code = 200,
Message = $"已删除{deleteRows}条数据!",
Data = null
};
}
catch (Exception ex)
{
var response = new ResponseCommon<Object>
{
Code = 300,
Message = $"操作失败:{ex.Message}",
Data = null
};
return response;
}
}
}
}

View File

@ -353,7 +353,7 @@ namespace WCS.BLL.Services.Service
{ {
//先查询出具体的Id //先查询出具体的Id
var matBaseInfos = await DbHelp.db.Queryable<MatBaseInfo>() var matBaseInfos = await DbHelp.db.Queryable<MatBaseInfo>()
.Where(t => request.MatBaseInfoIds.Contains(t.Id)) .Where(t => request.needDeleteIds.Contains(t.Id))
.ToListAsync(); .ToListAsync();
//执行删除 //执行删除
try try

View File

@ -103,6 +103,8 @@ namespace WCS.BLL.Services.Service
else else
{ {
request.ShelfInfo.ModifyUser = request.UserName; request.ShelfInfo.ModifyUser = request.UserName;
request.ShelfInfo.ModifyTime = DateTime.Now;
var rowNum = await DbHelp.db.Updateable(request.ShelfInfo).ExecuteCommandAsync(); var rowNum = await DbHelp.db.Updateable(request.ShelfInfo).ExecuteCommandAsync();
if (rowNum == 0) if (rowNum == 0)
{ {
@ -223,7 +225,7 @@ namespace WCS.BLL.Services.Service
{ {
//先查询出具体的Id //先查询出具体的Id
var shelfInfos = await DbHelp.db.Queryable<ShelfInfo>() var shelfInfos = await DbHelp.db.Queryable<ShelfInfo>()
.Where(t => request.MatBaseInfoIds.Contains(t.Id)) .Where(t => request.needDeleteIds.Contains(t.Id))
.ToListAsync(); .ToListAsync();
//执行删除 //执行删除
try try

View File

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Text;
using WCS.Model.ApiModel.User;
namespace WCS.Model.ApiModel.StoreInfo
{
public class AddLocaionInfoRequest<T> : RequestBase
{
public T LocationInfo { get; set; }
public AddOrUpdate AddOrUpdate { get; set; }
}
}

View File

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace WCS.Model.ApiModel.StoreInfo
{
public class GetLocationInfosRequest : PageQueryRequestBase
{
public int? LocationAreaId { get; set; }
public string LocationCode { get; set; }
public bool? IsEnable { get; set; }
}
}

View File

@ -2,9 +2,9 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace WCS.Model.ApiModel namespace WCS.Model.ApiModel.LocationInfo
{ {
public class LocationAreaModel public class LocationAreaInfoModel
{ {
public int? Id { get; set; } public int? Id { get; set; }
public string LocationAreaName { get; set; } public string LocationAreaName { get; set; }

View File

@ -0,0 +1,84 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
namespace WCS.Model.ApiModel.StoreInfo
{
public class LocationInfoModel : INotifyPropertyChanged
{
/// <summary>
/// 主键 自增Id
/// </summary>
public int Id { get; set; }
/// <summary>
/// 位置编码
/// </summary>
public string LocationCode { get; set; }
/// <summary>
/// 库位区域
/// </summary>
public int? LocationAreaId { get; set; }
/// <summary>
/// 库位区域
/// </summary>
public string LocationArea { get; set; }
/// <summary>
/// RCS库位编码
/// </summary>
public string RcsStoreCode { get; set; } = string.Empty;
/// <summary>
/// 允许放置的货架类型
/// </summary>
public List<string> AllowShelfTypes { get; set; } = new List<string>();
/// <summary>
/// 更新人
/// </summary>
public string ModifyUser { get; set; } = string.Empty;
/// <summary>
/// 更新时间
/// </summary>
public DateTime ModifyTime { get; set; } = DateTime.Now;
/// <summary>
/// 是否启用
/// </summary>
public bool IsEnable { get; set; } = true;
/// <summary>
/// 启用状态显示用字符串
/// </summary>
public string IsEnableStr
{
get
{
if (IsEnable)
return "启用";
else
return "禁用";
}
}
/// <summary>
/// 序号
/// </summary>
public int RowNumber { get; set; }
public bool IsSelected
{
get { return isSelected; }
set
{
isSelected = value;
OnPropertyChanged(nameof(IsSelected));
}
}
public bool isSelected;
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}

View File

@ -7,7 +7,7 @@ namespace WCS.Model.ApiModel.MatBaseInfo
{ {
public class DeleteInfosRequest : RequestBase public class DeleteInfosRequest : RequestBase
{ {
public List<int> MatBaseInfoIds { get; set; } public List<int> needDeleteIds { get; set; }
} }
} }

View File

@ -1,13 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace WCS.Model.ApiModel.StoreInfo
{
public class CalibrationSetOffsetRequest : RequestBase
{
public List<int> MouduleIds { get; set; }
public int OffSet { get; set; }
}
}

View File

@ -1,15 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace WCS.Model.ApiModel.StoreInfo
{
public class DisableOrEnableModuleRequest : RequestBase
{
public int ModuleId { get; set; }
public string ModuleCode { get; set; }
public DisableOrEnableEnum DisableOrEnable { get; set; }
}
}

View File

@ -0,0 +1,85 @@
using Microsoft.AspNetCore.Mvc;
using WCS.BLL.Services.IService;
using WCS.BLL.Services.Service;
using WCS.Model.ApiModel.MatInventoryDetail;
using WCS.Model;
using WCS.Model.ApiModel.StoreInfo;
using WCS.BLL.DbModels;
using WCS.Model.ApiModel.MatBaseInfo;
using WCS.DAL.DbModels;
using WCS.DAL.Db;
using WCS.Model.ApiModel.Home;
using WCS.Model.ApiModel.LocationInfo;
namespace WCS.WebApi.Controllers
{
/// <summary>
/// 货架管理、模组管理、库位管理的接口
/// </summary>
[ApiController]
[Route("[controller]")]
public class LocationInfoController : ControllerBase
{
public ILocationInfoService _locationInfoService { get; set; }
public LocationInfoController(ILocationInfoService locationInfoService)
{
_locationInfoService = locationInfoService;
}
#region
[Route("getLocationAreas")]
[HttpPost(Name = "getLocationAreas")]
public async Task<ResponseBase> getLocationAreas(RequestBase request)
{
try
{
//直接获取当前所有货架类型并返回
var locationAreaInfos = DbHelp.db.Queryable<LocationAreaInfo>()
.Select(t => new LocationAreaInfoModel()
{
Id = t.Id,
LocationAreaName = t.LocationAreaName
})
.ToList();
return new PageQueryResponse<LocationAreaInfoModel>()
{
Code = 200,
Message = "success",
Data = new PageQueryResponseData<LocationAreaInfoModel>
{
Lists = locationAreaInfos,
Count = locationAreaInfos.Count
}
};
}
catch (Exception ex)
{
return new PageQueryResponse<LocationAreaInfoModel>()
{
Code = 300,
Message = $"查询失败:{ex.Message}",
};
}
}
[Route("getLocationInfos")]
[HttpPost(Name = "getLocationInfos")]
public async Task<ResponseBase> GetLocationInfos(GetLocationInfosRequest request)
{
return await _locationInfoService.GetLocationInfos(request);
}
[HttpPost("addOrUpdateLocationInfo")]
public async Task<ResponseCommon<object>> addOrUpdateLocationInfo(AddLocaionInfoRequest<LocationInfo> request)
{
return await _locationInfoService.addOrUpdateLocationInfo(request);
}
[HttpPost("deleteLocationInfo")]
public async Task<ResponseCommon<object>> deleteLocationInfo(DeleteInfosRequest request)
{
return await _locationInfoService.deleteLocationInfo(request);
}
#endregion
}
}

View File

@ -81,6 +81,7 @@ namespace WebApi
builder.Services.AddScoped<IWarningService, WarningService>(); builder.Services.AddScoped<IWarningService, WarningService>();
builder.Services.AddScoped<IInOutRecordService, InOutRecordService>(); builder.Services.AddScoped<IInOutRecordService, InOutRecordService>();
builder.Services.AddScoped<IUploadService, UploadService>(); builder.Services.AddScoped<IUploadService, UploadService>();
builder.Services.AddScoped<ILocationInfoService, LocationInfoService>();
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EBA1A2><EFBFBD>ɵ<EFBFBD><C9B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><C3B5><EFBFBD>ģʽ //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EBA1A2><EFBFBD>ɵ<EFBFBD><C9B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><C3B5><EFBFBD>ģʽ
builder.Services.AddSingleton<IGenerateService, GenerateService>(); builder.Services.AddSingleton<IGenerateService, GenerateService>();

View File

@ -18,6 +18,7 @@
<local:AuthConverter x:Key="AuthConverter"/> <local:AuthConverter x:Key="AuthConverter"/>
<local:AuthVisConverter x:Key="AuthVisConverter"/> <local:AuthVisConverter x:Key="AuthVisConverter"/>
<local:AuthVisHidConverter x:Key="AuthVisHidConverter"/> <local:AuthVisHidConverter x:Key="AuthVisHidConverter"/>
<local:ListToString x:Key="listToString"/>
<!--字体--> <!--字体-->
<FontFamily x:Key="IconFont">pack://application,,,/智慧物流软件系统;component/Fonts/#iconfont</FontFamily> <FontFamily x:Key="IconFont">pack://application,,,/智慧物流软件系统;component/Fonts/#iconfont</FontFamily>
<!--字符串--> <!--字符串-->

View File

@ -0,0 +1,44 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
namespace
{
public class ListToString : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value == null)
return "";
if (value is string)
{
return value.ToString();
}
else if (value is List<string>)
{
List<string> strList = new List<string>();
string sep = parameter == null ? "," : parameter.ToString();
foreach (var item in value as List<string>)
{
strList.Add(item.ToString());
}
return string.Join(sep, strList);
}
return "";
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotSupportedException();
}
}
}

View File

@ -6,6 +6,7 @@ using System.Threading.Tasks;
using System.Windows.Documents; using System.Windows.Documents;
using WCS.Model; using WCS.Model;
using WCS.Model.ApiModel.Home; using WCS.Model.ApiModel.Home;
using WCS.Model.ApiModel.LocationInfo;
using .Api; using .Api;
namespace .Tool namespace .Tool
@ -27,5 +28,24 @@ namespace 智慧物流软件系统.Tool
} }
else { return new List<ShelfTypeModel>(); } else { return new List<ShelfTypeModel>(); }
} }
public static List<LocationAreaInfoModel> GetLocationAreaInfos()
{
var body = new RequestBase()
{
UserName = LocalStatic.CurrentUser,
DeviceType = LocalFile.Config.DeviceType,
};
var Result = ApiHelp.GetDataFromHttp<PageQueryResponse<LocationAreaInfoModel>>(LocalFile.Config.ApiIpHost + "locationInfo/getLocationAreas", body, "POST");
if (Result != null && Result.Data != null && Result.Data.Lists.Count() > 0)
{
return Result.Data.Lists;
}
else
{
return new List<LocationAreaInfoModel>();
}
}
} }
} }

View File

@ -19,6 +19,7 @@ using WCS.Model.ApiModel.MatBaseInfo;
using WCS.Model.ApiModel.User; using WCS.Model.ApiModel.User;
using WCS.Model.ApiModel; using WCS.Model.ApiModel;
using Newtonsoft.Json.Bson; using Newtonsoft.Json.Bson;
using WCS.Model.ApiModel.LocationInfo;
namespace .ViewModel namespace .ViewModel
{ {
@ -30,8 +31,8 @@ namespace 智慧物流软件系统.ViewModel
} }
#region Property #region Property
private List<ShelfInfoModel> dataGridItemSource; private List<LocationInfoModel> dataGridItemSource;
public List<ShelfInfoModel> DataGridItemSource public List<LocationInfoModel> DataGridItemSource
{ {
get { return dataGridItemSource; } get { return dataGridItemSource; }
set set
@ -40,8 +41,8 @@ namespace 智慧物流软件系统.ViewModel
} }
} }
private ShelfInfoModel selectedataGridItem; private LocationInfoModel selectedataGridItem;
public ShelfInfoModel SelectedataGridItem public LocationInfoModel SelectedataGridItem
{ {
get { return selectedataGridItem; } get { return selectedataGridItem; }
set set
@ -52,7 +53,7 @@ namespace 智慧物流软件系统.ViewModel
/// <summary> /// <summary>
/// 货架编号 /// 位置编号
/// </summary> /// </summary>
private string locationCode; private string locationCode;
public string LocationCode public string LocationCode
@ -64,8 +65,8 @@ namespace 智慧物流软件系统.ViewModel
} }
} }
private List<ShelfTypeModel> locationAreaItems; private List<LocationAreaInfoModel> locationAreaItems;
public List<ShelfTypeModel> LocationAreaItems public List<LocationAreaInfoModel> LocationAreaItems
{ {
get { return locationAreaItems; } get { return locationAreaItems; }
set set
@ -74,8 +75,8 @@ namespace 智慧物流软件系统.ViewModel
} }
} }
private ShelfTypeModel? selectedLocationAreaItems; private LocationAreaInfoModel? selectedLocationAreaItems;
public ShelfTypeModel? SelectedLocationAreaItems public LocationAreaInfoModel? SelectedLocationAreaItems
{ {
get { return selectedLocationAreaItems; } get { return selectedLocationAreaItems; }
set set
@ -89,8 +90,8 @@ namespace 智慧物流软件系统.ViewModel
//调用接口更新! //调用接口更新!
Task.Run(() => Task.Run(() =>
{ {
LocationAreaItems = new List<ShelfTypeModel>(); LocationAreaItems = new List<LocationAreaInfoModel>();
LocationAreaItems.Add(new ShelfTypeModel { Id = null, ShelfTypeName = "全部" }); LocationAreaItems.Add(new LocationAreaInfoModel { Id = null, LocationAreaName = "全部" });
var body = new RequestBase() var body = new RequestBase()
{ {
@ -98,7 +99,7 @@ namespace 智慧物流软件系统.ViewModel
DeviceType = LocalFile.Config.DeviceType, DeviceType = LocalFile.Config.DeviceType,
}; };
var Result = ApiHelp.GetDataFromHttp<PageQueryResponse<ShelfTypeModel>>(LocalFile.Config.ApiIpHost + "home/getShelfTypes", body, "POST"); var Result = ApiHelp.GetDataFromHttp<PageQueryResponse<LocationAreaInfoModel>>(LocalFile.Config.ApiIpHost + "locationInfo/getLocationAreas", body, "POST");
if (Result != null && Result.Data != null && Result.Data.Lists.Count() > 0) if (Result != null && Result.Data != null && Result.Data.Lists.Count() > 0)
{ {
LocationAreaItems.AddRange(Result.Data.Lists); LocationAreaItems.AddRange(Result.Data.Lists);
@ -151,17 +152,17 @@ namespace 智慧物流软件系统.ViewModel
var dia = Dialog.Show(new TextDialog()); var dia = Dialog.Show(new TextDialog());
try try
{ {
var body = new GetShelvesRequest() var body = new GetLocationInfosRequest()
{ {
ShelfTypeId = SelectedLocationAreaItems == null ? null : SelectedLocationAreaItems.Id, LocationAreaId = SelectedLocationAreaItems == null ? null : SelectedLocationAreaItems.Id,
ShelfCode = LocationCode, LocationCode = LocationCode,
IsEnable = IsEnable, IsEnable = IsEnable,
UserName = LocalStatic.CurrentUser, UserName = LocalStatic.CurrentUser,
DeviceType = LocalFile.Config.DeviceType, DeviceType = LocalFile.Config.DeviceType,
PageNumber = CurrentPage, PageNumber = CurrentPage,
PageSize = PageSize, PageSize = PageSize,
}; };
var Result = ApiHelp.GetDataFromHttp<PageQueryResponse<ShelfInfoModel>>(LocalFile.Config.ApiIpHost + "storeInfo/getShelves", body, "POST"); var Result = ApiHelp.GetDataFromHttp<PageQueryResponse<LocationInfoModel>>(LocalFile.Config.ApiIpHost + "locationInfo/getLocationInfos", body, "POST");
if (Result != null && Result.Data != null && Result.Data.Lists != null) if (Result != null && Result.Data != null && Result.Data.Lists != null)
{ {
DataGridItemSource = Result.Data.Lists; DataGridItemSource = Result.Data.Lists;
@ -186,7 +187,7 @@ namespace 智慧物流软件系统.ViewModel
public ICommand BtnAddCommand { get => new DelegateCommand(BtnAdd); } public ICommand BtnAddCommand { get => new DelegateCommand(BtnAdd); }
public async void BtnAdd() public async void BtnAdd()
{ {
var addView = new ShelfInfoAddOrUpdateView("新增货架"); var addView = new LocationInfoAddOrUpdateView("新增位置");
addView.ShowDialog(); addView.ShowDialog();
if (addView.DialogResult == true) if (addView.DialogResult == true)
{ {
@ -199,14 +200,14 @@ namespace 智慧物流软件系统.ViewModel
public async void BtnEdit() public async void BtnEdit()
{ {
//查询勾选的第一个数据 //查询勾选的第一个数据
var shelfInfo = DataGridItemSource?.Where(t => t.IsSelected == true).FirstOrDefault(); var info = DataGridItemSource?.Where(t => t.IsSelected == true).FirstOrDefault();
if (shelfInfo == null) if (info == null)
{ {
Growl.Warning("请选择需要修改的数据!"); Growl.Warning("请选择需要修改的数据!");
} }
else else
{ {
var addView = new ShelfInfoAddOrUpdateView("修改货架", shelfInfo); var addView = new LocationInfoAddOrUpdateView("修改位置", info);
addView.ShowDialog(); addView.ShowDialog();
if (addView.DialogResult == true) if (addView.DialogResult == true)
{ {
@ -223,11 +224,11 @@ namespace 智慧物流软件系统.ViewModel
if (isConfirmed) if (isConfirmed)
{ {
//查询勾选的第一个数据 //查询勾选的第一个数据
var matBaseInfoIds = DataGridItemSource?.Where(t => t.IsSelected == true) var needDeleteIds = DataGridItemSource?.Where(t => t.IsSelected == true)
.Select(t => t.Id) .Select(t => t.Id)
.ToList(); .ToList();
if (matBaseInfoIds == null) if (needDeleteIds == null)
{ {
Growl.Warning("请选择需要修改的数据!"); Growl.Warning("请选择需要修改的数据!");
} }
@ -237,9 +238,9 @@ namespace 智慧物流软件系统.ViewModel
{ {
UserName = LocalStatic.CurrentUser, UserName = LocalStatic.CurrentUser,
DeviceType = LocalFile.Config.DeviceType, DeviceType = LocalFile.Config.DeviceType,
MatBaseInfoIds = matBaseInfoIds, needDeleteIds = needDeleteIds,
}; };
var Result = ApiHelp.GetDataFromHttp<ResponseBase<UserModel>>(LocalFile.Config.ApiIpHost + "storeInfo/deleteShelfInfo", body, "POST"); var Result = ApiHelp.GetDataFromHttp<ResponseBase<UserModel>>(LocalFile.Config.ApiIpHost + "locationInfo/deleteLocationInfo", body, "POST");
if (Result != null && Result.Code == 200) if (Result != null && Result.Code == 200)
{ {
BtnSearch(); BtnSearch();
@ -255,8 +256,8 @@ namespace 智慧物流软件系统.ViewModel
}); });
////查询勾选的第一个数据 ////查询勾选的第一个数据
//var shelfInfo = DataGridItemSource?.Where(t => t.IsSelected == true).FirstOrDefault(); //var info = DataGridItemSource?.Where(t => t.IsSelected == true).FirstOrDefault();
//if (shelfInfo == null) //if (info == null)
//{ //{
// Growl.Warning("请选择需要删除的数据!"); // Growl.Warning("请选择需要删除的数据!");
//} //}
@ -266,7 +267,7 @@ namespace 智慧物流软件系统.ViewModel
// { // {
// UserName = LocalStatic.CurrentUser, // UserName = LocalStatic.CurrentUser,
// DeviceType = LocalFile.Config.DeviceType, // DeviceType = LocalFile.Config.DeviceType,
// ShelfInfo = shelfInfo, // ShelfInfo = info,
// AddOrUpdate = AddOrUpdate.Delete // AddOrUpdate = AddOrUpdate.Delete
// }; // };
// var Result = ApiHelp.GetDataFromHttp<ResponseBase<object>>(LocalFile.Config.ApiIpHost + "storeInfo/addOrUpdateShelfInfo", body, "POST"); // var Result = ApiHelp.GetDataFromHttp<ResponseBase<object>>(LocalFile.Config.ApiIpHost + "storeInfo/addOrUpdateShelfInfo", body, "POST");

View File

@ -0,0 +1,171 @@
using HandyControl.Controls;
using Ping9719.WpfEx.Mvvm;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.AccessControl;
using System.Security.Cryptography.X509Certificates;
using System.Threading.Tasks;
using System.Web.UI.WebControls;
using System.Windows.Controls;
using TouchSocket.Core;
using WCS.Model;
using WCS.Model.ApiModel.Home;
using WCS.Model.ApiModel.LocationInfo;
using WCS.Model.ApiModel.StoreInfo;
using .Tool;
namespace .ViewModel
{
public class LocationInfoAddOrUpdateViewModel : BindableBase
{
public HandyControl.Controls.CheckComboBox checkComboBox { get; set; }
#region Property
public LocationInfoAddOrUpdateViewModel()
{
}
public void InitTypes()
{
try
{
var task1 = Task.Run(() =>
{
LocationAreaItems = GetBaseData.GetLocationAreaInfos();
if (LocationAreaItems != null && LocationAreaItems.Count > 0)
SelectedLocationAreaItem = LocationAreaItems.First();
});
var task2 = Task.Run(() =>
{
AllowShelfTypes = new List<string>();
AllowShelfTypes = GetBaseData.GetShelfType()
.Select(t => t.ShelfTypeName)
.ToList();
});
Task.WaitAll([task1, task2]);
}
catch (Exception ex)
{
Growl.Warning("打开窗体失败,请关闭后重试!");
}
}
public void SetValues(LocationInfoModel locationInfoModel)
{
if (locationInfoModel == null)
{
locationInfoModel = new LocationInfoModel();
}
LocationId = locationInfoModel.Id;
var item = LocationAreaItems.FirstOrDefault(t => t.Id == locationInfoModel.LocationAreaId);
if (item != null)
{
SelectedLocationAreaItem = item;
}
LocationCode = locationInfoModel.LocationCode;
RcsStoreCode = locationInfoModel.RcsStoreCode;
//comboBox.selec
App.Current.Dispatcher.Invoke(() =>
{
locationInfoModel.AllowShelfTypes?.ForEach(t => checkComboBox.SelectedItems.Add(t));
});
IsEnable = locationInfoModel.IsEnable;
}
public LocationInfoModel GetValues()
{
var selectShelfTypes = checkComboBox.SelectedItems?.Cast<string>().ToList();
return new LocationInfoModel()
{
Id = LocationId,
LocationAreaId = SelectedLocationAreaItem.Id,
LocationArea = SelectedLocationAreaItem.LocationAreaName,
LocationCode = LocationCode,
RcsStoreCode = RcsStoreCode,
ModifyUser = LocalStatic.CurrentUser,
AllowShelfTypes = selectShelfTypes,
IsEnable = IsEnable,
};
}
private List<LocationAreaInfoModel> locationAreaItems;
public List<LocationAreaInfoModel> LocationAreaItems
{
get { return locationAreaItems; }
set
{
SetProperty(ref locationAreaItems, value);
}
}
private LocationAreaInfoModel selectedLocationAreaItem;
public LocationAreaInfoModel SelectedLocationAreaItem
{
get { return selectedLocationAreaItem; }
set
{
SetProperty(ref selectedLocationAreaItem, value);
}
}
private int locationId;
public int LocationId
{
get { return locationId; }
set
{
SetProperty(ref locationId, value);
}
}
private string locationCode;
public string LocationCode
{
get { return locationCode; }
set
{
SetProperty(ref locationCode, value);
}
}
/// <summary>
/// 允许放置的货架类型
/// </summary>
private List<string> allowShelfTypes;
public List<string> AllowShelfTypes
{
get { return allowShelfTypes; }
set
{
SetProperty(ref allowShelfTypes, value);
}
}
private string rcsStoreCode;
public string RcsStoreCode
{
get { return rcsStoreCode; }
set
{
SetProperty(ref rcsStoreCode, value);
}
}
private bool isEnable;
public bool IsEnable
{
get { return isEnable; }
set
{
SetProperty(ref isEnable, value);
}
}
#endregion
}
}

View File

@ -338,11 +338,11 @@ namespace 智慧物流软件系统.ViewModel
if (isConfirmed) if (isConfirmed)
{ {
//查询勾选的第一个数据 //查询勾选的第一个数据
var matBaseInfoIds = DataGridItemSource?.Where(t => t.IsSelected == true) var needDeleteIds = DataGridItemSource?.Where(t => t.IsSelected == true)
.Select(t => t.Id) .Select(t => t.Id)
.ToList(); .ToList();
if (matBaseInfoIds == null) if (needDeleteIds == null)
{ {
Growl.Warning("请选择需要修改的数据!"); Growl.Warning("请选择需要修改的数据!");
} }
@ -352,7 +352,7 @@ namespace 智慧物流软件系统.ViewModel
{ {
UserName = LocalStatic.CurrentUser, UserName = LocalStatic.CurrentUser,
DeviceType = LocalFile.Config.DeviceType, DeviceType = LocalFile.Config.DeviceType,
MatBaseInfoIds = matBaseInfoIds, needDeleteIds = needDeleteIds,
}; };
var Result = ApiHelp.GetDataFromHttp<ResponseBase<UserModel>>(LocalFile.Config.ApiIpHost + "matBaseInfo/deleteMatBaseInfo", body, "POST"); var Result = ApiHelp.GetDataFromHttp<ResponseBase<UserModel>>(LocalFile.Config.ApiIpHost + "matBaseInfo/deleteMatBaseInfo", body, "POST");
if (Result != null && Result.Code == 200) if (Result != null && Result.Code == 200)

View File

@ -212,11 +212,11 @@ namespace 智慧物流软件系统.ViewModel
if (isConfirmed) if (isConfirmed)
{ {
//查询勾选的第一个数据 //查询勾选的第一个数据
var matBaseInfoIds = DataGridItemSource?.Where(t => t.IsSelected == true) var needDeleteIds = DataGridItemSource?.Where(t => t.IsSelected == true)
.Select(t => t.Id) .Select(t => t.Id)
.ToList(); .ToList();
if (matBaseInfoIds == null) if (needDeleteIds == null)
{ {
Growl.Warning("请选择需要修改的数据!"); Growl.Warning("请选择需要修改的数据!");
} }
@ -226,7 +226,7 @@ namespace 智慧物流软件系统.ViewModel
{ {
UserName = LocalStatic.CurrentUser, UserName = LocalStatic.CurrentUser,
DeviceType = LocalFile.Config.DeviceType, DeviceType = LocalFile.Config.DeviceType,
MatBaseInfoIds = matBaseInfoIds, needDeleteIds = needDeleteIds,
}; };
var Result = ApiHelp.GetDataFromHttp<ResponseBase<UserModel>>(LocalFile.Config.ApiIpHost + "matBaseInfos/deleteMatBaseInfo", body, "POST"); var Result = ApiHelp.GetDataFromHttp<ResponseBase<UserModel>>(LocalFile.Config.ApiIpHost + "matBaseInfos/deleteMatBaseInfo", body, "POST");
if (Result != null && Result.Code == 200) if (Result != null && Result.Code == 200)

View File

@ -223,11 +223,11 @@ namespace 智慧物流软件系统.ViewModel
if (isConfirmed) if (isConfirmed)
{ {
//查询勾选的第一个数据 //查询勾选的第一个数据
var matBaseInfoIds = DataGridItemSource?.Where(t => t.IsSelected == true) var needDeleteIds = DataGridItemSource?.Where(t => t.IsSelected == true)
.Select(t => t.Id) .Select(t => t.Id)
.ToList(); .ToList();
if (matBaseInfoIds == null) if (needDeleteIds == null)
{ {
Growl.Warning("请选择需要修改的数据!"); Growl.Warning("请选择需要修改的数据!");
} }
@ -237,7 +237,7 @@ namespace 智慧物流软件系统.ViewModel
{ {
UserName = LocalStatic.CurrentUser, UserName = LocalStatic.CurrentUser,
DeviceType = LocalFile.Config.DeviceType, DeviceType = LocalFile.Config.DeviceType,
MatBaseInfoIds = matBaseInfoIds, needDeleteIds = needDeleteIds,
}; };
var Result = ApiHelp.GetDataFromHttp<ResponseBase<UserModel>>(LocalFile.Config.ApiIpHost + "storeInfo/deleteShelfInfo", body, "POST"); var Result = ApiHelp.GetDataFromHttp<ResponseBase<UserModel>>(LocalFile.Config.ApiIpHost + "storeInfo/deleteShelfInfo", body, "POST");
if (Result != null && Result.Code == 200) if (Result != null && Result.Code == 200)

View File

@ -0,0 +1,91 @@
<Window
xmlns:pi="https://github.com/ping9719/wpfex"
x:Class="智慧物流软件系统.LocationInfoAddOrUpdateView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:hc="https://handyorg.github.io/handycontrol"
mc:Ignorable="d"
Height="320" Width="320" WindowStyle="None" BorderThickness="0" Background="{x:Null}" AllowsTransparency="True" WindowStartupLocation="CenterScreen" Opacity="1">
<Border BorderBrush="Gray" Background="WhiteSmoke" CornerRadius="5" BorderThickness="1">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="auto"></RowDefinition>
</Grid.RowDefinitions>
<TextBlock FontSize="18" Name="Title" Text="{Binding Title, FallbackValue=新增位置}" TextWrapping="Wrap" VerticalAlignment="Center" HorizontalAlignment="Center"/>
<Button Margin="-5,-1"
Visibility="{Binding IsClose,Converter={StaticResource Boolean2VisibilityConverter}}"
Style="{StaticResource ButtonIcon}"
hc:IconElement.Geometry="{StaticResource CloseGeometry}" HorizontalAlignment="Right"
VerticalAlignment="Top" Click="closeClick"/>
<StackPanel Margin="5,0" Grid.Row="1" >
<StackPanel Orientation="Horizontal" Margin="5">
<TextBlock Text="库位区域: " FontSize="15" VerticalAlignment="Center" HorizontalAlignment="Right"></TextBlock>
<ComboBox Grid.Row="0" Grid.Column="1"
DisplayMemberPath="LocationAreaName"
ItemsSource="{Binding LocationAreaItems}"
SelectedItem="{Binding SelectedLocationAreaItem}"
IsEditable="False"
MinWidth="200"
FontSize="18" />
<TextBlock Text="*" Foreground="Red" VerticalAlignment="Center">
</TextBlock>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="5">
<TextBlock Text="位置编号: " FontSize="15" VerticalAlignment="Center" HorizontalAlignment="Right"></TextBlock>
<TextBox Name="txtLocationCode" MinWidth="200" Grid.Row="0" Grid.Column="1" FontSize="15"
VerticalAlignment="Center" HorizontalAlignment="Stretch"
Style="{StaticResource TextBoxExtend}"
Text="{Binding LocationCode}"
hc:InfoElement.Placeholder="此项必填">
</TextBox>
<TextBlock Text="*" Foreground="Red" VerticalAlignment="Center">
</TextBlock>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="5">
<TextBlock Text="RCS库位编号: " FontSize="15" VerticalAlignment="Center" HorizontalAlignment="Right"></TextBlock>
<TextBox Name="txtRowCounts" MinWidth="200" Grid.Row="0" Grid.Column="1" FontSize="15"
VerticalAlignment="Center" HorizontalAlignment="Stretch"
Style="{StaticResource TextBoxExtend}"
Text="{Binding RcsStoreCode}">
</TextBox>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="5">
<TextBlock Text="可放置货架类型: " FontSize="15" VerticalAlignment="Center" HorizontalAlignment="Right"></TextBlock>
<hc:CheckComboBox Margin="5" Height="60"
ItemsSource="{Binding AllowShelfTypes}"
Name="Group" MinWidth="150" MaxWidth="150"
hc:InfoElement.Necessary="True"
Style="{StaticResource CheckComboBoxExtend}" >
</hc:CheckComboBox>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="5">
<TextBlock Text="启用状态: " FontSize="15" VerticalAlignment="Center" HorizontalAlignment="Right"></TextBlock>
<ComboBox Name="IsBind" MinWidth="100" Grid.Row="0" Grid.Column="1" FontSize="15"
VerticalAlignment="Center" HorizontalAlignment="Stretch"
SelectedValuePath="Tag" SelectedValue="{Binding IsEnable}">
<ComboBoxItem Tag="True" IsSelected="True">启用</ComboBoxItem>
<ComboBoxItem Tag="False" >禁用</ComboBoxItem>
</ComboBox>
</StackPanel>
</StackPanel>
<StackPanel Margin="5" x:Name="spacingPanel" Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<Button Margin="5" MinHeight="30" FontSize="15" Content="确认" Name="btnOk" Click="btnOk_Click"/>
<Button Margin="5" MinHeight="30" FontSize="15" Content="取消" Click="closeClick"/>
</StackPanel>
</Grid>
</Border>
</Window>

View File

@ -0,0 +1,87 @@
using HandyControl.Controls;
using SqlSugar;
using System;
using System.Windows;
using WCS.BLL.DbModels;
using WCS.Model;
using WCS.Model.ApiModel.StoreInfo;
using WCS.Model.ApiModel.User;
using .Api;
using .ViewModel;
namespace
{
public partial class LocationInfoAddOrUpdateView : System.Windows.Window
{
public LocationInfoAddOrUpdateViewModel ViewModel = new LocationInfoAddOrUpdateViewModel();
public LocationInfoAddOrUpdateView(string _titleText, LocationInfoModel _locationInfoModel = null)
{
InitializeComponent();
this.DataContext = ViewModel;
ViewModel.InitTypes();
ViewModel.checkComboBox = this.Group;
//绑定标题
if (!string.IsNullOrEmpty(_titleText))
{
Title.Text = _titleText;
}
ViewModel.SetValues(_locationInfoModel);
}
private void btnOk_Click(object sender, RoutedEventArgs e)
{
try
{
#region
if (string.IsNullOrEmpty(ViewModel.LocationCode))
{
Growl.Warning("请输入位置编码!");
txtLocationCode.Focus();
return;
}
#endregion
#region /
var IsAdd = Title.Text == "新增位置";
var body = new AddLocaionInfoRequest<LocationInfoModel>()
{
UserName = LocalStatic.CurrentUser,
DeviceType = LocalFile.Config.DeviceType,
LocationInfo = ViewModel.GetValues(),
AddOrUpdate = IsAdd ? AddOrUpdate.Add : AddOrUpdate.Update
};
var Result = ApiHelp.GetDataFromHttp<ResponseBase<object>>(LocalFile.Config.ApiIpHost + "locationInfo/addOrUpdateLocationInfo", body, "POST");
if (Result != null && Result.Code == 200)
{
if (IsAdd)
Growl.Success("添加成功!");
else
Growl.Success("修改成功!");
this.DialogResult = true;
this.Close();
}
else
{
Growl.Error($"{Result?.Message?.ToString()}");
}
#endregion
}
//绑定数据
catch (Exception ex)
{
Growl.Error($"操作异常:{ex.Message}");
return;
}
}
private void closeClick(object sender, RoutedEventArgs e)
{
this.DialogResult = false;
this.Close();
}
}
}

View File

@ -43,7 +43,7 @@
<ComboBox Grid.Row="0" Grid.Column="3" <ComboBox Grid.Row="0" Grid.Column="3"
DisplayMemberPath="LocationAreaName" DisplayMemberPath="LocationAreaName"
ItemsSource="{Binding LocationAreaItems}" ItemsSource="{Binding LocationAreaItems}"
SelectedItem="{Binding SelectedLocationAreaItem}" SelectedItem="{Binding SelectedLocationAreaItems}"
Height="30" Height="30"
FontSize="18" FontSize="18"
IsEditable="False"/> IsEditable="False"/>
@ -141,13 +141,11 @@
</DataGridTemplateColumn.HeaderTemplate> </DataGridTemplateColumn.HeaderTemplate>
</DataGridTemplateColumn> </DataGridTemplateColumn>
<DataGridTextColumn IsReadOnly="True" Header="序号" Binding="{Binding RowNumber}"></DataGridTextColumn> <DataGridTextColumn IsReadOnly="True" Header="序号" Binding="{Binding RowNumber}"></DataGridTextColumn>
<DataGridTextColumn Header="物料编码" Binding="{Binding MatCode}"></DataGridTextColumn> <DataGridTextColumn Header="库位区域" MaxWidth="150" Binding="{Binding LocationArea}"></DataGridTextColumn>
<DataGridTextColumn Header="名称" MaxWidth="150" Binding="{Binding MatName}"></DataGridTextColumn> <DataGridTextColumn Header="位置编号" Binding="{Binding LocationCode}"></DataGridTextColumn>
<DataGridTextColumn Header="规格" MaxWidth="150" Binding="{Binding MatSpec}"></DataGridTextColumn> <DataGridTextColumn Header="RCS库位编号" MaxWidth="150" Binding="{Binding RcsStoreCode}"></DataGridTextColumn>
<DataGridTextColumn Header="单位" Binding="{Binding MatUnit}"></DataGridTextColumn> <DataGridTextColumn Header="可放置货架类型" Binding="{Binding AllowShelfTypes,Converter={StaticResource listToString}}"></DataGridTextColumn>
<DataGridTextColumn IsReadOnly="True" Header="启用状态" Binding="{Binding IsEnableStr}"></DataGridTextColumn>
<DataGridTextColumn Header="客户" Binding="{Binding MatCustomer}"></DataGridTextColumn>
<DataGridTextColumn IsReadOnly="True" Header="状态" Binding="{Binding IsEnableStr}"></DataGridTextColumn>
<DataGridTextColumn IsReadOnly="True" Header="更新人" Binding="{Binding ModifyUser}"></DataGridTextColumn> <DataGridTextColumn IsReadOnly="True" Header="更新人" Binding="{Binding ModifyUser}"></DataGridTextColumn>
<DataGridTextColumn IsReadOnly="True" Header="更新时间" Binding="{Binding ModifyTime ,StringFormat='yyyy-MM-dd HH:mm:ss'}"></DataGridTextColumn> <DataGridTextColumn IsReadOnly="True" Header="更新时间" Binding="{Binding ModifyTime ,StringFormat='yyyy-MM-dd HH:mm:ss'}"></DataGridTextColumn>
</DataGrid.Columns> </DataGrid.Columns>

View File

@ -18,7 +18,7 @@ namespace 智慧物流软件系统
{ {
public partial class LocationInfoView : UserControlBase public partial class LocationInfoView : UserControlBase
{ {
public MatBaseInfoViewModel viewModel { get; set; } = new MatBaseInfoViewModel(); public LocaionInfoViewModel viewModel { get; set; } = new LocaionInfoViewModel();
public LocationInfoView() public LocationInfoView()
{ {
InitializeComponent(); InitializeComponent();
@ -27,8 +27,10 @@ namespace 智慧物流软件系统
private void LoadedVisible(object sender, EventArgs e) private void LoadedVisible(object sender, EventArgs e)
{ {
viewModel.BtnReset(); viewModel.InitLocationAreaItems();
viewModel.BtnSearchReset(); viewModel.BtnSearchReset();
} }
private void DataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e) private void DataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)

View File

@ -155,7 +155,7 @@
</StackPanel> </StackPanel>
</TabItem.Header> </TabItem.Header>
<hc:TransitioningContentControl TransitionMode="Fade"> <hc:TransitioningContentControl TransitionMode="Fade">
<View:MatInventoryDetailView /> <View:LocationInfoView />
</hc:TransitioningContentControl> </hc:TransitioningContentControl>
</TabItem> </TabItem>
<TabItem Padding="10,10,40,10" <TabItem Padding="10,10,40,10"

View File

@ -45,114 +45,7 @@ namespace 智慧物流软件系统
private void Button_Click(object sender, RoutedEventArgs e) private void Button_Click(object sender, RoutedEventArgs e)
{ {
#region
//偏差值输入框的验证
var offSet = 0;
try
{
offSet = Convert.ToInt32(offSetTxt.Text.Trim());
if (offSet <= 0)
{
System.Windows.MessageBox.Show($"偏差值请输入大于0的自然数", "提示");
offSetTxt.Focus();
return;
}
}
catch (Exception ex)
{
System.Windows.MessageBox.Show($"偏差值请输入大于0的自然数", "提示");
offSetTxt.Focus();
return;
}
var loginName = ComboBoxId.Text.Trim();
var pass = PasswordBoxPass.Password.ToString();
if (string.IsNullOrEmpty(loginName))
{
System.Windows.MessageBox.Show("请输入账号!", "提示");
ComboBoxId.Focus();
return;
}
if (string.IsNullOrEmpty(pass))
{
System.Windows.MessageBox.Show("请输入密码!", "提示");
PasswordBoxPass.Focus();
return;
}
#endregion
try
{
#region
var body = new UserLoginRequest()
{
UserName = loginName,
DeviceType = LocalFile.Config.DeviceType + "标定",
GroupNames = LocalFile.Config.GroupName,
PassWord = pass,
IsNoLogin = false,
};
var Result = ApiHelp.GetDataFromHttp<ResponseBase<UserModel>>(LocalFile.Config.ApiIpHost + "user/userLogin", body, "POST");
if (Result != null && Result.Code != 200)
{
HandyControl.Controls.MessageBox.Warning(Result.Message, "提示");
return;
}
else if (Result == null)
{
HandyControl.Controls.MessageBox.Warning("登录失败:接口调用失败!", "提示");
return;
}
else
{
if (!Result.Data.IsAdmin && !Result.Data.IsGCYF)
{
HandyControl.Controls.MessageBox.Warning("登录成功!权限不足", "提示");
return;
}
else
{
//此分支可以继续
}
}
#endregion
#region
try
{
var body1 = new CalibrationSetOffsetRequest()
{
MouduleIds = new List<int>() { ModuleId },
OffSet = offSet,
UserName = LocalStatic.CurrentUser,
DeviceType = LocalFile.Config.DeviceType,
};
var Result1 = ApiHelp.GetDataFromHttp<ResponseCommon>(LocalFile.Config.ApiIpHost + "storeInfo/calibrationSetOffset", body1, "POST");
if (Result1 != null && Result1.Code == 200)
{
Growl.Success("发送标定指令成功!");
this.Close();
}
else if (Result1 != null)
{
Growl.Error(Result1.Message);
}
}
catch (Exception ex)
{
Growl.Error("操作失败:" + ex.Message);
}
finally
{
}
#endregion
}
catch (Exception ex)
{
System.Windows.MessageBox.Show(ex.Message, "错误");
return;
}
} }
private void Window_PreviewKeyDown(object sender, KeyEventArgs e) private void Window_PreviewKeyDown(object sender, KeyEventArgs e)