commit by yzf

master
Yang 2 years ago
parent 0878253397
commit b35b6d2441

@ -845,10 +845,23 @@ namespace FactorySystemApi.Controllers
if (viewList != null && viewList.Count > 0) if (viewList != null && viewList.Count > 0)
{ {
int materialId = viewList[0].FMaterialID; int materialId = viewList[0].FMaterialID;
dataList = MaterialTeamworkBll.GetViewMaterial(materialId.ToString()); if (teamType == 3)
NPOIHelper.ExportDTtoExcel(dataList, "Sheet1", savePath.Replace(".xlsx", fType + ".xlsx")); {
List<int> materialIds = viewList.Select(m => m.FMaterialID).ToList();
string ids = string.Join(",", materialIds);
dataList = MaterialTeamworkBll.GetViewMaterial(ids.ToString());
NPOIHelper.ExportDTtoExcel(dataList, "Sheet1", savePath.Replace(".xlsx", fType + ".xlsx"));
}
else
{
dataList = MaterialTeamworkBll.GetViewMaterial(materialId.ToString());
NPOIHelper.ExportDTtoExcel(dataList, "Sheet1", savePath.Replace(".xlsx", fType + ".xlsx"));
}
} }
} }
} }
} }

@ -473,6 +473,10 @@ namespace FactorySystemBll
{ {
viewList = db.Queryable<TFS_ViewMaterial>().Where(s => s.FTeamID == teamworkId && s.FTeamType == 1).ToList(); viewList = db.Queryable<TFS_ViewMaterial>().Where(s => s.FTeamID == teamworkId && s.FTeamType == 1).ToList();
} }
else if (teamworkType == 3)
{
viewList = db.Queryable<TFS_ViewMaterial>().Where(s => s.FHalfMaterialTeamID == teamworkId).ToList();
}
else else
{ {
viewList = db.Queryable<TFS_ViewMaterial>().Where(s => s.FMdfMaterialTeamID == teamworkId && s.FTeamType == 1).ToList(); viewList = db.Queryable<TFS_ViewMaterial>().Where(s => s.FMdfMaterialTeamID == teamworkId && s.FTeamType == 1).ToList();
@ -618,6 +622,11 @@ namespace FactorySystemBll
string whereSql = string.Format(" Where FTeamType=1 And FMdfMaterialTeamID={0}", teamworkId); string whereSql = string.Format(" Where FTeamType=1 And FMdfMaterialTeamID={0}", teamworkId);
strSql = strSql + whereSql; strSql = strSql + whereSql;
} }
else if ("3".Equals(teamworkType))
{
string whereSql = string.Format(" Where FHalfMaterialTeamID={0}", teamworkId);
strSql = strSql + whereSql;
}
else else
{ {
string whereSql = string.Format(" Where FTeamType=1 And FTeamID={0}", teamworkId); string whereSql = string.Format(" Where FTeamType=1 And FTeamID={0}", teamworkId);
@ -631,8 +640,9 @@ namespace FactorySystemBll
public DataTable GetViewMaterial(string FID) public DataTable GetViewMaterial(string FID)
{ {
SqlSugarClient db = AppSettingsHelper.GetSqlSugar(); SqlSugarClient db = AppSettingsHelper.GetSqlSugar();
string strSql = string.Format(@" string strSql = string.Format(@"
SELECT
SELECT
isnull( FTypeName1, '' ) AS '', isnull( FTypeName1, '' ) AS '',
isnull( FTypeName2, '' ) AS '', isnull( FTypeName2, '' ) AS '',
isnull( FK3Code, '' ) AS 'K3', isnull( FK3Code, '' ) AS 'K3',
@ -781,24 +791,25 @@ namespace FactorySystemBll
SELECT SELECT
isnull( b.FName, '' ) AS 'FTypeName1', isnull( b.FName, '' ) AS 'FTypeName1',
isnull( c.FName, '' ) AS 'FTypeName2', isnull( c.FName, '' ) AS 'FTypeName2',
isnull( FSAPCode, '' ) AS 'FCode', isnull( e.FSAPCode, '' ) AS 'FCode',
isnull( FSAPDescription, '' ) AS 'FName', isnull( e.FSAPDescription, '' ) AS 'FName',
isnull( FBaseMaterialDesc, '' ) AS 'FDesc', isnull( FBaseMaterialDesc, '' ) AS 'FDesc',
isnull( FBaseMaterialDesc, '' ) AS 'FVersionCode', isnull( FBaseMaterialDesc, '' ) AS 'FVersionCode',
isnull( FBaseMaterialDesc, '' ) AS 'FFactoryCode', isnull( FBaseMaterialDesc, '' ) AS 'FFactoryCode',
isnull( FBaseMaterialDesc, '' ) AS 'FSupplyCode', isnull( FBaseMaterialDesc, '' ) AS 'FSupplyCode',
isnull( FBaseMaterialGroup, '' ) AS 'FGroupCode', isnull( FBaseMaterialGroup, '' ) AS 'FGroupCode',
isnull( FBaseWeightUnit, '' ) AS 'FBaseUnit', isnull( FBaseWeightUnit, '' ) AS 'FBaseUnit',
isnull( FCraftExplain, '' ) AS 'FCraftDesc', isnull( e.FCraftExplain, '' ) AS 'FCraftDesc',
d.FName AS 'FtypeName',
a.* a.*
FROM FROM
TFS_MaterialInfo AS a TFS_MaterialInfo AS a
LEFT JOIN TFS_MaterialType AS d ON a.FType=d.FID LEFT JOIN TFS_Material AS e ON a.FDataID=e.FID
LEFT JOIN TFS_MaterialType AS b ON a.FTypeID1= b.FID LEFT JOIN TFS_MaterialType AS d ON a.FType=d.FID
LEFT JOIN TFS_MaterialType AS C ON a.FTypeID2= b.FID LEFT JOIN TFS_MaterialType AS b ON e.FTypeID1= b.FID
WHERE LEFT JOIN TFS_MaterialType AS C ON e.FTypeID2= c.FID
FDataId = {0})a;", FID); WHERE a.FDataID in ({0})
)a;
", FID);
DataTable data = db.Ado.GetDataTable(strSql); DataTable data = db.Ado.GetDataTable(strSql);
return data; return data;

Loading…
Cancel
Save