|
@@ -391,10 +391,9 @@ namespace UniformMaterialManagementSystem.ViewModels
|
|
// 新增行直接删除
|
|
// 新增行直接删除
|
|
if (CurrDeliveryReceipt.IsNewRow)
|
|
if (CurrDeliveryReceipt.IsNewRow)
|
|
{
|
|
{
|
|
- // todo 直接删除会切换行
|
|
|
|
_isExcute = false;
|
|
_isExcute = false;
|
|
DeliveryReceipts.Remove(CurrDeliveryReceipt);
|
|
DeliveryReceipts.Remove(CurrDeliveryReceipt);
|
|
- //CurrDeliveryReceipt = null;
|
|
|
|
|
|
+ fdgDelivery.Items.Refresh();
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -420,6 +419,7 @@ namespace UniformMaterialManagementSystem.ViewModels
|
|
string currContracNo = CurrDeliveryReceipt.ContractNo;
|
|
string currContracNo = CurrDeliveryReceipt.ContractNo;
|
|
string currProductName = CurrDeliveryReceipt.ProductName;
|
|
string currProductName = CurrDeliveryReceipt.ProductName;
|
|
DeliveryReceipts.Remove(CurrDeliveryReceipt);
|
|
DeliveryReceipts.Remove(CurrDeliveryReceipt);
|
|
|
|
+ fdgDelivery.Items.Refresh();
|
|
|
|
|
|
// 保存到数据库
|
|
// 保存到数据库
|
|
_service.Delete(CurrDeliveryReceipt);
|
|
_service.Delete(CurrDeliveryReceipt);
|
|
@@ -429,7 +429,6 @@ namespace UniformMaterialManagementSystem.ViewModels
|
|
MessageBox.Show("删除失败!");
|
|
MessageBox.Show("删除失败!");
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
-
|
|
|
|
MessageBox.Show("删除成功");
|
|
MessageBox.Show("删除成功");
|
|
|
|
|
|
// 删除后反写到数据库
|
|
// 删除后反写到数据库
|
|
@@ -655,10 +654,8 @@ namespace UniformMaterialManagementSystem.ViewModels
|
|
bool isNeedRollback = true;
|
|
bool isNeedRollback = true;
|
|
try
|
|
try
|
|
{
|
|
{
|
|
- // 需要存在 bin\DataBase 目录,且目录下存在一份 .db 文件,需要存在表
|
|
|
|
- // 选择的发货单导出到 .db 文件:根据主键判断,存在数据则更新,不存在则插入
|
|
|
|
- var deliveries = DeliveryReceipts;
|
|
|
|
- DataBaseUtil.ExportTable(deliveries, "DeliveryReceipts"); // 数据库表名输错会抛出异常,但在本方法里获取不到抛出异常
|
|
|
|
|
|
+ // 选择的发货单导出到 .db 文件:自动迁移数据库
|
|
|
|
+ DataBaseUtil.ExportTable(selectedDeliveries, "DeliveryReceipts", true);
|
|
|
|
|
|
// 选择发货单的明细导出到 .db 文件
|
|
// 选择发货单的明细导出到 .db 文件
|
|
List<DeliveryReceiptDetail> details = new List<DeliveryReceiptDetail>();
|
|
List<DeliveryReceiptDetail> details = new List<DeliveryReceiptDetail>();
|
|
@@ -666,7 +663,7 @@ namespace UniformMaterialManagementSystem.ViewModels
|
|
{
|
|
{
|
|
details.AddRange(delivery.DeliveryReceiptDetails);
|
|
details.AddRange(delivery.DeliveryReceiptDetails);
|
|
}
|
|
}
|
|
- DataBaseUtil.ExportTable(details, "DeliveryReceiptDetails");
|
|
|
|
|
|
+ DataBaseUtil.ExportTable(details, "DeliveryReceiptDetails", false);
|
|
|
|
|
|
// 将选择的数据导出为加密数据包
|
|
// 将选择的数据导出为加密数据包
|
|
string exportPath = DataBaseUtil.ExportData();
|
|
string exportPath = DataBaseUtil.ExportData();
|
|
@@ -909,6 +906,7 @@ namespace UniformMaterialManagementSystem.ViewModels
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ // 未选择行,直接返回
|
|
if (selectedCount == 0) { return; }
|
|
if (selectedCount == 0) { return; }
|
|
|
|
|
|
// 只删除新增行,则更新数据后直接返回
|
|
// 只删除新增行,则更新数据后直接返回
|
|
@@ -919,7 +917,6 @@ namespace UniformMaterialManagementSystem.ViewModels
|
|
CurrDeliveryReceipt.ShippedQty = details.Select(x => x.ShippedQuantity).Sum();
|
|
CurrDeliveryReceipt.ShippedQty = details.Select(x => x.ShippedQuantity).Sum();
|
|
OnPropertyChanged(nameof(CurrDeliveryReceipt));
|
|
OnPropertyChanged(nameof(CurrDeliveryReceipt));
|
|
fdgDeliveryDetail.Items.Refresh(); // 刷新子表索引
|
|
fdgDeliveryDetail.Items.Refresh(); // 刷新子表索引
|
|
-
|
|
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -949,7 +946,6 @@ namespace UniformMaterialManagementSystem.ViewModels
|
|
fdgDeliveryDetail.Items.Refresh();
|
|
fdgDeliveryDetail.Items.Refresh();
|
|
CurrDeliveryReceipt.ShippedPackets = details.Count;
|
|
CurrDeliveryReceipt.ShippedPackets = details.Count;
|
|
CurrDeliveryReceipt.ShippedQty = details.Select(x => x.ShippedQuantity).Sum();
|
|
CurrDeliveryReceipt.ShippedQty = details.Select(x => x.ShippedQuantity).Sum();
|
|
- //OnCurrDeliveryReceiptChanged(CurrDeliveryReceipt);
|
|
|
|
OnPropertyChanged(nameof(CurrDeliveryReceipt));
|
|
OnPropertyChanged(nameof(CurrDeliveryReceipt));
|
|
|
|
|
|
// 保存到数据库
|
|
// 保存到数据库
|
|
@@ -965,7 +961,7 @@ namespace UniformMaterialManagementSystem.ViewModels
|
|
// 删除成功提示
|
|
// 删除成功提示
|
|
MessageBox.Show($"删除 {savedRows.Count} 行已保存行。");
|
|
MessageBox.Show($"删除 {savedRows.Count} 行已保存行。");
|
|
|
|
|
|
- // 反写
|
|
|
|
|
|
+ // 反写合同明细、检验申请明细
|
|
bool isSuccCD = UpdataContractDetail(CurrDeliveryReceipt.ContractNo, CurrDeliveryReceipt.ProductName);
|
|
bool isSuccCD = UpdataContractDetail(CurrDeliveryReceipt.ContractNo, CurrDeliveryReceipt.ProductName);
|
|
bool isSuccAD = UpdateApplyDetail(packBatckNos, false);
|
|
bool isSuccAD = UpdateApplyDetail(packBatckNos, false);
|
|
if (isSuccCD && isSuccAD)
|
|
if (isSuccCD && isSuccAD)
|
|
@@ -1596,7 +1592,7 @@ namespace UniformMaterialManagementSystem.ViewModels
|
|
var details = CurrDeliveryReceipt!.DeliveryReceiptDetails;
|
|
var details = CurrDeliveryReceipt!.DeliveryReceiptDetails;
|
|
if (CurrDeliveryReceipt.ShippedPackets == 0 || CurrDeliveryReceipt.ShippedQty == 0 || details == null || details.Count == 0)
|
|
if (CurrDeliveryReceipt.ShippedPackets == 0 || CurrDeliveryReceipt.ShippedQty == 0 || details == null || details.Count == 0)
|
|
{
|
|
{
|
|
- MessageBox.Show("发货单明细为空,不允许保存!");
|
|
|
|
|
|
+ MessageBox.Show("发运数量 或 发运包数为 0 ,不允许保存!");
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|