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.MvcShipping.DAL.WMS;
using DSWeb.MvcShipping.Models.WMS;
using DSWeb.TruckMng.Helper;
using HcUtility.Comm;
using HcUtility.Core;
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.MvcShipping.Controllers
{
///
/// 路单查询
///
[JsonRequestBehavior]
public class WMSPriceController : Controller
{
//
// GET: /RptMng/MsRptPcHeadQry
public ActionResult Index()
{
return View();
}
public ContentResult GetDataList ( int start, int limit, string sort, string condition )
{
var dataList = WMSDAL.GetPriceList(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 SaveList ( string data )
{
var dataList = JsonConvert.Deserialize>(data);
foreach (var _d in dataList){
if ( !string.IsNullOrEmpty(_d.PRICEDATE)){
_d.PRICEDATE = _d.PRICEDATE.Replace("T", " ");
}
if (_d.GID == "" || _d.GID == "*")
{
_d.DbOperationType = DbOperationType.DbotIns;
_d.ModelUIStatus = "I";
_d.GID = Guid.NewGuid().ToString("N").ToString();
}
else
{
_d.DbOperationType = DbOperationType.DbotUpd;
_d.ModelUIStatus = "E";
}
}
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 Delete ( string data )
{
var dataList = JsonConvert.Deserialize>(data);
var result = new DBResult();
foreach (var _d in dataList)
{
if (_d.GID == "" || _d.GID == "*")
{
}
else
{
//var _L = ModelObjectConvert.ToModelObjectList(dataList);
//var _DL = ModelObjectConvert.ToModelObjectList(DeldataList);
var modb = new ModelObjectDBBill();
result = modb.Delete(_d
/*,
"delete from tMsWlBsFixed where BillNo='" + head.BillNo + "'",
"delete from ch_fee where BsNo='" + head.GId + "'",
"delete from tcard_use where BillNo='" + head.BillNo + "'"*/);
}
}
//刷新父窗口上的父节点
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
//Data = XXHDAL.GetData("M.ContractNo='" + head.ContractNo + "'")
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
#region 参照部分
#endregion
}
}