Commit 55c2bda8 authored by solho's avatar solho

add file

parent d468f47a
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Web.Http;
using System.Web.Http.Cors;
using WebAPI.Models;
using static WebAPI.Models.CommonModel;
using static WebAPI.Tool.Common;
namespace WebAPI.Controllers
{
[RoutePrefix("Esn_Subitem")]
public class Esn_Todos_FlowController : ApiController
{
MessageList_ETF Outmsg;
public Esn_Todos_FlowController()
{
if (Outmsg == null) Outmsg = new MessageList_ETF();
}
/// <summary>
/// 取得歷史明細
/// </summary>
/// <param name="Get_Flow_his"></param>
/// <returns></returns>
[Route("Get_Flow_his")]
[CorsHandle]
[HttpPost]
[HttpGet]
public MessageList_ETF Get_Flow_his(int Flowid)
{
String connString = ConfigurationManager.ConnectionStrings["eflow_cur"].ConnectionString;
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 top 100 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,a.Create_User_id,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
where a.Flow_id = @Flow_id
order by ConfirmTime desc
"
};
cmd.Parameters.AddWithValue("@Flow_id", Flowid);
DataSet ds = SqlToDs(cmd);
foreach (DataRow dr in ds.Tables[0].Rows)
{
hisT = new Esn_Todos_FlowModel()
{
ConfirmTime = (DateTime?)dr["ConfirmTime"],
ConfirmUserClass = dr["ConfirmUserClass"].ToString(),
ConfirmMethod = dr["ConfirmMethod"].ToString(),
Create_time = (DateTime?)dr["Create_time"],
Create_User_id = dr["Create_User_id"].ToString(),
From = dr["From"].ToString(),
To = dr["To"].ToString(),
Description = dr["Description"].ToString()
};
Hislist.Add(hisT);
}
}
Outmsg.FlowHislist = Hislist;
Outmsg.ListCode = 0;
Outmsg.Listmsg = "success";
}
catch (Exception e)
{
Outmsg.ListCode = 1;
Outmsg.Listmsg = "Exception:" + e.StackTrace;
}
return Outmsg;
}
}
}
using ExcelDataReader;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Web;
using System.Web.Http;
using System.Web.Http.Cors;
using WebAPI.Models;
using WebAPI.Tool;
using static WebAPI.Models.Esn_Todos;
namespace WebAPI.Controllers
{
[RoutePrefix("Esn_Subitem")]
public class Esn_todosController : ApiController
{
public Esn_todosController()
{
}
/// <summary>
/// 取得歷史明細
/// </summary>
/// <param name="Get_cur_his_id"></param>
/// <returns></returns>
///
[Route("Test")]
[HttpPost]
public MessageList show_sub_todos_data(int? SN)
{
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 + ")";
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 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
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
left join i_apply_type at1 on at1.case_type_id=ci1.case_type_id AND ci1.apply_type_id=at1.apply_type_id
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
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";
//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>案件狀態', "
// 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 & " 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)
return null;
}
}
}
using System;
using System.Collections.Generic;
namespace WebAPI.Models
{
/// <summary>
/// 處理事項子項相關
/// </summary>
public class MessageList_ET : MessageList
{
public List<Esn_Todos> Esn_Todoslist { get; set; }
}
public class Esn_Todos
{
public DateTime? ConfirmTime { get; set; }
public String ConfirmUserClass { get; set; }
public String ConfirmMethod { get; set; }
public DateTime? Create_time { get; set; }
public String Create_User_id { get; set; }
public String Step_Text { get; set; }
public String From { get; set; }
public String To { get; set; }
public String Description { get; set; }
public String Create_User_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