货架存量 修改 查询 等功能
This commit is contained in:
@ -39,11 +39,11 @@ namespace WCS.BLL.DbModels
|
||||
[SugarColumn(ColumnName = "shelf_type", Length = 64, IsNullable = true, ColumnDescription = "货架类型")]
|
||||
public string ShelfType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 货架区域
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "shelf_area", Length = 64, IsNullable = true, ColumnDescription = "货架区域")]
|
||||
public string ShelfArea { get; set; }
|
||||
///// <summary>
|
||||
///// 货架区域
|
||||
///// </summary>
|
||||
//[SugarColumn(ColumnName = "shelf_area", Length = 64, IsNullable = true, ColumnDescription = "货架区域")]
|
||||
//public string ShelfArea { get; set; }
|
||||
#endregion
|
||||
|
||||
#region 物料属性
|
||||
|
@ -41,11 +41,11 @@ namespace WCS.DAL.DbModels
|
||||
[SugarColumn(ColumnName = "shelf_status", IsNullable = true, ColumnDescription = "货架状态")]
|
||||
public ShelfStatusEnum ShelfStatus { get; set; } = ShelfStatusEnum.空货架;
|
||||
|
||||
/// <summary>
|
||||
/// 货架区域
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "shelf_area", Length = 64, IsNullable = true, ColumnDescription = "货架区域")]
|
||||
public string ShelfArea { get; set; }
|
||||
///// <summary>
|
||||
///// 货架区域
|
||||
///// </summary>
|
||||
//[SugarColumn(ColumnName = "shelf_area", Length = 64, IsNullable = true, ColumnDescription = "货架区域")]
|
||||
//public string ShelfArea { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 货架尺寸
|
||||
|
@ -1,14 +1,9 @@
|
||||
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.Model;
|
||||
using WCS.DAL.DbModels;
|
||||
using WCS.Model.ApiModel.StoreInfo;
|
||||
using WCS.BLL.DbModels;
|
||||
using WCS.Model.ApiModel.MatBaseInfo;
|
||||
using WCS.Model.ApiModel.MatDetailCurrentInfo;
|
||||
|
||||
namespace WCS.BLL.Services.IService
|
||||
{
|
||||
@ -19,7 +14,7 @@ namespace WCS.BLL.Services.IService
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
public Task<PageQueryResponse<MatDetailCurrentInfo>> GetMatDetailCurrentInfos(GetMatDetailCurrentInfosRequest request);
|
||||
public Task<PageQueryResponse<MatDetailCurrentInfoModel>> GetMatDetailCurrentInfos(GetMatDetailCurrentInfosRequest request);
|
||||
|
||||
/// <summary>
|
||||
/// 更新货架存量
|
||||
|
@ -18,6 +18,7 @@ using WCS.Model;
|
||||
using WCS.Model.ApiModel;
|
||||
using WCS.Model.ApiModel.InOutRecord;
|
||||
using WCS.Model.ApiModel.MatBaseInfo;
|
||||
using WCS.Model.ApiModel.MatDetailCurrentInfo;
|
||||
using WCS.Model.ApiModel.StoreInfo;
|
||||
using WCS.Model.ApiModel.User;
|
||||
|
||||
@ -26,7 +27,7 @@ namespace WCS.BLL.Services.Service
|
||||
public class MatDetailCurrentInfoService : IMatDetailCurrentInfoService
|
||||
{
|
||||
|
||||
public async Task<PageQueryResponse<MatDetailCurrentInfo>> GetMatDetailCurrentInfos(GetMatDetailCurrentInfosRequest request)
|
||||
public async Task<PageQueryResponse<MatDetailCurrentInfoModel>> GetMatDetailCurrentInfos(GetMatDetailCurrentInfosRequest request)
|
||||
{
|
||||
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(!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.MatName), (mci, si, li) => mci.MatCode.Contains(request.MatName))
|
||||
.Select((mci, si, li) => mci);
|
||||
.WhereIF(!string.IsNullOrEmpty(request.MatName), (mci, si, li) => mci.MatName.Contains(request.MatName))
|
||||
.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 records = await recordsQueryable
|
||||
.OrderByDescending(mci => mci.Id)
|
||||
.Skip((request.PageNumber - 1) * request.PageSize).Take(request.PageSize)
|
||||
.ToListAsync();
|
||||
//生成序号
|
||||
@ -52,11 +75,11 @@ namespace WCS.BLL.Services.Service
|
||||
{
|
||||
records[i].RowNumber = (request.PageNumber - 1) * request.PageSize + i + 1;
|
||||
}
|
||||
return new PageQueryResponse<MatDetailCurrentInfo>()
|
||||
return new PageQueryResponse<MatDetailCurrentInfoModel>()
|
||||
{
|
||||
Code = 200,
|
||||
Message = $"success",
|
||||
Data = new PageQueryResponseData<MatDetailCurrentInfo>()
|
||||
Data = new PageQueryResponseData<MatDetailCurrentInfoModel>()
|
||||
{
|
||||
TotalCount = totalCount,
|
||||
MaxPage = request.PageSize == 0 ? 0 : (int)Math.Ceiling((decimal)totalCount / request.PageSize),
|
||||
@ -67,7 +90,7 @@ namespace WCS.BLL.Services.Service
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return new PageQueryResponse<MatDetailCurrentInfo>()
|
||||
return new PageQueryResponse<MatDetailCurrentInfoModel>()
|
||||
{
|
||||
Code = 300,
|
||||
Message = $"操作失败:{ex.Message}",
|
||||
@ -77,119 +100,58 @@ namespace WCS.BLL.Services.Service
|
||||
|
||||
public async Task<ResponseCommon<object>> updateMatDetailCurrentInfo(AddLocaionInfoRequest<MatDetailCurrentInfo> request)
|
||||
{
|
||||
return null;
|
||||
//try
|
||||
//{
|
||||
// var MatDetailCurrentInfo = await DbHelp.db.Queryable<MatDetailCurrentInfo>() //.Where(t => t.MatDetailCurrentCode == request.MatDetailCurrentInfo.MatDetailCurrentCode)
|
||||
// .FirstAsync();
|
||||
// //修改位置信息
|
||||
// if (request.AddOrUpdate == AddOrUpdate.Update)
|
||||
// {
|
||||
// var existId = MatDetailCurrentInfo == null ? 0 : MatDetailCurrentInfo.Id;
|
||||
try
|
||||
{
|
||||
var matDetailCurrentInfo = await DbHelp.db.Queryable<MatDetailCurrentInfo>() //.Where(t => t.MatDetailCurrentCode == request.MatDetailCurrentInfo.MatDetailCurrentCode)
|
||||
.Where(t => t.Id == request.LocationInfo.Id)
|
||||
.FirstAsync();
|
||||
if (matDetailCurrentInfo == null)
|
||||
{
|
||||
return new ResponseCommon<Object>
|
||||
{
|
||||
Code = 205,
|
||||
Message = $"更新位置信息失败:此条数据不存在,请确认!",
|
||||
Data = null
|
||||
};
|
||||
}
|
||||
|
||||
// MatDetailCurrentInfo = await DbHelp.db.Queryable<MatDetailCurrentInfo>()
|
||||
// //.Where(t => t.Id == request.MatDetailCurrentInfo.Id)
|
||||
// .FirstAsync();
|
||||
// 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;
|
||||
matDetailCurrentInfo.MatQty = request.LocationInfo.MatQty;
|
||||
matDetailCurrentInfo.ModifyUser = request.UserName;
|
||||
matDetailCurrentInfo.ModifyTime = DateTime.Now;
|
||||
|
||||
// var rowNum = await DbHelp.db.Updateable(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 if (request.AddOrUpdate == AddOrUpdate.Add)
|
||||
// {
|
||||
// if (MatDetailCurrentInfo != null)
|
||||
// {
|
||||
// return new ResponseCommon<Object>
|
||||
// {
|
||||
// Code = 201,
|
||||
// Message = $"新增位置信息失败:位置[{MatDetailCurrentInfo.MatDetailCurrentCode}]已存在!",
|
||||
// Data = null
|
||||
// };
|
||||
// }
|
||||
// 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;
|
||||
//}
|
||||
var rowNum = await DbHelp.db.Updateable(matDetailCurrentInfo).ExecuteCommandAsync();
|
||||
if (rowNum == 0)
|
||||
{
|
||||
return new ResponseCommon<Object>
|
||||
{
|
||||
Code = 201,
|
||||
Message = $"更新货架存量信息失败:请重试!",
|
||||
Data = null
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
return new ResponseCommon<Object>
|
||||
{
|
||||
Code = 200,
|
||||
Message = $"更新货架存量信息成功!",
|
||||
Data = null
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
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)
|
||||
|
@ -2,7 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace WCS.Model.ApiModel.StoreInfo
|
||||
namespace WCS.Model.ApiModel.MatDetailCurrentInfo
|
||||
{
|
||||
public class GetMatDetailCurrentInfosRequest : PageQueryRequestBase
|
||||
{
|
||||
|
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
@ -29,10 +29,10 @@ namespace WCS.Model.ApiModel.StoreInfo
|
||||
/// </summary>
|
||||
public ShelfStatusEnum ShelfStatus { get; set; } = ShelfStatusEnum.空货架;
|
||||
|
||||
/// <summary>
|
||||
/// 货架区域
|
||||
/// </summary>
|
||||
public string ShelfArea { get; set; } = string.Empty;
|
||||
///// <summary>
|
||||
///// 货架区域
|
||||
///// </summary>
|
||||
//public string ShelfArea { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 货架尺寸
|
||||
|
@ -1,15 +1,11 @@
|
||||
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;
|
||||
using WCS.Model.ApiModel.MatDetailCurrentInfo;
|
||||
|
||||
namespace WCS.WebApi.Controllers
|
||||
{
|
||||
@ -34,14 +30,14 @@ namespace WCS.WebApi.Controllers
|
||||
return await _matDetailCurrentInfoService.GetMatDetailCurrentInfos(request);
|
||||
}
|
||||
|
||||
[HttpPost("updateLocationInfo")]
|
||||
public async Task<ResponseCommon<object>> updateLocationInfo(AddLocaionInfoRequest<MatDetailCurrentInfo> request)
|
||||
[HttpPost("updateMatDetailCurrentInfo")]
|
||||
public async Task<ResponseCommon<object>> updateMatDetailCurrentInfo(AddLocaionInfoRequest<MatDetailCurrentInfo> request)
|
||||
{
|
||||
return await _matDetailCurrentInfoService.updateMatDetailCurrentInfo(request);
|
||||
}
|
||||
|
||||
[HttpPost("deleteLocationInfo")]
|
||||
public async Task<ResponseCommon<object>> deleteLocationInfo(DeleteInfosRequest request)
|
||||
[HttpPost("deleteMatDetailCurrentInfo")]
|
||||
public async Task<ResponseCommon<object>> deleteMatDetailCurrentInfo(DeleteInfosRequest request)
|
||||
{
|
||||
return await _matDetailCurrentInfoService.deleteMatDetailCurrentInfo(request);
|
||||
}
|
||||
|
@ -193,7 +193,7 @@ namespace WCS.WebApi.Controllers
|
||||
ShlefId = shelf.Id,
|
||||
ShelfCode = shelf.ShelfCode,
|
||||
ShelfType = shelf.ShelfTypeName,
|
||||
ShelfArea = shelf.ShelfArea,
|
||||
//ShelfArea = shelf.ShelfArea,
|
||||
|
||||
MatCode = matBaseInfo.MatCode,
|
||||
MatName = matBaseInfo.MatName,
|
||||
|
149
货架标准上位机/ViewModels/MatDetailCurrentInfoUpdateViewModel.cs
Normal file
149
货架标准上位机/ViewModels/MatDetailCurrentInfoUpdateViewModel.cs
Normal 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
|
||||
}
|
||||
}
|
||||
}
|
@ -20,6 +20,7 @@ using WCS.Model.ApiModel.User;
|
||||
using WCS.Model.ApiModel;
|
||||
using Newtonsoft.Json.Bson;
|
||||
using WCS.Model.ApiModel.LocationInfo;
|
||||
using WCS.Model.ApiModel.MatDetailCurrentInfo;
|
||||
|
||||
namespace 智慧物流软件系统.ViewModel
|
||||
{
|
||||
@ -31,8 +32,8 @@ namespace 智慧物流软件系统.ViewModel
|
||||
}
|
||||
|
||||
#region Property
|
||||
private List<LocationInfoModel> dataGridItemSource;
|
||||
public List<LocationInfoModel> DataGridItemSource
|
||||
private List<MatDetailCurrentInfoModel> dataGridItemSource;
|
||||
public List<MatDetailCurrentInfoModel> DataGridItemSource
|
||||
{
|
||||
get { return dataGridItemSource; }
|
||||
set
|
||||
@ -41,8 +42,8 @@ namespace 智慧物流软件系统.ViewModel
|
||||
}
|
||||
}
|
||||
|
||||
private LocationInfoModel selectedataGridItem;
|
||||
public LocationInfoModel SelectedataGridItem
|
||||
private MatDetailCurrentInfoModel selectedataGridItem;
|
||||
public MatDetailCurrentInfoModel SelectedataGridItem
|
||||
{
|
||||
get { return selectedataGridItem; }
|
||||
set
|
||||
@ -166,7 +167,7 @@ namespace 智慧物流软件系统.ViewModel
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region
|
||||
#region 物料
|
||||
/// <summary>
|
||||
/// 物料编码
|
||||
/// </summary>
|
||||
@ -194,7 +195,6 @@ namespace 智慧物流软件系统.ViewModel
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Command
|
||||
@ -234,16 +234,21 @@ namespace 智慧物流软件系统.ViewModel
|
||||
var dia = Dialog.Show(new TextDialog());
|
||||
try
|
||||
{
|
||||
var body = new GetLocationInfosRequest()
|
||||
var body = new GetMatDetailCurrentInfosRequest()
|
||||
{
|
||||
LocationAreaId = SelectedLocationAreaItems == null ? null : SelectedLocationAreaItems.Id,
|
||||
LocationCode = LocationCode,
|
||||
ShelfTypeId = SelectedShelfTypeItem == null? null:selectedShelfTypeItem.Id,
|
||||
ShelfCode = ShelfCode,
|
||||
MatCode = MatCode,
|
||||
MatName = MatName,
|
||||
|
||||
UserName = LocalStatic.CurrentUser,
|
||||
DeviceType = LocalFile.Config.DeviceType,
|
||||
PageNumber = CurrentPage,
|
||||
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)
|
||||
{
|
||||
DataGridItemSource = Result.Data.Lists;
|
||||
@ -262,23 +267,9 @@ namespace 智慧物流软件系统.ViewModel
|
||||
#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 async void BtnEdit()
|
||||
public void BtnEdit()
|
||||
{
|
||||
//查询勾选的第一个数据
|
||||
var info = DataGridItemSource?.Where(t => t.IsSelected == true).FirstOrDefault();
|
||||
@ -288,9 +279,9 @@ namespace 智慧物流软件系统.ViewModel
|
||||
}
|
||||
else
|
||||
{
|
||||
var addView = new LocationInfoAddOrUpdateView("修改位置", info);
|
||||
addView.ShowDialog();
|
||||
if (addView.DialogResult == true)
|
||||
var updateView = new MatDetailCurrentInfoUpdateView("修改货架存量", info);
|
||||
updateView.ShowDialog();
|
||||
if (updateView.DialogResult == true)
|
||||
{
|
||||
CurrentPage = 1;
|
||||
}
|
||||
@ -321,7 +312,7 @@ namespace 智慧物流软件系统.ViewModel
|
||||
DeviceType = LocalFile.Config.DeviceType,
|
||||
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)
|
||||
{
|
||||
BtnSearch();
|
||||
@ -335,33 +326,6 @@ namespace 智慧物流软件系统.ViewModel
|
||||
}
|
||||
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
|
||||
|
||||
|
156
货架标准上位机/Views/MatDetailCurrentInfoUpdateView.xaml
Normal file
156
货架标准上位机/Views/MatDetailCurrentInfoUpdateView.xaml
Normal 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>
|
111
货架标准上位机/Views/MatDetailCurrentInfoUpdateView.xaml.cs
Normal file
111
货架标准上位机/Views/MatDetailCurrentInfoUpdateView.xaml.cs
Normal 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
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user