This commit is contained in:
hehaibing-1996
2024-05-15 18:59:24 +08:00
parent cc65e985aa
commit 432a96198f
75 changed files with 2174 additions and 272 deletions

View File

@ -51,7 +51,7 @@ namespace 货架标准上位机.ViewModel
if (newBytes > 0)
{
var currentScanedCode = Encoding.UTF8.GetString(e.ByteBlock, 0, e.ByteBlock.Len);
Logs.Write($"接收到扫码枪扫码数据{currentScanedCode}");
Logs.Write($"接收到扫码枪[{scanner.COM}]扫码数据{currentScanedCode}", LogsType.Scanner);
scanner.TempCode += currentScanedCode;
//校验末尾码
CheckDataCompleteness(scanner);
@ -88,11 +88,18 @@ namespace 货架标准上位机.ViewModel
var isModuleCode = Regex.IsMatch(scanner.TempCode, ModuleCodePattern);
if (isModuleCode)
{
Logs.Write($"[{scanner.COM}]校验到扫码数据为货架码【{scanner.TempCode}】", LogsType.Scanner);
ModuleCodeProcess(scanner);
}
else if (scanner.TempCode == "shelfGoOutInStore")
{
Logs.Write($"[{scanner.COM}]校验到扫码数据为结束入库码【{scanner.TempCode}】", LogsType.Scanner);
ShelfGoOutInstoreProcess(scanner);
}
//TODO 增加正则表达式进行判断是否扫到的是物料码
else
{
Logs.Write($"[{scanner.COM}]校验到扫码数据为物料码【{scanner.TempCode}】", LogsType.Scanner);
MatSnProcess(scanner);
}
}
@ -118,13 +125,15 @@ namespace 货架标准上位机.ViewModel
//如果扫码枪前一个货架未退出入库
if (scanner.IsInstoreMode)
{
//判断当前入库货架是否包含本次扫码的模组
//判断当前入库货架是否包含本次扫码的模组 表示用户重复对货架码进行扫码 不能让其多次进入入库
if (scanner.ModulesStr.Contains(scanner.TempCode))
{
Logs.Write($"当前扫码模组{scanner.TempCode},是当前入库货架{scanner.ShelfCode}的模组,不进行操作!", LogsType.Scanner);
return;
}
else
{
Logs.Write($"当前扫码模组{scanner.TempCode},不是当前入库货架{scanner.ShelfCode}的模组,先进行当前入库货架的退出入库操作!", LogsType.Scanner);
#region
try
{
@ -135,26 +144,32 @@ namespace 货架标准上位机.ViewModel
DeviceType = LocalFile.Config.DeviceType,
UserName = LocalStatic.CurrentUser,
};
var Result = ApiHelp.GetDataFromHttp<ResponseBase>(LocalFile.Config.ApiIpHost + "instore/shelfGoOutInStore", body, "POST");
var Result = ApiHelp.GetDataFromHttp<ResponseBase>(LocalFile.Config.ApiIpHost + "instore/shelfGoOutInStore", body, "POST", true);
if (Result != null && Result.Code == 200)
{
Logs.Write($"货架{scanner.ShelfCode}已成功退出入库!", LogsType.Scanner);
scanner.ShelfCode = string.Empty;
scanner.ModulesStr = string.Empty;
}
else
{
Logs.Write($"货架{scanner.ShelfCode}退出入库失败!", LogsType.Scanner);
return;
}
}
catch (Exception ex)
{
Logs.Write($"货架{scanner.ShelfCode}退出入库失败!发生异常:{ex.Message}", LogsType.Scanner);
}
#endregion
}
}
//调用接口 请求进入入库模式
//调用接口 本次扫码的货架进入入库模式
#region
try
{
Logs.Write($"扫码模组{scanner.TempCode},请求进入入库!", LogsType.Scanner);
var body = new ShelfGoInInstoreRequest()
{
ModuleCode = scanner.TempCode,
@ -165,20 +180,25 @@ namespace 货架标准上位机.ViewModel
var Result = ApiHelp.GetDataFromHttp<ShelfGoInInstoreResponse>(LocalFile.Config.ApiIpHost + "instore/shelfGoInInStore", body, "POST");
if (Result != null && Result.Code == 200)
{
Logs.Write($"扫码模组{scanner.TempCode},进入入库模式成功!", LogsType.Scanner);
scanner.IsInstoreMode = true;
scanner.ShelfCode = Result.Data.ShelfCode;
scanner.ModulesStr = Result.Data.ModulesStr;
//TODO 清除其他扫码枪的占用
//清除其他扫码枪的占用
var sacnners = ScannerManager.Scanners
.Where(t => ShelfCode == Result.Data.ShelfCode)
.Where(t => t.COM != scanner.COM)
.ToList();
foreach (var item in sacnners)
foreach (var scanner1 in sacnners)
{
item.ShelfCode = string.Empty;
scanner1.ShelfCode = string.Empty;
scanner1.ModulesStr = string.Empty;
}
}
else if (Result != null && !string.IsNullOrEmpty(Result.Message))
{
Logs.Write($"扫码模组{scanner.TempCode},进入入库模式失败!{Result.Message}", LogsType.Scanner);
Growl.Warning(Result.Message);
}
}
@ -189,6 +209,36 @@ namespace 货架标准上位机.ViewModel
#endregion
}
/// <summary>
/// 扫码枪扫到结束码
/// </summary>
/// <param name="scanner"></param>
public void ShelfGoOutInstoreProcess(Scanner scanner)
{
#region
try
{
var body = new ShelfGoOutInStoreRequest()
{
ShelfCode = scanner.ShelfCode,
IPAdress = scanner.COM,
DeviceType = LocalFile.Config.DeviceType,
UserName = LocalStatic.CurrentUser,
};
var Result = ApiHelp.GetDataFromHttp<ResponseBase>(LocalFile.Config.ApiIpHost + "instore/shelfGoOutInStore", body, "POST");
if (Result != null && Result.Code == 200)
{
scanner.ShelfCode = string.Empty;
scanner.ModulesStr = string.Empty;
}
}
catch (Exception ex)
{
}
#endregion
}
/// <summary>
/// 扫到物料码的数据处理
/// </summary>

