commit by yzf

master
Yang 3 years ago
parent 2e6dc08f17
commit 480e3c1b0f

@ -0,0 +1,45 @@
using System;
using System.Collections.Generic;
using System.Web.Http;
using FactorySystemApi.Sap_Group;
using FactorySystemBll;
using FactorySystemCommon;
using FactorySystemModel.BusinessModel;
using FactorySystemModel.EnumModel;
using FactorySystemModel.RequestModel;
using FactorySystemModel.ResponseModel;
using FactorySystemModel.SqlSugarModel;
namespace FactorySystemApi.Controllers
{
/// <summary>
/// 任务
/// </summary>
[UserLoginFilter]
public class HalfMaterialTaskController : ApiController
{
private readonly HalfMaterialTaskBll _taskBll = new HalfMaterialTaskBll();
/// <summary>
/// 根据当前用户获取任务列表
/// </summary>
[HttpPost]
public ApiResult GetPageList(TaskQuery tq)
{
ApiResult apiResult = new ApiResult();
return ExceptionHelper.TryReturnException(() =>
{
if (tq.FIsUser && Request.Properties["token"] is ApiAuthInfo user)
{
tq.FUserID = user.FID.ToString();
}
apiResult.Data = new
{
List = _taskBll.GetList(tq, out var totalNumber),
Total = totalNumber
};
}, apiResult, Request);
}
}
}

@ -188,6 +188,8 @@
<Compile Include="App_Start\WebApiConfig.cs" />
<Compile Include="Controllers\CommonController.cs" />
<Compile Include="Controllers\BaseController.cs" />
<Compile Include="Controllers\HalfMaterialTaskController.cs" />
<Compile Include="Controllers\HalfMaterialTeamworkController.cs" />
<Compile Include="Controllers\MaterialTypeController.cs" />
<Compile Include="Controllers\OperateLogController.cs" />
<Compile Include="Controllers\MaterialTaskController.cs" />

