1.PDA绑定相关接口

2.货架存量 后端接口
This commit is contained in:
hehaibing-1996
2025-01-13 20:08:03 +08:00
parent 6bd77a559b
commit a4c02a9173
19 changed files with 1590 additions and 29 deletions

View File

@ -44,32 +44,31 @@ namespace WCS.BLL.DbModels
/// </summary>
[SugarColumn(ColumnName = "shelf_area", Length = 64, IsNullable = true, ColumnDescription = "货架区域")]
public string ShelfArea { get; set; }
#endregion
#region
/// <summary>
/// 物料编码
/// </summary>
[SugarColumn(ColumnName = "mat_code", Length = 100, IsNullable = true, ColumnDescription = "物料编号")]
[SugarColumn(ColumnName = "mat_code", Length = 128, IsNullable = true, ColumnDescription = "物料编号")]
public string MatCode { get; set; }
/// <summary>
/// 物料名称
/// </summary>
[SugarColumn(ColumnName = "mat_name", Length = 150, IsNullable = true, ColumnDescription = "物料名称")]
[SugarColumn(ColumnName = "mat_name", Length = 128, IsNullable = true, ColumnDescription = "物料名称")]
public string MatName { get; set; }
/// <summary>
/// 物料规格
/// </summary>
[SugarColumn(ColumnName = "mat_spec", Length = 150, IsNullable = true, ColumnDescription = "物料规格")]
[SugarColumn(ColumnName = "mat_spec", Length = 128, IsNullable = true, ColumnDescription = "物料规格")]
public string MatSpec { get; set; }
/// <summary>
/// 物料数量
/// 物料单位
/// </summary>
[SugarColumn(ColumnName = "mat_qty", IsNullable = false, ColumnDescription = "物料数量")]
public int MatQty { get; set; }
[SugarColumn(ColumnName = "mat_unit", Length = 64, IsNullable = true, ColumnDescription = "物料单位")]
public string? MatUnit { get; set; }
/// <summary>
/// 物料供应商
@ -82,6 +81,12 @@ namespace WCS.BLL.DbModels
/// </summary>
[SugarColumn(ColumnName = "mat_customer", Length = 128, IsNullable = true, ColumnDescription = "物料客户")]
public string? MatCustomer { get; set; }
/// <summary>
/// 物料数量
/// </summary>
[SugarColumn(ColumnName = "mat_qty", IsNullable = false, ColumnDescription = "物料数量")]
public int MatQty { get; set; }
#endregion
/// <summary>

View File

@ -63,14 +63,32 @@ namespace WCS.DAL.DbModels
/// <summary>
/// 当前位置ID
/// </summary>
[SugarColumn(ColumnName = "current_location_id", IsNullable = true, ColumnDescription = "当前位置ID")]
[SugarColumn(ColumnName = "current_location_id", IsNullable = false, ColumnDescription = "当前位置ID")]
public int CurrentLocationId { get; set; } = 0;
/// <summary>
/// 当前位置编码
/// </summary>
[SugarColumn(ColumnName = "current_location_code", Length = 64, IsNullable = true, ColumnDescription = "当前位置编码")]
[SugarColumn(ColumnName = "current_location_code", Length = 64, IsNullable = false, ColumnDescription = "当前位置编码")]
public string CurrentLocaiotnCode { get; set; } = string.Empty;
/// <summary>
/// 目的地位置Id
/// </summary>
[SugarColumn(ColumnName = "destination_location_id", IsNullable = false, ColumnDescription = "当前位置ID")]
public int DestinationLocationId { get; set; } = 0;
/// <summary>
/// 目的地位置物料编码
/// </summary>
[SugarColumn(ColumnName = "destination_location_code", Length = 64, IsNullable = false, ColumnDescription = "当前位置编码")]
public string DestinationLocaiotnCode { get; set; } = string.Empty;
/// <summary>
/// 货架运输状态
/// </summary>
[SugarColumn(ColumnName = "trans_status", IsNullable = false, ColumnDescription = "货架运输状态")]
public TransStatusEnum TransStatus { get; set; } = TransStatusEnum.;
#endregion
/// <summary>
@ -116,9 +134,21 @@ namespace WCS.DAL.DbModels
public bool IsSelected { get; set; }
}
/// <summary>
/// 货架绑定物料的状态
/// </summary>
public enum ShelfStatusEnum
{
= 0,
= 1,
}
/// <summary>
/// 货架运输状态
/// </summary>
public enum TransStatusEnum
{
= 0,
= 1
}
}

View File

