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.

227 lines
7.3 KiB
C#

10 months ago
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
using DSWeb.Areas.TruckMng.Models.Comm;
using DSWeb.Areas.CommMng.DAL;
using DSWeb.Areas.Import.DAL.Finance;
using DSWeb.Areas.Import.Models.Finance;
using DSWeb.TruckMng.Comm.Cookie;
using DSWeb.TruckMng.Helper;
using DSWeb.TruckMng.Helper.Repository;
using HcUtility.Comm;
using HcUtility.Core;
namespace DSWeb.Areas.Import.Controllers
{
[JsonRequestBehavior]
public class FinanceOutController : Controller
{
//
// GET: /Import/FinanceOut
public ActionResult Index()
{
return View();
}
//
// GET: /Import/FinanceOut/Edit
public ActionResult Edit()
{
return View();
}
// Get:/Import/FinanceOut/GetDataList
/* public ContentResult GetDataList(string condition)
{
var _condition = " ContractNo = '" + condition + "' ";
List<Financemb> list = FinanceDAL.GetDataList(_condition);
var json = JsonConvert.Serialize
(new { Success = true, Message = "查询成功", totalCount = list.Count, data = list.ToList() });
return new ContentResult() { Content = json };
}*/
/*
public ContentResult GetFOut(string condition)
{
var _condition = " ContractNo = '" + condition + "' ";
List<FOutmb> list = FinanceDAL.GetFOut(_condition);
FOutmb head = null;
if (list.Count > 0)
head = list[0];
if (head == null)
{
head = new FOutmb();
}
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", data = head });
return new ContentResult() { Content = json };
}
public ContentResult GetFIn(string condition)
{
var _condition = " ContractNo = '" + condition + "' ";
List<FInmb> list = FinanceDAL.GetFIn(_condition);
FInmb head = null;
if (list.Count > 0)
head = list[0];
if (head == null)
{
head = new FInmb();
}
var json = JsonConvert.Serialize(
new { Success = true, Message = "查询成功", data = head });
return new ContentResult() { Content = json };
}
public ContentResult GetFInList(int start, int limit, string sort, string condition)
{
var dataList = FinanceDAL.GetFIn(condition);
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 GetFOutList(string condition)
{
var _condition = condition ;
List<FOutmb> list = FinanceDAL.GetFOutList(_condition);
var json = JsonConvert.Serialize
(new { Success = true, Message = "查询成功", totalCount = list.Count, data = list.ToList() });
return new ContentResult() { Content = json };
}
// GET/Import/XXH/GetDataList
public ContentResult GetMainList(int start, int limit, string sort, string condition)
{
var dataList = FinanceDAL.GetDataList(condition);
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 GetFOBodyList(string condition)
{
var _condition = " ContractNo = '" + condition + "' ";
List<FOBodymb> list = FinanceDAL.GetFOBodyList(_condition);
var json = JsonConvert.Serialize
(new { Success = true, Message = "查询成功", totalCount = list.Count, data = list.ToList() });
return new ContentResult() { Content = json };
}
public ContentResult Save(string opstatus, string data
, string FOBody, string FODelBody
)
{
FOutmb head = JsonConvert.Deserialize<FOutmb>(data);
var FOBodyList = JsonConvert.Deserialize<List<FOBodymb>>(FOBody);
var FODelBodyList = JsonConvert.Deserialize<List<FOBodymb>>(FODelBody);
if (opstatus == "add")
{
head.DbOperationType = DbOperationType.DbotIns;
head.ModelUIStatus = "I";
//head.gid = PubSysDAL.GetBillNo("0204"); //获取GID
}
else if (opstatus == "edit")
{
head.DbOperationType = DbOperationType.DbotUpd;
head.ModelUIStatus = "E";
}
else
{
head.DbOperationType = DbOperationType.DbotDel;
}
var modb = new ModelObjectRepository();
DBResult result = modb.Save(head,
ModelObjectConvert<FOBodymb>.ToModelObjectList(FOBodyList),
ModelObjectConvert<FOBodymb>.ToModelObjectList(FODelBodyList)
);
//刷新父窗口上的父节点
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = FinanceDAL.GetData("FO.gid='" + head.gid + "'")
};
if (Convert.ToInt16(head.FinanceStatus) >1)
{ ChangeStatus(head.ContractNo,"10"); }
else
{ ChangeStatus(head.ContractNo, "2"); }
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult SaveIn(string opstatus, string data)
{
FInmb head = JsonConvert.Deserialize<FInmb>(data);
if (opstatus == "add")
{
head.DbOperationType = DbOperationType.DbotIns;
head.ModelUIStatus = "I";
//head.gid = PubSysDAL.GetBillNo("0204"); //获取GID
}
else if (opstatus == "edit")
{
head.DbOperationType = DbOperationType.DbotUpd;
head.ModelUIStatus = "E";
}
else
{
head.DbOperationType = DbOperationType.DbotDel;
}
var modb = new ModelObjectRepository();
DBResult result = modb.Save(head
);
//刷新父窗口上的父节点
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = FinanceDAL.GetFIn("FO.gid='" + head.gid + "'")
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public int ChangeStatus(string ContractNo, string status)
{
var _count = 0;
_count = FinanceDAL.ChangeStatus(ContractNo, status);
return _count;
}
#region 参照部分
#endregion
*/
}
}