SVN r1077

SVN-Revision: r1077
This commit is contained in:
cyf
2025-12-15 02:58:20 +00:00
parent 864d78decb
commit f817b0873a
2 changed files with 24 additions and 193 deletions
+16 -166
View File
@@ -113,11 +113,6 @@ namespace Lskj.PubProductSysMge
/// 主表条件类
/// </summary>
public MyControl SearchMainObj;
/// <summary>
/// 表名集合(pl_Top中控件对应保存到的表名)
/// </summary>
public Dictionary<string, ModuleModel> TableNameList = new Dictionary<string, ModuleModel>();
/// <summary>
/// 规格控件
/// </summary>
@@ -556,7 +551,6 @@ namespace Lskj.PubProductSysMge
};
this.ControlList.Clear();
this.TableNameList.Clear();
try
{
if (projectComBoEdit.SelectedItem == "" || treeNode == null) return;
@@ -564,11 +558,7 @@ namespace Lskj.PubProductSysMge
if (treeNode != null && !string.IsNullOrEmpty(projectId))
{
DataTable dataTable = new DataTable();
string dataSourceSql = string.Format(@"select a.*, b.xtTableName,b.hyTableName,b.IsYsZD from p_productsyssettab a
left join P_ProductsysFieldsSetTab b on a.dbname = b.DataFields
where a.groupid = '{0}' and b.modid ='201004_04' and a.ban = 0
order by orderid", projectId);
//dataSourceSql = string.Format(@"select * from p_productsyssettab where groupid = '{0}' and ban = 0 order by orderid", projectId);
string dataSourceSql = string.Format("select * from p_productsyssettab where groupid = '{0}' and ban = 0 order by orderid", projectId);
dataTable = MainImpl.GetDataTableResult(dataSourceSql);
int x = 10;
int y = 10;
@@ -699,21 +689,6 @@ namespace Lskj.PubProductSysMge
baseControl.ReadOnly = setModel.ProhibitEdited;
this.pl_Top.Controls.Add(baseControl);
this.ControlList.Add(setModel);
if (!this.TableNameList.ContainsKey(setModel.SaveModeCode) && !string.IsNullOrWhiteSpace(setModel.SaveModeCode))
{
DataRow modelRow = MainImpl.GetSystemdllTab(setModel.SaveModeCode);//获取模块信息
if (modelRow == null)
{
MessageUtil.Show("模块编号[" + setModel.SaveModeCode + "],配置错误!\r\n该模块信息未找到!");
}
else
{
ModuleModel sysModel = new ModuleModel(modelRow);// 系统模块实体对象
this.TableNameList.Add(setModel.SaveModeCode, sysModel);
}
}
if (x + baseControl.Width + 15 + baseControl.Width > this.splitMainContainer.Panel2.Width)
{
x = 10;
@@ -1061,6 +1036,8 @@ namespace Lskj.PubProductSysMge
string nodeName = this.treeLeftViewEx.TreeView.SelectedNode != null ? this.treeLeftViewEx.TreeView.SelectedNode.Name : "";
this.speciesNoEdit.Text = "";
this.speciesNameEdit.Text = "";
//this.projectComBoEdit.Text = "";
//this.projectComBoEdit.Tag = "";
this.btnUpdate.Enabled = false;
this.btnSave.Enabled = true;
this.MainControlObj.ResetControlValue();
@@ -1068,12 +1045,16 @@ namespace Lskj.PubProductSysMge
this.ControlList.Clear();
try
{
//string projectId = MainImpl.GetResult(string.Format("select BmFaID from P_ProductSpeciesTab where speciesno = '{0}'", e.Node.Name)) + "";
//string projectName = MainImpl.GetResult(string.Format("select ItemName from p_productsyssetGrouptab where id = '{0}'", projectId)) + "";
string sql = "select id,ItemName from p_productsyssetGrouptab where speciesno = '{0}'";
if (!string.IsNullOrWhiteSpace(this.MainModuleObj.TreeClickSchemeSql)) sql = this.MainModuleObj.TreeClickSchemeSql;
DataTable dataTable = MainImpl.GetDataTableResult(string.Format(sql, e.Node.Name));
this.speciesNoEdit.Text = e.Node.Name;
this.speciesNameEdit.Text = e.Node.Text;
//this.projectComBoEdit.Text = projectName;
//this.projectComBoEdit.Tag = projectId;
this.projectComBoEdit.Text = "";
this.projectComBoEdit.Properties.Items.Clear();
if (e.Node.Nodes.Count == 0)
@@ -1100,7 +1081,9 @@ namespace Lskj.PubProductSysMge
{
where = string.Format(" and {0} like '{1}%'", this.ParentUnionField, e.Node.Name);
}
if (this.MainModuleObj.LeafNodeRefresh && e.Node.Nodes.Count != 0) return;
if (nodeName == e.Node.Name)
{
this.SetMainGridView(where, false, false);
@@ -1348,13 +1331,9 @@ namespace Lskj.PubProductSysMge
DataTable tableColumns = BaseImpl.GetTableColumns(this.MainModuleObj.MenuTable);
ControlModel model = this.MainControlObj._models.FirstOrDefault(x => x.FieldName == primaryKey);
string parentValue = this.speciesNoEdit.Text;//this.treeLeftViewEx.TreeView.SelectedNode.Name;
StringBuilder keyBuilder = new StringBuilder();
StringBuilder valueBuilder = new StringBuilder();
List<string> keyList = new List<string>() { "speciesno", "operatorname", "operatedate", "smartbmfa" };
List<BaseUserControl> modelControls = this.pl_Top.Controls.Cast<BaseUserControl>().Where(n => !string.IsNullOrEmpty((n.Tag as SysSetModel).DbName)).OrderBy(n => (n.Tag as SysSetModel).OrderId).ToList();
foreach (BaseUserControl item in modelControls)
{
@@ -1369,19 +1348,12 @@ namespace Lskj.PubProductSysMge
{
}
if (!keyList.Contains(sysSetModel.DbName.ToLower()))
{
if (sysSetModel.IsYsZD)
{
keyList.Add(sysSetModel.DbName.ToLower());
keyBuilder.Append(string.Format("{0},", sysSetModel.DbName));
valueBuilder.Append(string.Format("N'{0}',", fxValue.Replace("'", "''")));
}
}
}
foreach (ControlModel item in MainControlObj.ControlModels)
{
if (!item.IsSave ||
@@ -1424,65 +1396,6 @@ namespace Lskj.PubProductSysMge
int result = BaseModuleImpl.SaveBasePanelData(saveModel);
if (result == 1)
{
//保存附加表信息
foreach (string modeCode in TableNameList.Keys)
{
StringBuilder keyBuilderFb = new StringBuilder();
StringBuilder valueBuilderFb = new StringBuilder();
List<BaseUserControl> modelControlsNew = this.pl_Top.Controls.Cast<BaseUserControl>().Where(n => !string.IsNullOrEmpty((n.Tag as SysSetModel).DbName) && modeCode.Equals((n.Tag as SysSetModel).SaveModeCode)).OrderBy(n => (n.Tag as SysSetModel).OrderId).ToList();
foreach (BaseUserControl item in modelControlsNew)
{
SysSetModel sysSetModel = item.Tag as SysSetModel;
string fxValue = "";
try
{
string controlName = !string.IsNullOrWhiteSpace(sysSetModel.DbName) ? sysSetModel.DbName : sysSetModel.SysName;
fxValue = this.GetControlValue(controlName);
}
catch (Exception)
{
}
if (!keyList.Contains(sysSetModel.DbName.ToLower()))
{
if (!sysSetModel.IsYsZD)
{
keyList.Add(sysSetModel.DbName.ToLower());
keyBuilderFb.Append(string.Format("{0},", sysSetModel.DbName));
valueBuilderFb.Append(string.Format("N'{0}',", fxValue.Replace("'", "''")));
}
}
}
if (!string.IsNullOrWhiteSpace(keyBuilderFb + ""))
{
ModuleModel saveTableModel = TableNameList[modeCode];
string tablename = TableNameList[modeCode].MenuTable;
keyBuilderFb.Append(string.Format("{0},", primaryKey));
valueBuilderFb.Append(string.Format("N'{0}',", saveModel.FaultMsg));
string insertSqlFb = string.Format("insert into {0}({1}) values({2});", saveTableModel.MenuTable, keyBuilderFb.ToString().TrimEnd(','), valueBuilderFb.ToString().TrimEnd(','));
BaseSaveModel saveModelFb = new BaseSaveModel
{
BaseSaveType = SaveType.Add,
BaseSql = insertSqlFb,
KeyField = primaryKey,
FieldValue = primaryValue,
MenuCode = modeCode,
TableName = tablename,
ComfirmFlag = 0,
NewVer = saveTableModel.NewVer
};
int resultFb = BaseModuleImpl.SaveBasePanelData(saveModelFb);
if (resultFb != 1)
{
MessageUtil.Show("附表保存失败" + "\r\n" + saveModelFb.FaultMsg);
}
}
}
if (saveModel.NewVer == 1 && saveModel.BaseSaveType == SaveType.Add)
saveModel.FieldValue = primaryValue = saveModel.FaultMsg;
if (ApiHelper.IsExecEventApi(Interface.Api.OperateEvent.AfterModuleDataChange, saveModel.MenuCode, 0))
@@ -1553,13 +1466,13 @@ namespace Lskj.PubProductSysMge
//string newBillNo = focusRow["productid"] + "";
string primaryKey = BaseImpl.GetBasePrimaryKey(this.Model.ModuleCode);
ControlModel model = this.MainControlObj._models.FirstOrDefault(x => x.FieldName == primaryKey);
string newBillNo = this.MainControlObj.GetControlValue(model.FieldName);
//string parentValue = focusRow["speciesNo"] + "";
string parentValue = this.speciesNoEdit.Text;
//string newBillNo = BaseImpl.GetDefaultValue(model.Default, parentValue);
//string parentValue = focusRow["speciesNo"] + "";
List<string> keyList = new List<string>() { "speciesno", "operatorname", "operatedate", "smartbmfa" };
StringBuilder sqlBuilder = new StringBuilder();
List<BaseUserControl> modelControls = this.pl_Top.Controls.Cast<BaseUserControl>().Where(n => !string.IsNullOrEmpty((n.Tag as SysSetModel).DbName)).OrderBy(n => (n.Tag as SysSetModel).OrderId).ToList();
foreach (BaseUserControl item in modelControls)
{
@@ -1574,17 +1487,11 @@ namespace Lskj.PubProductSysMge
{
}
if (!sysSetModel.DbName.Equals(primaryKey, StringComparison.OrdinalIgnoreCase) && !sysSetModel.DbName.Equals("productid", StringComparison.OrdinalIgnoreCase))
{
if (sysSetModel.IsYsZD)
{
keyList.Add(sysSetModel.DbName.ToLower());
sqlBuilder.Append(string.Format("{0} = N'{1}',", sysSetModel.DbName, fxValue.Replace("'", "''")));
}
}
}
foreach (ControlModel item in this.MainControlObj.ControlModels)
{
if (!item.IsSave ||
@@ -1634,62 +1541,6 @@ namespace Lskj.PubProductSysMge
int result = BaseModuleImpl.SaveBasePanelData(saveModel);
if (result == 1)
{
foreach (string modeCode in TableNameList.Keys)
{
StringBuilder sqlBuilderFb = new StringBuilder();
List<BaseUserControl> modelControlsNew = this.pl_Top.Controls.Cast<BaseUserControl>().Where(n => !string.IsNullOrEmpty((n.Tag as SysSetModel).DbName) && modeCode.Equals((n.Tag as SysSetModel).SaveModeCode)).OrderBy(n => (n.Tag as SysSetModel).OrderId).ToList();
foreach (BaseUserControl item in modelControlsNew)
{
SysSetModel sysSetModel = item.Tag as SysSetModel;
string fxValue = "";
try
{
string controlName = !string.IsNullOrWhiteSpace(sysSetModel.DbName) ? sysSetModel.DbName : sysSetModel.SysName;
fxValue = this.GetControlValue(controlName);
}
catch (Exception)
{
}
if (!sysSetModel.DbName.Equals(primaryKey, StringComparison.OrdinalIgnoreCase) && !sysSetModel.DbName.Equals("productid", StringComparison.OrdinalIgnoreCase))
{
if (!sysSetModel.IsYsZD)
{
keyList.Add(sysSetModel.DbName.ToLower());
sqlBuilderFb.Append(string.Format("{0} = N'{1}',", sysSetModel.DbName, fxValue.Replace("'", "''")));
}
}
}
if (!string.IsNullOrWhiteSpace(sqlBuilderFb + ""))
{
ModuleModel saveTableModel = TableNameList[modeCode];
string tablename = TableNameList[modeCode].MenuTable;
string updateSql = string.Format("update {0} set {1} where {2}='{3}';", tablename, sqlBuilderFb.ToString().TrimEnd(','), primaryKey, newBillNo);
BaseSaveModel saveModelFb = new BaseSaveModel
{
BaseSaveType = SaveType.Update,
BaseSql = updateSql,
KeyField = primaryKey,
FieldValue = newBillNo,
MenuCode = modeCode,
TableName = tablename,
ComfirmFlag = 0,
NewVer = saveTableModel.NewVer
};
int resultFb = BaseModuleImpl.SaveBasePanelData(saveModelFb);
if (resultFb != 1)
{
MessageUtil.Show("附表保存失败" + "\r\n" + saveModelFb.FaultMsg);
}
}
}
if (ApiHelper.IsExecEventApi(Interface.Api.OperateEvent.AfterModuleDataChange, saveModel.MenuCode, 0))
{
ApiHelper apiHelper = new ApiHelper(saveModel.MenuCode, saveModel.FieldValue, saveModel.KeyField, saveModel.TableName, 0);
@@ -1772,10 +1623,9 @@ namespace Lskj.PubProductSysMge
DataRow focusRow = this.gcMain.GridView.GetFocusedDataRow();
if (focusRow == null) return;
string primaryVlaue = focusRow["productid"] + "";
//string projectId = selectSource["SmartBmFa"] + "";
//string speciesNo = selectSource["speciesNo"] + "";
string projectId = BaseImpl.GetResult(string.Format("select SmartBmFa from p_producttab where productid = '{0}'", primaryVlaue)) + "";
string speciesNo = focusRow["speciesNo"] + "";
DataRow selectSource = MainImpl.GetDataRowResult(string.Format("select * from p_producttab where productid = '{0}'", primaryVlaue));
string projectId = selectSource["SmartBmFa"] + "";
string speciesNo = selectSource["speciesNo"] + "";
if (string.IsNullOrEmpty(projectId))
{
MessageUtil.Show("该档案未通过智能编码生成,不支持智能编码修改");
@@ -1826,7 +1676,7 @@ namespace Lskj.PubProductSysMge
foreach (BaseUserControl item in modelControls)
{
SysSetModel sysSetModel = item.Tag as SysSetModel;
string value = focusRow.Table.Columns.Contains(sysSetModel.DbName) ? focusRow[sysSetModel.DbName] + "" : "";
string value = selectSource.Table.Columns.Contains(sysSetModel.DbName) ? selectSource[sysSetModel.DbName] + "" : "";
//double doubleValue;
item.EditText = value;
//if (double.TryParse(value, out doubleValue))
@@ -200,26 +200,11 @@ namespace Lskj.PubProductSysMge.Model
/// 前连接符 (反写材质)
/// </summary>
public string ConnectorStrCz { get; set; }
/// <summary>
// <summary>
/// 后连接符 (反写材质)
/// </summary>
public string EndConnectorStrCz { get; set; }
/// <summary>
/// 系统表
/// </summary>
public string xtModeCode { get; set; }
/// <summary>
/// 行业表
/// </summary>
public string hyModeCode { get; set; }
// <summary>
/// 是否映射
/// </summary>
public bool IsYsZD { get; set; }
// <summary>
/// 具体对应的表
/// </summary>
public string SaveModeCode { get; set; }
public SysSetModel(DataRow rowItem)
{
@@ -277,8 +262,4 @@ namespace Lskj.PubProductSysMge.Model
this.ConnectorStrGg = rowItem.Table.Columns.Contains("ConnectorStrGg") && !string.IsNullOrEmpty(rowItem["ConnectorStrGg"] + "") ? rowItem["ConnectorStrGg"] + "" : "";
this.EndConnectorStrGg = rowItem.Table.Columns.Contains("EndConnectorStrGg") && !string.IsNullOrEmpty(rowItem["EndConnectorStrGg"] + "") ? rowItem["EndConnectorStrGg"] + "" : "";
this.ConnectorStrXh = rowItem.Table.Columns.Contains("ConnectorStrXh") && !string.IsNullOrEmpty(rowItem["ConnectorStrXh"] + "") ? rowItem["ConnectorStrXh"] + "" : "";
this.EndConnectorStrXh = rowItem.Table.Columns.Contains("EndConnectorStrXh") && !string.IsNullOrEmpty(rowItem["EndConnectorStrXh"] + "") ? rowItem["EndConnectorStrXh"] + "" : "";
this.ConnectorStrZhsx = rowItem.Table.Columns.Contains("ConnectorStrZhsx") && !string.IsNullOrEmpty(rowItem["ConnectorStrZhsx"] + "") ? rowItem["ConnectorStrZhsx"] + "" : "";
this.EndConnectorStrZhsx = rowItem.Table.Columns.Contains("EndConnectorStrZhsx") && !string.I
this.ConnectorStrXh = rowItem.Table.Columns.Contains("ConnectorStrXh") && !string.IsNullOrEmpty(rowItem["ConnectorStrXh"] +