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

322 lines
10 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.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
using DSWeb.Areas.CommMng.DAL;
using DSWeb.Areas.TruckMng.DAL.MsKfJh;
using DSWeb.Areas.TruckMng.Models.MsKfJh;
using DSWeb.TruckMng.Comm.Cookie;
using DSWeb.TruckMng.Helper;
using DSWeb.TruckMng.Helper.Repository;
using HcUtility.Comm;
using HcUtility.Core;
namespace DSWeb.Areas.TruckMng.Controllers
{
/// <summary>
/// 配件申领单
/// </summary>
[JsonRequestBehavior]
public class MsKfJhController : Controller
{
//
// GET: /TruckMng/MsKfJh/
public ActionResult Index()
{
return View();
}
//
// GET: /TruckMng/MsKfJh/Edit
public ActionResult Edit()
{
return View();
}
public ActionResult HCIndex()
{
return View();
}
//
// GET: /TruckMng/MsKfJh/Edit
public ActionResult HCEdit()
{
return View();
}
//
// GET: /TruckMng/MsKfJh/IndexTyre
public ActionResult IndexTyre()
{
return View();
}
//
// GET: /TruckMng/MsKfJh/EditTyre
public ActionResult EditTyre()
{
return View();
}
//
// GET: /TruckMng/MsKfJh/IndexTyre
public ActionResult IndexTyreGd()
{
return View();
}
//
// GET: /TruckMng/MsKfJh/EditTyre
public ActionResult EditTyreGd()
{
return View();
}
//
// GET/TruckMng/MsKfJh/GetDataList
public ContentResult GetDataList(int start, int limit, string sort, string condition)
{
string contmp = null;
if (string.IsNullOrEmpty(condition))
{
contmp = " PluType='0' ";
}
else
{
contmp = condition + " and PluType='0' ";
}
var dataList = MsKfJhDAL.GetDataList(contmp, Convert.ToString(Session["USERID"]), CookieConfig.GetCookie_UserCode(Request), CookieConfig.GetCookie_OrgCode(Request), 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 };
}
//
// GET/TruckMng/MsKfJh/GetDataListTyre
public ContentResult GetDataListTyre(int start, int limit, string sort, string condition)
{
string contmp = null;
if (string.IsNullOrEmpty(condition))
{
contmp = " PluType='1' ";
}
else
{
contmp = condition + " and PluType='1' ";
}
var dataList = MsKfJhDAL.GetDataList(contmp, Convert.ToString(Session["USERID"]), CookieConfig.GetCookie_UserCode(Request), CookieConfig.GetCookie_OrgCode(Request),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 };
}
//
// GET/TruckMng/MsKfJh/GetDataListTyre
public ContentResult GetDataListTyreGd(int start, int limit, string sort, string condition)
{
string contmp = null;
if (string.IsNullOrEmpty(condition))
{
contmp = " PluType='2' ";
}
else
{
contmp = condition + " and PluType='2' ";
}
var dataList = MsKfJhDAL.GetDataList(contmp, Convert.ToString(Session["USERID"]), CookieConfig.GetCookie_UserCode(Request), CookieConfig.GetCookie_OrgCode(Request));
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 };
}
//
// GET/TruckMng/MsKfJh/GetData/
public ContentResult GetDataTyre(string handle, string condition)
{
MsKfJhHead headData = null;
if (handle == "edit")
{
var list = MsKfJhDAL.GetDataList(condition, Convert.ToString(Session["USERID"]), CookieConfig.GetCookie_UserCode(Request), CookieConfig.GetCookie_OrgCode(Request));
if (list.Count > 0)
headData = list[0];
}
if (headData == null)
{
headData = new MsKfJhHead();
headData.PluType = "1";
headData.OrgCode = CookieConfig.GetCookie_OrgCode(Request);
headData.CkCode = "*";
}
var json = JsonConvert.Serialize(
new { Success = true, Message = "查询成功", data = headData });
return new ContentResult() { Content = json };
}
//
// GET/TruckMng/MsKfJh/GetData/
public ContentResult GetDataTyreGd(string handle, string condition)
{
MsKfJhHead headData = null;
if (handle == "edit")
{
var list = MsKfJhDAL.GetDataList(condition, Convert.ToString(Session["USERID"]), CookieConfig.GetCookie_UserCode(Request), CookieConfig.GetCookie_OrgCode(Request));
if (list.Count > 0)
headData = list[0];
}
if (headData == null)
{
headData = new MsKfJhHead();
headData.PluType = "2";
headData.OrgCode = CookieConfig.GetCookie_OrgCode(Request);
headData.CkCode = "*";
}
var json = JsonConvert.Serialize(
new { Success = true, Message = "查询成功", data = headData });
return new ContentResult() { Content = json };
}
//
// GET/TruckMng/MsKfJh/GetData/
public ContentResult GetData(string handle, string condition)
{
MsKfJhHead headData = null;
if (handle == "edit")
{
var list = MsKfJhDAL.GetDataList(condition, Convert.ToString(Session["USERID"]), CookieConfig.GetCookie_UserCode(Request), CookieConfig.GetCookie_OrgCode(Request));
if (list.Count > 0)
headData = list[0];
}
if (headData == null)
{
headData = new MsKfJhHead();
}
var json = JsonConvert.Serialize(
new { Success = true, Message = "查询成功", data = headData });
return new ContentResult() { Content = json };
}
//
// GET/TruckMng/MsKfJh/Save
public ContentResult Save(string opstatus, string data, string body, string delbody)
{
var headData = JsonConvert.Deserialize<MsKfJhHead>(data);
var bodyList = JsonConvert.Deserialize<List<MsKfJhBody>>(body);
var bodyDelList = JsonConvert.Deserialize<List<MsKfJhBody>>(delbody);
if (opstatus == "add")
{
headData.DbOperationType = DbOperationType.DbotIns;
headData.ModelUIStatus = "I";
headData.BillNo = PubSysDAL.GetBillNo("0106");
headData.UserCode = CookieConfig.GetCookie_UserCode(Request);
headData.UserName = CookieConfig.GetCookie_UserName(Request);
headData.OrgCode = CookieConfig.GetCookie_OrgCode(Request);
headData.OrgName = CookieConfig.GetCookie_OrgName(Request);
headData.LrDate = DateTime.Now;
}
else if (opstatus == "edit")
{
headData.DbOperationType = DbOperationType.DbotUpd;
headData.ModelUIStatus = "E";
}
else
{
headData.DbOperationType = DbOperationType.DbotDel;
}
var modb = new ModelObjectRepository();
DBResult result = modb.Save(headData,
ModelObjectConvert<MsKfJhBody>.ToModelObjectList(bodyList),
ModelObjectConvert<MsKfJhBody>.ToModelObjectList(bodyDelList));
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = MsKfJhDAL.GetHeadDataByBillNo(headData.BillNo, Convert.ToString(Session["USERID"]), CookieConfig.GetCookie_UserCode(Request), CookieConfig.GetCookie_OrgCode(Request))
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
//
// GET/TruckMng/MsKfJh/Delete
public ContentResult Delete(string data)
{
var headData = JsonConvert.Deserialize<MsKfJhHead>(data);
var modb = new ModelObjectDB();
DBResult result = modb.Delete(headData, "delete from tMsKfJhBody where BillNo='" + headData.BillNo + "'");
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult GetBodyList(string billno)
{
var condition = " BillNo='" + billno + "' ";
List<MsKfJhBody> list = MsKfJhDAL.GetBodyList(condition);
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = list.Count, data = list.ToList() });
return new ContentResult() { Content = json };
}
public ContentResult GetBodyInfoList(string condition)
{
List<MsKfJhBody> list = MsKfJhDAL.GetBodyList(condition);
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = list.Count, data = list.ToList() });
return new ContentResult() { Content = json };
}
#region 参照部分
#endregion
}
}