新增原料入场记录独立页面,更新导航和菜单配置以支持新功能。优化原料入场记录编辑对话框,增强物料选择和显示逻辑,提升用户体验。
This commit is contained in:
@@ -40,6 +40,8 @@ public class SysMenuSeedData : ISqlSugarEntitySeedData<SysMenu>
|
|||||||
new SysMenu{ Id=1300150010601, Pid=1300150000101, Title="密炼物料信息", Path="/xslmes/mesMixerMaterial", Name="mesMixerMaterial", Component="MixerMaterialListView", Icon="", Type=MenuTypeEnum.Menu, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), OrderNo=105 },
|
new SysMenu{ Id=1300150010601, Pid=1300150000101, Title="密炼物料信息", Path="/xslmes/mesMixerMaterial", Name="mesMixerMaterial", Component="MixerMaterialListView", Icon="", Type=MenuTypeEnum.Menu, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), OrderNo=105 },
|
||||||
// 原料入场记录
|
// 原料入场记录
|
||||||
new SysMenu{ Id=1300150010701, Pid=1300150000101, Title="原料入场记录", Path="/xslmes/mesXslRawMaterialEntry", Name="mesXslRawMaterialEntry", Component="RawMaterialEntryListView", Icon="", Type=MenuTypeEnum.Menu, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), OrderNo=106 },
|
new SysMenu{ Id=1300150010701, Pid=1300150000101, Title="原料入场记录", Path="/xslmes/mesXslRawMaterialEntry", Name="mesXslRawMaterialEntry", Component="RawMaterialEntryListView", Icon="", Type=MenuTypeEnum.Menu, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), OrderNo=106 },
|
||||||
|
// 新增原料入场记录(独立页面)
|
||||||
|
new SysMenu{ Id=1300150010801, Pid=1300150000101, Title="新增原料入场记录", Path="/xslmes/rawMaterialEntryOperation", Name="rawMaterialEntryOperation", Component="RawMaterialEntryOperationView", Icon="", Type=MenuTypeEnum.Menu, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), OrderNo=107 },
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ public class SysTenantMenuSeedData : ISqlSugarEntitySeedData<SysTenantMenu>
|
|||||||
new SysTenantMenu(){ TenantId=1300000000001,MenuId=1300150010501},
|
new SysTenantMenu(){ TenantId=1300000000001,MenuId=1300150010501},
|
||||||
new SysTenantMenu(){ TenantId=1300000000001,MenuId=1300150010601},
|
new SysTenantMenu(){ TenantId=1300000000001,MenuId=1300150010601},
|
||||||
new SysTenantMenu(){ TenantId=1300000000001,MenuId=1300150010701},
|
new SysTenantMenu(){ TenantId=1300000000001,MenuId=1300150010701},
|
||||||
|
new SysTenantMenu(){ TenantId=1300000000001,MenuId=1300150010801},
|
||||||
new SysTenantMenu(){ TenantId=1300000000001,MenuId=1300200012101},
|
new SysTenantMenu(){ TenantId=1300000000001,MenuId=1300200012101},
|
||||||
new SysTenantMenu(){ TenantId=1300000000001,MenuId=1300200012111},
|
new SysTenantMenu(){ TenantId=1300000000001,MenuId=1300200012111},
|
||||||
new SysTenantMenu(){ TenantId=1300000000001,MenuId=1300200012121},
|
new SysTenantMenu(){ TenantId=1300000000001,MenuId=1300200012121},
|
||||||
|
|||||||
@@ -73,6 +73,8 @@ namespace YY.Admin
|
|||||||
containerRegistry.RegisterForNavigation<MixerMaterialListView>();
|
containerRegistry.RegisterForNavigation<MixerMaterialListView>();
|
||||||
// 原料入场记录
|
// 原料入场记录
|
||||||
containerRegistry.RegisterForNavigation<RawMaterialEntryListView>();
|
containerRegistry.RegisterForNavigation<RawMaterialEntryListView>();
|
||||||
|
// 新增原料入场记录(独立页面)
|
||||||
|
containerRegistry.RegisterForNavigation<RawMaterialEntryOperationView>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public class DialogWindow : Window, IDialogWindow
|
public class DialogWindow : Window, IDialogWindow
|
||||||
|
|||||||
@@ -125,7 +125,12 @@ namespace YY.Admin.ViewModels.Control
|
|||||||
// 已实现页面:原料入场记录
|
// 已实现页面:原料入场记录
|
||||||
["RawMaterialEntryListView"] = "RawMaterialEntryListView",
|
["RawMaterialEntryListView"] = "RawMaterialEntryListView",
|
||||||
["/xslmes/mesXslRawMaterialEntry"] = "RawMaterialEntryListView",
|
["/xslmes/mesXslRawMaterialEntry"] = "RawMaterialEntryListView",
|
||||||
["mesXslRawMaterialEntry"] = "RawMaterialEntryListView"
|
["mesXslRawMaterialEntry"] = "RawMaterialEntryListView",
|
||||||
|
|
||||||
|
// 已实现页面:新增原料入场记录
|
||||||
|
["RawMaterialEntryOperationView"] = "RawMaterialEntryOperationView",
|
||||||
|
["/xslmes/rawMaterialEntryOperation"] = "RawMaterialEntryOperationView",
|
||||||
|
["rawMaterialEntryOperation"] = "RawMaterialEntryOperationView"
|
||||||
};
|
};
|
||||||
|
|
||||||
private MenuItem? _selectedMenuItem;
|
private MenuItem? _selectedMenuItem;
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using YY.Admin.Core;
|
|||||||
using YY.Admin.Core.Entity;
|
using YY.Admin.Core.Entity;
|
||||||
using YY.Admin.Core.Services;
|
using YY.Admin.Core.Services;
|
||||||
using YY.Admin.Services.Service;
|
using YY.Admin.Services.Service;
|
||||||
|
using YY.Admin.Views.RawMaterialEntry;
|
||||||
|
|
||||||
namespace YY.Admin.ViewModels.RawMaterialEntry;
|
namespace YY.Admin.ViewModels.RawMaterialEntry;
|
||||||
|
|
||||||
@@ -31,10 +32,14 @@ public class RawMaterialEntryEditDialogViewModel : BaseViewModel, IDialogResulta
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (!SetProperty(ref _selectedMaterial, value) || value == null || Entry == null) return;
|
if (!SetProperty(ref _selectedMaterial, value) || value == null || Entry == null) return;
|
||||||
Entry.MaterialId = value.Id;
|
Entry.MaterialId = value.Id;
|
||||||
Entry.MaterialCode = value.MaterialCode;
|
Entry.MaterialCode = value.MaterialCode;
|
||||||
Entry.MaterialName = value.MaterialName;
|
Entry.MaterialName = value.MaterialName;
|
||||||
|
Entry.ManufacturerMaterialName = value.AliasName;
|
||||||
|
RecalculateShelfLife(value);
|
||||||
RaisePropertyChanged(nameof(Entry));
|
RaisePropertyChanged(nameof(Entry));
|
||||||
|
RaisePropertyChanged(nameof(SelectedMaterialDisplay));
|
||||||
|
RaisePropertyChanged(nameof(HasSelectedMaterial));
|
||||||
|
|
||||||
// 新增模式自动生成条码/批次号
|
// 新增模式自动生成条码/批次号
|
||||||
if (IsAddMode && !string.IsNullOrEmpty(value.MaterialCode))
|
if (IsAddMode && !string.IsNullOrEmpty(value.MaterialCode))
|
||||||
@@ -51,6 +56,57 @@ public class RawMaterialEntryEditDialogViewModel : BaseViewModel, IDialogResulta
|
|||||||
|
|
||||||
public bool IsAddMode => string.IsNullOrWhiteSpace(Entry?.Id);
|
public bool IsAddMode => string.IsNullOrWhiteSpace(Entry?.Id);
|
||||||
public string DialogTitle => IsAddMode ? "新增原料入场记录" : "编辑原料入场记录";
|
public string DialogTitle => IsAddMode ? "新增原料入场记录" : "编辑原料入场记录";
|
||||||
|
public string SelectedMaterialDisplay => _selectedMaterial == null
|
||||||
|
? "请选择密炼物料"
|
||||||
|
: $"[{_selectedMaterial.MaterialCode}] {_selectedMaterial.MaterialName}";
|
||||||
|
public bool HasSelectedMaterial => _selectedMaterial != null;
|
||||||
|
|
||||||
|
public string? IsSpecialAdoptionValue
|
||||||
|
{
|
||||||
|
get => Entry?.IsSpecialAdoption;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (Entry == null || Entry.IsSpecialAdoption == value)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Entry.IsSpecialAdoption = value;
|
||||||
|
if (!string.Equals(value, "1", StringComparison.Ordinal))
|
||||||
|
{
|
||||||
|
Entry.SpecialAdoptionOperator = null;
|
||||||
|
Entry.SpecialAdoptionTime = null;
|
||||||
|
Entry.SpecialAdoptionReason = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
RaisePropertyChanged(nameof(Entry));
|
||||||
|
RaisePropertyChanged(nameof(IsSpecialAdoptionValue));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public double? TotalWeightInput
|
||||||
|
{
|
||||||
|
get => Entry?.TotalWeight;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (Entry == null || Entry.TotalWeight == value) return;
|
||||||
|
Entry.TotalWeight = value;
|
||||||
|
RecalculatePortionWeight();
|
||||||
|
RaisePropertyChanged(nameof(Entry));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int? TotalPortionsInput
|
||||||
|
{
|
||||||
|
get => Entry?.TotalPortions;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (Entry == null || Entry.TotalPortions == value) return;
|
||||||
|
Entry.TotalPortions = value;
|
||||||
|
RecalculatePortionWeight();
|
||||||
|
RaisePropertyChanged(nameof(Entry));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public ObservableCollection<MesMixerMaterial> MaterialOptions { get; } = new();
|
public ObservableCollection<MesMixerMaterial> MaterialOptions { get; } = new();
|
||||||
public ObservableCollection<KeyValuePair<string, string>> TestResultOptions { get; } = new();
|
public ObservableCollection<KeyValuePair<string, string>> TestResultOptions { get; } = new();
|
||||||
@@ -59,6 +115,8 @@ public class RawMaterialEntryEditDialogViewModel : BaseViewModel, IDialogResulta
|
|||||||
public ObservableCollection<KeyValuePair<string, string>> StockBalanceOptions { get; } = new();
|
public ObservableCollection<KeyValuePair<string, string>> StockBalanceOptions { get; } = new();
|
||||||
public ObservableCollection<KeyValuePair<string, string>> IsSpecialAdoptionOptions { get; } = new();
|
public ObservableCollection<KeyValuePair<string, string>> IsSpecialAdoptionOptions { get; } = new();
|
||||||
public ObservableCollection<KeyValuePair<string, string>> StatusOptions { get; } = new();
|
public ObservableCollection<KeyValuePair<string, string>> StatusOptions { get; } = new();
|
||||||
|
public ObservableCollection<RawMaterialSplitDetailItem> SplitCodeDetails { get; } = new();
|
||||||
|
public double SplitCodeTableHeight => CalculateSplitCodeTableHeight();
|
||||||
|
|
||||||
private bool _result;
|
private bool _result;
|
||||||
public bool Result { get => _result; set => SetProperty(ref _result, value); }
|
public bool Result { get => _result; set => SetProperty(ref _result, value); }
|
||||||
@@ -66,6 +124,13 @@ public class RawMaterialEntryEditDialogViewModel : BaseViewModel, IDialogResulta
|
|||||||
|
|
||||||
public DelegateCommand SaveCommand { get; }
|
public DelegateCommand SaveCommand { get; }
|
||||||
public DelegateCommand CancelCommand { get; }
|
public DelegateCommand CancelCommand { get; }
|
||||||
|
public DelegateCommand ResetCommand { get; }
|
||||||
|
public DelegateCommand AddSplitDetailCommand { get; }
|
||||||
|
public DelegateCommand<RawMaterialSplitDetailItem> RemoveSplitDetailCommand { get; }
|
||||||
|
public DelegateCommand OpenMaterialPickerCommand { get; }
|
||||||
|
public DelegateCommand ClearMaterialCommand { get; }
|
||||||
|
public DelegateCommand OpenWeightRecordPickerCommand { get; }
|
||||||
|
public DelegateCommand ClearWeightRecordCommand { get; }
|
||||||
|
|
||||||
public RawMaterialEntryEditDialogViewModel(
|
public RawMaterialEntryEditDialogViewModel(
|
||||||
IRawMaterialEntryService entryService,
|
IRawMaterialEntryService entryService,
|
||||||
@@ -79,6 +144,14 @@ public class RawMaterialEntryEditDialogViewModel : BaseViewModel, IDialogResulta
|
|||||||
_mixerMaterialService = mixerMaterialService;
|
_mixerMaterialService = mixerMaterialService;
|
||||||
SaveCommand = new DelegateCommand(async () => await SaveAsync());
|
SaveCommand = new DelegateCommand(async () => await SaveAsync());
|
||||||
CancelCommand = new DelegateCommand(() => CloseAction?.Invoke());
|
CancelCommand = new DelegateCommand(() => CloseAction?.Invoke());
|
||||||
|
ResetCommand = new DelegateCommand(InitializeForAdd);
|
||||||
|
AddSplitDetailCommand = new DelegateCommand(AddSplitDetailRow);
|
||||||
|
RemoveSplitDetailCommand = new DelegateCommand<RawMaterialSplitDetailItem>(RemoveSplitDetailRow);
|
||||||
|
OpenMaterialPickerCommand = new DelegateCommand(async () => await OpenMaterialPickerAsync());
|
||||||
|
ClearMaterialCommand = new DelegateCommand(ClearMaterialSelection);
|
||||||
|
OpenWeightRecordPickerCommand = new DelegateCommand(async () => await OpenWeightRecordPickerAsync());
|
||||||
|
ClearWeightRecordCommand = new DelegateCommand(ClearWeightRecordSelection);
|
||||||
|
SplitCodeDetails.CollectionChanged += (_, _) => RaisePropertyChanged(nameof(SplitCodeTableHeight));
|
||||||
_ = LoadAllAsync();
|
_ = LoadAllAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -148,8 +221,13 @@ public class RawMaterialEntryEditDialogViewModel : BaseViewModel, IDialogResulta
|
|||||||
new KeyValuePair<string, string>("是", "1"),
|
new KeyValuePair<string, string>("是", "1"),
|
||||||
});
|
});
|
||||||
PopulateOptions(StatusOptions, statusOpts, Array.Empty<KeyValuePair<string, string>>());
|
PopulateOptions(StatusOptions, statusOpts, Array.Empty<KeyValuePair<string, string>>());
|
||||||
|
ApplyDefaultEntryStatusForAdd();
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
FillFallbackOptions();
|
||||||
|
ApplyDefaultEntryStatusForAdd();
|
||||||
}
|
}
|
||||||
catch { FillFallbackOptions(); }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void PopulateOptions(
|
private static void PopulateOptions(
|
||||||
@@ -206,13 +284,20 @@ public class RawMaterialEntryEditDialogViewModel : BaseViewModel, IDialogResulta
|
|||||||
{
|
{
|
||||||
_selectedMaterial = null;
|
_selectedMaterial = null;
|
||||||
RaisePropertyChanged(nameof(SelectedMaterial));
|
RaisePropertyChanged(nameof(SelectedMaterial));
|
||||||
|
RaisePropertyChanged(nameof(SelectedMaterialDisplay));
|
||||||
|
RaisePropertyChanged(nameof(HasSelectedMaterial));
|
||||||
Entry = new MesXslRawMaterialEntry
|
Entry = new MesXslRawMaterialEntry
|
||||||
{
|
{
|
||||||
TestResult = "0", TestStatus = "0", PrintFlag = "0",
|
EntryTime = DateTime.Now,
|
||||||
StockBalance = "0", IsSpecialAdoption = "0"
|
IsSpecialAdoption = "0"
|
||||||
};
|
};
|
||||||
|
InitializeSplitCodeDetailsFromEntry();
|
||||||
|
ApplyDefaultEntryStatusForAdd();
|
||||||
RaisePropertyChanged(nameof(IsAddMode));
|
RaisePropertyChanged(nameof(IsAddMode));
|
||||||
RaisePropertyChanged(nameof(DialogTitle));
|
RaisePropertyChanged(nameof(DialogTitle));
|
||||||
|
RaisePropertyChanged(nameof(TotalWeightInput));
|
||||||
|
RaisePropertyChanged(nameof(TotalPortionsInput));
|
||||||
|
RaisePropertyChanged(nameof(IsSpecialAdoptionValue));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void InitializeForEdit(MesXslRawMaterialEntry entry)
|
public void InitializeForEdit(MesXslRawMaterialEntry entry)
|
||||||
@@ -233,6 +318,7 @@ public class RawMaterialEntryEditDialogViewModel : BaseViewModel, IDialogResulta
|
|||||||
SpecialAdoptionReason = entry.SpecialAdoptionReason, Status = entry.Status, Remark = entry.Remark,
|
SpecialAdoptionReason = entry.SpecialAdoptionReason, Status = entry.Status, Remark = entry.Remark,
|
||||||
TenantId = entry.TenantId,
|
TenantId = entry.TenantId,
|
||||||
};
|
};
|
||||||
|
InitializeSplitCodeDetailsFromEntry();
|
||||||
|
|
||||||
// 若物料列表已加载则直接回填,否则记录 pending 等加载完后回填
|
// 若物料列表已加载则直接回填,否则记录 pending 等加载完后回填
|
||||||
if (MaterialOptions.Count > 0)
|
if (MaterialOptions.Count > 0)
|
||||||
@@ -240,6 +326,8 @@ public class RawMaterialEntryEditDialogViewModel : BaseViewModel, IDialogResulta
|
|||||||
_selectedMaterial = MaterialOptions.FirstOrDefault(m =>
|
_selectedMaterial = MaterialOptions.FirstOrDefault(m =>
|
||||||
string.Equals(m.Id, entry.MaterialId, StringComparison.OrdinalIgnoreCase));
|
string.Equals(m.Id, entry.MaterialId, StringComparison.OrdinalIgnoreCase));
|
||||||
RaisePropertyChanged(nameof(SelectedMaterial));
|
RaisePropertyChanged(nameof(SelectedMaterial));
|
||||||
|
RaisePropertyChanged(nameof(SelectedMaterialDisplay));
|
||||||
|
RaisePropertyChanged(nameof(HasSelectedMaterial));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -248,6 +336,9 @@ public class RawMaterialEntryEditDialogViewModel : BaseViewModel, IDialogResulta
|
|||||||
|
|
||||||
RaisePropertyChanged(nameof(IsAddMode));
|
RaisePropertyChanged(nameof(IsAddMode));
|
||||||
RaisePropertyChanged(nameof(DialogTitle));
|
RaisePropertyChanged(nameof(DialogTitle));
|
||||||
|
RaisePropertyChanged(nameof(TotalWeightInput));
|
||||||
|
RaisePropertyChanged(nameof(TotalPortionsInput));
|
||||||
|
RaisePropertyChanged(nameof(IsSpecialAdoptionValue));
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task SaveAsync()
|
private async Task SaveAsync()
|
||||||
@@ -255,6 +346,8 @@ public class RawMaterialEntryEditDialogViewModel : BaseViewModel, IDialogResulta
|
|||||||
if (Entry == null) return;
|
if (Entry == null) return;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
ApplyFirstSplitDetailToEntry();
|
||||||
|
RecalculatePortionWeight();
|
||||||
bool ok;
|
bool ok;
|
||||||
if (IsAddMode)
|
if (IsAddMode)
|
||||||
{
|
{
|
||||||
@@ -268,6 +361,13 @@ public class RawMaterialEntryEditDialogViewModel : BaseViewModel, IDialogResulta
|
|||||||
if (!ok) { HandyControl.Controls.MessageBox.Error("编辑失败!"); return; }
|
if (!ok) { HandyControl.Controls.MessageBox.Error("编辑失败!"); return; }
|
||||||
}
|
}
|
||||||
Result = ok;
|
Result = ok;
|
||||||
|
if (IsAddMode && CloseAction == null)
|
||||||
|
{
|
||||||
|
// 独立新增页面:保存成功后自动清空表单,便于连续录入
|
||||||
|
InitializeForAdd();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
CloseAction?.Invoke();
|
CloseAction?.Invoke();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@@ -275,4 +375,232 @@ public class RawMaterialEntryEditDialogViewModel : BaseViewModel, IDialogResulta
|
|||||||
HandyControl.Controls.MessageBox.Error($"操作失败:{ex.Message}");
|
HandyControl.Controls.MessageBox.Error($"操作失败:{ex.Message}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task OpenWeightRecordPickerAsync()
|
||||||
|
{
|
||||||
|
WeightRecordPickerDialogViewModel? pickerVm = null;
|
||||||
|
bool confirmed;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
confirmed = await HandyControl.Controls.Dialog.Show<WeightRecordPickerDialogView>()
|
||||||
|
.Initialize<WeightRecordPickerDialogViewModel>(vm =>
|
||||||
|
{
|
||||||
|
pickerVm = vm;
|
||||||
|
vm.Initialize(Entry?.BillNo);
|
||||||
|
})
|
||||||
|
.GetResultAsync<bool>();
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!confirmed || pickerVm?.SelectedRecord == null || Entry == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var selected = pickerVm.SelectedRecord;
|
||||||
|
Entry.WeightRecordId = selected.Id;
|
||||||
|
Entry.BillNo = selected.BillNo;
|
||||||
|
Entry.SupplierName = selected.SenderUnit;
|
||||||
|
Entry.SupplierId = null;
|
||||||
|
RaisePropertyChanged(nameof(Entry));
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task OpenMaterialPickerAsync()
|
||||||
|
{
|
||||||
|
RawMaterialEntryMaterialPickerDialogViewModel? pickerVm = null;
|
||||||
|
bool confirmed;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
confirmed = await HandyControl.Controls.Dialog.Show<RawMaterialEntryMaterialPickerDialogView>()
|
||||||
|
.Initialize<RawMaterialEntryMaterialPickerDialogViewModel>(vm =>
|
||||||
|
{
|
||||||
|
pickerVm = vm;
|
||||||
|
vm.Initialize(Entry?.MaterialCode, Entry?.MaterialName);
|
||||||
|
})
|
||||||
|
.GetResultAsync<bool>();
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!confirmed || pickerVm?.SelectedMaterial == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
SelectedMaterial = pickerVm.SelectedMaterial;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ClearMaterialSelection()
|
||||||
|
{
|
||||||
|
_selectedMaterial = null;
|
||||||
|
RaisePropertyChanged(nameof(SelectedMaterial));
|
||||||
|
RaisePropertyChanged(nameof(SelectedMaterialDisplay));
|
||||||
|
RaisePropertyChanged(nameof(HasSelectedMaterial));
|
||||||
|
|
||||||
|
if (Entry == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Entry.MaterialId = null;
|
||||||
|
Entry.MaterialCode = null;
|
||||||
|
Entry.MaterialName = null;
|
||||||
|
Entry.ManufacturerMaterialName = null;
|
||||||
|
Entry.ShelfLife = null;
|
||||||
|
RaisePropertyChanged(nameof(Entry));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ClearWeightRecordSelection()
|
||||||
|
{
|
||||||
|
if (Entry == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Entry.WeightRecordId = null;
|
||||||
|
Entry.BillNo = null;
|
||||||
|
Entry.SupplierId = null;
|
||||||
|
Entry.SupplierName = null;
|
||||||
|
RaisePropertyChanged(nameof(Entry));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void RecalculateShelfLife(MesMixerMaterial? material)
|
||||||
|
{
|
||||||
|
if (Entry == null || material?.ShelfLifeDays == null || material.ShelfLifeDays <= 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Entry.ShelfLife = DateTime.Now.Date.AddDays(material.ShelfLifeDays.Value).ToString("yyyy-MM-dd");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void RecalculatePortionWeight()
|
||||||
|
{
|
||||||
|
if (Entry == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Entry.TotalWeight.HasValue && Entry.TotalPortions.HasValue && Entry.TotalPortions.Value > 0)
|
||||||
|
{
|
||||||
|
Entry.PortionWeight = Math.Round(Entry.TotalWeight.Value / Entry.TotalPortions.Value, 2, MidpointRounding.AwayFromZero);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Entry.PortionWeight = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ApplyDefaultEntryStatusForAdd()
|
||||||
|
{
|
||||||
|
if (!IsAddMode || Entry == null || !string.IsNullOrWhiteSpace(Entry.Status))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var pending = StatusOptions.FirstOrDefault(x =>
|
||||||
|
string.Equals(x.Key?.Trim(), "待处理", StringComparison.OrdinalIgnoreCase));
|
||||||
|
if (!string.IsNullOrWhiteSpace(pending.Value))
|
||||||
|
{
|
||||||
|
Entry.Status = pending.Value;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 字典未就绪时使用常见默认值
|
||||||
|
Entry.Status = "0";
|
||||||
|
}
|
||||||
|
|
||||||
|
private void InitializeSplitCodeDetailsFromEntry()
|
||||||
|
{
|
||||||
|
SplitCodeDetails.Clear();
|
||||||
|
SplitCodeDetails.Add(new RawMaterialSplitDetailItem
|
||||||
|
{
|
||||||
|
Portions = Entry?.TotalPortions,
|
||||||
|
PortionWeight = Entry?.PortionWeight,
|
||||||
|
PortionPackages = Entry?.PortionPackages,
|
||||||
|
WarehouseLocation = Entry?.WarehouseLocation
|
||||||
|
});
|
||||||
|
RaisePropertyChanged(nameof(SplitCodeTableHeight));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddSplitDetailRow()
|
||||||
|
{
|
||||||
|
SplitCodeDetails.Add(new RawMaterialSplitDetailItem());
|
||||||
|
RaisePropertyChanged(nameof(SplitCodeTableHeight));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void RemoveSplitDetailRow(RawMaterialSplitDetailItem? item)
|
||||||
|
{
|
||||||
|
if (item == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
SplitCodeDetails.Remove(item);
|
||||||
|
if (SplitCodeDetails.Count == 0)
|
||||||
|
{
|
||||||
|
SplitCodeDetails.Add(new RawMaterialSplitDetailItem());
|
||||||
|
}
|
||||||
|
RaisePropertyChanged(nameof(SplitCodeTableHeight));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ApplyFirstSplitDetailToEntry()
|
||||||
|
{
|
||||||
|
if (Entry == null || SplitCodeDetails.Count == 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var first = SplitCodeDetails[0];
|
||||||
|
Entry.TotalPortions = first.Portions;
|
||||||
|
Entry.PortionWeight = first.PortionWeight;
|
||||||
|
Entry.PortionPackages = first.PortionPackages;
|
||||||
|
Entry.WarehouseLocation = first.WarehouseLocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
private double CalculateSplitCodeTableHeight()
|
||||||
|
{
|
||||||
|
const double headerHeight = 36d;
|
||||||
|
const double rowHeight = 36d;
|
||||||
|
const double framePadding = 16d;
|
||||||
|
const double minRows = 1d;
|
||||||
|
const double maxRows = 6d;
|
||||||
|
var rowCount = Math.Clamp(SplitCodeDetails.Count, (int)minRows, (int)maxRows);
|
||||||
|
return headerHeight + rowCount * rowHeight + framePadding;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class RawMaterialSplitDetailItem : BindableBase
|
||||||
|
{
|
||||||
|
private int? _portions;
|
||||||
|
public int? Portions
|
||||||
|
{
|
||||||
|
get => _portions;
|
||||||
|
set => SetProperty(ref _portions, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private double? _portionWeight;
|
||||||
|
public double? PortionWeight
|
||||||
|
{
|
||||||
|
get => _portionWeight;
|
||||||
|
set => SetProperty(ref _portionWeight, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private int? _portionPackages;
|
||||||
|
public int? PortionPackages
|
||||||
|
{
|
||||||
|
get => _portionPackages;
|
||||||
|
set => SetProperty(ref _portionPackages, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private string? _warehouseLocation;
|
||||||
|
public string? WarehouseLocation
|
||||||
|
{
|
||||||
|
get => _warehouseLocation;
|
||||||
|
set => SetProperty(ref _warehouseLocation, value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,9 @@ using YY.Admin.Core.Events;
|
|||||||
using YY.Admin.Core.Helper;
|
using YY.Admin.Core.Helper;
|
||||||
using YY.Admin.Core.Entity;
|
using YY.Admin.Core.Entity;
|
||||||
using YY.Admin.Core.Services;
|
using YY.Admin.Core.Services;
|
||||||
|
using YY.Admin.Event;
|
||||||
using YY.Admin.Services.Service;
|
using YY.Admin.Services.Service;
|
||||||
|
using YY.Admin.Module;
|
||||||
using YY.Admin.Views.RawMaterialEntry;
|
using YY.Admin.Views.RawMaterialEntry;
|
||||||
|
|
||||||
namespace YY.Admin.ViewModels.RawMaterialEntry;
|
namespace YY.Admin.ViewModels.RawMaterialEntry;
|
||||||
@@ -77,7 +79,7 @@ public class RawMaterialEntryListViewModel : BaseViewModel
|
|||||||
PageNo = 1;
|
PageNo = 1;
|
||||||
await LoadAsync();
|
await LoadAsync();
|
||||||
});
|
});
|
||||||
AddCommand = new DelegateCommand(async () => await ShowAddDialogAsync());
|
AddCommand = new DelegateCommand(OpenAddPage);
|
||||||
EditCommand = new DelegateCommand<MesXslRawMaterialEntry>(async e => await ShowEditDialogAsync(e));
|
EditCommand = new DelegateCommand<MesXslRawMaterialEntry>(async e => await ShowEditDialogAsync(e));
|
||||||
DeleteCommand = new DelegateCommand<MesXslRawMaterialEntry>(async e => await DeleteAsync(e));
|
DeleteCommand = new DelegateCommand<MesXslRawMaterialEntry>(async e => await DeleteAsync(e));
|
||||||
PrevPageCommand = new DelegateCommand(async () => { if (PageNo > 1) { PageNo--; await LoadAsync(); } });
|
PrevPageCommand = new DelegateCommand(async () => { if (PageNo > 1) { PageNo--; await LoadAsync(); } });
|
||||||
@@ -149,16 +151,14 @@ public class RawMaterialEntryListViewModel : BaseViewModel
|
|||||||
finally { IsLoading = false; }
|
finally { IsLoading = false; }
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task ShowAddDialogAsync()
|
private void OpenAddPage()
|
||||||
{
|
{
|
||||||
try
|
_eventAggregator.GetEvent<TabSourceSelectedEvent>().Publish(new TabSource
|
||||||
{
|
{
|
||||||
var result = await HandyControl.Controls.Dialog.Show<RawMaterialEntryEditDialogView>()
|
Name = "新增原料入场记录",
|
||||||
.Initialize<RawMaterialEntryEditDialogViewModel>(vm => vm.InitializeForAdd())
|
Icon = "\ue7ce",
|
||||||
.GetResultAsync<bool>();
|
ViewName = "RawMaterialEntryOperationView"
|
||||||
if (result) await LoadAsync();
|
});
|
||||||
}
|
|
||||||
catch (Exception ex) { Growl.Error($"打开新增对话框失败:{ex.Message}"); }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task ShowEditDialogAsync(MesXslRawMaterialEntry entry)
|
private async Task ShowEditDialogAsync(MesXslRawMaterialEntry entry)
|
||||||
|
|||||||
@@ -0,0 +1,129 @@
|
|||||||
|
using HandyControl.Tools.Extension;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using YY.Admin.Core;
|
||||||
|
using YY.Admin.Core.Entity;
|
||||||
|
using YY.Admin.Core.Services;
|
||||||
|
|
||||||
|
namespace YY.Admin.ViewModels.RawMaterialEntry;
|
||||||
|
|
||||||
|
public class RawMaterialEntryMaterialPickerDialogViewModel : BaseViewModel, IDialogResultable<bool>
|
||||||
|
{
|
||||||
|
private readonly IMixerMaterialService _mixerMaterialService;
|
||||||
|
|
||||||
|
private string? _searchCode;
|
||||||
|
public string? SearchCode
|
||||||
|
{
|
||||||
|
get => _searchCode;
|
||||||
|
set => SetProperty(ref _searchCode, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private string? _searchName;
|
||||||
|
public string? SearchName
|
||||||
|
{
|
||||||
|
get => _searchName;
|
||||||
|
set => SetProperty(ref _searchName, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ObservableCollection<MesMixerMaterial> Materials { get; } = new();
|
||||||
|
|
||||||
|
private MesMixerMaterial? _selectedMaterial;
|
||||||
|
public MesMixerMaterial? SelectedMaterial
|
||||||
|
{
|
||||||
|
get => _selectedMaterial;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref _selectedMaterial, value);
|
||||||
|
ConfirmCommand.RaiseCanExecuteChanged();
|
||||||
|
RaisePropertyChanged(nameof(SelectedMaterialDisplay));
|
||||||
|
RaisePropertyChanged(nameof(HasSelectedMaterial));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string SelectedMaterialDisplay => _selectedMaterial != null
|
||||||
|
? $"[{_selectedMaterial.MaterialCode}] {_selectedMaterial.MaterialName}"
|
||||||
|
: "选中密炼物料后点击「确认选择」";
|
||||||
|
|
||||||
|
public bool HasSelectedMaterial => _selectedMaterial != null;
|
||||||
|
|
||||||
|
private bool _result;
|
||||||
|
public bool Result
|
||||||
|
{
|
||||||
|
get => _result;
|
||||||
|
set => SetProperty(ref _result, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Action? CloseAction { get; set; }
|
||||||
|
|
||||||
|
public DelegateCommand SearchCommand { get; }
|
||||||
|
public DelegateCommand ConfirmCommand { get; }
|
||||||
|
public DelegateCommand CancelCommand { get; }
|
||||||
|
|
||||||
|
public RawMaterialEntryMaterialPickerDialogViewModel(
|
||||||
|
IMixerMaterialService mixerMaterialService,
|
||||||
|
IContainerExtension container,
|
||||||
|
IRegionManager regionManager) : base(container, regionManager)
|
||||||
|
{
|
||||||
|
_mixerMaterialService = mixerMaterialService;
|
||||||
|
SearchCommand = new DelegateCommand(async () => await LoadAsync());
|
||||||
|
ConfirmCommand = new DelegateCommand(Confirm, () => SelectedMaterial != null);
|
||||||
|
CancelCommand = new DelegateCommand(() => CloseAction?.Invoke());
|
||||||
|
_ = LoadAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Initialize(string? materialCode, string? materialName)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrWhiteSpace(materialCode))
|
||||||
|
{
|
||||||
|
SearchCode = materialCode.Trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(materialName))
|
||||||
|
{
|
||||||
|
SearchName = materialName.Trim();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task LoadAsync()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
IsLoading = true;
|
||||||
|
var result = await _mixerMaterialService.PageAsync(
|
||||||
|
1,
|
||||||
|
500,
|
||||||
|
materialCode: SearchCode?.Trim(),
|
||||||
|
materialName: SearchName?.Trim());
|
||||||
|
|
||||||
|
Materials.Clear();
|
||||||
|
foreach (var item in result.Records)
|
||||||
|
{
|
||||||
|
Materials.Add(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(SearchCode))
|
||||||
|
{
|
||||||
|
SelectedMaterial = Materials.FirstOrDefault(x =>
|
||||||
|
string.Equals(x.MaterialCode, SearchCode, StringComparison.OrdinalIgnoreCase));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
Materials.Clear();
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
IsLoading = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Confirm()
|
||||||
|
{
|
||||||
|
if (SelectedMaterial == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Result = true;
|
||||||
|
CloseAction?.Invoke();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
using YY.Admin.Core.Services;
|
||||||
|
using YY.Admin.Services.Service;
|
||||||
|
|
||||||
|
namespace YY.Admin.ViewModels.RawMaterialEntry;
|
||||||
|
|
||||||
|
public class RawMaterialEntryOperationViewModel : RawMaterialEntryEditDialogViewModel
|
||||||
|
{
|
||||||
|
public RawMaterialEntryOperationViewModel(
|
||||||
|
IRawMaterialEntryService entryService,
|
||||||
|
IJeecgDictSyncService dictSyncService,
|
||||||
|
IMixerMaterialService mixerMaterialService,
|
||||||
|
IContainerExtension container,
|
||||||
|
IRegionManager regionManager)
|
||||||
|
: base(entryService, dictSyncService, mixerMaterialService, container, regionManager)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,126 @@
|
|||||||
|
using HandyControl.Tools.Extension;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using YY.Admin.Core;
|
||||||
|
using YY.Admin.Core.Entity;
|
||||||
|
using YY.Admin.Core.Services;
|
||||||
|
|
||||||
|
namespace YY.Admin.ViewModels.RawMaterialEntry;
|
||||||
|
|
||||||
|
public class WeightRecordPickerDialogViewModel : BaseViewModel, IDialogResultable<bool>
|
||||||
|
{
|
||||||
|
private readonly IWeightRecordService _weightRecordService;
|
||||||
|
|
||||||
|
private string? _searchBillNo;
|
||||||
|
public string? SearchBillNo
|
||||||
|
{
|
||||||
|
get => _searchBillNo;
|
||||||
|
set => SetProperty(ref _searchBillNo, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private string? _searchPlateNumber;
|
||||||
|
public string? SearchPlateNumber
|
||||||
|
{
|
||||||
|
get => _searchPlateNumber;
|
||||||
|
set => SetProperty(ref _searchPlateNumber, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ObservableCollection<MesXslWeightRecord> Records { get; } = new();
|
||||||
|
|
||||||
|
private MesXslWeightRecord? _selectedRecord;
|
||||||
|
public MesXslWeightRecord? SelectedRecord
|
||||||
|
{
|
||||||
|
get => _selectedRecord;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref _selectedRecord, value);
|
||||||
|
ConfirmCommand.RaiseCanExecuteChanged();
|
||||||
|
RaisePropertyChanged(nameof(SelectedRecordDisplay));
|
||||||
|
RaisePropertyChanged(nameof(HasSelectedRecord));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string SelectedRecordDisplay => _selectedRecord != null
|
||||||
|
? $"[{_selectedRecord.BillNo}] 供应商:{_selectedRecord.SenderUnit ?? "-"}"
|
||||||
|
: "选中榜单后点击「确认选择」";
|
||||||
|
|
||||||
|
public bool HasSelectedRecord => _selectedRecord != null;
|
||||||
|
|
||||||
|
private bool _result;
|
||||||
|
public bool Result
|
||||||
|
{
|
||||||
|
get => _result;
|
||||||
|
set => SetProperty(ref _result, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Action? CloseAction { get; set; }
|
||||||
|
|
||||||
|
public DelegateCommand SearchCommand { get; }
|
||||||
|
public DelegateCommand ConfirmCommand { get; }
|
||||||
|
public DelegateCommand CancelCommand { get; }
|
||||||
|
|
||||||
|
public WeightRecordPickerDialogViewModel(
|
||||||
|
IWeightRecordService weightRecordService,
|
||||||
|
IContainerExtension container,
|
||||||
|
IRegionManager regionManager) : base(container, regionManager)
|
||||||
|
{
|
||||||
|
_weightRecordService = weightRecordService;
|
||||||
|
SearchCommand = new DelegateCommand(async () => await LoadAsync());
|
||||||
|
ConfirmCommand = new DelegateCommand(Confirm, () => SelectedRecord != null);
|
||||||
|
CancelCommand = new DelegateCommand(() => CloseAction?.Invoke());
|
||||||
|
_ = LoadAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Initialize(string? billNo)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrWhiteSpace(billNo))
|
||||||
|
{
|
||||||
|
SearchBillNo = billNo.Trim();
|
||||||
|
_ = LoadAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task LoadAsync()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
IsLoading = true;
|
||||||
|
var result = await _weightRecordService.PageAsync(
|
||||||
|
1,
|
||||||
|
200,
|
||||||
|
filterBillNo: SearchBillNo?.Trim(),
|
||||||
|
filterPlateNumber: SearchPlateNumber?.Trim(),
|
||||||
|
filterInoutDirection: "1");
|
||||||
|
|
||||||
|
Records.Clear();
|
||||||
|
foreach (var record in result.Records)
|
||||||
|
{
|
||||||
|
Records.Add(record);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(SearchBillNo))
|
||||||
|
{
|
||||||
|
SelectedRecord = Records.FirstOrDefault(x =>
|
||||||
|
string.Equals(x.BillNo, SearchBillNo, StringComparison.OrdinalIgnoreCase));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
Records.Clear();
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
IsLoading = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Confirm()
|
||||||
|
{
|
||||||
|
if (SelectedRecord == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Result = true;
|
||||||
|
CloseAction?.Invoke();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -31,30 +31,46 @@
|
|||||||
<StackPanel x:Name="RootPanel" Margin="24,8,24,8">
|
<StackPanel x:Name="RootPanel" Margin="24,8,24,8">
|
||||||
<hc:Row Gutter="16">
|
<hc:Row Gutter="16">
|
||||||
|
|
||||||
<!-- 密炼物料选择(搜索下拉) -->
|
<!-- 密炼物料选择(弹窗) -->
|
||||||
<hc:Col Span="16">
|
<hc:Col Span="16">
|
||||||
<DockPanel Margin="0,0,0,8" LastChildFill="True">
|
<Grid Margin="0,0,0,8">
|
||||||
<TextBlock DockPanel.Dock="Left" Text="密炼物料" Width="80"
|
<Grid.ColumnDefinitions>
|
||||||
VerticalAlignment="Center"
|
<ColumnDefinition Width="80"/>
|
||||||
Foreground="{DynamicResource PrimaryTextBrush}"/>
|
<ColumnDefinition Width="*"/>
|
||||||
<hc:ComboBox ItemsSource="{Binding MaterialOptions}"
|
<ColumnDefinition Width="60"/>
|
||||||
SelectedItem="{Binding SelectedMaterial}"
|
<ColumnDefinition Width="32"/>
|
||||||
IsEditable="True"
|
</Grid.ColumnDefinitions>
|
||||||
IsTextSearchEnabled="True"
|
<TextBlock Grid.Column="0" Text="密炼物料" VerticalAlignment="Center"
|
||||||
TextSearch.TextPath="MaterialCode"
|
FontSize="14" Foreground="{DynamicResource PrimaryTextBrush}"/>
|
||||||
Height="34"
|
<Border Grid.Column="1" CornerRadius="4" Height="34"
|
||||||
hc:InfoElement.Placeholder="输入物料编码搜索">
|
BorderBrush="{DynamicResource BorderBrush}" BorderThickness="1"
|
||||||
<hc:ComboBox.ItemTemplate>
|
Background="{DynamicResource ThirdlyRegionBrush}">
|
||||||
<DataTemplate>
|
<TextBlock Text="{Binding SelectedMaterialDisplay}" VerticalAlignment="Center"
|
||||||
<TextBlock>
|
Margin="8,0" FontSize="13" TextTrimming="CharacterEllipsis">
|
||||||
<Run Text="{Binding MaterialCode, Mode=OneWay}"/>
|
<TextBlock.Style>
|
||||||
<Run Text=" — "/>
|
<Style TargetType="TextBlock">
|
||||||
<Run Text="{Binding MaterialName, Mode=OneWay}"/>
|
<Setter Property="Foreground" Value="{DynamicResource SecondaryTextBrush}"/>
|
||||||
</TextBlock>
|
<Style.Triggers>
|
||||||
</DataTemplate>
|
<DataTrigger Binding="{Binding HasSelectedMaterial}" Value="True">
|
||||||
</hc:ComboBox.ItemTemplate>
|
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
|
||||||
</hc:ComboBox>
|
</DataTrigger>
|
||||||
</DockPanel>
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</TextBlock.Style>
|
||||||
|
</TextBlock>
|
||||||
|
</Border>
|
||||||
|
<Button Grid.Column="2" Content="选 择"
|
||||||
|
Command="{Binding OpenMaterialPickerCommand}"
|
||||||
|
Style="{StaticResource ButtonPrimary}"
|
||||||
|
Height="34" Margin="6,0,0,0" FontSize="12"/>
|
||||||
|
<Button Grid.Column="3"
|
||||||
|
Command="{Binding ClearMaterialCommand}"
|
||||||
|
Style="{StaticResource ButtonIcon}"
|
||||||
|
Height="34" Width="28" Margin="4,0,0,0" Padding="0"
|
||||||
|
ToolTip="清除物料"
|
||||||
|
Foreground="{DynamicResource SecondaryTextBrush}"
|
||||||
|
hc:IconElement.Geometry="{StaticResource ErrorGeometry}"/>
|
||||||
|
</Grid>
|
||||||
</hc:Col>
|
</hc:Col>
|
||||||
|
|
||||||
<!-- 物料名称(只读回显) -->
|
<!-- 物料名称(只读回显) -->
|
||||||
@@ -106,16 +122,36 @@
|
|||||||
</DockPanel>
|
</DockPanel>
|
||||||
</hc:Col>
|
</hc:Col>
|
||||||
|
|
||||||
<!-- 榜单号 -->
|
<!-- 榜单号(弹窗选择) -->
|
||||||
<hc:Col Span="8">
|
<hc:Col Span="8">
|
||||||
<hc:TextBox Text="{Binding Entry.BillNo, UpdateSourceTrigger=PropertyChanged}"
|
<Grid Margin="0,0,0,8">
|
||||||
Height="34"
|
<Grid.ColumnDefinitions>
|
||||||
hc:InfoElement.Title="榜单号"
|
<ColumnDefinition Width="80"/>
|
||||||
hc:InfoElement.TitleWidth="80"
|
<ColumnDefinition Width="*"/>
|
||||||
hc:InfoElement.TitlePlacement="Left"
|
<ColumnDefinition Width="60"/>
|
||||||
hc:InfoElement.Placeholder="请输入榜单号"
|
<ColumnDefinition Width="32"/>
|
||||||
hc:InfoElement.ShowClearButton="True"
|
</Grid.ColumnDefinitions>
|
||||||
Margin="0,0,0,8"/>
|
<TextBlock Grid.Column="0" Text="榜单号" VerticalAlignment="Center"
|
||||||
|
FontSize="14" Foreground="{DynamicResource PrimaryTextBrush}"/>
|
||||||
|
<Border Grid.Column="1" CornerRadius="4" Height="34"
|
||||||
|
BorderBrush="{DynamicResource BorderBrush}" BorderThickness="1"
|
||||||
|
Background="{DynamicResource ThirdlyRegionBrush}">
|
||||||
|
<TextBlock Text="{Binding Entry.BillNo}" VerticalAlignment="Center"
|
||||||
|
Margin="8,0" FontSize="13" TextTrimming="CharacterEllipsis"
|
||||||
|
Foreground="{DynamicResource PrimaryTextBrush}"/>
|
||||||
|
</Border>
|
||||||
|
<Button Grid.Column="2" Content="选 择"
|
||||||
|
Command="{Binding OpenWeightRecordPickerCommand}"
|
||||||
|
Style="{StaticResource ButtonPrimary}"
|
||||||
|
Height="34" Margin="6,0,0,0" FontSize="12"/>
|
||||||
|
<Button Grid.Column="3"
|
||||||
|
Command="{Binding ClearWeightRecordCommand}"
|
||||||
|
Style="{StaticResource ButtonIcon}"
|
||||||
|
Height="34" Width="28" Margin="4,0,0,0" Padding="0"
|
||||||
|
ToolTip="清除榜单"
|
||||||
|
Foreground="{DynamicResource SecondaryTextBrush}"
|
||||||
|
hc:IconElement.Geometry="{StaticResource ErrorGeometry}"/>
|
||||||
|
</Grid>
|
||||||
</hc:Col>
|
</hc:Col>
|
||||||
|
|
||||||
<!-- 供料客户 -->
|
<!-- 供料客户 -->
|
||||||
@@ -137,8 +173,9 @@
|
|||||||
hc:InfoElement.Title="供应商名称"
|
hc:InfoElement.Title="供应商名称"
|
||||||
hc:InfoElement.TitleWidth="80"
|
hc:InfoElement.TitleWidth="80"
|
||||||
hc:InfoElement.TitlePlacement="Left"
|
hc:InfoElement.TitlePlacement="Left"
|
||||||
hc:InfoElement.Placeholder="请输入供应商名称"
|
hc:InfoElement.Placeholder="根据榜单自动带出"
|
||||||
hc:InfoElement.ShowClearButton="True"
|
hc:InfoElement.ShowClearButton="True"
|
||||||
|
IsReadOnly="True"
|
||||||
Margin="0,0,0,8"/>
|
Margin="0,0,0,8"/>
|
||||||
</hc:Col>
|
</hc:Col>
|
||||||
|
|
||||||
@@ -151,6 +188,7 @@
|
|||||||
hc:InfoElement.TitlePlacement="Left"
|
hc:InfoElement.TitlePlacement="Left"
|
||||||
hc:InfoElement.Placeholder="请输入厂家物料名称"
|
hc:InfoElement.Placeholder="请输入厂家物料名称"
|
||||||
hc:InfoElement.ShowClearButton="True"
|
hc:InfoElement.ShowClearButton="True"
|
||||||
|
IsReadOnly="True"
|
||||||
Margin="0,0,0,8"/>
|
Margin="0,0,0,8"/>
|
||||||
</hc:Col>
|
</hc:Col>
|
||||||
|
|
||||||
@@ -161,14 +199,15 @@
|
|||||||
hc:InfoElement.Title="保质期"
|
hc:InfoElement.Title="保质期"
|
||||||
hc:InfoElement.TitleWidth="80"
|
hc:InfoElement.TitleWidth="80"
|
||||||
hc:InfoElement.TitlePlacement="Left"
|
hc:InfoElement.TitlePlacement="Left"
|
||||||
hc:InfoElement.Placeholder="请输入保质期"
|
hc:InfoElement.Placeholder="自动计算到期日期"
|
||||||
hc:InfoElement.ShowClearButton="True"
|
hc:InfoElement.ShowClearButton="True"
|
||||||
|
IsReadOnly="True"
|
||||||
Margin="0,0,0,8"/>
|
Margin="0,0,0,8"/>
|
||||||
</hc:Col>
|
</hc:Col>
|
||||||
|
|
||||||
<!-- 总重(KG) -->
|
<!-- 总重(KG) -->
|
||||||
<hc:Col Span="8">
|
<hc:Col Span="8">
|
||||||
<hc:NumericUpDown Value="{Binding Entry.TotalWeight}"
|
<hc:NumericUpDown Value="{Binding TotalWeightInput}"
|
||||||
Minimum="0"
|
Minimum="0"
|
||||||
DecimalPlaces="2"
|
DecimalPlaces="2"
|
||||||
Height="34"
|
Height="34"
|
||||||
@@ -182,7 +221,7 @@
|
|||||||
|
|
||||||
<!-- 总份数 -->
|
<!-- 总份数 -->
|
||||||
<hc:Col Span="8">
|
<hc:Col Span="8">
|
||||||
<hc:NumericUpDown Value="{Binding Entry.TotalPortions}"
|
<hc:NumericUpDown Value="{Binding TotalPortionsInput}"
|
||||||
Minimum="0"
|
Minimum="0"
|
||||||
DecimalPlaces="0"
|
DecimalPlaces="0"
|
||||||
Height="34"
|
Height="34"
|
||||||
@@ -204,7 +243,8 @@
|
|||||||
hc:InfoElement.Title="每份总重(KG)"
|
hc:InfoElement.Title="每份总重(KG)"
|
||||||
hc:InfoElement.TitleWidth="80"
|
hc:InfoElement.TitleWidth="80"
|
||||||
hc:InfoElement.TitlePlacement="Left"
|
hc:InfoElement.TitlePlacement="Left"
|
||||||
hc:InfoElement.Placeholder="请输入每份总重"
|
hc:InfoElement.Placeholder="自动按总重/总份数计算"
|
||||||
|
IsReadOnly="True"
|
||||||
Margin="0,0,0,8"/>
|
Margin="0,0,0,8"/>
|
||||||
</hc:Col>
|
</hc:Col>
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,172 @@
|
|||||||
|
<UserControl x:Class="YY.Admin.Views.RawMaterialEntry.RawMaterialEntryMaterialPickerDialogView"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||||
|
xmlns:md="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||||
|
xmlns:prism="http://prismlibrary.com/"
|
||||||
|
prism:ViewModelLocator.AutoWireViewModel="True"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Width="760">
|
||||||
|
|
||||||
|
<Grid Background="{DynamicResource ThirdlyRegionBrush}">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="360"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<hc:SimplePanel Margin="20,16,20,12">
|
||||||
|
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
|
||||||
|
<Border Width="32" Height="32" CornerRadius="6" Background="{DynamicResource PrimaryBrush}" Margin="0,0,10,0">
|
||||||
|
<md:PackIcon Kind="FlaskOutline" Width="18" Height="18" Foreground="White"
|
||||||
|
HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
<TextBlock Text="选择密炼物料" FontSize="16" FontWeight="SemiBold"
|
||||||
|
Foreground="{DynamicResource PrimaryTextBrush}" VerticalAlignment="Center"/>
|
||||||
|
</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="Center"/>
|
||||||
|
</hc:SimplePanel>
|
||||||
|
|
||||||
|
<Border Grid.Row="1" Background="{DynamicResource RegionBrush}" Padding="16,10">
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="80"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<hc:TextBox Text="{Binding SearchCode, UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
hc:InfoElement.Placeholder="输入物料编码搜索..."
|
||||||
|
hc:InfoElement.ShowClearButton="True"
|
||||||
|
Margin="0,0,8,0">
|
||||||
|
<hc:TextBox.InputBindings>
|
||||||
|
<KeyBinding Key="Enter" Command="{Binding SearchCommand}"/>
|
||||||
|
</hc:TextBox.InputBindings>
|
||||||
|
</hc:TextBox>
|
||||||
|
<hc:TextBox Grid.Column="1"
|
||||||
|
Text="{Binding SearchName, UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
hc:InfoElement.Placeholder="输入物料名称搜索..."
|
||||||
|
hc:InfoElement.ShowClearButton="True"
|
||||||
|
Margin="0,0,8,0">
|
||||||
|
<hc:TextBox.InputBindings>
|
||||||
|
<KeyBinding Key="Enter" Command="{Binding SearchCommand}"/>
|
||||||
|
</hc:TextBox.InputBindings>
|
||||||
|
</hc:TextBox>
|
||||||
|
<Button Grid.Column="2" Command="{Binding SearchCommand}"
|
||||||
|
IsEnabled="{Binding IsLoading, Converter={StaticResource Boolean2BooleanReConverter}}"
|
||||||
|
Style="{StaticResource ButtonPrimary}" Height="32">
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<md:PackIcon Kind="Magnify" Width="14" Height="14" VerticalAlignment="Center" Margin="0,0,4,0"/>
|
||||||
|
<TextBlock Text="搜索" FontSize="13" VerticalAlignment="Center"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Button>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<DataGrid x:Name="MaterialsGrid"
|
||||||
|
Grid.Row="2"
|
||||||
|
Margin="16,8,16,0"
|
||||||
|
ItemsSource="{Binding Materials}"
|
||||||
|
SelectedItem="{Binding SelectedMaterial}"
|
||||||
|
AutoGenerateColumns="False"
|
||||||
|
CanUserAddRows="False"
|
||||||
|
CanUserDeleteRows="False"
|
||||||
|
CanUserResizeRows="False"
|
||||||
|
HeadersVisibility="Column"
|
||||||
|
SelectionMode="Single"
|
||||||
|
SelectionUnit="FullRow"
|
||||||
|
IsReadOnly="True"
|
||||||
|
GridLinesVisibility="Horizontal"
|
||||||
|
HorizontalGridLinesBrush="#FFEDEFF2"
|
||||||
|
VerticalGridLinesBrush="Transparent"
|
||||||
|
Background="White"
|
||||||
|
RowBackground="White"
|
||||||
|
AlternatingRowBackground="#FAFCFF"
|
||||||
|
RowHeight="32"
|
||||||
|
ColumnHeaderHeight="34"
|
||||||
|
RowHeaderWidth="0"
|
||||||
|
MouseDoubleClick="MaterialsGrid_MouseDoubleClick">
|
||||||
|
<DataGrid.Resources>
|
||||||
|
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="#EAF3FF"/>
|
||||||
|
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="#1F1F1F"/>
|
||||||
|
<SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightBrushKey}" Color="#EAF3FF"/>
|
||||||
|
<SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightTextBrushKey}" Color="#1F1F1F"/>
|
||||||
|
</DataGrid.Resources>
|
||||||
|
<DataGrid.ColumnHeaderStyle>
|
||||||
|
<Style TargetType="DataGridColumnHeader">
|
||||||
|
<Setter Property="Background" Value="#F5F7FA"/>
|
||||||
|
<Setter Property="Foreground" Value="#606266"/>
|
||||||
|
<Setter Property="FontSize" Value="13"/>
|
||||||
|
<Setter Property="FontWeight" Value="SemiBold"/>
|
||||||
|
<Setter Property="Padding" Value="8,0"/>
|
||||||
|
<Setter Property="BorderBrush" Value="#EBEEF5"/>
|
||||||
|
<Setter Property="BorderThickness" Value="0,0,0,1"/>
|
||||||
|
</Style>
|
||||||
|
</DataGrid.ColumnHeaderStyle>
|
||||||
|
<DataGrid.RowStyle>
|
||||||
|
<Style TargetType="DataGridRow">
|
||||||
|
<Setter Property="Background" Value="White"/>
|
||||||
|
<Setter Property="Foreground" Value="#262626"/>
|
||||||
|
<Setter Property="BorderBrush" Value="#FFEDEFF2"/>
|
||||||
|
<Setter Property="BorderThickness" Value="0,0,0,1"/>
|
||||||
|
<Style.Triggers>
|
||||||
|
<Trigger Property="IsSelected" Value="True">
|
||||||
|
<Setter Property="Background" Value="#EAF3FF"/>
|
||||||
|
<Setter Property="Foreground" Value="#1F1F1F"/>
|
||||||
|
<Setter Property="BorderBrush" Value="#D6E8FF"/>
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="IsMouseOver" Value="True">
|
||||||
|
<Setter Property="Background" Value="#F5F9FF"/>
|
||||||
|
</Trigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</DataGrid.RowStyle>
|
||||||
|
<DataGrid.CellStyle>
|
||||||
|
<Style TargetType="DataGridCell">
|
||||||
|
<Setter Property="BorderThickness" Value="0"/>
|
||||||
|
<Setter Property="Padding" Value="8,0"/>
|
||||||
|
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
|
||||||
|
</Style>
|
||||||
|
</DataGrid.CellStyle>
|
||||||
|
<DataGrid.Columns>
|
||||||
|
<DataGridTextColumn Header="物料编码" Binding="{Binding MaterialCode}" Width="180"/>
|
||||||
|
<DataGridTextColumn Header="物料名称" Binding="{Binding MaterialName}" Width="*"/>
|
||||||
|
<DataGridTextColumn Header="厂家别名" Binding="{Binding AliasName}" Width="150"/>
|
||||||
|
<DataGridTextColumn Header="保质期(天)" Binding="{Binding ShelfLifeDays}" Width="100"/>
|
||||||
|
</DataGrid.Columns>
|
||||||
|
</DataGrid>
|
||||||
|
|
||||||
|
<Border Grid.Row="3" BorderBrush="{DynamicResource BorderBrush}" BorderThickness="0,1,0,0"
|
||||||
|
Padding="16,12">
|
||||||
|
<Grid>
|
||||||
|
<TextBlock VerticalAlignment="Center" FontSize="13" MaxWidth="420"
|
||||||
|
TextTrimming="CharacterEllipsis" HorizontalAlignment="Left"
|
||||||
|
Text="{Binding SelectedMaterialDisplay}">
|
||||||
|
<TextBlock.Style>
|
||||||
|
<Style TargetType="TextBlock">
|
||||||
|
<Setter Property="Foreground" Value="{DynamicResource SecondaryTextBrush}"/>
|
||||||
|
<Style.Triggers>
|
||||||
|
<DataTrigger Binding="{Binding HasSelectedMaterial}" Value="True">
|
||||||
|
<Setter Property="Foreground" Value="{DynamicResource PrimaryBrush}"/>
|
||||||
|
<Setter Property="FontWeight" Value="SemiBold"/>
|
||||||
|
</DataTrigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</TextBlock.Style>
|
||||||
|
</TextBlock>
|
||||||
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
||||||
|
<Button Content="取 消" Command="{Binding CancelCommand}"
|
||||||
|
Style="{StaticResource ButtonDefault}" Width="88" Margin="0,0,12,0" Height="34"/>
|
||||||
|
<Button Content="确认选择" Command="{Binding ConfirmCommand}"
|
||||||
|
Style="{StaticResource ButtonPrimary}" Width="100" Height="34"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using YY.Admin.ViewModels.RawMaterialEntry;
|
||||||
|
|
||||||
|
namespace YY.Admin.Views.RawMaterialEntry;
|
||||||
|
|
||||||
|
public partial class RawMaterialEntryMaterialPickerDialogView : UserControl
|
||||||
|
{
|
||||||
|
public RawMaterialEntryMaterialPickerDialogView()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MaterialsGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
if (DataContext is RawMaterialEntryMaterialPickerDialogViewModel vm && vm.ConfirmCommand.CanExecute())
|
||||||
|
{
|
||||||
|
vm.ConfirmCommand.Execute();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,507 @@
|
|||||||
|
<UserControl x:Class="YY.Admin.Views.RawMaterialEntry.RawMaterialEntryOperationView"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||||
|
xmlns:prism="http://prismlibrary.com/"
|
||||||
|
prism:ViewModelLocator.AutoWireViewModel="True"
|
||||||
|
mc:Ignorable="d">
|
||||||
|
|
||||||
|
<Grid Style="{StaticResource BaseViewStyle}">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<hc:SimplePanel Margin="24,16,24,12">
|
||||||
|
<TextBlock FontSize="18"
|
||||||
|
Foreground="{DynamicResource PrimaryTextBrush}"
|
||||||
|
Text="新增原料入场记录"
|
||||||
|
HorizontalAlignment="Left"
|
||||||
|
VerticalAlignment="Center"/>
|
||||||
|
</hc:SimplePanel>
|
||||||
|
|
||||||
|
<hc:ScrollViewer Grid.Row="1" IsInertiaEnabled="True" HorizontalScrollBarVisibility="Disabled">
|
||||||
|
<StackPanel x:Name="RootPanel" Margin="24,8,24,8">
|
||||||
|
<hc:Row Gutter="16">
|
||||||
|
|
||||||
|
<hc:Col Span="16">
|
||||||
|
<Grid Margin="0,0,0,8">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="80"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="60"/>
|
||||||
|
<ColumnDefinition Width="32"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBlock Grid.Column="0" Text="密炼物料" VerticalAlignment="Center"
|
||||||
|
FontSize="14" Foreground="{DynamicResource PrimaryTextBrush}"/>
|
||||||
|
<Border Grid.Column="1" CornerRadius="4" Height="34"
|
||||||
|
BorderBrush="{DynamicResource BorderBrush}" BorderThickness="1"
|
||||||
|
Background="{DynamicResource ThirdlyRegionBrush}">
|
||||||
|
<TextBlock Text="{Binding SelectedMaterialDisplay}" VerticalAlignment="Center"
|
||||||
|
Margin="8,0" FontSize="13" TextTrimming="CharacterEllipsis">
|
||||||
|
<TextBlock.Style>
|
||||||
|
<Style TargetType="TextBlock">
|
||||||
|
<Setter Property="Foreground" Value="{DynamicResource SecondaryTextBrush}"/>
|
||||||
|
<Style.Triggers>
|
||||||
|
<DataTrigger Binding="{Binding HasSelectedMaterial}" Value="True">
|
||||||
|
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
|
||||||
|
</DataTrigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</TextBlock.Style>
|
||||||
|
</TextBlock>
|
||||||
|
</Border>
|
||||||
|
<Button Grid.Column="2" Content="选 择"
|
||||||
|
Command="{Binding OpenMaterialPickerCommand}"
|
||||||
|
Style="{StaticResource ButtonPrimary}"
|
||||||
|
Height="34" Margin="6,0,0,0" FontSize="12"/>
|
||||||
|
<Button Grid.Column="3"
|
||||||
|
Command="{Binding ClearMaterialCommand}"
|
||||||
|
Style="{StaticResource ButtonIcon}"
|
||||||
|
Height="34" Width="28" Margin="4,0,0,0" Padding="0"
|
||||||
|
ToolTip="清除物料"
|
||||||
|
Foreground="{DynamicResource SecondaryTextBrush}"
|
||||||
|
hc:IconElement.Geometry="{StaticResource ErrorGeometry}"/>
|
||||||
|
</Grid>
|
||||||
|
</hc:Col>
|
||||||
|
|
||||||
|
<hc:Col Span="8">
|
||||||
|
<hc:TextBox Text="{Binding Entry.MaterialName}"
|
||||||
|
Height="34"
|
||||||
|
IsReadOnly="True"
|
||||||
|
hc:InfoElement.Title="物料名称"
|
||||||
|
hc:InfoElement.TitleWidth="80"
|
||||||
|
hc:InfoElement.TitlePlacement="Left"
|
||||||
|
Foreground="{DynamicResource SecondaryTextBrush}"
|
||||||
|
Margin="0,0,0,8"/>
|
||||||
|
</hc:Col>
|
||||||
|
|
||||||
|
<hc:Col Span="8">
|
||||||
|
<hc:TextBox Text="{Binding Entry.Barcode, UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
Height="34"
|
||||||
|
IsReadOnly="True"
|
||||||
|
hc:InfoElement.Title="条码"
|
||||||
|
hc:InfoElement.TitleWidth="80"
|
||||||
|
hc:InfoElement.TitlePlacement="Left"
|
||||||
|
hc:InfoElement.Placeholder="自动生成"
|
||||||
|
hc:InfoElement.ShowClearButton="True"
|
||||||
|
Margin="0,0,0,8"/>
|
||||||
|
</hc:Col>
|
||||||
|
|
||||||
|
<hc:Col Span="8">
|
||||||
|
<hc:TextBox Text="{Binding Entry.BatchNo, UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
Height="34"
|
||||||
|
IsReadOnly="True"
|
||||||
|
hc:InfoElement.Title="批次号"
|
||||||
|
hc:InfoElement.TitleWidth="80"
|
||||||
|
hc:InfoElement.TitlePlacement="Left"
|
||||||
|
hc:InfoElement.Placeholder="自动生成"
|
||||||
|
hc:InfoElement.ShowClearButton="True"
|
||||||
|
Margin="0,0,0,8"/>
|
||||||
|
</hc:Col>
|
||||||
|
|
||||||
|
<hc:Col Span="8">
|
||||||
|
<DockPanel Margin="0,0,0,8" LastChildFill="True">
|
||||||
|
<TextBlock DockPanel.Dock="Left" Text="入场时间" Width="80"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Foreground="{DynamicResource PrimaryTextBrush}"/>
|
||||||
|
<hc:DateTimePicker SelectedDateTime="{Binding Entry.EntryTime}"
|
||||||
|
hc:InfoElement.Placeholder="请选择入场时间"
|
||||||
|
hc:InfoElement.ShowClearButton="True"
|
||||||
|
Height="34"/>
|
||||||
|
</DockPanel>
|
||||||
|
</hc:Col>
|
||||||
|
|
||||||
|
<hc:Col Span="8">
|
||||||
|
<Grid Margin="0,0,0,8">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="80"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="60"/>
|
||||||
|
<ColumnDefinition Width="32"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBlock Grid.Column="0" Text="榜单号" VerticalAlignment="Center"
|
||||||
|
FontSize="14" Foreground="{DynamicResource PrimaryTextBrush}"/>
|
||||||
|
<Border Grid.Column="1" CornerRadius="4" Height="34"
|
||||||
|
BorderBrush="{DynamicResource BorderBrush}" BorderThickness="1"
|
||||||
|
Background="{DynamicResource ThirdlyRegionBrush}">
|
||||||
|
<TextBlock Text="{Binding Entry.BillNo}" VerticalAlignment="Center"
|
||||||
|
Margin="8,0" FontSize="13" TextTrimming="CharacterEllipsis"
|
||||||
|
Foreground="{DynamicResource PrimaryTextBrush}"/>
|
||||||
|
</Border>
|
||||||
|
<Button Grid.Column="2" Content="选 择"
|
||||||
|
Command="{Binding OpenWeightRecordPickerCommand}"
|
||||||
|
Style="{StaticResource ButtonPrimary}"
|
||||||
|
Height="34" Margin="6,0,0,0" FontSize="12"/>
|
||||||
|
<Button Grid.Column="3"
|
||||||
|
Command="{Binding ClearWeightRecordCommand}"
|
||||||
|
Style="{StaticResource ButtonIcon}"
|
||||||
|
Height="34" Width="28" Margin="4,0,0,0" Padding="0"
|
||||||
|
ToolTip="清除榜单"
|
||||||
|
Foreground="{DynamicResource SecondaryTextBrush}"
|
||||||
|
hc:IconElement.Geometry="{StaticResource ErrorGeometry}"/>
|
||||||
|
</Grid>
|
||||||
|
</hc:Col>
|
||||||
|
|
||||||
|
<hc:Col Span="8">
|
||||||
|
<hc:TextBox Text="{Binding Entry.SupplyCustomer, UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
Height="34"
|
||||||
|
hc:InfoElement.Title="供料客户"
|
||||||
|
hc:InfoElement.TitleWidth="80"
|
||||||
|
hc:InfoElement.TitlePlacement="Left"
|
||||||
|
hc:InfoElement.Placeholder="请输入供料客户"
|
||||||
|
hc:InfoElement.ShowClearButton="True"
|
||||||
|
Margin="0,0,0,8"/>
|
||||||
|
</hc:Col>
|
||||||
|
|
||||||
|
<hc:Col Span="8">
|
||||||
|
<hc:TextBox Text="{Binding Entry.SupplierName, UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
Height="34"
|
||||||
|
hc:InfoElement.Title="供应商名称"
|
||||||
|
hc:InfoElement.TitleWidth="80"
|
||||||
|
hc:InfoElement.TitlePlacement="Left"
|
||||||
|
hc:InfoElement.Placeholder="根据榜单自动带出"
|
||||||
|
hc:InfoElement.ShowClearButton="True"
|
||||||
|
IsReadOnly="True"
|
||||||
|
Margin="0,0,0,8"/>
|
||||||
|
</hc:Col>
|
||||||
|
|
||||||
|
<hc:Col Span="8">
|
||||||
|
<hc:TextBox Text="{Binding Entry.ManufacturerMaterialName, UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
Height="34"
|
||||||
|
hc:InfoElement.Title="厂家物料名称"
|
||||||
|
hc:InfoElement.TitleWidth="80"
|
||||||
|
hc:InfoElement.TitlePlacement="Left"
|
||||||
|
hc:InfoElement.Placeholder="自动带出厂家别名"
|
||||||
|
hc:InfoElement.ShowClearButton="True"
|
||||||
|
IsReadOnly="True"
|
||||||
|
Margin="0,0,0,8"/>
|
||||||
|
</hc:Col>
|
||||||
|
|
||||||
|
<hc:Col Span="8">
|
||||||
|
<hc:TextBox Text="{Binding Entry.ShelfLife, UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
Height="34"
|
||||||
|
hc:InfoElement.Title="保质期"
|
||||||
|
hc:InfoElement.TitleWidth="80"
|
||||||
|
hc:InfoElement.TitlePlacement="Left"
|
||||||
|
hc:InfoElement.Placeholder="自动计算到期日期"
|
||||||
|
hc:InfoElement.ShowClearButton="True"
|
||||||
|
IsReadOnly="True"
|
||||||
|
Margin="0,0,0,8"/>
|
||||||
|
</hc:Col>
|
||||||
|
|
||||||
|
<hc:Col Span="8">
|
||||||
|
<hc:NumericUpDown Value="{Binding TotalWeightInput}"
|
||||||
|
Minimum="0"
|
||||||
|
DecimalPlaces="2"
|
||||||
|
Height="34"
|
||||||
|
Style="{StaticResource NumericUpDownPlus}"
|
||||||
|
hc:InfoElement.Title="总重(KG)"
|
||||||
|
hc:InfoElement.TitleWidth="80"
|
||||||
|
hc:InfoElement.TitlePlacement="Left"
|
||||||
|
hc:InfoElement.Placeholder="请输入总重"
|
||||||
|
Margin="0,0,0,8"/>
|
||||||
|
</hc:Col>
|
||||||
|
|
||||||
|
<hc:Col Span="8">
|
||||||
|
<hc:NumericUpDown Value="{Binding TotalPortionsInput}"
|
||||||
|
Minimum="0"
|
||||||
|
DecimalPlaces="0"
|
||||||
|
Height="34"
|
||||||
|
Style="{StaticResource NumericUpDownPlus}"
|
||||||
|
hc:InfoElement.Title="总份数"
|
||||||
|
hc:InfoElement.TitleWidth="80"
|
||||||
|
hc:InfoElement.TitlePlacement="Left"
|
||||||
|
hc:InfoElement.Placeholder="请输入总份数"
|
||||||
|
Margin="0,0,0,8"/>
|
||||||
|
</hc:Col>
|
||||||
|
|
||||||
|
<hc:Col Span="8">
|
||||||
|
<hc:NumericUpDown Value="{Binding Entry.PortionWeight}"
|
||||||
|
Minimum="0"
|
||||||
|
DecimalPlaces="2"
|
||||||
|
Height="34"
|
||||||
|
Style="{StaticResource NumericUpDownPlus}"
|
||||||
|
hc:InfoElement.Title="每份总重(KG)"
|
||||||
|
hc:InfoElement.TitleWidth="80"
|
||||||
|
hc:InfoElement.TitlePlacement="Left"
|
||||||
|
hc:InfoElement.Placeholder="自动按总重/总份数计算"
|
||||||
|
IsReadOnly="True"
|
||||||
|
Margin="0,0,0,8"/>
|
||||||
|
</hc:Col>
|
||||||
|
|
||||||
|
<hc:Col Span="8">
|
||||||
|
<hc:NumericUpDown Value="{Binding Entry.PortionPackages}"
|
||||||
|
Minimum="0"
|
||||||
|
DecimalPlaces="0"
|
||||||
|
Height="34"
|
||||||
|
Style="{StaticResource NumericUpDownPlus}"
|
||||||
|
hc:InfoElement.Title="每份包数"
|
||||||
|
hc:InfoElement.TitleWidth="80"
|
||||||
|
hc:InfoElement.TitlePlacement="Left"
|
||||||
|
hc:InfoElement.Placeholder="请输入每份包数"
|
||||||
|
Margin="0,0,0,8"/>
|
||||||
|
</hc:Col>
|
||||||
|
|
||||||
|
<hc:Col Span="8" Visibility="Collapsed">
|
||||||
|
<hc:ComboBox SelectedValuePath="Value"
|
||||||
|
DisplayMemberPath="Key"
|
||||||
|
ItemsSource="{Binding TestResultOptions}"
|
||||||
|
SelectedValue="{Binding Entry.TestResult}"
|
||||||
|
Height="34"
|
||||||
|
hc:InfoElement.Title="检测结果"
|
||||||
|
hc:InfoElement.TitleWidth="80"
|
||||||
|
hc:InfoElement.TitlePlacement="Left"
|
||||||
|
hc:InfoElement.Placeholder="请选择检测结果"
|
||||||
|
Margin="0,0,0,8"/>
|
||||||
|
</hc:Col>
|
||||||
|
|
||||||
|
<hc:Col Span="8" Visibility="Collapsed">
|
||||||
|
<hc:ComboBox SelectedValuePath="Value"
|
||||||
|
DisplayMemberPath="Key"
|
||||||
|
ItemsSource="{Binding TestStatusOptions}"
|
||||||
|
SelectedValue="{Binding Entry.TestStatus}"
|
||||||
|
Height="34"
|
||||||
|
hc:InfoElement.Title="检测状态"
|
||||||
|
hc:InfoElement.TitleWidth="80"
|
||||||
|
hc:InfoElement.TitlePlacement="Left"
|
||||||
|
hc:InfoElement.Placeholder="请选择检测状态"
|
||||||
|
Margin="0,0,0,8"/>
|
||||||
|
</hc:Col>
|
||||||
|
|
||||||
|
<hc:Col Span="8" Visibility="Collapsed">
|
||||||
|
<hc:ComboBox SelectedValuePath="Value"
|
||||||
|
DisplayMemberPath="Key"
|
||||||
|
ItemsSource="{Binding PrintFlagOptions}"
|
||||||
|
SelectedValue="{Binding Entry.PrintFlag}"
|
||||||
|
Height="34"
|
||||||
|
hc:InfoElement.Title="打印标记"
|
||||||
|
hc:InfoElement.TitleWidth="80"
|
||||||
|
hc:InfoElement.TitlePlacement="Left"
|
||||||
|
hc:InfoElement.Placeholder="请选择打印标记"
|
||||||
|
Margin="0,0,0,8"/>
|
||||||
|
</hc:Col>
|
||||||
|
|
||||||
|
<hc:Col Span="8" Visibility="Collapsed">
|
||||||
|
<hc:ComboBox SelectedValuePath="Value"
|
||||||
|
DisplayMemberPath="Key"
|
||||||
|
ItemsSource="{Binding StockBalanceOptions}"
|
||||||
|
SelectedValue="{Binding Entry.StockBalance}"
|
||||||
|
Height="34"
|
||||||
|
hc:InfoElement.Title="入库结存"
|
||||||
|
hc:InfoElement.TitleWidth="80"
|
||||||
|
hc:InfoElement.TitlePlacement="Left"
|
||||||
|
hc:InfoElement.Placeholder="请选择入库结存"
|
||||||
|
Margin="0,0,0,8"/>
|
||||||
|
</hc:Col>
|
||||||
|
|
||||||
|
<hc:Col Span="8">
|
||||||
|
<hc:TextBox Text="{Binding Entry.WarehouseLocation, UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
Height="34"
|
||||||
|
hc:InfoElement.Title="库位"
|
||||||
|
hc:InfoElement.TitleWidth="80"
|
||||||
|
hc:InfoElement.TitlePlacement="Left"
|
||||||
|
hc:InfoElement.Placeholder="请输入库位"
|
||||||
|
hc:InfoElement.ShowClearButton="True"
|
||||||
|
Margin="0,0,0,8"/>
|
||||||
|
</hc:Col>
|
||||||
|
|
||||||
|
<hc:Col Span="8">
|
||||||
|
<hc:TextBox Text="{Binding Entry.UnloadOperator, UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
Height="34"
|
||||||
|
hc:InfoElement.Title="卸货人"
|
||||||
|
hc:InfoElement.TitleWidth="80"
|
||||||
|
hc:InfoElement.TitlePlacement="Left"
|
||||||
|
hc:InfoElement.Placeholder="请输入卸货人"
|
||||||
|
hc:InfoElement.ShowClearButton="True"
|
||||||
|
Margin="0,0,0,8"/>
|
||||||
|
</hc:Col>
|
||||||
|
|
||||||
|
<hc:Col Span="8">
|
||||||
|
<hc:ComboBox SelectedValuePath="Value"
|
||||||
|
DisplayMemberPath="Key"
|
||||||
|
ItemsSource="{Binding IsSpecialAdoptionOptions}"
|
||||||
|
SelectedValue="{Binding IsSpecialAdoptionValue}"
|
||||||
|
Height="34"
|
||||||
|
hc:InfoElement.Title="是否特采"
|
||||||
|
hc:InfoElement.TitleWidth="80"
|
||||||
|
hc:InfoElement.TitlePlacement="Left"
|
||||||
|
hc:InfoElement.Placeholder="请选择是否特采"
|
||||||
|
Margin="0,0,0,8"/>
|
||||||
|
</hc:Col>
|
||||||
|
|
||||||
|
<hc:Col Span="8">
|
||||||
|
<hc:Col.Style>
|
||||||
|
<Style TargetType="hc:Col">
|
||||||
|
<Setter Property="Visibility" Value="Collapsed"/>
|
||||||
|
<Style.Triggers>
|
||||||
|
<DataTrigger Binding="{Binding IsSpecialAdoptionValue}" Value="1">
|
||||||
|
<Setter Property="Visibility" Value="Visible"/>
|
||||||
|
</DataTrigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</hc:Col.Style>
|
||||||
|
<hc:TextBox Text="{Binding Entry.SpecialAdoptionOperator, UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
Height="34"
|
||||||
|
hc:InfoElement.Title="特采操作人"
|
||||||
|
hc:InfoElement.TitleWidth="80"
|
||||||
|
hc:InfoElement.TitlePlacement="Left"
|
||||||
|
hc:InfoElement.Placeholder="请输入特采操作人"
|
||||||
|
hc:InfoElement.ShowClearButton="True"
|
||||||
|
Margin="0,0,0,8"/>
|
||||||
|
</hc:Col>
|
||||||
|
|
||||||
|
<hc:Col Span="8">
|
||||||
|
<hc:Col.Style>
|
||||||
|
<Style TargetType="hc:Col">
|
||||||
|
<Setter Property="Visibility" Value="Collapsed"/>
|
||||||
|
<Style.Triggers>
|
||||||
|
<DataTrigger Binding="{Binding IsSpecialAdoptionValue}" Value="1">
|
||||||
|
<Setter Property="Visibility" Value="Visible"/>
|
||||||
|
</DataTrigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</hc:Col.Style>
|
||||||
|
<DockPanel Margin="0,0,0,8" LastChildFill="True">
|
||||||
|
<TextBlock DockPanel.Dock="Left" Text="特采时间" Width="80"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Foreground="{DynamicResource PrimaryTextBrush}"/>
|
||||||
|
<hc:DateTimePicker SelectedDateTime="{Binding Entry.SpecialAdoptionTime}"
|
||||||
|
hc:InfoElement.Placeholder="请选择特采时间"
|
||||||
|
hc:InfoElement.ShowClearButton="True"
|
||||||
|
Height="34"/>
|
||||||
|
</DockPanel>
|
||||||
|
</hc:Col>
|
||||||
|
|
||||||
|
<hc:Col Span="8" Visibility="Collapsed">
|
||||||
|
<hc:ComboBox SelectedValuePath="Value"
|
||||||
|
DisplayMemberPath="Key"
|
||||||
|
ItemsSource="{Binding StatusOptions}"
|
||||||
|
SelectedValue="{Binding Entry.Status}"
|
||||||
|
Height="34"
|
||||||
|
hc:InfoElement.Title="状态"
|
||||||
|
hc:InfoElement.TitleWidth="80"
|
||||||
|
hc:InfoElement.TitlePlacement="Left"
|
||||||
|
hc:InfoElement.Placeholder="请选择状态"
|
||||||
|
Margin="0,0,0,8"/>
|
||||||
|
</hc:Col>
|
||||||
|
|
||||||
|
<hc:Col Span="24">
|
||||||
|
<hc:Col.Style>
|
||||||
|
<Style TargetType="hc:Col">
|
||||||
|
<Setter Property="Visibility" Value="Collapsed"/>
|
||||||
|
<Style.Triggers>
|
||||||
|
<DataTrigger Binding="{Binding IsSpecialAdoptionValue}" Value="1">
|
||||||
|
<Setter Property="Visibility" Value="Visible"/>
|
||||||
|
</DataTrigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</hc:Col.Style>
|
||||||
|
<hc:TextBox Text="{Binding Entry.SpecialAdoptionReason, UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
hc:InfoElement.Title="特采原因"
|
||||||
|
hc:InfoElement.TitleWidth="80"
|
||||||
|
hc:InfoElement.TitlePlacement="Left"
|
||||||
|
hc:InfoElement.Placeholder="请输入特采原因"
|
||||||
|
hc:InfoElement.ShowClearButton="True"
|
||||||
|
TextWrapping="Wrap"
|
||||||
|
AcceptsReturn="True"
|
||||||
|
HorizontalAlignment="Stretch"
|
||||||
|
Height="64"
|
||||||
|
VerticalScrollBarVisibility="Auto"
|
||||||
|
Margin="0,0,0,8"/>
|
||||||
|
</hc:Col>
|
||||||
|
|
||||||
|
<hc:Col Span="24">
|
||||||
|
<hc:TextBox Text="{Binding Entry.Remark, UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
hc:InfoElement.Title="备注"
|
||||||
|
hc:InfoElement.TitleWidth="80"
|
||||||
|
hc:InfoElement.TitlePlacement="Left"
|
||||||
|
hc:InfoElement.Placeholder="请输入备注"
|
||||||
|
hc:InfoElement.ShowClearButton="True"
|
||||||
|
TextWrapping="Wrap"
|
||||||
|
AcceptsReturn="True"
|
||||||
|
HorizontalAlignment="Stretch"
|
||||||
|
Height="64"
|
||||||
|
VerticalScrollBarVisibility="Auto"
|
||||||
|
Margin="0,0,0,8"/>
|
||||||
|
</hc:Col>
|
||||||
|
|
||||||
|
</hc:Row>
|
||||||
|
|
||||||
|
<!-- 拆码明细:移出 hc:Row 避免被行高限制裁剪 -->
|
||||||
|
<Border BorderBrush="{DynamicResource BorderBrush}" BorderThickness="1" CornerRadius="6" Padding="12" Margin="0,4,0,8">
|
||||||
|
<StackPanel>
|
||||||
|
<DockPanel Margin="0,0,0,10">
|
||||||
|
<TextBlock Text="拆码明细"
|
||||||
|
FontSize="14"
|
||||||
|
FontWeight="SemiBold"
|
||||||
|
Foreground="{DynamicResource PrimaryTextBrush}"
|
||||||
|
VerticalAlignment="Center"/>
|
||||||
|
<Button DockPanel.Dock="Right"
|
||||||
|
Content="新增明细"
|
||||||
|
Command="{Binding AddSplitDetailCommand}"
|
||||||
|
Style="{StaticResource ButtonPrimary}"
|
||||||
|
Height="30"
|
||||||
|
Padding="10,0"
|
||||||
|
FontSize="12"/>
|
||||||
|
</DockPanel>
|
||||||
|
|
||||||
|
<DataGrid ItemsSource="{Binding SplitCodeDetails}"
|
||||||
|
AutoGenerateColumns="False"
|
||||||
|
CanUserAddRows="False"
|
||||||
|
CanUserDeleteRows="False"
|
||||||
|
CanUserReorderColumns="False"
|
||||||
|
CanUserResizeColumns="False"
|
||||||
|
HeadersVisibility="Column"
|
||||||
|
GridLinesVisibility="Horizontal"
|
||||||
|
HorizontalGridLinesBrush="#FFEDEDED"
|
||||||
|
VerticalGridLinesBrush="Transparent"
|
||||||
|
MinHeight="80"
|
||||||
|
HorizontalScrollBarVisibility="Disabled"
|
||||||
|
VerticalScrollBarVisibility="Disabled"
|
||||||
|
ColumnHeaderStyle="{StaticResource CusDataGridColumnHeaderStyle}"
|
||||||
|
Style="{StaticResource CusDataGridStyle}">
|
||||||
|
<DataGrid.Columns>
|
||||||
|
<DataGridTextColumn Header="份数"
|
||||||
|
Binding="{Binding Portions, UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
Width="80"
|
||||||
|
CellStyle="{StaticResource CusDataGridCellStyle}"/>
|
||||||
|
<DataGridTextColumn Header="每份重量(KG)"
|
||||||
|
Binding="{Binding PortionWeight, UpdateSourceTrigger=PropertyChanged, StringFormat=N2}"
|
||||||
|
Width="130"
|
||||||
|
CellStyle="{StaticResource CusDataGridCellStyle}"/>
|
||||||
|
<DataGridTextColumn Header="每份包数"
|
||||||
|
Binding="{Binding PortionPackages, UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
Width="100"
|
||||||
|
CellStyle="{StaticResource CusDataGridCellStyle}"/>
|
||||||
|
<DataGridTextColumn Header="库位"
|
||||||
|
Binding="{Binding WarehouseLocation, UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
Width="*"
|
||||||
|
CellStyle="{StaticResource CusDataGridCellStyle}"/>
|
||||||
|
<DataGridTemplateColumn Header="操作" Width="90">
|
||||||
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<Button Content="删除"
|
||||||
|
Command="{Binding DataContext.RemoveSplitDetailCommand, RelativeSource={RelativeSource AncestorType=DataGrid}}"
|
||||||
|
CommandParameter="{Binding}"
|
||||||
|
Style="{StaticResource ButtonDanger}"
|
||||||
|
Padding="6,2" Margin="4,2" FontSize="11"/>
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
</DataGrid.Columns>
|
||||||
|
</DataGrid>
|
||||||
|
</StackPanel>
|
||||||
|
</Border>
|
||||||
|
</StackPanel>
|
||||||
|
</hc:ScrollViewer>
|
||||||
|
|
||||||
|
<StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,12,0,20">
|
||||||
|
<Button Content="重置" Command="{Binding ResetCommand}" Style="{StaticResource ButtonDefault}" Margin="0,0,15,0" Width="100"/>
|
||||||
|
<Button Content="保存" Command="{Binding SaveCommand}" Style="{StaticResource ButtonPrimary}" Width="100"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using YY.Admin.ViewModels.RawMaterialEntry;
|
||||||
|
|
||||||
|
namespace YY.Admin.Views.RawMaterialEntry;
|
||||||
|
|
||||||
|
public partial class RawMaterialEntryOperationView : UserControl
|
||||||
|
{
|
||||||
|
private bool _initialized;
|
||||||
|
|
||||||
|
public RawMaterialEntryOperationView()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
Loaded += OnLoaded;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnLoaded(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (_initialized)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (DataContext is RawMaterialEntryEditDialogViewModel vm)
|
||||||
|
{
|
||||||
|
vm.InitializeForAdd();
|
||||||
|
_initialized = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,172 @@
|
|||||||
|
<UserControl x:Class="YY.Admin.Views.RawMaterialEntry.WeightRecordPickerDialogView"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||||
|
xmlns:md="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||||
|
xmlns:prism="http://prismlibrary.com/"
|
||||||
|
prism:ViewModelLocator.AutoWireViewModel="True"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Width="760">
|
||||||
|
|
||||||
|
<Grid Background="{DynamicResource ThirdlyRegionBrush}">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="360"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<hc:SimplePanel Margin="20,16,20,12">
|
||||||
|
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
|
||||||
|
<Border Width="32" Height="32" CornerRadius="6" Background="{DynamicResource PrimaryBrush}" Margin="0,0,10,0">
|
||||||
|
<md:PackIcon Kind="FileDocumentOutline" Width="18" Height="18" Foreground="White"
|
||||||
|
HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
<TextBlock Text="选择榜单号(自动带出供应商)" FontSize="16" FontWeight="SemiBold"
|
||||||
|
Foreground="{DynamicResource PrimaryTextBrush}" VerticalAlignment="Center"/>
|
||||||
|
</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="Center"/>
|
||||||
|
</hc:SimplePanel>
|
||||||
|
|
||||||
|
<Border Grid.Row="1" Background="{DynamicResource RegionBrush}" Padding="16,10">
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="80"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<hc:TextBox Text="{Binding SearchBillNo, UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
hc:InfoElement.Placeholder="输入榜单号搜索..."
|
||||||
|
hc:InfoElement.ShowClearButton="True"
|
||||||
|
Margin="0,0,8,0">
|
||||||
|
<hc:TextBox.InputBindings>
|
||||||
|
<KeyBinding Key="Enter" Command="{Binding SearchCommand}"/>
|
||||||
|
</hc:TextBox.InputBindings>
|
||||||
|
</hc:TextBox>
|
||||||
|
<hc:TextBox Grid.Column="1"
|
||||||
|
Text="{Binding SearchPlateNumber, UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
hc:InfoElement.Placeholder="输入车牌号搜索..."
|
||||||
|
hc:InfoElement.ShowClearButton="True"
|
||||||
|
Margin="0,0,8,0">
|
||||||
|
<hc:TextBox.InputBindings>
|
||||||
|
<KeyBinding Key="Enter" Command="{Binding SearchCommand}"/>
|
||||||
|
</hc:TextBox.InputBindings>
|
||||||
|
</hc:TextBox>
|
||||||
|
<Button Grid.Column="2" Command="{Binding SearchCommand}"
|
||||||
|
IsEnabled="{Binding IsLoading, Converter={StaticResource Boolean2BooleanReConverter}}"
|
||||||
|
Style="{StaticResource ButtonPrimary}" Height="32">
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<md:PackIcon Kind="Magnify" Width="14" Height="14" VerticalAlignment="Center" Margin="0,0,4,0"/>
|
||||||
|
<TextBlock Text="搜索" FontSize="13" VerticalAlignment="Center"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Button>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<DataGrid x:Name="WeightRecordsGrid"
|
||||||
|
Grid.Row="2"
|
||||||
|
Margin="16,8,16,0"
|
||||||
|
ItemsSource="{Binding Records}"
|
||||||
|
SelectedItem="{Binding SelectedRecord}"
|
||||||
|
AutoGenerateColumns="False"
|
||||||
|
CanUserAddRows="False"
|
||||||
|
CanUserDeleteRows="False"
|
||||||
|
CanUserResizeRows="False"
|
||||||
|
HeadersVisibility="Column"
|
||||||
|
SelectionMode="Single"
|
||||||
|
SelectionUnit="FullRow"
|
||||||
|
IsReadOnly="True"
|
||||||
|
GridLinesVisibility="Horizontal"
|
||||||
|
HorizontalGridLinesBrush="#FFEDEFF2"
|
||||||
|
VerticalGridLinesBrush="Transparent"
|
||||||
|
Background="White"
|
||||||
|
RowBackground="White"
|
||||||
|
AlternatingRowBackground="#FAFCFF"
|
||||||
|
RowHeight="32"
|
||||||
|
ColumnHeaderHeight="34"
|
||||||
|
RowHeaderWidth="0"
|
||||||
|
MouseDoubleClick="WeightRecordsGrid_MouseDoubleClick">
|
||||||
|
<DataGrid.Resources>
|
||||||
|
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="#EAF3FF"/>
|
||||||
|
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="#1F1F1F"/>
|
||||||
|
<SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightBrushKey}" Color="#EAF3FF"/>
|
||||||
|
<SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightTextBrushKey}" Color="#1F1F1F"/>
|
||||||
|
</DataGrid.Resources>
|
||||||
|
<DataGrid.ColumnHeaderStyle>
|
||||||
|
<Style TargetType="DataGridColumnHeader">
|
||||||
|
<Setter Property="Background" Value="#F5F7FA"/>
|
||||||
|
<Setter Property="Foreground" Value="#606266"/>
|
||||||
|
<Setter Property="FontSize" Value="13"/>
|
||||||
|
<Setter Property="FontWeight" Value="SemiBold"/>
|
||||||
|
<Setter Property="Padding" Value="8,0"/>
|
||||||
|
<Setter Property="BorderBrush" Value="#EBEEF5"/>
|
||||||
|
<Setter Property="BorderThickness" Value="0,0,0,1"/>
|
||||||
|
</Style>
|
||||||
|
</DataGrid.ColumnHeaderStyle>
|
||||||
|
<DataGrid.RowStyle>
|
||||||
|
<Style TargetType="DataGridRow">
|
||||||
|
<Setter Property="Background" Value="White"/>
|
||||||
|
<Setter Property="Foreground" Value="#262626"/>
|
||||||
|
<Setter Property="BorderBrush" Value="#FFEDEFF2"/>
|
||||||
|
<Setter Property="BorderThickness" Value="0,0,0,1"/>
|
||||||
|
<Style.Triggers>
|
||||||
|
<Trigger Property="IsSelected" Value="True">
|
||||||
|
<Setter Property="Background" Value="#EAF3FF"/>
|
||||||
|
<Setter Property="Foreground" Value="#1F1F1F"/>
|
||||||
|
<Setter Property="BorderBrush" Value="#D6E8FF"/>
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="IsMouseOver" Value="True">
|
||||||
|
<Setter Property="Background" Value="#F5F9FF"/>
|
||||||
|
</Trigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</DataGrid.RowStyle>
|
||||||
|
<DataGrid.CellStyle>
|
||||||
|
<Style TargetType="DataGridCell">
|
||||||
|
<Setter Property="BorderThickness" Value="0"/>
|
||||||
|
<Setter Property="Padding" Value="8,0"/>
|
||||||
|
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
|
||||||
|
</Style>
|
||||||
|
</DataGrid.CellStyle>
|
||||||
|
<DataGrid.Columns>
|
||||||
|
<DataGridTextColumn Header="榜单号" Binding="{Binding BillNo}" Width="180"/>
|
||||||
|
<DataGridTextColumn Header="车牌号" Binding="{Binding PlateNumber}" Width="120"/>
|
||||||
|
<DataGridTextColumn Header="供应商(发货单位)" Binding="{Binding SenderUnit}" Width="*"/>
|
||||||
|
<DataGridTextColumn Header="称重日期" Binding="{Binding WeighDate, StringFormat='yyyy-MM-dd'}" Width="120"/>
|
||||||
|
</DataGrid.Columns>
|
||||||
|
</DataGrid>
|
||||||
|
|
||||||
|
<Border Grid.Row="3" BorderBrush="{DynamicResource BorderBrush}" BorderThickness="0,1,0,0"
|
||||||
|
Padding="16,12">
|
||||||
|
<Grid>
|
||||||
|
<TextBlock VerticalAlignment="Center" FontSize="13" MaxWidth="420"
|
||||||
|
TextTrimming="CharacterEllipsis" HorizontalAlignment="Left"
|
||||||
|
Text="{Binding SelectedRecordDisplay}">
|
||||||
|
<TextBlock.Style>
|
||||||
|
<Style TargetType="TextBlock">
|
||||||
|
<Setter Property="Foreground" Value="{DynamicResource SecondaryTextBrush}"/>
|
||||||
|
<Style.Triggers>
|
||||||
|
<DataTrigger Binding="{Binding HasSelectedRecord}" Value="True">
|
||||||
|
<Setter Property="Foreground" Value="{DynamicResource PrimaryBrush}"/>
|
||||||
|
<Setter Property="FontWeight" Value="SemiBold"/>
|
||||||
|
</DataTrigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</TextBlock.Style>
|
||||||
|
</TextBlock>
|
||||||
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
||||||
|
<Button Content="取 消" Command="{Binding CancelCommand}"
|
||||||
|
Style="{StaticResource ButtonDefault}" Width="88" Margin="0,0,12,0" Height="34"/>
|
||||||
|
<Button Content="确认选择" Command="{Binding ConfirmCommand}"
|
||||||
|
Style="{StaticResource ButtonPrimary}" Width="100" Height="34"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using YY.Admin.ViewModels.RawMaterialEntry;
|
||||||
|
|
||||||
|
namespace YY.Admin.Views.RawMaterialEntry;
|
||||||
|
|
||||||
|
public partial class WeightRecordPickerDialogView : UserControl
|
||||||
|
{
|
||||||
|
public WeightRecordPickerDialogView()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void WeightRecordsGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
if (DataContext is WeightRecordPickerDialogViewModel vm && vm.ConfirmCommand.CanExecute())
|
||||||
|
{
|
||||||
|
vm.ConfirmCommand.Execute();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user