|
|
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 DSWeb.Areas.MvcShipping.Helper;
|
|
|
using DSWeb.Common.DB;
|
|
|
using static com.sun.net.httpserver.Authenticator;
|
|
|
using System.Threading;
|
|
|
|
|
|
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)
|
|
|
{
|
|
|
var canlogin = BasicDataRefDAL.CheckLogin(Session);
|
|
|
if (!canlogin.Success)
|
|
|
{
|
|
|
return (ContentResult)canlogin.Data;
|
|
|
}
|
|
|
|
|
|
|
|
|
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)
|
|
|
{
|
|
|
var canlogin = BasicDataRefDAL.CheckLogin(Session);
|
|
|
if (!canlogin.Success)
|
|
|
{
|
|
|
return (ContentResult)canlogin.Data;
|
|
|
}
|
|
|
|
|
|
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;
|
|
|
head.COMPANYID = Convert.ToString(Session["COMPANYID"]);
|
|
|
//head.SALECORPID = Convert.ToString(Session["COMPANYID"]);
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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)
|
|
|
{
|
|
|
var dataList = ChpayapplicationDAL.GetFeeDataList(condition, 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)
|
|
|
{
|
|
|
var dataList = ChpayapplicationDAL.GetAddBillList(start, limit,condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), sort);
|
|
|
int count= ChpayapplicationDAL.getAddBillTotalCount(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 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)
|
|
|
{
|
|
|
var dataList = ChpayapplicationDAL.GetFeeDetailList(condition, 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)
|
|
|
{
|
|
|
var canlogin = BasicDataRefDAL.CheckLogin(Session);
|
|
|
if (!canlogin.Success)
|
|
|
{
|
|
|
return (ContentResult)canlogin.Data;
|
|
|
}
|
|
|
|
|
|
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;
|
|
|
}
|
|
|
|
|
|
if (headData.ReplacePaymentOPTIME == "") headData.ReplacePaymentOPTIME = null;
|
|
|
|
|
|
|
|
|
var cansave = CanSave(ref headData);
|
|
|
|
|
|
if (!cansave.Success) {
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(cansave) };
|
|
|
}
|
|
|
|
|
|
var BILLNO = headData.BILLNO;
|
|
|
|
|
|
if (headData.INVDATE == "") headData.INVDATE = null;
|
|
|
if (headData.ReplacePaymentOPTIME == "") headData.ReplacePaymentOPTIME = null;
|
|
|
|
|
|
var modb = new ModelObjectDB();
|
|
|
DBResult result = modb.Save(headData);
|
|
|
if (result.Success == true) {
|
|
|
|
|
|
ChpayapplicationDAL.p_update_Amount(headData.BILLNO);
|
|
|
ChpayapplicationDAL.SetSALECORP(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) };
|
|
|
|
|
|
}
|
|
|
|
|
|
private static JsonResponse CanSave(ref ChPayapplication headData)
|
|
|
{
|
|
|
var error = "";
|
|
|
var result = new JsonResponse { Success = true };
|
|
|
|
|
|
var ct = ChpayapplicationDAL.GetPayRdCount("GID<>'" + headData.GID + "' AND BILLNO='" + headData.BILLNO + "' ");
|
|
|
if (ct != 0)
|
|
|
{
|
|
|
error += "付费申请编号重复,不允许保存!";
|
|
|
}
|
|
|
|
|
|
if (headData.IsReplacePayment == "1" || headData.IsReplacePayment == "true") {
|
|
|
if (string.IsNullOrWhiteSpace(headData.ReplacePaymentCORPID))
|
|
|
{
|
|
|
error += "代付时必须指定代付公司;";
|
|
|
}
|
|
|
else {
|
|
|
headData.ReplacePaymentStatus = "未代付";
|
|
|
}
|
|
|
}
|
|
|
else{
|
|
|
headData.ReplacePaymentStatus = "";
|
|
|
headData.ReplacePaymentCORPID = "";
|
|
|
}
|
|
|
|
|
|
|
|
|
if (error != "") {
|
|
|
result.Success = false;
|
|
|
result.Message = error;
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public ContentResult AddDetail(string bill, string data, string curr, string storeCurrExrate,string salecorp)
|
|
|
{
|
|
|
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();
|
|
|
|
|
|
var bsnoList = bodyList.Select(s => s.BSNO).Distinct().ToList();
|
|
|
var _r = ChpayapplicationDAL.SetSALECORP(bill, bsnoList);
|
|
|
if (!_r.Success)
|
|
|
{
|
|
|
return BasicDataRefDAL.GetContentResult(_r);
|
|
|
}
|
|
|
|
|
|
DBResult result = ChpayapplicationDAL.AddDetail(bill, 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="")
|
|
|
{
|
|
|
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;
|
|
|
|
|
|
var _r = ChpayapplicationDAL.SetSALECORP(billno, feesql, billcust, Convert.ToString(Session["COMPANYID"]), Convert.ToString(Session["USERID"]), custgroup);
|
|
|
if (!_r.Success)
|
|
|
{
|
|
|
return BasicDataRefDAL.GetContentResult(_r);
|
|
|
}
|
|
|
|
|
|
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, 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, 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 DoReplacePayment( string data,string dotype)
|
|
|
{
|
|
|
var canlogin = BasicDataRefDAL.CheckLogin(Session);
|
|
|
if (!canlogin.Success)
|
|
|
{
|
|
|
return (ContentResult)canlogin.Data;
|
|
|
}
|
|
|
|
|
|
var _headData = JsonConvert.Deserialize<ChPayapplication>(data);
|
|
|
|
|
|
var cdc = new CommonDataContext();
|
|
|
var headData = cdc.ch_fee_payapplication.FirstOrDefault(x => x.BILLNO == _headData.BILLNO);
|
|
|
|
|
|
if (headData == null || !string.IsNullOrWhiteSpace(headData.BILLNO))
|
|
|
{
|
|
|
|
|
|
}
|
|
|
else {
|
|
|
var jsonRespose0 = new JsonResponse
|
|
|
{
|
|
|
Success = false,
|
|
|
Message = "没有找到该业务"
|
|
|
};
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose0) };
|
|
|
}
|
|
|
|
|
|
//执行
|
|
|
if (dotype == "do")
|
|
|
{
|
|
|
var _r = CanDo(headData);
|
|
|
|
|
|
if (_r.Success != true) {
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(_r) };
|
|
|
}
|
|
|
|
|
|
headData.ReplacePaymentStatus = "已代付";
|
|
|
headData.ReplacePaymentOPTIME = Convert.ToDateTime( DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
|
|
|
headData.ReplacePaymentOPNAME = Convert.ToString(Session["SHOWNAME"]).ToString().Trim();
|
|
|
|
|
|
cdc.SaveChanges();
|
|
|
}
|
|
|
//取消
|
|
|
if (dotype == "undo")
|
|
|
{
|
|
|
var _r = CanUnDo(headData);
|
|
|
|
|
|
if (_r.Success != true)
|
|
|
{
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(_r) };
|
|
|
}
|
|
|
|
|
|
headData.ReplacePaymentStatus = "未代付";
|
|
|
headData.ReplacePaymentOPTIME = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
|
|
|
headData.ReplacePaymentOPNAME = Convert.ToString(Session["SHOWNAME"]).ToString().Trim();
|
|
|
|
|
|
cdc.SaveChanges();
|
|
|
}
|
|
|
var jsonRespose = new JsonResponse
|
|
|
{
|
|
|
Success = true,
|
|
|
Message = "执行成功",
|
|
|
Data = ChpayapplicationDAL.GetData(" BILLNO='" + headData.BILLNO + "'", Convert.ToString(Session["USERID"]), CookieConfig.GetCookie_UserCode(Request), Convert.ToString(Session["COMPANYID"]))
|
|
|
};
|
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 判断能否垫付
|
|
|
/// </summary>
|
|
|
/// <param name="headData"></param>
|
|
|
/// <returns></returns>
|
|
|
public JsonResponse CanDo(ch_fee_payapplication_md headData) {
|
|
|
//必须是审核通过状态的业务
|
|
|
//必须有至少一条附件
|
|
|
var error = "";
|
|
|
|
|
|
if (headData.BILLSTATUS != 0) {
|
|
|
error += "只有【审核通过】状态的付费申请才能执行代付操作;";
|
|
|
}
|
|
|
|
|
|
var cdc = new CommonDataContext();
|
|
|
|
|
|
var filelist = cdc.ch_fee_File.Where(x => x.BillNo == headData.BILLNO).ToList();
|
|
|
|
|
|
if (filelist == null || filelist.Count == 0) {
|
|
|
error += "必须上传相应的附件";
|
|
|
}
|
|
|
|
|
|
var result = new JsonResponse { Success = true };
|
|
|
|
|
|
if (error != "") {
|
|
|
result.Success = false;
|
|
|
result.Message = error;
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public JsonResponse CanUnDo(ch_fee_payapplication_md headData)
|
|
|
{
|
|
|
//必须是审核通过状态的业务
|
|
|
var error = "";
|
|
|
|
|
|
if (headData.BILLSTATUS != 0)
|
|
|
{
|
|
|
error += "只有【审核通过】状态的付费申请才能执行代付操作;";
|
|
|
}
|
|
|
|
|
|
var result = new JsonResponse { Success = true };
|
|
|
|
|
|
if (error != "")
|
|
|
{
|
|
|
result.Success = false;
|
|
|
result.Message = error;
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#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);
|
|
|
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);
|
|
|
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));
|
|
|
|
|
|
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 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' 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 ( )
|
|
|
{
|
|
|
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();
|
|
|
var FileBillType = "";
|
|
|
try
|
|
|
{
|
|
|
FileBillType = Request.Form["FileBillType"].ToString().Trim();
|
|
|
}
|
|
|
catch (Exception e) {
|
|
|
|
|
|
}
|
|
|
|
|
|
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();
|
|
|
String newFileName = DateTime.Now.ToString("yyyyMMddHHmmss_ffff", DateTimeFormatInfo.InvariantInfo) + fileExt;
|
|
|
String filePath = dirPath + newFileName;
|
|
|
imgFile.SaveAs(filePath);
|
|
|
|
|
|
var webpath = strPath+ newFileName;
|
|
|
//
|
|
|
|
|
|
//写入数据库
|
|
|
ChfeeFile model = new ChfeeFile();
|
|
|
model.GID = Guid.NewGuid().ToString();
|
|
|
model.BillNo = BillNo;
|
|
|
model.File_Type = 0;
|
|
|
model.File_Name = newFileName;
|
|
|
model.File_Path = webpath;//由物理路径改为相对路径
|
|
|
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);
|
|
|
|
|
|
|
|
|
if (FileBillType == "付费结算" || FileBillType == "收费结算")
|
|
|
{
|
|
|
//如果是付费结算和收费结算 则将文件路径
|
|
|
// /Areas/Account/Files/SCHN22080151(billno)/20220823093412_4312.jpg(filename)
|
|
|
// URL= file_originalname ; BSNO= v_op_bs.BSNO
|
|
|
// 写入Receipt_Doc ,用于在业务中看到附件
|
|
|
var cdc = new CommonDataContext();
|
|
|
|
|
|
//寻找结算业务对应的所有ch_fee 找到他们的BSNO列表
|
|
|
var feedolist = cdc.ch_fee_do.Where(x => x.BILLNO == BillNo);
|
|
|
var BSNOList = feedolist.Select(s => s.BSNO).Distinct().ToList();
|
|
|
if (BSNOList != null && BSNOList.Count > 0) {
|
|
|
foreach (var BSNO in BSNOList) {
|
|
|
var newdoc = new Receipt_Doc_md(BSNO);
|
|
|
|
|
|
newdoc.URL = fileOriginalName;
|
|
|
newdoc.Driect_URL = webpath;
|
|
|
newdoc.R_GID = BillNo;
|
|
|
cdc.Receipt_Doc.Add(newdoc);
|
|
|
}
|
|
|
cdc.SaveChanges();
|
|
|
}
|
|
|
|
|
|
//同时 寻找相应的付费申请 收费申请 将附件信息同时写入
|
|
|
|
|
|
|
|
|
var 申请单列表 = cdc.v_fee_do_payapplication.Where(x => x.BILLNO == BillNo).ToList();
|
|
|
|
|
|
var sendedList = new List<v_fee_do_payapplication_md>();
|
|
|
|
|
|
if (申请单列表 != null && 申请单列表.Count > 0)
|
|
|
{
|
|
|
foreach (var sqd in 申请单列表)
|
|
|
{
|
|
|
if (sendedList.Exists(x => x.PAYBILLNO == sqd.PAYBILLNO)) continue;
|
|
|
var newmodel = AutoMapperHelper.MapTo<ChfeeFile, ChfeeFile>(model);
|
|
|
newmodel.GID = Guid.NewGuid().ToString();
|
|
|
newmodel.BillNo = sqd.PAYBILLNO;
|
|
|
success = ChfeeFileDal.SaveFile(newmodel, 0, out msg);
|
|
|
sendedList.Add(sqd);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
jsonRespose.Success = success;
|
|
|
jsonRespose.Message = msg;
|
|
|
var json = JsonConvert.Serialize(new { success = success, Message = "上传成功", filePath = filePath });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
[HttpPost]
|
|
|
public ActionResult FileUpload_PL()
|
|
|
{
|
|
|
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();
|
|
|
var FileBillType = "";
|
|
|
try
|
|
|
{
|
|
|
FileBillType = Request.Form["FileBillType"].ToString().Trim();
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
for (int idx = 0; idx < Request.Files.Count; idx++)
|
|
|
{
|
|
|
|
|
|
|
|
|
var imgFile= Request.Files.Get(idx);
|
|
|
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();
|
|
|
String newFileName = DateTime.Now.ToString("yyyyMMddHHmmss_ffff", DateTimeFormatInfo.InvariantInfo)+ idx.ToString() + fileExt;
|
|
|
String filePath = dirPath + newFileName;
|
|
|
imgFile.SaveAs(filePath);
|
|
|
|
|
|
var webpath = strPath + newFileName;
|
|
|
//
|
|
|
|
|
|
//写入数据库
|
|
|
ChfeeFile model = new ChfeeFile();
|
|
|
model.GID = Guid.NewGuid().ToString();
|
|
|
model.BillNo = BillNo;
|
|
|
model.File_Type = 0;
|
|
|
model.File_Name = newFileName;
|
|
|
model.File_Path = webpath;//由物理路径改为相对路径
|
|
|
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);
|
|
|
|
|
|
|
|
|
if (FileBillType == "付费结算" || FileBillType == "收费结算")
|
|
|
{
|
|
|
//如果是付费结算和收费结算 则将文件路径
|
|
|
// /Areas/Account/Files/SCHN22080151(billno)/20220823093412_4312.jpg(filename)
|
|
|
// URL= file_originalname ; BSNO= v_op_bs.BSNO
|
|
|
// 写入Receipt_Doc ,用于在业务中看到附件
|
|
|
var cdc = new CommonDataContext();
|
|
|
|
|
|
//寻找结算业务对应的所有ch_fee 找到他们的BSNO列表
|
|
|
var feedolist = cdc.ch_fee_do.Where(x => x.BILLNO == BillNo);
|
|
|
var BSNOList = feedolist.Select(s => s.BSNO).Distinct().ToList();
|
|
|
if (BSNOList != null && BSNOList.Count > 0)
|
|
|
{
|
|
|
foreach (var BSNO in BSNOList)
|
|
|
{
|
|
|
var newdoc = new Receipt_Doc_md(BSNO);
|
|
|
|
|
|
newdoc.URL = fileOriginalName;
|
|
|
newdoc.Driect_URL = webpath;
|
|
|
newdoc.R_GID = BillNo;
|
|
|
cdc.Receipt_Doc.Add(newdoc);
|
|
|
}
|
|
|
cdc.SaveChanges();
|
|
|
}
|
|
|
|
|
|
//同时 寻找相应的付费申请 收费申请 将附件信息同时写入
|
|
|
|
|
|
|
|
|
var 申请单列表 = cdc.v_fee_do_payapplication.Where(x => x.BILLNO == BillNo).ToList();
|
|
|
|
|
|
var sendedList = new List<v_fee_do_payapplication_md>();
|
|
|
|
|
|
if (申请单列表 != null && 申请单列表.Count > 0)
|
|
|
{
|
|
|
foreach (var sqd in 申请单列表)
|
|
|
{
|
|
|
if (sendedList.Exists(x => x.PAYBILLNO == sqd.PAYBILLNO)) continue;
|
|
|
var newmodel = AutoMapperHelper.MapTo<ChfeeFile, ChfeeFile>(model);
|
|
|
newmodel.GID = Guid.NewGuid().ToString();
|
|
|
newmodel.BillNo = sqd.PAYBILLNO;
|
|
|
success = ChfeeFileDal.SaveFile(newmodel, 0, out msg);
|
|
|
sendedList.Add(sqd);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//jsonRespose.Success = success;
|
|
|
//jsonRespose.Message = msg;
|
|
|
//var json = JsonConvert.Serialize(new { success = true, Message = "上传成功", filePath = "" });
|
|
|
//return new ContentResult() { Content = json };
|
|
|
var result = new DBResult();
|
|
|
result.OK("上传成功", BillNo);
|
|
|
return Json(result);
|
|
|
}
|
|
|
|
|
|
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);
|
|
|
|
|
|
//20220823 增加处理 删除路径相同的其他附件数据,
|
|
|
ChfeeFileDal.DelOtherFile(file, out msg);
|
|
|
}
|
|
|
var jsonstr = JsonConvert.Serialize(new { Success = rst, Message = rst ? "删除成功" : msg });
|
|
|
return new ContentResult() { Content = jsonstr };
|
|
|
}
|
|
|
#region 参照部分
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|