|
|
|
|
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;
|
|
|
|
|
using ICSharpCode.SharpZipLib.Zip;
|
|
|
|
|
using DSWeb.Areas.Import.DAL.ReceiptDoc;
|
|
|
|
|
|
|
|
|
|
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(",(SELECT TOP 1 Y.HZSJ FROM QdPortDanPiaoChuKouYDBG Y WHERE Y.TDH='" + mblno + "' ) AS HZSJ ");
|
|
|
|
|
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 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(",(SELECT TOP 1 FanKongShiJian FROM op_ctn WHERE BSNO='" + bsno + "' AND CNTRNO=c.XiangHao ) 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 };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ActionResult DownloadFileList(string data,string filetype)
|
|
|
|
|
{
|
|
|
|
|
var headData = JsonConvert.Deserialize<List<MsOpBill>>(data);
|
|
|
|
|
var ctnnos = "";
|
|
|
|
|
|
|
|
|
|
var usercode = CookieConfig.GetCookie_UserCode(Request);
|
|
|
|
|
var pathstr = "../../UploadFiles/ViewTmp/" + usercode + DateTime.Now.ToString("yyyyMMddHHmmssfff");
|
|
|
|
|
var filePath = Server.MapPath(pathstr);
|
|
|
|
|
var zipfilename = DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".zip";
|
|
|
|
|
var destFile = filePath + "\\" + zipfilename;
|
|
|
|
|
if (!Directory.Exists(filePath))
|
|
|
|
|
{
|
|
|
|
|
Directory.CreateDirectory(filePath);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (headData != null)
|
|
|
|
|
{
|
|
|
|
|
using (ZipFile zipFile = ZipFile.Create(destFile))
|
|
|
|
|
{
|
|
|
|
|
zipFile.BeginUpdate();
|
|
|
|
|
foreach (var enumValue in headData)
|
|
|
|
|
{
|
|
|
|
|
var doclist = ReceiptDocDAL.GetDocList("BSNO='" + enumValue.BSNO + "' and RECEIPTTYPE='"+ filetype + "'");
|
|
|
|
|
foreach (var doc in doclist)
|
|
|
|
|
{
|
|
|
|
|
if (!string.IsNullOrEmpty(doc.Driect_URL))
|
|
|
|
|
{
|
|
|
|
|
var tmpfile = Server.MapPath(doc.Driect_URL);
|
|
|
|
|
if (System.IO.File.Exists(tmpfile))
|
|
|
|
|
{
|
|
|
|
|
FileInfo fileInfo2 = new FileInfo(tmpfile);
|
|
|
|
|
fileInfo2.CopyTo(filePath + "\\" + doc.URL);
|
|
|
|
|
zipFile.Add(filePath + "\\" + doc.URL, doc.URL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
zipFile.CommitUpdate();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//FileStream fs = new FileStream(destFile, FileMode.Open);
|
|
|
|
|
//byte[] datazip = new byte[fs.Length];
|
|
|
|
|
//fs.Read(datazip, 0, datazip.Length);
|
|
|
|
|
//fs.Close();
|
|
|
|
|
//MemoryStream ms = new MemoryStream(datazip);
|
|
|
|
|
|
|
|
|
|
//Response.AddHeader("Content-Disposition", "attachment;fileName=" + zipfilename);
|
|
|
|
|
//Response.BinaryWrite(ms.ToArray());
|
|
|
|
|
FileInfo fileInfo = new FileInfo(destFile);
|
|
|
|
|
Response.Clear(); //清除缓冲区流中的所有内容输出
|
|
|
|
|
Response.ClearContent(); //清除缓冲区流中的所有内容输出
|
|
|
|
|
Response.ClearHeaders(); //清除缓冲区流中的所有头
|
|
|
|
|
Response.Buffer = true; //该值指示是否缓冲输出,并在完成处理整个响应之后将其发送
|
|
|
|
|
Response.AddHeader("Content-Disposition", "attachment;filename=" + zipfilename);
|
|
|
|
|
Response.AddHeader("Content-Length", fileInfo.Length.ToString());
|
|
|
|
|
Response.AddHeader("Content-Transfer-Encoding", "binary");
|
|
|
|
|
Response.ContentType = "application/unknow"; //获取或设置输出流的 HTTP MIME 类型
|
|
|
|
|
Response.ContentEncoding = System.Text.Encoding.GetEncoding("gb2312"); //获取或设置输出流的 HTTP 字符集
|
|
|
|
|
Response.TransmitFile(fileInfo.FullName);
|
|
|
|
|
Response.End();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { success = true, Message = "下载完成" });
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|