Commit 1ab2f3b5 authored by solho's avatar solho

1.新增審核流程API

2.Rename 部分物件名
parent ee6f9d0d
......@@ -62,7 +62,7 @@ namespace WebAPI.Controllers
"
};
cmd.Parameters.AddWithValue("@eflow_id", Get_cur_his_id);
DataSet ds = GetSqlToDs(cmd);
DataSet ds = SqlToDs(cmd);
foreach (DataRow dr in ds.Tables[0].Rows)
{
hisT = new 核稿歷史()
......@@ -270,7 +270,7 @@ namespace WebAPI.Controllers
#endregion
StringBuilder auditString = new StringBuilder(""); int auditCount = 10;
cmd.CommandText = Cte + MaxCount;
DataSet ds = GetSqlToDs(cmd);
DataSet ds = SqlToDs(cmd);
foreach (DataRow dr in ds.Tables[0].Rows)
{
auditCount = Convert.ToInt16(dr["maxCount"]);
......@@ -284,7 +284,7 @@ namespace WebAPI.Controllers
}
cmd.CommandText = (Cte + Result).Replace("@auditString", auditString.ToString());
ds = GetSqlToDs(cmd);
ds = SqlToDs(cmd);
foreach (DataRow dr in ds.Tables[0].Rows)
{
......@@ -392,7 +392,7 @@ namespace WebAPI.Controllers
where a.eflow_id IN ({0}) @Group
", string.Join(",", parameters));
cmd.CommandText = cmd.CommandText.Replace("@fields", fields).Replace("@Group", Groups);
DataSet ds = GetSqlToDs(cmd);
DataSet ds = SqlToDs(cmd);
foreach (DataRow dr in ds.Tables[0].Rows)
{
if (isCount)
......@@ -494,7 +494,7 @@ namespace WebAPI.Controllers
where a.eflow_id IN ({0}) @Group
", string.Join(",", parameters));
cmd.CommandText = cmd.CommandText.Replace("@fields", fields).Replace("@Group", Groups);
DataSet ds = GetSqlToDs(cmd);
DataSet ds = SqlToDs(cmd);
foreach (DataRow dr in ds.Tables[0].Rows)
{
if (isCount)
......
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;
namespace WebAPI.Controllers
{
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")]
//[EnableCors(origins: "http://120.78.73.107:8888,https://ipeasy.purplevineip.com,https://ipeasy.essenptl.com,http://localhost:8002",
//headers: "*", methods: "*", SupportsCredentials = true)]
[CorsHandle]
[HttpPost]
[HttpGet]
public MessageList_ETF Get_Flow_his(int Flowid)
{
String connString = ConfigurationManager.ConnectionStrings["eflow_cur"].ConnectionString;
List<Esn_Todos_Flow_his> Hislist = new List<Esn_Todos_Flow_his>();
try
{
using (SqlConnection Conn = new SqlConnection(connString))
{
Esn_Todos_Flow_his hisT = new Esn_Todos_Flow_his();
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_Flow_his()
{
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;
}
}
}
......@@ -405,7 +405,7 @@ namespace WebAPI.Controllers
cmd.Parameters.AddWithValue("@fee_type_zh_tw", item["fee_type_zh_tw"].ToString());
cmd.Parameters.AddWithValue("@apply_type_id", item["apply_type_id"].ToString() == "" ? "ALL" : item["apply_type_id"].ToString());
cmd.Parameters.AddWithValue("@fee_cate_workitem", item["fee_cate_workitem"].ToString());
DataSet ds = GetSqlToDs(cmd);
DataSet ds = SqlToDs(cmd);
return ds;
}
private DataSet IsExistsFeeOfferConfig(ref SqlCommand cmd, Dictionary<string, string> item)
......@@ -420,7 +420,7 @@ namespace WebAPI.Controllers
cmd.Parameters.AddWithValue("@apply_type_id", item["apply_type_id"].ToString());
cmd.Parameters.AddWithValue("@customer_id", item["customer_id"].ToString());
cmd.Parameters.AddWithValue("@country_id", item["country_id"].ToString());
DataSet ds = GetSqlToDs(cmd);
DataSet ds = SqlToDs(cmd);
return ds;
}
......@@ -478,7 +478,7 @@ namespace WebAPI.Controllers
cmd.Parameters.AddWithValue("@fee_cate_workitem", item["fee_cate_workitem"].ToString());
cmd.Parameters.AddWithValue("@update_user_id", item["update_user_id"].ToString());
DataTable dt = InsertSqlToDr(cmd);
DataTable dt = SqlToDt(cmd);
item["seq"] = dt.Rows[0]["seq"].ToString();
item["fee_type_id"] = dt.Rows[0]["fee_type_id"].ToString();
......@@ -525,7 +525,7 @@ namespace WebAPI.Controllers
cmd.Parameters.AddWithValue("@fee_cate_workitem", item["fee_cate_workitem"].ToString());
cmd.Parameters.AddWithValue("@update_user_id", item["update_user_id"].ToString());
DataTable dt = InsertSqlToDr(cmd);
DataTable dt = SqlToDt(cmd);
item["seq"] = dt.Rows[0]["seq"].ToString();
}
......@@ -548,7 +548,7 @@ namespace WebAPI.Controllers
cmd.Parameters.AddWithValue("@remarks", "系統導入");
DataTable dt = InsertSqlToDr(cmd);
DataTable dt = SqlToDt(cmd);
return dt.Rows.Count > 0;
}
......@@ -596,7 +596,7 @@ namespace WebAPI.Controllers
cmd.Parameters.AddWithValue("@remark1", "系統導入");
//cmd.Parameters.AddWithValue("@remark1", "");
DataTable dt = InsertSqlToDr(cmd);
DataTable dt = SqlToDt(cmd);
return dt.Rows.Count > 0;
}
private void DeleteFeeOfferConfig(ref SqlCommand cmd, Dictionary<string, string> item)
......@@ -621,7 +621,7 @@ namespace WebAPI.Controllers
", Country1, Country2);
cmd.CommandText = str;
DataSet MetaData = GetSqlToDs(cmd);
DataSet MetaData = SqlToDs(cmd);
return MetaData;
}
......
......@@ -23,7 +23,9 @@ namespace WebAPI.Models
public class CommonModel
{
public static DataSet GetSqlToDs(SqlCommand cmd)
#region 共用函式
public static DataSet SqlToDs(SqlCommand cmd)
{
using (DataSet ds = new DataSet())
{
......@@ -36,7 +38,7 @@ namespace WebAPI.Models
}
}
public static DataTable InsertSqlToDr(SqlCommand cmd)
public static DataTable SqlToDt(SqlCommand cmd)
{
using (DataTable dt = new DataTable())
{
......@@ -49,7 +51,6 @@ namespace WebAPI.Models
}
#region 共用函式
public static string EastAsia_Format(string Msg)
{
Match m;
......
using System;
using System.Collections.Generic;
namespace WebAPI.Models
{
/// <summary>
/// 點數結算流程相關
/// </summary>
public class MessageList_ETF : MessageList
{
public List<Esn_Todos_Flow_his> FlowHislist { get; set; }
}
public class Esn_Todos_Flow_his
{
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
......@@ -26,7 +26,7 @@ public class CorsHandle : Attribute, ICorsPolicyProvider
objProlicy.Origins.Add("http://localhost");
objProlicy.Origins.Add("https://dev.essenptl.com");
objProlicy.Origins.Add("https://ite.essenptl.com");
objProlicy.Methods.Add("GET");
objProlicy.Methods.Add("POST");
objProlicy.Methods.Add("DELETE");
......
......@@ -197,10 +197,12 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Controllers\DictionaryController.cs" />
<Compile Include="Controllers\Esn_Todos_FlowController.cs" />
<Compile Include="Controllers\FileController.cs" />
<Compile Include="Controllers\InventorController.cs" />
<Compile Include="Controllers\SubProcInfoController.cs" />
<Compile Include="Controllers\ProcInfoController.cs" />
<Compile Include="Models\Esn_Todos_FlowModel.cs" />
<Compile Include="Models\ParamModel.cs" />
<Compile Include="Models\CommonResponseMsg.cs" />
<Compile Include="Tool\Common.cs" />
......@@ -309,6 +311,8 @@
</ItemGroup>
<ItemGroup>
<Folder Include="App_Data\" />
<Folder Include="Data\" />
<Folder Include="Views\Esn_Todos_Flow\" />
</ItemGroup>
<ItemGroup>
<Content Include="fonts\glyphicons-halflings-regular.woff2" />
......
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