|
|
|
@ -32,7 +32,7 @@ namespace FactorySystemBll
|
|
|
|
* 此处的viewType来自TBasicCode中FType=33时,的FRemark字段
|
|
|
|
* 此处的viewType来自TBasicCode中FType=33时,的FRemark字段
|
|
|
|
* **/
|
|
|
|
* **/
|
|
|
|
List<Dictionary<string, object>> viewList = new List<Dictionary<string, object>>();
|
|
|
|
List<Dictionary<string, object>> viewList = new List<Dictionary<string, object>>();
|
|
|
|
List<int> viewTypes=new List<int> { 2,3,4,5 };
|
|
|
|
List<int> viewTypes = new List<int> { 2, 3, 4, 5 };
|
|
|
|
if (viewTypes.Contains(viewType))
|
|
|
|
if (viewTypes.Contains(viewType))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
viewList = db.Queryable<TFS_ViewMaterial, TFS_Material>((a, b) =>
|
|
|
|
viewList = db.Queryable<TFS_ViewMaterial, TFS_Material>((a, b) =>
|
|
|
|
@ -75,7 +75,8 @@ namespace FactorySystemBll
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (viewType == 1) {
|
|
|
|
if (viewType == 1)
|
|
|
|
|
|
|
|
{
|
|
|
|
viewList = db.Queryable<TFS_ViewMaterial, TFS_Material>((a, b) =>
|
|
|
|
viewList = db.Queryable<TFS_ViewMaterial, TFS_Material>((a, b) =>
|
|
|
|
new JoinQueryInfos(JoinType.Inner, a.FMaterialID == b.FID))
|
|
|
|
new JoinQueryInfos(JoinType.Inner, a.FMaterialID == b.FID))
|
|
|
|
.Where((a, b) => a.FTeamID == teamId)
|
|
|
|
.Where((a, b) => a.FTeamID == teamId)
|
|
|
|
@ -85,7 +86,8 @@ namespace FactorySystemBll
|
|
|
|
"b.FBomEntry,b.FLineHouse,b.FProductDesc,b.FWorkCenter,b.FCraftExplain,b.FIidentifier,b.FGuaranteePeriod,b.FBStorageConditions,b.FSafetyStock,b.FTriggerRatio,b.FMinAmount,b.FMaxAmount,b.FYield,b.FFixedLoss,b.FTheoryYield," +
|
|
|
|
"b.FBomEntry,b.FLineHouse,b.FProductDesc,b.FWorkCenter,b.FCraftExplain,b.FIidentifier,b.FGuaranteePeriod,b.FBStorageConditions,b.FSafetyStock,b.FTriggerRatio,b.FMinAmount,b.FMaxAmount,b.FYield,b.FFixedLoss,b.FTheoryYield," +
|
|
|
|
"b.FQualityTest1,b.FQualityTest2").ToDictionaryList();
|
|
|
|
"b.FQualityTest1,b.FQualityTest2").ToDictionaryList();
|
|
|
|
List<TFS_MaterialInfo> Minfo = GetMaterialInfoList(viewList.GroupBy(s => s["FMaterialID"]).Select(s => int.Parse(s.Key.ToString())).ToList(), "", "", currUserId);
|
|
|
|
List<TFS_MaterialInfo> Minfo = GetMaterialInfoList(viewList.GroupBy(s => s["FMaterialID"]).Select(s => int.Parse(s.Key.ToString())).ToList(), "", "", currUserId);
|
|
|
|
if (Minfo.Count > 0) {
|
|
|
|
if (Minfo.Count > 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
FGuaranteePeriod = Minfo[0].FGuaranteePeriod;
|
|
|
|
FGuaranteePeriod = Minfo[0].FGuaranteePeriod;
|
|
|
|
FStorageConditions = Minfo[0].FStorageConditions;
|
|
|
|
FStorageConditions = Minfo[0].FStorageConditions;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -93,7 +95,8 @@ namespace FactorySystemBll
|
|
|
|
TFS_FTeamwork teamWork = db.Queryable<TFS_FTeamwork>().Where(s => s.FID == teamId).First();
|
|
|
|
TFS_FTeamwork teamWork = db.Queryable<TFS_FTeamwork>().Where(s => s.FID == teamId).First();
|
|
|
|
TFS_PackageMain packAge = db.Queryable<TFS_PackageMain>().Where(s => s.FCode == teamWork.FPackCode).First();
|
|
|
|
TFS_PackageMain packAge = db.Queryable<TFS_PackageMain>().Where(s => s.FCode == teamWork.FPackCode).First();
|
|
|
|
|
|
|
|
|
|
|
|
if (packAge != null) {
|
|
|
|
if (packAge != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
viewList[0].Remove("FBaseGrossWeight");
|
|
|
|
viewList[0].Remove("FBaseGrossWeight");
|
|
|
|
viewList[0].Add("FBaseGrossWeight", packAge.FGrossWeight);
|
|
|
|
viewList[0].Add("FBaseGrossWeight", packAge.FGrossWeight);
|
|
|
|
viewList[0].Remove("FBaseNetWeight");
|
|
|
|
viewList[0].Remove("FBaseNetWeight");
|
|
|
|
@ -104,7 +107,8 @@ namespace FactorySystemBll
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var FBaseMaterialDesc = viewList.GroupBy(s => s["FBaseMaterialDesc"]).Select(s => s.Key).ToList();
|
|
|
|
var FBaseMaterialDesc = viewList.GroupBy(s => s["FBaseMaterialDesc"]).Select(s => s.Key).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
if (FBaseMaterialDesc.Count > 0) {
|
|
|
|
if (FBaseMaterialDesc.Count > 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
viewList[0].Add("HalfDesc", FBaseMaterialDesc[0]);
|
|
|
|
viewList[0].Add("HalfDesc", FBaseMaterialDesc[0]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -405,7 +409,7 @@ namespace FactorySystemBll
|
|
|
|
FType = 2,
|
|
|
|
FType = 2,
|
|
|
|
FDataID = materialId,
|
|
|
|
FDataID = materialId,
|
|
|
|
FAddUser = userId,
|
|
|
|
FAddUser = userId,
|
|
|
|
FType2= temp.FTypeID2,
|
|
|
|
FType2 = temp.FTypeID2,
|
|
|
|
FMaterialGroup = temp.FMaterialGroup,
|
|
|
|
FMaterialGroup = temp.FMaterialGroup,
|
|
|
|
FMaterialType = temp.FMaterialType
|
|
|
|
FMaterialType = temp.FMaterialType
|
|
|
|
};
|
|
|
|
};
|
|
|
|
@ -494,6 +498,7 @@ namespace FactorySystemBll
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int result = 0;
|
|
|
|
int result = 0;
|
|
|
|
SqlSugarClient db = AppSettingsHelper.GetSqlSugar();
|
|
|
|
SqlSugarClient db = AppSettingsHelper.GetSqlSugar();
|
|
|
|
|
|
|
|
MaterialBll materialBll = new MaterialBll();
|
|
|
|
if (viewList != null && viewList.Count > 0)
|
|
|
|
if (viewList != null && viewList.Count > 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
string sqlWhere = string.Format("FViewType={0} and FTeamID={1}", viewType, teamId);
|
|
|
|
string sqlWhere = string.Format("FViewType={0} and FTeamID={1}", viewType, teamId);
|
|
|
|
@ -501,6 +506,41 @@ namespace FactorySystemBll
|
|
|
|
{
|
|
|
|
{
|
|
|
|
sqlWhere = string.Format("FViewType in (2, 3, 4, 5) and FTeamID={1}", viewType, teamId);
|
|
|
|
sqlWhere = string.Format("FViewType in (2, 3, 4, 5) and FTeamID={1}", viewType, teamId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < viewList.Count; i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
TFS_Material material = materialBll.GetMaterial(int.Parse(viewList[i]["FTypeID1"].ToString())).LastOrDefault();
|
|
|
|
|
|
|
|
//判断是否等于中间品
|
|
|
|
|
|
|
|
if (material.FType == "30")
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
TFS_Material material2 = materialBll.GetMaterial(int.Parse(viewList[i]["FTypeID2"].ToString())).LastOrDefault();
|
|
|
|
|
|
|
|
if (material2.FName.Contains("香基"))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (viewList[i].ContainsKey("FViewType"))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
viewList[i]["FViewType"] = (int)Constant.ViewType.香基视图;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
viewList[i].Add("FViewType", (int)Constant.ViewType.香基视图);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (viewList[i].ContainsKey("FViewType"))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
viewList[i]["FViewType"] = (int)Constant.ViewType.中间品视图;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
viewList[i].Add("FViewType", (int)Constant.ViewType.中间品视图);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
result += db.Updateable(viewList).AS("TFS_ViewMaterial").WhereColumns("FMaterialID").Where(sqlWhere).ExecuteCommand();
|
|
|
|
result += db.Updateable(viewList).AS("TFS_ViewMaterial").WhereColumns("FMaterialID").Where(sqlWhere).ExecuteCommand();
|
|
|
|
result += UnionModifyData(viewList, "TFS_ViewMaterial", teamId, db, "FMaterialID");
|
|
|
|
result += UnionModifyData(viewList, "TFS_ViewMaterial", teamId, db, "FMaterialID");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -646,13 +686,49 @@ namespace FactorySystemBll
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int result = 0;
|
|
|
|
int result = 0;
|
|
|
|
SqlSugarClient db = AppSettingsHelper.GetSqlSugar();
|
|
|
|
SqlSugarClient db = AppSettingsHelper.GetSqlSugar();
|
|
|
|
|
|
|
|
MaterialBll materialBll = new MaterialBll();
|
|
|
|
|
|
|
|
|
|
|
|
if (viewList != null && viewList.Count > 0)
|
|
|
|
if (viewList != null && viewList.Count > 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
string sqlWhere = string.Format("FViewType={0} and FTeamID={1}", viewType, teamId);
|
|
|
|
|
|
|
|
|
|
|
|
string sqlWhere = string.Format("FViewType={0} and FHalfMaterialTeamID={1}", viewType, teamId);
|
|
|
|
|
|
|
|
|
|
|
|
if (viewType == 10)
|
|
|
|
if (viewType == 10)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
sqlWhere = string.Format("FViewType in (2, 3, 4, 5) and FTeamID={1}", viewType, teamId);
|
|
|
|
sqlWhere = string.Format("FViewType in (2, 3, 4, 5) and FHalfMaterialTeamID={1}", viewType, teamId);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
for (int i = 0; i < viewList.Count; i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
TFS_Material material = materialBll.GetMaterial(int.Parse(viewList[i]["FTypeID1"].ToString())).LastOrDefault();
|
|
|
|
|
|
|
|
//判断是否等于中间品
|
|
|
|
|
|
|
|
if (material.FType == "30")
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
TFS_Material material2 = materialBll.GetMaterial(int.Parse(viewList[i]["FTypeID2"].ToString())).LastOrDefault();
|
|
|
|
|
|
|
|
if (material2.FName.Contains("香基"))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (viewList[i].ContainsKey("FViewType"))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
viewList[i]["FViewType"] = (int)Constant.ViewType.香基视图;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
viewList[i].Add("FViewType", (int)Constant.ViewType.香基视图);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (viewList[i].ContainsKey("FViewType"))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
viewList[i]["FViewType"] = (int)Constant.ViewType.中间品视图;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
viewList[i].Add("FViewType", (int)Constant.ViewType.中间品视图);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
result += db.Updateable(viewList).AS("TFS_ViewMaterial").WhereColumns("FMaterialID").Where(sqlWhere).ExecuteCommand();
|
|
|
|
result += db.Updateable(viewList).AS("TFS_ViewMaterial").WhereColumns("FMaterialID").Where(sqlWhere).ExecuteCommand();
|
|
|
|
result += HalfMaterialUnionModifyData(viewList, "TFS_ViewMaterial", teamId, db, "FMaterialID");
|
|
|
|
result += HalfMaterialUnionModifyData(viewList, "TFS_ViewMaterial", teamId, db, "FMaterialID");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -674,6 +750,9 @@ namespace FactorySystemBll
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
result += db.Updateable(materialList).AS("TFS_Material").WhereColumns("FID").ExecuteCommand();
|
|
|
|
result += db.Updateable(materialList).AS("TFS_Material").WhereColumns("FID").ExecuteCommand();
|
|
|
|
result += HalfMaterialUnionModifyData(materialList, "TFS_Material", teamId, db);
|
|
|
|
result += HalfMaterialUnionModifyData(materialList, "TFS_Material", teamId, db);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -838,7 +917,7 @@ namespace FactorySystemBll
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public object EexcSql(int tempId=0)
|
|
|
|
public object EexcSql(int tempId = 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
string sql = "";
|
|
|
|
string sql = "";
|
|
|
|
if (tempId > 0)
|
|
|
|
if (tempId > 0)
|
|
|
|
|