Commit 369a3e8e authored by solho's avatar solho

recommit

parent 833fa398
......@@ -22,8 +22,10 @@ namespace WebAPI.Controllers
[RoutePrefix("Esn_Subitem")]
public class Esn_todosController : ApiController
{
HttpResponseMessage result;
CommonResponseMsg response;
public Esn_todosController()
{
{
}
/// <summary>
......@@ -32,35 +34,41 @@ namespace WebAPI.Controllers
/// <param name="Get_cur_his_id"></param>
/// <returns></returns>
///
[Route("Test")]
[HttpPost]
public MessageList show_sub_todos_data(int? SN)
[Route("show_sub_todos_data")]
[HttpPost]
public HttpResponseMessage show_sub_todos_data(ParamModel param)
{
String sqlstr = "";
// SN = request_int("SN")
sqlstr = @"select distinct td.SN, case_id, finishedDate as finish_date, attorneyDueDate as int_due_date,
LegalDueDate as legal_due_date, todosStatus_name as todos_status_name, taskDescription as taskName, assignedTo_userID,
AssignStatus_name,Points as point_num,
Case When pointsType='POINT' Then '點數' When pointsType='AMT' Then '金額' When ISNULL(PointsType,'')='MP' Then '加乘點數' Else '點數' END as point_type
, '' as point_note, proc_id, matter_name
,case when (ISNULL(points,0)<>0 AND ISNULL(PointsType,'') <>'MP') AND ISNULL(exchangeRate,0)=0 THEn 1 ELSE ISNULL(exchangeRate,0) END as exchangeRate
from esn_Todos td where td.SN in (" + SN + ")";
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());
try
{
using (SqlConnection Conn = new SqlConnection(connString))
{
String sqlstr = "";
int SN = 853141;
sqlstr = @"select distinct td.SN, case_id, finishedDate as finish_date, attorneyDueDate as int_due_date,
LegalDueDate as legal_due_date, todosStatus_name as todos_status_name, taskDescription as taskName, assignedTo_userID,
AssignStatus_name,Points as point_num,
Case When pointsType='POINT' Then '點數' When pointsType='AMT' Then '金額' When ISNULL(PointsType,'')='MP' Then '加乘點數' Else '點數' END as point_type
, '' as point_note, proc_id, matter_name
,case when (ISNULL(points,0)<>0 AND ISNULL(PointsType,'') <>'MP') AND ISNULL(exchangeRate,0)=0 THEn 1 ELSE ISNULL(exchangeRate,0) END as exchangeRate
from esn_Todos td where td.SN in (" + SN + ")";
sqlstr = "select distinct td.*, tds.date_points_settlement, tds.date_points_settlement_pic_confirm from (" + sqlstr + ") td left join esn_todos_points tds on tds.sn=td.sn ";
//'gDebugha_wade(sqlstr)
sqlstr = "select distinct td.*, tds.date_points_settlement, tds.date_points_settlement_pic_confirm from (" + sqlstr + ") td left join esn_todos_points tds on tds.sn=td.sn ";
//'---+ 承辦人員
sqlstr = "select t11.*, isnull(ui1.cn_name, '&nbsp;') as cn_name from (" + sqlstr + ") t11 left join s_user_info ui1 on ui1.user_id=t11.assignedTo_userID";
//'gDebugha_wade(sqlstr)
//'---+ 承辦人員
sqlstr = "select t11.*, isnull(ui1.cn_name, '&nbsp;') as cn_name from (" + sqlstr + ") t11 left join s_user_info ui1 on ui1.user_id=t11.assignedTo_userID";
//'gDebugha_wade(sqlstr)
//'//+ caseNo
//'//+ caseNo
sqlstr = @"select distinct t1.*, ci1.country_id, ci1.case_volume, ci1.case_name, apply_type_zh_tw, business_type_zh_tw,
sqlstr = @"select distinct t1.*, ci1.country_id, ci1.case_volume, ci1.case_name, apply_type_zh_tw, business_type_zh_tw,
c1.customer_name,etf.id as Flow_id,etf.StepType_id,etf.PE_IsConfirm,etf.PG_IsConfirm,etf.Leader_IsConfirm,etf.Description,etf.StepType_id_Previous,
etfs.Map_Class,etfs.id as Map_Class_StepType_id,etf.Is_Settlement from (" + sqlstr + @") t1
left join p_case_info ci1 on t1.case_id=ci1.case_id
......@@ -68,39 +76,57 @@ namespace WebAPI.Controllers
left join i_business_type bt1 on bt1.case_type_id=ci1.case_type_id AND ci1.business_type_id=bt1.business_type_id
left join c_customer c1 on c1.customer_id=ci1.customer_id";
//'結算 FLOW'
sqlstr += @"left join esn_todos_Flow etf on etf.esn_todos_sn = t1.sn
//'結算 FLOW'
sqlstr += @"
left join esn_todos_Flow etf on etf.esn_todos_sn = t1.sn
left join esn_todos_Flow_his etfh on etf.id=etfh.Flow_id
left join esn_todos_Flow_StepType etfs on etf.StepType_id=etfs.id ";
//'gDebugha_wade(sqlstr)
//' wade todos
sqlstr = "select t3.*, isnull(cp3.ctrl_proc_zh_tw,('[IPS:' + matter_name + ']')) as TaskL1Name from (" + sqlstr + @")
t3 left join p_proc_info pc3 on pc3.proc_id=t3.proc_id
left join i_ctrl_proc cp3 on pc3.ctrl_proc_id=cp3.ctrl_proc_id";
//'gDebugha_wade(sqlstr)
//' wade todos
sqlstr = "select t3.*, isnull(cp3.ctrl_proc_zh_tw,('[IPS:' + matter_name + ']')) as TaskL1Name from (" + sqlstr + @")
t3 left join p_proc_info pc3 on pc3.proc_id=t3.proc_id
left join i_ctrl_proc cp3 on pc3.ctrl_proc_id=cp3.ctrl_proc_id";
//sqlstr0 = sqlstr
// sqlstr = " SELECT SN as attr_SN, 'caseNo' as class_1, case_id as attr_case_id, case_volume as attr_caseNo, case_volume as 案件編號, " & _
//sqlstr0 = sqlstr
// sqlstr = " SELECT SN as attr_SN, 'caseNo' as class_1, case_id as attr_case_id, case_volume as attr_caseNo, case_volume as 案件編號, " & _
// " ('<span class=Office_Name>' + country_id + '<span><br/><span class=caseNo2>' + '' + '</span>') as '國家<br/>案件編號2', "
// sqlstr = sqlstr & " 'tdTitle' as class_1, ('<span class=title>' + case_name + '</span><br/><span class=Client_CompanyName>' + customer_name + '<span>') as '案件名稱<br/>客戶名稱', "
// sqlstr = sqlstr & " 'LL' as class_applyType, apply_type_zh_tw as '申請類型',"
//sqlstr = sqlstr & " 'LL' as class_todo, ('<span class=MatterName>' + TaskL1Name +'<span><br/><span class=TaskDescription>' + taskName + '</span>') as '上層事項<br/>子層事項', "
//sqlstr = sqlstr & " 'LL' as class_status, ('<div class=ToDosStatus_Name>' + todos_status_name + '</div><div class=Status_Name>' + '' + '</div>') as '事項狀態<br>案件狀態', "
// " ('<span class=Office_Name>' + country_id + '<span><br/><span class=caseNo2>' + '' + '</span>') as '國家<br/>案件編號2', "
// sqlstr = sqlstr & " 'tdTitle' as class_1, ('<span class=title>' + case_name + '</span><br/><span class=Client_CompanyName>' + customer_name + '<span>') as '案件名稱<br/>客戶名稱', "
// sqlstr = sqlstr & " 'LL' as class_applyType, apply_type_zh_tw as '申請類型',"
//sqlstr = sqlstr & " 'LL' as class_todo, ('<span class=MatterName>' + TaskL1Name +'<span><br/><span class=TaskDescription>' + taskName + '</span>') as '上層事項<br/>子層事項', "
//sqlstr = sqlstr & " 'LL' as class_status, ('<div class=ToDosStatus_Name>' + todos_status_name + '</div><div class=Status_Name>' + '' + '</div>') as '事項狀態<br>案件狀態', "
// sqlstr = sqlstr & " assignedTo_userID as attr_userID, ('<span class=AssignedTo_Name>' + cn_name + '<span>') as 承辦人員, "
// sqlstr = sqlstr & " assignedTo_userID as attr_userID, ('<span class=AssignedTo_Name>' + cn_name + '<span>') as 承辦人員, "
//sqlstr = sqlstr & " ('<span class=legalDueDate>' + convert(varchar, legal_due_date, 23) + '<span>') as '法定到期日', "
//sqlstr = sqlstr & " ('<span class=legalDueDate>' + convert(varchar, legal_due_date, 23) + '<span>') as '法定到期日', "
//sqlstr = sqlstr & " finish_date as 完成日, int_due_date as 事務所到期日, 'tdr' as class_1, point_num as 點數,point_type as 點數類型, 'LL' as class_assignStatus, AssignStatus_name as '指派狀態', 'tdr' as class_1, exchangeRate as 評分, 'date_points_settlement' as class_2, date_points_settlement as 點數結算日, Flow_id as attr_Flowid,isnull(Map_Class,'PG') as attr_MapClass ,StepType_id_Previous as attr_StepTypeidPrevious ,Is_Settlement as attr_IsSettlement,isnull(StepType_id,'1') as 目前結算流程, 'checkbox2' as attr_type,'Field_PG' AS class_c1, (case when PG_IsConfirm =1 then 1 else null end) as 程序已確認, 'checkbox2' as attr_type ,'Field_PE' AS class_c2 ,(case when PE_IsConfirm =1 then 1 else null end) as 承辦人已確認, 'checkbox2' as attr_type ,'Field_Leader' AS class_c3, (case when Leader_IsConfirm =1 then 1 else null end) as 主管已確認,Description as 退回原因, date_points_settlement_pic_confirm as attr_title, 'checkbox2' as attr_type, 'date_points_settlement_pic_confirm' as class_3 /* , case when date_points_settlement_pic_confirm is null then null else 1 end as 確認結算, point_note as 備註 */ "
//sqlstr = sqlstr & " finish_date as 完成日, int_due_date as 事務所到期日, 'tdr' as class_1, point_num as 點數,point_type as 點數類型, 'LL' as class_assignStatus, AssignStatus_name as '指派狀態', 'tdr' as class_1, exchangeRate as 評分, 'date_points_settlement' as class_2, date_points_settlement as 點數結算日, Flow_id as attr_Flowid,isnull(Map_Class,'PG') as attr_MapClass ,StepType_id_Previous as attr_StepTypeidPrevious ,Is_Settlement as attr_IsSettlement,isnull(StepType_id,'1') as 目前結算流程, 'checkbox2' as attr_type,'Field_PG' AS class_c1, (case when PG_IsConfirm =1 then 1 else null end) as 程序已確認, 'checkbox2' as attr_type ,'Field_PE' AS class_c2 ,(case when PE_IsConfirm =1 then 1 else null end) as 承辦人已確認, 'checkbox2' as attr_type ,'Field_Leader' AS class_c3, (case when Leader_IsConfirm =1 then 1 else null end) as 主管已確認,Description as 退回原因, date_points_settlement_pic_confirm as attr_title, 'checkbox2' as attr_type, 'date_points_settlement_pic_confirm' as class_3 /* , case when date_points_settlement_pic_confirm is null then null else 1 end as 確認結算, point_note as 備註 */ "
// sqlstr = sqlstr & " from (" & sqlstr0 & ") tt "
//'gDebugha_wade(sqlstr)
// sqlstr = sqlstr & " from (" & sqlstr0 & ") tt "
//'gDebugha_wade(sqlstr)
response.Code = "1";
//response.Msg = Hislist;
result.Content = new StringContent(JsonConvert.SerializeObject(response), System.Text.Encoding.UTF8, "application/json");
}
}
catch (Exception e)
{
return null;
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;
}
}
......
......@@ -65,4 +65,15 @@ namespace WebAPI.Models
}
public class ExportEHR_hisModel
{
public int id { get; set; }
public String SaveData { get; set; }
public DateTime? update_time { get; set; }
public String update_user_id { get; set; }
public DateTime? Create_time { get; set; }
public String Create_user_id { get; set; }
public String cn_name { 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