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/TruckMng/Controllers/MsWlTruckFeeController.cs

145 lines
5.2 KiB
C#

2 years ago
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.Mvc;
using DSWeb.Areas.TruckMng.Models.MsWlTruck;
using DSWeb.Areas.TruckMng.DAL.MsWlTruck;
using DSWeb.Areas.CommMng.Models;
using DSWeb.TruckMng.Helper;
using DSWeb.TruckMng.Helper.Repository;
using Microsoft.Practices.EnterpriseLibrary.Data;
using HcUtility.Comm;
using HcUtility.Core;
using DSWeb.Areas.CommMng.DAL;
using DSWeb.TruckMng.Comm.Cookie;
namespace DSWeb.Areas.TruckMng.Controllers
{
/// <summary>
/// 项目信息明细
/// </summary>
public class MsWlTruckFeeController : Controller
{
//
// GET: /Import/RptImportFeedetail/
public ActionResult Index()
{
return View();
}
#region 车辆其他费用记录
public ContentResult GetDataList(int start, int limit, string sort, string condition)
{
var USERID = Convert.ToString(CookieConfig.GetCookie_UserId(Request));
var USERCODE = Convert.ToString(CookieConfig.GetCookie_UserCode(Request));
var ORGCODE = Convert.ToString(CookieConfig.GetCookie_OrgCode(Request));
var dataList = MsWlTruckDAL.GetTruckFeeList(condition,USERID,USERCODE,ORGCODE, 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 condition)
{
MsWlTruckFee head = null;
var USERID = Convert.ToString(CookieConfig.GetCookie_UserId(Request));
var USERCODE = Convert.ToString(CookieConfig.GetCookie_UserCode(Request));
var ORGCODE = Convert.ToString(CookieConfig.GetCookie_OrgCode(Request));
head = MsWlTruckDAL.GetTruckFee(condition, USERID, USERCODE, ORGCODE);
if (head == null)
{
head = new MsWlTruckFee();
}
var json = JsonConvert.Serialize(
new { Success = true, Message = "查询成功", data = head });
return new ContentResult() { Content = json };
}
#endregion
public ContentResult CreateTruckFee(string data)
{
var head = JsonConvert.Deserialize<MsWlTruckFee>(data);
head.DbOperationType = DbOperationType.DbotIns;
head.ModelUIStatus = "I";
head.GID = Guid.NewGuid().ToString(); //获取路单号
if (!string.IsNullOrEmpty(head.FeeDate))
{
head.FeeDate = head.FeeDate.Substring(0, 10);
}
//head.PcBillType = '0';
var modb = new ModelObjectRepository();
DBResult result = modb.Save(head);
var USERID = Convert.ToString(CookieConfig.GetCookie_UserId(Request));
var USERCODE = Convert.ToString(CookieConfig.GetCookie_UserCode(Request));
var ORGCODE = Convert.ToString(CookieConfig.GetCookie_OrgCode(Request));
//刷新父窗口上的父节点
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = MsWlTruckDAL.GetTruckFee(" gid= '" + head.GID + "'", USERID, USERCODE, ORGCODE, "")
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult DeleteTruckFee(string data)
{
var head = JsonConvert.Deserialize<MsWlTruckFee>(data);
head.DbOperationType = DbOperationType.DbotIns;
head.ModelUIStatus = "D";
var modb = new ModelObjectDB();
DBResult result = modb.Delete(head);
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = null
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult SaveTruckFee(string data)
{
var head = JsonConvert.Deserialize<MsWlTruckFee>(data);
head.DbOperationType = DbOperationType.DbotUpd;
head.ModelUIStatus = "E";
if (!string.IsNullOrEmpty(head.FeeDate))
{
head.FeeDate = head.FeeDate.Substring(0, 10);
}
var modb = new ModelObjectRepository();
DBResult result = modb.Save(head);
var USERID = Convert.ToString(CookieConfig.GetCookie_UserId(Request));
var USERCODE = Convert.ToString(CookieConfig.GetCookie_UserCode(Request));
var ORGCODE = Convert.ToString(CookieConfig.GetCookie_OrgCode(Request));
//刷新父窗口上的父节点
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = MsWlTruckDAL.GetTruckFee(" gid= '" + head.GID + "'", USERID, USERCODE, ORGCODE,"")
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
}
}