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.Models.Chfee_do_detail ;
using DSWeb.Areas.Account.Models.BillChfeeDetail ;
using DSWeb.MvcShipping.Helper ;
using DSWeb.MvcShipping.Comm.Cookie ;
using DSWeb.Areas.CommMng.DAL ;
using System.Collections.Generic ;
using HcUtility.Comm ;
using HcUtility.Core ;
using DSWeb.EntityDA ;
using DSWeb.Areas.Account.Models.Chfee_Exrate ;
using DSWeb.MvcShipping.DAL.MsSysBillNoSet ;
using DSWeb.MvcShipping.Models.MsSysBillNoSet ;
using DSWeb.Areas.Account.Models.Chfee_Invoicehexiao ;
using DSWeb.Areas.MvcShipping.DAL ;
using DSWeb.Areas.Account.DAL.Chfee_payapplication ;
using DSWeb.Areas.Account.Models.Chfee_payapplication ;
using System.IO ;
using System.Globalization ;
using System.Web.Script.Serialization ;
using DSWeb.MvcShipping.DAL.MsSysParamSet ;
using DSWeb.Areas.Account.Models.ChfeeDetail ;
using DSWeb.Areas.Account.Models.BSNOLB ;
using System.Text ;
using DSWeb.Areas.CommMng.Models ;
using System.Data ;
using DSWeb.Areas.RptMng.Comm ;
namespace DSWeb.Areas.Account.Controllers
{
[JsonRequestBehavior]
public class Chfee_payapplicationController : Controller
{
/ /
// GET:
public ActionResult Index ( )
{
return View ( ) ;
}
public ActionResult TruckIndex ( )
{
return View ( ) ;
}
public ActionResult WorkIndex ( )
{
return View ( ) ;
}
public ActionResult TruckModifyIndex ( )
{
return View ( ) ;
}
/ /
// GET: /
public ActionResult Edit ( )
{
return View ( ) ;
}
public ActionResult BLEdit ( )
{
return View ( ) ;
}
public ActionResult WorkEdit ( )
{
return View ( ) ;
}
public ActionResult TruckBLEdit ( )
{
return View ( ) ;
}
//付费申请审核
public ActionResult Audit ( )
{
return View ( ) ;
}
public ActionResult BalEdit ( )
{
return View ( ) ;
}
/// <summary>
/// 流程图
/// </summary>
/// <returns></returns>
public ActionResult Map ( )
{
return View ( ) ;
}
public ActionResult FileView ( )
{
return View ( ) ;
}
/ /
// GET:
//private static string CHPAYMSG = MsSysParamSetDAL.GetData("PARAMNAME='CHPAYMSG'").PARAMVALUE;
public ContentResult GetDataList ( int start , int limit , string sort , string condition )
{
if ( Convert . ToString ( Session [ "COMPANYID" ] ) . ToString ( ) . Trim ( ) = = "" | | Convert . ToString ( Session [ "USERID" ] ) . ToString ( ) . Trim ( ) = = "" | | Convert . ToString ( Session [ "CODENAME" ] ) . ToString ( ) . Trim ( ) = = "" | | Convert . ToString ( Session [ "SHOWNAME" ] ) . ToString ( ) . Trim ( ) = = "" | | Convert . ToString ( Session [ "DEPTNAME" ] ) . ToString ( ) . Trim ( ) = = "" )
{
var jsonRespose2 = new JsonResponse { Success = false , Message = "登录超时,请退出系统重新登录!" } ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose2 ) } ;
}
var dataList = ChpayapplicationDAL . GetDataList ( start , limit , condition , Convert . ToString ( Session [ "USERID" ] ) , CookieConfig . GetCookie_UserCode ( Request ) , Convert . ToString ( Session [ "COMPANYID" ] ) , sort ) ;
int count = ChpayapplicationDAL . getTotalCount ( condition , Convert . ToString ( Session [ "USERID" ] ) , CookieConfig . GetCookie_UserCode ( Request ) , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
var json = JsonConvert . Serialize ( new { Success = true , Message = "查询成功" , totalCount = count , data = dataList . ToList ( ) } ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult GetAuditDataList ( int start , int limit , string sort , string condition , string isaudit )
{
if ( Convert . ToString ( Session [ "COMPANYID" ] ) . ToString ( ) . Trim ( ) = = "" | | Convert . ToString ( Session [ "USERID" ] ) . ToString ( ) . Trim ( ) = = "" | | Convert . ToString ( Session [ "CODENAME" ] ) . ToString ( ) . Trim ( ) = = "" | | Convert . ToString ( Session [ "SHOWNAME" ] ) . ToString ( ) . Trim ( ) = = "" | | Convert . ToString ( Session [ "DEPTNAME" ] ) . ToString ( ) . Trim ( ) = = "" )
{
var jsonRespose2 = new JsonResponse { Success = false , Message = "登录超时,请退出系统重新登录!" } ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose2 ) } ;
}
var dataList = ChpayapplicationDAL . GetAuditDataList ( condition , Convert . ToString ( Session [ "USERID" ] ) , isaudit , CookieConfig . GetCookie_UserCode ( Request ) , Convert . ToString ( Session [ "COMPANYID" ] ) , sort ) ;
var list = dataList . Skip ( start ) . Take ( limit ) ;
var json = JsonConvert . Serialize ( new { Success = true , Message = "查询成功" , totalCount = dataList . Count , data = list . ToList ( ) } ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult GetData ( string handle , string condition )
{
ChPayapplication head = null ;
if ( handle = = "edit" )
{
var list = ChpayapplicationDAL . GetDataList ( 0 , 1 , condition , Convert . ToString ( Session [ "USERID" ] ) , CookieConfig . GetCookie_UserCode ( Request ) , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
if ( list . Count > 0 )
head = list [ 0 ] ;
}
if ( head = = null )
{
head = new ChPayapplication ( ) ;
}
if ( handle = = "add" )
{
head . APPLICANT = Convert . ToString ( Session [ "USERID" ] ) ;
head . APPLICANTNAME = Convert . ToString ( Session [ "SHOWNAME" ] ) ;
// head.CURR = Convert.ToString(Session["LOCALCURR"]);
head . SETTLETYPE = 7 ;
}
var json = JsonConvert . Serialize (
new { Success = true , Message = "查询成功" , data = head } ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult GetBillList ( int start , int limit , string condition , string sort )
{
var dataList = ChpayapplicationDAL . GetBodyList ( start , limit , condition , sort ) ;
int count = ChpayapplicationDAL . getbodyTotalCount ( condition , Convert . ToString ( Session [ "USERID" ] ) , CookieConfig . GetCookie_UserCode ( Request ) , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
var json = JsonConvert . Serialize ( new { Success = true , Message = "查询成功" , totalCount = count , data = dataList . ToList ( ) } ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult GetBillListPrint ( string condition , string sort )
{
var dataListStr = ChpayapplicationDAL . GetBodyAllListStr ( condition , sort ) ;
var json = JsonConvert . Serialize ( new { Success = true , Message = "查询成功" , Data = dataListStr } ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult GetTruckBillList ( int start , int limit , string condition , string sort )
{
var dataList = ChpayapplicationDAL . GetTruckBodyList ( start , limit , condition , sort ) ;
int count = ChpayapplicationDAL . getTruckbodyTotalCount ( condition , Convert . ToString ( Session [ "USERID" ] ) , CookieConfig . GetCookie_UserCode ( Request ) , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
var json = JsonConvert . Serialize ( new { Success = true , Message = "查询成功" , totalCount = count , data = dataList . ToList ( ) } ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult GetBillAuditList ( int start , int limit , string condition , string sort )
{
var dataList = ChpayapplicationDAL . GetBodyAuditList ( start , limit , condition , sort ) ;
int count = ChpayapplicationDAL . getbodyTotalCount ( condition , Convert . ToString ( Session [ "USERID" ] ) , CookieConfig . GetCookie_UserCode ( Request ) , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
var json = JsonConvert . Serialize ( new { Success = true , Message = "查询成功" , totalCount = count , data = dataList . ToList ( ) } ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult GetBillSum ( string condition )
{
var dataList = ChpayapplicationDAL . GetBodySumList ( condition ) ;
var json = JsonConvert . Serialize ( new { Success = true , Message = "查询成功" , totalCount = dataList . Count , data = dataList . ToList ( ) } ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult GetFeeDataList ( int start , int limit , string sort , string condition , string duino = "" )
{
var dataList = ChpayapplicationDAL . GetFeeDataList ( condition , duino , Convert . ToString ( Session [ "USERID" ] ) , Convert . ToString ( Session [ "SHOWNAME" ] ) , Convert . ToString ( Session [ "COMPANYID" ] ) , sort ) ;
var list = dataList . Skip ( start ) . Take ( limit ) ;
var json = JsonConvert . Serialize (
new { Success = true , Message = "查询成功" , totalCount = dataList . Count , data = list . ToList ( ) } ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult GetBillDataList ( int start , int limit , string sort , string condition , string duino = "" )
{
var dataList = ChpayapplicationDAL . GetAddBillList ( start , limit , condition , duino , Convert . ToString ( Session [ "USERID" ] ) , Convert . ToString ( Session [ "SHOWNAME" ] ) , Convert . ToString ( Session [ "COMPANYID" ] ) , sort ) ;
int count = ChpayapplicationDAL . getAddBillTotalCount ( condition , duino , Convert . ToString ( Session [ "USERID" ] ) , Convert . ToString ( Session [ "SHOWNAME" ] ) , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
var json = JsonConvert . Serialize (
new { Success = true , Message = "查询成功" , totalCount = count , data = dataList . ToList ( ) } ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult GetTruckBillDataList ( int start , int limit , string sort , string condition )
{
var dataList = ChpayapplicationDAL . GetAddTruckBillList ( start , limit , condition , Convert . ToString ( Session [ "USERID" ] ) , Convert . ToString ( Session [ "SHOWNAME" ] ) , Convert . ToString ( Session [ "COMPANYID" ] ) , sort ) ;
int count = ChpayapplicationDAL . getAddTruckBillTotalCount ( condition , Convert . ToString ( Session [ "USERID" ] ) , Convert . ToString ( Session [ "SHOWNAME" ] ) , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
var json = JsonConvert . Serialize (
new { Success = true , Message = "查询成功" , totalCount = count , data = dataList . ToList ( ) } ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult GetFeeDetailList ( string sort , string condition , string duino = "" )
{
var dataList = ChpayapplicationDAL . GetFeeDetailList ( condition , duino , Convert . ToString ( Session [ "USERID" ] ) , Convert . ToString ( Session [ "SHOWNAME" ] ) , Convert . ToString ( Session [ "COMPANYID" ] ) , sort ) ;
var json = JsonConvert . Serialize (
new { Success = true , Message = "查询成功" , totalCount = dataList . Count , data = dataList . ToList ( ) } ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult GetAddSum ( string condition )
{
var dataList = ChpayapplicationDAL . GetAddSum ( condition , Convert . ToString ( Session [ "USERID" ] ) , Convert . ToString ( Session [ "SHOWNAME" ] ) , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
var json = JsonConvert . Serialize ( new { Success = true , Message = "查询成功" , totalCount = dataList . Count , data = dataList . ToList ( ) } ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult Save ( string opstatus , string data )
{
if ( Convert . ToString ( Session [ "COMPANYID" ] ) . ToString ( ) . Trim ( ) = = "" | | Convert . ToString ( Session [ "USERID" ] ) . ToString ( ) . Trim ( ) = = "" | | Convert . ToString ( Session [ "CODENAME" ] ) . ToString ( ) . Trim ( ) = = "" | | Convert . ToString ( Session [ "SHOWNAME" ] ) . ToString ( ) . Trim ( ) = = "" | | Convert . ToString ( Session [ "DEPTNAME" ] ) . ToString ( ) . Trim ( ) = = "" )
{
var jsonRespose2 = new JsonResponse { Success = false , Message = "登录超时,请退出系统重新登录!" } ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose2 ) } ;
}
var headData = JsonConvert . Deserialize < ChPayapplication > ( data ) ;
if ( opstatus = = "add" )
{
headData . GID = Guid . NewGuid ( ) . ToString ( ) ;
headData . COMPANYID = CookieConfig . GetCookie_CompanyId ( Request ) ;
headData . APPLICANT = CookieConfig . GetCookie_UserId ( Request ) ;
headData . APPLYTIME = DateTime . Now ;
headData . ENTERTIME = DateTime . Now ;
headData . DbOperationType = DbOperationType . DbotIns ;
var billnoset = MsSysBillNoSetDAL . GetData ( "OPLBNAME='付费申请'" , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
if ( billnoset . BILLTYPE ! = "" )
headData . BILLNO = MsSysBillNoSetDAL . GetBillNo ( billnoset , headData . PAYABLETIME . ToString ( ) . Trim ( ) , headData . APPLYTIME . ToString ( ) ) ;
else
headData . BILLNO = PubSysDAL . GetBillNo ( "0303" ) ;
}
else if ( opstatus = = "edit" )
{
headData . DbOperationType = DbOperationType . DbotUpd ;
headData . ModelUIStatus = "E" ;
}
else
{
headData . DbOperationType = DbOperationType . DbotDel ;
}
var ct = ChpayapplicationDAL . GetPayRdCount ( "GID<>'" + headData . GID + "' AND BILLNO='" + headData . BILLNO + "' " ) ;
if ( ct ! = 0 )
{
var jsonRespose0 = new JsonResponse
{
Success = false ,
Message = "付费申请编号重复,不允许保存!"
} ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose0 ) } ;
}
var BILLNO = headData . BILLNO ;
if ( headData . INVDATE = = "" ) headData . INVDATE = null ;
var modb = new ModelObjectDB ( ) ;
DBResult result = modb . Save ( headData ) ;
if ( result . Success = = true ) {
ChpayapplicationDAL . p_update_Amount ( headData . BILLNO ) ;
}
else
{
MsSysBillNoSetDAL . DeleteBsNo ( headData . BILLNO ) ;
}
var jsonRespose = new JsonResponse
{
Success = result . Success ,
Message = result . Message ,
Data = ChpayapplicationDAL . GetData ( " BILLNO='" + BILLNO + "'" , Convert . ToString ( Session [ "USERID" ] ) , CookieConfig . GetCookie_UserCode ( Request ) , Convert . ToString ( Session [ "COMPANYID" ] ) )
} ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
public ContentResult AddDetail ( string bill , string data , string curr , string storeCurrExrate , string salecorp , string duino = "" )
{
if ( Convert . ToString ( Session [ "COMPANYID" ] ) . ToString ( ) . Trim ( ) = = "" | | Convert . ToString ( Session [ "USERID" ] ) . ToString ( ) . Trim ( ) = = "" | | Convert . ToString ( Session [ "CODENAME" ] ) . ToString ( ) . Trim ( ) = = "" | | Convert . ToString ( Session [ "SHOWNAME" ] ) . ToString ( ) . Trim ( ) = = "" | | Convert . ToString ( Session [ "DEPTNAME" ] ) . ToString ( ) . Trim ( ) = = "" )
{
var jsonRespose2 = new JsonResponse { Success = false , Message = "登录超时,请退出系统重新登录!" } ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose2 ) } ;
}
var bodyList = JsonConvert . Deserialize < List < ChFeeDetail > > ( data ) ;
T_ALL_DA T_ALL_DA = new EntityDA . T_ALL_DA ( ) ;
var exrateList = JsonConvert . Deserialize < List < ChFeeExrate > > ( storeCurrExrate ) ;
var CHPAYMSG = MsSysParamSetDAL . GetData ( "PARAMNAME='CHPAYMSG'" ) . PARAMVALUE ;
var modb = new ModelObjectDB ( ) ;
DBResult result = ChpayapplicationDAL . AddDetail ( bill , duino , bodyList , curr , Convert . ToString ( Session [ "COMPANYID" ] ) , salecorp ) ;
if ( result . Success ) {
ChpayapplicationDAL . p_update_Amount ( bill ) ;
if ( CHPAYMSG = = "1" )
{
var BLCOUNT = T_ALL_DA . GetStrSQL ( "BLCOUNT" , "select COUNT(*) BLCOUNT from ch_fee where FEETYPE=1 and (AMOUNT<>SETTLEMENT) and BSNO='" + bodyList [ 0 ] . BSNO + "'" ) ;
if ( BLCOUNT ! = "0" ) result . Message = "添加成功 注意:此票存在未结算的应收费用!" ;
else result . Message = "添加成功" ;
}
else {
result . Message = "添加成功" ;
}
}
var jsonRespose = new JsonResponse { Success = result . Success , Message = result . Message } ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
public ContentResult AddBill ( string billno , string billcust , string billcurr , string feesql , string storeCurrExrate , bool custgroup = false , string salecorp = "" , string duino = "" )
{
if ( Convert . ToString ( Session [ "COMPANYID" ] ) . ToString ( ) . Trim ( ) = = "" | | Convert . ToString ( Session [ "USERID" ] ) . ToString ( ) . Trim ( ) = = "" | | Convert . ToString ( Session [ "CODENAME" ] ) . ToString ( ) . Trim ( ) = = "" | | Convert . ToString ( Session [ "SHOWNAME" ] ) . ToString ( ) . Trim ( ) = = "" | | Convert . ToString ( Session [ "DEPTNAME" ] ) . ToString ( ) . Trim ( ) = = "" )
{
var jsonRespose2 = new JsonResponse { Success = false , Message = "登录超时,请退出系统重新登录!" } ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose2 ) } ;
}
var exrateList = JsonConvert . Deserialize < List < ChFeeExrate > > ( storeCurrExrate ) ;
var CHPAYMSG = MsSysParamSetDAL . GetData ( "PARAMNAME='CHPAYMSG'" ) . PARAMVALUE ;
if ( ( exrateList = = null ) | | ( exrateList . Count = = 0 ) )
{
if ( billcurr ! = "" )
exrateList = ChpayapplicationDAL . GetCurrExrateData ( billcust , billcurr , feesql , custgroup ) ;
if ( ( exrateList = = null ) | | ( exrateList . Count = = 0 ) )
{
var STLONESALECORP = MsSysParamSetDAL . GetData ( "PARAMNAME='STLONESALECORP'" ) ;
if ( STLONESALECORP . PARAMVALUE = = "1" & & salecorp ! = "" )
{
feesql = feesql + " AND SALECORP='" + salecorp + "'" ;
}
var modb = new ModelObjectDB ( ) ;
DBResult result = ChpayapplicationDAL . AddBill ( billno , duino , billcust , billcurr , feesql , exrateList , Convert . ToString ( Session [ "COMPANYID" ] ) , Convert . ToString ( Session [ "USERID" ] ) , custgroup ) ;
if ( result . Success ) { ChpayapplicationDAL . p_update_Amount ( billno ) ;
if ( CHPAYMSG = = "1" )
{
if ( ! custgroup )
feesql = feesql + " AND CUSTOMERNAME='" + billcust + "'" ;
var billnoinvlist = MsOpBillDAL . GetDataList ( " BSNO IN (select DISTINCT BSNO from ch_fee (NOLOCK) where FEETYPE=1 and (AMOUNT<>SETTLEMENT) AND BSNO IN (SELECT DISTINCT BSNO FROM CH_FEE f WHERE f.ISINVOICE<>1 and f.FEESTATUS IN (0,8,9) and (f.AMOUNT<>(ISNULL(f.INVOICE,0)+ISNULL(f.ORDERINVOICE,0)-ISNULL(f.ORDERINVSETTLEMENT,0))) AND " + feesql + " ))" , "" , "" , "" ) ;
var MBLNOSTR = "" ;
if ( billnoinvlist ! = null )
{
foreach ( var billnoinv in billnoinvlist )
{
MBLNOSTR = MBLNOSTR + billnoinv . MBLNO + "," ;
}
}
if ( MBLNOSTR ! = "" ) MBLNOSTR = ",注意:主提单号 " + MBLNOSTR + " 业务应收费用中存在未结算的费用!" ;
result . Message = "添加成功" + MBLNOSTR ;
}
else result . Message = "添加成功" ;
}
var jsonRespose = new JsonResponse { Success = result . Success , Message = result . Message } ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
else
{
var jsonRespose = new JsonResponse { Success = true , Message = "查询成功" , Data = exrateList . ToList ( ) } ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
}
else
{
var modb = new ModelObjectDB ( ) ;
DBResult result = ChpayapplicationDAL . AddBill ( billno , duino , billcust , billcurr , feesql , exrateList , Convert . ToString ( Session [ "COMPANYID" ] ) , Convert . ToString ( Session [ "USERID" ] ) ) ;
if ( result . Success ) { ChpayapplicationDAL . p_update_Amount ( billno ) ;
if ( ! custgroup )
feesql = feesql + " AND CUSTOMERNAME='" + billcust + "'" ;
var billnoinvlist = MsOpBillDAL . GetDataList ( " BSNO IN (select DISTINCT BSNO from ch_fee (NOLOCK) where FEETYPE=1 and (AMOUNT<>SETTLEMENT) AND BSNO IN (SELECT DISTINCT BSNO FROM CH_FEE f WHERE f.ISINVOICE<>1 and f.FEESTATUS IN (0,8,9) and (f.AMOUNT<>(ISNULL(f.INVOICE,0)+ISNULL(f.ORDERINVOICE,0)-ISNULL(f.ORDERINVSETTLEMENT,0))) AND " + feesql + " ))" , "" , "" , "" ) ;
var MBLNOSTR = "" ;
if ( billnoinvlist ! = null )
{
foreach ( var billnoinv in billnoinvlist )
{
MBLNOSTR = MBLNOSTR + billnoinv . MBLNO + "," ;
}
}
if ( MBLNOSTR ! = "" ) MBLNOSTR = ",注意:主提单号 " + MBLNOSTR + " 业务应收费用中存在未审核的费用!" ;
result . Message = "添加成功" + MBLNOSTR ;
}
var jsonRespose = new JsonResponse { Success = result . Success , Message = result . Message } ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
}
public ContentResult DelBill ( string data , string billno )
{
var bodyList = JsonConvert . Deserialize < List < Chfee_do_detail > > ( data ) ;
DBResult result = ChpayapplicationDAL . DelFeeDo ( bodyList ) ;
if ( result . Success ) { ChpayapplicationDAL . p_update_Amount ( billno ) ; }
var jsonRespose = new JsonResponse { Success = result . Success , Message = result . Message } ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
/ /
public ContentResult Delete ( string data )
{
var headData = JsonConvert . Deserialize < ChPayapplication > ( data ) ;
var dataList = ChpayapplicationDAL . GetBodyAllList ( "BILLNO='" + headData . BILLNO + "'" ) ;
DBResult result = ChpayapplicationDAL . DelFeeDo ( dataList ) ;
if ( result . Success = = true )
{
var modb = new ModelObjectDB ( ) ;
modb . Delete ( headData ) ;
MsSysBillNoSetDAL . DeleteBsNo ( headData . BILLNO ) ;
T_ALL_DA T_ALL_DA = new EntityDA . T_ALL_DA ( ) ;
var blUpSQL = " insert into sys_log(GID,NAME,LOGTYPE,LOGTIME,LOGCONTENT,CREATEUSER) values(NEWID(),'" + headData . BILLNO + "','删除付费申请','" + DateTime . Now . ToString ( "yyyy-MM-dd HH:mm:ss" ) + "','" + headData . BILLNO + '(' + headData . CUSTOMERNAME + ')' + "','" + Convert . ToString ( Session [ "USERID" ] ) + "')" ;
bool bl = T_ALL_DA . GetExecuteSqlCommand ( blUpSQL ) ;
}
var jsonRespose = new JsonResponse { Success = result . Success , Message = result . Message } ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
public ContentResult modify ( string data , string custname , string taxrate )
{
var headData = JsonConvert . Deserialize < ChPayapplication > ( data ) ;
DBResult result = ChpayapplicationDAL . DoModify ( headData , custname , taxrate ) ;
if ( result . Success = = true )
{
ChpayapplicationDAL . p_update_Amount ( headData . BILLNO ) ;
}
var jsonRespose = new JsonResponse { Success = result . Success , Message = result . Message } ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
#region 提交和撤销审核
public ContentResult SubmitAudit ( string bill )
{
var headdata = ChpayapplicationDAL . GetData ( " BILLNO='" + bill + "'" , Convert . ToString ( Session [ "USERID" ] ) , CookieConfig . GetCookie_UserCode ( Request ) , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
if ( headdata . BILLSTATUS = = 1 | | headdata . BILLSTATUS = = 6 )
{
DBResult result = ChpayapplicationDAL . SubmitAudit ( "FeeSettleAudit" , Convert . ToString ( Session [ "USERID" ] ) , bill , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
if ( result . Success = = true ) {
ChpayapplicationDAL . p_update_Amount ( bill ) ;
if ( result . Message2 = = "1" )
{
var PAYAUDITAUTOCLOSEDR = MsSysParamSetDAL . GetData ( "PARAMNAME='PAYAUDITAUTOCLOSEDR'" ) ;
if ( PAYAUDITAUTOCLOSEDR . PARAMVALUE = = "1" )
{
var bsnolist = new List < BSNOLB > ( ) ;
var dataList = ChpayapplicationDAL . GetBodyAllList ( "BILLNO='" + bill + "'" ) ;
if ( dataList ! = null )
{
foreach ( var enumValue in dataList )
{
if ( bsnolist . FindAll ( x = > x . BSNO = = enumValue . BSNO ) . Count = = 0 )
{
if ( enumValue . BSTYPE = = "海运出口" )
{
var bsnoitem = new BSNOLB ( ) ;
bsnoitem . BSNO = enumValue . BSNO ;
bsnolist . Add ( bsnoitem ) ;
}
}
}
}
ChpayapplicationDAL . SelBsLock ( bsnolist , "应收" ) ;
}
}
}
var FEECLOSEPAYAUTOAUDIT = MsSysParamSetDAL . GetData ( "PARAMNAME='FEECLOSEPAYAUTOAUDIT'" ) ;
if ( FEECLOSEPAYAUTOAUDIT . PARAMVALUE = = "1" ) {
var dataList = ChpayapplicationDAL . GetBodyAllList ( "BILLNO='" + bill + "'" ) ;
if ( dataList ! = null )
{
var isclose = true ;
foreach ( var enumValue in dataList )
{
if ( enumValue . FEESTATUSREF ! = "锁定" ) isclose = false ;
}
if ( isclose )
{
T_ALL_DA T_ALL_DA = new EntityDA . T_ALL_DA ( ) ;
var blUpSQL = " update ch_fee_payapplication set BILLSTATUS=0,AUDITUSER='" + Convert . ToString ( Session [ "USERID" ] ) + "',AUDITTIME='" + DateTime . Now . ToString ( "yyyy-MM-dd HH:mm:ss" ) + "' where BILLNO='" + bill + "'" ;
bool bl = T_ALL_DA . GetExecuteSqlCommand ( blUpSQL ) ;
}
}
}
var json = JsonConvert . Serialize ( result ) ;
return new ContentResult ( ) { Content = json } ;
} else {
var jsonRespose = new JsonResponse { Success = false , Message = "当前状态不允许提交!" } ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
}
public ContentResult SubmitAuditBack ( string bill )
{
var headdata = ChpayapplicationDAL . GetData ( " BILLNO='" + bill + "'" , Convert . ToString ( Session [ "USERID" ] ) , CookieConfig . GetCookie_UserCode ( Request ) , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
if ( headdata . BILLSTATUS = = 2 )
{
DBResult result = ChpayapplicationDAL . SubmitAuditBack ( "FeeSettleAudit" , Convert . ToString ( Session [ "USERID" ] ) , bill ) ;
var json = JsonConvert . Serialize ( result ) ;
return new ContentResult ( ) { Content = json } ;
}
else {
var jsonRespose = new JsonResponse { Success = false , Message = "当前状态不允许,撤销提交!" } ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
}
public ContentResult SubmitAuditList ( string bills )
{
DBResult result = ChpayapplicationDAL . SubmitAuditList ( "FeeSettleAudit" , Convert . ToString ( Session [ "USERID" ] ) , bills , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
if ( result . Message2 = = "1" ) {
var PAYAUDITAUTOCLOSEDR = MsSysParamSetDAL . GetData ( "PARAMNAME='PAYAUDITAUTOCLOSEDR'" ) ;
if ( PAYAUDITAUTOCLOSEDR . PARAMVALUE = = "1" )
{
var bsnolist = new List < BSNOLB > ( ) ;
var billList = bills . Split ( ',' ) ;
foreach ( var bill in billList )
{
var dataList = ChpayapplicationDAL . GetBodyAllList ( "BILLNO='" + bill + "'" ) ;
if ( dataList ! = null )
{
foreach ( var enumValue in dataList )
{
if ( bsnolist . FindAll ( x = > x . BSNO = = enumValue . BSNO ) . Count = = 0 )
{
var bsnoitem = new BSNOLB ( ) ;
bsnoitem . BSNO = enumValue . BSNO ;
bsnolist . Add ( bsnoitem ) ;
}
}
}
}
ChpayapplicationDAL . SelBsLock ( bsnolist , "应收" ) ;
}
}
var json = JsonConvert . Serialize ( result ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult SubmitAuditBackList ( string bills )
{
DBResult result = ChpayapplicationDAL . SubmitAuditBackList ( "FeeSettleAudit" , Convert . ToString ( Session [ "USERID" ] ) , bills , CookieConfig . GetCookie_UserCode ( Request ) , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
var json = JsonConvert . Serialize ( result ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult UpdateApp ( string bills , string type )
{
DBResult result = ChpayapplicationDAL . UpdateApp ( bills , type ) ;
var json = JsonConvert . Serialize ( result ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult UpdateISREVINV ( string bills , string type )
{
DBResult result = ChpayapplicationDAL . UpdateISREVINV ( bills , type ) ;
var json = JsonConvert . Serialize ( result ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult AuditList ( string data )
{
var bodyList = JsonConvert . Deserialize < List < ChPayapplication > > ( data ) ;
DBResult result = ChpayapplicationDAL . AuditList ( bodyList , Convert . ToString ( Session [ "USERID" ] ) ) ;
if ( result . Message2 = = "1" )
{
var PAYAUDITAUTOCLOSEDR = MsSysParamSetDAL . GetData ( "PARAMNAME='PAYAUDITAUTOCLOSEDR'" ) ;
if ( PAYAUDITAUTOCLOSEDR . PARAMVALUE = = "1" )
{
var bsnolist = new List < BSNOLB > ( ) ;
foreach ( var bill in bodyList )
{
var dataList = ChpayapplicationDAL . GetBodyAllList ( "BILLNO='" + bill . BILLNO + "'" ) ;
if ( dataList ! = null )
{
foreach ( var enumValue in dataList )
{
if ( bsnolist . FindAll ( x = > x . BSNO = = enumValue . BSNO ) . Count = = 0 )
{
var bsnoitem = new BSNOLB ( ) ;
bsnoitem . BSNO = enumValue . BSNO ;
bsnolist . Add ( bsnoitem ) ;
}
}
}
}
ChpayapplicationDAL . SelBsLock ( bsnolist , "应收" ) ;
}
}
var jsonRespose = new JsonResponse { Success = result . Success , Message = result . Message } ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
public ContentResult AuditBackList ( string data , string reason )
{
var bodyList = JsonConvert . Deserialize < List < ChPayapplication > > ( data ) ;
DBResult result = ChpayapplicationDAL . AuditBackList ( bodyList , Convert . ToString ( Session [ "USERID" ] ) , reason ) ;
var jsonRespose = new JsonResponse { Success = result . Success , Message = result . Message } ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
public ContentResult AllAudit ( string condition )
{
var dataList = ChpayapplicationDAL . GetAuditDataList ( condition , Convert . ToString ( Session [ "USERID" ] ) , "3" , CookieConfig . GetCookie_UserCode ( Request ) , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
DBResult result = ChpayapplicationDAL . AuditList ( dataList , Convert . ToString ( Session [ "USERID" ] ) ) ;
if ( result . Message2 = = "1" )
{
var PAYAUDITAUTOCLOSEDR = MsSysParamSetDAL . GetData ( "PARAMNAME='PAYAUDITAUTOCLOSEDR'" ) ;
if ( PAYAUDITAUTOCLOSEDR . PARAMVALUE = = "1" )
{
var bsnolist = new List < BSNOLB > ( ) ;
foreach ( var bill in dataList )
{
var dataList2 = ChpayapplicationDAL . GetBodyAllList ( "BILLNO='" + bill . BILLNO + "'" ) ;
if ( dataList2 ! = null )
{
foreach ( var enumValue in dataList2 )
{
if ( bsnolist . FindAll ( x = > x . BSNO = = enumValue . BSNO ) . Count = = 0 )
{
var bsnoitem = new BSNOLB ( ) ;
bsnoitem . BSNO = enumValue . BSNO ;
bsnolist . Add ( bsnoitem ) ;
}
}
}
}
ChpayapplicationDAL . SelBsLock ( bsnolist , "应收" ) ;
}
}
var jsonRespose = new JsonResponse { Success = result . Success , Message = result . Message } ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
#region 派工单
public ContentResult GetWorkData ( string handle , string condition )
{
ChWork head = null ;
if ( handle = = "edit" )
{
head = ChpayapplicationDAL . GetWorkData ( condition ) ;
}
if ( head = = null )
{
head = new ChWork ( ) ;
}
if ( handle = = "add" )
{
head . APPLICANT = Convert . ToString ( Session [ "USERID" ] ) ;
head . APPLICANTREF = Convert . ToString ( Session [ "SHOWNAME" ] ) ;
// head.CURR = Convert.ToString(Session["LOCALCURR"]);
head . SETTLETIME = DateTime . Now . ToString ( "yyyy-MM-dd" ) ;
}
var json = JsonConvert . Serialize (
new { Success = true , Message = "查询成功" , data = head } ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult GetWorkList ( int start , int limit , string condition , string sort )
{
var dataList = ChpayapplicationDAL . GetWorkList ( condition , Convert . ToString ( Session [ "USERID" ] ) , CookieConfig . GetCookie_UserCode ( Request ) , Convert . ToString ( Session [ "COMPANYID" ] ) , sort ) ;
var list = dataList . Skip ( start ) . Take ( limit ) ;
var json = JsonConvert . Serialize (
new { Success = true , Message = "查询成功" , totalCount = dataList . Count , data = list . ToList ( ) } ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult SaveWork ( string opstatus , string data )
{
var headData = JsonConvert . Deserialize < ChWork > ( data ) ;
if ( opstatus = = "add" )
{
headData . GID = Guid . NewGuid ( ) . ToString ( ) ;
headData . COMPANYID = CookieConfig . GetCookie_CompanyId ( Request ) ;
headData . APPLICANT = CookieConfig . GetCookie_UserId ( Request ) ;
headData . APPLYTIME = DateTime . Now . ToString ( ) ;
headData . BILLSTATUS = "新建" ;
headData . DbOperationType = DbOperationType . DbotIns ;
var billnoset = MsSysBillNoSetDAL . GetData ( "OPLBNAME='派工单'" , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
if ( billnoset . BILLTYPE ! = "" )
headData . BILLNO = MsSysBillNoSetDAL . GetBillNo ( billnoset , headData . APPLYTIME . ToString ( ) . Trim ( ) , headData . APPLYTIME . ToString ( ) ) ;
else
headData . BILLNO = PubSysDAL . GetBillNo ( "0303" ) ;
}
else if ( opstatus = = "edit" )
{
headData . DbOperationType = DbOperationType . DbotUpd ;
headData . ModelUIStatus = "E" ;
}
else
{
headData . DbOperationType = DbOperationType . DbotDel ;
}
var BILLNO = headData . BILLNO ;
var modb = new ModelObjectDB ( ) ;
DBResult result = modb . Save ( headData ) ;
if ( result . Success = = true )
{
}
else
{
MsSysBillNoSetDAL . DeleteBsNo ( headData . BILLNO ) ;
}
var jsonRespose = new JsonResponse
{
Success = result . Success ,
Message = result . Message ,
Data = ChpayapplicationDAL . GetWorkData ( " BILLNO='" + BILLNO + "'" )
} ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
public ContentResult DeleteWork ( string data )
{
var headData = JsonConvert . Deserialize < ChWork > ( data ) ;
var modb = new ModelObjectDB ( ) ;
modb . Delete ( headData ) ;
MsSysBillNoSetDAL . DeleteBsNo ( headData . BILLNO ) ;
T_ALL_DA T_ALL_DA = new EntityDA . T_ALL_DA ( ) ;
var blUpSQL1 = " update ch_fee_payapplication SET WORKBILLNO='' WHERE WORKBILLNO='" + headData . BILLNO + "'" ;
bool bl1 = T_ALL_DA . GetExecuteSqlCommand ( blUpSQL1 ) ;
//var blUpSQL = " insert into sys_log(GID,NAME,LOGTYPE,LOGTIME,LOGCONTENT,CREATEUSER) values(NEWID(),'" + headData.BILLNO + "','删除付费申请','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" + headData.BILLNO + '(' + headData.CUSTOMERNAME + ')' + "','" + Convert.ToString(Session["USERID"]) + "')";
// bool bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
var jsonRespose = new JsonResponse { Success = true , Message = "删除成功!" } ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
public ContentResult AddWorkList ( string head , string data , string reason )
{
var headdata = JsonConvert . Deserialize < ChWork > ( head ) ;
var bodyList = JsonConvert . Deserialize < List < ChPayapplication > > ( data ) ;
DBResult result = ChpayapplicationDAL . AddWorkList ( headdata , bodyList , Convert . ToString ( Session [ "USERID" ] ) ) ;
var jsonRespose = new JsonResponse { Success = result . Success , Message = result . Message } ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
public ContentResult DelWorkList ( string head , string data , string reason )
{
var headdata = JsonConvert . Deserialize < ChWork > ( head ) ;
var bodyList = JsonConvert . Deserialize < List < ChPayapplication > > ( data ) ;
DBResult result = ChpayapplicationDAL . DelWorkList ( headdata , bodyList , Convert . ToString ( Session [ "USERID" ] ) ) ;
var jsonRespose = new JsonResponse { Success = result . Success , Message = result . Message } ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
public ContentResult SubmitAuditWork ( string bill )
{
var headdata = ChpayapplicationDAL . GetWorkData ( " BILLNO='" + bill + "'" ) ;
if ( headdata . BILLSTATUS = = "新建" )
{
T_ALL_DA T_ALL_DA = new EntityDA . T_ALL_DA ( ) ;
var blUpSQL1 = " update ch_fee_work SET BILLSTATUS='提交审核' WHERE BILLNO='" + bill + "'" ;
bool bl1 = T_ALL_DA . GetExecuteSqlCommand ( blUpSQL1 ) ;
var json = JsonConvert . Serialize ( new JsonResponse { Success = true , Message = "修改成功!" } ) ;
return new ContentResult ( ) { Content = json } ;
}
else
{
var jsonRespose = new JsonResponse { Success = false , Message = "当前状态不允许提交!" } ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
}
public ContentResult SubmitAuditBackWork ( string bill )
{
var headdata = ChpayapplicationDAL . GetWorkData ( " BILLNO='" + bill + "'" ) ;
if ( headdata . BILLSTATUS = = "提交审核" )
{
T_ALL_DA T_ALL_DA = new EntityDA . T_ALL_DA ( ) ;
var blUpSQL1 = " update ch_fee_work SET BILLSTATUS='新建' WHERE BILLNO='" + bill + "'" ;
bool bl1 = T_ALL_DA . GetExecuteSqlCommand ( blUpSQL1 ) ;
var json = JsonConvert . Serialize ( new JsonResponse { Success = true , Message = "修改成功!" } ) ;
return new ContentResult ( ) { Content = json } ;
}
else
{
var jsonRespose = new JsonResponse { Success = false , Message = "当前状态不允许,撤销提交!" } ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
}
public ContentResult SubmitAuditWorkList ( string bills )
{
var bodyList = JsonConvert . Deserialize < List < ChWork > > ( bills ) ;
T_ALL_DA T_ALL_DA = new EntityDA . T_ALL_DA ( ) ;
foreach ( var bill in bodyList )
{
var blUpSQL1 = " update ch_fee_work SET BILLSTATUS='提交审核' WHERE BILLNO='" + bill . BILLNO + "'" ;
bool bl1 = T_ALL_DA . GetExecuteSqlCommand ( blUpSQL1 ) ;
}
var json = JsonConvert . Serialize ( new JsonResponse { Success = true , Message = "修改成功!" } ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult SubmitAuditBackWorkList ( string bills )
{
var bodyList = JsonConvert . Deserialize < List < ChWork > > ( bills ) ;
T_ALL_DA T_ALL_DA = new EntityDA . T_ALL_DA ( ) ;
foreach ( var bill in bodyList )
{
var blUpSQL1 = " update ch_fee_work SET BILLSTATUS='新建' WHERE BILLNO='" + bill . BILLNO + "'" ;
bool bl1 = T_ALL_DA . GetExecuteSqlCommand ( blUpSQL1 ) ;
}
var json = JsonConvert . Serialize ( new JsonResponse { Success = true , Message = "修改成功!" } ) ;
return new ContentResult ( ) { Content = json } ;
}
# endregion
public ContentResult GetPrint ( string billno )
{
DBResult result = ChpayapplicationDAL . GetPrint ( billno , Convert . ToString ( Session [ "USERID" ] ) , CookieConfig . GetCookie_UserCode ( Request ) , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
var jsonRespose = new JsonResponse { Success = result . Success , Message = result . Message } ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
public ContentResult UpdatePrint ( string billnos )
{
var result = new DBResult ( ) ;
T_ALL_DA T_ALL_DA = new EntityDA . T_ALL_DA ( ) ;
string blUpSQL = " update ch_fee_payapplication set ISPRINT='1',PRINTCOUNT=ISNULL(PRINTCOUNT,0)+1,PRINTTIME=GETDATE() where BILLNO IN (" + billnos + ")" ;
bool bl = T_ALL_DA . GetExecuteSqlCommand ( blUpSQL ) ;
result . Success = true ;
result . Message = "更新成功!" ;
var jsonRespose = new JsonResponse
{
Success = result . Success ,
Message = result . Message ,
// Data = MsChFeeDAL.GetDataList(headData.BillNo, Convert.ToString(Session["USERID"]), CookieConfig.GetCookie_UserCode(Request), CookieConfig.GetCookie_OrgCode(Request))
} ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
public ContentResult UpdateNoPrint ( string billnos )
{
var result = new DBResult ( ) ;
T_ALL_DA T_ALL_DA = new EntityDA . T_ALL_DA ( ) ;
string blUpSQL = " update ch_fee_payapplication set ISPRINT='0',PRINTTIME=NULL where BILLNO IN (" + billnos + ")" ;
bool bl = T_ALL_DA . GetExecuteSqlCommand ( blUpSQL ) ;
result . Success = true ;
result . Message = "更新成功!" ;
var jsonRespose = new JsonResponse
{
Success = result . Success ,
Message = result . Message ,
// Data = MsChFeeDAL.GetDataList(headData.BillNo, Convert.ToString(Session["USERID"]), CookieConfig.GetCookie_UserCode(Request), CookieConfig.GetCookie_OrgCode(Request))
} ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
# endregion
#region 入账申请生成付费申请
public ContentResult GetBalList ( string billno )
{
var dataList = ChpayapplicationDAL . GetBalList ( billno ) ;
var json = JsonConvert . Serialize ( new { Success = true , Message = "查询成功" , totalCount = dataList . Count , data = dataList . ToList ( ) } ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult GetBalAddList ( int start , int limit , string sort , string condition )
{
var dataList = ChpayapplicationDAL . GetBalAddList ( condition , Convert . ToString ( Session [ "USERID" ] ) , CookieConfig . GetCookie_UserCode ( Request ) , Convert . ToString ( Session [ "COMPANYID" ] ) , sort ) ;
var list = dataList . Skip ( start ) . Take ( limit ) ;
var json = JsonConvert . Serialize ( new { Success = true , Message = "查询成功" , totalCount = dataList . Count , data = list . ToList ( ) } ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult GetBalFeeDetailList ( string sort , string condition )
{
var dataList = ChpayapplicationDAL . GetBalFeeDetailList ( condition ) ;
var json = JsonConvert . Serialize (
new { Success = true , Message = "查询成功" , totalCount = dataList . Count , data = dataList . ToList ( ) } ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult AddBalDetail ( string billno , string data )
{
var bodyList = JsonConvert . Deserialize < List < ChBalapplication > > ( data ) ;
var modb = new ModelObjectDB ( ) ;
DBResult result = ChpayapplicationDAL . AddBalDetail ( billno , bodyList , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
if ( result . Success ) { ChpayapplicationDAL . p_update_Amount ( billno ) ; }
var jsonRespose = new JsonResponse { Success = result . Success , Message = result . Message } ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
public ContentResult DelAppBill ( string data , string billno )
{
var bodyList = JsonConvert . Deserialize < List < ChBalapplication > > ( data ) ;
DBResult result = ChpayapplicationDAL . DelBalApp ( bodyList , billno ) ;
if ( result . Success ) { ChpayapplicationDAL . p_update_Amount ( billno ) ; }
var jsonRespose = new JsonResponse { Success = result . Success , Message = result . Message } ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
# endregion
public ContentResult GetMapData ( string BSNO , string NAME )
{
var mapList = FlowMapDal . GetMap ( BSNO , NAME ) ;
var json = JsonConvert . Serialize (
new { Success = true , Message = "查询成功" , totalCount = 1 , data = mapList } ) ;
return new ContentResult ( ) { Content = json } ;
}
/// <summary>
/// 获取车辆证件信息
/// </summary>
/// <param name="condition"></param>
/// <returns></returns>
public ContentResult GetFileList ( string BillNo )
{
var dataList = ChfeeFileDal . GetFileList ( BillNo ) ;
//var list = dataList.Skip(start).Take(limit);
var json = JsonConvert . Serialize ( new { Success = true , Message = "查询成功" , totalCount = dataList . Count , data = dataList . ToList ( ) } ) ;
return new ContentResult ( ) { Content = json } ;
}
/// <summary>
/// 上传证件照片
/// </summary>
/// <returns></returns>
public ContentResult FileUpload ( )
{
if ( Convert . ToString ( Session [ "COMPANYID" ] ) . ToString ( ) . Trim ( ) = = "" | | Convert . ToString ( Session [ "USERID" ] ) . ToString ( ) . Trim ( ) = = "" | | Convert . ToString ( Session [ "CODENAME" ] ) . ToString ( ) . Trim ( ) = = "" | | Convert . ToString ( Session [ "SHOWNAME" ] ) . ToString ( ) . Trim ( ) = = "" | | Convert . ToString ( Session [ "DEPTNAME" ] ) . ToString ( ) . Trim ( ) = = "" )
{
var jsonRespose2 = new JsonResponse { Success = false , Message = "登录超时,请退出系统重新登录!" } ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose2 ) } ;
}
var jsonRespose = new JsonResponse { Success = false , Message = "" } ;
if ( Request . Files . Count ! = 1 )
{
jsonRespose . Success = false ;
jsonRespose . Message = "请选择上传的文件" ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
var imgFile = Request . Files [ "file" ] ;
var BillNo = Request . Form [ "BillNo" ] . ToString ( ) . Trim ( ) ;
String strPath = "/Areas/Account/Files/" + BillNo + "/" ;
String dirPath = System . Web . HttpContext . Current . Server . MapPath ( strPath ) ;
if ( ! Directory . Exists ( dirPath ) )
{
Directory . CreateDirectory ( dirPath ) ;
}
string fileOriginalName = Path . GetFileNameWithoutExtension ( imgFile . FileName ) ;
String fileExt = Path . GetExtension ( imgFile . FileName ) . ToLower ( ) ;
if ( fileExt = = ".asp" | | fileExt = = ".aspx" )
{
jsonRespose . Success = false ;
jsonRespose . Message = "不允许上传ASP或ASPX文件" ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
String newFileName = DateTime . Now . ToString ( "yyyyMMddHHmmss_ffff" , DateTimeFormatInfo . InvariantInfo ) + fileExt ;
String filePath = dirPath + newFileName ;
imgFile . SaveAs ( filePath ) ;
//写入数据库
ChfeeFile model = new ChfeeFile ( ) ;
model . GID = Guid . NewGuid ( ) . ToString ( ) ;
model . BillNo = BillNo ;
model . File_Type = 0 ;
model . File_Name = newFileName ;
model . File_Path = filePath ;
model . CreateTime = DateTime . Now . ToShortDateString ( ) ;
model . Operator = Session [ "USERID" ] ! = null ? Session [ "USERID" ] . ToString ( ) : "" ;
model . File_OriginalName = fileOriginalName ;
model . File_DocNo = Request . Form [ "File_DocNo" ] ;
model . File_DocType = Request . Form [ "File_DocType" ] ;
string msg = "" ;
bool success = ChfeeFileDal . SaveFile ( model , 0 , out msg ) ;
jsonRespose . Success = success ;
jsonRespose . Message = msg ;
var json = JsonConvert . Serialize ( new { success = success , Message = "上传成功" , filePath = filePath } ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult CertDel ( string TruckNo )
{
var data = Request [ "data" ] ;
JavaScriptSerializer json = new JavaScriptSerializer ( ) ;
List < ChfeeFile > file = json . Deserialize < List < ChfeeFile > > ( data ) ;
string msg = "" ;
bool rst = false ;
if ( file ! = null )
{
rst = ChfeeFileDal . DelFile ( file , out msg ) ;
}
var jsonstr = JsonConvert . Serialize ( new { Success = rst , Message = rst ? "删除成功" : msg } ) ;
return new ContentResult ( ) { Content = jsonstr } ;
}
#region 参照部分
# endregion
}
}