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/MsOpBillController.cs

214 lines
8.9 KiB
C#

3 years ago
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.OleDb;
using System.IO;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using DSWeb.MvcShipping.Comm.Cookie;
using DSWeb.MvcShipping.Helper;
using DSWeb.MvcShipping.Helper.Repository;
using DSWeb.MvcShipping.Models.MsOpBill;
using DSWeb.MvcShipping.Models.MsOpHistry;
using DSWeb.Areas.MvcShipping.DAL;
using HcUtility.Comm;
using HcUtility.Core;
using DSWeb.Areas.CommMng.DAL;
using DSWeb.Areas.RptMng.Comm;
using DSWeb.MvcShipping.DAL.MsSysParamSet;
namespace DSWeb.MvcShipping.Controllers
{
/// <summary>
/// 业务综合台账信息
/// </summary>
[JsonRequestBehavior]
public class MsOpBillController : Controller
{
public ActionResult MsFeeHistoryView()
{
return View();
}
public ActionResult MsOpHistoryView()
{
return View();
}
public ActionResult MsOpFeeView()
{
return View();
}
public ActionResult MsOpQQCTBILLView()
{
return View();
}
public ActionResult CtnStatusView()
{
return View();
}
public ContentResult GetBLListData(int start, int limit, string sort, string condition)
{
var dataList = MsOpBillDAL.GetDataList(condition, 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 };
}
public ContentResult GetBLData(string condition)
{
MsOpBill head = MsOpBillDAL.GetData(condition);
var json = JsonConvert.Serialize(
new { Success = true, Message = "查询成功", data = head });
return new ContentResult() { Content = json };
}
public ContentResult GetHistryListData(int start, int limit, string sort, string condition)
{
var dataList = MsOpBillDAL.GetHistryDataList(condition, 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 };
}
public ContentResult GetHistryData(string condition)
{
MsOpHistry head = MsOpBillDAL.GetHistryData(condition);
return new ContentResult() { Content = head.BSTEXT};
}
public ContentResult GetHistryDetailData(string condition)
{
MsOpHistry head = MsOpBillDAL.GetHistryDetailData(condition);
return new ContentResult() { Content = head.BSTEXT };
}
public ContentResult GetFeeDoList(string condition, string dotype)
{
var dataList = MsOpBillDAL.GetFeeDoList(condition, dotype);
var json = JsonConvert.Serialize(
new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
return new ContentResult() { Content = json };
}
public ContentResult GetInvHXFeeDoList(string condition)
{
var dataList = MsOpBillDAL.GetInvHXFeeDoList(condition);
var json = JsonConvert.Serialize(
new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
return new ContentResult() { Content = json };
}
public ContentResult GetCtnStatus(int start, int limit, string mblno, string bsno, string sort)
{
var strSql = new StringBuilder();
var USEYDW = MsSysParamSetDAL.GetData("PARAMNAME='USEYDW'");
if (USEYDW.PARAMVALUE == "1")
{
strSql.Append("SELECT '"+ mblno + "' MBLNO,CNTRNO,SEALNO,C.TiXiangShiJian TXSJ,C.FanChangShiJian FCSJ,c.JiGangShiJian JGSJ,TRUCKNO,c.DaoGangShiJian DGSJ,c.TiHuoShiJian THSJ,c.FanKongShiJian FKSJ ");
strSql.Append(",'' AS HZSJ ");
strSql.Append(",(SELECT TOP 1 COMPTIME FROM op_status WHERE BSNO='" + bsno + "' AND [STATUS]='海关放行' ) AS HGFX ");
strSql.Append(",(SELECT TOP 1 COMPTIME FROM op_status WHERE BSNO='" + bsno + "' AND [STATUS]='装船出运' ) AS ZCCY ");
strSql.Append("FROM OP_CTN C WHERE C.MBLNO='" + mblno + "' ");
}
else
{
strSql.Append("SELECT C.MBLNO,C.XiangHao CNTRNO,C.FengHao SEALNO,C.TiXiangShiJian TXSJ,C.FanChangShiJian FCSJ,c.JiGangShiJian JGSJ,c.CheHao TRUCKNO ");
strSql.Append(",ZhongZhuanXieChuan,ZhongZhuanZhuangChuan,MuDiGangDaoGang,MuDiGangTiXiang,MuDiGangFanXiang ");
strSql.Append(",(SELECT TOP 1 Y.HZSJ FROM QdPortDanPiaoChuKouYDBG Y WHERE Y.TDH='" + mblno + "' ) AS HZSJ ");
strSql.Append(",MuDiGangDaoGang AS DGSJ ");
strSql.Append(",MuDiGangTiXiang AS THSJ ");
strSql.Append(",(SELECT TOP 1 COMPTIME FROM op_status WHERE BSNO='" + bsno + "' AND [STATUS]='海关放行' ) AS HGFX ");
strSql.Append(",(SELECT TOP 1 COMPTIME FROM op_status WHERE BSNO='" + bsno + "' AND [STATUS]='装船出运' ) AS ZCCY ");
strSql.Append(",MuDiGangFanXiang AS FKSJ ");
strSql.Append("FROM PYChangZhanXiangHaoData C WHERE C.MBLNO='" + mblno + "' ");
}
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(start, limit, dbRptResult, "Result_Set", true);
return new ContentResult() { Content = json };
}
public ContentResult GetCtnStatus2(int start, int limit, string mblno, string bsno, string sort)
{
var strSql = new StringBuilder();
var USEYDW = MsSysParamSetDAL.GetData("PARAMNAME='USEYDW'");
if (USEYDW.PARAMVALUE == "1")
{
strSql.Append("SELECT P.CTNALL,P.PKGS,P.KGS,P.CBM,P.CNTRNO,P.SEALNO,P.TiXiangShiJian TXSJ,P.FanChangShiJian FCSJ,P.JiGangShiJian JGSJ,P.TRUCKNO,P.DaoGangShiJian DGSJ,P.TiHuoShiJian THSJ,P.FanKongShiJian FKSJ ");
strSql.Append("from OP_CTN P LEFT JOIN OP_SEAE B ON (P.BSNO=B.BSNO) WHERE B.MBLNO='" + mblno + "' ");
}
else
{
strSql.Append("SELECT CASE WHEN P.CTNALL IS NULL THEN C.Xiangxing ELSE P.CTNALL END CTNALL,P.PKGS,P.KGS,P.CBM,C.XiangHao CNTRNO,C.FengHao SEALNO,C.TiXiangShiJian TXSJ,C.FanChangShiJian FCSJ,c.JiGangShiJian JGSJ,c.CheHao TRUCKNO ");
strSql.Append(",(SELECT TOP 1 DaoGangShiJian FROM op_ctn WHERE BSNO='" + bsno + "' AND CNTRNO=c.XiangHao ) AS DGSJ ");
strSql.Append(",(SELECT TOP 1 TiHuoShiJian FROM op_ctn WHERE BSNO='" + bsno + "' AND CNTRNO=c.XiangHao ) AS THSJ ");
strSql.Append(",(SELECT TOP 1 FanKongShiJian FROM op_ctn WHERE BSNO='" + bsno + "' AND CNTRNO=c.XiangHao ) AS FKSJ ");
strSql.Append("FROM PYChangZhanXiangHaoData C ");
strSql.Append("LEFT JOIN OP_CTN P ON (P.CNTRNO=C.XiangHao) WHERE C.MBLNO='" + mblno + "' ");
}
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(start, limit, dbRptResult, "Result_Set", true);
return new ContentResult() { Content = json };
}
public ContentResult GetOpStatusData(string bsno)
{
MsOpSeaeBillTrack head = null;
head = MsOpBillDAL.GetOpStatusData(bsno);
var json = JsonConvert.Serialize(
new { Success = true, Message = "查询成功", data = head });
return new ContentResult() { Content = json };
}
}
}