Commit 227da49e authored by solho's avatar solho

feat:客戶列表新增update發票抬頭 API

fix:結算紀錄前一步驟錯誤
parent cd2a7481
......@@ -39,7 +39,8 @@ namespace WebAPI.Controllers
SqlCommand cmd = new SqlCommand("", Conn)
{
CommandText = @"
select customer_name from c_customer a
select customer_name,customer_id from c_customer a
where a.is_enabled=1 "
};
DataTable dt = SqlToDt(cmd);
......@@ -62,6 +63,97 @@ namespace WebAPI.Controllers
result.Content = new StringContent(JsonConvert.SerializeObject(response), System.Text.Encoding.UTF8, "application/json");
return result;
}
[Route("Update_CustomerListTP")]
[CorsHandle]
[HttpPost]
public HttpResponseMessage Update_CustomerList(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))
{
SqlCommand cmd = new SqlCommand("", Conn)
{
CommandText = @"MERGE INTO essen_request_info WITH(HOLDLOCK) as target USING(select * from essen_request_info a where a.request_id=@request_id ) as source (request_id,customer_id)
on(target.request_id = source.request_id )
WHEN MATCHED THEN UPDATE SET customer_id = @customer_id
WHEN NOT MATCHED THEN INSERT(request_id,customer_id)
VALUES(@request_id,@customer_id )"
};
cmd.Parameters.AddWithValue("@customer_id", obj_input["customer_id"].ToString());
cmd.Parameters.AddWithValue("@request_id", obj_input["request_id"].ToString());
DataTable dt = SqlToDt(cmd);
response.Msg = JsonConvert.SerializeObject(dt);
response.Code = "1";
}
}
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("Update_CustomerList")]
[CorsHandle]
[HttpPost]
public HttpResponseMessage Update_CustomerList2(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))
{
SqlCommand cmd = new SqlCommand("", Conn)
{
CommandText = @"MERGE INTO essen_customer WITH(HOLDLOCK) as target USING(select * from essen_customer a where a.customer_id=@customer_id) as source (customer_id,request_customer_id)
on(target.customer_id = source.customer_id )
WHEN MATCHED THEN UPDATE SET request_customer_id = @request_customer_id
WHEN NOT MATCHED THEN INSERT(customer_id,request_customer_id)
VALUES(@customer_id,@request_customer_id)"
};
cmd.Parameters.AddWithValue("@customer_id", obj_input["customer_id"].ToString());
cmd.Parameters.AddWithValue("@request_customer_id", obj_input["request_customer_id"].ToString());
DataTable dt = SqlToDt(cmd);
response.Msg = JsonConvert.SerializeObject(dt);
response.Code = "1";
}
}
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;
}
}
......
......@@ -238,7 +238,7 @@ namespace WebAPI.Controllers
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()
sqlstr += string.Format(@"update esn_todos_Flow Set Is_Settlement = 1,update_user_id = @gWadeID,Update_time = GETDATE(),StepType_id_Previous=StepType_id
,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)
......
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