Commit e2b8fe5a authored by solho's avatar solho

EHR匯出紀錄

parent 0a818eca
......@@ -35,6 +35,84 @@ namespace WebAPI.Controllers
response = new CommonResponseMsg();
}
/// <summary>
/// 取得歷史明細
/// </summary>
/// <param name="Get_Flow_his"></param>
/// <returns></returns>
[Route("GetFlowSns")]
[CorsHandle]
[HttpPost]
//[HttpGet]
public HttpResponseMessage Get_Flow_Sns(ParamModel param)
{
if (param != null && param.Input != null && !string.IsNullOrWhiteSpace((param.Input.ToString())))
{
string input = param.Input.ToString();
String connString = ConfigurationManager.ConnectionStrings["eflow_cur"].ConnectionString;
JObject obj_input = JObject.Parse(input.ToString());
List<Esn_Todos_FlowModel> Hislist = new List<Esn_Todos_FlowModel>();
try
{
using (SqlConnection Conn = new SqlConnection(connString))
{
Esn_Todos_FlowModel hisT = new Esn_Todos_FlowModel();
SqlCommand cmd = new SqlCommand("", Conn)
{
CommandText = @" select a.ConfirmTime
,Case When a.ConfirmUserClass='PG' Then '程序' When a.ConfirmUserClass='PE' Then '承辦人' When a.ConfirmUserClass='Leader' Then '主管' else '其他' End as ConfirmUserClass
,Case When a.ConfirmMethod='CF' Then '確認' When a.ConfirmMethod='RJ' Then '退回' When a.ConfirmMethod='RV' Then '撤回' else '其他' End as ConfirmMethod
,a.Create_time,d.cn_name as Create_User_Name,b.Step_Text as ""From"",c.Step_Text as ""To"",a.Description
from esn_Todos_flow_his a
left join esn_todos_Flow_StepType b on a.FromType_id = b.id
left join esn_todos_Flow_StepType c on a.ToType_id = c.id
left join evw_Employee d on a.Create_User_id = d.user_id
where a.Flow_id = @Flow_id
"
};
cmd.Parameters.AddWithValue("@Flow_id", obj_input["Flowid"].ToString());
DataSet ds = SqlToDs(cmd);
DateTime? ConfirmTime;
foreach (DataRow dr in ds.Tables[0].Rows)
{
ConfirmTime = (DateTime?)dr["ConfirmTime"];
hisT = new Esn_Todos_FlowModel()
{
ConfirmTime = ConfirmTime,
ConfirmUserClass = dr["ConfirmUserClass"].ToString(),
ConfirmMethod = dr["ConfirmMethod"].ToString(),
Create_User_Name = dr["Create_User_Name"].ToString(),
From = dr["From"].ToString(),
To = dr["To"].ToString(),
Description = dr["Description"].ToString()
};
Hislist.Add(hisT);
//Hislist.OrderByDescending(p => p.ConfirmTime);
}
}
response.Code = "1";
response.Msg = Hislist;
result.Content = new StringContent(JsonConvert.SerializeObject(response), System.Text.Encoding.UTF8, "application/json");
}
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>
......@@ -221,7 +299,7 @@ namespace WebAPI.Controllers
StepType_idHis = CStepTypeCur.id;
CStepTypeNext = AllStepType.Where(p => p.Map_Class.Contains("PE")).FirstOrDefault();
CStepTypeCur = CStepTypeNext;
CStepTypeCur = CStepTypeNext;
Tsql = @"insert into esn_todos_Flow(esn_todos_sn,[StepType_id],[" + CStepTypeCur.Map_Class
+ @"_IsConfirm],StepType_id_Previous,Description,[create_user_id],[Create_time],update_user_id,update_time) "
+ " OUTPUT Inserted.id into @TempTable "
......@@ -264,8 +342,8 @@ namespace WebAPI.Controllers
Tsql = Tsql + CStepTypeNext.Map_Class + "_IsConfirm =" + IsConfirm + ",";
}
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 +
......@@ -296,7 +374,53 @@ namespace WebAPI.Controllers
response.Code = "0";
response.Msg = return_msg_error;
}
}
}
}
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;
}
[Route("SavePointSettlementLog")]
[CorsHandle]
[HttpPost]
[HttpGet]
public HttpResponseMessage Save_PointSettlement_Log(ParamModel param)
{
if (param != null && param.Input != null && !string.IsNullOrWhiteSpace((param.Input.ToString())))
{
string input = param.Input.ToString();
String connString = ConfigurationManager.ConnectionStrings["eflow_cur"].ConnectionString;
try
{
JObject obj_input = JObject.Parse(input.ToString());
JArray obj_input_data= JArray.Parse(obj_input["SaveData"].ToString());
using (SqlConnection Conn = new SqlConnection(connString))
{
SqlCommand cmd = new SqlCommand("", Conn)
{
CommandText = @"Insert into esn_todos_SettleLog([SaveData],[update_time],[update_user_id])
values(@SaveData,getdate(),@gUserID_wade)"
};
cmd.Parameters.AddWithValue("@SaveData", obj_input["SaveData"].ToString());
cmd.Parameters.AddWithValue("@gUserID_wade", obj_input["gUserID_wade"].ToString());
DataTable dt = SqlToDt(cmd);
response.Code = "1";
response.Msg = "匯出完畢";
}
}
catch (Exception e)
{
......@@ -314,4 +438,5 @@ namespace WebAPI.Controllers
return result;
}
}
}
......@@ -35,5 +35,34 @@ namespace WebAPI.Models
public String update_user_id { get; set; }
public DateTime? update_time { get; set; }
}
public class GetFlowSnsModel
{
public String attr_SN { get; set; }
public String class_1 { get; set; }
public String attr_case_id { get; set; }
public String attr_caseNo { get; set; }
public String case_volume { get; set; }
public String country_id { get; set; }
public String case_name { get; set; }
public String apply_type_zh_tw { get; set; }
public String business_type_zh_tw { get; set; }
public String customer_name { get; set; }
public String Flow_id { get; set; }
public String StepType_id { get; set; }
public String PE_IsConfirm { get; set; }
public String PG_IsConfirm { get; set; }
public String Leader_IsConfirm { get; set; }
public String Description { get; set; }
public String StepType_id_Previous { get; set; }
public String Map_Class { get; set; }
public String Map_Class_StepType_id { get; set; }
public String Is_Settlement { get; set; }
public String Step_Value { get; set; }
public String Create_user_id { get; set; }
public DateTime? Create_time { get; set; }
public DateTime? Update_time { get; set; }
public String Update_user_id { get; set; }
}
}
\ No newline at end of file
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