|
@@ -168,14 +168,14 @@ namespace UniformMaterialManagementSystem.ViewModels
|
|
contractList = _contractService.Query(x => !x.ExportStatus && x.Year == App.CurrentUser!.WorkYear)
|
|
contractList = _contractService.Query(x => !x.ExportStatus && x.Year == App.CurrentUser!.WorkYear)
|
|
.Include(x => x.ContractDetails).ThenInclude(x => x.Material)
|
|
.Include(x => x.ContractDetails).ThenInclude(x => x.Material)
|
|
.Include(x => x.Company)
|
|
.Include(x => x.Company)
|
|
- .Include(x => x.PurchaseCompany).ToList();
|
|
|
|
|
|
+ .Include(x => x.PurchaseCompany).OrderBy(x=>x.EditDate).ToList();
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
contractList = _contractService.Query(x => !x.ExportStatus && x.Year == App.CurrentUser!.WorkYear && (x.CompanyGuid == App.CurrentUser.CompanyGuid || x.PurchaseCompanyGuid == App.CurrentUser.CompanyGuid))
|
|
contractList = _contractService.Query(x => !x.ExportStatus && x.Year == App.CurrentUser!.WorkYear && (x.CompanyGuid == App.CurrentUser.CompanyGuid || x.PurchaseCompanyGuid == App.CurrentUser.CompanyGuid))
|
|
.Include(x => x.ContractDetails).ThenInclude(x => x.Material)
|
|
.Include(x => x.ContractDetails).ThenInclude(x => x.Material)
|
|
.Include(x => x.Company)
|
|
.Include(x => x.Company)
|
|
- .Include(x => x.PurchaseCompany).ToList();
|
|
|
|
|
|
+ .Include(x => x.PurchaseCompany).OrderBy(x => x.EditDate).ToList();
|
|
}
|
|
}
|
|
|
|
|
|
UnExportContracts.Clear();
|
|
UnExportContracts.Clear();
|
|
@@ -400,67 +400,80 @@ namespace UniformMaterialManagementSystem.ViewModels
|
|
[RelayCommand]
|
|
[RelayCommand]
|
|
private void DeleteUnExportContract()
|
|
private void DeleteUnExportContract()
|
|
{
|
|
{
|
|
- //if (SelectedUnExportContract == null)
|
|
|
|
- //{
|
|
|
|
- // MessageBox.Show("请选中一行,再进行删除操作!", "提示", MessageBoxButton.OK, MessageBoxImage.Warning);
|
|
|
|
- // return;
|
|
|
|
- //}
|
|
|
|
-
|
|
|
|
- //if (SelectedUnExportContract.ChangedStatus)
|
|
|
|
- //{
|
|
|
|
- // MessageBox.Show("合同正在变更,不可删除!", "提示", MessageBoxButton.OK, MessageBoxImage.Warning);
|
|
|
|
- // return;
|
|
|
|
- //}
|
|
|
|
- /* 确认删除提示 */
|
|
|
|
- //var result = MessageBox.Show($"确认删除材料合同号:{SelectedUnExportContract.ContractNo}的材料采购合同吗?", "提示", MessageBoxButton.OKCancel, MessageBoxImage.Question);
|
|
|
|
- //if (result != MessageBoxResult.OK) return;
|
|
|
|
-
|
|
|
|
- //_contractService?.Delete(x => x.Guid == SelectedUnExportContract.Guid);
|
|
|
|
- //_contractService?.SaveChanges();
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- var selectedContracts = new List<ContractModel>();
|
|
|
|
- var changedContracts = new List<ContractModel>();
|
|
|
|
- foreach (var contract in UnExportContracts)
|
|
|
|
|
|
+ if (SelectedUnExportContract == null)
|
|
{
|
|
{
|
|
- if (!contract.IsSelected) continue;
|
|
|
|
- if (contract.ChangedStatus)
|
|
|
|
- {
|
|
|
|
- changedContracts.Add(contract);
|
|
|
|
- }
|
|
|
|
- else
|
|
|
|
- {
|
|
|
|
- selectedContracts.Add(contract);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (selectedContracts.Count + changedContracts.Count == 0)
|
|
|
|
- {
|
|
|
|
- MessageBox.Show($"没有选中任何行", "提示", MessageBoxButton.OK, MessageBoxImage.Warning);
|
|
|
|
|
|
+ MessageBox.Show("请选中一行,再进行删除操作!", "提示", MessageBoxButton.OK, MessageBoxImage.Warning);
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- if (selectedContracts.Count == 0)
|
|
|
|
|
|
+
|
|
|
|
+ if (SelectedUnExportContract.ChangedStatus)
|
|
{
|
|
{
|
|
- MessageBox.Show($"变更状态的合同不允许删除,请选择未变更的合同进行删除!", "提示", MessageBoxButton.OK, MessageBoxImage.Warning);
|
|
|
|
|
|
+ MessageBox.Show("合同正在变更,不可删除!", "提示", MessageBoxButton.OK, MessageBoxImage.Warning);
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
-
|
|
|
|
/* 确认删除提示 */
|
|
/* 确认删除提示 */
|
|
- var result = MessageBox.Show($"您选中了{selectedContracts.Count + changedContracts.Count}条合同,将有{changedContracts.Count}条合同被删除,确认继续?(变更状态的合同不允许删除)", "提示", MessageBoxButton.OKCancel, MessageBoxImage.Question);
|
|
|
|
|
|
+ var result = MessageBox.Show($"确认删除材料合同号:{SelectedUnExportContract.ContractNo}的材料采购合同吗?", "提示", MessageBoxButton.OKCancel, MessageBoxImage.Question);
|
|
if (result != MessageBoxResult.OK) return;
|
|
if (result != MessageBoxResult.OK) return;
|
|
|
|
|
|
- //删除选中行
|
|
|
|
- foreach (var contract in selectedContracts)
|
|
|
|
- {
|
|
|
|
- _contractService?.Delete(x => x.Guid == contract.Guid);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
+ _contractService?.Delete(x => x.Guid == SelectedUnExportContract.Guid);
|
|
_contractService?.SaveChanges();
|
|
_contractService?.SaveChanges();
|
|
|
|
|
|
|
|
+
|
|
|
|
+ //var selectedContracts = new List<ContractModel>();
|
|
|
|
+ //var changedContracts = new List<ContractModel>();
|
|
|
|
+ //foreach (var contract in UnExportContracts)
|
|
|
|
+ //{
|
|
|
|
+ // if (!contract.IsSelected) continue;
|
|
|
|
+ // if (contract.ChangedStatus)
|
|
|
|
+ // {
|
|
|
|
+ // changedContracts.Add(contract);
|
|
|
|
+ // }
|
|
|
|
+ // else
|
|
|
|
+ // {
|
|
|
|
+ // selectedContracts.Add(contract);
|
|
|
|
+ // }
|
|
|
|
+ //}
|
|
|
|
+
|
|
|
|
+ //if (selectedContracts.Count + changedContracts.Count == 0)
|
|
|
|
+ //{
|
|
|
|
+ // MessageBox.Show($"没有选中任何行", "提示", MessageBoxButton.OK, MessageBoxImage.Warning);
|
|
|
|
+ // return;
|
|
|
|
+ //}
|
|
|
|
+ //if (selectedContracts.Count == 0)
|
|
|
|
+ //{
|
|
|
|
+ // MessageBox.Show($"变更状态的合同不允许删除,请选择未变更的合同进行删除!", "提示", MessageBoxButton.OK, MessageBoxImage.Warning);
|
|
|
|
+ // return;
|
|
|
|
+ //}
|
|
|
|
+
|
|
|
|
+ ///* 确认删除提示 */
|
|
|
|
+ //var result = MessageBox.Show($"您选中了{selectedContracts.Count + changedContracts.Count}条合同,将有{changedContracts.Count}条合同被删除,确认继续?(变更状态的合同不允许删除)", "提示", MessageBoxButton.OKCancel, MessageBoxImage.Question);
|
|
|
|
+ //if (result != MessageBoxResult.OK) return;
|
|
|
|
+
|
|
|
|
+ ////删除选中行
|
|
|
|
+ //foreach (var contract in selectedContracts)
|
|
|
|
+ //{
|
|
|
|
+ // _contractService?.Delete(x => x.Guid == contract.Guid);
|
|
|
|
+ //}
|
|
|
|
+
|
|
|
|
+ //_contractService?.SaveChanges();
|
|
|
|
+
|
|
/* 重新加载数据 */
|
|
/* 重新加载数据 */
|
|
LoadUnExportData();
|
|
LoadUnExportData();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 全部选中或取消全选
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="isChecked"></param>
|
|
|
|
+ [RelayCommand]
|
|
|
|
+ private void SelectAll(bool isChecked)
|
|
|
|
+ {
|
|
|
|
+ foreach (var contract in UnExportContracts)
|
|
|
|
+ {
|
|
|
|
+ contract.IsSelected = isChecked;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
/// <summary>
|
|
/// <summary>
|
|
/// 导出上报附件1
|
|
/// 导出上报附件1
|
|
/// </summary>
|
|
/// </summary>
|
|
@@ -847,7 +860,7 @@ namespace UniformMaterialManagementSystem.ViewModels
|
|
.Include(x => x.Company)
|
|
.Include(x => x.Company)
|
|
.Include(x => x.PurchaseCompany)
|
|
.Include(x => x.PurchaseCompany)
|
|
.Include(x => x.ContractDetails)
|
|
.Include(x => x.ContractDetails)
|
|
- .ThenInclude(d => d.Material).ToList();
|
|
|
|
|
|
+ .ThenInclude(d => d.Material).OrderBy(x => x.EditDate).ToList();
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
@@ -855,7 +868,7 @@ namespace UniformMaterialManagementSystem.ViewModels
|
|
.Include(x => x.Company)
|
|
.Include(x => x.Company)
|
|
.Include(x => x.PurchaseCompany)
|
|
.Include(x => x.PurchaseCompany)
|
|
.Include(x => x.ContractDetails)
|
|
.Include(x => x.ContractDetails)
|
|
- .ThenInclude(d => d.Material).ToList();
|
|
|
|
|
|
+ .ThenInclude(d => d.Material).OrderBy(x => x.EditDate).ToList();
|
|
}
|
|
}
|
|
|
|
|
|
Contracts.Clear();
|
|
Contracts.Clear();
|