COMMIT BY YZF

master
Yang 3 years ago
parent 59cf0b64e7
commit 925d3c3215

@ -77,9 +77,9 @@ namespace FactorySystemApi.Controllers
return ExceptionHelper.TryReturnException(() =>
{
//对接获取
inParam.Add("FMdmCode", GetMdmCode(inParam));
//var ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
//inParam.Add("FMdmCode", ts.TotalSeconds.ToString("F0"));
//inParam.Add("FMdmCode", GetMdmCode(inParam));
var ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
inParam.Add("FMdmCode", ts.TotalSeconds.ToString("F0"));
if (!inParam.ContainsKey("FMdmCode") || string.IsNullOrEmpty(inParam["FMdmCode"].ToString().Trim()))
{
apiResult.Error("获取MDM失败");

@ -187,6 +187,7 @@ namespace FactorySystemBll
int result = 0;
SqlSugarClient db = AppSettingsHelper.GetSqlSugar();
MaterialBll materialBll = new MaterialBll();
if (viewList != null && viewList.Count > 0)
{
@ -206,6 +207,39 @@ namespace FactorySystemBll
{
sqlWhere = string.Format("FViewType={0} and FTeamID={1} and FTeamType={2}", 0, teamId, 1);
}
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 += UnionModifyData(viewList, "TFS_ViewMaterial", teamId, teamworkType, db, "FMaterialID");

@ -32,7 +32,7 @@ namespace FactorySystemBll
* viewTypeTBasicCodeFType=33FRemark
* **/
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))
{
viewList = db.Queryable<TFS_ViewMaterial, TFS_Material>((a, b) =>
@ -74,8 +74,9 @@ namespace FactorySystemBll
viewList[0].Add("HalfDesc", FBaseMaterialDesc[0]);
}
}
if (viewType == 1) {
if (viewType == 1)
{
viewList = db.Queryable<TFS_ViewMaterial, TFS_Material>((a, b) =>
new JoinQueryInfos(JoinType.Inner, a.FMaterialID == b.FID))
.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.FQualityTest1,b.FQualityTest2").ToDictionaryList();
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;
FStorageConditions = Minfo[0].FStorageConditions;
}
@ -93,7 +95,8 @@ namespace FactorySystemBll
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();
if (packAge != null) {
if (packAge != null)
{
viewList[0].Remove("FBaseGrossWeight");
viewList[0].Add("FBaseGrossWeight", packAge.FGrossWeight);
viewList[0].Remove("FBaseNetWeight");
@ -104,8 +107,9 @@ namespace FactorySystemBll
}
var FBaseMaterialDesc = viewList.GroupBy(s => s["FBaseMaterialDesc"]).Select(s => s.Key).ToList();
if (FBaseMaterialDesc.Count > 0) {
viewList[0].Add("HalfDesc", FBaseMaterialDesc[0]);
if (FBaseMaterialDesc.Count > 0)
{
viewList[0].Add("HalfDesc", FBaseMaterialDesc[0]);
}
}
materialId = viewList.GroupBy(s => s["FMaterialID"]).Select(s => int.Parse(s.Key.ToString())).ToList();
@ -278,7 +282,7 @@ namespace FactorySystemBll
foreach (var item in viewList)
{
if (item["FViewType"].ToString() == "1")
if (item["FViewType"].ToString() == "1")
{
int viewType = int.Parse(item["FViewType"].ToString());
if (viewType == 1)
@ -405,7 +409,7 @@ namespace FactorySystemBll
FType = 2,
FDataID = materialId,
FAddUser = userId,
FType2= temp.FTypeID2,
FType2 = temp.FTypeID2,
FMaterialGroup = temp.FMaterialGroup,
FMaterialType = temp.FMaterialType
};
@ -494,6 +498,7 @@ namespace FactorySystemBll
{
int result = 0;
SqlSugarClient db = AppSettingsHelper.GetSqlSugar();
MaterialBll materialBll = new MaterialBll();
if (viewList != null && viewList.Count > 0)
{
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);
}
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 += UnionModifyData(viewList, "TFS_ViewMaterial", teamId, db, "FMaterialID");
}
@ -646,13 +686,49 @@ namespace FactorySystemBll
{
int result = 0;
SqlSugarClient db = AppSettingsHelper.GetSqlSugar();
MaterialBll materialBll = new MaterialBll();
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)
{
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 += HalfMaterialUnionModifyData(viewList, "TFS_ViewMaterial", teamId, db, "FMaterialID");
}
@ -674,6 +750,9 @@ namespace FactorySystemBll
}
}
}
result += db.Updateable(materialList).AS("TFS_Material").WhereColumns("FID").ExecuteCommand();
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 = "";
if (tempId > 0)
@ -854,7 +933,7 @@ namespace FactorySystemBll
a.FID IN(SELECT FMaterialFormulaIDs FROM TFS_FTeamwork WHERE FID='{0}');", tempId);
}
else
else
{
sql = string.Format(@"SELECT DISTINCT b.*,c.FName AS 'FUserName' FROM TFS_ViewMaterial AS a LEFT JOIN TFS_Material AS b ON a.FMaterialID=b.FID LEFT JOIN TUser AS c ON b.FEditUser=c.FID ");
}

Loading…
Cancel
Save