@ -107,63 +107,63 @@ namespace FactorySystemBll
List < string > paramName = new List < string > ( ) { "FDeleted!=1" } ;
List < string > paramName = new List < string > ( ) { "FDeleted!=1" } ;
List < SugarParameter > paramVal = new List < SugarParameter > ( ) ;
List < SugarParameter > paramVal = new List < SugarParameter > ( ) ;
//if (inParam != null && inParam.Count > 0 )
if ( inParam ! = null & & inParam . Count > 0 )
// {
{
// foreach (var item in inParam)
foreach ( var item in inParam )
// {
{
// if (item.Key == "FPageIndex" || item.Key == "PageIndex")
if ( item . Key = = "FPageIndex" | | item . Key = = "PageIndex" )
// {
{
// int.TryParse(item.Value.ToString(), out pageIndex);
int . TryParse ( item . Value . ToString ( ) , out pageIndex ) ;
// }
}
// else if (item.Key == "FPageSize" || item.Key == "PageSize")
else if ( item . Key = = "FPageSize" | | item . Key = = "PageSize" )
// {
{
// int.TryParse(item.Value.ToString(), out pageSize);
int . TryParse ( item . Value . ToString ( ) , out pageSize ) ;
// }
}
// else if (item.Key == "FAddDate" || item.Key == "AddDate")
else if ( item . Key = = "FAddDate" | | item . Key = = "AddDate" )
// {
{
// paramName.Add("convert(varchar(10),FAddDate,120)=@FAddDate");
paramName . Add ( "convert(varchar(10),FAddDate,120)=@FAddDate" ) ;
// paramVal.Add(new SugarParameter("@FAddDate", item.Value.ToString()));
paramVal . Add ( new SugarParameter ( "@FAddDate" , item . Value . ToString ( ) ) ) ;
// }
}
// else if (item.Key == "FDataType" || item.Key == "DataType")
else if ( item . Key = = "FDataType" | | item . Key = = "DataType" )
// {
{
// if (item.Value.ToString() == "1")//我发起的
if ( item . Value . ToString ( ) = = "1" ) //我发起的
// {
{
// paramName.Add("FAddUser=@FAddUser");
paramName . Add ( "FAddUser=@FAddUser" ) ;
// paramVal.Add(new SugarParameter("@FAddUser", userId));
paramVal . Add ( new SugarParameter ( "@FAddUser" , userId ) ) ;
// }
}
// else if (item.Value.ToString() == "2")//我参与的
else if ( item . Value . ToString ( ) = = "2" ) //我参与的
// {
{
// paramName.Add(string.Format(@"FID in(select distinct FTeamID from TFS_FTeamProcess where ','+FChargeID+',' like '%,{0},%'
paramName . Add ( string . Format ( @ "FID in(select distinct FTeamID from TFS_FTeamProcess where ','+FChargeID+',' like '%,{0},%'
// union select distinct FTeamID from TFS_Task where ',' + FUserID + ',' like '%,{0},%')", userId));
union select distinct FTeamID from TFS_Task where ',' + FUserID + ',' like ' % , { 0 } , % ' ) ", userId));
// }
}
// }
}
// else if (item.Key == "FProgress" || item.Key == "FProgress")
else if ( item . Key = = "FProgress" | | item . Key = = "FProgress" )
// {
{
// string pVal = item.Value.ToString();
string pVal = item . Value . ToString ( ) ;
// if (!string.IsNullOrEmpty(pVal))
if ( ! string . IsNullOrEmpty ( pVal ) )
// {
{
// if (pVal == "100" || pVal == "100%")
if ( pVal = = "100" | | pVal = = "100%" )
// {
{
// paramName.Add("FProgress='100'");
paramName . Add ( "FProgress='100'" ) ;
// }
}
// else
else
// {
{
// paramName.Add("FProgress!='100'");
paramName . Add ( "FProgress!='100'" ) ;
// }
}
// }
}
// }
}
// else
else
// {
{
// //检索,全转成字符串
//检索,全转成字符串
// paramName.Add("','+cast(" + item.Key + " as varchar)+',' like '%'+@" + item.Key + "+'%'");
paramName . Add ( "','+cast(" + item . Key + " as varchar)+',' like '%'+@" + item . Key + "+'%'" ) ;
// paramVal.Add(new SugarParameter("@" + item.Key, item.Value.ToString()));
paramVal . Add ( new SugarParameter ( "@" + item . Key , item . Value . ToString ( ) ) ) ;
// }
}
// }
}
// }
}
SqlSugarClient db = AppSettingsHelper . GetSqlSugar ( ) ;
SqlSugarClient db = AppSettingsHelper . GetSqlSugar ( ) ;
string searchKey = string . Format ( @"a. FID AS 'FID',a.FTestCode AS 'FTestCode',b.FVersionCode AS 'FVersionCode',a.FNewTestCode AS 'NewFTestCode',c.FVersionCode AS 'NewFVersionCode',c.FType,a.FAddDate,d.FName,a.FDeleted AS 'FDeleted',b.FDesc,c.FDesc AS 'NewFDesc',a.FMaterialHalfIDs ") ;
string searchKey = string . Format ( @"a. *,d.FName ") ;
var temp = db . Queryable < TFS_HalfMaterialFTeamwork , T FS_Formula, TFS_Formula , T User> ( ( a , b , c , d ) = > new JoinQueryInfos ( JoinType . Left , a . FTestCode = = b . FTestCode , JoinType . Left , a . FNewTestCode = = c . FTestCode , JoinType . Left , a . FAddUser = = d . FID ) ) . Select < object > ( searchKey ) ;
var temp = db . Queryable < TFS_HalfMaterialFTeamwork , T User> ( ( a , d ) = > new JoinQueryInfos ( JoinType . Left , a . FAddUser = = d . FID ) ) . Select < object > ( searchKey ) ;
List < object > result = db . Queryable ( temp ) . Where ( string . Join ( " and " , paramName ) , paramVal )
List < object > result = db . Queryable ( temp ) . Where ( string . Join ( " and " , paramName ) , paramVal )
. OrderBy ( "FID desc" ) . ToPageList ( pageIndex , pageSize , ref totalCount ) . ToList < object > ( ) ;
. OrderBy ( "FID desc" ) . ToPageList ( pageIndex , pageSize , ref totalCount ) . ToList < object > ( ) ;
@ -178,7 +178,7 @@ namespace FactorySystemBll
SqlSugarClient db = AppSettingsHelper . GetSqlSugar ( ) ;
SqlSugarClient db = AppSettingsHelper . GetSqlSugar ( ) ;
try
try
{
{
List < TBasicCode > typeList = db . Queryable < TBasicCode > ( ) . Where ( s = > s . FType = = ( int ) Constant . BasicCode . 流程 类 型 & & s . FState = = 1 ) . ToList ( ) ;
List < TBasicCode > typeList = db . Queryable < TBasicCode > ( ) . Where ( s = > s . FType = = ( int ) Constant . BasicCode . 变更 试 验 号 流 程 & & s . FState = = 1 ) . ToList ( ) ;
List < TFS_HalfMaterialFTeamProcess > taskList = new List < TFS_HalfMaterialFTeamProcess > ( ) ;
List < TFS_HalfMaterialFTeamProcess > taskList = new List < TFS_HalfMaterialFTeamProcess > ( ) ;
foreach ( var item in typeList )
foreach ( var item in typeList )
{
{
@ -382,6 +382,7 @@ namespace FactorySystemBll
mItem . FFactoryID = factory . FID ;
mItem . FFactoryID = factory . FID ;
mItem . FFactoryCode = factory . FCode ;
mItem . FFactoryCode = factory . FCode ;
}
}
mItem . FTestCode = teamInfo . FTestCode ;
mItem . FID = db . Insertable ( mItem ) . IgnoreColumns ( true ) . ExecuteReturnIdentity ( ) ;
mItem . FID = db . Insertable ( mItem ) . IgnoreColumns ( true ) . ExecuteReturnIdentity ( ) ;
//if (vItem.FLevel > 1) formulaIds += "," + mItem.FID;
//if (vItem.FLevel > 1) formulaIds += "," + mItem.FID;
}
}
@ -446,6 +447,7 @@ namespace FactorySystemBll
mItem . FOldID = oldId ;
mItem . FOldID = oldId ;
mItem . FLevelID = vItem . FLevel ;
mItem . FLevelID = vItem . FLevel ;
mItem . FParentID = oldParent ;
mItem . FParentID = oldParent ;
mItem . FTestCode = teamInfo . FNewTestCode ;
if ( mItem . FLevelID > = 1 ) formulaList . Add ( mItem ) ;
if ( mItem . FLevelID > = 1 ) formulaList . Add ( mItem ) ;
}
}
@ -460,52 +462,6 @@ namespace FactorySystemBll
formulaIds + = first . FID + "," + fids ;
formulaIds + = first . FID + "," + fids ;
}
}
}
}
//if (hasNewView.Count() > 0)
//{
// hasNewView.OrderBy(s => s.Key);
// string facoryIds = ""; bool hasOther = false;
// foreach (var item in hasNewView)
// {
// //创建视图事项
// string factorys = item.Value.Trim(',');
// BaseBll.CreateTaskData(teamInfo.FID, userId, (item.Key + 2).ToString(), factorys);
// facoryIds += factorys;
// if (item.Key != (int)Constant.ViewType.原料视图) hasOther = true;
// }
// if (hasNewView.ContainsKey((int)Constant.ViewType.原料视图))
// {
// proSql += BaseBll.GetProcessSql(teamInfo.FID, (int)Constant.ProcessType.新原料视图, "F2", 1);
// }
// else
// {
// proSql += BaseBll.GetProcessSql(teamInfo.FID, (int)Constant.ProcessType.新原料视图, "F4", 2);
// }
// if (hasOther)
// {
// proSql += BaseBll.GetProcessSql(teamInfo.FID, (int)Constant.ProcessType.新半成品中间品香基, "F2", 1);
// }
// else
// {
// proSql += BaseBll.GetProcessSql(teamInfo.FID, (int)Constant.ProcessType.新半成品中间品香基, "F4", 2);
// }
// if (hasNewView.ContainsKey((int)Constant.ViewType.中间品视图) || hasNewView.ContainsKey((int)Constant.ViewType.香基视图)
// || hasNewView.ContainsKey((int)Constant.ViewType.半成品视图))
// {
// proSql += string.Format("update TFS_FTeamwork set FViewType=FViewType+',3,4' where FID={0};", teamInfo.FID);
// BaseBll.CreateTaskData(teamId, userId, "8");
// }
// proSql += BaseBll.GetProcessSql(teamInfo.FID, (int)Constant.ProcessType.配方视图, "F2", 1);
//}
//else
//{
// proSql += BaseBll.GetProcessSql(teamInfo.FID, (int)Constant.ProcessType.配方视图, "F2", 2);
// proSql += BaseBll.GetProcessSql(teamInfo.FID, (int)Constant.ProcessType.新半成品中间品香基, "F4", 2);
// proSql += BaseBll.GetProcessSql(teamInfo.FID, (int)Constant.ProcessType.新原料视图, "F4", 2);
//}
////下面两个要根据包材判断, 先改成进行中, hasNewView == 0 && 包材是旧的,完成
//int pVersion = (hasNewView.Count == 0 && teamInfo.FPackID < 1) ? 2 : 1;
//proSql += BaseBll.GetProcessSql(teamInfo.FID, (int)Constant.ProcessType.生产工艺路线, "F2", pVersion);
//proSql += BaseBll.GetProcessSql(teamInfo.FID, (int)Constant.ProcessType.生成版本, "F2", pVersion);
string updateSql = "" ;
string updateSql = "" ;
@ -675,14 +631,14 @@ namespace FactorySystemBll
TFS_ViewMaterial mainView = new TFS_ViewMaterial ( )
TFS_ViewMaterial mainView = new TFS_ViewMaterial ( )
{
{
FMaterialID = mainMater . FID ,
FMaterialID = mainMater . FID ,
F TeamID = teamInfo . FID ,
F HalfMaterial TeamID = teamInfo . FID ,
FFactoryID = teamInfo . FCreateFactoryID ,
FFactoryID = teamInfo . FCreateFactoryID ,
FFactoryCode = teamInfo . FCreateFactoryCode ,
FFactoryCode = teamInfo . FCreateFactoryCode ,
FViewType = ( int ) Constant . ViewType . 物 料 分 类 视 图 ,
FViewType = ( int ) Constant . ViewType . 物 料 分 类 视 图 ,
FLevel = 1 ,
FLevel = 1 ,
FEditUser = userId ,
FEditUser = userId ,
FBaseMaterialCode = teamInfo . FMdmCode ,
FBaseMaterialCode = teamInfo . FMdmCode ,
FBaseTestCode = teamInfo . F TestCode,
FBaseTestCode = teamInfo . F New TestCode,
FBaseBasicMeter = teamInfo . FWeightUnit ,
FBaseBasicMeter = teamInfo . FWeightUnit ,
FBaseMaterialDesc = teamInfo . FSaleCode ,
FBaseMaterialDesc = teamInfo . FSaleCode ,
FBaseMaterialGroup = teamInfo . FMaterialGroup ,
FBaseMaterialGroup = teamInfo . FMaterialGroup ,
@ -702,9 +658,9 @@ namespace FactorySystemBll
if ( teamInfo . FProdFactoryID ! = teamInfo . FCreateFactoryID )
if ( teamInfo . FProdFactoryID ! = teamInfo . FCreateFactoryID )
{
{
mainMater . FFactoryID = teamInfo . FProdFactoryID ;
//mainMater.FFactoryID = teamInfo.FProdFactoryID ;
mainMater . FFactoryCode = teamInfo . FProdFactoryCode ;
//mainMater.FFactoryCode = teamInfo.FProdFactoryCode ;
mainMater . FID = db . Insertable ( mainMater ) . IgnoreColumns ( true ) . ExecuteReturnIdentity ( ) ;
//mainMater.FID = db.Insertable(mainMater).IgnoreColumns(true).ExecuteReturnIdentity() ;
mainView . FFactoryID = teamInfo . FProdFactoryID ;
mainView . FFactoryID = teamInfo . FProdFactoryID ;
mainView . FFactoryCode = teamInfo . FProdFactoryCode ;
mainView . FFactoryCode = teamInfo . FProdFactoryCode ;
@ -719,8 +675,8 @@ namespace FactorySystemBll
//修改流程状态(协同发起完成,成品视图进行中)
//修改流程状态(协同发起完成,成品视图进行中)
//proSql += BaseBll.GetProcessSql(teamInfo.FID, (int)Constant.ProcessType.协同发起, "F2", 1);
//proSql += BaseBll.GetProcessSql(teamInfo.FID, (int)Constant.ProcessType.协同发起, "F2", 1);
//proSql += BaseBll.GetProcessSql(teamInfo.FID, (int)Constant.ProcessType.成品视图, "F2", 1);
//proSql += BaseBll.GetProcessSql(teamInfo.FID, (int)Constant.ProcessType.成品视图, "F2", 1);
proSql + = BaseBll . GetTaskSql2 ( - 1 , 2 , teamInfo . FID , ( int ) Constant . TaskType . 配 方 选 择 , 2 ) ;
//proSql += BaseBll.GetTaskSql2(-1, 2, teamInfo.FID, (int)Constant.TaskType.配方选择, 2) ;
proSql = proSql . Trim ( ';' ) ;
//proSql = proSql.Trim(';') ;
int result = db . Ado . ExecuteCommand ( proSql ) ;
int result = db . Ado . ExecuteCommand ( proSql ) ;
db . CommitTran ( ) ;
db . CommitTran ( ) ;
}
}
@ -780,7 +736,7 @@ namespace FactorySystemBll
/// <param name="testCode">原配方</param>
/// <param name="testCode">原配方</param>
/// <param name="testCode2">新配方</param>
/// <param name="testCode2">新配方</param>
/// <returns></returns>
/// <returns></returns>
public List < TFS_Material > UpdateFormula ( string testCode , string testCode2 , int temId , string idList = "" )
public List < TFS_Material > UpdateFormula ( string testCode , string testCode2 , int temId , int factoryID , string idList = "" )
{
{
SqlSugarClient db = AppSettingsHelper . GetSqlSugar ( ) ;
SqlSugarClient db = AppSettingsHelper . GetSqlSugar ( ) ;
@ -798,8 +754,10 @@ namespace FactorySystemBll
{
{
sql = string . Format ( "update TFS_Material set FTestCode='{0}' WHERE FID in ({1})" , testCode , idList ) ;
sql = string . Format ( "update TFS_Material set FTestCode='{0}' WHERE FID in ({1})" , testCode , idList ) ;
}
}
if ( materialList . Count ( ) > 0 )
{
db . Ado . ExecuteCommand ( sql ) ;
db . Ado . ExecuteCommand ( sql ) ;
}
return materialList ;
return materialList ;
}
}