You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DS7/DSWeb/Areas/CommMng/Controllers/DSWEBAPPInterfaceController.cs

332 lines
13 KiB
C#

using System;
using System.Linq;
using System.Web.Mvc;
using DSWeb.Areas.Account.DAL.Chfee_Payapplication;
using DSWeb.Areas.Account.Models.Chfee_Payapplication;
using DSWeb.Areas.Account.DAL.Chfee_Invoicehexiao;
using DSWeb.Areas.Account.Models.Chfee_Invoicehexiao;
using DSWeb.MvcShipping.Helper;
using DSWeb.Areas.CommMng.DAL;
using System.Collections.Generic;
using HcUtility.Comm;
using System.IO;
using System.Text;
using DSWeb.Areas.CommMng.Models;
using System.Data;
using DSWeb.Common.DB;
using System.Web.UI.WebControls;
namespace DSWeb.Areas.CommMng.Controllers
{
[JsonRequestBehavior]
public class DSWEBAPPInterfaceController : Controller
{
/// <summary>
/// 用于提供给app的查询入口
/// 需传入userid
/// </summary>
/// <param name="userid"></param>
/// <param name="condition"></param>
/// <returns></returns>
///
public class AppParam
{
public string userid { get; set; }
public string formname { get; set; }
public string isaudit { get; set; }
public string condition { get; set; }
}
/// <summary>
/// 付费申请审批
/// </summary>
/// <returns></returns>
public ContentResult PayApplicationInterface()
{
StreamReader sr = new StreamReader(Request.InputStream, Encoding.UTF8);
var strJson = new StringBuilder();
string line = null;
while (((line = sr.ReadLine())) != null)
{
strJson.Append(line);
}
var appparam = JsonConvert.Deserialize<AppParam>(strJson.ToString());
var cdc = new CommonDataContext();
string userid = appparam.userid;
string formname = appparam.formname;
string isaudit = appparam.isaudit;
string condition = appparam.condition;
var userlist = cdc.VW_user.Where(x => x.USERID == userid).ToList();
if (userlist == null || userlist.Count == 0)
{
var json0 = JsonConvert.Serialize(new { Success = false, Message = "没有找到用户" });
return new ContentResult() { Content = json0 };
}
var json = JsonConvert.Serialize(new { Success = true, Message = "未找到查询方法" });
var user = userlist[0];
if (formname == "查询列表")
{
var dataList = ChpayapplicationDAL.GetAuditDataList(condition, user.USERID, isaudit, user.SHOWNAME, user.COMPANYID, null);
var json1 = JsonConvert.Serialize(new { Success = true, Message = "查询成功", data = dataList.ToList() });
return new ContentResult() { Content = json1 };
}
if (formname == "查询明细")
{
var dataList = ChpayapplicationDAL.GetBodyAuditList(0, 9999, condition, "");
var json1 = JsonConvert.Serialize(new { Success = true, Message = "查询成功", data = dataList.ToList() });
return new ContentResult() { Content = json1 };
}
if (formname == "审批通过")
{
var audithead = ChpayapplicationDAL.GetData(condition, user.USERID, user.SHOWNAME, user.COMPANYID);
var bodyList = new List<ChPayapplication>() { audithead };
DBResult result = ChpayapplicationDAL.AuditList(bodyList, user.USERID);
return BasicDataRefDAL.GetContentResult(result);
}
if (formname == "驳回")
{
var audithead = ChpayapplicationDAL.GetData(condition, user.USERID, user.SHOWNAME, user.COMPANYID);
var bodyList = new List<ChPayapplication>() { audithead };
DBResult result = ChpayapplicationDAL.AuditBackList(bodyList, user.USERID, isaudit);
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
return new ContentResult() { Content = json };
}
/// <summary>
/// 付费发票审核
/// </summary>
/// <returns></returns>
public ContentResult PayInvInterface()
{
StreamReader sr = new StreamReader(Request.InputStream, Encoding.UTF8);
var strJson = new StringBuilder();
string line = null;
while (((line = sr.ReadLine())) != null)
{
strJson.Append(line);
}
var appparam = JsonConvert.Deserialize<AppParam>(strJson.ToString());
var cdc = new CommonDataContext();
string userid = appparam.userid;
string formname = appparam.formname;
string isaudit = appparam.isaudit;
string condition = appparam.condition;
var userlist = cdc.VW_user.Where(x => x.USERID == userid).ToList();
if (userlist == null || userlist.Count == 0)
{
var json0 = JsonConvert.Serialize(new { Success = false, Message = "没有找到用户" });
return new ContentResult() { Content = json0 };
}
var json = JsonConvert.Serialize(new { Success = true, Message = "未找到查询方法" });
var user = userlist[0];
if (formname == "查询列表")
{
var dataList = ChinvoicehexiaoDAL.GetAuditDataList(condition, user.USERID, isaudit, user.SHOWNAME, user.COMPANYID, null);
var json1 = JsonConvert.Serialize(new { Success = true, Message = "查询成功", data = dataList.ToList() });
return new ContentResult() { Content = json1 };
}
if (formname == "查询明细")
{
var dataList = ChinvoicehexiaoDAL.GetBodyList( condition, "");
var json1 = JsonConvert.Serialize(new { Success = true, Message = "查询成功", data = dataList.ToList() });
return new ContentResult() { Content = json1 };
}
if (formname == "审批通过")
{
var audithead = ChinvoicehexiaoDAL.GetData(condition);
var bodyList = new List<ChInvoicehexiao>() { audithead };
DBResult result = ChinvoicehexiaoDAL.AuditList(bodyList, user.USERID);
return BasicDataRefDAL.GetContentResult(result);
}
if (formname == "驳回")
{
var audithead = ChinvoicehexiaoDAL.GetData(condition);
var bodyList = new List<ChInvoicehexiao>() { audithead };
DBResult result = ChinvoicehexiaoDAL.AuditBackList(bodyList, user.USERID);
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
return new ContentResult() { Content = json };
}
/// <summary>
/// 往来单位审批
/// </summary>
/// <returns></returns>
public ContentResult InfoClientAuditInterface()
{
StreamReader sr = new StreamReader(Request.InputStream, Encoding.UTF8);
var strJson = new StringBuilder();
string line = null;
while (((line = sr.ReadLine())) != null)
{
strJson.Append(line);
}
var appparam = JsonConvert.Deserialize<AppParam>(strJson.ToString());
var cdc = new CommonDataContext();
string userid = appparam.userid;
string formname = appparam.formname;
string isaudit = appparam.isaudit;
string condition = appparam.condition;
var userlist = cdc.VW_user.Where(x => x.USERID == userid).ToList();
if (userlist == null || userlist.Count == 0)
{
var json0 = JsonConvert.Serialize(new { Success = false, Message = "没有找到用户" });
return new ContentResult() { Content = json0 };
}
var json = JsonConvert.Serialize(new { Success = true, Message = "未找到查询方法" });
var user = userlist[0];
if (formname == "查询列表")
{
var dataList = ChinvoicehexiaoDAL.GetAuditDataList(condition, user.USERID, isaudit, user.SHOWNAME, user.COMPANYID, null);
var json1 = JsonConvert.Serialize(new { Success = true, Message = "查询成功", data = dataList.ToList() });
return new ContentResult() { Content = json1 };
}
if (formname == "查询明细")
{
var dataList = ChinvoicehexiaoDAL.GetBodyList(condition, "");
var json1 = JsonConvert.Serialize(new { Success = true, Message = "查询成功", data = dataList.ToList() });
return new ContentResult() { Content = json1 };
}
if (formname == "审批通过")
{
var audithead = ChinvoicehexiaoDAL.GetData(condition);
var bodyList = new List<ChInvoicehexiao>() { audithead };
DBResult result = ChinvoicehexiaoDAL.AuditList(bodyList, user.USERID);
return BasicDataRefDAL.GetContentResult(result);
}
if (formname == "驳回")
{
var audithead = ChinvoicehexiaoDAL.GetData(condition);
var bodyList = new List<ChInvoicehexiao>() { audithead };
DBResult result = ChinvoicehexiaoDAL.AuditBackList(bodyList, user.USERID);
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
return new ContentResult() { Content = json };
}
/// <summary>
/// 发票申请审批
/// </summary>
/// <returns></returns>
public ContentResult InvApplicationAuditInterface()
{
StreamReader sr = new StreamReader(Request.InputStream, Encoding.UTF8);
var strJson = new StringBuilder();
string line = null;
while (((line = sr.ReadLine())) != null)
{
strJson.Append(line);
}
var appparam = JsonConvert.Deserialize<AppParam>(strJson.ToString());
var cdc = new CommonDataContext();
string userid = appparam.userid;
string formname = appparam.formname;
string isaudit = appparam.isaudit;
string condition = appparam.condition;
var userlist = cdc.VW_user.Where(x => x.USERID == userid).ToList();
if (userlist == null || userlist.Count == 0)
{
var json0 = JsonConvert.Serialize(new { Success = false, Message = "没有找到用户" });
return new ContentResult() { Content = json0 };
}
var json = JsonConvert.Serialize(new { Success = true, Message = "未找到查询方法" });
var user = userlist[0];
if (formname == "查询列表")
{
var dataList = ChpayapplicationDAL.GetAuditDataList(condition, user.USERID, isaudit, user.SHOWNAME, user.COMPANYID, null);
var json1 = JsonConvert.Serialize(new { Success = true, Message = "查询成功", data = dataList.ToList() });
return new ContentResult() { Content = json1 };
}
if (formname == "查询明细")
{
var dataList = ChpayapplicationDAL.GetBodyAuditList(0, 9999, condition, "");
var json1 = JsonConvert.Serialize(new { Success = true, Message = "查询成功", data = dataList.ToList() });
return new ContentResult() { Content = json1 };
}
if (formname == "审批通过")
{
var audithead = ChpayapplicationDAL.GetData(condition, user.USERID, user.SHOWNAME, user.COMPANYID);
var bodyList = new List<ChPayapplication>() { audithead };
DBResult result = ChpayapplicationDAL.AuditList(bodyList, user.USERID);
return BasicDataRefDAL.GetContentResult(result);
}
if (formname == "驳回")
{
var audithead = ChpayapplicationDAL.GetData(condition, user.USERID, user.SHOWNAME, user.COMPANYID);
var bodyList = new List<ChPayapplication>() { audithead };
DBResult result = ChpayapplicationDAL.AuditBackList(bodyList, user.USERID, isaudit);
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
return new ContentResult() { Content = json };
}
}
}