|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Web.Mvc;
|
|
|
|
|
using DSWeb.Areas.CommMng.DAL;
|
|
|
|
|
using DSWeb.Areas.TruckMng.DAL.MsKfLy;
|
|
|
|
|
using DSWeb.Areas.TruckMng.Models.MsKfLy;
|
|
|
|
|
using DSWeb.TruckMng.Comm.Cookie;
|
|
|
|
|
using DSWeb.TruckMng.Helper;
|
|
|
|
|
using DSWeb.TruckMng.Helper.Repository;
|
|
|
|
|
using HcUtility.Comm;
|
|
|
|
|
using HcUtility.Core;
|
|
|
|
|
using DSWeb.SoftMng.Filter;
|
|
|
|
|
|
|
|
|
|
namespace DSWeb.Areas.TruckMng.Controllers
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 配件申领单
|
|
|
|
|
/// </summary>
|
|
|
|
|
[JsonRequestBehavior]
|
|
|
|
|
public class MsKfLyController : Controller
|
|
|
|
|
{
|
|
|
|
|
//
|
|
|
|
|
// GET: /TruckMng/MsKfLy/
|
|
|
|
|
|
|
|
|
|
public ActionResult Index()
|
|
|
|
|
{
|
|
|
|
|
return View();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// GET: /TruckMng/MsKfLy/Edit
|
|
|
|
|
|
|
|
|
|
public ActionResult Edit()
|
|
|
|
|
{
|
|
|
|
|
return View();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ActionResult HCIndex()
|
|
|
|
|
{
|
|
|
|
|
return View();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// GET: /TruckMng/MsKfLy/Edit
|
|
|
|
|
|
|
|
|
|
public ActionResult HCEdit()
|
|
|
|
|
{
|
|
|
|
|
return View();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// GET: /TruckMng/MsKfLy/IndexTyre
|
|
|
|
|
|
|
|
|
|
public ActionResult IndexTyre()
|
|
|
|
|
{
|
|
|
|
|
return View();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// GET: /TruckMng/MsKfLy/EditTyre
|
|
|
|
|
|
|
|
|
|
public ActionResult EditTyre()
|
|
|
|
|
{
|
|
|
|
|
return View();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// GET:/TruckMng/MsKfLy/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 = MsKfLyDAL.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/MsKfLy/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 = MsKfLyDAL.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/MsKfLy/GetDataTyre/
|
|
|
|
|
|
|
|
|
|
public ContentResult GetDataTyre(string handle, string condition)
|
|
|
|
|
{
|
|
|
|
|
MsKfLyHead headData = null;
|
|
|
|
|
|
|
|
|
|
if (handle == "edit")
|
|
|
|
|
{
|
|
|
|
|
var list = MsKfLyDAL.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 MsKfLyHead();
|
|
|
|
|
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/MsKfLy/GetData/
|
|
|
|
|
|
|
|
|
|
public ContentResult GetData(string handle, string condition)
|
|
|
|
|
{
|
|
|
|
|
MsKfLyHead headData = null;
|
|
|
|
|
|
|
|
|
|
if (handle == "edit")
|
|
|
|
|
{
|
|
|
|
|
var list = MsKfLyDAL.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 MsKfLyHead();
|
|
|
|
|
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/MsKfLy/Save
|
|
|
|
|
|
|
|
|
|
public ContentResult Save(string opstatus, string data, string body, string delbody)
|
|
|
|
|
{
|
|
|
|
|
var headData = JsonConvert.Deserialize<MsKfLyHead>(data);
|
|
|
|
|
var bodyList = JsonConvert.Deserialize<List<MsKfLyBody>>(body);
|
|
|
|
|
var bodyDelList = JsonConvert.Deserialize<List<MsKfLyBody>>(delbody);
|
|
|
|
|
|
|
|
|
|
if (opstatus == "add")
|
|
|
|
|
{
|
|
|
|
|
headData.DbOperationType = DbOperationType.DbotIns;
|
|
|
|
|
headData.ModelUIStatus = "I";
|
|
|
|
|
|
|
|
|
|
headData.BillNo = PubSysDAL.GetBillNo("0107");
|
|
|
|
|
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<MsKfLyBody>.ToModelObjectList(bodyList),
|
|
|
|
|
ModelObjectConvert<MsKfLyBody>.ToModelObjectList(bodyDelList));
|
|
|
|
|
|
|
|
|
|
var jsonRespose = new JsonResponse
|
|
|
|
|
{
|
|
|
|
|
Success = result.Success,
|
|
|
|
|
Message = result.Message,
|
|
|
|
|
Data = MsKfLyDAL.GetHeadDataByBillNo(headData.BillNo, Convert.ToString(Session["USERID"]), CookieConfig.GetCookie_UserCode(Request), CookieConfig.GetCookie_OrgCode(Request))
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// GET:/TruckMng/MsKfLy/Delete
|
|
|
|
|
|
|
|
|
|
public ContentResult Delete(string data)
|
|
|
|
|
{
|
|
|
|
|
var headData = JsonConvert.Deserialize<MsKfLyHead>(data);
|
|
|
|
|
|
|
|
|
|
var modb = new ModelObjectDB();
|
|
|
|
|
DBResult result = modb.Delete(headData, "delete from tMsKfLyBody 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<MsKfLyBody> list = MsKfLyDAL.GetBodyList(condition);
|
|
|
|
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = list.Count, data = list.ToList() });
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 参照部分
|
|
|
|
|
|
|
|
|
|
public ContentResult GetTruckNoList(string condition)
|
|
|
|
|
{
|
|
|
|
|
var list = MsKfLyDAL.GetTruckNoList(Convert.ToString(Session["USERID"]), CookieConfig.GetCookie_UserCode(Request), CookieConfig.GetCookie_OrgCode(Request));
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", data = list.ToList() });
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ContentResult GetPriceJxCountList(string PluCode)
|
|
|
|
|
{
|
|
|
|
|
var list = MsKfLyDAL.GetPriceJxCountList(PluCode, CookieConfig.GetCookie_OrgCode(Request));
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", data = list.ToList() });
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ContentResult GetPrice(string PluCode)
|
|
|
|
|
{
|
|
|
|
|
var list = MsKfLyDAL.GetPrice(PluCode, CookieConfig.GetCookie_OrgCode(Request));
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", data = list.ToList() });
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|