@ -143,11 +143,21 @@ namespace FactorySystemApi.Controllers
List < TFS_Material > materialList = TeamworkBll . CheckMaterialListByTest ( teamwork . FFormulaTestCode , teamwork . FVersionCode ) ;
if ( materialList . Count = = 0 ) {
TeamworkBll . CreateProductView ( teamwork , null , user . FID ) ;
// 20230726 不论新增或暂存,都在创建协同时生成成品事项
//BaseBll.CreateTaskData(teamwork.FID, user.FID, "3", teamwork.FCreateFactoryID + "," + teamwork.FProdFactoryID);
//BaseBll.UpdateTeamProcess(teamwork.FID, (int)Constant.ProcessType.成品视图, 2, 1);
//开始BOM下载
DockGetBomData ( teamwork . FID , user . FID ) ;
}
else {
TeamworkBll . CreateProductView ( teamwork , materialList , user . FID ) ;
// 20230726 不论新增或暂存,都在创建协同时生成成品事项
//BaseBll.CreateTaskData(teamwork.FID, user.FID, "3", teamwork.FCreateFactoryID + "," + teamwork.FProdFactoryID);
//BaseBll.UpdateTeamProcess(teamwork.FID, (int)Constant.ProcessType.成品视图, 2, 1);
TeamworkBll . HasMaterialTestCode ( teamwork ) ;
/ * *
@ -178,6 +188,12 @@ namespace FactorySystemApi.Controllers
}
else
{
// 20230726 不论新增或暂存,都在创建协同时生成成品事项
//TFS_FTeamwork teamwork = BaseBll.GetTempModel<TFS_FTeamwork>(teamId);
//TeamworkBll.CreateProductView(teamwork, null, user.FID);
//BaseBll.CreateTaskData(teamwork.FID, user.FID, "3", teamwork.FCreateFactoryID + "," + teamwork.FProdFactoryID);
//BaseBll.UpdateTeamProcess(teamwork.FID, (int)Constant.ProcessType.成品视图, 2, 1);
BaseBll . CreateTaskData ( teamId , user . FID , ( ( int ) Constant . TaskType . 配 方 选 择 ) . ToString ( ) ) ;
BaseBll . UpdateTeamProcess ( teamId , ( int ) Constant . ProcessType . 协 同 发 起 , 1 , 1 ) ;
}
@ -304,16 +320,16 @@ namespace FactorySystemApi.Controllers
savePath + = Constant . TeamViewType . 配 方 视 图 . ToString ( ) ;
//原始配方
whereSql = string . Format ( @ "dbo.StrExistInStr(TFS_ViewMaterial.FMaterialID,(select FMaterialFormulaIDs from TFS_FTeamwork where FID={0}))>0
and TFS_ViewMaterial . F FactoryID= ( select FProdFactoryID from TFS_FTeamwork where FID = { 0 } ) ", inParam[" FTeamID "]);
and TFS_ViewMaterial . F TeamType = 0 and TFS_ViewMaterial . F FactoryID= ( select FProdFactoryID from TFS_FTeamwork where FID = { 0 } ) ", inParam[" FTeamID "]);
//生产、计划配方
joinSql = string . Format ( @ "(dbo.StrExistInStr(TFS_ViewMaterial.FMaterialID,(select FMaterialFormulaIDs from TFS_FTeamwork where FID={0}))>0
and TFS_Material . FSuccedaneumID < 1 ) and TFS_ViewMaterial . FFactoryID = ( select FProdFactoryID from TFS_FTeamwork where FID = { 0 } ) ",
and TFS_Material . FSuccedaneumID < 1 ) and TFS_ViewMaterial . FTeamType = 0 and TFS_ViewMaterial . FFactoryID = ( select FProdFactoryID from TFS_FTeamwork where FID = { 0 } ) ",
inParam [ "FTeamID" ] ) ;
break ;
case ( int ) Constant . TeamViewType . 生 产 工 艺 路 线 视 图 :
savePath + = Constant . TeamViewType . 生 产 工 艺 路 线 视 图 . ToString ( ) ;
//只要生产工厂
whereSql + = string . Format ( " and TFS_ViewMaterial.F FactoryID in(select FID from TFS_Factory where FType={0})", ( int ) Constant . FactoryType . 单 工 厂 ) ;
whereSql + = string . Format ( " and TFS_ViewMaterial.F TeamType = 0 and TFS_ViewMaterial.F FactoryID in(select FID from TFS_Factory where FType={0})", ( int ) Constant . FactoryType . 单 工 厂 ) ;
//视图类型
List < int > tempInt3_1 = new List < int >
{
@ -322,12 +338,12 @@ namespace FactorySystemApi.Controllers
( int ) Constant . ViewType . 香 基 视 图 ,
( int ) Constant . ViewType . 中 间 品 视 图
} ;
whereSql + = string . Format ( " and TFS_ViewMaterial.F ViewType in({0})", string . Join ( "," , tempInt3_1 ) ) ;
whereSql + = string . Format ( " and TFS_ViewMaterial.F TeamType = 0 and TFS_ViewMaterial.F ViewType in({0})", string . Join ( "," , tempInt3_1 ) ) ;
break ;
case ( int ) Constant . TeamViewType . 生 产 版 本 视 图 :
savePath + = Constant . TeamViewType . 生 产 版 本 视 图 . ToString ( ) ;
//只要生产工厂
whereSql + = string . Format ( " and TFS_ViewMaterial.F FactoryID in(select FID from TFS_Factory where FType={0})", ( int ) Constant . FactoryType . 单 工 厂 ) ;
whereSql + = string . Format ( " and TFS_ViewMaterial.F TeamType = 0 and TFS_ViewMaterial.F FactoryID in(select FID from TFS_Factory where FType={0})", ( int ) Constant . FactoryType . 单 工 厂 ) ;
//视图类型
List < int > tempInt4_1 = new List < int >
{
@ -336,22 +352,22 @@ namespace FactorySystemApi.Controllers
( int ) Constant . ViewType . 中 间 品 视 图 ,
( int ) Constant . ViewType . 香 基 视 图
} ;
whereSql + = string . Format ( " and TFS_ViewMaterial.F ViewType in({0})", string . Join ( "," , tempInt4_1 ) ) ;
whereSql + = string . Format ( " and TFS_ViewMaterial.F TeamType = 0 and TFS_ViewMaterial.F ViewType in({0})", string . Join ( "," , tempInt4_1 ) ) ;
break ;
case ( int ) Constant . TeamViewType . 组 装 BOM 视 图 :
savePath + = Constant . TeamViewType . 组 装 BOM 视 图 . ToString ( ) ;
//一级半成品、包材→无替代料的
whereSql = string . Format ( @ "(dbo.StrExistInStr(TFS_ViewMaterial.FMaterialID,(select FMaterialHalfIDs from TFS_FTeamwork where FID={0}))>0 or
TFS_ViewMaterial . F MaterialID in ( select FMaterialID from TFS_PackageChild where FTeamID = { 0 } or
whereSql = string . Format ( @ "(dbo.StrExistInStr(TFS_ViewMaterial.FMaterialID,(select FMaterialHalfIDs from TFS_FTeamwork where FID={0}))>0 or (
TFS_ViewMaterial . F TeamType = 0 and TFS_ViewMaterial . F MaterialID in ( select FMaterialID from TFS_PackageChild where FTeamID = { 0 } ) or
FPackageID = ( select FPackID from TFS_FTeamwork where FID = { 0 } ) ) )
", inParam[" FTeamID "]);
//只要生产工厂
whereSql + = string . Format ( " and TFS_ViewMaterial.F FactoryID=(select FProdFactoryID from TFS_FTeamwork where FID={0})", inParam [ "FTeamID" ] ) ;
whereSql + = string . Format ( " and TFS_ViewMaterial.F TeamType = 0 and TFS_ViewMaterial.F FactoryID=(select FProdFactoryID from TFS_FTeamwork where FID={0})", inParam [ "FTeamID" ] ) ;
break ;
case ( int ) Constant . TeamViewType . 物 料 视 图 :
default :
savePath + = Constant . TeamViewType . 物 料 视 图 . ToString ( ) ;
whereSql + = " and TFS_ViewMaterial.F MaterialID>0";
whereSql + = " and TFS_ViewMaterial.F TeamType = 0 and TFS_ViewMaterial.F MaterialID>0";
break ;
}
savePath + = ".xlsx" ;
@ -621,10 +637,6 @@ namespace FactorySystemApi.Controllers
return result ;
}
/// <summary>
/// 递归梳理BOM
/// </summary>