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

317 lines
12 KiB
C#

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using System;
using System.Linq;
using System.Web.Mvc;
using DSWeb.Areas.Account.DAL.Chfee_Jinzhang;
using DSWeb.Areas.Account.Models.Chfee_jinzhang;
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 System.Data;
using DSWeb.SoftMng.Filter;
namespace DSWeb.Areas.Account.Controllers
{
[JsonRequestBehavior]
public class Chfee_jinzhangController : Controller
{
//
// GET:
public ActionResult Index()
{
return View();
}
//
// GET: /
public ActionResult Edit()
{
return View();
}
//
// GET
#region 支票
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
public ContentResult GetDataList(int start, int limit, string sort, string condition)
{
var dataList = ChJinzhangDAL.GetDataList(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 };
}
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
public ContentResult GetData(string handle, string condition)
{
ChJinzhang head = null;
if (handle == "edit")
{
var list = ChJinzhangDAL.GetDataList(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 ChJinzhang();
}
if (handle == "add")
{
head.CREATEUSER = Convert.ToString(Session["USERID"]);
head.CREATEUSERREF = Convert.ToString(Session["SHOWNAME"]);
head.COMPANYID = Convert.ToString(Session["COMPANYID"]);
}
var json = JsonConvert.Serialize(
new { Success = true, Message = "查询成功", data = head });
return new ContentResult() { Content = json };
}
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
public ContentResult GetSTLData(string handle, string drno)
{
ChJinzhang head = null;
T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
var sqlAPEGOL = "SELECT [BILLNO],[CUSTOMERNAME],[AMOUNTRMB],[ACCOUNTRMB],[AMOUNTUSD],[ACCOUNTUSD],[CURR],[CUSTACCOUNT],[CUSTBANK],"
+ "RB.ACCOUNT RMBACOUNT,RB.BANKNAME RMBBANKNAME,RB.ACCOUNTNAME RMBACCOUNTNAME,UB.ACCOUNT USDACOUNT,UB.BANKNAME USDBANKNAME,UB.ACCOUNTNAME USDACCOUNTNAME"
+ " ,(SELECT [DESCRIPTION] FROM info_client where SHORTNAME=CUSTOMERNAME) JINZHANGCUSTNAME FROM ch_fee_settlement left join sys_bank RB ON (RB.GID=ACCOUNTRMB) left join sys_bank UB ON (UB.GID=ACCOUNTUSD) "
+ " WHERE BILLNO= '" + drno + "'";
DataSet dsstldata = null;
dsstldata = T_ALL_DA.GetAllSQL(sqlAPEGOL);
if (head == null)
{
head = new ChJinzhang();
}
if (handle == "add")
{
head.CREATEUSER = Convert.ToString(Session["USERID"]);
head.CREATEUSERREF = Convert.ToString(Session["SHOWNAME"]);
head.COMPANYID = Convert.ToString(Session["COMPANYID"]);
}
if (dsstldata != null)
{
if (dsstldata.Tables[0].Rows.Count > 0)
{
head.CUSTOMERNAME = dsstldata.Tables[0].Rows[0]["CUSTOMERNAME"].ToString().Trim();
head.JINZHANGCUSTNAME = dsstldata.Tables[0].Rows[0]["JINZHANGCUSTNAME"].ToString().Trim();
head.STLBILLNO = dsstldata.Tables[0].Rows[0]["BILLNO"].ToString().Trim();
Decimal dl = Decimal.Parse(dsstldata.Tables[0].Rows[0]["AMOUNTRMB"].ToString().Trim());
if (dsstldata.Tables[0].Rows[0]["CURR"].ToString().Trim() == "RMB")
{
head.CURRENCY = "RMB";
head.AMOUNT = Decimal.Parse(dsstldata.Tables[0].Rows[0]["AMOUNTRMB"].ToString().Trim());
head.BANKID = dsstldata.Tables[0].Rows[0]["ACCOUNTRMB"].ToString().Trim();
head.BANK = dsstldata.Tables[0].Rows[0]["RMBBANKNAME"].ToString().Trim();
head.COMPANYNAME = dsstldata.Tables[0].Rows[0]["RMBACCOUNTNAME"].ToString().Trim();
head.BANKACCOUNT = dsstldata.Tables[0].Rows[0]["RMBACOUNT"].ToString().Trim();
}
else {
head.CURRENCY = dsstldata.Tables[0].Rows[0]["CURR"].ToString().Trim();
head.AMOUNT = Decimal.Parse(dsstldata.Tables[0].Rows[0]["AMOUNTUSD"].ToString().Trim());
head.BANKID = dsstldata.Tables[0].Rows[0]["ACCOUNTUSD"].ToString().Trim();
head.BANK = dsstldata.Tables[0].Rows[0]["USDBANKNAME"].ToString().Trim();
head.COMPANYNAME = dsstldata.Tables[0].Rows[0]["USDACCOUNTNAME"].ToString().Trim();
head.BANKACCOUNT = dsstldata.Tables[0].Rows[0]["USDACOUNT"].ToString().Trim();
}
}
}
var json = JsonConvert.Serialize(
new { Success = true, Message = "查询成功", data = head });
return new ContentResult() { Content = json };
}
public ContentResult Save(string opstatus, string data)
{
var headData = JsonConvert.Deserialize<ChJinzhang>(data);
if (opstatus == "add")
{
headData.GID = Guid.NewGuid().ToString();
headData.BILLNO = PubSysDAL.GetBillNo("0611");
headData.COMPANYID = Convert.ToString(Session["COMPANYID"]);
headData.CREATEUSER = Convert.ToString(Session["USERID"]);
headData.CREATETIME = DateTime.Now.ToString();
headData.DbOperationType = DbOperationType.DbotIns;
}
else if (opstatus == "edit")
{
headData.DbOperationType = DbOperationType.DbotUpd;
headData.ModelUIStatus = "E";
}
else
{
headData.DbOperationType = DbOperationType.DbotDel;
}
if (headData.JINZHANGMAKETIME == "") headData.JINZHANGMAKETIME = null;
var BILLNO = headData.BILLNO;
var amountstr = string.Format("{0:0.00}", headData.AMOUNT);
amountstr = amountstr.Replace(".","");
headData.FEN = ChJinzhangDAL.Amount2STR(amountstr, 1, headData.CURRENCY);
headData.JIAO = ChJinzhangDAL.Amount2STR(amountstr, 2, headData.CURRENCY);
headData.YUAN = ChJinzhangDAL.Amount2STR(amountstr, 3, headData.CURRENCY);
headData.SHI = ChJinzhangDAL.Amount2STR(amountstr, 4, headData.CURRENCY);
headData.BAI = ChJinzhangDAL.Amount2STR(amountstr, 5, headData.CURRENCY);
headData.QIAN = ChJinzhangDAL.Amount2STR(amountstr, 6, headData.CURRENCY);
headData.WAN = ChJinzhangDAL.Amount2STR(amountstr, 7, headData.CURRENCY);
headData.SHIWAN = ChJinzhangDAL.Amount2STR(amountstr, 8, headData.CURRENCY);
headData.BAIWAN = ChJinzhangDAL.Amount2STR(amountstr, 9, headData.CURRENCY);
headData.QIANWAN = ChJinzhangDAL.Amount2STR(amountstr, 10, headData.CURRENCY);
headData.YI = ChJinzhangDAL.Amount2STR(amountstr, 11, headData.CURRENCY);
headData.SHIYI = ChJinzhangDAL.Amount2STR(amountstr, 12, headData.CURRENCY);
headData.BAIYI = ChJinzhangDAL.Amount2STR(amountstr, 13, headData.CURRENCY);
// headData.FEN=
var modb = new ModelObjectDB();
DBResult result = modb.Save(headData);
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = ChJinzhangDAL.GetData(" BILLNO='" + BILLNO + "'", Convert.ToString(Session["USERID"]), CookieConfig.GetCookie_UserCode(Request), Convert.ToString(Session["COMPANYID"]))
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
//
public ContentResult Delete(string data)
{
var headData = JsonConvert.Deserialize<ChJinzhang>(data);
DBResult result;
var modb = new ModelObjectDB();
result=modb.Delete(headData);
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult DeleteUp(string data)
{
var headData = JsonConvert.Deserialize<ChJinzhang>(data);
DBResult result;
result = ChJinzhangDAL.UpdateDelete(headData.BILLNO, Convert.ToString(Session["USERID"]));
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
#region 锁定和撤销锁定
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
public ContentResult Lock(string bill)
{
DBResult result = ChJinzhangDAL.Lock(bill);
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
public ContentResult UnLock(string bill)
{
DBResult result = ChJinzhangDAL.UnLock(bill);
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
public ContentResult LockList(string bills)
{
DBResult result = ChJinzhangDAL.LockList(bills);
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
public ContentResult UnLockList(string bills)
{
DBResult result = ChJinzhangDAL.UnLockList(bills);
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
#endregion
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
public ContentResult UpdatePrint(string billno)
{
DBResult result = ChJinzhangDAL.UpdatePrint(billno);
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
#endregion
#region 参照部分
#endregion
}
}