|
|
@ -265,7 +265,15 @@ namespace QMAPP.FJC.DAL.ProductionPlan |
|
|
|
try |
|
|
|
{ |
|
|
|
StringBuilder sql = new StringBuilder(); |
|
|
|
sql.AppendFormat("SELECT TOP {0} W.[PID]\r\n", count); |
|
|
|
|
|
|
|
if (workcellcode == "BRIM_WELDING_BC316") |
|
|
|
{ |
|
|
|
sql.AppendFormat("SELECT TOP 12 A.[PID], A.[ORDERPLANID], A.[ORDERPLAN_NO], A.[ORDER_TYPE], A.[SEQ], A.[MATERIAL_CODE], A.[MATERIAL_NAME], A.[PBOM_CODE], A.[QTY], A.[COMPLETE_QTY], A.[PLAN_DATE], A.[SHIFT_CODE], A.[WORKCENTER_CODE], A.[WORKCENTER_NAME], A.[WORKCELL_CODE], A.[WORKCELL_NAME], A.[WORKLOC_CODE], A.[REMARK], A.[EQPT_NAME], A.[EQPT_CODE], A.[STATE], A.[MOULD_CODE], A.[PRI], A.[UPDATEDATE], A.[IGNORE_FISBREAK], A.[FIS_ASMSETCODE] FROM ( "); |
|
|
|
sql.AppendFormat("SELECT TOP {0} W.[PID]\r\n", 12); |
|
|
|
}else |
|
|
|
{ |
|
|
|
sql.AppendFormat("SELECT TOP {0} W.[PID]\r\n", count); |
|
|
|
} |
|
|
|
sql.AppendFormat(" ,W.[ORDERPLANID] "); |
|
|
|
sql.AppendFormat(" ,W.[ORDERPLAN_NO] "); |
|
|
|
sql.AppendFormat(" ,W.[ORDER_TYPE] "); |
|
|
@ -289,6 +297,7 @@ namespace QMAPP.FJC.DAL.ProductionPlan |
|
|
|
sql.AppendFormat(" ,W.[MOULD_CODE] "); |
|
|
|
sql.AppendFormat(" ,W.[PRI] "); |
|
|
|
sql.AppendFormat(" ,W.[UPDATEDATE] "); |
|
|
|
sql.AppendFormat(" ,P.[PLAN_SEQ] "); |
|
|
|
sql.AppendFormat(" ,P.[IGNORE_FISBREAK] "); |
|
|
|
sql.AppendFormat(" ,P.[FIS_ASMSETCODE] "); |
|
|
|
sql.AppendFormat(" FROM [T_PP_WORKORDER] AS W WITH(NOLOCK) "); |
|
|
@ -310,7 +319,15 @@ namespace QMAPP.FJC.DAL.ProductionPlan |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
sql.AppendFormat(" ORDER BY W.[UPDATEDATE],W.[PRI],W.[PLAN_DATE],P.PLAN_SEQ,W.[SEQ],W.[MATERIAL_CODE] "); |
|
|
|
if (workcellcode == "BRIM_WELDING_BC316") |
|
|
|
{ |
|
|
|
sql.AppendFormat(" ORDER BY W.[PLAN_DATE]) A "); |
|
|
|
sql.AppendFormat(" ORDER BY A.[UPDATEDATE],A.[PRI],A.[PLAN_DATE],A.PLAN_SEQ,A.[SEQ],A.[MATERIAL_CODE] "); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
sql.AppendFormat(" ORDER BY W.[UPDATEDATE],W.[PRI],W.[PLAN_DATE],P.PLAN_SEQ,W.[SEQ],W.[MATERIAL_CODE] "); |
|
|
|
} |
|
|
|
List<DataParameter> parameters = new List<DataParameter>(); |
|
|
|
parameters.Add(new DataParameter("workcellcode", workcellcode)); |
|
|
|
using (var session = AppDataFactory.CreateMainSession()) |
|
|
@ -324,6 +341,8 @@ namespace QMAPP.FJC.DAL.ProductionPlan |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 获取指定工序的生产计划清单
|
|
|
|
/// </summary>
|
|
|
@ -762,35 +781,76 @@ namespace QMAPP.FJC.DAL.ProductionPlan |
|
|
|
{ |
|
|
|
List<DataParameter> parameters = new List<DataParameter>(); |
|
|
|
StringBuilder sql = new StringBuilder(); |
|
|
|
sql.AppendLine("SELECT TOP 1 W.* "); |
|
|
|
sql.AppendLine(" ,P.[IGNORE_FISBREAK] "); |
|
|
|
sql.AppendFormat(" FROM [T_PP_WORKORDER] AS W "); |
|
|
|
sql.AppendFormat(" LEFT JOIN [T_PP_ORDERPLAN] AS P "); |
|
|
|
|
|
|
|
|
|
|
|
//sql.AppendLine("SELECT TOP 1 W.* ");
|
|
|
|
//sql.AppendLine(" ,P.[IGNORE_FISBREAK] ");
|
|
|
|
//sql.AppendFormat(" FROM [T_PP_WORKORDER] AS W ");
|
|
|
|
//sql.AppendFormat(" LEFT JOIN [T_PP_ORDERPLAN] AS P ");
|
|
|
|
//sql.AppendFormat(" ON P.[PID]=W.[ORDERPLANID] ");
|
|
|
|
//sql.AppendFormat(" LEFT JOIN [T_MD_MATERIAL] AS M ");
|
|
|
|
//sql.AppendFormat(" ON W.[MATERIAL_CODE]=M.[MATERIAL_CODE] ");
|
|
|
|
//sql.AppendFormat(" WHERE W.[WORKCELL_CODE]=@workcellcode ");
|
|
|
|
//sql.AppendLine(" AND W.[STATE]<>'4' AND W.[STATE]<>'2' ");
|
|
|
|
//sql.AppendFormat(" ORDER BY W.[PRI],W.[PLAN_DATE],P.PLAN_SEQ,W.[SEQ],W.[MATERIAL_CODE] ");
|
|
|
|
//parameters.Add(new DataParameter("workcellcode", workcellcode));
|
|
|
|
//parameters.Add(new DataParameter("mouldcode", mouldcode));
|
|
|
|
|
|
|
|
|
|
|
|
if (workcellcode == "BRIM_WELDING_BC316") |
|
|
|
{ |
|
|
|
sql.AppendFormat("SELECT TOP 1 A.[PID], A.[ORDERPLANID], A.[ORDERPLAN_NO], A.[ORDER_TYPE], A.[SEQ], A.[MATERIAL_CODE], A.[MATERIAL_NAME], A.[PBOM_CODE], A.[QTY], A.[COMPLETE_QTY], A.[PLAN_DATE], A.[SHIFT_CODE], A.[WORKCENTER_CODE], A.[WORKCENTER_NAME], A.[WORKCELL_CODE], A.[WORKCELL_NAME], A.[WORKLOC_CODE], A.[REMARK], A.[EQPT_NAME], A.[EQPT_CODE], A.[STATE], A.[MOULD_CODE], A.[PRI], A.[UPDATEDATE], A.[IGNORE_FISBREAK], A.[FIS_ASMSETCODE] FROM ( "); |
|
|
|
sql.AppendFormat("SELECT TOP {0} W.[PID]\r\n", 12); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
sql.AppendFormat("SELECT TOP {0} W.[PID]\r\n", 1); |
|
|
|
} |
|
|
|
sql.AppendFormat(" ,W.[ORDERPLANID] "); |
|
|
|
sql.AppendFormat(" ,W.[ORDERPLAN_NO] "); |
|
|
|
sql.AppendFormat(" ,W.[ORDER_TYPE] "); |
|
|
|
sql.AppendFormat(" ,W.[SEQ] "); |
|
|
|
sql.AppendFormat(" ,W.[MATERIAL_CODE] "); |
|
|
|
sql.AppendFormat(" ,M.[MATERIAL_NAME] "); |
|
|
|
sql.AppendFormat(" ,W.[PBOM_CODE] "); |
|
|
|
sql.AppendFormat(" ,W.[QTY] "); |
|
|
|
sql.AppendFormat(" ,W.[COMPLETE_QTY] "); |
|
|
|
sql.AppendFormat(" ,W.[PLAN_DATE] "); |
|
|
|
sql.AppendFormat(" ,W.[SHIFT_CODE] "); |
|
|
|
sql.AppendFormat(" ,W.[WORKCENTER_CODE] "); |
|
|
|
sql.AppendFormat(" ,W.[WORKCENTER_NAME] "); |
|
|
|
sql.AppendFormat(" ,W.[WORKCELL_CODE] "); |
|
|
|
sql.AppendFormat(" ,W.[WORKCELL_NAME] "); |
|
|
|
sql.AppendFormat(" ,W.[WORKLOC_CODE] "); |
|
|
|
sql.AppendFormat(" ,W.[REMARK] "); |
|
|
|
sql.AppendFormat(" ,W.[EQPT_NAME] "); |
|
|
|
sql.AppendFormat(" ,W.[EQPT_CODE] "); |
|
|
|
sql.AppendFormat(" ,W.[STATE] "); |
|
|
|
sql.AppendFormat(" ,W.[MOULD_CODE] "); |
|
|
|
sql.AppendFormat(" ,W.[PRI] "); |
|
|
|
sql.AppendFormat(" ,W.[UPDATEDATE] "); |
|
|
|
sql.AppendFormat(" ,P.[PLAN_SEQ] "); |
|
|
|
sql.AppendFormat(" ,P.[IGNORE_FISBREAK] "); |
|
|
|
sql.AppendFormat(" ,P.[FIS_ASMSETCODE] "); |
|
|
|
sql.AppendFormat(" FROM [T_PP_WORKORDER] AS W WITH(NOLOCK) "); |
|
|
|
sql.AppendFormat(" LEFT JOIN [T_PP_ORDERPLAN] AS P WITH(NOLOCK) "); |
|
|
|
sql.AppendFormat(" ON P.[PID]=W.[ORDERPLANID] "); |
|
|
|
sql.AppendFormat(" LEFT JOIN [T_MD_MATERIAL] AS M "); |
|
|
|
sql.AppendFormat(" LEFT JOIN [T_MD_MATERIAL] AS M WITH(NOLOCK)"); |
|
|
|
sql.AppendFormat(" ON W.[MATERIAL_CODE]=M.[MATERIAL_CODE] "); |
|
|
|
sql.AppendFormat(" WHERE W.[WORKCELL_CODE]=@workcellcode "); |
|
|
|
//if (mouldcode == "HWL_FRONT") // 左前门
|
|
|
|
//{
|
|
|
|
// sql.AppendLine(" and left(W.PBOM_CODE,10) = 'VW331DP_LF'");
|
|
|
|
//}
|
|
|
|
//else if (mouldcode == "HWL_REAR") //左后门
|
|
|
|
//{
|
|
|
|
// sql.AppendLine(" and left(W.PBOM_CODE,10) = 'VW331DP_LR' ");
|
|
|
|
//}
|
|
|
|
//else if (mouldcode == "HWL_FRONT") //右前门
|
|
|
|
//{
|
|
|
|
// sql.AppendLine(" and left(W.PBOM_CODE,10) = 'VW331DP_RF' ");
|
|
|
|
//}
|
|
|
|
//else if (mouldcode == "HWR_REAR") //右后门
|
|
|
|
//{
|
|
|
|
// sql.AppendLine(" and left(W.PBOM_CODE,10) = 'VW331DP_RR' ");
|
|
|
|
//}
|
|
|
|
//sql.AppendLine(" AND W.[MOULD_CODE]=@mouldcode ");
|
|
|
|
sql.AppendLine(" AND W.[STATE]<>'4' "); |
|
|
|
sql.AppendFormat(" ORDER BY W.[PRI],W.[PLAN_DATE],P.PLAN_SEQ,W.[SEQ],W.[MATERIAL_CODE] "); |
|
|
|
sql.AppendFormat(" AND W.[STATE]<>4 and W.[STATE]<>2 "); |
|
|
|
|
|
|
|
if (workcellcode == "BRIM_WELDING_BC316") |
|
|
|
{ |
|
|
|
sql.AppendFormat(" ORDER BY W.[PLAN_DATE]) A "); |
|
|
|
sql.AppendFormat(" ORDER BY A.[UPDATEDATE],A.[PRI],A.[PLAN_DATE],A.PLAN_SEQ,A.[SEQ],A.[MATERIAL_CODE] "); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
sql.AppendFormat(" ORDER BY W.[UPDATEDATE],W.[PRI],W.[PLAN_DATE],P.PLAN_SEQ,W.[SEQ],W.[MATERIAL_CODE] "); |
|
|
|
} |
|
|
|
|
|
|
|
parameters.Add(new DataParameter("workcellcode", workcellcode)); |
|
|
|
parameters.Add(new DataParameter("mouldcode", mouldcode)); |
|
|
|
using (var session = AppDataFactory.CreateMainSession()) |
|
|
|
{ |
|
|
|
return session.Get<WorkOrder>(sql.ToString(), parameters.ToArray()); |
|
|
|