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/Mobile/Controllers/ApprovalController.cs

210 lines
7.6 KiB
C#

using System;
using System.Linq;
using System.Web.Mvc;
using System.Collections.Generic;
using HcUtility.Comm;
using HcUtility.Core;
using System.Web.Script.Serialization;
using DSWeb.EntityDA;
using System.Data;
using System.Text;
using DSWeb.Areas.CommMng.Models;
using Microsoft.Practices.EnterpriseLibrary.Data;
using DSWeb.TruckMng.Comm.Cookie;
using DSWeb.TruckMng.Helper;
using DSWeb.TruckMng.Helper.Repository;
using DSWeb.Areas.Account.Models.MsOpBill;
using DSWeb.MvcShipping.DAL.Chfee_AuditDAL;
using DSWeb.Areas.Mobile.DAL;
using DSWeb.Areas.Account.DAL.Chfee_Payapplication;
using DSWeb.Areas.Account.Models.Chfee_Payapplication;
using DSWeb.MvcShipping.DAL.MsSysParamSet;
using DSWeb.SoftMng.Filter;
namespace DSWeb.Areas.Mobile.Controllers
{
public class ApprovalController : Controller
{
public ActionResult Index ( )
{
return View();
}
//
// GET:
public ActionResult YSYF ( )
{
return View();
}
public ActionResult YSYFDetails ( )
{
return View();
}
public ActionResult Details ( )
{
return View();
}
public ActionResult FFSP ( )
{
return View();
}
public ActionResult FFSPDetails ( )
{
return View();
}
/// <summary>
/// 付费审批-通过
/// </summary>
/// <param name="billno"></param>
/// <param name="uid"></param>
/// <returns></returns>
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
public ContentResult DoFFSPWithBillNoAndUid ( string billno,string uid)
{
List<ChPayapplication> list = new List<ChPayapplication>();
if (billno.IndexOf(',')>0)
{
string [] bills = billno.Split(',');
foreach (var bno in bills)
{
ChPayapplication ch = new ChPayapplication();
ch.BILLNO = bno;
//获取该票审核的状态billstates
string sql = "SELECT billstatus FROM ch_fee_payapplication where billno = '" + bno + "'";
Database db = DatabaseFactory.CreateDatabase();
var rst = db.ExecuteScalar(CommandType.Text, sql);
int status = 0;
if (rst != null && rst != DBNull.Value)
{
status = Convert.ToInt32(rst);
}
ch.BILLSTATUS = status;
list.Add(ch);
}
}
else
{
ChPayapplication ch = new ChPayapplication();
ch.BILLNO = billno;
//获取该票审核的状态billstates
string sql = "SELECT billstatus FROM ch_fee_payapplication where billno = '" + billno + "'";
Database db = DatabaseFactory.CreateDatabase();
var rst = db.ExecuteScalar(CommandType.Text, sql);
int status = 0;
if (rst != null && rst != DBNull.Value)
{
status = Convert.ToInt32(rst);
}
ch.BILLSTATUS = status;
list.Add(ch);
}
DBResult result = ChpayapplicationDAL.AuditList(list, uid);
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
/// <summary>
/// 付费审批-驳回
/// </summary>
/// <param name="billno"></param>
/// <param name="uid"></param>
/// <returns></returns>
public ContentResult RejectFFSPWithBillNoAndUid ( string billno, string uid )
{
List<ChPayapplication> list = new List<ChPayapplication>();
if (billno.IndexOf(',') > 0) {
string[] bills = billno.Split(',');
foreach (var bno in bills)
{
ChPayapplication ch = new ChPayapplication();
ch.BILLNO = bno;
//获取该票审核的状态billstates
string sql = "SELECT billstatus FROM ch_fee_payapplication where billno = '" + bno + "'";
Database db = DatabaseFactory.CreateDatabase();
var rst = db.ExecuteScalar(CommandType.Text, sql);
int status = 0;
if (rst != null && rst != DBNull.Value)
{
status = Convert.ToInt32(rst);
}
ch.BILLSTATUS = status;
list.Add(ch);
}
}
else
{
ChPayapplication ch = new ChPayapplication();
ch.BILLNO = billno;
//获取该票审核的状态billstates
string sql = "SELECT billstatus FROM ch_fee_payapplication where billno = '" + billno + "'";
Database db = DatabaseFactory.CreateDatabase();
var rst = db.ExecuteScalar(CommandType.Text, sql);
int status = 0;
if (rst != null && rst != DBNull.Value)
{
status = Convert.ToInt32(rst);
}
ch.BILLSTATUS = status;
list.Add(ch);
}
DBLog.Log("RejectFFSPWithBillNoAndUid", "list.count", list.Count.ToString());
DBLog.Log("RejectFFSPWithBillNoAndUid", "uid", uid);
DBResult result = ChpayapplicationDAL.AuditBackList(list, uid,"");
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
/// <summary>
/// 应收应付审批-通过
/// </summary>
/// <param name="billno"></param>
/// <param name="uid"></param>
/// <returns></returns>
public ContentResult DoYSYFWithBillNoAndUid ( string bsnos, string userid,string showname,string comid)
{
string[] data = bsnos.Split(',');
foreach (var item in data)
{
string[] data2 = item.Split('$');
string bsno = data2[0];
string optype = data2[1];
string oplb = data2[2];
var AuditAutoLock = MsSysParamSetDAL.GetData("PARAMNAME='AuditAutoLock'");
var workflowstr = "";
var AMENDSELFWORK = MsSysParamSetDAL.GetData("PARAMNAME='AMENDSELFWORKFLOW'");
if (AMENDSELFWORK.PARAMVALUE == "1") workflowstr = "AmendFeefyAudit";
if (optype == "1" && AMENDSELFWORK.PARAMVALUE == "1")
{
workflowstr = "AmendFeefyAudit";
} else
{
workflowstr = "";
}
DBResult result = null;
result = Chfee_AuditDAL.PiliangAudit(oplb, bsno,userid, showname, comid, workflowstr);
if (result.Success == true)
{
if (AuditAutoLock.PARAMVALUE == "1")
{
Chfee_AuditDAL.UpLock(bsno,oplb);
}
}
}
var jsonRespose = new JsonResponse { Success = true, Message = ""};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
}
}