commit by yzf

master
Yang 3 years ago
parent 480e3c1b0f
commit 20c5923aef

@ -89,7 +89,6 @@ namespace FactorySystemApi.Controllers
{
try
{
ids = MaterialTeamworkBll.UpdateFormula(inParam["FTestCode"].ToString(), inParam["FNewTestCode"].ToString());
inParam.TryGetValue("FState", out object state);
if (null == state)
{
@ -149,6 +148,10 @@ namespace FactorySystemApi.Controllers
//创建 TFS_FTeamwork
int teamId = BaseBll.InsertDataModel(inParam, "TFS_HalfMaterialFTeamwork");
ids = MaterialTeamworkBll.UpdateFormula(inParam["FTestCode"].ToString(), inParam["FNewTestCode"].ToString());
apiResult.Data = teamId;
if (teamId > 0)
{
@ -178,8 +181,8 @@ namespace FactorySystemApi.Controllers
*
*
* **/
BaseBll.CreateTaskData2(teamwork.FID, user.FID, "15"); //新增物料分类事项
BaseBll.UpdateTeamProcess2(teamId, (int)Constant.ProcessType., 2, 1); // 更新物料分类流程
BaseBll.CreateTaskData2(teamwork.FID, user.FID, "1"); //新增物料分类事项
BaseBll.UpdateTeamProcess2(teamId, (int)Constant.HalfMaterialProcessType., 2, 1); // 更新物料分类流程
////补充包材规格
//BaseBll.CreateTaskData(teamId, user.FID, "14");
@ -611,8 +614,8 @@ namespace FactorySystemApi.Controllers
*
*
* **/
BaseBll.CreateTaskData2(teamwork.FID, userId, "15"); //新增物料分类事项
BaseBll.UpdateTeamProcess2(teamId, (int)Constant.ProcessType., 2, 1); // 更新物料分类流程
BaseBll.CreateTaskData2(teamwork.FID, userId, "2"); //新增物料分类事项
BaseBll.UpdateTeamProcess2(teamId, (int)Constant.HalfMaterialProcessType., 2, 1); // 更新物料分类流程
////协同发起事项
//BaseBll.UpdateTeamProcess(teamwork.FID, (int)Constant.ProcessType.协同发起, 3, 2);
@ -640,7 +643,7 @@ namespace FactorySystemApi.Controllers
else
{
OperateLogBll.Add(teamwork.FID, 2, "BOM下载失败BOM数据为空", userId);
BaseBll.CreateTaskData2(teamwork.FID, userId, ((int)Constant.TaskType.BOM).ToString());
BaseBll.CreateTaskData2(teamwork.FID, userId, ((int)Constant.HalfMaterialTask.BOM).ToString());
BaseBll.UpdateTeamProcess2(teamwork.FID, (int)Constant.ProcessType., 2, 1);
HalfMaterialTeamworkBll.ChangeTeamProcess(teamwork.FID);
}
@ -648,7 +651,7 @@ namespace FactorySystemApi.Controllers
catch (Exception ex)
{
OperateLogBll.Add(teamwork.FID, 2, "BOM下载失败请稍后重试对接", userId);
BaseBll.CreateTaskData2(teamwork.FID, userId, ((int)Constant.TaskType.BOM).ToString());
BaseBll.CreateTaskData2(teamwork.FID, userId, ((int)Constant.HalfMaterialTask.BOM).ToString());
BaseBll.UpdateTeamProcess(teamwork.FID, (int)Constant.ProcessType., 2, 1);
ExceptionHelper.AddSystemJournal(Request, specifList[0], ex.Message, userId, "DockGetBomData");
}

@ -202,5 +202,65 @@ namespace FactorySystemApi.Controllers
}
}, apiResult, Request);
}
/// <summary>
/// 保存视图编辑的内容
/// </summary>
[HttpPost]
public ApiResult UpdateBatchById3(Dictionary<string, object> inParam)
{
var apiResult = new ApiResult();
return ExceptionHelper.TryReturnException(() =>
{
if (Request.Properties["token"] is ApiAuthInfo user)
{
inParam.TryGetValue("TFS_ViewMaterial", out object viewObj);
inParam.TryGetValue("TFS_Material", out object materialObj);
inParam.TryGetValue("TFS_MaterialInfo", out object infoObj);
List<Dictionary<string, object>> viewList = JsonConvert.DeserializeObject<List<Dictionary<string, object>>>(JsonConvert.SerializeObject(viewObj));
List<Dictionary<string, object>> materialList = JsonConvert.DeserializeObject<List<Dictionary<string, object>>>(JsonConvert.SerializeObject(materialObj));
List<Dictionary<string, object>> infoList = JsonConvert.DeserializeObject<List<Dictionary<string, object>>>(JsonConvert.SerializeObject(infoObj));
int teamId = int.Parse(inParam["FTeamID"].ToString());
int viewType = int.Parse(inParam["FViewType"].ToString());
apiResult.Data = _viewBll.UpdateBatchById3(viewList, materialList, infoList, teamId, viewType, user.FID);
if (viewType == 10)
{
// 创建物料视图事项
TFS_HalfMaterialFTeamwork teamwork = BaseBll.GetTempModel<TFS_HalfMaterialFTeamwork>(teamId);
List<Dictionary<string, object>> vml = _viewBll.GetListByTeamId(teamId, viewType, user.FID, out List<int> materialId, out string FGuaranteePeriod, out string FStorageConditions, true);
Dictionary<int, string> hasNewView = new Dictionary<int, string>();
if (vml != null)
{
foreach (Dictionary<string, object> row in vml)
{
int materialType = (int)(long)row["FViewType"];
string factoryId = row["FFactoryID"].ToString();
if (materialType == 2 || materialType == 3 || materialType == 4 || materialType == 5)
{
if (hasNewView.ContainsKey(materialType))
{
hasNewView[materialType] = hasNewView[materialType] + factoryId + ",";
}
else
{
hasNewView.Add(materialType, factoryId + ",");
}
}
}
HalfMaterialTeamworkBll TeamworkBll = new HalfMaterialTeamworkBll();
TeamworkBll.CreateMaterialTask(hasNewView, teamwork, user.FID);
}
BaseBll.CreateTaskData2(teamId, user.FID, "3");
BaseBll.UpdateTeamProcess2(teamwork.FID, (int)Constant.HalfMaterialProcessType., 3, 2);
BaseBll.UpdateTeamProcess2(teamwork.FID, (int)Constant.HalfMaterialProcessType., 2, 1);
}
}
}, apiResult, Request);
}
}
}

