1.发送任务时添加货架编码识别

2.客户端功能优化:任务管理无法通过货架编码等进行模糊搜索
3.数据记录功能增加导出功能
This commit is contained in:
hehaibing-1996
2025-03-18 10:39:52 +08:00
parent 8112e697e6
commit 90a273f924
4 changed files with 105 additions and 4 deletions

View File

@ -285,6 +285,7 @@ namespace WCS.BLL.Manager
var body = new GenAgvSchedulingTaskRequest()
{
positionCodePath = positionCodePathItems,
podCode = shelfCode,//发送任务时添加货架编码
};
var response = ApiHelp.GetDataFromHttp<AGVResponseModel>(url, body, "POST", true);
if (response.code == "0" && response.message == "成功")

View File

@ -83,10 +83,10 @@ namespace WCS.WebApi.Controllers
}
var recordsQueryable = DbHelp.db.Queryable<AgvTask>()
.WhereIF(string.IsNullOrEmpty(request.ShelfCode), t => t.ShelfCode.Contains(request.ShelfCode))
.WhereIF(string.IsNullOrEmpty(request.CreateUser), t => t.CreateUser.Contains(request.CreateUser))
.WhereIF(string.IsNullOrEmpty(request.StartLocationCode), t => t.StartLocationCode.Contains(request.StartLocationCode))
.WhereIF(string.IsNullOrEmpty(request.EndLocationCode), t => t.StartLocationCode.Contains(request.EndLocationCode))
.WhereIF(!string.IsNullOrEmpty(request.ShelfCode), t => t.ShelfCode.Contains(request.ShelfCode))
.WhereIF(!string.IsNullOrEmpty(request.CreateUser), t => t.CreateUser.Contains(request.CreateUser))
.WhereIF(!string.IsNullOrEmpty(request.StartLocationCode), t => t.StartLocationCode.Contains(request.StartLocationCode))
.WhereIF(!string.IsNullOrEmpty(request.EndLocationCode), t => t.StartLocationCode.Contains(request.EndLocationCode))
.WhereIF(request.TaskStatus != null, t => t.TaskStatus == request.TaskStatus);
var totalCount = await recordsQueryable.CountAsync();

View File

@ -14,8 +14,10 @@ using WCS.Model;
using WCS.Model.ApiModel.AGV;
using WCS.Model.ApiModel.Home;
using WCS.Model.ApiModel.MatBaseInfo;
using WCS.Model.ApiModel.MatDetailCurrentInfo;
using WCS.Model.ApiModel.MatDetailHistoryInfo;
using WCS.Model.ApiModel.StoreInfo;
using WCS.WebApi.Helper;
using Mode = WCS.BLL.HardWare.Mode;
namespace WCS.WebApi.Controllers
@ -117,5 +119,55 @@ namespace WCS.WebApi.Controllers
}
[Route("exportMatDetailHistoryInfo")]
[HttpPost(Name = "exportMatDetailHistoryInfo")]
public async Task<IActionResult> exportMatDetailHistoryInfo(GetMatDetailHistoryInfosRequest request)
{
var recordsQueryable = DbHelp.db.Queryable<MatDetailHistoryInfo>()
.WhereIF(request.RecordType != null, t => t.RecordType == request.RecordType)
.WhereIF(request.FunctionType != null, t => t.FunctionType == request.FunctionType)
.WhereIF(!string.IsNullOrEmpty(request.ShelfCode), t => t.ShelfCode.Contains(request.ShelfCode))
.WhereIF(!string.IsNullOrEmpty(request.MatCode), t => t.MatCode.Contains(request.MatCode))
.WhereIF(!string.IsNullOrEmpty(request.MatName), t => t.MatName.Contains(request.MatName))
;
var totalCount = await recordsQueryable.CountAsync();
var result = await recordsQueryable
.OrderByDescending(t => t.ModifyTime)
//.Skip((request.PageNumber - 1) * request.PageSize).Take(request.PageSize)
.ToListAsync();
//生成序号
for (int i = 0; i < result.Count; i++)
{
result[i].RowNumber = (request.PageNumber - 1) * request.PageSize + i + 1;
}
var columns = new[]
{
new ExportableColumn("序号","RowNumber"),
new ExportableColumn("货架编码","ShelfCode"),
new ExportableColumn("记录类型","RecordType"),
new ExportableColumn("操作功能","FunctionType"),
new ExportableColumn("货架编码","MatCode"),
new ExportableColumn("物料名称","MatName"),
new ExportableColumn("物料批次","MatBatch"),
new ExportableColumn("物料规格","MatSpec"),
new ExportableColumn("更新前数量", "BeforeQty"),
new ExportableColumn("更新后数量", "AfterQty"),
new ExportableColumn("更新人", "ModifyUser"),
new ExportableColumn("更新时间", "ModifyTime"),
};
if (result == null)
{
return NotFound();
}
else
return ExportExcelHelper.Export("导出数据", columns, result);
}
}
}

View File

@ -24,6 +24,7 @@ using WCS.Model.ApiModel.MatDetailCurrentInfo;
using WCS.Model.ApiModel.Stocktaking;
using WCS.Model.ApiModel.MatDetailHistoryInfo;
using WCS.Model.ApiModel.AGV;
using System.Data.SQLite;
namespace .ViewModel
{
@ -258,6 +259,53 @@ namespace 智慧物流软件系统.ViewModel
return true;
});
}
/// <summary>
/// 导出数据为Excel文件
/// </summary>
public ICommand BtnExportCommand { get => new DelegateCommand(BtnExport); }
public async void BtnExport()
{
try
{
#region
Microsoft.Win32.SaveFileDialog sfd = new Microsoft.Win32.SaveFileDialog();
sfd.Title = "选择文件保存路径";
sfd.Filter = ".xlsx文件(*.xlsx)|*.xlsx";
sfd.FileName = "数据记录" + DateTime.Now.ToString("yyyyMMddhhmmss");
sfd.OverwritePrompt = true;
if (sfd.ShowDialog() != true)
{
return;
}
string path = sfd.FileName;
#endregion
var isSelectedRecordType = Enum.TryParse<RecordTypeEnum>(SelectedRecordTypeItem, out RecordTypeEnum recordType);
var isSelectedFunctionType = Enum.TryParse<FunctionTypeEnum>(SelectedFunctionTypeItem, out FunctionTypeEnum functionType);
var body = new GetMatDetailHistoryInfosRequest()
{
FunctionType = isSelectedFunctionType ? functionType : null,
RecordType = isSelectedRecordType ? recordType : null,
ShelfCode = ShelfCode,
MatCode = MatCode,
MatName = MatName,
UserName = LocalStatic.CurrentUser,
DeviceType = LocalFile.Config.DeviceType,
PageNumber = CurrentPage,
PageSize = PageSize,
};
await ApiHelp.PostDownloadFileAsync(path, System.Net.Http.HttpMethod.Post, LocalFile.Config.ApiIpHost + "matDetailHistoryInfo/exportMatDetailHistoryInfo", body);
Growl.Success("导出成功!");
}
catch (Exception ex)
{
Growl.Error("导出失败:" + ex.Message);
}
}
#endregion
#region PageOperation