View File

@ -243,7 +243,7 @@ namespace 货架标准上位机.ViewModel
UserName = LocalStatic.CurrentUser,
DeviceType = LocalFile.Config.DeviceType,
PageNumber = CurrentPage,
PageSize = 10,
PageSize = PageSize,
};
var Result = ApiHelp.GetDataFromHttp<PageQueryResponse<InOutRecordModel>>(LocalFile.Config.ApiIpHost + "inOutRecord/getInOutRecord", body, "POST");
if (Result != null && Result.Data != null && Result.Data.Lists != null)
@ -293,7 +293,7 @@ namespace 货架标准上位机.ViewModel
UserName = LocalStatic.CurrentUser,
DeviceType = LocalFile.Config.DeviceType,
PageNumber = CurrentPage,
PageSize = 10,
PageSize = 65535,
};
await ApiHelp.PostDownloadFileAsync(path, System.Net.Http.HttpMethod.Post, LocalFile.Config.ApiIpHost + "inOutRecord/exportInOutRecord", body);
Growl.Success("导出成功!");
@ -334,6 +334,14 @@ namespace 货架标准上位机.ViewModel
set { SetProperty(ref totalCount, value); }
}
private int pageSize = 10;
public int PageSize
{
get => pageSize;
set { SetProperty(ref pageSize, value); }
}
public ICommand BtnFirstPageCommand { get => new DelegateCommand(BtnFirstPage); }
public void BtnFirstPage()
{

View File

@ -157,7 +157,7 @@ namespace 货架标准上位机.ViewModel
UserName = LocalStatic.CurrentUser,
DeviceType = LocalFile.Config.DeviceType,
PageNumber = CurrentPage,
PageSize = 10,
PageSize = PageSize,
};
var Result = ApiHelp.GetDataFromHttp<PageQueryResponse<SystemApiLogModel>>(LocalFile.Config.ApiIpHost + "interfaceRecord/getInterfaceRecord", body, "POST");
@ -211,7 +211,7 @@ namespace 货架标准上位机.ViewModel
UserName = LocalStatic.CurrentUser,
DeviceType = LocalFile.Config.DeviceType,
PageNumber = CurrentPage,
PageSize = 10,
PageSize = 65535,
};
await ApiHelp.PostDownloadFileAsync(path, System.Net.Http.HttpMethod.Post, LocalFile.Config.ApiIpHost + "interfaceRecord/exportInterfaceRecord", body);
@ -251,6 +251,14 @@ namespace 货架标准上位机.ViewModel
set { SetProperty(ref totalCount, value); }
}
private int pageSize = 10;
public int PageSize
{
get => pageSize;
set { SetProperty(ref pageSize, value); }
}
public ICommand BtnFirstPageCommand { get => new DelegateCommand(BtnFirstPage); }
public void BtnFirstPage()
{

View File

@ -142,7 +142,7 @@ namespace 货架标准上位机.ViewModel
UserName = LocalStatic.CurrentUser,
DeviceType = LocalFile.Config.DeviceType,
PageNumber = CurrentPage,
PageSize = 10,
PageSize = PageSize,
};
var Result = ApiHelp.GetDataFromHttp<PageQueryResponse<MatBaseInfoModel>>(LocalFile.Config.ApiIpHost + "matBaseInfo/getMatBaseInfo", body, "POST");
@ -163,8 +163,6 @@ namespace 货架标准上位机.ViewModel
dia.Close();
}
#endregion
}
/// <summary>
@ -173,7 +171,6 @@ namespace 货架标准上位机.ViewModel
public ICommand BtnExportCommand { get => new DelegateCommand(BtnExport); }
public async void BtnExport()
{
try
{
#region
@ -199,7 +196,7 @@ namespace 货架标准上位机.ViewModel
UserName = LocalStatic.CurrentUser,
DeviceType = LocalFile.Config.DeviceType,
PageNumber = CurrentPage,
PageSize = 10,
PageSize = 65535,
};
await ApiHelp.PostDownloadFileAsync(path, System.Net.Http.HttpMethod.Post, LocalFile.Config.ApiIpHost + "matBaseInfo/exportMatBaseInfo", body);
Growl.Success("导出成功!");
@ -240,7 +237,7 @@ namespace 货架标准上位机.ViewModel
UserName = LocalStatic.CurrentUser,
DeviceType = LocalFile.Config.DeviceType,
PageNumber = CurrentPage,
PageSize = 10,
PageSize = 65535,
};
var result = await ApiHelp.PostImportFileAsync<ResponseCommon<List<string>>>(path, System.Net.Http.HttpMethod.Post,
LocalFile.Config.ApiIpHost + "matBaseInfo/importMatBaseInfo", LocalStatic.CurrentUser, LocalFile.Config.DeviceType);
@ -256,7 +253,6 @@ namespace 货架标准上位机.ViewModel
else
HandyControl.Controls.MessageBox.Show(result.Message);
}
}
catch (Exception ex)
{
@ -295,7 +291,6 @@ namespace 货架标准上位机.ViewModel
else
{
Growl.Error($"{Result?.Message?.ToString()}");
//BtnAdd();
}
}
}
@ -430,6 +425,14 @@ namespace 货架标准上位机.ViewModel
set { SetProperty(ref totalCount, value); }
}
private int pageSize = 10;
public int PageSize
{
get => pageSize;
set { SetProperty(ref pageSize, value); }
}
public ICommand BtnFirstPageCommand { get => new DelegateCommand(BtnFirstPage); }
public void BtnFirstPage()
{

View File

@ -26,11 +26,22 @@ using WCS.Model.ApiModel.MatBaseInfo;
using System.Collections.ObjectModel;
using HandyControl.Tools.Extension;
using .Tool;
using System.Printing;
using System.Printing.IndexedProperties;
namespace .ViewModel
{
public class MatInfoViewModel : BindableBase
{
public MatInfoViewModel()
{
IsPrintedItemSource = new List<ComboBoxItem>()
{
new ComboBoxItem(){Text = "全部",Value = null},
new ComboBoxItem(){Text = "否",Value = false },
new ComboBoxItem(){Text = "是",Value = true},
};
}
#region Property
private ObservableCollection<MatInfoModel> dataGridItemSource;
public ObservableCollection<MatInfoModel> DataGridItemSource
@ -52,6 +63,35 @@ namespace 货架标准上位机.ViewModel
}
}
private List<ComboBoxItem> isPrintedItemSource;
public List<ComboBoxItem> IsPrintedItemSource
{
get => isPrintedItemSource;
set { SetProperty(ref isPrintedItemSource, value); }
}
public class ComboBoxItem
{
public string Text { get; set; }
public bool? Value { get; set; }
}
private bool? isPrinted;
public bool? IsPrinted
{
get => isPrinted;
set { SetProperty(ref isPrinted, value); }
}
private string matBatch;
public string MatBatch
{
get => matBatch;
set { SetProperty(ref matBatch, value); }
}
/// <summary>
/// 物料编码
/// </summary>
@ -125,7 +165,6 @@ namespace 货架标准上位机.ViewModel
return;
}
#region
//var dia = Dialog.Show(new TextDialog());
try
{
var body = new GetMatInfoRequest()
@ -134,11 +173,13 @@ namespace 货架标准上位机.ViewModel
MatName = MatName,
MatSpec = MatSpec,
MatSN = MatSN,
MatBatch = MatBatch,
IsPrinted = IsPrinted,
UserName = LocalStatic.CurrentUser,
DeviceType = LocalFile.Config.DeviceType,
PageNumber = CurrentPage,
PageSize = 10,
PageSize = PageSize,
};
var Result = ApiHelp.GetDataFromHttp<PageQueryResponse<MatInfoModel>>(LocalFile.Config.ApiIpHost + "matBaseInfo/getMatInfo", body, "POST");
@ -166,7 +207,7 @@ namespace 货架标准上位机.ViewModel
public ICommand BtnDeleteCommand { get => new DelegateCommand(BtnDelete); }
public async void BtnDelete()
{
Growl.Ask($"是否删除所有勾选数据]!", isConfirmed =>
Growl.Ask($"是否删除所有勾选数据]!", isConfirmed =>
{
if (isConfirmed)
{
@ -187,7 +228,7 @@ namespace 货架标准上位机.ViewModel
DeviceType = LocalFile.Config.DeviceType,
MatBaseInfoIds = matBaseInfoIds,
};
var Result = ApiHelp.GetDataFromHttp<ResponseBase<UserModel>>(LocalFile.Config.ApiIpHost + "matBaseInfo/deleteMatBaseInfo", body, "POST");
var Result = ApiHelp.GetDataFromHttp<ResponseBase<UserModel>>(LocalFile.Config.ApiIpHost + "matBaseInfos/deleteMatBaseInfo", body, "POST");
if (Result != null && Result.Code == 200)
{
CurrentPage = 1;
@ -204,10 +245,99 @@ namespace 货架标准上位机.ViewModel
}
public ICommand BtnPrintCommand { get => new DelegateCommand(BtnPrint); }
public async void BtnPrint()
public void BtnPrint()
{
var matBaseInfo = DataGridItemSource?.Where(t => t.IsSelected == true).ToList();
//TO DO后台批量打印
var matBaseInfos = DataGridItemSource?.Where(t => t.IsSelected == true).ToList();
if (matBaseInfos == null || matBaseInfos.Count == 0)
{
Growl.Warning("请选择需要打印的物料!");
return;
}
//重复打印提示
#region
var printedMatBaseInfo = matBaseInfos.Where(t => t.IsPrinted).ToList();
if (printedMatBaseInfo != null && printedMatBaseInfo.Count > 0)
{
//拼接提示字符串
var messageStr = "以下条码已打印:\r\n" +
string.Join("\r\n", printedMatBaseInfo.Select(t => $"[{t.MatSN}]已打印{t.PrintedTimes}次!").ToList())
+ "\r\n\r\n是否继续打印(重复打印可能造成条码重复)";
var result = HandyControl.Controls.MessageBox.Show(messageStr, "重复打印提示", MessageBoxButton.OKCancel);
if (result == MessageBoxResult.Cancel)
{
return;
}
}
#endregion
//批量打印
Task.Run(() =>
{
try
{
ProcessDialog process = null;
Dialog dia = null;
var totalCount = matBaseInfos.Count();
int currentCount = 0;
App.Current.Dispatcher.Invoke(() =>
{
process = new ProcessDialog();
dia = Dialog.Show(process);
});
matBaseInfos.ForEach(t =>
{
PrintTender.PrintTag(new PrintClass()
{
MatSn = t.MatSN,
MatName = t.MatName,
MatCode = t.MatCode,
MatBatch = t.MatBatch,
MatQty = t.MatQty.ToString(),
MatSpec = t.MatSpec,
});
currentCount++;
if (process != null)
process.viewModel.ProcessValue = Convert.ToInt32(((decimal)currentCount / totalCount) * 100);
});
App.Current.Dispatcher.Invoke(() =>
{
dia.Close();
dia.Collapse();
});
#region
try
{
var body = new PrintedMatInfoRequest()
{
PrintedMatInfoIds = matBaseInfos.Select(t => t.Id).ToList(),
UserName = LocalStatic.CurrentUser,
DeviceType = LocalFile.Config.DeviceType,
};
var Result = ApiHelp.GetDataFromHttp<ResponseCommon>(LocalFile.Config.ApiIpHost + "matBaseInfo/printedMatInfo", body, "POST");
if (Result != null && Result.Code == 200)
{
//回传成功
}
else
{
//回传失败
}
}
catch (Exception ex)
{
Logs.Write("回传“打印成功”失败:" + ex.Message);
}
#endregion
}
catch (Exception ex)
{
Logs.Write("打印条码失败:" + ex.Message);
}
});
}
#endregion
@ -238,6 +368,14 @@ namespace 货架标准上位机.ViewModel
set { SetProperty(ref totalCount, value); }
}
private int pageSize = 10;
public int PageSize
{
get => pageSize;
set { SetProperty(ref pageSize, value); }
}
public ICommand BtnFirstPageCommand { get => new DelegateCommand(BtnFirstPage); }
public void BtnFirstPage()
{

View File

@ -220,7 +220,7 @@ namespace 货架标准上位机.ViewModel
UserName = LocalStatic.CurrentUser,
DeviceType = LocalFile.Config.DeviceType,
PageNumber = CurrentPage,
PageSize = 10,
PageSize = PageSize,
};
var Result = ApiHelp.GetDataFromHttp<PageQueryResponse<MatInventoryDetailModel>>(LocalFile.Config.ApiIpHost + "matInventoryDetail/getMatInventoryDetail", body, "POST");
if (Result != null && Result.Data != null && Result.Data.Lists != null)
@ -270,7 +270,7 @@ namespace 货架标准上位机.ViewModel
UserName = LocalStatic.CurrentUser,
DeviceType = LocalFile.Config.DeviceType,
PageNumber = CurrentPage,
PageSize = 10,
PageSize = 65535,
};
await ApiHelp.PostDownloadFileAsync(path, System.Net.Http.HttpMethod.Post, LocalFile.Config.ApiIpHost + "matInventoryDetail/exportMatInventoryDetail", body);
Growl.Success("导出成功!");
@ -301,7 +301,7 @@ namespace 货架标准上位机.ViewModel
UserName = LocalStatic.CurrentUser,
DeviceType = LocalFile.Config.DeviceType,
PageNumber = 1,
PageSize = 10000,
PageSize = 65535,
};
var Result = ApiHelp.GetDataFromHttp<PageQueryResponse<MatInventoryDetailModel>>(LocalFile.Config.ApiIpHost + "matInventoryDetail/getMatInventoryDetail", body, "POST");
if (Result != null && Result.Data != null && Result.Data.Lists != null)
@ -399,7 +399,7 @@ namespace 货架标准上位机.ViewModel
UserName = LocalStatic.CurrentUser,
DeviceType = LocalFile.Config.DeviceType,
PageNumber = CurrentPage,
PageSize = 10000,
PageSize = 65535,
};
var Result = ApiHelp.GetDataFromHttp<PageQueryResponse<MatInventoryDetailModel>>(LocalFile.Config.ApiIpHost + "matInventoryDetail/getMatInventoryDetail", body, "POST");
if (Result != null && Result.Data != null && Result.Data.Lists != null)
@ -506,6 +506,14 @@ namespace 货架标准上位机.ViewModel
set { SetProperty(ref totalCount, value); }
}
private int pageSize = 10;
public int PageSize
{
get => pageSize;
set { SetProperty(ref pageSize, value); }
}
public ICommand BtnFirstPageCommand { get => new DelegateCommand(BtnFirstPage); }
public void BtnFirstPage()
{

View File

@ -0,0 +1,228 @@
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;
namespace .ViewModel
{
public class ModuleInfoViewModel : BindableBase
{
public ModuleInfoViewModel()
{
}
#region Property
private List<ModuleInfoModel> dataGridItemSource;
public List<ModuleInfoModel> DataGridItemSource
{
get { return dataGridItemSource; }
set
{
SetProperty(ref dataGridItemSource, value);
}
}
private ModuleInfoModel selectedataGridItem;
public ModuleInfoModel SelectedataGridItem
{
get { return selectedataGridItem; }
set
{
SetProperty(ref selectedataGridItem, value);
}
}
private string shelfCode;
public string ShelfCode
{
get { return shelfCode; }
set
{
SetProperty(ref shelfCode, value);
}
}
private string moduleCode;
public string ModuleCode
{
get => moduleCode;
set { SetProperty(ref moduleCode, value); }
}
#endregion
#region Command
public ICommand BtnResetCommand { get => new DelegateCommand(BtnReset); }
public void BtnReset()
{
ModuleCode = string.Empty;
ShelfCode = 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 GetShelvesRequest()
{
ShelfCode = ShelfCode,
UserName = LocalStatic.CurrentUser,
DeviceType = LocalFile.Config.DeviceType,
PageNumber = CurrentPage,
PageSize = PageSize,
};
var Result = ApiHelp.GetDataFromHttp<PageQueryResponse<ModuleInfoModel>>(LocalFile.Config.ApiIpHost + "storeInfo/getModules", 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
}
public ICommand BtnDeleteCommand { get => new DelegateCommand(BtnDelete); }
public void BtnDelete()
{
//查询勾选的第一个数据
var shelfInfo = DataGridItemSource?.Where(t => t.IsSelected == true).FirstOrDefault();
if (shelfInfo == null)
{
Growl.Warning("请选择需要删除的数据!");
}
else
{
var body = new AddShelfInfoRequest<ShelfInfoModel>()
{
UserName = LocalStatic.CurrentUser,
DeviceType = LocalFile.Config.DeviceType,
//ShelfInfo = shelfInfo,
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); }
}
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

@ -100,7 +100,7 @@ namespace 货架标准上位机.ViewModels
UserName = LocalStatic.CurrentUser,
DeviceType = LocalFile.Config.DeviceType,
PageNumber = CurrentPage,
PageSize = 10,
PageSize = PageSize,
};
var Result = ApiHelp.GetDataFromHttp<PageQueryResponse<OutOrderModel>>(LocalFile.Config.ApiIpHost + "outStore/GetOutOrderList", body, "POST");
if (Result != null && Result.Data != null && Result.Data.Lists != null)
@ -412,6 +412,14 @@ namespace 货架标准上位机.ViewModels
set { SetProperty(ref totalCount, value); }
}
private int pageSize = 10;
public int PageSize
{
get => pageSize;
set { SetProperty(ref pageSize, value); }
}
public ICommand BtnFirstPageCommand { get => new DelegateCommand(BtnFirstPage); }
public void BtnFirstPage()
{
@ -445,5 +453,6 @@ namespace 货架标准上位机.ViewModels
}
}
#endregion
}
}