@ -233,7 +233,7 @@ namespace FactorySystemBll
{
SqlSugarClient db = AppSettingsHelper.GetSqlSugar();
TBasicCode basicCode = db.Queryable<TBasicCode>().Where(s => s.FValue == proType.ToString()
&& s.FType == (int)Constant.BasicCode.).First();
&& s.FType == (int)Constant.BasicCode.).First();
if (basicCode != null)
{
Dictionary<string, object> updateModel = new Dictionary<string, object>();
@ -488,7 +488,7 @@ namespace FactorySystemBll
List<string> taskTypeList = taskTypes.Split(',').ToList();
List<TBasicCode> basicCodeList = db.Queryable<TBasicCode>().Where(s => s.FType == (int)Constant.BasicCode.
List<TBasicCode> basicCodeList = db.Queryable<TBasicCode>().Where(s => s.FType == (int)Constant.BasicCode.
&& s.FState == 1 && taskTypeList.Contains(s.FValue)).ToList();
PropertyInfo[] basicCodeProps = typeof(TBasicCode).GetProperties();

@ -568,7 +568,7 @@ namespace FactorySystemBll
if (hasNewView.ContainsKey((int)Constant.ViewType.) || hasNewView.ContainsKey((int)Constant.ViewType.)
|| hasNewView.ContainsKey((int)Constant.ViewType.))
{
proSql += string.Format("update TFS_MaterialFTeamwork set FViewType=FViewType+',3,4' where FID={0};", teamInfo.FID);
proSql += string.Format("update TFS_HalfMaterialFTeamwork set FViewType=FViewType+',3,4' where FID={0};", teamInfo.FID);
BaseBll.CreateTaskData2(teamInfo.FID, userId, "8");
}
proSql += BaseBll.GetProcessSql2(teamInfo.FID, (int)Constant.ProcessType., "F2", 1);

@ -32,8 +32,8 @@ namespace FactorySystemBll
* viewTypeTBasicCodeFType=33FRemark
* **/
List<Dictionary<string, object>> viewList = new List<Dictionary<string, object>>();
if (viewType == 10)
List<int> viewTypes=new List<int> { 2,3,4,5,10};
if (viewTypes.Contains(viewType))
{
viewList = db.Queryable<TFS_ViewMaterial, TFS_Material>((a, b) =>
new JoinQueryInfos(JoinType.Inner, a.FMaterialID == b.FID))
@ -401,6 +401,120 @@ namespace FactorySystemBll
}
return result;
}
/// <summary>
/// 试验号变更-保存视图编辑内容3
/// </summary>
public int UpdateBatchById3(List<Dictionary<string, object>> viewList, List<Dictionary<string, object>> materialList,
List<Dictionary<string, object>> infoList, int teamId, int viewType, int userId)
{
int result = 0;
SqlSugarClient db = AppSettingsHelper.GetSqlSugar();
if (viewList != null && viewList.Count > 0)
{
string sqlWhere = string.Format("FViewType={0} and FTeamID={1}", viewType, teamId);
if (viewType == 10)
{
sqlWhere = string.Format("FViewType in (2, 3, 4, 5) and FTeamID={1}", viewType, teamId);
}
result += db.Updateable(viewList).AS("TFS_ViewMaterial").WhereColumns("FMaterialID").Where(sqlWhere).ExecuteCommand();
result += UnionModifyData(viewList, "TFS_ViewMaterial", teamId, db, "FMaterialID");
}
if (materialList != null && materialList.Count > 0)
{
for (int i = 0; i < materialList.Count; i++)
{
materialList[i]["FID"] = materialList[i]["FMaterialID"];
materialList[i].Remove("FMaterialID");
if (materialList[i].TryGetValue("FK3Code", out object k3Code))
{
if (materialList[i].ContainsKey("FK3ShortCode"))
{
materialList[i]["FK3ShortCode"] = k3Code.ToString().Split('.').Last();
}
else
{
materialList[i].Add("FK3ShortCode", k3Code.ToString().Split('.').Last());
}
}
}
result += db.Updateable(materialList).AS("TFS_Material").WhereColumns("FID").ExecuteCommand();
result += UnionModifyData(materialList, "TFS_Material", teamId, db);
}
if (infoList != null && infoList.Count > 0)
{
for (int i = 0; i < infoList.Count; i++)
{
infoList[i]["FDataID"] = infoList[i]["FMaterialID"];
infoList[i].Remove("FMaterialID");
infoList[i].Add("FType", 2);
}
result += db.Updateable(infoList).AS("TFS_MaterialInfo").WhereColumns("FType", "FDataID").ExecuteCommand();
result += UnionModifyData(infoList, "TFS_MaterialInfo", teamId, db, "FDataID");
}
//result += CheckTaskComplete2(db, teamId, viewType, userId);
return result;
}
/// <summary>
/// 试验号变更-
/// </summary>
/// <param name="db"></param>
/// <param name="teamId"></param>
/// <param name="taskType"></param>
/// <param name="userId"></param>
/// <returns></returns>
private int CheckTaskComplete2(SqlSugarClient db, int teamId, int taskType, int userId)
{
int result = 0;
//List<string> fields = db.Queryable<TBasicCode, TFS_ViewFieldInfo>((a, b) => new JoinQueryInfos(JoinType.Left, a.F2 == b.FID.ToString()))
// .Where((a, b) => a.FType == 40 && b.FType == 1 && a.F1 == taskType.ToString()).Select((a, b) => b.FField).ToList();
//string okSql = string.Format("select count(1) from TFS_ViewMaterial where FTeamID={0} and FViewType={1} and(", teamId, taskType);
//okSql += string.Join("='' or ", fields).Replace("TFS_ViewMaterial.", "") + "='')";
//string okResult = db.Ado.GetString(okSql);
string okResult = "";
if (string.IsNullOrEmpty(okResult) || okResult == "0")
{
if (taskType != 10)
{
//视图类型+2是事项除了包材
taskType += 2;
if (taskType >= (int)Constant.TaskType.) taskType = (int)Constant.TaskType.;
}
else
{
taskType = 15;
}
string taskSql = "";
int proType = -2; string appSql = " and(select count(1) from TFS_HalfMaterialTask t where t.FTeamID=a.FTeamID and t.FType in({0}) and t.FState!=2)=0";
switch (taskType)
{
case 3://成品视图事项:3→成品视图2
proType = 2;
break;
case 4://新半成品视图:4
case 5://新中间品视图:5
case 6://新香基视图:6→新半成品/中间品/香基3
proType = 3;
appSql = string.Format(appSql, "4,5,6");
break;
case 7://新原料视图:7→新原料视图:4
proType = 4;
break;
case 15://物料分类视图:15→物料分类视图:0
proType = 0;
break;
case 11://新包材视图:7→新原料视图:8
proType = 8;
break;
}
if (taskType == 15 || proType > 0) taskSql = BaseBll.GetProcessSql2(teamId, proType, "F3", 2, string.Format(appSql, taskType));
taskSql = BaseBll.GetTaskSql2(-1, 2, teamId, taskType, -1, string.Format("','+a.FUserID+',' like ',%{0}%,'", userId)) + taskSql;
result += db.Ado.ExecuteCommand(taskSql);
HalfMaterialTeamworkBll.ChangeTeamProcess(teamId);
}
return result;
}
/// <summary>
/// 联合修改

@ -55,7 +55,10 @@ namespace FactorySystemModel.EnumModel
= 41,
= 42,
= 43,
= 44
= 44,
=45,
=46
}
/// <summary>
@ -102,7 +105,8 @@ namespace FactorySystemModel.EnumModel
= 13,
= 14,
= 15,
=16
=16,
=17
}
/// <summary>
@ -120,7 +124,8 @@ namespace FactorySystemModel.EnumModel
= 7,
BOM = 8,
= 9,
=10
=10,
=11
}
/// <summary>
@ -168,5 +173,22 @@ namespace FactorySystemModel.EnumModel
= 30,
= 40
}
//code=45
public enum HalfMaterialTask
{
BOM = 1,
= 2,
= 3
}
//code=46
public enum HalfMaterialProcessType
{
= 1,
= 2,
= 3,
}
}
}

Loading…
Cancel
Save