货架存量 修改 查询 等功能

This commit is contained in:
hehaibing-1996
2025-01-14 11:18:38 +08:00
parent a4c02a9173
commit 2d2ef672de
13 changed files with 602 additions and 204 deletions

View File

@ -39,11 +39,11 @@ namespace WCS.BLL.DbModels
[SugarColumn(ColumnName = "shelf_type", Length = 64, IsNullable = true, ColumnDescription = "货架类型")] [SugarColumn(ColumnName = "shelf_type", Length = 64, IsNullable = true, ColumnDescription = "货架类型")]
public string ShelfType { get; set; } public string ShelfType { get; set; }
/// <summary> ///// <summary>
/// 货架区域 ///// 货架区域
/// </summary> ///// </summary>
[SugarColumn(ColumnName = "shelf_area", Length = 64, IsNullable = true, ColumnDescription = "货架区域")] //[SugarColumn(ColumnName = "shelf_area", Length = 64, IsNullable = true, ColumnDescription = "货架区域")]
public string ShelfArea { get; set; } //public string ShelfArea { get; set; }
#endregion #endregion
#region #region

View File

@ -41,11 +41,11 @@ namespace WCS.DAL.DbModels
[SugarColumn(ColumnName = "shelf_status", IsNullable = true, ColumnDescription = "货架状态")] [SugarColumn(ColumnName = "shelf_status", IsNullable = true, ColumnDescription = "货架状态")]
public ShelfStatusEnum ShelfStatus { get; set; } = ShelfStatusEnum.; public ShelfStatusEnum ShelfStatus { get; set; } = ShelfStatusEnum.;
/// <summary> ///// <summary>
/// 货架区域 ///// 货架区域
/// </summary> ///// </summary>
[SugarColumn(ColumnName = "shelf_area", Length = 64, IsNullable = true, ColumnDescription = "货架区域")] //[SugarColumn(ColumnName = "shelf_area", Length = 64, IsNullable = true, ColumnDescription = "货架区域")]
public string ShelfArea { get; set; } //public string ShelfArea { get; set; }
/// <summary> /// <summary>
/// 货架尺寸 /// 货架尺寸

View File

