SVN r472
SVN-Revision: r472
This commit is contained in:
@@ -235,6 +235,10 @@ namespace Lskj.PubBomImport
|
|||||||
//记录历史版本号
|
//记录历史版本号
|
||||||
string updateHistoryVerSql = @"update bom_BillListTab set historyVer = '{0}' where Billdocument_Id='{1}'";
|
string updateHistoryVerSql = @"update bom_BillListTab set historyVer = '{0}' where Billdocument_Id='{1}'";
|
||||||
SqlHelper.ExecuteNonQuery(string.Format(updateHistoryVerSql, code, childBillNo));
|
SqlHelper.ExecuteNonQuery(string.Format(updateHistoryVerSql, code, childBillNo));
|
||||||
|
//备份Bom清单明细
|
||||||
|
string bakBomListSql = @"delete bom_BillListlogTab where parentProduct = '{0}' and historyVer = (select top 1 historyVer from bom_BillListTab where parentProduct = '{0}');insert into bom_BillListlogTab select * from bom_BillListTab where parentProduct = '{0}';";
|
||||||
|
SqlHelper.ExecuteNonQuery(string.Format(bakBomListSql, code));
|
||||||
|
//更新明细关联版本号
|
||||||
string updateChildVerSql = @"update bom_BillListTab set Ver = (select top 1 billdocument_id from bom_billListTab where ParentProduct = '{0}') where Billdocument_Id = (select top 1 billdocument_id from bom_billListTab where ParentProduct = '{1}') and ProductId='{0}'";
|
string updateChildVerSql = @"update bom_BillListTab set Ver = (select top 1 billdocument_id from bom_billListTab where ParentProduct = '{0}') where Billdocument_Id = (select top 1 billdocument_id from bom_billListTab where ParentProduct = '{1}') and ProductId='{0}'";
|
||||||
SqlHelper.ExecuteNonQuery(string.Format(updateChildVerSql, code, productId));
|
SqlHelper.ExecuteNonQuery(string.Format(updateChildVerSql, code, productId));
|
||||||
SetProcessBar(80, allCount);
|
SetProcessBar(80, allCount);
|
||||||
@@ -455,6 +459,10 @@ namespace Lskj.PubBomImport
|
|||||||
//记录历史版本号
|
//记录历史版本号
|
||||||
string updateHistoryVerSql = @"update bom_BillListTab set historyVer = '{0}' where Billdocument_Id='{1}'";
|
string updateHistoryVerSql = @"update bom_BillListTab set historyVer = '{0}' where Billdocument_Id='{1}'";
|
||||||
SqlHelper.ExecuteNonQuery(string.Format(updateHistoryVerSql, code, childBillNo));
|
SqlHelper.ExecuteNonQuery(string.Format(updateHistoryVerSql, code, childBillNo));
|
||||||
|
//备份Bom清单明细
|
||||||
|
string bakBomListSql = @"delete bom_BillListlogTab where parentProduct = '{0}' and historyVer = (select top 1 historyVer from bom_BillListTab where parentProduct = '{0}');insert into bom_BillListlogTab select * from bom_BillListTab where parentProduct = '{0}';";
|
||||||
|
SqlHelper.ExecuteNonQuery(string.Format(bakBomListSql, code));
|
||||||
|
//更新明细关联版本
|
||||||
string updateChildVerSql = @"update bom_BillListTab set Ver = (select top 1 billdocument_id from bom_billListTab where ParentProduct = '{0}') where Billdocument_Id = (select top 1 billdocument_id from bom_billListTab where ParentProduct = '{1}') and ProductId='{0}'";
|
string updateChildVerSql = @"update bom_BillListTab set Ver = (select top 1 billdocument_id from bom_billListTab where ParentProduct = '{0}') where Billdocument_Id = (select top 1 billdocument_id from bom_billListTab where ParentProduct = '{1}') and ProductId='{0}'";
|
||||||
SqlHelper.ExecuteNonQuery(string.Format(updateChildVerSql, code, productId));
|
SqlHelper.ExecuteNonQuery(string.Format(updateChildVerSql, code, productId));
|
||||||
SetProcessBar(80, allCount);
|
SetProcessBar(80, allCount);
|
||||||
@@ -572,6 +580,7 @@ namespace Lskj.PubBomImport
|
|||||||
parentInfo = new FileInfo(dirPath);
|
parentInfo = new FileInfo(dirPath);
|
||||||
Model = frmMain.Model;
|
Model = frmMain.Model;
|
||||||
string pattern = @"([A-Za-z]+)(\d*)$";
|
string pattern = @"([A-Za-z]+)(\d*)$";
|
||||||
|
string namepattern = @"^(.+?)\s+(.+)$";
|
||||||
//原物料名称
|
//原物料名称
|
||||||
string productCode = sourceRow != null && sourceRow.Table.Columns.Contains(Model.BeforeBomFieldName) ? sourceRow[Model.BeforeBomFieldName] + "" : "";
|
string productCode = sourceRow != null && sourceRow.Table.Columns.Contains(Model.BeforeBomFieldName) ? sourceRow[Model.BeforeBomFieldName] + "" : "";
|
||||||
Match match = Regex.Match(productCode, pattern);
|
Match match = Regex.Match(productCode, pattern);
|
||||||
@@ -581,7 +590,6 @@ namespace Lskj.PubBomImport
|
|||||||
{
|
{
|
||||||
string code = "";
|
string code = "";
|
||||||
string name = "";
|
string name = "";
|
||||||
string namepattern = @"^(.+?)\s+(.+)$";
|
|
||||||
Match namematch = Regex.Match(Path.GetFileNameWithoutExtension(parentInfo.Name).Trim(), namepattern);
|
Match namematch = Regex.Match(Path.GetFileNameWithoutExtension(parentInfo.Name).Trim(), namepattern);
|
||||||
if (namematch.Success)
|
if (namematch.Success)
|
||||||
{
|
{
|
||||||
@@ -596,6 +604,12 @@ namespace Lskj.PubBomImport
|
|||||||
frmMain.FirstRowIndex = index;
|
frmMain.FirstRowIndex = index;
|
||||||
if (code.StartsWith("QD") || code.StartsWith("ZZQD"))
|
if (code.StartsWith("QD") || code.StartsWith("ZZQD"))
|
||||||
{
|
{
|
||||||
|
DataTable historyTable = BaseImpl.GetDataTableResult($"select * from bom_BillListlogTab where ParentProduct = '{productCode}' and historyVer = '{code}'");
|
||||||
|
if (historyTable != null && historyTable.Rows.Count > 0)
|
||||||
|
{
|
||||||
|
//已经存在该版本则不进行任何操作
|
||||||
|
continue;
|
||||||
|
}
|
||||||
FileInfo childInfo = new FileInfo(dirPath);
|
FileInfo childInfo = new FileInfo(dirPath);
|
||||||
if (childInfo != null)
|
if (childInfo != null)
|
||||||
{
|
{
|
||||||
@@ -621,9 +635,6 @@ namespace Lskj.PubBomImport
|
|||||||
SetProcessBar(40, allCount);
|
SetProcessBar(40, allCount);
|
||||||
frmBillInfo.AddOrUpdateBill(masterRow, detailTable);
|
frmBillInfo.AddOrUpdateBill(masterRow, detailTable);
|
||||||
SetProcessBar(60, allCount);
|
SetProcessBar(60, allCount);
|
||||||
//备份Bom清单明细
|
|
||||||
string bakBomListSql = @"delete bom_BillListlogTab where parentProduct = '{0}' and historyVer = (select top 1 historyVer from bom_BillListTab where parentProduct = '{0}');insert into bom_BillListlogTab select * from bom_BillListTab where parentProduct = '{0}';";
|
|
||||||
SqlHelper.ExecuteNonQuery(string.Format(bakBomListSql, productCode));
|
|
||||||
string billNo = "";
|
string billNo = "";
|
||||||
frmBillInfo.BillSave(ref billNo);
|
frmBillInfo.BillSave(ref billNo);
|
||||||
SetProcessBar(80, allCount);
|
SetProcessBar(80, allCount);
|
||||||
@@ -631,6 +642,9 @@ namespace Lskj.PubBomImport
|
|||||||
//记录历史版本号
|
//记录历史版本号
|
||||||
string updateHistoryVerSql = @"update bom_BillListTab set historyVer = '{0}' where Billdocument_Id='{1}'";
|
string updateHistoryVerSql = @"update bom_BillListTab set historyVer = '{0}' where Billdocument_Id='{1}'";
|
||||||
SqlHelper.ExecuteNonQuery(string.Format(updateHistoryVerSql, code, billNo));
|
SqlHelper.ExecuteNonQuery(string.Format(updateHistoryVerSql, code, billNo));
|
||||||
|
//备份Bom清单明细
|
||||||
|
string bakBomListSql = @"delete bom_BillListlogTab where parentProduct = '{0}' and historyVer = (select top 1 historyVer from bom_BillListTab where parentProduct = '{0}');insert into bom_BillListlogTab select * from bom_BillListTab where parentProduct = '{0}';";
|
||||||
|
SqlHelper.ExecuteNonQuery(string.Format(bakBomListSql, productCode));
|
||||||
StaticControl.RightMenuGridView.GridControl.Invoke(new Action(() =>
|
StaticControl.RightMenuGridView.GridControl.Invoke(new Action(() =>
|
||||||
{
|
{
|
||||||
if (sourceRow.Table.Columns.Contains("qms_laddf_RelatedId"))
|
if (sourceRow.Table.Columns.Contains("qms_laddf_RelatedId"))
|
||||||
|
|||||||
Reference in New Issue
Block a user