|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Web.Mvc;
|
|
|
|
|
using DSWeb.Areas.CommMng.DAL;
|
|
|
|
|
using DSWeb.Areas.TruckMng.DAL.MsWlDjPc;
|
|
|
|
|
using DSWeb.Areas.TruckMng.Models.Comm;
|
|
|
|
|
using DSWeb.Areas.TruckMng.Models.MsWlDjPc;
|
|
|
|
|
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 MsWlDjPcController : Controller
|
|
|
|
|
{
|
|
|
|
|
//
|
|
|
|
|
// GET: /TruckMng/MsWlDjPc/
|
|
|
|
|
|
|
|
|
|
public ActionResult Index()
|
|
|
|
|
{
|
|
|
|
|
return View();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// GET: /TruckMng/MsWlDjPc/Edit
|
|
|
|
|
|
|
|
|
|
public ActionResult Edit()
|
|
|
|
|
{
|
|
|
|
|
return View();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// GET:/TruckMng/MsWlDjPc/GetDataList
|
|
|
|
|
|
|
|
|
|
public ContentResult GetDataList(int start, int limit, string sort, string condition)
|
|
|
|
|
{
|
|
|
|
|
var sqlwhere = condition;
|
|
|
|
|
if (!string.IsNullOrEmpty(condition))
|
|
|
|
|
sqlwhere += " and ";
|
|
|
|
|
sqlwhere += " PcBillType='2'";
|
|
|
|
|
|
|
|
|
|
var dataList = MsWlDjPcDAL.GetDataList(sqlwhere,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/MsWlDjPc/GetData/
|
|
|
|
|
|
|
|
|
|
public ContentResult GetData(string handle, string condition)
|
|
|
|
|
{
|
|
|
|
|
MsWlPcHead headData = null;
|
|
|
|
|
|
|
|
|
|
if (handle == "edit")
|
|
|
|
|
{
|
|
|
|
|
var list = MsWlDjPcDAL.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 MsWlPcHead();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var json = JsonConvert.Serialize(
|
|
|
|
|
new { Success = true, Message = "查询成功", data = headData });
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ContentResult GetBodyList(string billno)
|
|
|
|
|
{
|
|
|
|
|
var condition = " BillNo='" + billno + "' ";
|
|
|
|
|
List<MsWlDjPound> list = MsWlDjPcDAL.GetBodyList(condition);
|
|
|
|
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = list.Count, data = list.ToList() });
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ContentResult GetFeeFixBodyList(string billno)
|
|
|
|
|
{
|
|
|
|
|
var condition = " BillNo='" + billno + "'";
|
|
|
|
|
List<MsWlPcFixed> list = MsWlDjPcDAL.GetFixBodyList(condition);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = list.Count, data = list.ToList() });
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// GET:/TruckMng/MsWlDjPc/Save
|
|
|
|
|
public ContentResult Save(string opstatus, string data, string poundbody, string pounddelbody,
|
|
|
|
|
string fixbody, string fixdelbody, string chfeebody, string chfeedelbody)
|
|
|
|
|
{
|
|
|
|
|
var head = JsonConvert.Deserialize<MsWlPcHead>(data);
|
|
|
|
|
var poundBodyList = JsonConvert.Deserialize<List<MsWlDjPound>>(poundbody);
|
|
|
|
|
var poundBodyDelList = JsonConvert.Deserialize<List<MsWlDjPound>>(pounddelbody);
|
|
|
|
|
var fixBodyList = JsonConvert.Deserialize<List<MsWlPcFixed>>(fixbody);
|
|
|
|
|
var fixBodyDelList = JsonConvert.Deserialize<List<MsWlPcFixed>>(fixdelbody);
|
|
|
|
|
var chfeeBodyList = JsonConvert.Deserialize<List<MsChFee>>(chfeebody);
|
|
|
|
|
var chfeeBodyDelList = JsonConvert.Deserialize<List<MsChFee>>(chfeedelbody);
|
|
|
|
|
|
|
|
|
|
head.TotalMil = head.NoLoadMil + head.OverLoadMil;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (opstatus == "add")
|
|
|
|
|
{
|
|
|
|
|
head.BillNo = PubSysDAL.GetBillNo("0111");
|
|
|
|
|
head.DbOperationType = DbOperationType.DbotIns;
|
|
|
|
|
head.ModelUIStatus = "I";
|
|
|
|
|
head.UserCode = CookieConfig.GetCookie_UserCode(Request);
|
|
|
|
|
head.UserName = CookieConfig.GetCookie_UserName(Request);
|
|
|
|
|
head.OrgCode = CookieConfig.GetCookie_OrgCode(Request);
|
|
|
|
|
head.OrgName = CookieConfig.GetCookie_OrgName(Request);
|
|
|
|
|
head.LrDate = DateTime.Now;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
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<MsWlDjPound>.ToModelObjectList(poundBodyList),
|
|
|
|
|
ModelObjectConvert<MsWlDjPound>.ToModelObjectList(poundBodyDelList)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
DBResult result = modb.Save(head,
|
|
|
|
|
ModelObjectConvert<MsWlDjPound>.ToModelObjectList(poundBodyList),
|
|
|
|
|
ModelObjectConvert<MsWlDjPound>.ToModelObjectList(poundBodyDelList),
|
|
|
|
|
ModelObjectConvert<MsWlPcFixed>.ToModelObjectList(fixBodyList),
|
|
|
|
|
ModelObjectConvert<MsWlPcFixed>.ToModelObjectList(fixBodyDelList),
|
|
|
|
|
ModelObjectConvert<MsChFee>.ToModelObjectList(chfeeBodyList),
|
|
|
|
|
ModelObjectConvert<MsChFee>.ToModelObjectList(chfeeBodyDelList));
|
|
|
|
|
|
|
|
|
|
var jsonRespose = new JsonResponse
|
|
|
|
|
{
|
|
|
|
|
Success = result.Success,
|
|
|
|
|
Message = result.Message,
|
|
|
|
|
Data = MsWlDjPcDAL.GetHeadDataByBillNo(head.BillNo, Convert.ToString(Session["USERID"]), CookieConfig.GetCookie_UserCode(Request), CookieConfig.GetCookie_OrgCode(Request))
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ContentResult Delete(string data)
|
|
|
|
|
{
|
|
|
|
|
var head = JsonConvert.Deserialize<MsWlPcHead>(data);
|
|
|
|
|
|
|
|
|
|
var modb = new ModelObjectDBBill();
|
|
|
|
|
DBResult result = modb.Delete(head,
|
|
|
|
|
"delete from tMsWlDjPound where BillNo='" + head.BillNo + "'",
|
|
|
|
|
"delete from tMsWlBsFixed where BillNo='" + head.BillNo + "'",
|
|
|
|
|
"delete from ch_fee where BsNo='" + head.GId + "'");
|
|
|
|
|
|
|
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 参照部分
|
|
|
|
|
|
|
|
|
|
public ContentResult GetTruckNoList(string condition)
|
|
|
|
|
{
|
|
|
|
|
var list = MsWlDjPcDAL.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 GetDrvNameList(string condition)
|
|
|
|
|
{
|
|
|
|
|
var list = MsWlDjPcDAL.GetDrvNameList(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 GetDjBillNoList(string condition)
|
|
|
|
|
{
|
|
|
|
|
var list = MsWlDjPcDAL.GetDjBillNoList(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 GetTruckFuel(string truckNo, string loadType, decimal ton, decimal mil)
|
|
|
|
|
{
|
|
|
|
|
var fuel = MsWlDjPcDAL.GetTruckFuel(truckNo, loadType, ton, mil);
|
|
|
|
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", data = fuel });
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|