SVN-Revision: r859
This commit is contained in:
wyf
2025-07-16 02:53:14 +00:00
parent c21c084397
commit eb41c7c1e4
3 changed files with 207 additions and 6 deletions
+9 -1
View File
@@ -54,6 +54,10 @@ namespace Lskj.PubBomAlter
/// 验证的语句
/// </summary>
public string VerifySql;
/// <summary>
/// 反写确认按钮
/// </summary>
public string AllowFxBtn;
public override string[] OtherParams()
{
return this.Params;
@@ -74,8 +78,12 @@ namespace Lskj.PubBomAlter
{
base.ModuleCode = args[6];
}
if (args.Length > 7 && !string.IsNullOrWhiteSpace(args[7]))
{
SaveSql = args[7];
}
if (args.Length > 8 && !string.IsNullOrWhiteSpace(args[8]))
{
SaveSql = args[8];
AllowFxBtn = args[8] + "";
}
+36 -5
View File
@@ -50,6 +50,8 @@ namespace Lskj.PubBomAlter
this.btnPmsSave = new DevExpress.XtraEditors.SimpleButton();
this.rightDetailPanel = new System.Windows.Forms.Panel();
this.gcDetailControlEx = new Lskj.Control.GridControlEx();
this.pl_buttomflow = new System.Windows.Forms.FlowLayoutPanel();
this.btnFxSave = new DevExpress.XtraEditors.SimpleButton();
((System.ComponentModel.ISupportInitialize)(this.splitRightContainer)).BeginInit();
this.splitRightContainer.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitControlContainer)).BeginInit();
@@ -69,6 +71,7 @@ namespace Lskj.PubBomAlter
((System.ComponentModel.ISupportInitialize)(this.panelControl1)).BeginInit();
this.panelControl1.SuspendLayout();
this.rightDetailPanel.SuspendLayout();
this.pl_buttomflow.SuspendLayout();
this.SuspendLayout();
//
// scrollableControl
@@ -140,14 +143,14 @@ namespace Lskj.PubBomAlter
this.treeGridControlEx.Name = "treeGridControlEx";
this.treeGridControlEx.SiftEnumObj = Lskj.Control.GridControlEx.HeaderSiftEnum.Sum;
this.treeGridControlEx.Size = new System.Drawing.Size(376, 500);
this.treeGridControlEx.SysModel = null;
this.treeGridControlEx.TabIndex = 29;
//
// pl_buttom
//
this.pl_buttom.Appearance.BackColor = System.Drawing.Color.Transparent;
this.pl_buttom.Appearance.Options.UseBackColor = true;
this.pl_buttom.Controls.Add(this.btnApply);
this.pl_buttom.Controls.Add(this.btnSave);
this.pl_buttom.Controls.Add(this.pl_buttomflow);
this.pl_buttom.Dock = System.Windows.Forms.DockStyle.Bottom;
this.pl_buttom.Location = new System.Drawing.Point(2, 529);
this.pl_buttom.Margin = new System.Windows.Forms.Padding(2);
@@ -160,7 +163,7 @@ namespace Lskj.PubBomAlter
this.btnApply.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnApply.Appearance.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnApply.Appearance.Options.UseFont = true;
this.btnApply.Location = new System.Drawing.Point(214, 5);
this.btnApply.Location = new System.Drawing.Point(211, 3);
this.btnApply.Name = "btnApply";
this.btnApply.Size = new System.Drawing.Size(80, 26);
this.btnApply.TabIndex = 41;
@@ -171,7 +174,7 @@ namespace Lskj.PubBomAlter
this.btnSave.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnSave.Appearance.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnSave.Appearance.Options.UseFont = true;
this.btnSave.Location = new System.Drawing.Point(300, 5);
this.btnSave.Location = new System.Drawing.Point(297, 3);
this.btnSave.Name = "btnSave";
this.btnSave.Size = new System.Drawing.Size(72, 26);
this.btnSave.TabIndex = 40;
@@ -277,6 +280,7 @@ namespace Lskj.PubBomAlter
this.gcMainControlEx.Name = "gcMainControlEx";
this.gcMainControlEx.SiftEnumObj = Lskj.Control.GridControlEx.HeaderSiftEnum.Sum;
this.gcMainControlEx.Size = new System.Drawing.Size(329, 527);
this.gcMainControlEx.SysModel = null;
this.gcMainControlEx.TabIndex = 51;
//
// panelControl1
@@ -321,8 +325,32 @@ namespace Lskj.PubBomAlter
this.gcDetailControlEx.Name = "gcDetailControlEx";
this.gcDetailControlEx.SiftEnumObj = Lskj.Control.GridControlEx.HeaderSiftEnum.Sum;
this.gcDetailControlEx.Size = new System.Drawing.Size(411, 566);
this.gcDetailControlEx.SysModel = null;
this.gcDetailControlEx.TabIndex = 52;
//
// pl_buttomflow
//
this.pl_buttomflow.Controls.Add(this.btnSave);
this.pl_buttomflow.Controls.Add(this.btnApply);
this.pl_buttomflow.Controls.Add(this.btnFxSave);
this.pl_buttomflow.Dock = System.Windows.Forms.DockStyle.Fill;
this.pl_buttomflow.FlowDirection = System.Windows.Forms.FlowDirection.RightToLeft;
this.pl_buttomflow.Location = new System.Drawing.Point(2, 2);
this.pl_buttomflow.Name = "pl_buttomflow";
this.pl_buttomflow.Size = new System.Drawing.Size(372, 31);
this.pl_buttomflow.TabIndex = 1;
//
// btnFxSave
//
this.btnFxSave.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnFxSave.Appearance.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnFxSave.Appearance.Options.UseFont = true;
this.btnFxSave.Location = new System.Drawing.Point(125, 3);
this.btnFxSave.Name = "btnFxSave";
this.btnFxSave.Size = new System.Drawing.Size(80, 26);
this.btnFxSave.TabIndex = 42;
this.btnFxSave.Text = "批量确认";
//
// FrmMain
//
this.Appearance.BackColor = System.Drawing.SystemColors.Control;
@@ -356,6 +384,7 @@ namespace Lskj.PubBomAlter
((System.ComponentModel.ISupportInitialize)(this.panelControl1)).EndInit();
this.panelControl1.ResumeLayout(false);
this.rightDetailPanel.ResumeLayout(false);
this.pl_buttomflow.ResumeLayout(false);
this.ResumeLayout(false);
}
@@ -365,4 +394,6 @@ namespace Lskj.PubBomAlter
private DevExpress.XtraEditors.SplitContainerControl splitRightContainer;
private DevExpress.XtraEditors.SplitContainerControl splitControlContainer;
private DevExpress.XtraEditors.PanelControl topPanel;
private DevExpress.XtraEditors.PanelC
private DevExpress.XtraEditors.PanelControl pl_Bottom;
private System.Windows.Forms.Panel rightDetailPanel;
private DevExpress.XtraEditors.PanelControl
+162
View File
@@ -500,6 +500,22 @@ namespace Lskj.PubBomAlter
/// </summary>
private void InitEvents()
{
if (BomAlterModel.AllowFxBtn.Equals("1"))
{
btnFxSave.Visible = true;
}
else
{
btnFxSave.Visible = false;
}
if (!string.IsNullOrEmpty(BomAlterModel.SaveSql))
{
btnApply.Visible = true;
}
else
{
btnApply.Visible = false;
}
//TreeGridObj.TreeListObj.MouseDoubleClick += OnTreeListObjMouseDoubleClick;
TreeGridObj.TreeListObj.CustomDrawNodeButton += OnTreeListObjCustomDrawNodeButton;
this.splitRightContainer.SplitterPositionChanged += OnSplitMainContainerPositionChanged;
@@ -509,6 +525,7 @@ namespace Lskj.PubBomAlter
this.btnPmsSave.Click += OnBtnPmsSaveClick;
this.btnSave.Click += OnBtnSaveClick;
this.btnApply.Click += OnBtnApplyClick;
this.btnFxSave.Click += OnBtnFxSaveClick;
this.gcDetailControlEx.GridView.DoubleClick += OnGcDetailGridViewDoubleClick;
this.gcDetailControlEx.GridView.SelectionChanged += OnGridViewSelectionChanged;
}
@@ -2007,6 +2024,143 @@ namespace Lskj.PubBomAlter
}
}
/// <summary>
/// 批量反写
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void OnBtnFxSaveClick(object sender, EventArgs e)
{
DataTable sourceTable = treeGridControlEx.GridControl.DataSourceTable();
foreach (DataRow sourceRow in sourceTable.Rows)
{
string xgtigName = $"{sysModel.PrefixKey}xgtig";
if (sourceRow.Table.Columns.Contains(xgtigName) && (sourceRow[xgtigName] + "").Equals("1"))
{
if (sourceTable.Columns.Contains("Plm_lmb_SmartBmFa"))
{
string projectId = sourceRow["Plm_lmb_SmartBmFa"] + "";
if (!string.IsNullOrEmpty(projectId))
{
string specValue = "";
string modelValue = "";
string zhsxValue = "";
string unitValue = "";
string czValue = "";
string nameValue = "";
string sourceSql = GcMainModuleObj.MenuSql;
sourceSql = ReplaceHelper.ReplaceRowParam(sourceRow, sourceSql);
DataTable dataTable = BaseImpl.GetDataTableResult(sourceSql);
List<SysSetModel> controlList = new List<SysSetModel>();
foreach (DataRow item in dataTable.Rows)
{
controlList.Add(new SysSetModel(item));
}
string primaryVlaue = sourceRow["productid"] + "";
DataRow selectSource = BaseImpl.GetDataRowResult(string.Format("select * from p_producttab where productid = '{0}'", primaryVlaue));
if (selectSource == null)
{
primaryVlaue = sourceRow[$"{sysModel.PrefixKey}id"] + "";
selectSource = BaseImpl.GetDataRowResult($"select * from {sysModel.MenuTable} where {sysModel.PrefixKey}id = '{primaryVlaue}'");
}
SysSetModel nameModel = controlList.Where(n => n.OrderId.Equals(1)).FirstOrDefault();
if (nameModel != null)
{
nameValue = selectSource.Table.Columns.Contains(nameModel.DbName) ? selectSource[nameModel.DbName] + "" : "";
}
//反写规格
List<SysSetModel> specModels = controlList.Where(n => n.SpecDbName.Equals(1)).OrderBy(n => n.SpecSort).ToList();
StringBuilder specText = new StringBuilder();
for (int i = 0; i < specModels.Count; i++)
{
SysSetModel specModel = specModels[i];
string value = selectSource.Table.Columns.Contains(specModel.DbName) ? selectSource[specModel.DbName] + "" : "";
if (!string.IsNullOrWhiteSpace(value))
{
if (i == 0)
{
specText.Append(string.Format("{0}{1}{2}", specModel.ConnectorStrGg, value, specModel.EndConnectorStrGg));
}
else
{
specText.Append(string.Format("{0}{1}{2}{3}", specModel.ConnectorStr, specModel.ConnectorStrGg, value, specModel.EndConnectorStrGg));
}
}
}
specValue = specText.ToString();
//反写型号
List<SysSetModel> modelModels = controlList.Where(n => n.ModelDbName.Equals(1)).OrderBy(n => n.ModelSort).ToList();
StringBuilder modelText = new StringBuilder();
for (int i = 0; i < modelModels.Count; i++)
{
SysSetModel modelModel = modelModels[i];
string value = selectSource.Table.Columns.Contains(modelModel.DbName) ? selectSource[modelModel.DbName] + "" : "";
if (!string.IsNullOrWhiteSpace(value))
{
if (i == 0)
{
modelText.Append(string.Format("{0}{1}{2}", modelModel.ConnectorStrGg, value, modelModel.EndConnectorStrGg));
}
else
{
modelText.Append(string.Format("{0}{1}{2}{3}", modelModel.ConnectorStr, modelModel.ConnectorStrGg, value, modelModel.EndConnectorStrGg));
}
}
}
modelValue = modelText.ToString();
//反写综合属性
List<SysSetModel> zhsxModels = controlList.Where(n => n.ZhSxdbName.Equals(1)).OrderBy(n => n.ProDeSort).ToList();
StringBuilder zhsxText = new StringBuilder();
for (int i = 0; i < zhsxModels.Count; i++)
{
SysSetModel zhsxModel = zhsxModels[i];
string value = selectSource.Table.Columns.Contains(zhsxModel.DbName) ? selectSource[zhsxModel.DbName] + "" : "";
if (value.Equals("无"))
{
value = "";
}
if (!string.IsNullOrWhiteSpace(value))
{
if (i == 0)
{
zhsxText.Append(string.Format("{0}{1}{2}", zhsxModel.ConnectorStrZhsx, value, zhsxModel.EndConnectorStrZhsx));
}
else
{
zhsxText.Append(string.Format("{0}{1}{2}{3}", zhsxModel.ConnectorStr, zhsxModel.ConnectorStrZhsx, value, zhsxModel.EndConnectorStrZhsx));
}
}
}
zhsxValue = zhsxText.ToString();
//反写材质属性
List<SysSetModel> czModels = controlList.Where(n => n.CzdbName.Equals(1)).OrderBy(n => n.GradeSort).ToList();
StringBuilder czText = new StringBuilder();
for (int i = 0; i < czModels.Count; i++)
{
SysSetModel czModel = czModels[i];
string value = selectSource.Table.Columns.Contains(czModel.DbName) ? selectSource[czModel.DbName] + "" : "";
if (value.Equals("无"))
{
value = "";
}
if (!string.IsNullOrWhiteSpace(value))
{
if (i == 0)
{
czText.Append(string.Format("{0}{1}{2}", czModel.ConnectorStrCz, value, czModel.EndConnectorStrCz));
}
else
{
czText.Append(string.Format("{0}{1}{2}{3}", czModel.ConnectorStr, czModel.ConnectorStrCz, value, czModel.EndConnectorStrCz));
}
}
}
czValue = czText.ToString();
}
}
}
}
}
/// <summary>
/// 自动刷新
/// </summary>
/// <param name="sender"></param>
@@ -2017,6 +2171,14 @@ namespace Lskj.PubBomAlter
{
SearchObj.SearchGrid();
}
btnFxSave.Enabled = false;
string xgtigName = $"{sysModel.PrefixKey}xgtig";
DataTable sourceTable = treeGridControlEx.GridControl.DataSourceTable();
if (sourceTable != null && sourceTable.Columns.Contains(xgtigName))
{
var selectRows = sourceTable.AsEnumerable().Where(n => (n[xgtigName] + "").Equals("1"));
btnFxSave.Enabled = selectRows.Count() > 0;
}
}
/// <summary>
/// 查询后事件