提交代码

This commit is contained in:
hehaibing-1996
2024-04-23 08:31:37 +08:00
parent d40c3f253a
commit aaf7c17562
43 changed files with 2196 additions and 71 deletions

View File

@ -48,7 +48,7 @@ namespace 货架标准上位机.ViewModel
public WrapPanel wrapPanel;
public async void AddUserControl()
{
var dia = Dialog.Show(new TextDialog());
//var dia = Dialog.Show(new TextDialog());
try
{
var body = new GetShelfStatusRequest()
@ -75,9 +75,9 @@ namespace 货架标准上位机.ViewModel
}
finally
{
dia.Close();
//dia.Close();
}
}
}
#endregion
#region

View File

@ -185,15 +185,16 @@ namespace 货架标准上位机.ViewModel
{
var body = new QueryByMatSnRequest()
{
MatSn = scanner.TempCode,
ShelfCode = scanner.ShelfCode,
IpAddress = scanner.COM,
DeviceType = LocalFile.Config.DeviceType,
UserName = LocalStatic.CurrentUser,
};
var Result = ApiHelp.GetDataFromHttp<QueryByMatSnResponse>(LocalFile.Config.ApiIpHost + "instore/queryByMatSn", body, "POST");
var Result = ApiHelp.GetDataFromHttp<ResponseCommon<MatInfoModel>>(LocalFile.Config.ApiIpHost + "instore/queryByMatSn", body, "POST");
if (Result != null && Result.Code == 200)
{
scanner.MatSn = Result.Data.materialBar;
scanner.MatSn = Result.Data.MatSN;
}
}
catch (Exception ex)

View File

