SVN-Revision: r718
This commit is contained in:
wyf
2025-06-13 02:09:39 +00:00
parent 033d29a15c
commit 2a5f79e249
+19 -5
View File
@@ -578,6 +578,16 @@ namespace Lskj.PubBomImport
string speciesno = selectRows[0]["BomAddSpeciesNo"] + "";
string productId = selectRows[0]["BomMxMainProduct"] + "";
string oldProductId = selectRows[0]["BomAddOldProductId"] + "";
string guid = "";
ControlModel guidModel = StaticControl.RightMenuMyControl.ControlModels.Where(n => n.LabelText.Equals("唯一编码")).FirstOrDefault();
if (guidModel != null)
{
guid = StaticControl.RightMenuMyControl.GetControlValue(guidModel);
}
if (string.IsNullOrEmpty(guid))
{
throw new Exception($"唯一编码不能为空");
}
GridControlEx gridControlEx = null;
if (StaticControl.BomUnionPage != null && StaticControl.BomUnionPage.Tag is GridControlEx gridDetailControl)
{
@@ -736,11 +746,15 @@ namespace Lskj.PubBomImport
foreach (int bomRowIndex in bomRowIndexs)
{
DataRow dataRow = gridControlEx.GridView.GetDataRow(bomRowIndex);
string sql = $@"insert bom_bgRwTab (productid,appellation,spec,yproductid,yappellation,yspec,xdopname,xddate,comid)
select '{dataRow["productid"] + ""}','{dataRow["appellation"] + ""}','{dataRow["spec"] + ""}',productid,appellation,spec,'{ERPInfo.Instance.UserName}',getdate(),0
from p_producttab where productid = '{dataRow["Yproductid"] + ""}'
and '{dataRow["productid"] + ""}' not in(select productid from bom_bgRwTab where isnull(comid, 0) = 0)";
SqlHelper.ExecuteNonQuery(sql);
string sql = $@"insert bom_bgRwTab (guid,productid,appellation,spec,yproductid,yappellation,yspec,xdopname,xddate,BomOperatorId,comid) OUTPUT INSERTED.BGID
select '{guid}','{dataRow["productid"] + ""}','{dataRow["appellation"] + ""}','{dataRow["spec"] + ""}',productid,appellation,spec,'{ERPInfo.Instance.UserName}',getdate(),(select top 1 OperatorId from bom_billTab WITH (NOLOCK) where productid = '{dataRow["productid"] + ""}'),2
from p_producttab where productid = '{dataRow["Yproductid"] + ""}'";
string insertId = SqlHelper.ExecuteScalar(sql) + "";
string updateSql = $@"update bom_bgRwTab set billdocumentId = (
'BG' + CONVERT(VARCHAR(8), getdate(), 112) + RIGHT('0000' +
CAST((select COUNT(*) FROM bom_bgRwTab WHERE BGID > (select max(BGID) from bom_bgRwTab where XdDate < (CAST(GETDATE() AS DATE))) and BGID <= '{insertId}') AS VARCHAR(4)), 4))
where BGID = '{insertId}'";
SqlHelper.ExecuteNonQuery(updateSql);
}
this.Invoke(new Action(() =>
{