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/MvcShipping/Controllers/WMSFeeModelController.cs

199 lines
7.4 KiB
C#

3 years ago
using System;
using System.Linq;
using System.Web.Mvc;
using DSWeb.MvcShipping.DAL.MsAnnounce;
using DSWeb.Areas.MvcShipping.DAL.WMSFeeModel;
using System.Collections.Generic;
using HcUtility.Comm;
using HcUtility.Core;
using System.Web.Script.Serialization;
using DSWeb.EntityDA;
using System.Data;
using System.Text;
using DSWeb.Areas.CommMng.Models;
using Microsoft.Practices.EnterpriseLibrary.Data;
using DSWeb.Areas.MvcShipping.DAL.Message;
using DSWeb.MvcShipping.DAL.MsSysBillNoSet;
using DSWeb.MvcShipping.DAL.MsCodeFtpSet;
using DSWeb.TruckMng.Comm.Cookie;
using DSWeb.TruckMng.Helper;
using DSWeb.TruckMng.Helper.Repository;
using DSWeb.Areas.MvcShipping.Models.WMSFeeModel;
using DSWeb.Areas.CommMng.DAL;
using DSWeb.Areas.RptMng.Comm;
namespace DSWeb.MvcShipping.Controllers
{
public class WMSFeeModelController : Controller
{
//
// GET:
public ActionResult Index ( )
{
return View();
}
//
// GET: /
public ActionResult Edit ( )
{
return View();
}
public ActionResult InEdit ( )
{
return View();
}
public ContentResult GetDataList ( int start, int limit, string sort, string condition )
{
int count = 0;
var dataList = WMSFeeModelDAL.GetDataList(condition);
var timeStamp = DateTime.Now.ToShortDateString();
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = count, data = dataList.ToList(), timeStamp = timeStamp });
return new ContentResult() { Content = json };
}
public ContentResult GetDataDetailsList ( string condition )
{
int count = 0;
var dataList = WMSFeeModelDAL.GetDataDetailsList(condition);
var timeStamp = DateTime.Now.ToShortDateString();
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = count, data = dataList.ToList(), timeStamp = timeStamp });
return new ContentResult() { Content = json };
}
public ContentResult GetLoaderFeeList(string condition)
{
var strSql = new StringBuilder();
strSql.Append("SELECT GID,PGID,GGID,FEETYPE,FEEDIRECTION,FEEUNIT,FEEPRICE ");
strSql.Append(" from WMS_FEEMODEL_LOADER");
if (!string.IsNullOrEmpty(condition))
{
strSql.Append(" Where " + condition);
}
var dbparams = new List<CustomDbParamter>();
var paramps_sSQL = new CustomDbParamter();
paramps_sSQL.ParameterName = "@sSQL";
paramps_sSQL.DbType = DbType.String;
paramps_sSQL.Direction = ParameterDirection.Input;
paramps_sSQL.Value = strSql.ToString();
dbparams.Add(paramps_sSQL);
var dbRptResult = PubSysDAL.GetMsSqlPrcDataSet("sMsExesqlQry", dbparams, "Result_Set");
var json = RptHelper.GetRptJsonResult(0, 20, dbRptResult, "Result_Set", true);
return new ContentResult() { Content = json };
}
public ContentResult GetData ( string handle, string condition )
{
WMSFeeModelModel head = null;
var timeStamp = DateTime.Now.ToShortDateString();
if (handle == "edit")
{
var wmsfee = WMSFeeModelDAL.GetDataList(condition);
if (wmsfee.Count>0)
{
head = wmsfee[0];
}
}
if (head == null)
{
head = new WMSFeeModelModel();
}
var json = JsonConvert.Serialize(
new { Success = true, Message = "查询成功", data = head, timeStamp = timeStamp });
return new ContentResult() { Content = json };
}
public ContentResult GetPinMing ( string condition )
{
int count = 0;
var dataList = WMSFeeModelDAL.GetPinMing(condition);
var timeStamp = DateTime.Now.ToShortDateString();
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = count, data = dataList.ToList(), timeStamp = timeStamp });
return new ContentResult() { Content = json };
}
public ContentResult Save ( string opstatus, string data, string details, string detailsDel,string loader,string loaderDel )
{
var head = JsonConvert.Deserialize<WMSFeeModelModel>(data);
var WMSFeeDetailsList = JsonConvert.Deserialize<List<WMSFeeModelDetails>>(details);
var WMSFeeDetailsDelList = JsonConvert.Deserialize<List<WMSFeeModelDetails>>(detailsDel);
var LoaderFeeList = JsonConvert.Deserialize<List<LOADERFEEMODEL>>(loader);
var LoaderFeeDelList = JsonConvert.Deserialize<List<LOADERFEEMODEL>>(loaderDel);
var jsonRespose = new JsonResponse();
string outMsg = "";
string gid = "";
jsonRespose.Success = WMSFeeModelDAL.Save(head, WMSFeeDetailsList, LoaderFeeList,out outMsg,out gid);
jsonRespose.Message = outMsg;
var respHead = WMSFeeModelDAL.GetDataList(" GID='" + gid + "'");
if (respHead!=null&&respHead.Count>0)
{
jsonRespose.Data = respHead[0];
}
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult CopyNew(string data)
{
var head = JsonConvert.Deserialize<WMSFeeModelModel>(data);
var jsonRespose = new JsonResponse();
string outMsg = "";
string gid = "";
jsonRespose.Success = WMSFeeModelDAL.CopyNew(head, out outMsg, out gid);
jsonRespose.Message = outMsg;
var respHead = WMSFeeModelDAL.GetDataList(" GID='" + gid + "'");
if (respHead != null && respHead.Count > 0)
{
jsonRespose.Data = respHead[0];
}
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult Delete(string data)
{
var headData = JsonConvert.Deserialize<WMSFeeModelModel>(data);
var loaderData = JsonConvert.Deserialize<LOADERFEEMODEL>(data);
DBResult result = WMSFeeModelDAL.DeleteDetail(headData);
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult DeleteDetail(string data)
{
var head = JsonConvert.Deserialize<WMSFeeModelDetails>(data);
var modb = new ModelObjectDB();
DBResult result = modb.Delete(head);
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult DeleteLoader(string data)
{
var head = JsonConvert.Deserialize<LOADERFEEMODEL>(data);
var modb = new ModelObjectDB();
DBResult result = modb.Delete(head);
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
}
}