SVN-Revision: r539
This commit is contained in:
wyf
2025-05-07 08:40:13 +00:00
parent 4bbdcfb69a
commit ffa65eec12
3 changed files with 639 additions and 265 deletions
+44 -1
View File
@@ -548,9 +548,52 @@ namespace Lskj.PubBomImport
{
//更新
DataTable source = this.gcMain.GridControl.DataSourceTable();
List<DataRow> deleteRows = new List<DataRow>();
foreach (DataRow sourceRow in source.Rows)
{
string productId = sourceRow["ProductId"] + "";
DataRow newSourceRow = newSource.Rows.Cast<DataRow>().Where(n => (n["ProductId"] + "").Equals(productId)).FirstOrDefault();
if (newSourceRow != null)
{
sourceRow["tamount"] = newSourceRow["tamount"];
sourceRow["amount"] = newSourceRow["amount"];
newSource.Rows.Remove(newSourceRow);
}
else
{
deleteRows.Add(sourceRow);
}
}
foreach (DataRow deleteRow in deleteRows)
{
source.Rows.Remove(deleteRow);
}
foreach (DataRow newSourceRow in newSource.Rows)
{
DataRow newRow = source.NewRow();
newRow.ItemArray = newSourceRow.ItemArray;
source.Rows.Add(newRow);
}
}
else
{
//新增
this.gcMain.GridControl.DataSource = newSource;
}
}
public void AddOrUpdateBillByZZQD(DataRow rowItem, DataTable newSource)
{
string masterSql = rowItem == null ? billModel.MasterSql.Replace("{" + billModel.PrimaryKey + "}", this.lblOrderNo.Text) : ReplaceHelper.ReplaceRowParam(rowItem, billModel.MasterSql);
// 加载单据信息
DataRow mainRow = BillImpl.GetDataRowResult(masterSql);
this.SetBillStatus(mainRow);
if (!billModel.SaveState)
{
this.InitializeHeader(rowItem);
}
string controlSql = "select '' as billdocument_id,'0' affirmer,'0' rtagid,'{材料代码}' as productid";
if (mainRow != null)
{
//更新
DataTable source = this.gcMain.GridC