@ -62,7 +62,7 @@ namespace WCS.BLL.Manager
}
//手动修改后台配置后再进行CodeFirst 数据库的生成、表的生成
//如果不配置此参数 每次启动都会持续几十秒才能成功启动后端
if (LocalFile.Config.IsResetDBOrTable)
//if (LocalFile.Config.IsResetDBOrTable)//开发阶段暂时屏蔽初始化限制
{
#region
DbHelp.db.DbMaintenance.CreateDatabase();
@ -71,7 +71,7 @@ namespace WCS.BLL.Manager
Logs.Write("【初始化数据库】创建数据库", LogsType.StartBoot);
DbHelp.db.CodeFirst.InitTables(typeof(ShelfInfo), typeof(MatBaseInfo), typeof(ShelfTypeInfo)
,typeof(LocationInfo), typeof(LocationAreaInfo)
,typeof(LocationInfo), typeof(LocationAreaInfo),typeof(MatDetailCurrentInfo)
, typeof(InventoryDetail), typeof(OutOrder), typeof(OutOrderDetail), typeof(OutOrderMatDetail)
, typeof(MatInfo), typeof(StoreInfo)
, typeof(StockTakingOrder), typeof(StockTakingOrderMatDetail), typeof(InOutRecord)

View File

@ -0,0 +1,38 @@
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 IMatDetailCurrentInfoService
{
/// <summary>
/// 查询货架存量列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public Task<PageQueryResponse<MatDetailCurrentInfo>> GetMatDetailCurrentInfos(GetMatDetailCurrentInfosRequest request);
/// <summary>
/// 更新货架存量
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public Task<ResponseCommon<object>> updateMatDetailCurrentInfo(AddLocaionInfoRequest<MatDetailCurrentInfo> request);
/// <summary>
/// 删除货架存量数据
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public Task<ResponseCommon<object>> deleteMatDetailCurrentInfo(DeleteInfosRequest request);
}
}

View File

@ -92,7 +92,7 @@ namespace WCS.BLL.Services.Service
Data = null
};
}
else if (existId != locationInfo.Id)
else if (existId != 0 && existId != locationInfo.Id)
{
return new ResponseCommon<Object>
{

View File

@ -0,0 +1,224 @@
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 MatDetailCurrentInfoService : IMatDetailCurrentInfoService
{
public async Task<PageQueryResponse<MatDetailCurrentInfo>> GetMatDetailCurrentInfos(GetMatDetailCurrentInfosRequest request)
{
try
{
var recordsQueryable = DbHelp.db.Queryable<MatDetailCurrentInfo>()
.LeftJoin<ShelfInfo>((mci, si) => mci.ShlefId == si.Id)
.LeftJoin<LocationInfo>((mci, si, li) => (si.TransStatus == TransStatusEnum. && si.CurrentLocationId == li.Id)
|| (si.TransStatus == TransStatusEnum. && si.DestinationLocationId == li.Id))
.WhereIF(request.LocationAreaId != null && request.LocationAreaId != 0, (mci, si, li) => li.LocationAreaId == request.LocationAreaId)
.WhereIF(!string.IsNullOrEmpty(request.LocationCode), (mci, si, li) => li.LocationCode.Contains(request.LocationCode))
.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);
//分页
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<MatDetailCurrentInfo>()
{
Code = 200,
Message = $"success",
Data = new PageQueryResponseData<MatDetailCurrentInfo>()
{
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<MatDetailCurrentInfo>()
{
Code = 300,
Message = $"操作失败:{ex.Message}",
};
}
}
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;
// 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;
// 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;
//}
}
public async Task<ResponseCommon<object>> deleteMatDetailCurrentInfo(DeleteInfosRequest request)
{
//先查询出具体的Id
var MatDetailCurrentInfos = await DbHelp.db.Queryable<MatDetailCurrentInfo>()
.Where(t => request.needDeleteIds.Contains(t.Id))
.ToListAsync();
//执行删除
try
{
var deleteRows = await DbHelp.db.Deleteable(MatDetailCurrentInfos).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

@ -91,7 +91,7 @@ namespace WCS.BLL.Services.Service
Data = null
};
}
else if (existId != shelfnfo.Id)
else if (existId != 0 && existId != shelfnfo.Id)
{
return new ResponseCommon<Object>
{

View File

@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace WCS.Model.ApiModel.StoreInfo
{
public class GetMatDetailCurrentInfosRequest : PageQueryRequestBase
{
public int? LocationAreaId { get; set; }
public string LocationCode { get; set; }
public int? ShelfTypeId { get; set; }
public string ShelfCode { get; set; }
public string MatCode { get; set; }
public string MatName { get; set; }
}
}

View File

@ -0,0 +1,44 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace WCS.Model.ApiModel.PDAMatBind
{
public class BindMatDetailRequest : RequestBase
{
/// <summary>
/// 工位ID
/// </summary>
public int LocationId { get; set; }
/// <summary>
/// 位置编码 工位编码
/// </summary>
public string LocationCode { get; set; }
/// <summary>
/// 货架ID
/// </summary>
public int ShelfId { get; set; }
/// <summary>
/// 货架编码
/// </summary>
public string ShelfCode { get; set;}
/// <summary>
/// 物料基础数据Id
/// </summary>
public int MatBaseInfoId { get; set; }
/// <summary>
/// 物料编码
/// </summary>
public string MatCode { get; set;}
/// <summary>
/// 物料数量
/// </summary>
public int Qty { get; set; }
}
}

View File

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace WCS.Model.ApiModel.PDAMatBind
{
public class GetShelfInfoByLocationCodeRequest:RequestBase
{
/// <summary>
/// 位置编码 工位编码
/// </summary>
public string LocationCode { get; set; }
}
}

View File

@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace WCS.Model.ApiModel.PDAMatBind
{
public class GetShelfInfoByLocationReturnData
{
/// <summary>
/// 工位ID
/// </summary>
public int LocationId { get; set; } = 0;
/// <summary>
/// 位置编码 工位编码
/// </summary>
public string LocationCode { get; set; } = string.Empty;
/// <summary>
/// 货架ID
/// </summary>
public int? ShelfId { get; set; } = 0;
/// <summary>
/// 货架编码
/// </summary>
public string ShelfCode { get; set;} = string.Empty;
}
}

View File

@ -0,0 +1,50 @@
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 MatDetailCurrenInfoController : ControllerBase
{
public IMatDetailCurrentInfoService _matDetailCurrentInfoService { get; set; }
public MatDetailCurrenInfoController(IMatDetailCurrentInfoService matDetailCurrentInfoService)
{
_matDetailCurrentInfoService = matDetailCurrentInfoService;
}
#region
[Route("getMatDetailCurrentInfos")]
[HttpPost(Name = "getMatDetailCurrentInfos")]
public async Task<ResponseBase> GetMatDetailCurrentInfos(GetMatDetailCurrentInfosRequest request)
{
return await _matDetailCurrentInfoService.GetMatDetailCurrentInfos(request);
}
[HttpPost("updateLocationInfo")]
public async Task<ResponseCommon<object>> updateLocationInfo(AddLocaionInfoRequest<MatDetailCurrentInfo> request)
{
return await _matDetailCurrentInfoService.updateMatDetailCurrentInfo(request);
}
[HttpPost("deleteLocationInfo")]
public async Task<ResponseCommon<object>> deleteLocationInfo(DeleteInfosRequest request)
{
return await _matDetailCurrentInfoService.deleteMatDetailCurrentInfo(request);
}
#endregion
}
}

View File

@ -0,0 +1,228 @@
using Microsoft.AspNetCore.Mvc;
using WCS.BLL.DbModels;
using WCS.BLL.Services.IService;
using WCS.DAL.Db;
using WCS.DAL.DbModels;
using WCS.Model;
using WCS.Model.ApiModel;
using WCS.Model.ApiModel.PDAMatBind;
using WCS.Model.ApiModel.User;
using WCS.Model.WebSocketModel;
namespace WCS.WebApi.Controllers
{
/// <summary>
/// PDA物料绑定相关接口
/// </summary>
[ApiController]
[Route("[controller]")]
public class PDAMatBindController : ControllerBase
{
public IWarningService _warningService { get; set; }
public PDAMatBindController(IWarningService warningService)
{
_warningService = warningService;
}
[Route("getShelfInfoByLocationCode")]
[HttpPost(Name = "getShelfInfoByLocationCode")]
public async Task<ResponseBase> getShelfInfoByLocationCode(GetShelfInfoByLocationCodeRequest request)
{
//判断参数
if (string.IsNullOrEmpty(request.LocationCode))
{
return new ResponseCommon()
{
Code = 201,
Message = "工位编码为空!",
Data = null,
};
}
//获取是否存在当前工位
var location = await DbHelp.db.Queryable<LocationInfo>()
.Where(t => t.LocationCode == request.LocationCode)
.Where(t => t.IsEnable == true)
.FirstAsync();
if (location == null)
{
return new ResponseCommon()
{
Code = 201,
Message = $"工位[{request.LocationCode}]不存在或已被禁用!\r\n请联系系统管理人员维护工位信息",
Data = null,
};
}
//获取当前工位的货架
var shelf = await DbHelp.db.Queryable<ShelfInfo>()
.Where(t => t.CurrentLocationId == location.Id && t.TransStatus == TransStatusEnum.
|| t.DestinationLocationId == location.Id && t.TransStatus == TransStatusEnum.)//解决产线人员 呼叫后货架未到的时候绑定的问题
.Where(t => t.IsEnable)
.FirstAsync();
return new ResponseBase<GetShelfInfoByLocationReturnData>()
{
Code = 200,
Message = $"success",
Data = new GetShelfInfoByLocationReturnData()
{
LocationId = location.Id,
LocationCode = request.LocationCode,
ShelfId = shelf?.Id,
ShelfCode = shelf?.ShelfCode,
},
};
}
[Route("bindMatDetail")]
[HttpPost(Name = "bindMatDetail")]
public async Task<ResponseCommon> bindMatDetail(BindMatDetailRequest request)
{
try
{
#region
//判断参数
if (request.LocationId == 0 || string.IsNullOrEmpty(request.LocationCode))
{
return new ResponseCommon()
{
Code = 201,
Message = "工位或工位编码为空!",
Data = null,
};
}
if (request.ShelfId == 0 || string.IsNullOrEmpty(request.ShelfCode))
{
return new ResponseCommon()
{
Code = 201,
Message = "货架或货架编码为空!",
Data = null,
};
}
if (request.MatBaseInfoId == 0 || string.IsNullOrEmpty(request.MatCode))
{
return new ResponseCommon()
{
Code = 201,
Message = "未选择物料!",
Data = null,
};
}
if (request.Qty <= 0)
{
return new ResponseCommon()
{
Code = 201,
Message = "数量应大于等于1",
Data = null,
};
}
#endregion
#region
//判断参数
if (string.IsNullOrEmpty(request.LocationCode))
{
return new ResponseCommon()
{
Code = 201,
Message = "工位编码为空!",
Data = null,
};
}
//获取是否存在当前工位
var location = await DbHelp.db.Queryable<LocationInfo>()
.Where(t => t.Id == request.LocationId)
.Where(t => t.IsEnable == true)
.FirstAsync();
if (location == null)
{
return new ResponseCommon()
{
Code = 201,
Message = $"工位[{request.LocationCode}]不存在或已被禁用!\r\n请联系系统管理人员维护工位信息",
Data = null,
};
}
//获取当前工位的货架
var shelf = await DbHelp.db.Queryable<ShelfInfo>()
.Where(t => t.Id == request.ShelfId)
.Where(t => t.CurrentLocationId == location.Id && t.TransStatus == TransStatusEnum.
|| t.DestinationLocationId == location.Id && t.TransStatus == TransStatusEnum.)//解决产线人员 呼叫后货架未到的时候绑定的问题
.Where(t => t.IsEnable == true)
.FirstAsync();
if (shelf == null)
{
return new ResponseCommon()
{
Code = 205,
Message = $"货架[{request.ShelfCode}],已不在工位上!\r\n请进行【货架呼叫】",
Data = null,
};
}
//获取物料基础信息
var matBaseInfo = await DbHelp.db.Queryable<MatBaseInfo>()
.Where(t => t.Id == request.MatBaseInfoId)
.Where(t => t.IsEnable == true)
.FirstAsync();
if (matBaseInfo == null)
{
return new ResponseCommon()
{
Code = 201,
Message = $"不存在物料[{request.MatCode}]或已被禁用!",
Data = null,
};
}
#endregion
//校验合格 进行保存
var matDetailCurrentInfo = new MatDetailCurrentInfo()
{
ShlefId = shelf.Id,
ShelfCode = shelf.ShelfCode,
ShelfType = shelf.ShelfTypeName,
ShelfArea = shelf.ShelfArea,
MatCode = matBaseInfo.MatCode,
MatName = matBaseInfo.MatName,
MatSupplier = matBaseInfo.MatSupplier,
MatCustomer = matBaseInfo.MatCustomer,
MatSpec = matBaseInfo.MatSpec,
MatUnit = matBaseInfo.MatUnit,
MatQty = request.Qty,
ModifyUser = request.UserName,
};
DbHelp.db.Insertable(matDetailCurrentInfo).ExecuteCommand();
return new ResponseCommon()
{
Code = 200,
Message = "success",
Data = null,
};
}
catch (Exception ex)
{
return new ResponseCommon()
{
Code = 201,
Message = ex.Message,
Data = null,
};
}
}
}
}

View File

@ -82,6 +82,7 @@ namespace WebApi
builder.Services.AddScoped<IInOutRecordService, InOutRecordService>();
builder.Services.AddScoped<IUploadService, UploadService>();
builder.Services.AddScoped<ILocationInfoService, LocationInfoService>();
builder.Services.AddScoped<IMatDetailCurrentInfoService,MatDetailCurrentInfoService>();
//<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>();

View File

@ -0,0 +1,441 @@
using HandyControl.Controls;
using MiniExcelLibs;
using Ping9719.WpfEx.Mvvm;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Input;
using .Views.Controls;
using .Api;
using WCS.Model;
using WCS.Model.ApiModel.Home;
using WCS.Model.ApiModel.StoreInfo;
using WCS.BLL.DbModels;
using WCS.Model.ApiModel.MatBaseInfo;
using WCS.Model.ApiModel.User;
using WCS.Model.ApiModel;
using Newtonsoft.Json.Bson;
using WCS.Model.ApiModel.LocationInfo;
namespace .ViewModel
{
public class MatDetailCurrentInfoViewModel : BindableBase
{
public MatDetailCurrentInfoViewModel()
{
}
#region Property
private List<LocationInfoModel> dataGridItemSource;
public List<LocationInfoModel> DataGridItemSource
{
get { return dataGridItemSource; }
set
{
SetProperty(ref dataGridItemSource, value);
}
}
private LocationInfoModel selectedataGridItem;
public LocationInfoModel SelectedataGridItem
{
get { return selectedataGridItem; }
set
{
SetProperty(ref selectedataGridItem, value);
}
}
#region
private string locationCode;
public string LocationCode
{
get { return locationCode; }
set
{
SetProperty(ref locationCode, value);
}
}
private List<LocationAreaInfoModel> locationAreaItems;
public List<LocationAreaInfoModel> LocationAreaItems
{
get { return locationAreaItems; }
set
{
SetProperty(ref locationAreaItems, value);
}
}
private LocationAreaInfoModel? selectedLocationAreaItems;
public LocationAreaInfoModel? SelectedLocationAreaItems
{
get { return selectedLocationAreaItems; }
set
{
SetProperty(ref selectedLocationAreaItems, value);
}
}
public void InitLocationAreaItems()
{
//调用接口更新!
Task.Run(() =>
{
LocationAreaItems = new List<LocationAreaInfoModel>();
LocationAreaItems.Add(new LocationAreaInfoModel { Id = null, LocationAreaName = "全部" });
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)
{
LocationAreaItems.AddRange(Result.Data.Lists);
}
SelectedLocationAreaItems = LocationAreaItems.FirstOrDefault();
});
}
#endregion
#region
/// <summary>
/// 货架编号
/// </summary>
private string shelfCode;
public string ShelfCode
{
get { return shelfCode; }
set
{
SetProperty(ref shelfCode, value);
}
}
private List<ShelfTypeModel> shelfTypeItems;
public List<ShelfTypeModel> ShelfTypeItems
{
get { return shelfTypeItems; }
set
{
SetProperty(ref shelfTypeItems, value);
}
}
private ShelfTypeModel? selectedShelfTypeItem;
public ShelfTypeModel? SelectedShelfTypeItem
{
get { return selectedShelfTypeItem; }
set
{
SetProperty(ref selectedShelfTypeItem, value);
}
}
public void InitShelfTypeItems()
{
//调用接口更新!
Task.Run(() =>
{
ShelfTypeItems = new List<ShelfTypeModel>();
ShelfTypeItems.Add(new ShelfTypeModel { Id = null, ShelfTypeName = "全部" });
var body = new RequestBase()
{
UserName = LocalStatic.CurrentUser,
DeviceType = LocalFile.Config.DeviceType,
};
var Result = ApiHelp.GetDataFromHttp<PageQueryResponse<ShelfTypeModel>>(LocalFile.Config.ApiIpHost + "home/getShelfTypes", body, "POST");
if (Result != null && Result.Data != null && Result.Data.Lists.Count() > 0)
{
ShelfTypeItems.AddRange(Result.Data.Lists);
}
SelectedShelfTypeItem = ShelfTypeItems.FirstOrDefault();
});
}
#endregion
#region
/// <summary>
/// 物料编码
/// </summary>
private string matCode;
public string MatCode
{
get { return matCode; }
set
{
SetProperty(ref matCode, value);
}
}
/// <summary>
/// 物料名称
/// </summary>
private string matName;
public string MatName
{
get { return matName; }
set
{
SetProperty(ref matName, value);
}
}
#endregion
#endregion
#region Command
public ICommand BtnResetCommand { get => new DelegateCommand(BtnReset); }
public void BtnReset()
{
if (LocationAreaItems != null)
{
SelectedLocationAreaItems = LocationAreaItems.FirstOrDefault();
}
LocationCode = string.Empty;
if (ShelfTypeItems != null)
{
SelectedShelfTypeItem = ShelfTypeItems.FirstOrDefault();
}
ShelfCode = string.Empty;
MatCode = string.Empty;
MatName = string.Empty;
}
public ICommand BtnSearchCommand { get => new DelegateCommand(BtnSearchReset); }
public void BtnSearchReset()
{
BtnSearch(true);
}
public void BtnSearch(bool IsPageReset = true)
{
if (CurrentPage == 0 || IsPageReset)
{
CurrentPage = 1;
return;
}
#region
var dia = Dialog.Show(new TextDialog());
try
{
var body = new GetLocationInfosRequest()
{
LocationAreaId = SelectedLocationAreaItems == null ? null : SelectedLocationAreaItems.Id,
LocationCode = LocationCode,
UserName = LocalStatic.CurrentUser,
DeviceType = LocalFile.Config.DeviceType,
PageNumber = CurrentPage,
PageSize = PageSize,
};
var Result = ApiHelp.GetDataFromHttp<PageQueryResponse<LocationInfoModel>>(LocalFile.Config.ApiIpHost + "locationInfo/getLocationInfos", body, "POST");
if (Result != null && Result.Data != null && Result.Data.Lists != null)
{
DataGridItemSource = Result.Data.Lists;
MaxPage = Result.Data.MaxPage;
TotalCount = Result.Data.TotalCount;
}
}
catch (Exception ex)
{
Growl.Error("加载数据失败:" + ex.Message);
}
finally
{
dia.Close();
}
#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()
{
//查询勾选的第一个数据
var info = DataGridItemSource?.Where(t => t.IsSelected == true).FirstOrDefault();
if (info == null)
{
Growl.Warning("请选择需要修改的数据!");
}
else
{
var addView = new LocationInfoAddOrUpdateView("修改位置", info);
addView.ShowDialog();
if (addView.DialogResult == true)
{
CurrentPage = 1;
}
}
}
public ICommand BtnDeleteCommand { get => new DelegateCommand(BtnDelete); }
public void BtnDelete()
{
Growl.Ask($"是否删除所有勾选的数据?", isConfirmed =>
{
if (isConfirmed)
{
//查询勾选的第一个数据
var needDeleteIds = DataGridItemSource?.Where(t => t.IsSelected == true)
.Select(t => t.Id)
.ToList();
if (needDeleteIds == null)
{
Growl.Warning("请选择需要修改的数据!");
}
else
{
var body = new DeleteInfosRequest()
{
UserName = LocalStatic.CurrentUser,
DeviceType = LocalFile.Config.DeviceType,
needDeleteIds = needDeleteIds,
};
var Result = ApiHelp.GetDataFromHttp<ResponseBase<UserModel>>(LocalFile.Config.ApiIpHost + "locationInfo/deleteLocationInfo", body, "POST");
if (Result != null && Result.Code == 200)
{
BtnSearch();
Growl.Success("删除成功!" + Result?.Message);
}
else
{
Growl.Error($"{Result?.Message?.ToString()}");
}
}
}
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
#region PageOperation
private int currentPage;
public int CurrentPage
{
get { return currentPage; }
set
{
SetProperty(ref currentPage, value);
BtnSearch(false);
}
}
private int maxPage;
public int MaxPage
{
get { return maxPage; }
set { SetProperty(ref maxPage, value); }
}
//总数量
private int totalCount;
public int TotalCount
{
get { return totalCount; }
set { SetProperty(ref totalCount, value); }
}
private int pageSize = 10;
public int PageSize
{
get => pageSize;
set
{
SetProperty(ref pageSize, value);
BtnSearch(true);
}
}
public ICommand BtnFirstPageCommand { get => new DelegateCommand(BtnFirstPage); }
public void BtnFirstPage()
{
CurrentPage = 1;
}
public ICommand BtnPrePageCommand { get => new DelegateCommand(BtnPrePage); }
public void BtnPrePage()
{
if (CurrentPage > 1)
{
CurrentPage--;
}
}
public ICommand BtnNextPageCommand { get => new DelegateCommand(BtnNextPage); }
public void BtnNextPage()
{
if (CurrentPage < MaxPage)
{
CurrentPage++;
}
}
public ICommand BtnLastPageCommand { get => new DelegateCommand(BtnLastPage); }
public void BtnLastPage()
{
if (CurrentPage != MaxPage)
{
CurrentPage = MaxPage;
}
}
#endregion
}
}

View File

@ -31,22 +31,27 @@
<ColumnDefinition Width="2*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0"
VerticalAlignment="Center" HorizontalAlignment="Right"
Text="位置编号:" FontSize="18" ></TextBlock>
<TextBox Grid.Column="1"
VerticalAlignment="Center" HorizontalAlignment="Stretch"
FontSize="18" MinWidth="90" Text="{Binding LocationCode}"></TextBox>
<TextBlock Grid.Column="2"
VerticalAlignment="Center" HorizontalAlignment="Right"
Text="库位区域:" FontSize="18" ></TextBlock>
<ComboBox Grid.Row="0" Grid.Column="3"
VerticalAlignment="Center"
HorizontalAlignment="Right"
Text="位置区域:"
FontSize="18"></TextBlock>
<ComboBox Grid.Row="0"
Grid.Column="1"
DisplayMemberPath="LocationAreaName"
ItemsSource="{Binding LocationAreaItems}"
SelectedItem="{Binding SelectedLocationAreaItems}"
Height="30"
FontSize="18"
IsEditable="False"/>
IsEditable="False" />
<TextBlock Grid.Column="2"
VerticalAlignment="Center" HorizontalAlignment="Right"
Text="位置编号:" FontSize="18" ></TextBlock>
<TextBox Grid.Column="3"
VerticalAlignment="Center" HorizontalAlignment="Stretch"
FontSize="18" MinWidth="90" Text="{Binding LocationCode}"></TextBox>
<TextBlock Grid.Column="4"
VerticalAlignment="Center" HorizontalAlignment="Right"
@ -141,7 +146,7 @@
</DataGridTemplateColumn.HeaderTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn IsReadOnly="True" Header="序号" Binding="{Binding RowNumber}"></DataGridTextColumn>
<DataGridTextColumn Header="位区域" MaxWidth="150" Binding="{Binding LocationArea}"></DataGridTextColumn>
<DataGridTextColumn Header="位区域" MaxWidth="150" Binding="{Binding LocationArea}"></DataGridTextColumn>
<DataGridTextColumn Header="位置编号" Binding="{Binding LocationCode}"></DataGridTextColumn>
<DataGridTextColumn Header="RCS库位编号" MaxWidth="150" Binding="{Binding RcsStoreCode}"></DataGridTextColumn>
<DataGridTextColumn Header="可放置货架类型" Binding="{Binding AllowShelfTypes,Converter={StaticResource listToString}}"></DataGridTextColumn>

View File

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

View File

@ -0,0 +1,343 @@
<pi:UserControlBase
xmlns:pi="https://github.com/ping9719/wpfex"
x:Class="智慧物流软件系统.MatDetailCurrentInfoView"
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"
d:DesignHeight="737" d:DesignWidth="1192" LoadedVisibleFirst="LoadedVisible">
<Border Margin="0" Background="AliceBlue" CornerRadius="3" Padding="0">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1.6*"></RowDefinition>
<RowDefinition Height="9*"></RowDefinition>
</Grid.RowDefinitions>
<Border Grid.Row="0" Margin="5 5 5 0" Background="AliceBlue" CornerRadius="5" Padding="0">
<Grid>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1.9*"></ColumnDefinition>
<ColumnDefinition Width="2*"></ColumnDefinition>
<ColumnDefinition Width="1.9*"></ColumnDefinition>
<ColumnDefinition Width="2*"></ColumnDefinition>
<ColumnDefinition Width="1.9*"></ColumnDefinition>
<ColumnDefinition Width="2*"></ColumnDefinition>
<ColumnDefinition Width="1.9*"></ColumnDefinition>
<ColumnDefinition Width="2*"></ColumnDefinition>
<ColumnDefinition Width="2*"></ColumnDefinition>
<ColumnDefinition Width="2*"></ColumnDefinition>
<ColumnDefinition Width="2*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0"
VerticalAlignment="Center"
HorizontalAlignment="Right"
Text="货架类型:"
FontSize="18"></TextBlock>
<ComboBox Grid.Row="0"
Grid.Column="1"
DisplayMemberPath="ShelfTypeName"
ItemsSource="{Binding ShelfTypeItems}"
SelectedItem="{Binding SelectedShelfTypeItem}"
Height="30"
FontSize="18"
IsEditable="False" />
<TextBlock Grid.Column="2"
VerticalAlignment="Center" HorizontalAlignment="Right"
Text="货架编码:" FontSize="18" ></TextBlock>
<TextBox Grid.Column="3"
VerticalAlignment="Center" HorizontalAlignment="Stretch"
FontSize="18" MinWidth="90" Text="{Binding ShelfCode}"></TextBox>
<TextBlock Grid.Column="4"
VerticalAlignment="Center"
HorizontalAlignment="Right"
Text="位置区域:"
FontSize="18"></TextBlock>
<ComboBox Grid.Row="0"
Grid.Column="5"
DisplayMemberPath="LocationAreaName"
ItemsSource="{Binding LocationAreaItems}"
SelectedItem="{Binding SelectedLocationAreaItems}"
Height="30"
FontSize="18"
IsEditable="False" />
<TextBlock Grid.Column="6"
VerticalAlignment="Center"
HorizontalAlignment="Right"
Text="位置编号:"
FontSize="18"></TextBlock>
<TextBox Grid.Column="7"
VerticalAlignment="Center"
HorizontalAlignment="Stretch"
FontSize="18"
MinWidth="90"
Text="{Binding LocationCode}"></TextBox>
<Button Style="{StaticResource ButtonSuccess}" hc:BorderElement.CornerRadius="15"
Grid.Column="9" MinHeight="40" FontSize="18" Content="&#xe8b9; 搜索" FontFamily="{StaticResource IconFont}"
Command="{Binding BtnSearchCommand}">
</Button>
<Button Style="{StaticResource ButtonWarning}" hc:BorderElement.CornerRadius="15"
Grid.Column="10" MinHeight="40" FontSize="18" Content="&#xe652; 重置" FontFamily="{StaticResource IconFont}"
Command="{Binding BtnResetCommand}">
</Button>
<TextBlock Grid.Column="0"
Grid.Row="1"
VerticalAlignment="Center"
HorizontalAlignment="Right"
Text="物料编码:"
FontSize="18"></TextBlock>
<TextBox Grid.Column="1"
Grid.Row="1"
VerticalAlignment="Center"
HorizontalAlignment="Stretch"
FontSize="18"
MinWidth="90"
Text="{Binding MatCode}"></TextBox>
<TextBlock Grid.Column="2"
Grid.Row="1"
VerticalAlignment="Center"
HorizontalAlignment="Right"
Text="物料名称:"
FontSize="18"></TextBlock>
<TextBox Grid.Column="3"
Grid.Row="1"
VerticalAlignment="Center"
HorizontalAlignment="Stretch"
FontSize="18"
MinWidth="90"
Text="{Binding MatName}"></TextBox>
</Grid>
</Border>
<Border Grid.Row="1" Margin="5" Background="AliceBlue" CornerRadius="5" Padding="0">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="0.8*"></RowDefinition>
<RowDefinition Height="8.2*"></RowDefinition>
<RowDefinition Height="0.8*"></RowDefinition>
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" Orientation="Horizontal">
<Button MinHeight="40" FontSize="18" Margin="5"
Content="&#xe612;修 改" FontFamily="{StaticResource IconFont}"
Foreground="WhiteSmoke"
Background="CadetBlue"
Command="{Binding BtnEditCommand}">
</Button>
<Button MinHeight="40"
FontSize="18"
Margin="5"
Content="&#xe8c1;删 除"
FontFamily="{StaticResource IconFont}"
Foreground="WhiteSmoke"
Command="{Binding BtnDeleteCommand}"
Style="{StaticResource ButtonDanger}"></Button>
<Button MinHeight="40" FontSize="18" Margin="5"
Content="&#xe866;导 出" FontFamily="{StaticResource IconFont}"
Command="{Binding BtnExportCommand}"
Foreground="WhiteSmoke"
Background="DarkOrange">
</Button>
</StackPanel>
<DataGrid Grid.Row="1"
SelectionChanged="DataGrid_SelectionChanged"
SelectedItem="{Binding SelectedataGridItem}"
Name="dataGrid"
SelectedCellsChanged="DataGrid_SelectedCellsChanged"
ItemsSource="{Binding DataGridItemSource}"
RowHeight="39"
AutoGenerateColumns="False" FontSize="13">
<DataGrid.Columns>
<DataGridTemplateColumn CanUserResize="False">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<CheckBox Width="30" Height="30" IsHitTestVisible="False" IsChecked="{Binding IsSelected}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
<DataGridTemplateColumn.HeaderTemplate>
<DataTemplate>
<CheckBox Width="30" Height="30" Unchecked="allChecked_Unchecked" Checked="allChecked_Checked" Name="allChecked"/>
</DataTemplate>
</DataGridTemplateColumn.HeaderTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn IsReadOnly="True" Header="序号" Binding="{Binding RowNumber}"></DataGridTextColumn>
<DataGridTextColumn Header="货架类型" MaxWidth="150" Binding="{Binding ShelfType}"></DataGridTextColumn>
<DataGridTextColumn Header="货架编码" Binding="{Binding ShelfCode}"></DataGridTextColumn>
<DataGridTextColumn Header="位置区域" MaxWidth="150" Binding="{Binding LocationArea}"></DataGridTextColumn>
<DataGridTextColumn Header="位置编号" Binding="{Binding LocationCode}"></DataGridTextColumn>
<DataGridTextColumn Header="物料编码" Binding="{Binding MatCode}"></DataGridTextColumn>
<DataGridTextColumn Header="物料名称" Binding="{Binding MatName}"></DataGridTextColumn>
<DataGridTextColumn Header="物料规格" Binding="{Binding MatSpec}"></DataGridTextColumn>
<DataGridTextColumn Header="数量" Binding="{Binding MatQty}"></DataGridTextColumn>
<DataGridTextColumn IsReadOnly="True" Header="更新人" Binding="{Binding ModifyUser}"></DataGridTextColumn>
<DataGridTextColumn IsReadOnly="True" Header="更新时间" Binding="{Binding ModifyTime ,StringFormat='yyyy-MM-dd HH:mm:ss'}"></DataGridTextColumn>
</DataGrid.Columns>
</DataGrid>
<Grid Grid.Row="2">
<Border CornerRadius="3" Background="Transparent" VerticalAlignment="Center" >
<Grid HorizontalAlignment="Stretch" Margin="0" VerticalAlignment="Top" Width="Auto" MinHeight="26">
<Grid.RowDefinitions>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="5*"></ColumnDefinition>
<ColumnDefinition Width="5*"></ColumnDefinition>
<ColumnDefinition Width="5*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="5">
<TextBlock FontSize="14" VerticalAlignment="Center" Text="共"></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="{Binding TotalCount ,FallbackValue=0}"></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="条记录 "></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="第"></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="{Binding CurrentPage,FallbackValue=0}"></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="/"></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="{Binding MaxPage,FallbackValue=0}"></TextBlock>
<TextBlock FontSize="14" VerticalAlignment="Center" Text="页 "></TextBlock>
<ComboBox FontSize="14" VerticalAlignment="Center" SelectedValue="{Binding PageSize}" SelectedValuePath="Tag">
<ComboBoxItem Tag="10" IsSelected="True">10条/页</ComboBoxItem>
<ComboBoxItem Tag="20">20条/页</ComboBoxItem>
<ComboBoxItem Tag="50">50条/页</ComboBoxItem>
<ComboBoxItem Tag="100">100条/页</ComboBoxItem>
<ComboBoxItem Tag="500">500条/页</ComboBoxItem>
</ComboBox>
</StackPanel>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Grid.Column="1">
<Grid>
<Grid.RowDefinitions >
<RowDefinition Height="30"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<Button BorderBrush="Transparent" Background="Transparent" Grid.Column="0" Name="btnFirst" Content="首页" Foreground="Black" FontSize="14"
Command="{Binding BtnFirstPageCommand}"/>
<Button BorderBrush="Transparent" Background="Transparent" Grid.Column="1" Name="btnPrev" Content="上一页" FontSize="14"
Command="{Binding BtnPrePageCommand}"/>
<TextBox BorderBrush="Transparent" Grid.Column="2" FontSize="14" MinWidth="50" HorizontalAlignment="Center" VerticalAlignment="Center" Cursor="IBeam" IsEnabled="False"
Text ="{Binding CurrentPage}" TextAlignment="Center"/>
<Button BorderBrush="Transparent" Background="Transparent" Grid.Column="3" Name="btnNext" Content="下一页" FontSize="14"
Command="{Binding BtnNextPageCommand}"/>
<Button BorderBrush="Transparent" Background="Transparent" Grid.Column="4" Name="btnLast" Content="末页" FontSize="14"
Command="{Binding BtnLastPageCommand}"/>
</Grid>
</StackPanel>
</Grid>
</Border>
</Grid>
</Grid>
</Border>
<!--<Border Grid.Row="1" Margin="3" Background="AliceBlue" CornerRadius="3" Padding="0">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="0.8*"></RowDefinition>
<RowDefinition Height="8*"></RowDefinition>
<RowDefinition Height="0.7*"></RowDefinition>
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" Orientation="Horizontal">
<Button MinHeight="40" FontSize="18" Margin="5" Command="{Binding BtnExportCommand}"
Content="&#xe866; 导 出" FontFamily="{StaticResource IconFont}"
Style="{StaticResource ButtonWarning}" Background="DarkOrange">
</Button>
</StackPanel>
<DataGrid Grid.Row="1"
SelectedCellsChanged="DataGrid_SelectedCellsChanged"
ItemsSource="{Binding DataGridItemSource}"
RowHeight="39"
AutoGenerateColumns="False"
FontSize="13">
<DataGrid.Columns>
<DataGridTextColumn Header="序号" Binding="{Binding RowNumber}"></DataGridTextColumn>
<DataGridTextColumn Header="接口地址" Binding="{Binding RequestUrl}"></DataGridTextColumn>
<DataGridTextColumn Header="设备IP" Binding="{Binding DeviceIp}"></DataGridTextColumn>
<DataGridTextColumn Header="请求参数" Binding="{Binding RequestBody}" MaxWidth="100"></DataGridTextColumn>
<DataGridTextColumn Header="QueryString" Binding="{Binding QueryString}" MaxWidth="100"></DataGridTextColumn>
<DataGridTextColumn Header="请求时间" Binding="{Binding RequestTime,StringFormat='yyyy-MM-dd HH:mm:ss'}"></DataGridTextColumn>
<DataGridTextColumn Header="返回参数" Binding="{Binding ResponseJson}" MaxWidth="100"></DataGridTextColumn>
<DataGridTextColumn Header="返回时间" Binding="{Binding ResponseTime,StringFormat='yyyy-MM-dd HH:mm:ss'}"></DataGridTextColumn>
<DataGridTextColumn Header="耗时(ms)" Binding="{Binding ExecutionTime}"></DataGridTextColumn>
</DataGrid.Columns>
</DataGrid>
<Grid Grid.Row="2">
<Border CornerRadius="3" Background="Transparent" VerticalAlignment="Center" >
<Grid HorizontalAlignment="Stretch" Margin="0" VerticalAlignment="Top" Width="Auto" MinHeight="26">
<Grid.RowDefinitions>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="5*"></ColumnDefinition>
<ColumnDefinition Width="5*"></ColumnDefinition>
<ColumnDefinition Width="5*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal" Margin="5">
<TextBlock FontSize="14" Text="共"></TextBlock>
<TextBlock FontSize="14" Text="{Binding TotalCount ,FallbackValue=0}"></TextBlock>
<TextBlock FontSize="14" Text="条记录 "></TextBlock>
<TextBlock FontSize="14" Text="第"></TextBlock>
<TextBlock FontSize="14" Text="{Binding CurrentPage,FallbackValue=0}"></TextBlock>
<TextBlock FontSize="14" Text="/"></TextBlock>
<TextBlock FontSize="14" Text="{Binding MaxPage,FallbackValue=0}"></TextBlock>
<TextBlock FontSize="14" Text="页"></TextBlock>
</StackPanel>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Grid.Column="1">
<Grid>
<Grid.RowDefinitions >
<RowDefinition Height="30"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<Button BorderBrush="Transparent" Background="Transparent" Grid.Column="0" Name="btnFirst" Content="首页" Foreground="Black" FontSize="14"
Command="{Binding BtnFirstPageCommand}"/>
<Button BorderBrush="Transparent" Background="Transparent" Grid.Column="1" Name="btnPrev" Content="上一页" FontSize="14"
Command="{Binding BtnPrePageCommand}"/>
<TextBox BorderBrush="Transparent" Grid.Column="2" FontSize="14" MinWidth="50" HorizontalAlignment="Center" VerticalAlignment="Center" Cursor="IBeam" IsEnabled="False"
Text ="{Binding CurrentPage}" TextAlignment="Center"
/>
<Button BorderBrush="Transparent" Background="Transparent" Grid.Column="3" Name="btnNext" Content="下一页" FontSize="14"
Command="{Binding BtnNextPageCommand}"/>
<Button BorderBrush="Transparent" Background="Transparent" Grid.Column="4" Name="btnLast" Content="末页" FontSize="14"
Command="{Binding BtnLastPageCommand}"/>
</Grid>
</StackPanel>
</Grid>
</Border>
</Grid>
</Grid>
</Border>-->
</Grid>
</Border>
</pi:UserControlBase>

View File

@ -0,0 +1,90 @@
using Ping9719.WpfEx;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using .ViewModel;
namespace
{
public partial class MatDetailCurrentInfoView : UserControlBase
{
public MatDetailCurrentInfoViewModel viewModel { get; set; } = new MatDetailCurrentInfoViewModel();
public MatDetailCurrentInfoView()
{
InitializeComponent();
this.DataContext = viewModel;
viewModel.InitLocationAreaItems();
viewModel.InitShelfTypeItems();
}
private void LoadedVisible(object sender, EventArgs e)
{
viewModel.BtnReset();
viewModel.BtnSearchReset();
}
private void DataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
try
{
if (viewModel.SelectedataGridItem != null)
{
viewModel.SelectedataGridItem.IsSelected = !viewModel.SelectedataGridItem.IsSelected;
dataGrid.UnselectAllCells();//取消选中 避免手动点击check选项时反选失败 和重新点击该项时反选失败
}
}
catch
{
}
}
private void DataGrid_SelectedCellsChanged(object sender, SelectedCellsChangedEventArgs e)
{
//try
//{
// if (viewModel.SelectedataGridItem != null)
// {
// viewModel.SelectedataGridItem.IsSelected = !viewModel.SelectedataGridItem.IsSelected;
// }
//}
//catch
//{
//}
}
private void allChecked_Checked(object sender, RoutedEventArgs e)
{
if (viewModel != null && viewModel.DataGridItemSource != null && viewModel.DataGridItemSource.Count() > 0)
{
foreach (var item in viewModel.DataGridItemSource)
{
item.IsSelected = true;
}
}
}
private void allChecked_Unchecked(object sender, RoutedEventArgs e)
{
if (viewModel != null && viewModel.DataGridItemSource != null && viewModel.DataGridItemSource.Count() > 0)
{
foreach (var item in viewModel.DataGridItemSource)
{
item.IsSelected = false;
}
}
}
}
}