View File

@ -278,6 +278,7 @@ namespace 货架标准上位机.ViewModel
if (Result.Data.Count > 0)
{
DataGridItemSource = new ObservableCollection<OutOrderMatDetailModel>(Result.Data);
OrderStatus = Result.Message;
}
else
{
@ -285,7 +286,6 @@ namespace 货架标准上位机.ViewModel
{
DataGridItemSource?.Clear();
});
Growl.Warning("该单据未查询到发料明细!");
}
}

View File

@ -135,7 +135,7 @@ namespace 货架标准上位机.ViewModel
UserName = LocalStatic.CurrentUser,
DeviceType = LocalFile.Config.DeviceType,
PageNumber = CurrentPage,
PageSize = 10,
PageSize = PageSize,
};
var Result = ApiHelp.GetDataFromHttp<PageQueryResponse<ShelfInfoModel>>(LocalFile.Config.ApiIpHost + "storeInfo/getShelves", body, "POST");
if (Result != null && Result.Data != null && Result.Data.Lists != null)
@ -250,6 +250,14 @@ namespace 货架标准上位机.ViewModel
set { SetProperty(ref totalCount, value); }
}
private int pageSize = 10;
public int PageSize
{
get => pageSize;
set { SetProperty(ref pageSize, value); }
}
public ICommand BtnFirstPageCommand { get => new DelegateCommand(BtnFirstPage); }
public void BtnFirstPage()
{

View File

@ -101,7 +101,7 @@ namespace 货架标准上位机.ViewModels
UserName = LocalStatic.CurrentUser,
DeviceType = LocalFile.Config.DeviceType,
PageNumber = CurrentPage,
PageSize = 10,
PageSize = PageSize,
};
var Result = ApiHelp.GetDataFromHttp<PageQueryResponse<StockTakingOrderModel>>(LocalFile.Config.ApiIpHost + "stockTaking/getStockTakingOrders", body, "POST");
if (Result != null && Result.Data != null && Result.Data.Lists != null)
@ -398,6 +398,7 @@ namespace 货架标准上位机.ViewModels
{
Growl.Warning("单据已提交,库存数据已修改!");
BtnSearch();
StockTakingView.viewModel.RefreshStockTakingOrderList(StockTakingView.viewModel.SelectedOutOrderNumber);
}
else if (Result != null)
{
@ -419,6 +420,7 @@ namespace 货架标准上位机.ViewModels
}
#endregion
#region PageOperation
private int currentPage;
public int CurrentPage
@ -446,6 +448,14 @@ namespace 货架标准上位机.ViewModels
set { SetProperty(ref totalCount, value); }
}
private int pageSize = 10;
public int PageSize
{
get => pageSize;
set { SetProperty(ref pageSize, value); }
}
public ICommand BtnFirstPageCommand { get => new DelegateCommand(BtnFirstPage); }
public void BtnFirstPage()
{

View File

@ -232,6 +232,10 @@ namespace 货架标准上位机.ViewModel
{
SelectedOutOrder = OutOrderList.Where(t => t.StocktakingOrderNumber == OrderNumber).FirstOrDefault();
}
else
{
SelectedOutOrder = OutOrderList.FirstOrDefault(); ;
}
}
else if (Result != null && !string.IsNullOrEmpty(Result.Message))
{

View File

@ -0,0 +1,214 @@
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;
namespace .ViewModel
{
public class StoreInfoViewModel : BindableBase
{
public StoreInfoViewModel()
{
}
#region Property
private List<StoreInfoModel> dataGridItemSource;
public List<StoreInfoModel> DataGridItemSource
{
get { return dataGridItemSource; }
set
{
SetProperty(ref dataGridItemSource, value);
}
}
private StoreInfoModel selectedataGridItem;
public StoreInfoModel SelectedataGridItem
{
get { return selectedataGridItem; }
set
{
SetProperty(ref selectedataGridItem, value);
}
}
private string shelfCode;
public string ShelfCode
{
get { return shelfCode; }
set
{
SetProperty(ref shelfCode, value);
}
}
private string moduleCode;
public string ModuleCode
{
get => moduleCode;
set { SetProperty(ref moduleCode, value); }
}
private string storeCode;
public string StoreCode
{
get => storeCode;
set { SetProperty(ref storeCode, value); }
}
private string currentMatSN;
public string CurrentMatSN
{
get => currentMatSN;
set { SetProperty(ref currentMatSN, value); }
}
#endregion
#region Command
public ICommand BtnResetCommand { get => new DelegateCommand(BtnReset); }
public void BtnReset()
{
ShelfCode = string.Empty;
ModuleCode = string.Empty;
StoreCode = string.Empty;
CurrentMatSN = 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 GetStoresRequest()
{
ShelfCode = ShelfCode,
ModuleCode = ModuleCode,
StoreCode = StoreCode,
CurrentMatSN = CurrentMatSN,
UserName = LocalStatic.CurrentUser,
DeviceType = LocalFile.Config.DeviceType,
PageNumber = CurrentPage,
PageSize = PageSize,
};
var Result = ApiHelp.GetDataFromHttp<PageQueryResponse<StoreInfoModel>>(LocalFile.Config.ApiIpHost + "storeInfo/getStores", 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
}
#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); }
}
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
}
}