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.CommMng.DAL; using DSWeb.Areas.TruckMng.DAL; using DSWeb.Areas.TruckMng.DAL.MsRptPcHeadEdit; using DSWeb.Areas.TruckMng.Models.MsWlBs; using DSWeb.TruckMng.Helper; using HcUtility.Comm; using DSWeb.Areas.CommMng.Models; using Microsoft.Practices.EnterpriseLibrary.Data; using DSWeb.TruckMng.Comm.Cookie; using DSWeb.EntityDA; using DSWeb.TruckMng.Helper.Repository; using DSWeb.MvcShipping.DAL.MsSysBillNoSet; using DSWeb.MvcShipping.DAL.MsBaseInfoDAL; namespace DSWeb.Areas.TruckMng.Controllers { /// /// 路单查询 派车计划 /// [JsonRequestBehavior] public class MsRptPcHeadEditController : Controller { // // GET: /RptMng/MsRptPcHeadQry public ActionResult Index() { return View(); } public ContentResult GetDataList ( int start, int limit, string sort, string condition ) { var dataList = MsRptPcHeadEditDAL.GetDataList(condition, sort); var list = dataList.Skip(start).Take(limit); List contentList = list.ToList(); List tailList = MsRptPcHeadEditDAL.AddTail(contentList); //var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = list.ToList() }); var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = tailList }); return new ContentResult() { Content = json }; } public ContentResult SaveList ( string data ) { var dataList = JsonConvert.Deserialize>(data); foreach (var _d in dataList){ if ( !string.IsNullOrEmpty(_d.ExpDate)){ _d.ExpDate = _d.ExpDate.Replace("T", " "); } if ( !string.IsNullOrEmpty(_d.EndPortDate)) { _d.EndPortDate = _d.EndPortDate.Substring(0, 10); } if (!string.IsNullOrEmpty(_d.OrgCode)) { _d.OrgCode = CookieConfig.GetCookie_OrgCode(Request); } if (_d.BillNo == "" || _d.BillNo == "*") { _d.DbOperationType = DbOperationType.DbotIns; _d.ModelUIStatus = "I"; var billnoset = MsSysBillNoSetDAL.GetData("OPLBNAME='陆运派车'", Convert.ToString(Session["COMPANYID"])); if (billnoset.BILLTYPE == "") billnoset.BILLTYPE = "0111"; if (billnoset.RULEDATETYPE == "") billnoset.RULEDATETYPE = "业务日期"; var bsdate = _d.ExpDate; if (bsdate == "" || bsdate == null) bsdate = DateTime.Now.ToString("yyyy-MM-dd"); _d.BillNo = MsSysBillNoSetDAL.GetBillNo(billnoset, bsdate, DateTime.Now.ToString("yyyy-MM")); //获取合同号 //_d.BillNo = MsRptPcHeadEditDAL.getCodeRule("路单编号", "BillNo", DateTime.Now.ToString(), DateTime.Now.ToString(), Convert.ToString(Session["USERID"]), Convert.ToString(Session["COMPANYID"])); _d.GId = "PC_" + Guid.NewGuid().ToString("N").ToUpper(); } else { _d.DbOperationType = DbOperationType.DbotUpd; _d.ModelUIStatus = "E"; } if (!string.IsNullOrEmpty(_d.ArriveDate)) { if (_d.ArriveDate.Length > 10) { _d.ArriveDate = _d.ArriveDate.Substring(0, 10); } } } var result = new DBResult(); var _L = ModelObjectConvert.ToModelObjectList(dataList); //var _DL = ModelObjectConvert.ToModelObjectList(DeldataList); var modb = new ModelObjectRepository(); result = modb.SaveHead(_L); //刷新父窗口上的父节点 var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message, //Data = XXHDAL.GetData("M.ContractNo='" + head.ContractNo + "'") }; return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; } public ContentResult GetMuDiDi ( int start, int limit, string sort, string condition ) { var dataList = MsRptPcHeadEditDAL.GetMuDiDi(condition, 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 GetShifadi ( int start, int limit, string sort, string condition ) { var dataList = MsRptPcHeadEditDAL.GetShiFaDi(condition, 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 }; } #region 参照部分 #endregion } }