@ -1,14 +1,9 @@
using System; using WCS.Model;
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.DAL.DbModels;
using WCS.Model.ApiModel.StoreInfo; using WCS.Model.ApiModel.StoreInfo;
using WCS.BLL.DbModels; using WCS.BLL.DbModels;
using WCS.Model.ApiModel.MatBaseInfo; using WCS.Model.ApiModel.MatBaseInfo;
using WCS.Model.ApiModel.MatDetailCurrentInfo;
namespace WCS.BLL.Services.IService namespace WCS.BLL.Services.IService
{ {
@ -19,7 +14,7 @@ namespace WCS.BLL.Services.IService
/// </summary> /// </summary>
/// <param name="request"></param> /// <param name="request"></param>
/// <returns></returns> /// <returns></returns>
public Task<PageQueryResponse<MatDetailCurrentInfo>> GetMatDetailCurrentInfos(GetMatDetailCurrentInfosRequest request); public Task<PageQueryResponse<MatDetailCurrentInfoModel>> GetMatDetailCurrentInfos(GetMatDetailCurrentInfosRequest request);
/// <summary> /// <summary>
/// 更新货架存量 /// 更新货架存量

View File

@ -18,6 +18,7 @@ using WCS.Model;
using WCS.Model.ApiModel; using WCS.Model.ApiModel;
using WCS.Model.ApiModel.InOutRecord; using WCS.Model.ApiModel.InOutRecord;
using WCS.Model.ApiModel.MatBaseInfo; using WCS.Model.ApiModel.MatBaseInfo;
using WCS.Model.ApiModel.MatDetailCurrentInfo;
using WCS.Model.ApiModel.StoreInfo; using WCS.Model.ApiModel.StoreInfo;
using WCS.Model.ApiModel.User; using WCS.Model.ApiModel.User;
@ -26,7 +27,7 @@ namespace WCS.BLL.Services.Service
public class MatDetailCurrentInfoService : IMatDetailCurrentInfoService public class MatDetailCurrentInfoService : IMatDetailCurrentInfoService
{ {
public async Task<PageQueryResponse<MatDetailCurrentInfo>> GetMatDetailCurrentInfos(GetMatDetailCurrentInfosRequest request) public async Task<PageQueryResponse<MatDetailCurrentInfoModel>> GetMatDetailCurrentInfos(GetMatDetailCurrentInfosRequest request)
{ {
try try
{ {
@ -39,12 +40,34 @@ namespace WCS.BLL.Services.Service
.WhereIF(request.ShelfTypeId != null && request.ShelfTypeId != 0, (mci, si, li) => si.ShelfTypeId == request.ShelfTypeId) .WhereIF(request.ShelfTypeId != null && request.ShelfTypeId != 0, (mci, si, li) => si.ShelfTypeId == request.ShelfTypeId)
.WhereIF(!string.IsNullOrEmpty(request.ShelfCode), (mci, si, li) => si.ShelfCode.Contains(request.ShelfCode)) .WhereIF(!string.IsNullOrEmpty(request.ShelfCode), (mci, si, li) => si.ShelfCode.Contains(request.ShelfCode))
.WhereIF(!string.IsNullOrEmpty(request.MatCode), (mci, si, li) => mci.MatCode.Contains(request.MatCode)) .WhereIF(!string.IsNullOrEmpty(request.MatCode), (mci, si, li) => mci.MatCode.Contains(request.MatCode))
.WhereIF(!string.IsNullOrEmpty(request.MatName), (mci, si, li) => mci.MatCode.Contains(request.MatName)) .WhereIF(!string.IsNullOrEmpty(request.MatName), (mci, si, li) => mci.MatName.Contains(request.MatName))
.Select((mci, si, li) => mci); .Select((mci, si, li) => new MatDetailCurrentInfoModel()
{
Id = mci.Id,
ShlefId = mci.ShlefId,
ShelfCode = mci.ShelfCode,
ShelfType = mci.ShelfType,
LocationArea = li.LocationArea,
LocationCode = li.LocationCode,
MatCode = mci.MatCode,
MatName = mci.MatName,
MatSpec = mci.MatSpec,
MatUnit = mci.MatUnit,
MatCustomer = mci.MatCustomer,
MatQty = mci.MatQty,
MatSupplier = mci.MatSupplier,
StationCode = mci.StationCode,
ModifyUser = mci.ModifyUser,
ModifyTime = mci.ModifyTime
});
//分页 //分页
var totalCount = await recordsQueryable.CountAsync(); var totalCount = await recordsQueryable.CountAsync();
var records = await recordsQueryable var records = await recordsQueryable
.OrderByDescending(mci => mci.Id)
.Skip((request.PageNumber - 1) * request.PageSize).Take(request.PageSize) .Skip((request.PageNumber - 1) * request.PageSize).Take(request.PageSize)
.ToListAsync(); .ToListAsync();
//生成序号 //生成序号
@ -52,11 +75,11 @@ namespace WCS.BLL.Services.Service
{ {
records[i].RowNumber = (request.PageNumber - 1) * request.PageSize + i + 1; records[i].RowNumber = (request.PageNumber - 1) * request.PageSize + i + 1;
} }
return new PageQueryResponse<MatDetailCurrentInfo>() return new PageQueryResponse<MatDetailCurrentInfoModel>()
{ {
Code = 200, Code = 200,
Message = $"success", Message = $"success",
Data = new PageQueryResponseData<MatDetailCurrentInfo>() Data = new PageQueryResponseData<MatDetailCurrentInfoModel>()
{ {
TotalCount = totalCount, TotalCount = totalCount,
MaxPage = request.PageSize == 0 ? 0 : (int)Math.Ceiling((decimal)totalCount / request.PageSize), MaxPage = request.PageSize == 0 ? 0 : (int)Math.Ceiling((decimal)totalCount / request.PageSize),
@ -67,7 +90,7 @@ namespace WCS.BLL.Services.Service
} }
catch (Exception ex) catch (Exception ex)
{ {
return new PageQueryResponse<MatDetailCurrentInfo>() return new PageQueryResponse<MatDetailCurrentInfoModel>()
{ {
Code = 300, Code = 300,
Message = $"操作失败:{ex.Message}", Message = $"操作失败:{ex.Message}",
@ -77,119 +100,58 @@ namespace WCS.BLL.Services.Service
public async Task<ResponseCommon<object>> updateMatDetailCurrentInfo(AddLocaionInfoRequest<MatDetailCurrentInfo> request) public async Task<ResponseCommon<object>> updateMatDetailCurrentInfo(AddLocaionInfoRequest<MatDetailCurrentInfo> request)
{ {
return null; try
//try {
//{ var matDetailCurrentInfo = await DbHelp.db.Queryable<MatDetailCurrentInfo>() //.Where(t => t.MatDetailCurrentCode == request.MatDetailCurrentInfo.MatDetailCurrentCode)
// var MatDetailCurrentInfo = await DbHelp.db.Queryable<MatDetailCurrentInfo>() //.Where(t => t.MatDetailCurrentCode == request.MatDetailCurrentInfo.MatDetailCurrentCode) .Where(t => t.Id == request.LocationInfo.Id)
// .FirstAsync(); .FirstAsync();
// //修改位置信息 if (matDetailCurrentInfo == null)
// if (request.AddOrUpdate == AddOrUpdate.Update) {
// { return new ResponseCommon<Object>
// var existId = MatDetailCurrentInfo == null ? 0 : MatDetailCurrentInfo.Id; {
Code = 205,
Message = $"更新位置信息失败:此条数据不存在,请确认!",
Data = null
};
}
// MatDetailCurrentInfo = await DbHelp.db.Queryable<MatDetailCurrentInfo>() matDetailCurrentInfo.MatQty = request.LocationInfo.MatQty;
// //.Where(t => t.Id == request.MatDetailCurrentInfo.Id) matDetailCurrentInfo.ModifyUser = request.UserName;
// .FirstAsync(); matDetailCurrentInfo.ModifyTime = DateTime.Now;
// if (MatDetailCurrentInfo == null)
// {
// return new ResponseCommon<Object>
// {
// Code = 201,
// Message = $"更新位置信息失败:该位置不存在!",
// Data = null
// };
// }
// else if (existId != 0 && existId != MatDetailCurrentInfo.Id)
// {
// return new ResponseCommon<Object>
// {
// Code = 201,
// Message = $"更新位置信息失败:位置[{MatDetailCurrentInfo.MatDetailCurrentCode}]已存在!",
// Data = null
// };
// }
// else
// {
// request.MatDetailCurrentInfo.ModifyUser = request.UserName;
// request.MatDetailCurrentInfo.ModifyTime = DateTime.Now;
// var rowNum = await DbHelp.db.Updateable(request.MatDetailCurrentInfo).ExecuteCommandAsync(); var rowNum = await DbHelp.db.Updateable(matDetailCurrentInfo).ExecuteCommandAsync();
// if (rowNum == 0) if (rowNum == 0)
// { {
// return new ResponseCommon<Object> return new ResponseCommon<Object>
// { {
// Code = 201, Code = 201,
// Message = $"更新位置信息失败:请重试!", Message = $"更新货架存量信息失败:请重试!",
// Data = null Data = null
// }; };
// } }
// else else
// { {
// return new ResponseCommon<Object> return new ResponseCommon<Object>
// { {
// Code = 200, Code = 200,
// Message = $"更新位置信息成功!", Message = $"更新货架存量信息成功!",
// Data = null Data = null
// }; };
// } }
// }
// }
// else if (request.AddOrUpdate == AddOrUpdate.Add)
// { }
// if (MatDetailCurrentInfo != null) catch (Exception ex)
// { {
// return new ResponseCommon<Object> var response = new ResponseCommon<Object>
// { {
// Code = 201, Code = 300,
// Message = $"新增位置信息失败:位置[{MatDetailCurrentInfo.MatDetailCurrentCode}]已存在!", Message = $"操作失败:{ex.Message}",
// Data = null Data = null
// }; };
// } return response;
// else }
// {
// request.MatDetailCurrentInfo.ModifyUser = request.UserName;
// var rowNum = await DbHelp.db.Insertable(request.MatDetailCurrentInfo).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>> deleteMatDetailCurrentInfo(DeleteInfosRequest request) public async Task<ResponseCommon<object>> deleteMatDetailCurrentInfo(DeleteInfosRequest request)

View File

@ -2,7 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace WCS.Model.ApiModel.StoreInfo namespace WCS.Model.ApiModel.MatDetailCurrentInfo
{ {
public class GetMatDetailCurrentInfosRequest : PageQueryRequestBase public class GetMatDetailCurrentInfosRequest : PageQueryRequestBase
{ {

View File

@ -0,0 +1,65 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
namespace WCS.Model.ApiModel.MatDetailCurrentInfo
{
public class MatDetailCurrentInfoModel : INotifyPropertyChanged
{
public int Id { get; set; }
#region
public int? ShlefId { get; set; }
public string? ShelfCode { get; set; } = string.Empty;
public string? ShelfType { get; set; } = string.Empty;
//货架位置的区域
public string? LocationArea { get; set; } = string.Empty;
/// <summary>
/// 货架位置
/// </summary>
public string? LocationCode { get; set; } = string.Empty;
#endregion
#region
public string? MatCode { get; set; } = string.Empty;
public string? MatName { get; set; } = string.Empty;
public string? MatSpec { get; set; } = string.Empty;
public string? MatUnit { get; set; } = string.Empty;
public string? MatSupplier { get; set; } = string.Empty;
public string? MatCustomer { get; set; } = string.Empty;
public int MatQty { get; set; }
#endregion
public string? StationCode { get; set; } = string.Empty;
public string? ModifyUser { get; set; } = string.Empty;
public DateTime? ModifyTime { get; set; } = DateTime.Now;
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

@ -29,10 +29,10 @@ namespace WCS.Model.ApiModel.StoreInfo
/// </summary> /// </summary>
public ShelfStatusEnum ShelfStatus { get; set; } = ShelfStatusEnum.; public ShelfStatusEnum ShelfStatus { get; set; } = ShelfStatusEnum.;
/// <summary> ///// <summary>
/// 货架区域 ///// 货架区域
/// </summary> ///// </summary>
public string ShelfArea { get; set; } = string.Empty; //public string ShelfArea { get; set; } = string.Empty;
/// <summary> /// <summary>
/// 货架尺寸 /// 货架尺寸

View File

@ -1,15 +1,11 @@
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using WCS.BLL.Services.IService; using WCS.BLL.Services.IService;
using WCS.BLL.Services.Service; using WCS.BLL.Services.Service;
using WCS.Model.ApiModel.MatInventoryDetail;
using WCS.Model; using WCS.Model;
using WCS.Model.ApiModel.StoreInfo; using WCS.Model.ApiModel.StoreInfo;
using WCS.BLL.DbModels; using WCS.BLL.DbModels;
using WCS.Model.ApiModel.MatBaseInfo; using WCS.Model.ApiModel.MatBaseInfo;
using WCS.DAL.DbModels; using WCS.Model.ApiModel.MatDetailCurrentInfo;
using WCS.DAL.Db;
using WCS.Model.ApiModel.Home;
using WCS.Model.ApiModel.LocationInfo;
namespace WCS.WebApi.Controllers namespace WCS.WebApi.Controllers
{ {
@ -34,14 +30,14 @@ namespace WCS.WebApi.Controllers
return await _matDetailCurrentInfoService.GetMatDetailCurrentInfos(request); return await _matDetailCurrentInfoService.GetMatDetailCurrentInfos(request);
} }
[HttpPost("updateLocationInfo")] [HttpPost("updateMatDetailCurrentInfo")]
public async Task<ResponseCommon<object>> updateLocationInfo(AddLocaionInfoRequest<MatDetailCurrentInfo> request) public async Task<ResponseCommon<object>> updateMatDetailCurrentInfo(AddLocaionInfoRequest<MatDetailCurrentInfo> request)
{ {
return await _matDetailCurrentInfoService.updateMatDetailCurrentInfo(request); return await _matDetailCurrentInfoService.updateMatDetailCurrentInfo(request);
} }
[HttpPost("deleteLocationInfo")] [HttpPost("deleteMatDetailCurrentInfo")]
public async Task<ResponseCommon<object>> deleteLocationInfo(DeleteInfosRequest request) public async Task<ResponseCommon<object>> deleteMatDetailCurrentInfo(DeleteInfosRequest request)
{ {
return await _matDetailCurrentInfoService.deleteMatDetailCurrentInfo(request); return await _matDetailCurrentInfoService.deleteMatDetailCurrentInfo(request);
} }

View File

@ -193,7 +193,7 @@ namespace WCS.WebApi.Controllers
ShlefId = shelf.Id, ShlefId = shelf.Id,
ShelfCode = shelf.ShelfCode, ShelfCode = shelf.ShelfCode,
ShelfType = shelf.ShelfTypeName, ShelfType = shelf.ShelfTypeName,
ShelfArea = shelf.ShelfArea, //ShelfArea = shelf.ShelfArea,
MatCode = matBaseInfo.MatCode, MatCode = matBaseInfo.MatCode,
MatName = matBaseInfo.MatName, MatName = matBaseInfo.MatName,

View File

@ -0,0 +1,149 @@
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;
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.MatDetailCurrentInfo;
using WCS.Model.ApiModel.StoreInfo;
using .Tool;
namespace .ViewModel
{
public class MatDetailCurrentInfoUpdateViewModel : BindableBase
{
public MatDetailCurrentInfoModel model { get; set; }
public System.Windows.Controls.TextBox textBox { get; set; }
#region Property
public void SetValues(MatDetailCurrentInfoModel matDetailCurrentInfoModel)
{
model = matDetailCurrentInfoModel;
ShelfType = matDetailCurrentInfoModel.ShelfType;
ShelfCode = matDetailCurrentInfoModel.ShelfCode;
LocationArea = matDetailCurrentInfoModel.LocationArea;
LocationCode = matDetailCurrentInfoModel.LocationCode;
MatName = matDetailCurrentInfoModel.MatName;
MatCode = matDetailCurrentInfoModel.MatCode;
MatSpec = matDetailCurrentInfoModel.MatSpec;
MatQty = matDetailCurrentInfoModel.MatQty;
if (textBox != null)
Task.Run(() =>
{
Thread.Sleep(100);
App.Current.Dispatcher.Invoke(() =>
{
textBox.Focus();
});
});
}
public MatDetailCurrentInfoModel GetValues()
{
if (model == null)
{
return null;
}
model.MatQty = MatQty;
return model;
}
private string shelfCode;
public string ShelfCode
{
get { return shelfCode; }
set
{
SetProperty(ref shelfCode, value);
}
}
private string shelfType;
public string ShelfType
{
get { return shelfType; }
set
{
SetProperty(ref shelfType, value);
}
}
private string locationArea;
public string LocationArea
{
get { return locationArea; }
set
{
SetProperty(ref locationArea, value);
}
}
private string locationCode;
public string LocationCode
{
get { return locationCode; }
set
{
SetProperty(ref locationCode, value);
}
}
private string matCode;
public string MatCode
{
get { return matCode; }
set
{
SetProperty(ref matCode, value);
}
}
private string matName;
public string MatName
{
get { return matName; }
set
{
SetProperty(ref matName, value);
}
}
private string matSpec;
public string MatSpec
{
get { return matSpec; }
set
{
SetProperty(ref matSpec, value);
}
}
private int matQty;
public int MatQty
{
get { return matQty; }
set
{
SetProperty(ref matQty, value);
}
#endregion
}
}
}

View File

@ -20,6 +20,7 @@ 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; using WCS.Model.ApiModel.LocationInfo;
using WCS.Model.ApiModel.MatDetailCurrentInfo;
namespace .ViewModel namespace .ViewModel
{ {
@ -31,8 +32,8 @@ namespace 智慧物流软件系统.ViewModel
} }
#region Property #region Property
private List<LocationInfoModel> dataGridItemSource; private List<MatDetailCurrentInfoModel> dataGridItemSource;
public List<LocationInfoModel> DataGridItemSource public List<MatDetailCurrentInfoModel> DataGridItemSource
{ {
get { return dataGridItemSource; } get { return dataGridItemSource; }
set set
@ -41,8 +42,8 @@ namespace 智慧物流软件系统.ViewModel
} }
} }
private LocationInfoModel selectedataGridItem; private MatDetailCurrentInfoModel selectedataGridItem;
public LocationInfoModel SelectedataGridItem public MatDetailCurrentInfoModel SelectedataGridItem
{ {
get { return selectedataGridItem; } get { return selectedataGridItem; }
set set
@ -166,7 +167,7 @@ namespace 智慧物流软件系统.ViewModel
} }
#endregion #endregion
#region #region
/// <summary> /// <summary>
/// 物料编码 /// 物料编码
/// </summary> /// </summary>
@ -194,7 +195,6 @@ namespace 智慧物流软件系统.ViewModel
} }
#endregion #endregion
#endregion #endregion
#region Command #region Command
@ -234,16 +234,21 @@ namespace 智慧物流软件系统.ViewModel
var dia = Dialog.Show(new TextDialog()); var dia = Dialog.Show(new TextDialog());
try try
{ {
var body = new GetLocationInfosRequest() var body = new GetMatDetailCurrentInfosRequest()
{ {
LocationAreaId = SelectedLocationAreaItems == null ? null : SelectedLocationAreaItems.Id, LocationAreaId = SelectedLocationAreaItems == null ? null : SelectedLocationAreaItems.Id,
LocationCode = LocationCode, LocationCode = LocationCode,
ShelfTypeId = SelectedShelfTypeItem == null? null:selectedShelfTypeItem.Id,
ShelfCode = ShelfCode,
MatCode = MatCode,
MatName = MatName,
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<LocationInfoModel>>(LocalFile.Config.ApiIpHost + "locationInfo/getLocationInfos", body, "POST"); var Result = ApiHelp.GetDataFromHttp<PageQueryResponse<MatDetailCurrentInfoModel>>(LocalFile.Config.ApiIpHost + "matDetailCurrenInfo/getMatDetailCurrentInfos", 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;
@ -262,23 +267,9 @@ namespace 智慧物流软件系统.ViewModel
#endregion #endregion
} }
/// <summary>
/// 物料新增操作
/// </summary>
public ICommand BtnAddCommand { get => new DelegateCommand(BtnAdd); }
public async void BtnAdd()
{
var addView = new LocationInfoAddOrUpdateView("新增位置");
addView.ShowDialog();
if (addView.DialogResult == true)
{
//添加或修改成功后重新查询
CurrentPage = 1;
}
}
public ICommand BtnEditCommand { get => new DelegateCommand(BtnEdit); } public ICommand BtnEditCommand { get => new DelegateCommand(BtnEdit); }
public async void BtnEdit() public void BtnEdit()
{ {
//查询勾选的第一个数据 //查询勾选的第一个数据
var info = DataGridItemSource?.Where(t => t.IsSelected == true).FirstOrDefault(); var info = DataGridItemSource?.Where(t => t.IsSelected == true).FirstOrDefault();
@ -288,9 +279,9 @@ namespace 智慧物流软件系统.ViewModel
} }
else else
{ {
var addView = new LocationInfoAddOrUpdateView("修改位置", info); var updateView = new MatDetailCurrentInfoUpdateView("修改货架存量", info);
addView.ShowDialog(); updateView.ShowDialog();
if (addView.DialogResult == true) if (updateView.DialogResult == true)
{ {
CurrentPage = 1; CurrentPage = 1;
} }
@ -321,7 +312,7 @@ namespace 智慧物流软件系统.ViewModel
DeviceType = LocalFile.Config.DeviceType, DeviceType = LocalFile.Config.DeviceType,
needDeleteIds = needDeleteIds, needDeleteIds = needDeleteIds,
}; };
var Result = ApiHelp.GetDataFromHttp<ResponseBase<UserModel>>(LocalFile.Config.ApiIpHost + "locationInfo/deleteLocationInfo", body, "POST"); var Result = ApiHelp.GetDataFromHttp<ResponseBase<UserModel>>(LocalFile.Config.ApiIpHost + "matDetailCurrenInfo/deleteMatDetailCurrentInfo", body, "POST");
if (Result != null && Result.Code == 200) if (Result != null && Result.Code == 200)
{ {
BtnSearch(); BtnSearch();
@ -335,33 +326,6 @@ namespace 智慧物流软件系统.ViewModel
} }
return true; return true;
}); });
////查询勾选的第一个数据
//var info = DataGridItemSource?.Where(t => t.IsSelected == true).FirstOrDefault();
//if (info == null)
//{
// Growl.Warning("请选择需要删除的数据!");
//}
//else
//{
// var body = new AddShelfInfoRequest<ShelfInfoModel>()
// {
// UserName = LocalStatic.CurrentUser,
// DeviceType = LocalFile.Config.DeviceType,
// ShelfInfo = info,
// AddOrUpdate = AddOrUpdate.Delete
// };
// var Result = ApiHelp.GetDataFromHttp<ResponseBase<object>>(LocalFile.Config.ApiIpHost + "storeInfo/addOrUpdateShelfInfo", body, "POST");
// if (Result != null && Result.Code == 200)
// {
// Growl.Success("删除成功!");
// CurrentPage = 1;
// }
// else
// {
// Growl.Error($"{Result?.Message?.ToString()}");
// }
//}
} }
#endregion #endregion

View File

@ -0,0 +1,156 @@
<Window
xmlns:pi="https://github.com/ping9719/wpfex"
x:Class="智慧物流软件系统.MatDetailCurrentInfoUpdateView"
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="390" 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>
<TextBox MinWidth="200"
Grid.Row="0"
Grid.Column="1"
FontSize="15"
IsReadOnly="True"
VerticalAlignment="Center"
HorizontalAlignment="Stretch"
Style="{StaticResource TextBoxExtend}"
Text="{Binding ShelfType}"></TextBox>
</StackPanel>
<StackPanel Orientation="Horizontal"
Margin="5">
<TextBlock Text="货架编码: "
FontSize="15"
VerticalAlignment="Center"
HorizontalAlignment="Right"></TextBlock>
<TextBox MinWidth="200"
Grid.Row="0"
Grid.Column="1"
FontSize="15"
IsReadOnly="True"
VerticalAlignment="Center"
HorizontalAlignment="Stretch"
Style="{StaticResource TextBoxExtend}"
Text="{Binding ShelfCode}"></TextBox>
</StackPanel>
<StackPanel Orientation="Horizontal"
Margin="5">
<TextBlock Text="位置区域: "
FontSize="15"
VerticalAlignment="Center"
HorizontalAlignment="Right"></TextBlock>
<TextBox MinWidth="200"
Grid.Row="0"
Grid.Column="1"
FontSize="15"
IsReadOnly="True"
VerticalAlignment="Center"
HorizontalAlignment="Stretch"
Style="{StaticResource TextBoxExtend}"
Text="{Binding LocationArea}"></TextBox>
</StackPanel>
<StackPanel Orientation="Horizontal"
Margin="5">
<TextBlock Text="位置编号: "
FontSize="15"
VerticalAlignment="Center"
HorizontalAlignment="Right"></TextBlock>
<TextBox MinWidth="200"
Grid.Row="0"
Grid.Column="1"
FontSize="15"
IsReadOnly="True"
VerticalAlignment="Center"
HorizontalAlignment="Stretch"
Style="{StaticResource TextBoxExtend}"
Text="{Binding LocationCode}"></TextBox>
</StackPanel>
<StackPanel Orientation="Horizontal"
Margin="5">
<TextBlock Text="物料编码: "
FontSize="15"
VerticalAlignment="Center"
HorizontalAlignment="Right"></TextBlock>
<TextBox MinWidth="200"
Grid.Row="0"
Grid.Column="1"
FontSize="15"
IsReadOnly="True"
VerticalAlignment="Center"
HorizontalAlignment="Stretch"
Style="{StaticResource TextBoxExtend}"
Text="{Binding MatCode}"></TextBox>
</StackPanel>
<StackPanel Orientation="Horizontal"
Margin="5">
<TextBlock Text="物料名称: "
FontSize="15"
VerticalAlignment="Center"
HorizontalAlignment="Right"></TextBlock>
<TextBox MinWidth="200"
Grid.Row="0"
Grid.Column="1"
FontSize="15"
IsReadOnly="True"
VerticalAlignment="Center"
HorizontalAlignment="Stretch"
Style="{StaticResource TextBoxExtend}"
Text="{Binding MatName}"></TextBox>
</StackPanel>
<StackPanel Orientation="Horizontal"
Margin="5">
<TextBlock Text="物料规格: "
FontSize="15"
VerticalAlignment="Center"
HorizontalAlignment="Right"></TextBlock>
<TextBox MinWidth="200"
Grid.Row="0"
Grid.Column="1"
FontSize="15"
IsReadOnly="True"
VerticalAlignment="Center"
HorizontalAlignment="Stretch"
Style="{StaticResource TextBoxExtend}"
Text="{Binding MatSpec}"></TextBox>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="5">
<TextBlock Text="物料数量: " FontWeight="Bold" FontSize="15" VerticalAlignment="Center" HorizontalAlignment="Right"></TextBlock>
<TextBox Name="txtMatQty" FontWeight="Bold" MinWidth="100" Grid.Row="0" Grid.Column="1" FontSize="15"
VerticalAlignment="Center" HorizontalAlignment="Stretch"
Style="{StaticResource TextBoxExtend}"
GotFocus="txtMatQty_GotFocus"
Text="{Binding MatQty}">
</TextBox>
</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,111 @@
using HandyControl.Controls;
using SqlSugar;
using System;
using System.Windows;
using WCS.BLL.DbModels;
using WCS.Model;
using WCS.Model.ApiModel.MatDetailCurrentInfo;
using WCS.Model.ApiModel.StoreInfo;
using WCS.Model.ApiModel.User;
using .Api;
using .ViewModel;
namespace
{
public partial class MatDetailCurrentInfoUpdateView : System.Windows.Window
{
public MatDetailCurrentInfoUpdateViewModel ViewModel = new MatDetailCurrentInfoUpdateViewModel();
public MatDetailCurrentInfoUpdateView(string _titleText, MatDetailCurrentInfoModel _matDetailCurrentInfoModel = null)
{
InitializeComponent();
this.DataContext = ViewModel;
ViewModel.textBox = txtMatQty;
ViewModel.SetValues(_matDetailCurrentInfoModel);
//绑定标题
Title.Text = "修改货架存量";
}
private void btnOk_Click(object sender, RoutedEventArgs e)
{
try
{
#region
try
{
txtMatQty.Text = txtMatQty.Text.Trim();
var qty = int.Parse(txtMatQty.Text);
if (qty < 0)
{
HandyControl.Controls.MessageBox.Show("数量请输入大于0的值");
return;
}
else if (qty == 0)
{
HandyControl.Controls.MessageBox.Show("数量请输入大于0的值!\r\n如果需要设置为0请使用【删除】功能");
return;
}
}
catch (Exception ex)
{
HandyControl.Controls.MessageBox.Show("数量请输入有效的数字!");
return;
}
#endregion
#region /
var body = new AddLocaionInfoRequest<MatDetailCurrentInfoModel>()
{
UserName = LocalStatic.CurrentUser,
DeviceType = LocalFile.Config.DeviceType,
LocationInfo = ViewModel.GetValues(),
AddOrUpdate = AddOrUpdate.Update
};
var Result = ApiHelp.GetDataFromHttp<ResponseBase<object>>(LocalFile.Config.ApiIpHost + "matDetailCurrenInfo/updateMatDetailCurrentInfo", body, "POST");
if (Result != null && Result.Code == 200)
{
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();
}
private void txtMatQty_GotFocus(object sender, RoutedEventArgs e)
{
try
{
var textBox = sender as System.Windows.Controls.TextBox;
if (textBox != null)
{
textBox.CaretIndex = textBox.Text.Length;
}
}
catch
{
}
}
}
}