1.出库单据、生成出库单据、计算物料时增加货架类型用于区分信息化货架和智能货架的物料 实现分开出
This commit is contained in:
@ -282,11 +282,11 @@ namespace 货架标准上位机.Api
|
||||
public static T GetDataFromHttp<T>(string url, object dataObj, string httpMethod, bool isSaveLog = false)
|
||||
{
|
||||
Guid guid = Guid.NewGuid();
|
||||
var data = JsonConvert.SerializeObject(dataObj);
|
||||
var data = dataObj == null ? string.Empty : JsonConvert.SerializeObject(dataObj);
|
||||
try
|
||||
{
|
||||
if (isSaveLog)
|
||||
Logs.Write($"【{guid}】开始请求调用接口 url:{url} 请求方式:{httpMethod} 数据:{data}",LogsType.Api);
|
||||
Logs.Write($"【{guid}】开始请求调用接口 url:{url} 请求方式:{httpMethod} 数据:{data}", LogsType.Api);
|
||||
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
|
||||
request.Method = httpMethod;
|
||||
request.ContentType = "application/json";
|
||||
|
BIN
货架标准上位机/Excel/出库导入模板.xlsx
Normal file
BIN
货架标准上位机/Excel/出库导入模板.xlsx
Normal file
Binary file not shown.
Binary file not shown.
@ -19,6 +19,10 @@ namespace 货架标准上位机
|
||||
/// 货架服务器的Ip和端口号
|
||||
/// </summary>
|
||||
public string ApiIpHost { get; set; }
|
||||
/// <summary>
|
||||
/// WebSocket服务器的地址
|
||||
/// </summary>
|
||||
public string WebSocketUrl { get; set; }
|
||||
|
||||
public List<string> GroupName { get; set; }
|
||||
|
||||
|
@ -276,7 +276,7 @@ namespace 货架标准上位机.ViewModel
|
||||
var Result = ApiHelp.GetDataFromHttp<ResponseCommon<MatInfoModel>>(LocalFile.Config.ApiIpHost + "instore/queryInstoreStatus", body, "POST");
|
||||
if (Result != null && !string.IsNullOrEmpty(Result.Message))
|
||||
{
|
||||
TextBoxLog.AddLog(Result.Message, "InstoreLog", DateTime.Now);
|
||||
TextBoxLog.AddLog($"物料[{scanner.MatSn}]" + Result.Message, "InstoreLog", DateTime.Now);
|
||||
scanner.MatSn = string.Empty;
|
||||
scanner.ScannerDisplayControl.RefreshValues(scanner.ShelfCode, scanner.MatSn);
|
||||
}
|
||||
|
@ -227,18 +227,6 @@ namespace 货架标准上位机.ViewModel
|
||||
//已经选择文件 调用接口进行导入数据
|
||||
string path = ofd.FileName;
|
||||
|
||||
var body = new GetMatBaseInfoRequest()
|
||||
{
|
||||
MatCode = MatCode,
|
||||
MatName = MatName,
|
||||
MatSpec = MatSpec,
|
||||
IsEnable = IsEnable,
|
||||
|
||||
UserName = LocalStatic.CurrentUser,
|
||||
DeviceType = LocalFile.Config.DeviceType,
|
||||
PageNumber = CurrentPage,
|
||||
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);
|
||||
if (result.Code == 200)
|
||||
|
@ -33,14 +33,7 @@ namespace 货架标准上位机.ViewModel
|
||||
{
|
||||
public MatInventoryDetailViewModel()
|
||||
{
|
||||
//获取物料编码列表
|
||||
//matCodes = DbHelp.db.Queryable<InventoryDetail>()
|
||||
// .Select(t => new DataModel()
|
||||
// {
|
||||
// MatCode = t.MatCode
|
||||
// })
|
||||
// .Distinct()
|
||||
// .ToList();
|
||||
|
||||
}
|
||||
|
||||
public void InitMatCode()
|
||||
|
@ -4,10 +4,12 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using WCS.BLL.DbModels;
|
||||
using WCS.Model;
|
||||
using WCS.Model.ApiModel.Home;
|
||||
using WCS.Model.ApiModel.MatInventoryDetail;
|
||||
using 货架标准上位机.Api;
|
||||
|
||||
@ -35,6 +37,71 @@ namespace 货架标准上位机.ViewModels
|
||||
SetProperty(ref selectedItemSource, value);
|
||||
}
|
||||
}
|
||||
|
||||
private List<ShelfTypeModel> shelfTypeItems;
|
||||
public List<ShelfTypeModel> ShelfTypeItems
|
||||
{
|
||||
get { return shelfTypeItems; }
|
||||
set
|
||||
{
|
||||
SetProperty(ref shelfTypeItems, value);
|
||||
}
|
||||
}
|
||||
public void InitShelfTypeItems()
|
||||
{
|
||||
//调用接口更新!
|
||||
Task.Run(() =>
|
||||
{
|
||||
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 = Result.Data.Lists;
|
||||
SelectedShelfTypeItem = Result.Data.Lists.First();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private ShelfTypeModel selectedShelfTypeItem;
|
||||
public ShelfTypeModel SelectedShelfTypeItem
|
||||
{
|
||||
get { return selectedShelfTypeItem; }
|
||||
set
|
||||
{
|
||||
SetProperty(ref selectedShelfTypeItem, value);
|
||||
}
|
||||
}
|
||||
|
||||
private int selectedTypeCount = 0;
|
||||
public int SelectedTypeCount
|
||||
{
|
||||
get => selectedTypeCount;
|
||||
set
|
||||
{
|
||||
SetProperty(ref selectedTypeCount, value);
|
||||
if (selectedTypeCount == 0)
|
||||
{
|
||||
ShelfTypeIsEnabled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
ShelfTypeIsEnabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool shelfTypeIsEnabled = true;
|
||||
public bool ShelfTypeIsEnabled
|
||||
{
|
||||
get => shelfTypeIsEnabled; set { SetProperty(ref shelfTypeIsEnabled, value); }
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Command
|
||||
@ -44,7 +111,11 @@ namespace 货架标准上位机.ViewModels
|
||||
public ICommand BtnAddCommand { get => new DelegateCommand(BtnAdd); }
|
||||
public void BtnAdd()
|
||||
{
|
||||
var window = new OutInventoryAddMatView();
|
||||
if (SelectedShelfTypeItem == null)
|
||||
{
|
||||
HandyControl.Controls.MessageBox.Show("请选择货架类型!");
|
||||
}
|
||||
var window = new OutInventoryAddMatView(SelectedShelfTypeItem.Id);
|
||||
window.Owner = Application.Current.MainWindow;
|
||||
var result = window.ShowDialog();
|
||||
if (result == true)
|
||||
@ -52,6 +123,7 @@ namespace 货架标准上位机.ViewModels
|
||||
if (DataGridItemSource == null)
|
||||
DataGridItemSource = new ObservableCollection<MatInventorySummaryModel>();
|
||||
DataGridItemSource.Add(window.inventorySummary);
|
||||
SelectedTypeCount = DataGridItemSource.Count;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -66,11 +138,12 @@ namespace 货架标准上位机.ViewModels
|
||||
{
|
||||
|
||||
DataGridItemSource.Remove(obj);
|
||||
;
|
||||
SelectedTypeCount = DataGridItemSource.Count;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
Growl.Info(ex.Message);
|
||||
Logs.Write($"删除物料时发生异常", LogsType.Err);
|
||||
}
|
||||
}
|
||||
|
||||
@ -117,6 +190,8 @@ namespace 货架标准上位机.ViewModels
|
||||
{
|
||||
OrderType = "出库",
|
||||
OrderSource = "WCS前端",
|
||||
ShelfTypeId = SelectedShelfTypeItem.Id,
|
||||
ShelfTypeName = SelectedShelfTypeItem.ShelfTypeName,
|
||||
ItemList = DataGridItemSource.Select(t => new MatCodeItemList()
|
||||
{
|
||||
MatCode = t.MatCode,
|
||||
|
@ -58,6 +58,14 @@ namespace 货架标准上位机.ViewModels
|
||||
SetProperty(ref matName, value);
|
||||
}
|
||||
}
|
||||
|
||||
private int shelfTypeId;
|
||||
public int ShelfTypeId
|
||||
{
|
||||
get => shelfTypeId;
|
||||
set { SetProperty(ref shelfTypeId, value); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Command
|
||||
@ -74,6 +82,7 @@ namespace 货架标准上位机.ViewModels
|
||||
{
|
||||
MatName = MatName,
|
||||
MatCode = MatCode,
|
||||
ShelfTypeId = ShelfTypeId,
|
||||
};
|
||||
var Result = ApiHelp.GetDataFromHttp<ResponseCommon<List<MatInventorySummaryModel>>>(LocalFile.Config.ApiIpHost + "matInventoryDetail/getMatInventorySummary", body, "POST");
|
||||
if (Result != null && Result.Data != null)
|
||||
|
@ -144,6 +144,17 @@ namespace 货架标准上位机.ViewModels
|
||||
BtnSearch(true);
|
||||
}
|
||||
|
||||
//导入出库
|
||||
public ICommand BtnImportDocumentCommand { get => new DelegateCommand(BtnImportDocument); }
|
||||
public void BtnImportDocument()
|
||||
{
|
||||
var window = new OutInventoryImportDucumentView();
|
||||
window.Owner = Application.Current.MainWindow;
|
||||
var result = window.ShowDialog();
|
||||
if (result == true)
|
||||
BtnSearch(true);
|
||||
}
|
||||
|
||||
public ICommand BtnOrderDetailCommand { get => new DelegateCommand(BtnOrderDetail); }
|
||||
public void BtnOrderDetail()
|
||||
{
|
||||
|
212
货架标准上位机/ViewModels/OutInventoryImportDucumentViewModel.cs
Normal file
212
货架标准上位机/ViewModels/OutInventoryImportDucumentViewModel.cs
Normal file
@ -0,0 +1,212 @@
|
||||
using HandyControl.Controls;
|
||||
using Ping9719.WpfEx.Mvvm;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows;
|
||||
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 OutInventoryImportDucumentViewModel : BindableBase
|
||||
{
|
||||
#region Property
|
||||
private ObservableCollection<MatInventorySummaryModel> dataGridItemSource;
|
||||
public ObservableCollection<MatInventorySummaryModel> DataGridItemSource
|
||||
{
|
||||
get { return dataGridItemSource; }
|
||||
set
|
||||
{
|
||||
SetProperty(ref dataGridItemSource, value);
|
||||
}
|
||||
}
|
||||
|
||||
private MatInventorySummaryModel selectedItemSource;
|
||||
public MatInventorySummaryModel SelectedItemSource
|
||||
{
|
||||
get { return selectedItemSource; }
|
||||
set
|
||||
{
|
||||
SetProperty(ref selectedItemSource, value);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Command
|
||||
public ICommand BtnDownloadExcelCommand { get => new DelegateCommand(BtnDownloadExcel); }
|
||||
public async void BtnDownloadExcel()
|
||||
{
|
||||
try
|
||||
{
|
||||
#region 选择文件保存路径
|
||||
Microsoft.Win32.SaveFileDialog sfd = new Microsoft.Win32.SaveFileDialog();
|
||||
sfd.Filter = ".xlsx文件(*.xlsx)|*.xlsx";
|
||||
sfd.FileName = "出库导入模板";
|
||||
sfd.Title = "请选择文件保存地址";
|
||||
sfd.OverwritePrompt = true;
|
||||
if (sfd.ShowDialog() != true)
|
||||
{
|
||||
return;
|
||||
}
|
||||
string path = sfd.FileName;
|
||||
#endregion
|
||||
|
||||
#region 从本地下载复制模板
|
||||
string sourceFile = System.Environment.CurrentDirectory + "\\Excel\\出库单据导入模板.xlsx"; // 源文件路径
|
||||
string destinationFile = path; // 目标文件路径
|
||||
try
|
||||
{
|
||||
File.Copy(sourceFile, destinationFile, true); // true表示如果目标文件存在,则覆盖它
|
||||
Growl.Success("文件下载成功!");
|
||||
}
|
||||
catch (IOException ioEx)
|
||||
{
|
||||
Growl.Success("文件下载失败: " + ioEx.Message);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Growl.Success("文件下载失败: " + ex.Message);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Growl.Error("导出失败:" + ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
public ICommand BtnImportCommand { get => new DelegateCommand(BtnImport); }
|
||||
public async void BtnImport()
|
||||
{
|
||||
try
|
||||
{
|
||||
#region 选择需要导入文件的路径
|
||||
Microsoft.Win32.OpenFileDialog ofd = new Microsoft.Win32.OpenFileDialog();
|
||||
ofd.Title = "选择模板";
|
||||
ofd.Filter = ".xlsx文件(*.xlsx)|*.xlsx";
|
||||
ofd.Multiselect = false;
|
||||
|
||||
if (ofd.ShowDialog() != true)
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endregion
|
||||
//已经选择文件 调用接口进行导入数据
|
||||
string path = ofd.FileName;
|
||||
#region 接口导入 返回所输入物料的状态信息 校验输入的值
|
||||
var result = await ApiHelp.PostImportFileAsync<ResponseCommon<List<MatInventorySummaryModel>>>(path, System.Net.Http.HttpMethod.Post,
|
||||
LocalFile.Config.ApiIpHost + "outstore/importMat", LocalStatic.CurrentUser, LocalFile.Config.DeviceType);
|
||||
if (result.Code == 200)
|
||||
{
|
||||
DataGridItemSource = new ObservableCollection<MatInventorySummaryModel>(result.Data);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (result != null && !string.IsNullOrEmpty(result.Message))
|
||||
HandyControl.Controls.MessageBox.Show(result.Message);
|
||||
else
|
||||
{
|
||||
HandyControl.Controls.MessageBox.Show("导入失败,请重试!");
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Growl.Warning("导入失败:" + ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
public ICommand DelCommand { get => new DelegateCommand<MatInventorySummaryModel>(Del); }
|
||||
public void Del(MatInventorySummaryModel obj)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
DataGridItemSource.Remove(obj);
|
||||
;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// 定义一个事件,当需要关闭窗口时触发
|
||||
public event Action TrueClose;
|
||||
public event Action FalseClose;
|
||||
// 一个方法,当满足某些条件时调用,以触发关闭窗口
|
||||
protected virtual void OnRequestClose(bool IsTrue)
|
||||
{
|
||||
if (IsTrue)
|
||||
TrueClose?.Invoke();
|
||||
else
|
||||
FalseClose?.Invoke();
|
||||
}
|
||||
public ICommand GenerateOutOrderCommand { get => new DelegateCommand(GenerateOutOrder); }
|
||||
public void GenerateOutOrder()
|
||||
{
|
||||
//数据校验
|
||||
if (DataGridItemSource == null || DataGridItemSource.Count == 0)
|
||||
{
|
||||
HandyControl.Controls.MessageBox.Show("选择的物料为空无法生成出库单!");
|
||||
return;
|
||||
}
|
||||
foreach (var itemSource in DataGridItemSource)
|
||||
{
|
||||
if (itemSource.NeedQty == 0)
|
||||
{
|
||||
Growl.Warning("需求数量未填!");
|
||||
SelectedItemSource = itemSource;
|
||||
return;
|
||||
}
|
||||
}
|
||||
#region 调用接口生成出库单据
|
||||
try
|
||||
{
|
||||
var body = new SysOutOrderByMatCodeRequest()
|
||||
{
|
||||
OrderType = "出库",
|
||||
OrderSource = "WCS前端",
|
||||
ItemList = DataGridItemSource.Select(t => new MatCodeItemList()
|
||||
{
|
||||
MatCode = t.MatCode,
|
||||
MatName = t.MatName,
|
||||
MatBatch = t.MatBatch,
|
||||
ReqQty = t.NeedQty,
|
||||
}).ToList(),
|
||||
DeviceType = LocalFile.Config.DeviceType,
|
||||
UserName = LocalStatic.CurrentUser
|
||||
};
|
||||
var Result = ApiHelp.GetDataFromHttp<ResponseCommon>(LocalFile.Config.ApiIpHost + "outstore/sysOutOrderByMatCode", body, "POST");
|
||||
if (Result != null && Result.Code == 200)
|
||||
{
|
||||
Growl.Success(Result.Message);
|
||||
OnRequestClose(true);
|
||||
}
|
||||
else if (Result != null)
|
||||
{
|
||||
Growl.Warning(Result.Message);
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Growl.Error("加载数据失败:" + ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -1,15 +1,26 @@
|
||||
using HandyControl.Controls;
|
||||
using HandyControl.Tools.Extension;
|
||||
using Microsoft.Win32;
|
||||
using Ping9719.WpfEx.Mvvm;
|
||||
using QRCoder;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.IO;
|
||||
using System.IO.Ports;
|
||||
using System.Linq;
|
||||
using System.Reflection.Emit;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Markup;
|
||||
using System.Windows.Media.Imaging;
|
||||
using WCS.Model;
|
||||
using 货架标准上位机.Api;
|
||||
using 货架标准上位机.Views.Controls;
|
||||
using static System.Net.WebRequestMethods;
|
||||
|
||||
namespace 货架标准上位机.ViewModel
|
||||
{
|
||||
@ -215,5 +226,61 @@ namespace 货架标准上位机.ViewModel
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public ICommand AppQRCodeCommand { get => new DelegateCommand(AppQRCode); }
|
||||
public void AppQRCode()
|
||||
{
|
||||
try
|
||||
{
|
||||
#region 获取最新版App名称
|
||||
var Result = ApiHelp.GetDataFromHttp<ResponseCommon>(LocalFile.Config.ApiIpHost + "fileDownload/getLatestAppName", null, "GET");
|
||||
if (Result != null && Result.Code == 200)
|
||||
{
|
||||
//拼凑url
|
||||
var downLoadUrl = LocalFile.Config.ApiIpHost + $"fileDownload/downloadApp?fileName={Result.Data}";
|
||||
//生成二维码
|
||||
var qrCodeImage = GenerateQRCode(downLoadUrl);
|
||||
//展示二维码
|
||||
Dialog.Show(new ImageDialog(qrCodeImage));
|
||||
|
||||
}
|
||||
else if (Result != null)
|
||||
{
|
||||
Growl.Warning(Result.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
Growl.Warning("调用接口失败!");
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public BitmapImage GenerateQRCode(string data)
|
||||
{
|
||||
QRCodeGenerator qrGenerator = new QRCodeGenerator();
|
||||
QRCodeData qrCodeData = qrGenerator.CreateQrCode(data, QRCodeGenerator.ECCLevel.Q);
|
||||
QRCode qrCode = new QRCode(qrCodeData);
|
||||
Bitmap qrCodeImage = qrCode.GetGraphic(20, Color.Black, Color.White, true);
|
||||
// 将System.Drawing.Bitmap转换为System.Windows.Media.Imaging.BitmapImage
|
||||
using (var memoryStream = new MemoryStream())
|
||||
{
|
||||
// 假设Bitmap的Save方法支持Png格式(通常是这样)
|
||||
qrCodeImage.Save(memoryStream, ImageFormat.Png);
|
||||
memoryStream.Position = 0;
|
||||
var bitmapImage = new BitmapImage();
|
||||
bitmapImage.BeginInit();
|
||||
bitmapImage.StreamSource = memoryStream;
|
||||
bitmapImage.CacheOption = BitmapCacheOption.OnLoad;
|
||||
bitmapImage.EndInit();
|
||||
|
||||
// 返回BitmapImage
|
||||
return bitmapImage;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
15
货架标准上位机/Views/Controls/ImageDialog.xaml
Normal file
15
货架标准上位机/Views/Controls/ImageDialog.xaml
Normal file
@ -0,0 +1,15 @@
|
||||
<Border x:Class="货架标准上位机.Views.Controls.ImageDialog"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
CornerRadius="10"
|
||||
Width="300"
|
||||
Height="186"
|
||||
Background="{DynamicResource RegionBrush}">
|
||||
<hc:SimplePanel>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
|
||||
<Image Name="image1"> </Image>
|
||||
</StackPanel>
|
||||
<Button Width="22" Height="22" Command="hc:ControlCommands.Close" Style="{StaticResource ButtonIcon}" Foreground="{DynamicResource PrimaryBrush}" hc:IconElement.Geometry="{StaticResource ErrorGeometry}" Padding="0" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,4,4,0"/>
|
||||
</hc:SimplePanel>
|
||||
</Border>
|
29
货架标准上位机/Views/Controls/ImageDialog.xaml.cs
Normal file
29
货架标准上位机/Views/Controls/ImageDialog.xaml.cs
Normal file
@ -0,0 +1,29 @@
|
||||
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.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace 货架标准上位机.Views.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// TextDialog.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class ImageDialog
|
||||
{
|
||||
public ImageDialog(BitmapImage image)
|
||||
{
|
||||
InitializeComponent();
|
||||
this.image1.Source = image;
|
||||
}
|
||||
}
|
||||
}
|
@ -113,9 +113,9 @@
|
||||
</Button>
|
||||
|
||||
<Button MinHeight="40" FontSize="18" Margin="5"
|
||||
Content="导 入" FontFamily="{StaticResource IconFont}"
|
||||
Content="导 入" FontFamily="{StaticResource IconFont}"
|
||||
Command="{Binding BtnImportCommand}"
|
||||
Foreground="WhiteSmoke"
|
||||
Foreground="WhiteSmoke"
|
||||
Background="Green"
|
||||
>
|
||||
</Button>
|
||||
@ -129,7 +129,7 @@
|
||||
|
||||
|
||||
<Button MinHeight="40" FontSize="18" Margin="5"
|
||||
Content="打 印" FontFamily="{StaticResource IconFont}"
|
||||
Content="生成&打印" FontFamily="{StaticResource IconFont}"
|
||||
Command="{Binding BtnPrintCommand}"
|
||||
Foreground="WhiteSmoke"
|
||||
Background="DarkOrange"
|
||||
|
@ -116,7 +116,7 @@
|
||||
|
||||
<StackPanel Grid.Row="0" Orientation="Horizontal">
|
||||
<Button MinHeight="40" FontSize="18" Margin="4" hc:BorderElement.CornerRadius="6"
|
||||
Content="打印/补打" FontFamily="{StaticResource IconFont}"
|
||||
Content="打印/补打" FontFamily="{StaticResource IconFont}"
|
||||
Command="{Binding BtnPrintCommand}"
|
||||
Foreground="WhiteSmoke"
|
||||
Background="DarkOrange">
|
||||
|
@ -5,7 +5,7 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
Height="500" Width="850" WindowStyle="None" Background="{x:Null}" BorderThickness="0" AllowsTransparency="True" WindowStartupLocation="CenterScreen" Opacity="1">
|
||||
Height="500" Width="850" WindowStyle="None" Background="{x:Null}" BorderThickness="0" AllowsTransparency="True" WindowStartupLocation="CenterScreen" Opacity="1" Loaded="Window_Loaded">
|
||||
<hc:Window.Resources>
|
||||
<ResourceDictionary>
|
||||
<Style TargetType="Button" BasedOn="{StaticResource ButtonDefault}">
|
||||
@ -34,6 +34,19 @@
|
||||
<Border Background="AliceBlue" Padding="0">
|
||||
<Grid >
|
||||
<StackPanel Margin="3" Orientation="Horizontal">
|
||||
<StackPanel Margin="3" Grid.Row="3" Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Center">
|
||||
<TextBlock VerticalAlignment="Center"
|
||||
Text="货架类型:" FontSize="22" >
|
||||
</TextBlock>
|
||||
<ComboBox
|
||||
IsEnabled="{Binding ShelfTypeIsEnabled}"
|
||||
VerticalAlignment="Center"
|
||||
DisplayMemberPath="ShelfTypeName"
|
||||
ItemsSource="{Binding ShelfTypeItems}"
|
||||
SelectedItem="{Binding SelectedShelfTypeItem}"
|
||||
FontSize="22"
|
||||
IsEditable="False"/>
|
||||
</StackPanel>
|
||||
<Button MinHeight="40" FontSize="18"
|
||||
Content="增加物料" FontFamily="{StaticResource IconFont}"
|
||||
Foreground="WhiteSmoke"
|
||||
@ -76,15 +89,15 @@
|
||||
</Grid>
|
||||
|
||||
<StackPanel Grid.Row="3" HorizontalAlignment="Right" Orientation="Horizontal">
|
||||
<TextBlock FontSize="20" Text="已选物料:"></TextBlock>
|
||||
<TextBlock FontSize="20" Text="{Binding SelectedTypeCount}"></TextBlock>
|
||||
<TextBlock FontSize="20" Text="种"></TextBlock>
|
||||
<TextBlock FontSize="22" Text="已选物料:"></TextBlock>
|
||||
<TextBlock FontSize="22" Text="{Binding SelectedTypeCount}"></TextBlock>
|
||||
<TextBlock FontSize="22" Text="种"></TextBlock>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Margin="3" x:Name="spacingPanel" Grid.Row="4" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
|
||||
<Button Margin="0" Content="生成出库单" Background="ForestGreen" Foreground="White" MinHeight="40" FontSize="20"
|
||||
Command="{Binding GenerateOutOrderCommand}"/>
|
||||
<TextBlock Margin="20" Text=""></TextBlock>
|
||||
<TextBlock Margin="16" Text=""></TextBlock>
|
||||
<Button Margin="0" Content="取消" Background="IndianRed" Foreground="White" MinHeight="40" FontSize="20" Click="closeClick"/>
|
||||
</StackPanel>
|
||||
|
||||
|
@ -59,5 +59,10 @@ namespace 货架标准上位机
|
||||
this.DialogResult = false;
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
viewModel.InitShelfTypeItems();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -25,10 +25,11 @@ namespace 货架标准上位机
|
||||
|
||||
public MatInventorySummaryModel inventorySummary = null;
|
||||
|
||||
public OutInventoryAddMatView()
|
||||
public OutInventoryAddMatView(int shelfTypeId)
|
||||
{
|
||||
InitializeComponent();
|
||||
this.DataContext = viewModel;
|
||||
viewModel.ShelfTypeId = shelfTypeId;
|
||||
}
|
||||
|
||||
private void closeClick(object sender, RoutedEventArgs e)
|
||||
|
@ -88,12 +88,18 @@
|
||||
<Button MinHeight="40" FontSize="18" Margin="5" Command="{Binding BtnPauseCommand}"
|
||||
Content="暂停发料" FontFamily="{StaticResource IconFont}" Background="CadetBlue" Foreground="White">
|
||||
</Button>
|
||||
<Button hc:BorderElement.CornerRadius="10"
|
||||
<Button hc:BorderElement.CornerRadius="10" Margin="5"
|
||||
HorizontalAlignment="Right"
|
||||
Background="Green" Foreground="White"
|
||||
Grid.Column="1" MinHeight="40" FontSize="22" Content="按物料发料" FontFamily="{StaticResource IconFont}"
|
||||
Grid.Column="1" MinHeight="40" FontSize="22" Content="物料发料" FontFamily="{StaticResource IconFont}"
|
||||
Command="{Binding BtnOutOrderCommand}">
|
||||
</Button>
|
||||
<Button hc:BorderElement.CornerRadius="10" Margin="5"
|
||||
HorizontalAlignment="Right"
|
||||
Background="Green" Foreground="White"
|
||||
Grid.Column="1" MinHeight="40" FontSize="22" Content="导入发料" FontFamily="{StaticResource IconFont}"
|
||||
Command="{Binding BtnImportDocumentCommand}">
|
||||
</Button>
|
||||
</StackPanel>
|
||||
<DataGrid Grid.Row="1" SelectedCellsChanged="DataGrid_SelectedCellsChanged"
|
||||
SelectedItem="{Binding SelectedataGridItem}"
|
||||
|
93
货架标准上位机/Views/OutInventoryImportDucumentView.xaml
Normal file
93
货架标准上位机/Views/OutInventoryImportDucumentView.xaml
Normal file
@ -0,0 +1,93 @@
|
||||
<hc:Window x:Class="货架标准上位机.OutInventoryImportDucumentView"
|
||||
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"
|
||||
mc:Ignorable="d"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
Height="500" Width="850" WindowStyle="None" Background="{x:Null}" BorderThickness="0" AllowsTransparency="True" WindowStartupLocation="CenterScreen" Opacity="1">
|
||||
<hc:Window.Resources>
|
||||
<ResourceDictionary>
|
||||
<Style TargetType="Button" BasedOn="{StaticResource ButtonDefault}">
|
||||
<Setter Property="Padding" Value="25,0"></Setter>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
</hc:Window.Resources>
|
||||
|
||||
<Border Background="AliceBlue" CornerRadius="10" BorderThickness="1.5" BorderBrush="Black" >
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"></RowDefinition>
|
||||
<RowDefinition Height="1.5*"></RowDefinition>
|
||||
<RowDefinition Height="10*"></RowDefinition>
|
||||
<RowDefinition Height="0.8*"></RowDefinition>
|
||||
<RowDefinition Height="1.5*"></RowDefinition>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Button Margin="-5,-1" Visibility="{Binding IsClose,Converter={StaticResource Boolean2VisibilityConverter}}" Style="{StaticResource ButtonIcon}" hc:IconElement.Geometry="{StaticResource CloseGeometry}" HorizontalAlignment="Right" VerticalAlignment="Top" Click="closeClick"/>
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBlock FontSize="25" Name="Title" Text="导入出库单据" TextWrapping="Wrap" VerticalAlignment="Top" HorizontalAlignment="Center"/>
|
||||
<hc:Divider Margin="0"></hc:Divider>
|
||||
</StackPanel>
|
||||
|
||||
<Border Grid.Row="1" Margin="2 2 2 0" Background="AliceBlue" Padding="0">
|
||||
<Border Background="AliceBlue" Padding="0">
|
||||
<Grid >
|
||||
<StackPanel Margin="3" Orientation="Horizontal">
|
||||
<Button MinHeight="40" FontSize="18" Margin="3"
|
||||
Content="导入" FontFamily="{StaticResource IconFont}"
|
||||
Foreground="WhiteSmoke"
|
||||
Background="Green"
|
||||
Command="{Binding BtnImportCommand}">
|
||||
</Button>
|
||||
<Button MinHeight="40" FontSize="18" Margin="3"
|
||||
Content="下载模板" FontFamily="{StaticResource IconFont}"
|
||||
Foreground="WhiteSmoke"
|
||||
Background="Green"
|
||||
Command="{Binding BtnDownloadExcelCommand}">
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Border>
|
||||
|
||||
<Grid Margin="5,0" Grid.Row="2" >
|
||||
<DataGrid Grid.Row="1" SelectedCellsChanged="DataGrid_SelectedCellsChanged"
|
||||
RowHeight="39"
|
||||
ItemsSource="{Binding DataGridItemSource}"
|
||||
SelectedItem="{Binding SelectedItemSource, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
AutoGenerateColumns="False" Name="dg1" FontSize="15">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn IsReadOnly="True" Header="物料编码" Binding="{Binding MatCode}"></DataGridTextColumn>
|
||||
<DataGridTextColumn IsReadOnly="True" Header="物料名称" MaxWidth="150" Binding="{Binding MatName}"></DataGridTextColumn>
|
||||
<DataGridTextColumn IsReadOnly="True" Header="物料批次" Binding="{Binding MatBatch}"></DataGridTextColumn>
|
||||
<DataGridTextColumn IsReadOnly="True" Header="库存数量" Binding="{Binding TotalQty}"></DataGridTextColumn>
|
||||
<DataGridTextColumn IsReadOnly="True" Header="需求数量" Binding="{Binding NeedQty}"></DataGridTextColumn>
|
||||
<DataGridTextColumn IsReadOnly="True" Header="提示信息" Binding="{Binding Info}"></DataGridTextColumn>
|
||||
<DataGridTemplateColumn CanUserResize="False" Header="">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<Button Style="{StaticResource ButtonDanger}" Margin="0,0,0,0" IsEnabled="True" Content="删除" Width="60" Command="{Binding DataContext.DelCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}}" CommandParameter="{Binding }"/>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</Grid>
|
||||
|
||||
<StackPanel Grid.Row="3" HorizontalAlignment="Right" Orientation="Horizontal">
|
||||
<TextBlock FontSize="20" Text="已选物料:"></TextBlock>
|
||||
<TextBlock FontSize="20" Text="{Binding SelectedTypeCount}"></TextBlock>
|
||||
<TextBlock FontSize="20" Text="种"></TextBlock>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Margin="3" x:Name="spacingPanel" Grid.Row="4" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
|
||||
<Button Margin="0" Content="生成出库单" Background="ForestGreen" Foreground="White" MinHeight="40" FontSize="20"
|
||||
Command="{Binding GenerateOutOrderCommand}"/>
|
||||
<TextBlock Margin="20" Text=""></TextBlock>
|
||||
<Button Margin="0" Content="取消" Background="IndianRed" Foreground="White" MinHeight="40" FontSize="20" Click="closeClick"/>
|
||||
</StackPanel>
|
||||
|
||||
</Grid>
|
||||
</Border>
|
||||
</hc:Window>
|
63
货架标准上位机/Views/OutInventoryImportDucumentView.xaml.cs
Normal file
63
货架标准上位机/Views/OutInventoryImportDucumentView.xaml.cs
Normal file
@ -0,0 +1,63 @@
|
||||
|
||||
using HandyControl.Controls;
|
||||
using HandyControl.Data;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Media;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using 货架标准上位机.ViewModels;
|
||||
|
||||
namespace 货架标准上位机
|
||||
{
|
||||
public partial class OutInventoryImportDucumentView : HandyControl.Controls.Window
|
||||
{
|
||||
public OutInventoryImportDucumentViewModel viewModel = new OutInventoryImportDucumentViewModel();
|
||||
public OutInventoryImportDucumentView()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.DataContext = viewModel;
|
||||
|
||||
viewModel.TrueClose += OnTrueClose;
|
||||
viewModel.FalseClose += OnFalseClose;
|
||||
}
|
||||
|
||||
private void closeClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.DialogResult = false;
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void DataGrid_SelectedCellsChanged(object sender, SelectedCellsChangedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void txtMatQty1_PreviewTextInput(object sender, TextCompositionEventArgs e)
|
||||
{
|
||||
if (!Regex.IsMatch(e.Text, "^[0-9]"))
|
||||
{
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTrueClose()
|
||||
{
|
||||
this.DialogResult = true;
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void OnFalseClose()
|
||||
{
|
||||
this.DialogResult = false;
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
}
|
@ -127,14 +127,6 @@
|
||||
ItemsSource="{Binding DataGridItemSource}"
|
||||
RowHeight="40"
|
||||
AutoGenerateColumns="False" FontSize="15">
|
||||
<!--<DataGrid.Resources>
|
||||
<货架标准上位机:WorkItemBackgroundConverter x:Key="converter"/>
|
||||
</DataGrid.Resources>
|
||||
<DataGrid.RowStyle>
|
||||
<Style TargetType="DataGridRow">
|
||||
<Setter Property="Background" Value="{Binding Path=IsSended, Converter={StaticResource converter}}"/>
|
||||
</Style>
|
||||
</DataGrid.RowStyle>-->
|
||||
<DataGrid.Columns>
|
||||
<DataGridTemplateColumn Header="" CanUserResize="False" Width="50">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
|
@ -59,6 +59,14 @@
|
||||
</StackPanel>
|
||||
</GroupBox>
|
||||
|
||||
<GroupBox Header="App" Margin="5" Padding="5" Style="{StaticResource GroupBoxTab}" Background="{x:Null}">
|
||||
<StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Button Margin="5" Command="{Binding AppQRCodeCommand}">下载二维码</Button>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</GroupBox>
|
||||
|
||||
<GroupBox Header="软件" Margin="5" Padding="5" Style="{StaticResource GroupBoxTab}" Background="{x:Null}">
|
||||
<StackPanel>
|
||||
<TextBlock>开机启动</TextBlock>
|
||||
|
@ -21,7 +21,7 @@ namespace 货架标准上位机
|
||||
{
|
||||
client = new WebSocketClient();
|
||||
client.Setup(new TouchSocketConfig()
|
||||
.SetRemoteIPHost("ws://127.0.0.1:7789/ws")
|
||||
.SetRemoteIPHost(LocalFile.Config.WebSocketUrl)
|
||||
.ConfigureContainer(a =>
|
||||
{
|
||||
a.AddConsoleLogger();
|
||||
@ -97,7 +97,7 @@ namespace 货架标准上位机
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
WarningManager.AddWarning(warning);
|
||||
@ -105,7 +105,7 @@ namespace 货架标准上位机
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
client.Send(e.DataFrame.ToText());
|
||||
}
|
||||
|
@ -3,8 +3,10 @@
|
||||
"MySql": "server=localhost;Database=db1;Uid=root;Pwd=123456;Convert Zero Datetime=True",
|
||||
//货架服务器的IP和端口号
|
||||
"ApiIpHost": "http://localhost:8888/",
|
||||
//WebSocket的地址
|
||||
"WebSocketUrl": "ws://127.0.0.1:7789/ws",
|
||||
//货架分区
|
||||
"GroupName": [ "13寸智能货架", "7寸智能货架"],
|
||||
"GroupName": [ "13寸智能货架", "7寸智能货架" ],
|
||||
//设备类型 可以配置为每个电脑不一样
|
||||
"DeviceType": "WCS前端",
|
||||
//货架类型的是否开机自检
|
||||
|
@ -51,6 +51,7 @@
|
||||
<PackageReference Include="MySqlConnector" Version="2.3.5" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="Ping9719.WpfEx" Version="0.8.0" />
|
||||
<PackageReference Include="QRCoder" Version="1.5.1" />
|
||||
<PackageReference Include="SqlSugar" Version="5.1.4.149" />
|
||||
<PackageReference Include="SqlSugar.MySqlConnector" Version="5.1.3.42" />
|
||||
<PackageReference Include="System.Data.SQLite.Core" Version="1.0.118" />
|
||||
@ -85,6 +86,12 @@
|
||||
<None Update="data\jsconfig.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Excel\出库单据导入模板.xlsx">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Excel\物料管理导入模板.xlsx">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Resources\Interop.BarTender.dll">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
@ -102,12 +109,18 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="Models\JsConfig.cs">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Compile>
|
||||
<Compile Update="Views\Controls\ScannerDisplayControl.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Update="Views\Controls\ProcessDialog.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Update="Views\Controls\ImageDialog.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
Reference in New Issue
Block a user