Commit 3457384b authored by solho's avatar solho

加入關帳比對

parent 12b8398f
......@@ -398,10 +398,13 @@ namespace WebAPI.Controllers
#endregion
//Confirm_Class.Add("PG"); Confirm_Class.Add("Leader"); //test
#region 取得FLOW相關
cmd.CommandText = @"select et.*,etf.id AS Flowid,etf.*,
cmd.CommandText = @"select ets.Settle_Date,case when ets.isClosed=1 then 1 else 0 end SettleisClosed,et.*,etf.id AS Flowid,etf.*,
etfs.* FROM esn_todos et
left join esn_todos_Flow etf on et.sn=etf.esn_todos_sn
left join esn_todos_Flow_StepType etfs on etfs.id=etf.StepType_id
left join esn_todos_points etp on etp.sn=et.sn
left join evw_Employee eel on eel.user_id=et.AssignedTo_userid
left join esn_todos_Settle ets on ets.DSNum =eel.Emp_DSNum and DATEDIFF(MONTH,etp.date_points_settlement,ets.Settle_Date)=0
where et.sn in(@Esn_Todos_Sn)
";
......@@ -426,6 +429,7 @@ namespace WebAPI.Controllers
JToken JtSn;
//List<String> sql = new List<string>();
int StepType_id_Previous, StepType_id, StepType_idHis;
Boolean SettleisClosed = false;
DataRow dsr;
//foreach (DataRow dr in ds.Tables[0].Rows)
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
......@@ -441,10 +445,10 @@ namespace WebAPI.Controllers
if (dsr["esn_todos_sn"] == DBNull.Value) //insert
{
CStepTypeCur = AllStepType.Where(p => p.Map_Class.Contains(JtSn["validclass"].ToString())).FirstOrDefault();
CStepTypeCur = AllStepType.Where(p => p.Map_Class.Contains(JtSn["targetclass"].ToString())).FirstOrDefault();
StepType_idHis = CStepTypeCur.id;
if (!string.IsNullOrEmpty(JtSn["targetclass"].ToString()))
if (JtSn["targetclass"] != null && !string.IsNullOrEmpty(JtSn["targetclass"].ToString()))
{
CStepTypeNext = AllStepType.Where(p => p.id == AllStepType.Where(p2 => p2.Map_Class == JtSn["targetclass"].ToString()).FirstOrDefault().id).FirstOrDefault();
}
......@@ -467,12 +471,14 @@ namespace WebAPI.Controllers
//{
// return_msg_error.Add(dsr["esn_todos_sn"] + ":該流程已異動, 不可變更");
//}
SettleisClosed = dsr["SettleisClosed"].ToString() == "1" ? true : false;
if (SettleisClosed)
return_msg_error.Add(dsr["esn_todos_sn"] + ":該流程 "+ Convert.ToDateTime( dsr["Settle_Date"]).ToString(" yyyy年MM月 ") + "已關帳, 不可變更");
#endregion
CStepTypeCur = AllStepType.Where(p => p.id == StepType_id).FirstOrDefault();
if (!string.IsNullOrEmpty(JtSn["targetclass"].ToString()))
if (JtSn["targetclass"] !=null && !string.IsNullOrEmpty(JtSn["targetclass"].ToString()))
{
CStepTypeNext = AllStepType.Where(p => p.id == AllStepType.Where(p2 => p2.Map_Class == JtSn["targetclass"].ToString()).FirstOrDefault().id).FirstOrDefault();
}
......@@ -521,7 +527,7 @@ namespace WebAPI.Controllers
}
else
{
Tsql = Tsql + CStepTypeCur.Map_Class + "_IsConfirm =" + IsConfirm + ",";
//Tsql = Tsql + CStepTypeCur.Map_Class + "_IsConfirm =" + IsConfirm + ",";
StepType_idHis = CStepTypeCur.id;
}
Tsql = Tsql + " StepType_id = '" + CStepTypeNext.id + "',StepType_id_Previous = '" + CStepTypeCur.id +
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment