SVN r1033
SVN-Revision: r1033
This commit is contained in:
@@ -113,6 +113,11 @@ namespace Lskj.PubProductSysMge
|
||||
/// 主表条件类
|
||||
/// </summary>
|
||||
public MyControl SearchMainObj;
|
||||
/// <summary>
|
||||
/// 表名集合(pl_Top中控件对应保存到的表名)
|
||||
/// </summary>
|
||||
public Dictionary<string,string> TableNameList = new Dictionary<string, string>();
|
||||
|
||||
/// <summary>
|
||||
/// 规格控件
|
||||
/// </summary>
|
||||
@@ -551,6 +556,7 @@ namespace Lskj.PubProductSysMge
|
||||
};
|
||||
|
||||
this.ControlList.Clear();
|
||||
this.TableNameList.Clear();
|
||||
try
|
||||
{
|
||||
if (projectComBoEdit.SelectedItem == "" || treeNode == null) return;
|
||||
@@ -558,7 +564,10 @@ namespace Lskj.PubProductSysMge
|
||||
if (treeNode != null && !string.IsNullOrEmpty(projectId))
|
||||
{
|
||||
DataTable dataTable = new DataTable();
|
||||
string dataSourceSql = string.Format("select * from p_productsyssettab where groupid = '{0}' and ban = 0 order by orderid", projectId);
|
||||
string dataSourceSql = string.Format(@"select a.*, b.xtTableName,b.hyTableName,b.IsYsZD from p_productsyssettab a
|
||||
left join P_ProductsysFieldsSetTab b on a.modid = b.modid and a.SysName = b.DataFields
|
||||
where a.groupid = '{0}' and a.ban = 0
|
||||
order by orderid", projectId);
|
||||
dataTable = MainImpl.GetDataTableResult(dataSourceSql);
|
||||
int x = 10;
|
||||
int y = 10;
|
||||
@@ -689,6 +698,17 @@ namespace Lskj.PubProductSysMge
|
||||
baseControl.ReadOnly = setModel.ProhibitEdited;
|
||||
this.pl_Top.Controls.Add(baseControl);
|
||||
this.ControlList.Add(setModel);
|
||||
if (!this.TableNameList.ContainsKey(setModel.SaveModeCode))
|
||||
{
|
||||
DataRow modelRow = MainImpl.GetSystemdllTab(setModel.SaveModeCode);//获取模块信息
|
||||
if (modelRow == null)
|
||||
{
|
||||
MessageUtil.Show("模块编号[" + setModel.SaveModeCode + "],配置错误!\r\n该模块信息未找到!");
|
||||
}
|
||||
ModuleModel sysModel = new ModuleModel(modelRow);// 系统模块实体对象
|
||||
this.TableNameList.Add(setModel.SaveModeCode, sysModel.MenuTable);
|
||||
}
|
||||
|
||||
if (x + baseControl.Width + 15 + baseControl.Width > this.splitMainContainer.Panel2.Width)
|
||||
{
|
||||
x = 10;
|
||||
@@ -1328,32 +1348,70 @@ 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;
|
||||
//string newBillNo = BaseImpl.GetDefaultValue(model.Default, parentValue);
|
||||
//sqlBuilder.Append(string.Format("delete from bom_BillTab where productid = '{0}'\r\n", newBillNo));
|
||||
//sqlBuilder.Append(string.Format("delete from bom_BillListTab where ParentProduct = '{0}'\r\n", newBillNo));
|
||||
|
||||
|
||||
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)
|
||||
|
||||
foreach (string modeCode in TableNameList.Keys)
|
||||
{
|
||||
SysSetModel sysSetModel = item.Tag as SysSetModel;
|
||||
string fxValue = "";
|
||||
try
|
||||
StringBuilder keyBuilderFb = new StringBuilder();
|
||||
StringBuilder valueBuilderFb = new StringBuilder();
|
||||
List<BaseUserControl> modelControls = 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 modelControls)
|
||||
{
|
||||
string controlName = !string.IsNullOrWhiteSpace(sysSetModel.DbName) ? sysSetModel.DbName : sysSetModel.SysName;
|
||||
fxValue = this.GetControlValue(controlName);
|
||||
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()))
|
||||
{
|
||||
keyList.Add(sysSetModel.DbName.ToLower());
|
||||
if (sysSetModel.SaveModeCode.Equals(MainModuleObj.ModeCode))
|
||||
{
|
||||
//保存到主表里
|
||||
keyBuilder.Append(string.Format("{0},", sysSetModel.DbName));
|
||||
valueBuilder.Append(string.Format("N'{0}',", fxValue.Replace("'", "''")));
|
||||
}
|
||||
else
|
||||
{
|
||||
keyBuilderFb.Append(string.Format("{0},", sysSetModel.DbName));
|
||||
valueBuilderFb.Append(string.Format("N'{0}',", fxValue.Replace("'", "''")));
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(keyBuilderFb+""))
|
||||
{
|
||||
string tablename = TableNameList[modeCode];
|
||||
string insertSqlFb = string.Format("insert into {0}({1}) values({2});", tablename, 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 = MainModuleObj.NewVer
|
||||
};
|
||||
int resultFb = BaseModuleImpl.SaveBasePanelData(saveModelFb);
|
||||
}
|
||||
if (!keyList.Contains(sysSetModel.DbName.ToLower()))
|
||||
{
|
||||
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 ||
|
||||
@@ -1470,27 +1528,63 @@ namespace Lskj.PubProductSysMge
|
||||
//string newBillNo = BaseImpl.GetDefaultValue(model.Default, parentValue);
|
||||
List<string> keyList = new List<string>() { "speciesno", "operatorname", "operatedate", "smartbmfa" };
|
||||
StringBuilder sqlBuilder = new StringBuilder();
|
||||
//sqlBuilder.Append(string.Format("update p_producttab set spec = '{0}',model = '{1}',productid = '{2}',appellation = '{3}',productdescrip = '{4}',speciesno = '{5}',productunitname = '{6}',OperatorName = '{7}',Operatedate = '{8}',SmartBmFa = '{9}' where productid = '{10}'\r\n",
|
||||
//SpecBaseControl != null ? SpecBaseControl.EditText : "", ModelBaseControl != null ? ModelBaseControl.EditText : "", newBillNo, NameBaseControl != null ? NameBaseControl.EditText : "", ZhSxBaseControl != null ? ZhSxBaseControl.EditText : "", parentValue, UnitBaseControl != null ? UnitBaseControl.EditText : "", ERPInfo.Instance.UserName, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), this.projectEdit.Tag, newBillNo));
|
||||
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)
|
||||
|
||||
foreach (string modeCode in TableNameList.Keys)
|
||||
{
|
||||
SysSetModel sysSetModel = item.Tag as SysSetModel;
|
||||
string fxValue = "";
|
||||
try
|
||||
StringBuilder sqlBuilderFb = new StringBuilder();
|
||||
|
||||
List<BaseUserControl> modelControls = 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 modelControls)
|
||||
{
|
||||
string controlName = !string.IsNullOrWhiteSpace(sysSetModel.DbName) ? sysSetModel.DbName : sysSetModel.SysName;
|
||||
fxValue = this.GetControlValue(controlName);
|
||||
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))
|
||||
{
|
||||
keyList.Add(sysSetModel.DbName.ToLower());
|
||||
if (sysSetModel.SaveModeCode.Equals(MainModuleObj.ModeCode))
|
||||
{
|
||||
//保存到主表里
|
||||
sqlBuilder.Append(string.Format("{0} = N'{1}',", sysSetModel.DbName, fxValue.Replace("'", "''")));
|
||||
}
|
||||
else
|
||||
{
|
||||
sqlBuilderFb.Append(string.Format("{0} = N'{1}',", sysSetModel.DbName, fxValue.Replace("'", "''")));
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(sqlBuilder + ""))
|
||||
{
|
||||
string tablename = TableNameList[modeCode];
|
||||
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 = MainModuleObj.NewVer
|
||||
};
|
||||
int resultFb = BaseModuleImpl.SaveBasePanelData(saveModelFb);
|
||||
}
|
||||
if (!sysSetModel.DbName.Equals(primaryKey, StringComparison.OrdinalIgnoreCase) && !sysSetModel.DbName.Equals("productid", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
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 ||
|
||||
@@ -1622,9 +1716,11 @@ namespace Lskj.PubProductSysMge
|
||||
DataRow focusRow = this.gcMain.GridView.GetFocusedDataRow();
|
||||
if (focusRow == null) return;
|
||||
string primaryVlaue = focusRow["productid"] + "";
|
||||
DataRow selectSource = MainImpl.GetDataRowResult(string.Format("select * from p_producttab where productid = '{0}'", primaryVlaue));
|
||||
string projectId = selectSource["SmartBmFa"] + "";
|
||||
string speciesNo = selectSource["speciesNo"] + "";
|
||||
//DataRow selectSource = MainImpl.GetDataRowResult(string.Format("select * from p_producttab where productid = '{0}'", primaryVlaue));
|
||||
//string projectId = selectSource["SmartBmFa"] + "";
|
||||
//string speciesNo = selectSource["speciesNo"] + "";
|
||||
string projectId = focusRow["SmartBmFa"] + "";
|
||||
string speciesNo = focusRow["speciesNo"] + "";
|
||||
if (string.IsNullOrEmpty(projectId))
|
||||
{
|
||||
MessageUtil.Show("该档案未通过智能编码生成,不支持智能编码修改");
|
||||
@@ -1675,7 +1771,7 @@ namespace Lskj.PubProductSysMge
|
||||
foreach (BaseUserControl item in modelControls)
|
||||
{
|
||||
SysSetModel sysSetModel = item.Tag as SysSetModel;
|
||||
string value = selectSource.Table.Columns.Contains(sysSetModel.DbName) ? selectSource[sysSetModel.DbName] + "" : "";
|
||||
string value = focusRow.Table.Columns.Contains(sysSetModel.DbName) ? focusRow[sysSetModel.DbName] + "" : "";
|
||||
//double doubleValue;
|
||||
item.EditText = value;
|
||||
//if (double.TryParse(value, out doubleValue))
|
||||
|
||||
@@ -200,11 +200,26 @@ 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)
|
||||
{
|
||||
@@ -266,11 +281,4 @@ namespace Lskj.PubProductSysMge.Model
|
||||
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.IsNullOrEmpty(rowItem["EndConnectorStrZhsx"] + "") ? rowItem["EndConnectorStrZhsx"] + "" : "";
|
||||
|
||||
this.ConnectorStrCz = rowItem.Table.Columns.Contains("ConnectorStrCz") && !string.IsNullOrEmpty(rowItem["ConnectorStrCz"] + "") ? rowItem["ConnectorStrCz"] + "" : "";
|
||||
this.EndConnectorStrCz = rowItem.Table.Columns.Contains("EndConnectorStrCz") && !string.IsNullOrEmpty(rowItem["EndConnectorStrCz"] + "") ? rowItem["EndConnectorStrCz"] + "" : "";
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
this.EndConnectorStrZhsx = rowItem.Table.Columns.Contains("EndConnectorStrZhsx") && !string.I
|
||||
Reference in New Issue
Block a user