Commit 721053b4 authored by solho's avatar solho

fix:修正 The incoming request has too many parameters. The server supports a...

fix:修正 The incoming request has too many parameters. The server supports a maximum of 2100 parameters
fix:轉運營版批次確認 原因未清除
parent f496eb26
......@@ -348,8 +348,7 @@ namespace WebAPI.Controllers
ds = SqlToDs(cmd);
#endregion
String Wade_User_ID = obj_input["Wade_User_ID"].ToString(), Reject_Description = obj_input["Reject_Description"].ToString(),
date0 = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), Tsql = "", RJTOp = "";
String Wade_User_ID = obj_input["Wade_User_ID"].ToString(), Reject_Description ="",date0 = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), Tsql = "", RJTOp = "";
//List<String> sql = new List<string>();
......@@ -366,6 +365,7 @@ namespace WebAPI.Controllers
try
{
RJTOp = "";
Reject_Description = obj_input["Reject_Description"].ToString();
StepType_id_Previous = dsr["StepType_id_Previous"] == DBNull.Value ? 0 : Convert.ToInt32(dsr["StepType_id_Previous"]);
//StepType_id_next = Convert.ToInt32(dsr["StepType_id_next"]);
StepType_id = dsr["StepType_id"] == DBNull.Value ? 0 : Convert.ToInt32(dsr["StepType_id"]);
......@@ -403,7 +403,7 @@ namespace WebAPI.Controllers
+ @"_IsConfirm],StepType_id_Previous,Description,[create_user_id],[Create_time],update_user_id,update_time) "
+ " OUTPUT Inserted.id into @TempTable "
+ " values (" + dsr["sn"] + ",'" + CStepTypeNext.id + "'," + IsConfirm + ",'" + StepType_idHis
+ "',@Reject_Description,@Wade_User_ID,'" + date0 + "'" + ",@Wade_User_ID,'" + date0 + "'" + "); "
+ "'," + string.Format("@Reject_Description_{0}", i) + ",@Wade_User_ID,'" + date0 + "'" + ",@Wade_User_ID,'" + date0 + "'" + "); "
;
}
else //update
......@@ -453,11 +453,13 @@ namespace WebAPI.Controllers
}
else if (Confirm_Method == "RJTOp")
{
string Reject_DescriptionRJTOp = "";//轉運營辦訊息改為與傳給SP同步
Reject_DescriptionRJTOp = "承辦人:" + JtSn["todos_Reject_Desc"].ToString() + "<br>主管:" + Reject_Description;
//Tsql = Tsql + "PG_IsConfirm =" + IsConfirm + "," + "PE_IsConfirm =" + IsConfirm + "," + "Leader_IsConfirm =" + IsConfirm + ","; //退回後,改為更新所有Flow狀態確認
//CStepTypeNext = AllStepType.Where(p => p.Step_Value == Step_Value_previous).FirstOrDefault();
RJTOp = String.Format(@"exec [dbo].esp_esn_Todos_V3_AssignStatus 'AS05' ," + dsr["sn"] + @",'',@todos_Reject_Desc_{0},'',@Wade_User_ID ;", i);
cmd.Parameters.AddWithValue(string.Format("@todos_Reject_Desc_{0}", i), "承辦人:" + JtSn["todos_Reject_Desc"].ToString() + "<br>主管:" + Reject_Description);
Reject_Description = "承辦人:" + JtSn["todos_Reject_Desc"].ToString() + "<br>主管:" + Reject_Description; //轉運營辦訊息改為與傳給SP同步
RJTOp = String.Format(@"exec [dbo].esp_esn_Todos_V3_AssignStatus 'AS05' ," + dsr["sn"] + @",'',@todos_Reject_Desc_{0},'',@Wade_User_ID ;", i);//轉運營辦訊息改為與傳給SP同步
cmd.Parameters.AddWithValue(string.Format("@todos_Reject_Desc_{0}", i), Reject_DescriptionRJTOp);
Reject_Description = Reject_DescriptionRJTOp;
CStepTypeNext = AllStepType.Where(p => p.id == CStepTypeCur.Step_Id_previous).FirstOrDefault();
}
else //預設為往下一步動作
......@@ -473,14 +475,13 @@ namespace WebAPI.Controllers
}
Tsql = Tsql + " StepType_id = '" + CStepTypeNext.id + "',StepType_id_Previous = '" + CStepTypeCur.id +
"',Description = @Reject_Description,update_user_id=@Wade_User_ID,update_time='" + date0 + "' "
"',Description = " + string.Format("@Reject_Description_{0}", i) + ",update_user_id=@Wade_User_ID,update_time='" + date0 + "' "
+ " output Inserted.id into @TempTable where id =" + dsr["Flowid"] + ";"
;
}
Tsql += @"select @FlowId=id from @TempTable;
insert into esn_todos_Flow_his (Flow_id,ConfirmTime,FromType_id,ToType_id,ConfirmUserId,ConfirmUserClass,ConfirmMethod,Description,Create_User_id,Create_time) "
+ " values (@FlowId,'" + date0 + "','" + StepType_idHis + "','" + CStepTypeNext.id + "',@Wade_User_ID,'" + CStepTypeCur.Map_Class + "','" + Confirm_Method + "',@Reject_Description,@Wade_User_ID,'" + date0 + "'" + ") ;";
+ " values (@FlowId,'" + date0 + "','" + StepType_idHis + "','" + CStepTypeNext.id + "',@Wade_User_ID,'" + CStepTypeCur.Map_Class + "','" + Confirm_Method + "',"+ string.Format("@Reject_Description_{0}", i) + ",@Wade_User_ID,'" + date0 + "'" + ") ;";
Tsql += RJTOp;
}
......@@ -488,9 +489,9 @@ namespace WebAPI.Controllers
{
return_msg_error.Add(dsr["esn_todos_sn"] + ":"+e.Message);
}
cmd.Parameters.AddWithValue(string.Format("@Reject_Description_{0}", i), Reject_Description);
}
cmd.Parameters.AddWithValue("@Reject_Description", Reject_Description);
cmd.Parameters.AddWithValue("@Wade_User_ID", Wade_User_ID);
cmd.CommandText = @"declare @TempTable TABLE(id INT)
declare @FlowId int " + Tsql;
......
......@@ -178,8 +178,8 @@ namespace WebAPI.Controllers
};
SettleMataData.Add(etsm);
}
String sqldeclare;int batchcount = 20;
String point, AssignedTo_userID, Emp_DSNum, TaskDescription, CaseNo, Map_Class;
String sqldeclare;int batchcount = 100;
String point, AssignedTo_userID, Emp_DSNum, TaskDescription, CaseNo, Map_Class, SN;
DateTime date_points_settlement;
DataRow dr;
List<String> return_msgs = new List<string>(), return_msg_error = new List<string>(), return_sn = new List<string>();
......@@ -190,12 +190,14 @@ namespace WebAPI.Controllers
{
dr = dt.Rows[i];
point = dr["points"].ToString();
date_points_settlement = dr["date_points_settlement"] == DBNull.Value ? Convert.ToDateTime("1900-01-01") : Convert.ToDateTime(dr["date_points_settlement"]);
Emp_DSNum = dr["Emp_DSNum"].ToString();
TaskDescription = dr["TaskDescription"].ToString();
CaseNo = dr["CaseNo"].ToString();
Map_Class = dr["Map_Class"].ToString();
AssignedTo_userID = dr["AssignedTo_userID"].ToString();
#region 邏輯比對
#region 關帳
Esn_todos_SettleModel etsm = SettleMataData.Where(a => (a.Settle_Date.ToString("yyyyMM").Equals(date_points_settlement.ToString("yyyyMM"))
......@@ -222,34 +224,44 @@ namespace WebAPI.Controllers
}
#endregion
#endregion
SN = dr["SN"].ToString();
if (dr["SN_tdp"] == DBNull.Value)
{
//sqlstr += string.Format(@"insert into esn_todos_points(sn,date_points_settlement,date_points_settlement_AssignTo,date_points_settlement_Point,update_user_id,update_time)
// values (@SN{0},@value,@AssignedTo_userID{0},@points{0},@gWadeID,getdate()); ", i);
sqlstr += string.Format(@"insert into esn_todos_points(sn,date_points_settlement,date_points_settlement_AssignTo,date_points_settlement_Point,update_user_id,update_time)
values (@SN{0},@value,@AssignedTo_userID{0},@points{0},@gWadeID,getdate()); ", i);
values ({0},@value,'{1}',{2},@gWadeID,getdate()); ", SN, AssignedTo_userID, point);
}
else
{
sqlstr += string.Format(@"update esn_todos_points set date_points_settlement=@value,date_points_settlement_AssignTo=@AssignedTo_userID{0}
,date_points_settlement_Point=@points{0} ,update_user_id=@gWadeID,Update_time=GETDATE() where SN =@SN{0};", i);
//sqlstr += string.Format(@"update esn_todos_points set date_points_settlement=@value,date_points_settlement_AssignTo=@AssignedTo_userID{0}
// ,date_points_settlement_Point=@points{0} ,update_user_id=@gWadeID,Update_time=GETDATE() where SN =@SN{0};", i);
sqlstr += string.Format(@"update esn_todos_points set date_points_settlement=@value,date_points_settlement_AssignTo='{1}'
,date_points_settlement_Point='{2}' ,update_user_id=@gWadeID,Update_time=GETDATE() where SN ={0};", SN, AssignedTo_userID, point);
}
cmd.Parameters.AddWithValue(string.Format("@SN{0}", i), dr["SN"].ToString());
cmd.Parameters.AddWithValue(string.Format("@AssignedTo_userID{0}", i), AssignedTo_userID);
cmd.Parameters.AddWithValue(string.Format("@points{0}", i), point);
//cmd.Parameters.AddWithValue(string.Format("@SN{0}", i), dr["SN"].ToString());
//cmd.Parameters.AddWithValue(string.Format("@AssignedTo_userID{0}", i), AssignedTo_userID);
//cmd.Parameters.AddWithValue(string.Format("@points{0}", i), point);
//sqlstr += string.Format(@"update esn_todos_Flow Set Is_Settlement = 1,update_user_id = @gWadeID,Update_time = GETDATE(),StepType_id_Previous=StepType_id
// ,StepType_id =(select id from esn_todos_Flow_StepType a where a.Map_Class='HR') output INSERTED.id INTO @TempTable where esn_todos_sn =@SN{0};
// select @FlowId=id from @TempTable;
// insert into esn_todos_Flow_his(Flow_id,ConfirmTime,FromType_id,ToType_id,ConfirmUserId,ConfirmUserClass,ConfirmMethod,Description,Create_User_id,Create_time)
// select id as Flow_id,GETDATE(),a.StepType_id_Previous,StepType_id,@gWadeID,'HR','SL','結算日期:' + @value,@gWadeID,GETDATE() from esn_todos_Flow a where a.id=@FlowId;
// ", i);
sqlstr += string.Format(@"update esn_todos_Flow Set Is_Settlement = 1,update_user_id = @gWadeID,Update_time = GETDATE(),StepType_id_Previous=StepType_id
,StepType_id =(select id from esn_todos_Flow_StepType a where a.Map_Class='HR') output INSERTED.id INTO @TempTable where esn_todos_sn =@SN{0};
,StepType_id =(select id from esn_todos_Flow_StepType a where a.Map_Class='HR') output INSERTED.id INTO @TempTable where esn_todos_sn ={0};
select @FlowId=id from @TempTable;
insert into esn_todos_Flow_his(Flow_id,ConfirmTime,FromType_id,ToType_id,ConfirmUserId,ConfirmUserClass,ConfirmMethod,Description,Create_User_id,Create_time)
select id as Flow_id,GETDATE(),a.StepType_id_Previous,StepType_id,@gWadeID,'HR','SL','結算日期:' + @value,@gWadeID,GETDATE() from esn_todos_Flow a where a.id=@FlowId;
", i);
return_sn.Add(dr["SN"].ToString());
", SN);
return_sn.Add(SN);
if (i % batchcount == batchcount-1 || i== dt.Rows.Count-1) //固定筆數 存入批次語法
{
batchSql.Add(sqldeclare + sqlstr);
sqlstr = "";
}
}
......
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