@ -0,0 +1,278 @@
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 System.Windows.Media;
using SqlSugar;
using HandyControl.Data;
using System.Windows;
using Newtonsoft.Json.Linq;
using .Views.Controls;
using WCS.Model.ApiModel.User;
using .Api;
using WCS.Model;
using WCS.Model.ApiModel;
using System.Windows.Controls;
using WCS.Model.ApiModel.InterfaceRecord;
using WCS.BLL.DbModels;
using WCS.Model.ApiModel.MatBaseInfo;
using System.Collections.ObjectModel;
using HandyControl.Tools.Extension;
using .Tool;
namespace .ViewModel
{
public class MatInfoViewModel : BindableBase
{
#region Property
private ObservableCollection<MatInfoModel> dataGridItemSource;
public ObservableCollection<MatInfoModel> DataGridItemSource
{
get { return dataGridItemSource; }
set
{
SetProperty(ref dataGridItemSource, value);
}
}
public MatInfoModel selectedataGridItem;
public MatInfoModel SelectedataGridItem
{
get { return selectedataGridItem; }
set
{
SetProperty(ref selectedataGridItem, value);
}
}
/// <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);
}
}
/// <summary>
/// 物料规格
/// </summary>
private string matSpec;
public string MatSpec
{
get { return matSpec; }
set
{
SetProperty(ref matSpec, value);
}
}
private string matSN;
public string MatSN
{
get { return matSN; }
set
{
SetProperty(ref matSN, value);
}
}
#endregion
#region Command
public ICommand BtnResetCommand { get => new DelegateCommand(BtnReset); }
public void BtnReset()
{
MatCode = string.Empty;
MatName = string.Empty;
MatSpec = string.Empty;
MatSN = 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 GetMatInfoRequest()
{
MatCode = MatCode,
MatName = MatName,
MatSpec = MatSpec,
MatSN = MatSN,
UserName = LocalStatic.CurrentUser,
DeviceType = LocalFile.Config.DeviceType,
PageNumber = CurrentPage,
PageSize = 10,
};
var Result = ApiHelp.GetDataFromHttp<PageQueryResponse<MatInfoModel>>(LocalFile.Config.ApiIpHost + "matBaseInfo/getMatInfo", body, "POST");
if (Result != null && Result.Data != null && Result.Data.Lists != null)
{
DataGridItemSource = new ObservableCollection<MatInfoModel>(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 BtnDeleteCommand { get => new DelegateCommand(BtnDelete); }
public async void BtnDelete()
{
Growl.Ask($"是否删除所有勾选得数据]!", isConfirmed =>
{
if (isConfirmed)
{
//查询勾选的第一个数据
var matBaseInfoIds = DataGridItemSource?.Where(t => t.IsSelected == true)
.Select(t => t.Id)
.ToList();
if (matBaseInfoIds == null)
{
Growl.Warning("请选择需要修改的数据!");
}
else
{
var body = new DeleteMatBaseInfosRequest()
{
UserName = LocalStatic.CurrentUser,
DeviceType = LocalFile.Config.DeviceType,
MatBaseInfoIds = matBaseInfoIds,
};
var Result = ApiHelp.GetDataFromHttp<ResponseBase<UserModel>>(LocalFile.Config.ApiIpHost + "matBaseInfo/deleteMatBaseInfo", body, "POST");
if (Result != null && Result.Code == 200)
{
CurrentPage = 1;
Growl.Success("删除成功!" + Result?.Message);
}
else
{
Growl.Error($"{Result?.Message?.ToString()}");
}
}
}
return true;
});
}
public ICommand BtnPrintCommand { get => new DelegateCommand(BtnPrint); }
public async void BtnPrint()
{
var matBaseInfo = DataGridItemSource?.Where(t => t.IsSelected == true).ToList();
//TO DO后台批量打印
}
#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); }
}
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

@ -0,0 +1,66 @@
using HandyControl.Controls;
using Ping9719.WpfEx.Mvvm;
using System;
using System.Collections.ObjectModel;
using System.Windows;
using System.Windows.Input;
using WCS.BLL.DbModels;
using WCS.Model.ApiModel.MatInventoryDetail;
namespace .ViewModels
{
public class OutInventoryAddDucumentViewModel : BindableBase
{
#region Property
private ObservableCollection<MatInventorySummaryModel> dataGridItemSource;
public ObservableCollection<MatInventorySummaryModel> DataGridItemSource
{
get { return dataGridItemSource; }
set
{
SetProperty(ref dataGridItemSource, value);
}
}
#endregion
#region Command
/// <summary>
/// 新增物料
/// </summary>
public ICommand BtnAddCommand { get => new DelegateCommand(BtnAdd); }
public void BtnAdd()
{
var window = new OutInventoryAddMatView();
window.Owner = Application.Current.MainWindow;
var result = window.ShowDialog();
if (result == true)
{
if (DataGridItemSource == null)
DataGridItemSource = new ObservableCollection<MatInventorySummaryModel>();
DataGridItemSource.Add(window.inventorySummary);
}
else
{
return;
}
}
public ICommand DelCommand { get => new DelegateCommand<MatInventorySummaryModel>(Del); }
public void Del(MatInventorySummaryModel obj)
{
try
{
DataGridItemSource.Remove(obj);
;
}
catch (Exception ex)
{
}
}
#endregion
}
}

View File

@ -0,0 +1,95 @@
using HandyControl.Controls;
using Ping9719.WpfEx.Mvvm;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
using WCS.BLL.DbModels;
using WCS.Model;
using WCS.Model.ApiModel.MatBaseInfo;
using WCS.Model.ApiModel.MatInventoryDetail;
using .Api;
namespace .ViewModels
{
public class OutInventoryAddMatViewModel : BindableBase
{
#region Property
private ObservableCollection<MatInventorySummaryModel> dataGridItemSource;
public ObservableCollection<MatInventorySummaryModel> DataGridItemSource
{
get { return dataGridItemSource; }
set
{
SetProperty(ref dataGridItemSource, value);
}
}
private MatInventorySummaryModel selectedataGridItem;
public MatInventorySummaryModel SelectedataGridItem
{
get { return selectedataGridItem; }
set
{
SetProperty(ref selectedataGridItem, 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);
}
}
#endregion
#region Command
/// <summary>
/// 搜索
/// </summary>
public ICommand BtnSearchCommand { get => new DelegateCommand(BtnSearch); }
public void BtnSearch()
{
#region
try
{
var body = new GetMatInventorySummaryRequest()
{
MatName = MatName,
MatCode = MatCode,
};
var Result = ApiHelp.GetDataFromHttp<ResponseCommon<List<MatInventorySummaryModel>>>(LocalFile.Config.ApiIpHost + "matInventoryDetail/getMatInventorySummary", body, "POST");
if (Result != null && Result.Data != null)
{
DataGridItemSource = new ObservableCollection<MatInventorySummaryModel>(Result.Data);
}
}
catch (Exception ex)
{
Growl.Error("加载数据失败:" + ex.Message);
}
finally
{
}
#endregion
}
#endregion
}
}

View File

@ -0,0 +1,379 @@
using HandyControl.Controls;
using HandyControl.Data;
using MiniExcelLibs;
using Ping9719.WpfEx.Mvvm;
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using TouchSocket.Core;
using .ViewModel;
namespace .ViewModel
{
public class OutInventoryViewModel : BindableBase
{
public OutInventoryViewModel()
{
//线程 更新当前选择的订单的状态
//Task.Run(() =>
//{
// while (true)
// {
// try
// {
// Thread.Sleep(1000);
// //if (LocalStatic.IsRefreshOrderDetail)
// //{
// // LocalStatic.IsRefreshOrderDetail = false;
// // SelectedPickBillNumberChanged();
// //}
// }
// catch
// {
// //Logs.Write("更新订单状态异常!!");
// }
// }
//});
}
public System.Windows.Controls.TextBox textBox { get; set; }
#region Property
private string number;
public string Number
{
get { return number; }
set
{
SetProperty(ref number, value);
}
}
private bool isOrderOut;
public bool IsOrderOut
{
get { return isOrderOut; }
set
{
SetProperty(ref isOrderOut, value);
//LocalStatic.IsOrderOut = value;
}
}
private string matCode1;
public string MatCode1
{
get { return matCode1; }
set
{
SetProperty(ref matCode1, value);
}
}
private int matQty1;
public int MatQty1
{
get { return matQty1; }
set
{
SetProperty(ref matQty1, value);
}
}
private string order_prod_number;
public string Order_prod_number
{
get { return order_prod_number; }
set
{
SetProperty(ref order_prod_number, value);
}
}
private string material_code;
public string Material_code
{
get { return material_code; }
set
{
SetProperty(ref material_code, value);
}
}
private string material_name;
public string Material_name
{
get { return material_name; }
set
{
SetProperty(ref material_name, value);
}
}
private string material_spec;
public string Material_spec
{
get { return material_spec; }
set
{
SetProperty(ref material_spec, 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 matCode3;
public string MatCode3
{
get { return matCode3; }
set
{
SetProperty(ref matCode3, value);
}
}
private string matName3;
public string MatName3
{
get { return matName3; }
set
{
SetProperty(ref matName3, value);
}
}
private string matSpec3;
public string MatSpec3
{
get { return matSpec3; }
set
{
SetProperty(ref matSpec3, value);
}
}
private string matBatch3;
public string MatBatch3
{
get { return matBatch3; }
set
{
SetProperty(ref matBatch3, value);
}
}
private string selectedPickBillNumber;
public string SelectedPickBillNumber
{
get { return selectedPickBillNumber; }
set
{
SetProperty(ref selectedPickBillNumber, value);
}
}
private string orderProdNumber;
public string OrderProdNumber
{
get { return orderProdNumber; }
set
{
SetProperty(ref orderProdNumber, value);
}
}
private string orderStatus;
public string OrderStatus
{
get { return orderStatus; }
set
{
SetProperty(ref orderStatus, value);
}
}
private List<object> dataGridItemSource;
public List<object> DataGridItemSource
{
get { return dataGridItemSource; }
set
{
SetProperty(ref dataGridItemSource, value);
RefreshCount();
}
}
//领料单号列表
private List<string> pickBillNumberList;
public List<string> PickBillNumberList
{
get { return pickBillNumberList; }
set
{
SetProperty(ref pickBillNumberList, value);
}
}
public void RefreshCount()
{
Task.Run(() =>
{
TotalPan = dataGridItemSource.Count();
//SendedPan = dataGridItemSource.Where(t => t.IsSend == true).Count();
//UnSendedPan = dataGridItemSource.Where(t => t.IsSend == false).Count();
});
}
#endregion
#region Command
//public ICommand BtnSearchCommand { get => new DelegateCommand(BtnSearch); }
//public void BtnSearch()
//{
// if (string.IsNullOrEmpty(MatCode1))
// {
// Growl.Warning("请输入料号进行筛选!");
// return;
// }
// else if (MatQty1 == 0)
// {
// Growl.Warning("请输入需要的数量!");
// return;
// }
// var inventoryDetails = DbHelp.db.Queryable<InventoryDetail>();
// if (!string.IsNullOrEmpty(MatCode1))
// {
// inventoryDetails = inventoryDetails
// .Where(t => t.MatCode.Contains(MatCode1))
// .Includes(t => t.StoreInfo)
// .OrderBy(t => t.MatQty);
// }
// else
// {
// }
// var inventorys = inventoryDetails.ToList();
// int totalMatQty = 0;
// //List<InventoryDetail> dataSourceTemp = new List<InventoryDetail>();
// foreach (var item in inventorys)
// {
// if (totalMatQty < MatQty1)
// {
// totalMatQty += item.MatQty;
// item.IsSelected = true;
// }
// else
// {
// break;
// }
// }
// DataGridItemSource = inventorys;
//}
public ICommand BtnOutOrderCommand { get => new DelegateCommand(BtnOutOrder); }
public void BtnOutOrder()
{
var window = new OutInventoryAddDucumentView();
window.Owner = Application.Current.MainWindow;
window.ShowDialog();
}
//public ICommand BtnTempOutCommand { get => new DelegateCommand(BtnTempOut); }
//public void BtnTempOut()
//{
// var window = new OutInventoryDocumentDetailView();
// window.ShowDialog();
// if (window.DialogResult == true)
// {
// DataGridItemSource = window.DataGridItemSource;
// }
//}
public ICommand BtnReset3Command { get => new DelegateCommand(BtnReset3); }
public void BtnReset3()
{
MatCode3 = string.Empty;
MatName3 = string.Empty;
MatSpec3 = string.Empty;
MatBatch3 = string.Empty;
}
public ICommand BtnStartCommand { get => new DelegateCommand(BtnStart); }
public void BtnStart()
{
return;
}
public ICommand BtnPauseCommand { get => new DelegateCommand(BtnPause); }
public void BtnPause()
{
}
#endregion
#region PageOperation
private int totalPan;
public int TotalPan
{
get { return totalPan; }
set { SetProperty(ref totalPan, value); }
}
private int sendedPan;
public int SendedPan
{
get { return sendedPan; }
set { SetProperty(ref sendedPan, value); }
}
private int unSendedPan;
public int UnSendedPan
{
get { return unSendedPan; }
set { SetProperty(ref unSendedPan, value); }
}
#endregion
#region private method
public bool GrowlCallBack(bool aaa)
{
return true;
}
#endregion
}
}