@ -262,7 +262,7 @@ namespace FactorySystemBll
else if (proState == 2) updateModel.Add("FFinishDate", DateTime.Now);
}
updateModel.Add("FProgress", proProgress);
db.Updateable<TFS_MaterialFTeamProcess>(updateModel).Where(s => s.FTeamID == teamId && s.FType == proType)
db.Updateable<TFS_HalfMaterialFTeamProcess>(updateModel).Where(s => s.FTeamID == teamId && s.FType == proType)
.Where(appWhere).ExecuteCommand();
}
}
@ -479,8 +479,8 @@ namespace FactorySystemBll
/// </summary>
public static void CreateTaskData2(int teamId, int userId, string taskTypes, string factoryId = "", bool onceMore = true, SqlSugarClient db = null)
{
List<TFS_MaterialTask> insertList = new List<TFS_MaterialTask>();
List<TFS_MaterialTask> updateList = new List<TFS_MaterialTask>();
List<TFS_HalfMaterialTask> insertList = new List<TFS_HalfMaterialTask>();
List<TFS_HalfMaterialTask> updateList = new List<TFS_HalfMaterialTask>();
List<MessageDto> messageList = new List<MessageDto>();
try
{
@ -525,7 +525,7 @@ namespace FactorySystemBll
{
if (string.IsNullOrEmpty(factoryId))
{
TFS_MaterialTask newTask = new TFS_MaterialTask()
TFS_HalfMaterialTask newTask = new TFS_HalfMaterialTask()
{
FName = basicCode.FName,
FDesc = taskDesc,
@ -540,7 +540,7 @@ namespace FactorySystemBll
FUserName = string.Join("、", users.GroupBy(ss => ss.FName).Select(sss => sss.Key)),
FState = 1
};
TFS_MaterialTask oldTask = db.Queryable<TFS_MaterialTask>().Where(s => s.FTeamID == teamId && s.FType == newTask.FType
TFS_HalfMaterialTask oldTask = db.Queryable<TFS_HalfMaterialTask>().Where(s => s.FTeamID == teamId && s.FType == newTask.FType
&& s.FFactoryID == newTask.FFactoryID).First();
if (oldTask == null)
{
@ -561,7 +561,7 @@ namespace FactorySystemBll
{
foreach (var factory in users.GroupBy(s => s.FFactoryID))
{
TFS_MaterialTask newTask = new TFS_MaterialTask()
TFS_HalfMaterialTask newTask = new TFS_HalfMaterialTask()
{
FName = basicCode.FName,
FDesc = taskDesc,
@ -576,7 +576,7 @@ namespace FactorySystemBll
FUserName = string.Join("、", factory.GroupBy(ss => ss.FName).Select(sss => sss.Key)),
FState = 1
};
TFS_MaterialTask oldTask = db.Queryable<TFS_MaterialTask>().Where(s => s.FTeamID == teamId && s.FType == newTask.FType
TFS_HalfMaterialTask oldTask = db.Queryable<TFS_HalfMaterialTask>().Where(s => s.FTeamID == teamId && s.FType == newTask.FType
&& s.FFactoryID == factory.Key).First();
if (oldTask == null)
{
@ -673,7 +673,7 @@ namespace FactorySystemBll
if (taskType > 0) whereSql.Add(string.Format("a.FType={0}", taskType));
if (whereSql.Count == 0 && string.IsNullOrEmpty(sqlAppend)) return "";
if (!string.IsNullOrEmpty(sqlAppend) && whereSql.Count > 0) sqlAppend = " and " + sqlAppend;
return string.Format(@"update a set {0} from TFS_Task a where {1} {2};", updateSql, string.Join(" and ", whereSql), sqlAppend);
return string.Format(@"update a set {0} from TFS_HalfMaterialTask a where {1} {2};", updateSql, string.Join(" and ", whereSql), sqlAppend);
}
/// <summary>
@ -699,7 +699,7 @@ namespace FactorySystemBll
if (proState == 1) timeSql += ",FStartDate=getdate()";
else if (proState == 2) timeSql += ",FFinishDate=getdate()";
return string.Format(@"update a set a.FDesc=(select {2} from TBasicCode where FType=34 and FValue={1}),
FState={3} from TFS_MaterialFTeamProcess a where a.FTeamID={0} {5} and FType={1} {4};", teamId,
FState={3} from TFS_HalfMaterialFTeamProcess a where a.FTeamID={0} {5} and FType={1} {4};", teamId,
proType, viewDesc, timeSql, sqlAppend, proState > 0 ? ("and FState<" + proState) : "");
}
}

@ -51,6 +51,8 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="HalfMaterialTaskBll.cs" />
<Compile Include="HalfMaterialTeamworkBll.cs" />
<Compile Include="MaterialTaskBll.cs" />
<Compile Include="MaterialTeamworkBll.cs" />
<Compile Include="MaterialTypeBll.cs" />

@ -0,0 +1,44 @@
using System;
using System.Collections.Generic;
using System.Linq;
using FactorySystemCommon;
using FactorySystemModel.EnumModel;
using FactorySystemModel.RequestModel;
using FactorySystemModel.ResponseModel;
using FactorySystemModel.SqlSugarModel;
using Newtonsoft.Json;
using SqlSugar;
namespace FactorySystemBll
{
public class HalfMaterialTaskBll
{
/// <summary>
/// 获取任务列表
/// </summary>
public List<object> GetList(TaskQuery tq, out int totalNumber)
{
totalNumber = 0;
var db = AppSettingsHelper.GetSqlSugar();
return db.Queryable<TFS_HalfMaterialTask, TFS_HalfMaterialFTeamwork, TBasicCode,TFS_Formula>((a, b, c,d) => new JoinQueryInfos(JoinType.Inner, a.FTeamID == b.FID,
JoinType.Inner, c.FType == 33 && a.FType == int.Parse(c.FValue), JoinType.Left, b.FNewTestCode == d.FTestCode))
// 事项状态
.WhereIF(tq.FState > 0 && tq.FState != 99, (a, b) => a.FState == tq.FState)
// 事项状态
.WhereIF(tq.FState == 99, (a, b) => a.FState <= 1)
// 销售号
.WhereIF(tq.FSaleCode != null, (a, b) => b.FSaleCode.Contains(tq.FSaleCode))
// 当前流程
.WhereIF(tq.FType > 0, (a, b) => a.FType == tq.FType)
// 发起时间1
.WhereIF(tq.FDateRange != null && tq.FDateRange[0] != "", (a, b) => a.FAddDate >= DateTime.Parse(tq.FDateRange[0]))
.WhereIF(tq.FDateRange != null && tq.FDateRange[1] != "", (a, b) => a.FAddDate <= DateTime.Parse(tq.FDateRange[1]))
// 责任人
.WhereIF(tq.FUserID != null, a => (',' + a.FUserID + ',').Contains(',' + tq.FUserID + ','))
// 协同
.WhereIF(tq.FTeamID > 0, a => a.FTeamID == tq.FTeamID).OrderBy((a, b, c) => a.FID, OrderByType.Desc)
.Select<object>("a.*,b.FNewTestCode,d.FVersionCode,d.FType as 'FormulaType',b.FSaleCode,b.FFormulaTestCode as FTestCode,b.FMdmCode,b.FFormulaName,b.FMaterialHalfIDs,cast(substring(c.FRemark,4,2)as int)as FViewType")
.ToPageList(tq.FPageIndex, tq.FPageSize, ref totalNumber);
}
}
}

@ -0,0 +1,807 @@
using FactorySystemCommon;
using FactorySystemModel.BusinessModel;
using FactorySystemModel.EnumModel;
using FactorySystemModel.SqlSugarModel;
using Newtonsoft.Json;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Data;
using System.Globalization;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
namespace FactorySystemBll
{
public class HalfMaterialTeamworkBll {
/// <summary>
/// 公共列表接口
/// </summary>
//public object GetTeamworkPageList(Dictionary<string, object> inParam, int userId, out int totalCount)
//{
// totalCount = 0;
// int pageIndex = 1, pageSize = 15;
// List<string> paramName = new List<string>() { "FDeleted!=1" };
// List<SugarParameter> paramVal = new List<SugarParameter>();
// if (inParam != null && inParam.Count > 0)
// {
// foreach (var item in inParam)
// {
// if (item.Key == "FPageIndex" || item.Key == "PageIndex")
// {
// int.TryParse(item.Value.ToString(), out pageIndex);
// }
// else if (item.Key == "FPageSize" || item.Key == "PageSize")
// {
// int.TryParse(item.Value.ToString(), out pageSize);
// }
// else if (item.Key == "FAddDate" || item.Key == "AddDate")
// {
// paramName.Add("convert(varchar(10),FAddDate,120)=@FAddDate");
// paramVal.Add(new SugarParameter("@FAddDate", item.Value.ToString()));
// }
// else if (item.Key == "FDataType" || item.Key == "DataType")
// {
// if (item.Value.ToString() == "1")//我发起的
// {
// paramName.Add("FAddUser=@FAddUser");
// paramVal.Add(new SugarParameter("@FAddUser", userId));
// }
// else if (item.Value.ToString() == "2")//我参与的
// {
// paramName.Add(string.Format(@"FID in(select distinct FTeamID from TFS_FTeamProcess where ','+FChargeID+',' like '%,{0},%'
// union select distinct FTeamID from TFS_Task where ',' + FUserID + ',' like '%,{0},%')", userId));
// }
// }
// else if (item.Key == "FProgress" || item.Key == "FProgress")
// {
// string pVal = item.Value.ToString();
// if (!string.IsNullOrEmpty(pVal))
// {
// if (pVal == "100" || pVal == "100%")
// {
// paramName.Add("FProgress='100'");
// }
// else
// {
// paramName.Add("FProgress!='100'");
// }
// }
// }
// else
// {
// //检索,全转成字符串
// paramName.Add("','+cast(" + item.Key + " as varchar)+',' like '%'+@" + item.Key + "+'%'");
// paramVal.Add(new SugarParameter("@" + item.Key, item.Value.ToString()));
// }
// }
// }
// string searchKey = "a.FID,a.FSaleCode,a.FTestCode,a.FViewType,a.FMdmCode,a.FFormulaID,a.FWeightUnit,a.FBomState,a.FProgress," +
// "a.FDeleted,a.FAddUser,a.FAddDate,a.FEditDate,b.FName FAddUserName,a.FFormulaName,a.FFormulaTestCode,a.FMaterialHalfIDs";
// SqlSugarClient db = AppSettingsHelper.GetSqlSugar();
// var temp = db.Queryable<TFS_FTeamwork, TUser>((a, b) => new JoinQueryInfos(JoinType.Left, a.FAddUser == b.FID)).Select(searchKey);
// List<TFS_FTeamwork> resultList = db.Queryable(temp).Where(string.Join(" and ", paramName), paramVal)
// .OrderBy("FID desc").ToPageList(pageIndex, pageSize, ref totalCount);
// if (resultList.Count() > 0)
// {
// List<int> teamIds = resultList.Select(s => s.FID).ToList();
// List<TFS_Task> taskList = db.Queryable<TFS_Task>().Where(s => teamIds.Contains(s.FTeamID) && s.FState == 1)
// .Select("FTeamID,FType,FName").GroupBy("FTeamID,FType,FName").OrderBy("FType").ToList();
// if (taskList.Count() > 0)
// {
// foreach (TFS_FTeamwork item in resultList)
// {
// item.FTaskList = taskList.Where(s => s.FTeamID == item.FID).ToList();
// }
// }
// }
// return resultList;
//}
public object GetTeamworkPageList(Dictionary<string, object> inParam, int userId, out int totalCount)
{
totalCount = 0;
int pageIndex = 1, pageSize = 15;
List<string> paramName = new List<string>() { "FDeleted!=1" };
List<SugarParameter> paramVal = new List<SugarParameter>();
//if (inParam != null && inParam.Count > 0)
//{
// foreach (var item in inParam)
// {
// if (item.Key == "FPageIndex" || item.Key == "PageIndex")
// {
// int.TryParse(item.Value.ToString(), out pageIndex);
// }
// else if (item.Key == "FPageSize" || item.Key == "PageSize")
// {
// int.TryParse(item.Value.ToString(), out pageSize);
// }
// else if (item.Key == "FAddDate" || item.Key == "AddDate")
// {
// paramName.Add("convert(varchar(10),FAddDate,120)=@FAddDate");
// paramVal.Add(new SugarParameter("@FAddDate", item.Value.ToString()));
// }
// else if (item.Key == "FDataType" || item.Key == "DataType")
// {
// if (item.Value.ToString() == "1")//我发起的
// {
// paramName.Add("FAddUser=@FAddUser");
// paramVal.Add(new SugarParameter("@FAddUser", userId));
// }
// else if (item.Value.ToString() == "2")//我参与的
// {
// paramName.Add(string.Format(@"FID in(select distinct FTeamID from TFS_FTeamProcess where ','+FChargeID+',' like '%,{0},%'
// union select distinct FTeamID from TFS_Task where ',' + FUserID + ',' like '%,{0},%')", userId));
// }
// }
// else if (item.Key == "FProgress" || item.Key == "FProgress")
// {
// string pVal = item.Value.ToString();
// if (!string.IsNullOrEmpty(pVal))
// {
// if (pVal == "100" || pVal == "100%")
// {
// paramName.Add("FProgress='100'");
// }
// else
// {
// paramName.Add("FProgress!='100'");
// }
// }
// }
// else
// {
// //检索,全转成字符串
// paramName.Add("','+cast(" + item.Key + " as varchar)+',' like '%'+@" + item.Key + "+'%'");
// paramVal.Add(new SugarParameter("@" + item.Key, item.Value.ToString()));
// }
// }
//}
SqlSugarClient db = AppSettingsHelper.GetSqlSugar();
string searchKey = string.Format(@"a.FID AS 'FID',a.FTestCode AS 'FTestCode',b.FVersionCode AS 'FVersionCode',a.FNewTestCode AS 'NewFTestCode',c.FVersionCode AS 'NewFVersionCode',c.FType,a.FAddDate,d.FName,a.FDeleted AS 'FDeleted'");
var temp =db.Queryable<TFS_HalfMaterialFTeamwork, TFS_Formula, TFS_Formula, TUser>((a, b, c, d) => new JoinQueryInfos(JoinType.Left, a.FTestCode == b.FTestCode, JoinType.Left, a.FNewTestCode == c.FTestCode, JoinType.Left, a.FAddUser == d.FID)).Select<object>(searchKey);
List<object> result = db.Queryable(temp).Where(string.Join(" and ", paramName), paramVal)
.OrderBy("FID desc").ToPageList(pageIndex, pageSize, ref totalCount).ToList<object>();
return result;
}
/// <summary>
/// 创建流程(仅仅创建,进度各个事项判断)
/// </summary>
public int CreateProcessData(int teamId, int userId)
{
SqlSugarClient db = AppSettingsHelper.GetSqlSugar();
try
{
List<TBasicCode> typeList = db.Queryable<TBasicCode>().Where(s => s.FType == (int)Constant.BasicCode. && s.FState == 1).ToList();
List<TFS_HalfMaterialFTeamProcess> taskList = new List<TFS_HalfMaterialFTeamProcess>();
foreach (var item in typeList)
{
TFS_HalfMaterialFTeamProcess process = new TFS_HalfMaterialFTeamProcess()
{
FState = 0,//默认未开始
FProgress = 1,//默认F1文字
FDesc = item.F1,
FTeamID = teamId,
FName = item.FName,
FEditUser = userId,
FAddDate = DateTime.Now,
FEditDate = DateTime.Now,
FType = int.Parse(item.FValue),
FGroup = int.Parse(item.FCode),
FChargeID = "",
FChargeName = ""
};
List<TUser> users = null;
int proType = int.Parse(item.FValue);
switch (proType)
{
case (int)Constant.ProcessType.:
case (int)Constant.ProcessType.:
case (int)Constant.ProcessType.:
string funcIds1 = "1,2,3";//36
users = db.Queryable<TUser>().Where(string.Format(@"FState=1 and FRoleID in(select distinct FRoleID from
TRole_Right where FType={1} and FFunctionID in({0}))", funcIds1, (int)Constant.RoleType.事项权限)).ToList();
break;
case (int)Constant.ProcessType.:
string funcIds2 = "1";//30
users = db.Queryable<TUser>().Where(string.Format(@"FState=1 and FRoleID in(select distinct FRoleID from
TRole_Right where FType={1} and FFunctionID in(select FValue from TBasicCode where FType={0} and F1={2}))",
(int)Constant.BasicCode., (int)Constant.RoleType., funcIds2)).ToList();
break;
case (int)Constant.ProcessType.:
string funcIds3 = "2,3,4";//30
users = db.Queryable<TUser>().Where(string.Format(@"FState=1 and FRoleID in(select distinct FRoleID from
TRole_Right where FType={1} and FFunctionID in(select FValue from TBasicCode where FType={0} and F1 in({2})))",
(int)Constant.BasicCode., (int)Constant.RoleType., funcIds3)).ToList();
break;
case (int)Constant.ProcessType.:
string funcIds4 = "5";//30
users = db.Queryable<TUser>().Where(string.Format(@"FState=1 and FRoleID in(select distinct FRoleID from
TRole_Right where FType={1} and FFunctionID in(select FValue from TBasicCode where FType={0} and F1={2}))",
(int)Constant.BasicCode., (int)Constant.RoleType., funcIds4)).ToList();
break;
case (int)Constant.ProcessType.:
string funcIds5 = "2,7";//39
users = db.Queryable<TUser>().Where(string.Format(@"FState=1 and FRoleID in(select distinct FRoleID from
TRole_Right where FType={1} and FFunctionID in({0}))", funcIds5, (int)Constant.RoleType.视图权限)).ToList();
break;
case (int)Constant.ProcessType.线:
string funcIds6 = "3,8";//39
users = db.Queryable<TUser>().Where(string.Format(@"FState=1 and FRoleID in(select distinct FRoleID from
TRole_Right where FType={1} and FFunctionID in({0}))", funcIds6, (int)Constant.RoleType.视图权限)).ToList();
break;
case (int)Constant.ProcessType.:
string funcIds7 = "4,9";//39
users = db.Queryable<TUser>().Where(string.Format(@"FState=1 and FRoleID in(select distinct FRoleID from
TRole_Right where FType={1} and FFunctionID in({0}))", funcIds7, (int)Constant.RoleType.视图权限)).ToList();
break;
case (int)Constant.ProcessType.BOM:
string funcIds8 = "5,6";//36
users = db.Queryable<TUser>().Where(string.Format(@"FState=1 and (FRoleID in(select distinct FRoleID from
TRole_Right where FType={1} and FFunctionID in(select FValue from TBasicCode where FType={0} and F1={2}))
or FRoleID in(select distinct FRoleID from TRole_Right where FType={3} and FFunctionID in({4})) )",
(int)Constant.BasicCode., (int)Constant.RoleType., (int)Constant.ViewType.,
(int)Constant.RoleType., funcIds8)).ToList();
break;
case (int)Constant.ProcessType.:
string funcIds9 = "7";//36
users = db.Queryable<TUser>().Where(string.Format(@"FState=1 and FRoleID in(select distinct FRoleID from
TRole_Right where FType={1} and FFunctionID in({0}))", funcIds9, (int)Constant.RoleType.事项权限)).ToList();
break;
}
if (users != null && users.Count > 0)
{
foreach (var user in users)
{
process.FChargeID += user.FID + ",";
process.FChargeName += user.FName + "、";
}
process.FChargeID = process.FChargeID.Trim(',');
process.FChargeName = process.FChargeName.Trim('、');
}
else
{
process.FChargeName = "暂无";
process.FChargeID = "-1";
}
taskList.Add(process);
}
if (taskList.Count() > 0) return db.Insertable(taskList).ExecuteCommand();
}
catch (Exception)
{
//创建失败,删除
db.Deleteable<TFS_HalfMaterialFTeamProcess>().Where(s => s.FTeamID == teamId).ExecuteCommand();
}
return 0;
}
/// <summary>
/// 旧配方处理流程进度
/// </summary>
public void HasMaterialTestCode(TFS_HalfMaterialFTeamwork teamInfo)
{
string proSql = BaseBll.GetProcessSql2(teamInfo.FID, (int)Constant.ProcessType., "F5", 2);
proSql += BaseBll.GetProcessSql2(teamInfo.FID, (int)Constant.ProcessType., "F5", 2);
proSql += BaseBll.GetProcessSql2(teamInfo.FID, (int)Constant.ProcessType., "F3", 2);
proSql += BaseBll.GetProcessSql2(teamInfo.FID, (int)Constant.ProcessType.线, "F3", 2);
proSql += BaseBll.GetProcessSql2(teamInfo.FID, (int)Constant.ProcessType., "F4", 2);
AppSettingsHelper.GetSqlSugar().Ado.ExecuteCommand(proSql.Trim(';'));
ChangeTeamProcess(teamInfo.FID);
}
/// <summary>
/// 获取协同视图字段信息
/// </summary>
public List<TFS_ViewFieldInfo> GetTeamworkViewField(int intType)
{
return AppSettingsHelper.GetSqlSugar().Queryable<TFS_ViewFieldInfo>().Where(s => s.FType == intType
&& s.FDeleted != (int)Constant.DeleteCode.).OrderBy(s => s.FOrder).ToList();
}
/// <summary>
/// 获取协同视图结果信息
/// </summary>
public DataTable GetTeamworkViewData(string selectSql, string whereSql, string joinSql = "")
{
SqlSugarClient db = AppSettingsHelper.GetSqlSugar();
string strSql = string.Format(@"select distinct {0},TFS_ViewMaterial.FMaterialID from TFS_FTeamwork left join TFS_ViewMaterial on
TFS_FTeamwork.FID=TFS_ViewMaterial.FTeamID left join TFS_Material on TFS_Material.FID=TFS_ViewMaterial.FMaterialID
{2} where {1}", selectSql, whereSql, string.IsNullOrEmpty(joinSql) ? "" : joinSql);
return db.Ado.GetDataTable(strSql);
}
/// <summary>
/// 获取协同视图结果信息
/// </summary>
public DataTable GetTeamworkViewData2(string selectSql, string whereSql, string joinSql = "")
{
SqlSugarClient db = AppSettingsHelper.GetSqlSugar();
string strSql = string.Format(@"select distinct {0},TFS_ViewMaterial.FMaterialID from TFS_ViewMaterial
left join TFS_Material on TFS_Material.FID=TFS_ViewMaterial.FMaterialID
left join TFS_MaterialInfo on TFS_ViewMaterial.FMaterialID=TFS_MaterialInfo.FDataID and TFS_MaterialInfo.FType=2
left join TFS_PackageChild on TFS_PackageChild.FMaterialID =TFS_ViewMaterial.FMaterialID
{2} where {1}", selectSql, whereSql, string.IsNullOrEmpty(joinSql) ? "" : joinSql);
return db.Ado.GetDataTable(strSql);
}
public int ExecSql(string sql)
{
SqlSugarClient db = AppSettingsHelper.GetSqlSugar();
return db.Ado.ExecuteCommand(sql);
}
/// <summary>
/// BOM梳理结果数据处理
/// </summary>
public bool AnalysisBomData(List<TFS_Material> mateList, List<TFS_ViewMaterial> viewList, int teamId, int userId, string formulaIds, string halfIds)
{
SqlSugarClient db = AppSettingsHelper.GetSqlSugar();
db.BeginTran();
try
{
viewList = viewList.OrderBy(s => s.FLevel).ToList();
List<TFS_Material> formulaList = new List<TFS_Material>();
TFS_HalfMaterialFTeamwork teamInfo = db.Queryable<TFS_HalfMaterialFTeamwork>().Where(s => s.FID == teamId).First();
TFS_Factory factory = null;
string proSql = "";
Dictionary<int, string> hasNewView = new Dictionary<int, string>();
for (int i = 0; i < viewList.Count; i++)
{
TFS_ViewMaterial vItem = viewList[i];
TFS_Material mItem = mateList.Find(s => s.FID == vItem.FBomMaterialID);
int oldId = mItem.FID, oldParent = mItem.FParentID;
Expression<Func<TFS_Material, bool>> expression;
if (string.IsNullOrEmpty(mItem.FCode)) expression = s => s.FPlmCode == mItem.FPlmCode && s.FVersionCode == mItem.FVersionCode;
else expression = s => s.FCode == mItem.FCode && s.FVersionCode == mItem.FVersionCode;
TFS_Material mData = db.Queryable<TFS_Material>().Where(expression).First();
if (mData == null)//没物料新增物料
{
if (factory == null)
{
string tempSql = @"select * from TFS_Factory where FID=(SELECT FCreateFactoryID FROM TFS_MaterialFTeamwork WHERE FID={0})";
factory = db.SqlQueryable<TFS_Factory>(string.Format(tempSql, teamId)).First();
}
if (factory != null)
{
mItem.FFactoryID = factory.FID;
mItem.FFactoryCode = factory.FCode;
}
mItem.FID = db.Insertable(mItem).IgnoreColumns(true).ExecuteReturnIdentity();
//if (vItem.FLevel > 1) formulaIds += "," + mItem.FID;
}
else
{
string name = string.IsNullOrEmpty(mData.FName) ? mItem.FName : mData.FName;
viewList[i].FBaseMaterialDesc = name;
mItem = mData;
}
//formulaIds = formulaIds.Replace(oldId.ToString(), mItem.FID.ToString());
halfIds = halfIds.Replace(oldId.ToString(), mItem.FID.ToString());
bool hasCreate = false;
bool isAddFormula = false;
//是否有委外视图
TFS_ViewMaterial vData = db.Queryable<TFS_ViewMaterial>().Where(s => s.FFactoryID == teamInfo.FCreateFactoryID
&& s.FMaterialID == mItem.FID).First();
if (vData == null)
{
hasCreate = isAddFormula = true;
vItem.FFactoryID = teamInfo.FCreateFactoryID;
vItem.FFactoryCode = teamInfo.FCreateFactoryCode;
vItem.FTeamID = teamInfo.FID;
vItem.FMaterialID = mItem.FID;
vItem.FBaseMaterialGroup = mItem.FMaterialGroup;
vItem.FBaseBasicMeter = mItem.FBaseUnit;
db.Insertable(vItem).IgnoreColumns(true).ExecuteCommand();
if (!hasNewView.ContainsKey(vItem.FViewType)) hasNewView.Add(vItem.FViewType, vItem.FFactoryID.ToString() + ",");
else hasNewView[vItem.FViewType] = hasNewView[vItem.FViewType] + vItem.FFactoryID.ToString() + ",";
}
//是否有工厂视图
vData = db.Queryable<TFS_ViewMaterial>().Where(s => s.FFactoryID == teamInfo.FProdFactoryID && s.FMaterialID == mItem.FID).First();
if (vData == null)
{
isAddFormula = true;
vItem.FFactoryID = teamInfo.FProdFactoryID;
vItem.FFactoryCode = teamInfo.FProdFactoryCode;
vItem.FTeamID = teamInfo.FID;
vItem.FMaterialID = mItem.FID;
vItem.FBaseMaterialGroup = mItem.FMaterialGroup;
vItem.FBaseBasicMeter = mItem.FBaseUnit;
//所谓固定字段,但是分工厂且视图还不一样
if (vItem.FViewType == (int)Constant.ViewType. || vItem.FViewType == (int)Constant.ViewType.
|| vItem.FViewType == (int)Constant.ViewType.)
{
vItem.FQualityType3 = "04";
vItem.FQualityType5 = "09";
}
else if (vItem.FViewType == (int)Constant.ViewType.)
{
if (hasCreate) vItem.FQualityType4 = "05";
}
else if (vItem.FViewType == (int)Constant.ViewType.)
{
if (hasCreate) vItem.FQualityType4 = "05";
else vItem.FQualityType1 = "01";
}
db.Insertable(vItem).IgnoreColumns(true).ExecuteCommand();
if (!hasNewView.ContainsKey(vItem.FViewType)) hasNewView.Add(vItem.FViewType, vItem.FFactoryID.ToString() + ",");
else hasNewView[vItem.FViewType] = hasNewView[vItem.FViewType] + vItem.FFactoryID.ToString() + ",";
}
mItem.FIsNew = isAddFormula;
mItem.FOldID = oldId;
mItem.FLevelID = vItem.FLevel;
mItem.FParentID = oldParent;
if (mItem.FLevelID >= 1) formulaList.Add(mItem);
}
formulaIds = "";
//2022-09-27生成BOM层级关系生成配方视图的时候再根据这个处理父子
List<BomFormulaDto> bfList = new List<BomFormulaDto>();
if (formulaList.Count > 0)
{
foreach (TFS_Material first in formulaList.Where(s => s.FLevelID == 1))
{
bfList.Add(new BomFormulaDto() { mId = first.FID, isNew = first.FIsNew, childs = GetBomFormulaChild(first, formulaList, out string fids) });
formulaIds += first.FID + "," + fids;
}
}
//if (hasNewView.Count() > 0)
//{
// hasNewView.OrderBy(s => s.Key);
// string facoryIds = ""; bool hasOther = false;
// foreach (var item in hasNewView)
// {
// //创建视图事项
// string factorys = item.Value.Trim(',');
// BaseBll.CreateTaskData(teamInfo.FID, userId, (item.Key + 2).ToString(), factorys);
// facoryIds += factorys;
// if (item.Key != (int)Constant.ViewType.原料视图) hasOther = true;
// }
// if (hasNewView.ContainsKey((int)Constant.ViewType.原料视图))
// {
// proSql += BaseBll.GetProcessSql(teamInfo.FID, (int)Constant.ProcessType.新原料视图, "F2", 1);
// }
// else
// {
// proSql += BaseBll.GetProcessSql(teamInfo.FID, (int)Constant.ProcessType.新原料视图, "F4", 2);
// }
// if (hasOther)
// {
// proSql += BaseBll.GetProcessSql(teamInfo.FID, (int)Constant.ProcessType.新半成品中间品香基, "F2", 1);
// }
// else
// {
// proSql += BaseBll.GetProcessSql(teamInfo.FID, (int)Constant.ProcessType.新半成品中间品香基, "F4", 2);
// }
// if (hasNewView.ContainsKey((int)Constant.ViewType.中间品视图) || hasNewView.ContainsKey((int)Constant.ViewType.香基视图)
// || hasNewView.ContainsKey((int)Constant.ViewType.半成品视图))
// {
// proSql += string.Format("update TFS_FTeamwork set FViewType=FViewType+',3,4' where FID={0};", teamInfo.FID);
// BaseBll.CreateTaskData(teamId, userId, "8");
// }
// proSql += BaseBll.GetProcessSql(teamInfo.FID, (int)Constant.ProcessType.配方视图, "F2", 1);
//}
//else
//{
// proSql += BaseBll.GetProcessSql(teamInfo.FID, (int)Constant.ProcessType.配方视图, "F2", 2);
// proSql += BaseBll.GetProcessSql(teamInfo.FID, (int)Constant.ProcessType.新半成品中间品香基, "F4", 2);
// proSql += BaseBll.GetProcessSql(teamInfo.FID, (int)Constant.ProcessType.新原料视图, "F4", 2);
//}
////下面两个要根据包材判断先改成进行中hasNewView == 0 && 包材是旧的,完成
//int pVersion = (hasNewView.Count == 0 && teamInfo.FPackID < 1) ? 2 : 1;
//proSql += BaseBll.GetProcessSql(teamInfo.FID, (int)Constant.ProcessType.生产工艺路线, "F2", pVersion);
//proSql += BaseBll.GetProcessSql(teamInfo.FID, (int)Constant.ProcessType.生成版本, "F2", pVersion);
string updateSql = "";
formulaIds = formulaIds.Replace(",,", ",").Replace(",,", ",").Replace(",,", ",").Trim(',');
if (!string.IsNullOrEmpty(formulaIds))
{
updateSql += string.Format("FMaterialFormulaIDs='{0}',FViewType=FViewType+',2',", formulaIds);
updateSql += string.Format("FBomFormula='{0}',", JsonConvert.SerializeObject(bfList));
}
if (!string.IsNullOrEmpty(halfIds)) updateSql += string.Format("FMaterialHalfIDs='{0}',", halfIds);
if (!string.IsNullOrEmpty(updateSql)) proSql += string.Format("update TFS_MaterialFTeamwork set {1} where FID={0};", teamInfo.FID, updateSql.Trim(','));
proSql += BaseBll.GetTaskSql2(-1, 2, teamId, (int)Constant.TaskType.BOM, 2);
db.Ado.ExecuteCommand(proSql.Trim(';'));
db.CommitTran();
}
catch (Exception ex)
{
db.RollbackTran();
return false;
}
return true;
}
public bool CreateMaterialTask(Dictionary<int, string> hasNewView, TFS_HalfMaterialFTeamwork teamInfo, int userId)
{
string proSql = "";
SqlSugarClient db = AppSettingsHelper.GetSqlSugar();
db.BeginTran();
try
{
if (hasNewView.Count() > 0)
{
hasNewView.OrderBy(s => s.Key);
string facoryIds = ""; bool hasOther = false;
foreach (var item in hasNewView)
{
//创建视图事项
string factorys = item.Value.Trim(',');
BaseBll.CreateTaskData2(teamInfo.FID, userId, (item.Key + 2).ToString(), factorys);
facoryIds += factorys;
if (item.Key != (int)Constant.ViewType.) hasOther = true;
}
if (hasNewView.ContainsKey((int)Constant.ViewType.))
{
proSql += BaseBll.GetProcessSql2(teamInfo.FID, (int)Constant.ProcessType., "F2", 1);
}
else
{
proSql += BaseBll.GetProcessSql2(teamInfo.FID, (int)Constant.ProcessType., "F4", 2);
}
if (hasOther)
{
proSql += BaseBll.GetProcessSql2(teamInfo.FID, (int)Constant.ProcessType., "F2", 1);
}
else
{
proSql += BaseBll.GetProcessSql2(teamInfo.FID, (int)Constant.ProcessType., "F4", 2);
}
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);
BaseBll.CreateTaskData2(teamInfo.FID, userId, "8");
}
proSql += BaseBll.GetProcessSql2(teamInfo.FID, (int)Constant.ProcessType., "F2", 1);
}
else
{
proSql += BaseBll.GetProcessSql2(teamInfo.FID, (int)Constant.ProcessType., "F2", 2);
proSql += BaseBll.GetProcessSql2(teamInfo.FID, (int)Constant.ProcessType., "F4", 2);
proSql += BaseBll.GetProcessSql2(teamInfo.FID, (int)Constant.ProcessType., "F4", 2);
}
//下面两个要根据包材判断先改成进行中hasNewView == 0 && 包材是旧的,完成
int pVersion = (hasNewView.Count == 0 && teamInfo.FPackID < 1) ? 2 : 1;
proSql += BaseBll.GetProcessSql2(teamInfo.FID, (int)Constant.ProcessType.线, "F2", pVersion);
proSql += BaseBll.GetProcessSql2(teamInfo.FID, (int)Constant.ProcessType., "F2", pVersion);
}
catch (Exception ex)
{
db.RollbackTran();
return false;
}
return true;
}
private List<BomFormulaDto> GetBomFormulaChild(TFS_Material first, List<TFS_Material> formulaList, out string fids)
{
List<BomFormulaDto> dtoList = new List<BomFormulaDto>();
List<TFS_Material> temps = formulaList.Where(s => s.FParentID == first.FOldID).ToList();
fids = "";
if (temps != null && temps.Count > 0)
{
foreach (TFS_Material item in temps)
{
if (first.FIsNew || item.FIsNew) fids += item.FID + ",";//父级新则子一级全部都要、自己是新
dtoList.Add(new BomFormulaDto() { mId = item.FID, isNew = item.FIsNew, childs = GetBomFormulaChild(item, formulaList, out string nextIds) });
if (!string.IsNullOrEmpty(nextIds)) fids += nextIds + ",";
}
}
return dtoList;
}
/// <summary>
/// 创建成品视图和包材判断
/// </summary>
public bool CreateProductView(TFS_HalfMaterialFTeamwork teamInfo, List<TFS_Material> materialList, int userId)
{
SqlSugarClient db = AppSettingsHelper.GetSqlSugar();
db.BeginTran();
try
{
TFS_PackageMain package = null;
string proSql = "";
//包材信息判断
{
//string packCode = teamInfo.FPackCode;
//List<string> names = teamInfo.FSaleCode.Split('-').ToList();
//string name = names.Where(s => s.Contains("@")).FirstOrDefault();
//if (string.IsNullOrEmpty(name))
//{
// name = names.Where(s => s.Contains("□")).FirstOrDefault();
// if (!string.IsNullOrEmpty(name)) packCode = name.Substring(0, name.IndexOf("□"));
//}
//else
//{
// packCode = name.Substring(0, name.IndexOf("@"));
//}
//if (!string.IsNullOrEmpty(packCode))
//{
// teamInfo.FPackCode = packCode;
//}
package = db.Queryable<TFS_PackageMain>().Where(s => s.FCode == teamInfo.FPackCode).OrderBy(s => s.FID, OrderByType.Desc).First();
if (package == null)
{
db.Updateable<TFS_HalfMaterialFTeamwork>(new { FPackCode = teamInfo.FPackCode }).Where(s => s.FID == teamInfo.FID).ExecuteCommand();
//BaseBll.CreateTaskData(teamInfo.FID, userId, "9");//新增新包材事项
proSql += BaseBll.GetProcessSql2(teamInfo.FID, (int)Constant.ProcessType.BOM, "F2", 0);//新包材流程进行中
} else
{
db.Updateable<TFS_HalfMaterialFTeamwork>(new { FPackID = package.FID, FPackCode = teamInfo.FPackCode }).Where(s => s.FID == teamInfo.FID).ExecuteCommand();
proSql += BaseBll.GetProcessSql2(teamInfo.FID, (int)Constant.ProcessType.BOM, "F3", 0);//新包材流程完成
}
if (materialList != null && materialList.Count > 0)
{
TFS_Material material = materialList.Find(s => s.FType == "20");//默认取第一个20的没找到取第一个
if (material == null) material = materialList.FirstOrDefault();
db.Updateable<TFS_HalfMaterialFTeamwork>(new { FMaterialHalfIDs = material.FID }).Where(s => s.FID == teamInfo.FID).ExecuteCommand();
}
}
//物料和成品视图
{
TFS_Material mainMater = new TFS_Material()
{
FName = teamInfo.FSaleCode,
FDesc = teamInfo.FSaleCode,
FType = "10",
FCode = teamInfo.FMdmCode,
FTestCode = teamInfo.FFormulaTestCode,
FFactoryID = teamInfo.FCreateFactoryID,
FFactoryCode = teamInfo.FCreateFactoryCode,
FEditUser = userId
};
mainMater.FID = db.Insertable(mainMater).IgnoreColumns(true).ExecuteReturnIdentity();
TFS_ViewMaterial mainView = new TFS_ViewMaterial()
{
FMaterialID = mainMater.FID,
FTeamID = teamInfo.FID,
FFactoryID = teamInfo.FCreateFactoryID,
FFactoryCode = teamInfo.FCreateFactoryCode,
FViewType = (int)Constant.ViewType.,
FLevel = 1,
FEditUser = userId,
FBaseMaterialCode = teamInfo.FMdmCode,
FBaseTestCode = teamInfo.FTestCode,
FBaseBasicMeter = teamInfo.FWeightUnit,
FBaseMaterialDesc = teamInfo.FSaleCode,
FBaseMaterialGroup = teamInfo.FMaterialGroup,
//默认值不同
FOrganizeMaterialType = teamInfo.FMaterialType,
FAccountPriceUnit = "1",
FAccountAccessType = "3000",
FAccountSaleOrderInventory = "3010",
FAccountCostAccountBatch = "1",
//2022-10-08 所谓的成品字段值是包材的规格、毛重、净重
FBaseSpecification = package != null ? package.FSpecs : "",
FBaseGrossWeight = package != null ? package.FGrossWeight : "",
FBaseNetWeight = package != null ? package.FNetWeight : "",
FTeamType=2
};
db.Insertable(mainView).IgnoreColumns(true).ExecuteCommand();
if (teamInfo.FProdFactoryID != teamInfo.FCreateFactoryID)
{
mainMater.FFactoryID = teamInfo.FProdFactoryID;
mainMater.FFactoryCode = teamInfo.FProdFactoryCode;
mainMater.FID = db.Insertable(mainMater).IgnoreColumns(true).ExecuteReturnIdentity();
mainView.FFactoryID = teamInfo.FProdFactoryID;
mainView.FFactoryCode = teamInfo.FProdFactoryCode;
mainView.FMaterialID = mainMater.FID;
db.Insertable(mainView).IgnoreColumns(true).ExecuteCommand();
}
//成品视图
//BaseBll.CreateTaskData(teamInfo.FID, userId, "3", teamInfo.FCreateFactoryID + "," + teamInfo.FProdFactoryID);
}
//成品视图物料组复核,有权限的所有
//BaseBll.CreateTaskData(teamInfo.FID, userId, "12");
//修改流程状态(协同发起完成,成品视图进行中)
//proSql += BaseBll.GetProcessSql(teamInfo.FID, (int)Constant.ProcessType.协同发起, "F2", 1);
//proSql += BaseBll.GetProcessSql(teamInfo.FID, (int)Constant.ProcessType.成品视图, "F2", 1);
proSql += BaseBll.GetTaskSql2(-1, 2, teamInfo.FID, (int)Constant.TaskType., 2);
proSql = proSql.Trim(';');
int result = db.Ado.ExecuteCommand(proSql);
db.CommitTran();
}
catch (Exception ex)
{
db.RollbackTran();
return false;
}
return true;
}
/// <summary>
/// 判断物料表里有这个实验号的数量
/// </summary>
public List<TFS_Material> CheckMaterialListByTest(string testCode, string versionCode)
{
return AppSettingsHelper.GetSqlSugar().Queryable<TFS_Material>().Where(s => s.FTestCode == testCode && s.FVersionCode == versionCode).ToList();
}
/// <summary>
/// 根据模式,试验号判断物料表里有这个实验号的数量
/// </summary>
public List<TFS_Material> CheckMaterialListByTest2(string testCode, int FFactoryID)
{
return AppSettingsHelper.GetSqlSugar().Queryable<TFS_Material>().Where(s => s.FTestCode == testCode && s.FFactoryID == FFactoryID).ToList();
}
/// <summary>
/// 更新协同主信息进度
/// </summary>
public static void ChangeTeamProcess(int teamId, SqlSugarClient db = null)
{
if (db == null) db = AppSettingsHelper.GetSqlSugar();
db.Ado.ExecuteCommand(string.Format(@"
declare @process1 int;
set @process1=(select count(1) from TFS_HalfMaterialFTeamProcess where FTeamID={0} and FState=2)*8;
set @process1+=(select count(1) from TFS_HalfMaterialTask where FTeamID={0} and FState=2)*5;
update TFS_HalfMaterialFTeamwork set FProgress=(case when @process1>99 then '99' else @process1 end)
where FID={0} and FProgress!='100';
", teamId));
}
/// <summary>
/// 更具描述查询是否有重复名称
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
public bool CheckTeamName(string name)
{
SqlSugarClient db = AppSettingsHelper.GetSqlSugar();
return db.Queryable<TFS_FTeamwork>().Any(m => m.FSaleCode == name&&m.FDeleted!= (int)Constant.DeleteCode.);
}
/// <summary>
/// 更新配方
/// </summary>
/// <param name="testCode">原配方</param>
/// <param name="testCode2">新配方</param>
/// <returns></returns>
public List<int> UpdateFormula(string testCode, string testCode2, string idList="")
{
SqlSugarClient db = AppSettingsHelper.GetSqlSugar();
List<TFS_Material> materialList = db.Queryable<TFS_Material>().Where(m => m.FTestCode == testCode).ToList();
List<int> ids = materialList.Select(m => m.FID).ToList();
//更新配方
string sql = "";
if (string.IsNullOrWhiteSpace(idList))
{
sql = string.Format("update TFS_Material set FTestCode='{0}' WHERE FID in ({1})", testCode2, string.Join(",", ids));
}
else
{
sql = string.Format("update TFS_Material set FTestCode='{0}' WHERE FID in ({1})", testCode, idList);
}
db.Ado.ExecuteCommand(sql);
return ids;
}
}
}

@ -75,6 +75,9 @@
<Compile Include="SqlSugarModel\TFS_Factory.cs" />
<Compile Include="SqlSugarModel\TFS_FieldInfo.cs" />
<Compile Include="SqlSugarModel\TFS_Formula.cs" />
<Compile Include="SqlSugarModel\TFS_HalfMaterialFTeamProcess.cs" />
<Compile Include="SqlSugarModel\TFS_HalfMaterialFTeamwork.cs" />
<Compile Include="SqlSugarModel\TFS_HalfMaterialTask.cs" />
<Compile Include="SqlSugarModel\TFS_MaterialFTeamProcess.cs" />
<Compile Include="SqlSugarModel\TFS_FTeamProcess.cs" />
<Compile Include="SqlSugarModel\TFS_MaterialFTeamwork.cs" />

@ -0,0 +1,123 @@
using System;
using System.Linq;
using System.Text;
using SqlSugar;
namespace FactorySystemModel.SqlSugarModel
{
///<summary>
///协同流程
///</summary>
[SugarTable("TFS_HalfMaterialFTeamProcess")]
public partial class TFS_HalfMaterialFTeamProcess
{
public TFS_HalfMaterialFTeamProcess()
{
}
/// <summary>
/// Desc:唯一标识
/// Default:
/// Nullable:False
/// </summary>
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
public int FID { get; set; }
/// <summary>
/// Desc:协同ID
/// Default:-1
/// Nullable:False
/// </summary>
public int FTeamID { get; set; }
/// <summary>
/// Desc:类型TBasicCode.FType=34
/// Default:
/// Nullable:False
/// </summary>
public int FType { get; set; }
/// <summary>
/// Desc:分组
/// Default:-1
/// Nullable:False
/// </summary>
public int FGroup { get; set; }
/// <summary>
/// Desc:名称
/// Default:
/// Nullable:False
/// </summary>
public string FName { get; set; }
/// <summary>
/// Desc:描述
/// Default:
/// Nullable:False
/// </summary>
public string FDesc { get; set; }
/// <summary>
/// Desc:状态0未开始1进行中2已完成
/// Default:-1
/// Nullable:False
/// </summary>
public int FState { get; set; }
/// <summary>
/// Desc:进度:标识文字,TBasicCode的F值
/// Default:-1
/// Nullable:False
/// </summary>
public int FProgress { get; set; }
/// <summary>
/// Desc:负责人ID
/// Default:-1
/// Nullable:False
/// </summary>
public string FChargeID { get; set; }
/// <summary>
/// Desc:负责人名称
/// </summary>
public string FChargeName { get; set; }
/// <summary>
/// Desc:添加时间
/// Default:DateTime.Now
/// Nullable:False
/// </summary>
public DateTime FAddDate { get; set; }
/// <summary>
/// Desc:开始时间
/// Default:DateTime.Now
/// Nullable:False
/// </summary>
public DateTime? FStartDate { get; set; }
/// <summary>
/// Desc:完成时间
/// Default:DateTime.Now
/// Nullable:False
/// </summary>
public DateTime? FFinishDate { get; set; }
/// <summary>
/// Desc:修改人
/// Default:-1
/// Nullable:False
/// </summary>
public int FEditUser { get; set; }
/// <summary>
/// Desc:修改时间
/// Default:DateTime.Now
/// Nullable:False
/// </summary>
public DateTime FEditDate { get; set; }
}
}

@ -0,0 +1,255 @@
using System;
using System.Collections.Generic;
using SqlSugar;
namespace FactorySystemModel.SqlSugarModel
{
///<summary>
///协同表
///</summary>
[SugarTable("TFS_HalfMaterialFTeamwork")]
public partial class TFS_HalfMaterialFTeamwork
{
public TFS_HalfMaterialFTeamwork()
{
FAddUserName = null;
FTaskList = new List<TFS_HalfMaterialTask>();
}
/// <summary>
/// Desc:唯一标识
/// Default:
/// Nullable:False
/// </summary>
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
public int FID { get; set; }
/// <summary>
/// Desc:销售号
/// Default:
/// Nullable:False
/// </summary>
public string FSaleCode { get; set; }
/// <summary>
/// Desc:视图类型(查看、导出)
/// Default:
/// Nullable:False
/// </summary>
public string FViewType { get; set; }
/// <summary>
/// Desc:包材ID
/// Default:
/// Nullable:False
/// </summary>
public int? FPackID { get; set; }
/// <summary>
/// Desc:包材Code---“新增销售号描述”-后面@或者□前面的内容为包材号
/// Default:
/// Nullable:False
/// </summary>
public string FPackCode { get; set; }
/// <summary>
/// Desc:试验号
/// Default:
/// Nullable:False
/// </summary>
public string FTestCode { get; set; }
/// <summary>
/// Desc:新试验号
/// Default:
/// Nullable:False
/// </summary>
public string FNewTestCode { get; set; }
/// <summary>
/// Desc:配方内码
/// Default:
/// Nullable:False
/// </summary>
public string FVersionCode { get; set; }
/// <summary>
/// Desc:MDN编码
/// Default:
/// Nullable:False
/// </summary>
public string FMdmCode { get; set; }
/// <summary>
/// Desc:配方编号
/// Default:-1
/// Nullable:False
/// </summary>
public int FFormulaID { get; set; }
/// <summary>
/// Desc:配方编号
/// Default:-1
/// Nullable:False
/// </summary>
public string FFormulaName { get; set; }
/// <summary>
/// Desc:配方试验号
/// Default:-1
/// Nullable:False
/// </summary>
public string FFormulaTestCode { get; set; }
/// <summary>
/// Desc:一级物料编号
/// Default:
/// Nullable:False
/// </summary>
public string FMaterialFormulaIDs { get; set; }
/// <summary>
/// Desc:一级半成品编号
/// Default:-1
/// Nullable:False
/// </summary>
public string FMaterialHalfIDs { get; set; }
/// <summary>
/// Desc:计量单位TDataCode.FType=1
/// Default:
/// Nullable:False
/// </summary>
public string FWeightUnit { get; set; }
/// <summary>
/// Desc:物料组TDataCode.FType=2
/// Default:
/// Nullable:False
/// </summary>
public string FMaterialGroup { get; set; }
/// <summary>
/// Desc:物料类型
/// Default:
/// Nullable:False
/// </summary>
public string FMaterialType { get; set; }
/// <summary>
/// Desc:Bom下载状态
/// Default:
/// Nullable:False
/// </summary>
public int FBomState { get; set; }
/// <summary>
/// Desc:Bom清单数据备份
/// Default:
/// Nullable:False
/// </summary>
public string FBomJson { get; set; }
/// <summary>
/// Desc:进度
/// Default:0%
/// Nullable:False
/// </summary>
public string FProgress { get; set; }
/// <summary>
/// Desc:删除状态1删除0未删除
/// Default:0
/// Nullable:False
/// </summary>
public int FDeleted { get; set; }
/// <summary>
/// Desc:工厂编号
/// Default:-1
/// Nullable:False
/// </summary>
public int FCreateFactoryID { get; set; }
/// <summary>
/// Desc:工厂代码
/// Default:-1
/// Nullable:False
/// </summary>
public string FCreateFactoryCode { get; set; }
/// <summary>
/// Desc:工厂模式
/// Default:
/// Nullable:False
/// </summary>
public int FCreateFactoryType { get; set; }
/// <summary>
/// Desc:工厂编号
/// Default:-1
/// Nullable:False
/// </summary>
public int FProdFactoryID { get; set; }
/// <summary>
/// Desc:工厂代码
/// Default:-1
/// Nullable:False
/// </summary>
public string FProdFactoryCode { get; set; }
/// <summary>
/// Desc:添加人
/// Default:-1
/// Nullable:False
/// </summary>
public int FAddUser { get; set; }
/// <summary>
/// 添加人(仅插入的时候不操作此列)
/// </summary>
[SugarColumn(IsIgnore = true)]
public string FAddUserName { get; set; }
/// <summary>
/// 当前事项
/// </summary>
[SugarColumn(IsIgnore = true)]
public List<TFS_HalfMaterialTask> FTaskList { get; set; }
/// <summary>
/// Desc:添加时间
/// Default:DateTime.Now
/// Nullable:False
/// </summary>
public DateTime FAddDate { get; set; }
/// <summary>
/// Desc:修改人
/// Default:-1
/// Nullable:False
/// </summary>
public int FEditUser { get; set; }
/// <summary>
/// Desc:修改时间
/// Default:DateTime.Now
/// Nullable:False
/// </summary>
public DateTime FEditDate { get; set; }
/// <summary>
/// Desc:状态1已增0暂存
/// Default:-1
/// Nullable:False
/// </summary>
public int FState { get; set; }
/// <summary>
/// Desc:BOM配方层级梳理
/// Default:-1
/// Nullable:False
/// </summary>
public string FBomFormula { get; set; }
}
}

@ -0,0 +1,115 @@
using System;
using SqlSugar;
namespace FactorySystemModel.SqlSugarModel
{
///<summary>
///待办事项
///</summary>
[SugarTable("TFS_HalfMaterialTask")]
public partial class TFS_HalfMaterialTask
{
public TFS_HalfMaterialTask()
{
}
/// <summary>
/// Desc:唯一标识
/// Default:
/// Nullable:False
/// </summary>
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
public int FID { get; set; }
/// <summary>
/// Desc:协同ID
/// Default:-1
/// Nullable:False
/// </summary>
public int FTeamID { get; set; }
/// <summary>
/// Desc:类型TBasicCode.FType=33
/// Default:
/// Nullable:False
/// </summary>
public int FType { get; set; }
/// <summary>
/// Desc:名称
/// Default:
/// Nullable:False
/// </summary>
public string FName { get; set; }
/// <summary>
/// Desc:描述
/// Default:
/// Nullable:False
/// </summary>
public string FDesc { get; set; }
/// <summary>
/// Desc:工厂Id
/// Default:
/// Nullable:False
/// </summary>
public int FFactoryID { get; set; }
/// <summary>
/// Desc:负责用户
/// Default:
/// Nullable:False
/// </summary>
public string FUserID { get; set; }
/// <summary>
/// Desc:负责用户
/// Default:
/// Nullable:False
/// </summary>
public string FUserName { get; set; }
/// <summary>
/// Desc:状态0未开始1进行中2已完成
/// Default:-1
/// Nullable:False
/// </summary>
public int FState { get; set; }
/// <summary>
/// Desc:修改状态1可修改0不可修改
/// Default:-1
/// Nullable:False
/// </summary>
public int? FCanEdit { get; set; }
/// <summary>
/// Desc:添加时间
/// Default:DateTime.Now
/// Nullable:False
/// </summary>
public DateTime FAddDate { get; set; }
/// <summary>
/// Desc:修改人
/// Default:-1
/// Nullable:False
/// </summary>
public int FEditUser { get; set; }
/// <summary>
/// Desc:修改时间
/// Default:DateTime.Now
/// Nullable:False
/// </summary>
public DateTime FEditDate { get; set; }
/// <summary>
/// Desc:完成时间
/// Default:DateTime.Now
/// Nullable:False
/// </summary>
public DateTime? FFinishDate { get; set; }
}
}
Loading…
Cancel
Save