Commit 90dd5de1 authored by solho's avatar solho

轉營運辦公式修改

parent 418e04f7
...@@ -528,7 +528,7 @@ namespace WebAPI.Controllers ...@@ -528,7 +528,7 @@ namespace WebAPI.Controllers
{ {
//Tsql = Tsql + "PG_IsConfirm =" + IsConfirm + "," + "PE_IsConfirm =" + IsConfirm + "," + "Leader_IsConfirm =" + IsConfirm + ","; //退回後,改為更新所有Flow狀態確認 //Tsql = Tsql + "PG_IsConfirm =" + IsConfirm + "," + "PE_IsConfirm =" + IsConfirm + "," + "Leader_IsConfirm =" + IsConfirm + ","; //退回後,改為更新所有Flow狀態確認
//CStepTypeNext = AllStepType.Where(p => p.Step_Value == Step_Value_previous).FirstOrDefault(); //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); 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 ); cmd.Parameters.AddWithValue(string.Format("@todos_Reject_Desc_{0}",i), "承辦人:" + JtSn["todos_Reject_Desc"].ToString() + "<br>主管:" + Reject_Description );
CStepTypeNext = AllStepType.Where(p => p.id == CStepTypeCur.Step_Id_previous).FirstOrDefault(); CStepTypeNext = AllStepType.Where(p => p.id == CStepTypeCur.Step_Id_previous).FirstOrDefault();
......
...@@ -124,10 +124,9 @@ namespace WebAPI.Controllers ...@@ -124,10 +124,9 @@ namespace WebAPI.Controllers
result.Content = new StringContent(JsonConvert.SerializeObject(response), System.Text.Encoding.UTF8, "application/json"); result.Content = new StringContent(JsonConvert.SerializeObject(response), System.Text.Encoding.UTF8, "application/json");
return result; return result;
} }
[Route("UpdateDatePointsSettlement")] [Route("UpdateDatePointsSettlement")]
[CorsHandle] [CorsHandle]
[HttpPost] [HttpPost]
public HttpResponseMessage Update_date_points_settlement(ParamModel param) public HttpResponseMessage Update_date_points_settlement(ParamModel param)
{ {
...@@ -210,6 +209,90 @@ namespace WebAPI.Controllers ...@@ -210,6 +209,90 @@ namespace WebAPI.Controllers
return result; return result;
} }
[Route("batchUpdate_points")]
[CorsHandle]
[HttpPost]
public HttpResponseMessage batchUpdate_points(ParamModel param)
{
if (param != null && param.Input != null && !string.IsNullOrWhiteSpace((param.Input.ToString())))
{
string input = param.Input.ToString();
JObject obj_input = JObject.Parse(input.ToString());
try
{
using (SqlConnection Conn = new SqlConnection(connString))
{
String sns = obj_input["SN"].ToString();
String sqlstr = @"select td.SN, tdp.SN as SN_tdp,td.points,AssignedTo_userid FROM esn_todos td
left join esn_todos_points tdp on tdp.sn=td.sn
WHERE td.sn in (" + sns + ")";
String value = obj_input["value"].ToString();
value = value == "" ? "null" : obj_input["value"].ToString();
SqlCommand cmd = new SqlCommand("", Conn)
{
CommandText = sqlstr
};
cmd.Parameters.AddWithValue("@SN", obj_input["SN"].ToString());
DataTable dt = SqlToDt(cmd);
String point, AssignedTo_userID;
DataRow dr;
sqlstr = "declare @TempTable TABLE(id INT) declare @FlowId int; ";
cmd.Parameters.Clear();
for (int i = 0; i < dt.Rows.Count; i++)
{
dr = dt.Rows[i];
point = dr["points"].ToString();
AssignedTo_userID = dr["AssignedTo_userID"].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);
}
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);
}
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 =(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,@value,a.StepType_id,StepType_id,@gWadeID,'HR','SL','確認日期:' + @value,@gWadeID,GETDATE() from esn_todos_Flow a where a.id=@FlowId;
", i);
}
cmd.Parameters.AddWithValue("@value", value);
cmd.Parameters.AddWithValue("@gWadeID", obj_input["gWadeID"].ToString());
cmd.CommandText = sqlstr;
dt = SqlToDt(cmd);
response.Code = "1";
string JSONString = string.Empty;
JSONString = JsonConvert.SerializeObject(dt);
response.Msg = "結算完畢";
}
}
catch (Exception e)
{
response.Code = "0";
response.Msg = "Exception:" + e.StackTrace;
}
}
else
{
response.Code = "0";
response.Msg = "no input or format error";
}
result.Content = new StringContent(JsonConvert.SerializeObject(response), System.Text.Encoding.UTF8, "application/json");
return result;
}
/// <summary> /// <summary>
/// 案件統計 SP測試1 /// 案件統計 SP測試1
/// </summary> /// </summary>
...@@ -266,5 +349,61 @@ namespace WebAPI.Controllers ...@@ -266,5 +349,61 @@ namespace WebAPI.Controllers
return result; return result;
} }
[Route("rpt_PerformanceMonth_Flow")]
[CorsHandle]
[HttpPost]
[HttpGet]
public HttpResponseMessage rpt_PerformanceMonth_Flow(ParamModel param)
{
if (param != null && param.Input != null && !string.IsNullOrWhiteSpace((param.Input.ToString())))
{
string input = param.Input.ToString();
try
{
using (SqlConnection Conn = new SqlConnection(connString))
{
SqlCommand cmd = new SqlCommand("", Conn)
{
CommandText = @"
Declare @p_ReportType varchar(20),@p_ReportType2 varchar(20), @p_Date_settlement_begin DateTime,@p_Date_settlement_end DateTime
DECLARE @Emp_ID VARCHAR(50),@Emp_ItemNo VARCHAR(20),@QryEmpItem VARCHAR(20)= '' ,@QryEmpDS VARCHAR(20)= '' ,@p_isComfirm varchar(1),@p_gtPoint int
,@IsPG bit=0,@PGJoin varchar(max)='',@p_flow_user_id_also VARCHAR(50);
select * into #tb_Split from ufn_split(@p_params,',')
select @p_ReportType=value from #tb_Split where id=1
select @p_isComfirm=value from #tb_Split where id=2
select @p_gtPoint=value from #tb_Split where id=3
select @p_Date_settlement_begin=value from #tb_Split where id=4
select @p_Date_settlement_end=value from #tb_Split where id=5
select @p_ReportType2=value from #tb_Split where id=6
"
};
//cmd.Parameters.AddWithValue("@SaveData", obj_input["SaveData"].ToString());
//cmd.Parameters.AddWithValue("@gUserID_wade", obj_input["gUserID_wade"].ToString());
//cmd.Parameters.AddWithValue("@Country", obj_input["Country"].ToString());
DataTable dt = SqlToDt(cmd);
response.Code = "1";
response.Msg = "匯出完畢";
}
}
catch (Exception e)
{
response.Code = "0";
response.Msg = "Exception:" + e.StackTrace;
}
}
else
{
response.Code = "0";
response.Msg = "no input or format error";
}
result.Content = new StringContent(JsonConvert.SerializeObject(response), System.Text.Encoding.UTF8, "application/json");
return result;
}
} }
} }
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