|
|
using System;
|
|
|
using System.Linq;
|
|
|
using System.Text;
|
|
|
using System.Web.Mvc;
|
|
|
using DSWeb.MvcShipping.DAL.MsOpSeaeDAL;
|
|
|
using DSWeb.MvcShipping.DAL.MsOpSeaeEdiDAL;
|
|
|
using DSWeb.MvcShipping.Models.MsOpSeae;
|
|
|
using DSWeb.MvcShipping.Models.MsOpSeaeBill;
|
|
|
using DSWeb.MvcShipping.Helper;
|
|
|
using DSWeb.MvcShipping.Comm.Cookie;
|
|
|
using HcUtility.Comm;
|
|
|
using HcUtility.Core;
|
|
|
using System.Collections.Generic;
|
|
|
using DSWeb.MvcShipping.DAL.MsCodeFtpSet;
|
|
|
using DSWeb.MvcShipping.DAL.MsBaseInfoDAL;
|
|
|
using System.IO;
|
|
|
using System.Data;
|
|
|
using System.Data.OleDb;
|
|
|
using DSWeb.Areas.CommMng.DAL;
|
|
|
using DSWeb.Areas.RptMng.Comm;
|
|
|
using DSWeb.Areas.CommMng.Models;
|
|
|
using Microsoft.Office.Interop.Excel;
|
|
|
using DSWeb.MvcShipping.Models.MsOpApply;
|
|
|
|
|
|
using DSWeb.MvcShipping.DAL.MsSysBillNoSet;
|
|
|
using DSWeb.MvcShipping.Models.MsSysBillNoSet;
|
|
|
using DSWeb.MvcShipping.DAL.MsSysParamSet;
|
|
|
using DSWeb.MvcShipping.DAL.DsSendmail;
|
|
|
using DSWeb.MvcShipping.DAL.MsCompanysDAL;
|
|
|
using DSWeb.MvcShipping.DAL.MsChFeeDAL;
|
|
|
using System.Text.RegularExpressions;
|
|
|
using DSWeb.MvcShipping.DAL.MsInfoClient;
|
|
|
using DSWeb.MvcShipping.DAL.MsOpSeaiDAL;
|
|
|
using DSWeb.MvcShipping.Models.MsOpSeai;
|
|
|
using DSWeb.EntityDA;
|
|
|
using DSWeb.MvcShipping.DAL.MsCodeOpTemplate;
|
|
|
using DSWeb.SoftMng.DAL.SoftSysTable;
|
|
|
using DSWeb.MvcShipping.Models.MsOpSeaeToSeai;
|
|
|
using DSWeb.MvcShipping.Models.MsChFee;
|
|
|
using DSWeb.MvcShipping.Models.MsOpHistry;
|
|
|
using DSWeb.Areas.MvcShipping.DAL.Message.vgm;
|
|
|
using DSWeb.Areas.MvcShipping.DAL;
|
|
|
using System.Web.Script.Serialization;
|
|
|
using System.Web;
|
|
|
using System.Drawing;
|
|
|
using Newtonsoft.Json.Linq;
|
|
|
using DSWeb.MvcShipping.DAL.MsInfoClientMailProject;
|
|
|
using DSWeb.MvcShipping.Models.MsOpMailSend;
|
|
|
using System.Web.Configuration;
|
|
|
using DSWeb.Areas.MvcShipping.Comm;
|
|
|
using DSWeb.Areas.MvcShipping.DAL.BookingConfirm;
|
|
|
|
|
|
//using Discuz.Common;
|
|
|
|
|
|
namespace DSWeb.MvcShipping.Controllers
|
|
|
{
|
|
|
|
|
|
[JsonRequestBehavior]
|
|
|
public class MsOpSeaeController : Controller
|
|
|
{
|
|
|
private static string OPLISTNOCANCEL = MsSysParamSetDAL.GetData("PARAMNAME='OPLISTNOCANCEL'").PARAMVALUE;
|
|
|
|
|
|
#region 窗体
|
|
|
public ActionResult Index()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
|
|
|
|
|
|
public ActionResult Edit()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
public ActionResult SeaeEdit()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
|
|
|
public ActionResult SaleEdit()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
public ActionResult SaleIndex()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
|
|
|
public ActionResult FeeEdit()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
public ActionResult FenList()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
public ActionResult SeaeFeeView()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
public ActionResult FeeAmendEdit()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
public ActionResult ReceiptEdit()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
public ActionResult BillEdit()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
public ActionResult BillLSEdit()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
public ActionResult FenEdit()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
public ActionResult RptCtnList()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
|
|
|
public ActionResult PiLiangFeeEdit()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
public ActionResult PiLiangDoc()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
public ActionResult PiLiangFeeLREdit()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
public ActionResult PiLiangOpBillEdit()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
|
|
|
public ActionResult HistryFeeIndex()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
public ActionResult HistryBillIndex()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
public ActionResult HistryFenIndex()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
public ActionResult FenBillList()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
public ActionResult PiLiangFenFee()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
public ActionResult FenAdd()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
|
|
|
public ActionResult EditView()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
|
|
|
public ActionResult OpCtnDetailEdit()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
public ActionResult HistryOpSeaeIndex()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
|
|
|
public ActionResult TuiAudit()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
public ActionResult AmendIndex()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
public ActionResult AmendFeeEdit()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
public ActionResult CancelIndex()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
public ActionResult CancelCloseIndex()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
public ActionResult DuiView()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
public ActionResult TaskView()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
|
|
|
public ActionResult ModifyEdit()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region 查询
|
|
|
|
|
|
[HttpGet]
|
|
|
public ContentResult GetDataList(int start, int limit, string custname, string mobile, string mblno, string hblno, string shipper, string consignee, string portload, string destination, string cntrno, string goodsname, string etdfr, string etdto, string etafr, string etato, string portdischarge,string arrivalFlag="")
|
|
|
{
|
|
|
//string strstart =context.Request["start"];
|
|
|
//string strlimit =context.Request["limit"];
|
|
|
//if (strstart == null || strlimit == null)
|
|
|
//{
|
|
|
// var json2 = JsonConvert.Serialize(new { Success = false, Message = "参数有误1"});
|
|
|
// return new ContentResult() { Content = json2 };
|
|
|
//}
|
|
|
//int start = Convert.ToInt32(strstart);
|
|
|
//int limit = Convert.ToInt32(strlimit);
|
|
|
|
|
|
//string custname = context.Request["custname"];
|
|
|
//string mobile = context.Request["mobile"];
|
|
|
//string mblno = context.Request["mblno"];
|
|
|
//string hblno = context.Request["hblno"];
|
|
|
//string shipper = context.Request["shipper"];
|
|
|
//string consignee = context.Request["consignee"];
|
|
|
//string portload = context.Request["portload"];
|
|
|
//string destination = context.Request["destination"];
|
|
|
//string cntrno = context.Request["cntrno"];
|
|
|
//string goodsname = context.Request["goodsname"];
|
|
|
//string etdfr = context.Request["etdfr"];
|
|
|
//string etdto = context.Request["etdto"];
|
|
|
//string etafr = context.Request["etafr"];
|
|
|
//string etato = context.Request["etato"];
|
|
|
|
|
|
//
|
|
|
|
|
|
var condition = "";
|
|
|
if (!string.IsNullOrEmpty(custname))
|
|
|
{
|
|
|
condition = condition + " and (((CASE WHEN substring(OPERATORTEL,1,1)='0' THEN 'AAA' ELSE CUSTOMERNAME END)='" + custname + "') ";
|
|
|
condition = condition + "OR((CASE WHEN substring(OPERATORTEL, 2, 1) = '0' THEN 'AAA' ELSE SHIPPERID END) = '" + custname + "')";
|
|
|
condition = condition + "OR((CASE WHEN substring(OPERATORTEL, 3, 1) = '0' THEN 'AAA' ELSE CONSIGNEEID END) = '" + custname + "')";
|
|
|
condition = condition + "OR((CASE WHEN substring(OPERATORTEL, 4, 1) = '0' THEN 'AAA' ELSE NOTIFYPARTYID END) = '" + custname + "'))";
|
|
|
}
|
|
|
if (!string.IsNullOrEmpty(mblno))
|
|
|
{
|
|
|
condition = condition + " and MBLNO like '%" + mblno + "%'";
|
|
|
}
|
|
|
if (!string.IsNullOrEmpty(hblno))
|
|
|
{
|
|
|
condition = condition + " and HBLNO like '%" + hblno + "%'";
|
|
|
}
|
|
|
if (!string.IsNullOrEmpty(shipper))
|
|
|
{
|
|
|
condition = condition + " and shipper like '%" + shipper + "%'";
|
|
|
}
|
|
|
if (!string.IsNullOrEmpty(consignee))
|
|
|
{
|
|
|
condition = condition + " and consignee like '%" + consignee + "%'";
|
|
|
}
|
|
|
if (!string.IsNullOrEmpty(portload))
|
|
|
{
|
|
|
condition = condition + " and portload like '%" + portload + "%'";
|
|
|
}
|
|
|
if (!string.IsNullOrEmpty(destination))
|
|
|
{
|
|
|
condition = condition + " and destination like '%" + destination + "%'";
|
|
|
}
|
|
|
if (!string.IsNullOrEmpty(portdischarge))
|
|
|
{
|
|
|
condition = condition + " and PORTDISCHARGE like '%" + portdischarge + "%'";
|
|
|
}
|
|
|
if (!string.IsNullOrEmpty(cntrno))
|
|
|
{
|
|
|
condition = condition + " and CNTRSEALNO like '%" + cntrno + "%'";
|
|
|
}
|
|
|
if (!string.IsNullOrEmpty(goodsname))
|
|
|
{
|
|
|
condition = condition + " and goodsname like '%" + goodsname + "%'";
|
|
|
}
|
|
|
if (!string.IsNullOrEmpty(etdfr))
|
|
|
{
|
|
|
condition = condition + " and ETD>='" + etdfr + "'";
|
|
|
}
|
|
|
if (!string.IsNullOrEmpty(etdto))
|
|
|
{
|
|
|
condition = condition + " and ETD<='" + etdto + "'";
|
|
|
}
|
|
|
if (!string.IsNullOrEmpty(etafr))
|
|
|
{
|
|
|
condition = condition + " and ETA>='" + etafr + "'";
|
|
|
}
|
|
|
if (!string.IsNullOrEmpty(etato))
|
|
|
{
|
|
|
condition = condition + " and ETA<='" + etato + "'";
|
|
|
}
|
|
|
if (!string.IsNullOrEmpty(arrivalFlag))
|
|
|
{
|
|
|
if (arrivalFlag=="1")
|
|
|
condition = condition + " and EXISTS (select 1 from OP_STATUS WHERE OP_SEAE.BSNO=OP_STATUS.BSNO AND STATUS='ATA') ";
|
|
|
if (arrivalFlag == "0")
|
|
|
condition = condition + " and NOT EXISTS (select 1 from OP_STATUS WHERE OP_SEAE.BSNO=OP_STATUS.BSNO AND STATUS='ATA') ";
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var dataList = MsOpSeaeDAL.GetSeaeListDataList(start, limit, condition);
|
|
|
int count = MsOpSeaeDAL.getSeaeListTotalCount(condition);
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = count, data = dataList.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
public ContentResult GetSaleDataList(int start, int limit, string sort, string condition, string load)
|
|
|
{
|
|
|
if (Convert.ToString(Session["COMPANYID"]).ToString().Trim() == "" || Convert.ToString(Session["USERID"]).ToString().Trim() == "" || Convert.ToString(Session["CODENAME"]).ToString().Trim() == "" || Convert.ToString(Session["SHOWNAME"]).ToString().Trim() == "" || Convert.ToString(Session["DEPTNAME"]).ToString().Trim() == "")
|
|
|
{
|
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
}
|
|
|
var dataList = MsOpSeaeDAL.GetSaleDataList(condition, Convert.ToString(Session["SHOWNAME"]), sort, load, CookieConfig.GetCookie_UserId(Request), Convert.ToString(Session["COMPANYID"]));
|
|
|
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 GetAmendDataList(int start, int limit, string sort, string condition, string load)
|
|
|
{
|
|
|
// var dataList = MsOpSeaeDAL.GetDataList(condition, CookieConfig.GetCookie_UserId(Request), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), sort,load);
|
|
|
//var list = dataList.Skip(start).Take(limit);
|
|
|
|
|
|
var dataList = MsOpSeaeDAL.GetAmendDataList(start, limit, condition, CookieConfig.GetCookie_UserId(Request), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), sort);
|
|
|
int count = MsOpSeaeDAL.getAmendTotalCount(condition, CookieConfig.GetCookie_UserId(Request), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = count, data = dataList.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
public ContentResult GetAmendDataListStr(string sort, string condition)
|
|
|
{
|
|
|
var dataListStr = MsOpSeaeDAL.GetAmendDataStr(condition, CookieConfig.GetCookie_UserId(Request), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), sort);
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = dataListStr.Message, data = dataListStr.Data });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
public ContentResult GetDataListStr(string sort, string condition)
|
|
|
{
|
|
|
if (condition.IndexOf("ISCANCEL=1") >= 0) { }
|
|
|
else
|
|
|
{
|
|
|
//var OPLISTNOCANCEL = MsSysParamSetDAL.GetData("PARAMNAME='OPLISTNOCANCEL'");
|
|
|
if (OPLISTNOCANCEL == "1")
|
|
|
{
|
|
|
if (!string.IsNullOrEmpty(condition))
|
|
|
{
|
|
|
condition = condition + " and isnull(B.ISCANCEL,0)<>1 ";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
condition = " isnull(B.ISCANCEL,0)<>1 ";
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
var dataListStr = MsOpSeaeDAL.GetDataListStr(condition, CookieConfig.GetCookie_UserId(Request), CookieConfig.GetCookie_UserName(Request), Convert.ToString(Session["COMPANYID"]), sort);
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = dataListStr.Message, data = dataListStr.Data });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
public ContentResult GetDataListSum(int start, int limit, string sort, string condition)
|
|
|
{
|
|
|
var dataList = MsOpSeaeDAL.GetDataListSum(condition, CookieConfig.GetCookie_UserId(Request), CookieConfig.GetCookie_UserName(Request), Convert.ToString(Session["COMPANYID"]), 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 GetSaleDataListSum(int start, int limit, string sort, string condition)
|
|
|
{
|
|
|
var dataList = MsOpSeaeDAL.GetSaleDataListSum(condition, Convert.ToString(Session["SHOWNAME"]), 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 };
|
|
|
}
|
|
|
|
|
|
[HttpGet]
|
|
|
public ContentResult GetData(string mblno)
|
|
|
{
|
|
|
if (!string.IsNullOrEmpty(mblno))
|
|
|
{
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
var json2 = JsonConvert.Serialize(new { Success = false, Message = "提单号不能为空!" });
|
|
|
return new ContentResult() { Content = json2 };
|
|
|
}
|
|
|
MsOpSeae head = null;
|
|
|
head = MsOpSeaeDAL.GetData("MBLNO='"+mblno+"'");
|
|
|
|
|
|
var json = JsonConvert.Serialize(
|
|
|
new { Success = true, Message = "查询成功", data = head });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
|
|
|
public ContentResult GetAmendData(string condition)
|
|
|
{
|
|
|
MsOpSeae head = null;
|
|
|
|
|
|
var headlist = MsOpSeaeDAL.GetAmendDataList(0, 1, condition, CookieConfig.GetCookie_UserId(Request), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
|
|
|
if (headlist.Count > 0)
|
|
|
head = headlist[0];
|
|
|
else
|
|
|
head = new MsOpSeae();
|
|
|
|
|
|
var json = JsonConvert.Serialize(
|
|
|
new { Success = true, Message = "查询成功", data = head });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
public ContentResult GetCopyData(string handle, string condition, string copybill)
|
|
|
{
|
|
|
MsOpSeae head = null;
|
|
|
|
|
|
var oldhead = MsOpSeaeDAL.GetData(condition);
|
|
|
|
|
|
var copyfieldlist = MsCodeOpTemplateDAL.GetCodeOpTemplateDetail(" LINKGID in (select top 1 GID from CODE_OP_TEMPLATE where op='" + CookieConfig.GetCookie_UserId(Request) + "' or ISPUBLIC='是' order by ISPUBLIC)");
|
|
|
if (copyfieldlist.Count == 0)
|
|
|
{
|
|
|
head = oldhead;
|
|
|
head.BSNO = "topseae" + Guid.NewGuid().ToString();
|
|
|
head.MASTERNO = "";
|
|
|
head.CUSTNO = "";
|
|
|
head.ORDERNO = "";
|
|
|
head.ISCANCEL ="";
|
|
|
head.OP = Convert.ToString(Session["SHOWNAME"]);
|
|
|
head.INPUTBY = Convert.ToString(Session["SHOWNAME"]);
|
|
|
|
|
|
head.BSSTATUS = false;
|
|
|
head.FEESTATUS = false;
|
|
|
head.BSSTATUSREF = "未锁定";
|
|
|
head.FEESTATUSREF = "未锁定";
|
|
|
|
|
|
if (copybill == "true")
|
|
|
{
|
|
|
var billlist = MsOpSeaeDAL.GetBillList(condition);
|
|
|
if (billlist != null)
|
|
|
{
|
|
|
foreach (var enumValue in billlist)
|
|
|
{
|
|
|
enumValue.INPUTBY = Convert.ToString(Session["SHOWNAME"]);
|
|
|
enumValue.BSNO = head.BSNO;
|
|
|
enumValue.AS_ID = Guid.NewGuid().ToString();
|
|
|
enumValue.MBLNO = "";
|
|
|
enumValue.HBLNO = "";
|
|
|
enumValue.DbOperationType = DbOperationType.DbotIns;
|
|
|
var modb = new ModelObjectDB();
|
|
|
DBResult result = modb.Save(enumValue);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
|
|
|
if (head == null)
|
|
|
{
|
|
|
head = new MsOpSeae();
|
|
|
head.BSNO = "topseae" + Guid.NewGuid().ToString();
|
|
|
head.OP = Convert.ToString(Session["SHOWNAME"]);
|
|
|
head.DOC = Convert.ToString(Session["SHOWNAME"]);
|
|
|
head.INPUTBY = Convert.ToString(Session["SHOWNAME"]);
|
|
|
head.CUSTSERVICE = Convert.ToString(Session["SHOWNAME"]);
|
|
|
|
|
|
foreach (var enumValue in copyfieldlist)
|
|
|
{
|
|
|
|
|
|
|
|
|
if (enumValue.FIELDNAME == "ORDERTYPE") head.ORDERTYPE = oldhead.ORDERTYPE;
|
|
|
if (enumValue.FIELDNAME == "CUSTOMERNAME") head.CUSTOMERNAME = oldhead.CUSTOMERNAME;
|
|
|
if (enumValue.FIELDNAME == "BSSOURCEDETAIL") head.BSSOURCEDETAIL = oldhead.BSSOURCEDETAIL;
|
|
|
if (enumValue.FIELDNAME == "BSSOURCE") head.BSSOURCE = oldhead.BSSOURCE;
|
|
|
if (enumValue.FIELDNAME == "OP") head.OP = oldhead.OP;
|
|
|
if (enumValue.FIELDNAME == "CUSTSERVICE") head.CUSTSERVICE = oldhead.CUSTSERVICE;
|
|
|
if (enumValue.FIELDNAME == "SALE") head.SALE = oldhead.SALE;
|
|
|
if (enumValue.FIELDNAME == "VESSEL") head.VESSEL = oldhead.VESSEL;
|
|
|
if (enumValue.FIELDNAME == "VOYNO") head.VOYNO = oldhead.VOYNO;
|
|
|
if (enumValue.FIELDNAME == "ETD") head.ETD = oldhead.ETD;
|
|
|
if (enumValue.FIELDNAME == "ATD") head.ATD = oldhead.ATD;
|
|
|
if (enumValue.FIELDNAME == "PORTLOADID") head.PORTLOADID = oldhead.PORTLOADID;
|
|
|
if (enumValue.FIELDNAME == "PORTLOAD") head.PORTLOAD = oldhead.PORTLOAD;
|
|
|
if (enumValue.FIELDNAME == "PORTDISCHARGEID") head.PORTDISCHARGEID = oldhead.PORTDISCHARGEID;
|
|
|
if (enumValue.FIELDNAME == "PORTDISCHARGE") head.PORTDISCHARGE = oldhead.PORTDISCHARGE;
|
|
|
if (enumValue.FIELDNAME == "GOODSNAME") head.GOODSNAME = oldhead.GOODSNAME;
|
|
|
if (enumValue.FIELDNAME == "CONTRACTNO") head.CONTRACTNO = oldhead.CONTRACTNO;
|
|
|
if (enumValue.FIELDNAME == "KGS") head.KGS = oldhead.KGS;
|
|
|
if (enumValue.FIELDNAME == "PKGS") head.PKGS = oldhead.PKGS;
|
|
|
if (enumValue.FIELDNAME == "KINDPKGS") head.KINDPKGS = oldhead.KINDPKGS;
|
|
|
if (enumValue.FIELDNAME == "REMARK") head.REMARK = oldhead.REMARK;
|
|
|
if (enumValue.FIELDNAME == "YARD") head.YARD = oldhead.YARD;
|
|
|
if (enumValue.FIELDNAME == "YARDATTN") head.YARDATTN = oldhead.YARDATTN;
|
|
|
if (enumValue.FIELDNAME == "YARDTEL") head.YARDTEL = oldhead.YARDTEL;
|
|
|
if (enumValue.FIELDNAME == "BLTYPE") head.BLTYPE = oldhead.BLTYPE;
|
|
|
if (enumValue.FIELDNAME == "CBM") head.CBM = oldhead.CBM;
|
|
|
if (enumValue.FIELDNAME == "CARRIER") head.CARRIER = oldhead.CARRIER;
|
|
|
if (enumValue.FIELDNAME == "TRUCKER") head.TRUCKER = oldhead.TRUCKER;
|
|
|
if (enumValue.FIELDNAME == "CUSTOMSNUM") head.CUSTOMSNUM = oldhead.CUSTOMSNUM;
|
|
|
if (enumValue.FIELDNAME == "NOPKGS") head.NOPKGS = oldhead.NOPKGS;
|
|
|
if (enumValue.FIELDNAME == "GROSSWEIGHT") head.GROSSWEIGHT = oldhead.GROSSWEIGHT;
|
|
|
if (enumValue.FIELDNAME == "MEASUREMENT") head.MEASUREMENT = oldhead.MEASUREMENT;
|
|
|
if (enumValue.FIELDNAME == "DESCRIPTION") head.DESCRIPTION = oldhead.DESCRIPTION;
|
|
|
if (enumValue.FIELDNAME == "TOTALNO") head.TOTALNO = oldhead.TOTALNO;
|
|
|
if (enumValue.FIELDNAME == "TRANSNO") head.TRANSNO = oldhead.TRANSNO;
|
|
|
if (enumValue.FIELDNAME == "SHIPPERID") head.SHIPPERID = oldhead.SHIPPERID;
|
|
|
if (enumValue.FIELDNAME == "CONSIGNEEID") head.CONSIGNEEID = oldhead.CONSIGNEEID;
|
|
|
if (enumValue.FIELDNAME == "NOTIFYPARTYID") head.NOTIFYPARTYID = oldhead.NOTIFYPARTYID;
|
|
|
if (enumValue.FIELDNAME == "SHIPPER") head.SHIPPER = oldhead.SHIPPER;
|
|
|
if (enumValue.FIELDNAME == "CONSIGNEE") head.CONSIGNEE = oldhead.CONSIGNEE;
|
|
|
if (enumValue.FIELDNAME == "NOTIFYPARTY") head.NOTIFYPARTY = oldhead.NOTIFYPARTY;
|
|
|
if (enumValue.FIELDNAME == "MSHIPPERID") head.MSHIPPERID = oldhead.MSHIPPERID;
|
|
|
if (enumValue.FIELDNAME == "MCONSIGNEEID") head.MCONSIGNEEID = oldhead.MCONSIGNEEID;
|
|
|
if (enumValue.FIELDNAME == "MNOTIFYPARTYID") head.MNOTIFYPARTYID = oldhead.MNOTIFYPARTYID;
|
|
|
if (enumValue.FIELDNAME == "MSHIPPER") head.MSHIPPER = oldhead.MSHIPPER;
|
|
|
if (enumValue.FIELDNAME == "MCONSIGNEE") head.MCONSIGNEE = oldhead.MCONSIGNEE;
|
|
|
if (enumValue.FIELDNAME == "MNOTIFYPARTY") head.MNOTIFYPARTY = oldhead.MNOTIFYPARTY;
|
|
|
if (enumValue.FIELDNAME == "AGENTID") head.AGENTID = oldhead.AGENTID;
|
|
|
if (enumValue.FIELDNAME == "AGENT") head.AGENT = oldhead.AGENT;
|
|
|
if (enumValue.FIELDNAME == "CLOSINGDATE") head.CLOSINGDATE = oldhead.CLOSINGDATE;
|
|
|
if (enumValue.FIELDNAME == "ETA") head.ETA = oldhead.ETA;
|
|
|
if (enumValue.FIELDNAME == "PLACERECEIPT" || enumValue.FIELDNAME == "PlACERECEIPT") head.PLACERECEIPT = oldhead.PLACERECEIPT;
|
|
|
if (enumValue.FIELDNAME == "PLACERECEIPTID") head.PLACERECEIPTID = oldhead.PLACERECEIPTID;
|
|
|
if (enumValue.FIELDNAME == "PLACEDELIVERYID") head.PLACEDELIVERYID = oldhead.PLACEDELIVERYID;
|
|
|
if (enumValue.FIELDNAME == "PLACEDELIVERY") head.PLACEDELIVERY = oldhead.PLACEDELIVERY;
|
|
|
if (enumValue.FIELDNAME == "DESTINATIONID") head.DESTINATIONID = oldhead.DESTINATIONID;
|
|
|
if (enumValue.FIELDNAME == "DESTINATION") head.DESTINATION = oldhead.DESTINATION;
|
|
|
if (enumValue.FIELDNAME == "NOBILL") head.NOBILL = oldhead.NOBILL;
|
|
|
if (enumValue.FIELDNAME == "COPYNOBILL") head.COPYNOBILL = oldhead.COPYNOBILL;
|
|
|
if (enumValue.FIELDNAME == "ISSUEDATE") head.ISSUEDATE = oldhead.ISSUEDATE;
|
|
|
if (enumValue.FIELDNAME == "ISSUEPLACE") head.ISSUEPLACE = oldhead.ISSUEPLACE;
|
|
|
if (enumValue.FIELDNAME == "BLFRT") head.BLFRT = oldhead.BLFRT;
|
|
|
if (enumValue.FIELDNAME == "PREPARDAT") head.PREPARDAT = oldhead.PREPARDAT;
|
|
|
if (enumValue.FIELDNAME == "PAYABLEAT") head.PAYABLEAT = oldhead.PAYABLEAT;
|
|
|
if (enumValue.FIELDNAME == "SERVICE") head.SERVICE = oldhead.SERVICE;
|
|
|
if (enumValue.FIELDNAME == "MARKS") head.MARKS = oldhead.MARKS;
|
|
|
if (enumValue.FIELDNAME == "LANE") head.LANE = oldhead.LANE;
|
|
|
if (enumValue.FIELDNAME == "FORWARDER") head.FORWARDER = oldhead.FORWARDER;
|
|
|
if (enumValue.FIELDNAME == "INVNO") head.INVNO = oldhead.INVNO;
|
|
|
if (enumValue.FIELDNAME == "CARGOID") head.CARGOID = oldhead.CARGOID;
|
|
|
if (enumValue.FIELDNAME == "DCLASS") head.DCLASS = oldhead.DCLASS;
|
|
|
if (enumValue.FIELDNAME == "DUNNO") head.DUNNO = oldhead.DUNNO;
|
|
|
if (enumValue.FIELDNAME == "REEFERF") head.REEFERF = oldhead.REEFERF;
|
|
|
if (enumValue.FIELDNAME == "TEMPID") head.TEMPID = oldhead.TEMPID;
|
|
|
if (enumValue.FIELDNAME == "TEMPSET") head.TEMPSET = oldhead.TEMPSET;
|
|
|
if (enumValue.FIELDNAME == "TEMPMAX") head.TEMPMAX = oldhead.TEMPMAX;
|
|
|
if (enumValue.FIELDNAME == "TEMPMIN") head.TEMPMIN = oldhead.TEMPMIN;
|
|
|
if (enumValue.FIELDNAME == "HUMIDITY") head.HUMIDITY = oldhead.HUMIDITY;
|
|
|
if (enumValue.FIELDNAME == "ORDTYPE") head.ORDTYPE = oldhead.ORDTYPE;
|
|
|
if (enumValue.FIELDNAME == "ORDERNO") head.ORDERNO = oldhead.ORDERNO;
|
|
|
if (enumValue.FIELDNAME == "INSURANCEER") head.INSURANCEER = oldhead.INSURANCEER;
|
|
|
if (enumValue.FIELDNAME == "INSURANCENO") head.INSURANCENO = oldhead.INSURANCENO;
|
|
|
if (enumValue.FIELDNAME == "INAMOUT") head.INAMOUT = oldhead.INAMOUT;
|
|
|
if (enumValue.FIELDNAME == "ISFUMIGATION") head.ISFUMIGATION = oldhead.ISFUMIGATION;
|
|
|
if (enumValue.FIELDNAME == "ISSTORAGE") head.ISSTORAGE = oldhead.ISSTORAGE;
|
|
|
if (enumValue.FIELDNAME == "ISLAND") head.ISLAND = oldhead.ISLAND;
|
|
|
if (enumValue.FIELDNAME == "ISCUSTOMS") head.ISCUSTOMS = oldhead.ISCUSTOMS;
|
|
|
if (enumValue.FIELDNAME == "ISINSPECTION") head.ISINSPECTION = oldhead.ISINSPECTION;
|
|
|
if (enumValue.FIELDNAME == "ISBOOKING") head.ISBOOKING = oldhead.ISBOOKING;
|
|
|
if (enumValue.FIELDNAME == "ISAGENT") head.ISAGENT = oldhead.ISAGENT;
|
|
|
if (enumValue.FIELDNAME == "ISHBLNO") head.ISHBLNO = oldhead.ISHBLNO;
|
|
|
if (enumValue.FIELDNAME == "SERVICE9") head.SERVICE9 = oldhead.SERVICE9;
|
|
|
if (enumValue.FIELDNAME == "SERVICE10") head.SERVICE10 = oldhead.SERVICE10;
|
|
|
if (enumValue.FIELDNAME == "DOC") head.DOC = oldhead.DOC;
|
|
|
if (enumValue.FIELDNAME == "PACKINGTYPE") head.PACKINGTYPE = oldhead.PACKINGTYPE;
|
|
|
if (enumValue.FIELDNAME == "WAREHOUSE") head.WAREHOUSE = oldhead.WAREHOUSE;
|
|
|
if (enumValue.FIELDNAME == "CLOSEDOCDATE") head.CLOSEDOCDATE = oldhead.CLOSEDOCDATE;
|
|
|
if (enumValue.FIELDNAME == "INTOPORTDATE") head.INTOPORTDATE = oldhead.INTOPORTDATE;
|
|
|
if (enumValue.FIELDNAME == "MBLFRT") head.MBLFRT = oldhead.MBLFRT;
|
|
|
if (enumValue.FIELDNAME == "STLNAME") head.STLNAME = oldhead.STLNAME;
|
|
|
if (enumValue.FIELDNAME == "STLDATE") head.STLDATE = oldhead.STLDATE;
|
|
|
if (enumValue.FIELDNAME == "OPERATOR") head.OPERATOR = oldhead.OPERATOR;
|
|
|
if (enumValue.FIELDNAME == "OPERATORTEL") head.OPERATORTEL = oldhead.OPERATORTEL;
|
|
|
if (enumValue.FIELDNAME == "FINANCIALSTAFF") head.FINANCIALSTAFF = oldhead.FINANCIALSTAFF;
|
|
|
if (enumValue.FIELDNAME == "SOURCECODE") head.SOURCECODE = oldhead.SOURCECODE;
|
|
|
if (enumValue.FIELDNAME == "ISCONTAINERSOC") head.ISCONTAINERSOC = oldhead.ISCONTAINERSOC;
|
|
|
if (enumValue.FIELDNAME == "DPAGE") head.DPAGE = oldhead.DPAGE;
|
|
|
if (enumValue.FIELDNAME == "DLABEL") head.DLABEL = oldhead.DLABEL;
|
|
|
if (enumValue.FIELDNAME == "LINKMAN") head.LINKMAN = oldhead.LINKMAN;
|
|
|
if (enumValue.FIELDNAME == "VESSELID") head.VESSELID = oldhead.VESSELID;
|
|
|
if (enumValue.FIELDNAME == "ISSUEPLACEID") head.ISSUEPLACEID = oldhead.ISSUEPLACEID;
|
|
|
if (enumValue.FIELDNAME == "HSCODE") head.HSCODE = oldhead.HSCODE;
|
|
|
if (enumValue.FIELDNAME == "TRANSTATUS") head.TRANSTATUS = oldhead.TRANSTATUS;
|
|
|
if (enumValue.FIELDNAME == "EDIREMARK") head.EDIREMARK = oldhead.EDIREMARK;
|
|
|
if (enumValue.FIELDNAME == "SERVICECONTRACTNO") head.SERVICECONTRACTNO = oldhead.SERVICECONTRACTNO;
|
|
|
if (enumValue.FIELDNAME == "CUSTOMNO") head.CUSTOMNO = oldhead.CUSTOMNO;
|
|
|
if (enumValue.FIELDNAME == "CUSTOMDATE") head.CUSTOMDATE = oldhead.CUSTOMDATE;
|
|
|
if (enumValue.FIELDNAME == "INSPECTIONNO") head.INSPECTIONNO = oldhead.INSPECTIONNO;
|
|
|
if (enumValue.FIELDNAME == "INSPECTIONDATE") head.INSPECTIONDATE = oldhead.INSPECTIONDATE;
|
|
|
if (enumValue.FIELDNAME == "ENTERP") head.ENTERP = oldhead.ENTERP;
|
|
|
if (enumValue.FIELDNAME == "ENTERPID") head.ENTERPID = oldhead.ENTERPID;
|
|
|
if (enumValue.FIELDNAME == "CLEARCUSTOMDATE") head.CLEARCUSTOMDATE = oldhead.CLEARCUSTOMDATE;
|
|
|
if (enumValue.FIELDNAME == "TERMSDELIVERY") head.TERMSDELIVERY = oldhead.TERMSDELIVERY;
|
|
|
if (enumValue.FIELDNAME == "INSPECTSERVICE") head.INSPECTSERVICE = oldhead.INSPECTSERVICE;
|
|
|
if (enumValue.FIELDNAME == "TRADETERM") head.TRADETERM = oldhead.TRADETERM;
|
|
|
if (enumValue.FIELDNAME == "SHIPAGENCY") head.SHIPAGENCY = oldhead.SHIPAGENCY;
|
|
|
if (enumValue.FIELDNAME == "ISMOREGOOD") head.ISMOREGOOD = oldhead.ISMOREGOOD;
|
|
|
if (enumValue.FIELDNAME == "CUSTNO") head.CUSTNO = oldhead.CUSTNO;
|
|
|
if (enumValue.FIELDNAME == "MBLNO") head.MBLNO = oldhead.MBLNO;
|
|
|
if (enumValue.FIELDNAME == "HBLNO") head.HBLNO = oldhead.HBLNO;
|
|
|
if (enumValue.FIELDNAME == "APPLYNO") head.APPLYNO = oldhead.APPLYNO;
|
|
|
if (enumValue.FIELDNAME == "TRANSNO") head.TRANSNO = oldhead.TRANSNO;
|
|
|
if (enumValue.FIELDNAME == "ISSUETYPE") head.ISSUETYPE = oldhead.ISSUETYPE;
|
|
|
if (enumValue.FIELDNAME == "VESSELID") head.VESSELID = oldhead.VESSELID;
|
|
|
if (enumValue.FIELDNAME == "VESSEL2N") head.VESSEL2N = oldhead.VESSEL2N;
|
|
|
if (enumValue.FIELDNAME == "VOYNO2N") head.VOYNO2N = oldhead.VOYNO2N;
|
|
|
if (enumValue.FIELDNAME == "VESSELID2N") head.VESSELID2N = oldhead.VESSELID2N;
|
|
|
if (enumValue.FIELDNAME == "SALECORPID") head.SALECORPID = oldhead.SALECORPID;
|
|
|
}
|
|
|
|
|
|
if (copybill == "true")
|
|
|
{
|
|
|
var billlist = MsOpSeaeDAL.GetBillList(condition);
|
|
|
if (billlist != null)
|
|
|
{
|
|
|
foreach (var enumValue in billlist)
|
|
|
{
|
|
|
enumValue.INPUTBY = Convert.ToString(Session["SHOWNAME"]);
|
|
|
enumValue.BSNO = head.BSNO;
|
|
|
enumValue.AS_ID = Guid.NewGuid().ToString();
|
|
|
enumValue.MBLNO = "";
|
|
|
enumValue.HBLNO = "";
|
|
|
enumValue.DbOperationType = DbOperationType.DbotIns;
|
|
|
var modb = new ModelObjectDB();
|
|
|
DBResult result = modb.Save(enumValue);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
var json = JsonConvert.Serialize(
|
|
|
new { Success = true, Message = "查询成功", data = head });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
public ContentResult GetBodyList(string condition, string sort)
|
|
|
{
|
|
|
var dataList = MsOpSeaeDAL.GetBodyList(condition, sort);
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
public ContentResult GetBodyListSum(string condition)
|
|
|
{
|
|
|
var dataList = MsOpSeaeDAL.GetBodyListSum(condition);
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
public ContentResult GetOpCtnDetailList(string condition)
|
|
|
{
|
|
|
var dataList = MsOpSeaeDAL.GetOpCtnDetailList(condition);
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
public ContentResult GetManifestList(string condition)
|
|
|
{
|
|
|
var dataList = MsOpSeaeDAL.GetManifestList(condition);
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
public ContentResult GetManifestSumList(string condition)
|
|
|
{
|
|
|
var dataList = MsOpSeaeDAL.GetManifestSumList(condition);
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
public ContentResult GetOpStatusStandard()
|
|
|
{
|
|
|
var dataInfo = MsOpSeaeDAL.GetOpStatusStandard();
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataInfo.Count, data = dataInfo.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
public ContentResult GetOpStatus(string bsno)
|
|
|
{
|
|
|
var dataInfo = MsOpSeaeDAL.GetOpStatus(bsno);
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataInfo.Count, data = dataInfo.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
public ContentResult SearchOpStatus(string mblno)
|
|
|
{
|
|
|
var dataInfo = MsOpSeaeDAL.SearchOpStatus(mblno);
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataInfo.Count, data = dataInfo.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
public ContentResult GetMblIsRepeat(string bsno, string mblno)
|
|
|
{
|
|
|
var ct = MsOpSeaeDAL.GetRdCount("MASTERNO<>'" + bsno + "' AND MBLNO='" + mblno + "' and CORPID='" + Convert.ToString(Session["COMPANYID"]) + "'");
|
|
|
if (ct != 0)
|
|
|
{
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "提单号重复!" });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
var json = JsonConvert.Serialize(new { Success = false, Message = "查询成功" });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
}
|
|
|
public ContentResult GetIsManifestSum(string bsno)
|
|
|
{
|
|
|
var issame = true;
|
|
|
var issamemsg = "";
|
|
|
var bill = MsOpSeaeDAL.GetData("BSNO='" + bsno + "'");
|
|
|
var billmsum = MsOpSeaeDAL.GetManifestBsNoSumList("BSNO='" + bsno + "'");
|
|
|
if (Convert.ToDecimal(bill.PKGS) != billmsum[0].PKGS)
|
|
|
{
|
|
|
issame = false;
|
|
|
issamemsg = issamemsg + "<br /> 分票件数合计:" + billmsum[0].PKGS + " 与件数:" + bill.PKGS + ",不一致。";
|
|
|
}
|
|
|
if (Convert.ToDecimal(bill.KGS) != billmsum[0].KGS)
|
|
|
{
|
|
|
issame = false;
|
|
|
issamemsg = issamemsg + " <br />分票毛重合计:" + billmsum[0].KGS + " 与毛重:" + bill.KGS + ",不一致。";
|
|
|
}
|
|
|
if (Convert.ToDecimal(bill.CBM) != billmsum[0].CBM)
|
|
|
{
|
|
|
issame = false;
|
|
|
issamemsg = issamemsg + " <br />分票体积合计:" + billmsum[0].CBM + " 与体积:" + bill.CBM + ",不一致。";
|
|
|
}
|
|
|
|
|
|
|
|
|
if (!issame)
|
|
|
{
|
|
|
var json = JsonConvert.Serialize(new { Success = false, Message = issamemsg });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功" });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 保存
|
|
|
public ContentResult Save(string opstatus, string data, string data2, string data3, string body)
|
|
|
{
|
|
|
|
|
|
string userid = Convert.ToString(Session["USERID"]);
|
|
|
if (userid == "" || userid == null)
|
|
|
{
|
|
|
var jsonRespose = new JsonResponse { Success = false, Message = "登陆状态失效,请重新登陆进行操作!" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
var aaa = "";
|
|
|
data2 = data2.Replace("❥", "<");
|
|
|
var headData = JsonConvert.Deserialize<MsOpSeae>(data.Replace("}", ",") + data2.Replace("{", "").Replace("}", ",") + data3.Replace("{", ""));
|
|
|
var bodyList = JsonConvert.Deserialize<List<MsOpSeaeDetail>>(body);
|
|
|
|
|
|
|
|
|
|
|
|
var isPost = true;
|
|
|
var errorstr = "";
|
|
|
var isuse = false;
|
|
|
var iscreatecustno = false;
|
|
|
var custno = "";
|
|
|
var billnoset = MsSysBillNoSetDAL.GetData("OPLBNAME='海运出口' AND RULEBLNO='委托编号' ", Convert.ToString(Session["COMPANYID"]));
|
|
|
if (billnoset.BILLTYPE != "")
|
|
|
isuse = true;
|
|
|
else
|
|
|
isuse = MsBaseInfoDAL.GetRuleUse("委托编号", "1");
|
|
|
if (headData.CUSTNO.Trim() == "" || headData.CUSTNO == null)
|
|
|
{
|
|
|
if (isuse)
|
|
|
{
|
|
|
var FENCUSTNOE = MsSysParamSetDAL.GetData("PARAMNAME='FENCUSTNOE'");
|
|
|
if (FENCUSTNOE.PARAMVALUE == "1" && headData.MASTERNO != "" && headData.BSNO != headData.MASTERNO)
|
|
|
{
|
|
|
headData.CUSTNO = MsSysBillNoSetDAL.GetFenCustNo(headData.MASTERNO, "op_seae");
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
|
|
|
if (billnoset.BILLTYPE != "")
|
|
|
custno = MsSysBillNoSetDAL.GetBillNo(billnoset, headData.ETD.ToString().Trim(), headData.ACCDATE.ToString().Trim(), "", headData.OP, headData.SALECORPID);
|
|
|
else
|
|
|
custno = MsOpSeaeDAL.getCodeRule("委托编号", "CUSTNO", headData.BSDATE.ToString().Trim(), headData.ACCDATE.ToString().Trim(), CookieConfig.GetCookie_UserId(Request), Convert.ToString(Session["COMPANYID"]));
|
|
|
iscreatecustno = true;
|
|
|
headData.CUSTNO = custno;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
var ct = MsOpSeaeDAL.GetRdCount("BSNO<>'" + headData.BSNO + "' AND CUSTNO='" + headData.CUSTNO + "' and CORPID='" + Convert.ToString(Session["COMPANYID"]) + "' ");
|
|
|
if (ct != 0)
|
|
|
{
|
|
|
isPost = false;
|
|
|
errorstr = "委托编号" + headData.CUSTNO + "重复";
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (headData.CORPID == "" || headData.CORPID == null)
|
|
|
{
|
|
|
headData.CORPID = CookieConfig.GetCookie_CompanyId(Request);
|
|
|
}
|
|
|
if (headData.CUSTNO == "")
|
|
|
{
|
|
|
isPost = false;
|
|
|
errorstr = "委托编号为空";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
/*
|
|
|
var At = MsOpSeaeDAL.GetRdCount("MASTERNO<>'" + headData.BSNO + "' AND CUSTNO='" + headData.CUSTNO + "' and CORPID='" + Convert.ToString(Session["COMPANYID"]) + "'");
|
|
|
if (At != 0)
|
|
|
{
|
|
|
isPost = false;
|
|
|
errorstr = "委托编号<" + headData.CUSTNO + ">重复";
|
|
|
}
|
|
|
* */
|
|
|
}
|
|
|
|
|
|
var mblreapeat = MsSysParamSetDAL.GetData("PARAMNAME='SeaeMblrepeat'");
|
|
|
|
|
|
if (mblreapeat.PARAMVALUE != "1" && headData.MBLNO != "" && headData.MBLNO != null && headData.BLTYPE != "拼箱分票")
|
|
|
{
|
|
|
var ct = MsOpSeaeDAL.GetRdCount("MASTERNO<>'" + headData.BSNO + "' AND MBLNO='" + headData.MBLNO + "' and CORPID='" + Convert.ToString(Session["COMPANYID"]) + "' AND ISNULL(ISCANCEL,'')<>'1' ");
|
|
|
if (ct != 0)
|
|
|
{
|
|
|
isPost = false;
|
|
|
errorstr = "主提单号重复";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (headData.HBLNO.Trim() == "" || headData.HBLNO == null)
|
|
|
{
|
|
|
var billnosethblno = MsSysBillNoSetDAL.GetData("OPLBNAME='海运出口' AND RULEBLNO='分提单号' ", Convert.ToString(Session["COMPANYID"]));
|
|
|
if (billnosethblno.BILLTYPE != ""&&billnosethblno.ISAUTO=="1")
|
|
|
{
|
|
|
var hblno = MsSysBillNoSetDAL.GetBillNo(billnosethblno, headData.ETD.ToString().Trim(), headData.ACCDATE.ToString().Trim(), "", headData.OP, headData.SALECORPID);
|
|
|
headData.HBLNO = hblno;
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
|
|
|
var hblreapeat = MsSysParamSetDAL.GetData("PARAMNAME='SeaeHblrepeat'");
|
|
|
if (hblreapeat.PARAMVALUE != "1" && headData.HBLNO != "" && headData.HBLNO != null)
|
|
|
{
|
|
|
var ct = MsOpSeaeDAL.GetRdCount("BSNO<>'" + headData.BSNO + "' AND HBLNO='" + headData.HBLNO + "' and CORPID='" + Convert.ToString(Session["COMPANYID"]) + "'");
|
|
|
if (ct != 0)
|
|
|
{
|
|
|
isPost = false;
|
|
|
errorstr = "分提单号重复";
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
//if (headData.ORDERNO != "" && headData.ORDERNO != null)
|
|
|
//{
|
|
|
// var ct = MsOpSeaeDAL.GetRdCount("BSNO<>'" + headData.BSNO + "' AND ORDERNO='" + headData.ORDERNO + "' and CORPID='" + Convert.ToString(Session["COMPANYID"]) + "'");
|
|
|
// if (ct != 0)
|
|
|
// {
|
|
|
// isPost = false;
|
|
|
// errorstr = "订舱编号";
|
|
|
// }
|
|
|
//}
|
|
|
|
|
|
if (headData.ETD != "" && headData.CUSTOMERNAME != "")// headData.STLDATE == "" &&
|
|
|
{
|
|
|
//根据客户、开船日计算账期
|
|
|
|
|
|
var _dmb = MsInfoClientDAL.GetSTLDATE(headData.CUSTOMERNAME, "海运出口", headData.ETD, headData.SALE);
|
|
|
headData.STLNAME = _dmb.STLNAME;
|
|
|
headData.STLDATE = _dmb.STLDATE;
|
|
|
|
|
|
if (_dmb.STLNAME == "")
|
|
|
{
|
|
|
headData.STLNAME = "现结买单";
|
|
|
headData.STLDATE = headData.ETD;
|
|
|
}
|
|
|
if (_dmb.BSSOURCE != "") headData.BSSOURCE = _dmb.BSSOURCE;
|
|
|
}
|
|
|
|
|
|
if (opstatus == "add")
|
|
|
{
|
|
|
headData.INPUTBY = CookieConfig.GetCookie_UserName(Request);
|
|
|
headData.CREATETIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
headData.BSSTATUS = false;
|
|
|
headData.FEESTATUS = false;
|
|
|
headData.DbOperationType = DbOperationType.DbotIns;
|
|
|
headData.ISCANCEL = "";
|
|
|
}
|
|
|
else if (opstatus == "edit")
|
|
|
{
|
|
|
headData.DbOperationType = DbOperationType.DbotUpd;
|
|
|
headData.ModelUIStatus = "E";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
headData.DbOperationType = DbOperationType.DbotDel;
|
|
|
}
|
|
|
if (headData.MASTERNO == null || headData.MASTERNO == "") { headData.MASTERNO = headData.BSNO; }
|
|
|
headData.BSDATE = DateTime.Now;
|
|
|
|
|
|
if (headData.ETA == "") headData.ETA = null;
|
|
|
if (headData.ETD == "") headData.ETD = null;
|
|
|
if (headData.STLDATE == "") headData.STLDATE = null;
|
|
|
if (headData.ATD == "") headData.ATD = null;
|
|
|
if (headData.DELIVERYDATE == "") headData.DELIVERYDATE = null;
|
|
|
|
|
|
if (headData.ISSUEDATE == "" || (Convert.ToDateTime(headData.ISSUEDATE) < Convert.ToDateTime("2010-01-01"))) headData.ISSUEDATE = null;
|
|
|
if (headData.CLOSINGDATE == "") headData.CLOSINGDATE = null;
|
|
|
if (headData.CLOSEDOCDATE == "") headData.CLOSEDOCDATE = null;
|
|
|
if (headData.INSPECTIONDATE == "") headData.INSPECTIONDATE = null;
|
|
|
if (headData.CUSTOMDATE == "") headData.CUSTOMDATE = null;
|
|
|
if (headData.CLEARCUSTOMDATE == "") headData.CLEARCUSTOMDATE = null;
|
|
|
headData.MBLNO = headData.MBLNO.Trim();
|
|
|
headData.SHIPPER = FullWidthToHalfWidth(ToDBC(headData.SHIPPER));
|
|
|
headData.SHIPPER = DelEndSpace(headData.SHIPPER);
|
|
|
headData.CONSIGNEE = FullWidthToHalfWidth(ToDBC(headData.CONSIGNEE));
|
|
|
headData.CONSIGNEE = DelEndSpace(headData.CONSIGNEE);
|
|
|
headData.NOTIFYPARTY = FullWidthToHalfWidth(ToDBC(headData.NOTIFYPARTY));
|
|
|
headData.NOTIFYPARTY = DelEndSpace(headData.NOTIFYPARTY);
|
|
|
//headData.MSHIPPER = ToDBC(headData.MSHIPPER);
|
|
|
//headData.MSHIPPER = DelEndSpace(headData.MSHIPPER);
|
|
|
//headData.MCONSIGNEE = ToDBC(headData.MCONSIGNEE);
|
|
|
//headData.MCONSIGNEE = DelEndSpace(headData.MCONSIGNEE);
|
|
|
//headData.MNOTIFYPARTY = ToDBC(headData.MNOTIFYPARTY);
|
|
|
//headData.MNOTIFYPARTY = DelEndSpace(headData.MNOTIFYPARTY);
|
|
|
headData.MARKS = FullWidthToHalfWidth(ToDBC(headData.MARKS));
|
|
|
headData.DESCRIPTION = FullWidthToHalfWidth(ToDBC(headData.DESCRIPTION));
|
|
|
if (headData.KGS == "") headData.KGS = "0";
|
|
|
if (headData.PKGS == "") headData.PKGS = "0";
|
|
|
if (headData.CBM == "") headData.CBM = "0";
|
|
|
headData.SALE = headData.SALE.Trim();
|
|
|
headData.CUSTSERVICE = headData.CUSTSERVICE.Trim();
|
|
|
headData.DOC = headData.DOC.Trim();
|
|
|
headData.FRCUSTSERVICE = headData.FRCUSTSERVICE.Trim();
|
|
|
|
|
|
// headData.VESSEL = MsBaseInfoDAL.DelPortCn(headData.VESSEL);
|
|
|
//headData.PORTLOAD = MsBaseInfoDAL.DelPortCn(headData.PORTLOAD);
|
|
|
//headData.PORTDISCHARGE = MsBaseInfoDAL.DelPortCn(headData.PORTDISCHARGE);
|
|
|
//headData.PLACERECEIPT = MsBaseInfoDAL.DelPortCn(headData.PLACERECEIPT);
|
|
|
//headData.PORTDISCHARGE = MsBaseInfoDAL.DelPortCn(headData.PORTDISCHARGE);
|
|
|
//headData.DESTINATION = MsBaseInfoDAL.DelPortCn(headData.DESTINATION);
|
|
|
|
|
|
//if (headData.BLTYPE=="拼箱分票" || headData.BLTYPE=="拼箱单票")
|
|
|
// headData.CNTRTOTAL = headData.PKGS.ToString() + headData.KINDPKGS + "/" + headData.KGS.ToString()+ "KGS/" + headData.CBM.ToString()+ "CBM";
|
|
|
if (headData.BLTYPE == "拼箱分票" && headData.MASTERNO != headData.BSNO)
|
|
|
{
|
|
|
decimal Mpkgs = 0;
|
|
|
decimal Mkgs = 0;
|
|
|
decimal Mcbm = 0;
|
|
|
var Fpkgs = Convert.ToInt32(headData.PKGS);
|
|
|
decimal Fkgs = Convert.ToDecimal(headData.KGS);
|
|
|
decimal Fcbm = Convert.ToDecimal(headData.CBM);
|
|
|
|
|
|
var MSeaeList = MsOpSeaeDAL.GetFenList("BSNO='" + headData.MASTERNO + "'", CookieConfig.GetCookie_UserId(Request), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
|
|
|
if (MSeaeList.Count != 0)
|
|
|
{
|
|
|
var MSeae = MSeaeList[0];
|
|
|
Mpkgs = Convert.ToInt32(MSeae.PKGS);
|
|
|
Mkgs = Convert.ToDecimal(MSeae.KGS);
|
|
|
Mcbm = Convert.ToDecimal(MSeae.CBM);
|
|
|
}
|
|
|
|
|
|
var FenSumList = MsOpSeaeDAL.GetDataListSum("MASTERNO='" + headData.MASTERNO + "' AND BSNO<>MASTERNO AND BSNO<>'" + headData.BSNO + "'", CookieConfig.GetCookie_UserId(Request), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), null, true);
|
|
|
if (FenSumList.Count != 0)
|
|
|
{
|
|
|
var FSeae = FenSumList[0];
|
|
|
Fpkgs = Fpkgs + Convert.ToInt32(FSeae.PKGS);
|
|
|
Fkgs = Fkgs + Convert.ToDecimal(FSeae.KGS);
|
|
|
Fcbm = Fcbm + Convert.ToDecimal(FSeae.CBM);
|
|
|
}
|
|
|
if (Fpkgs > Mpkgs || Fkgs > Mkgs || Fcbm > Mcbm)
|
|
|
{
|
|
|
isPost = false;
|
|
|
errorstr = "分票合计件重尺不能大于主票的件重尺";
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
var BSNO = headData.BSNO;
|
|
|
|
|
|
#region 判断字段长度
|
|
|
if (isPost)
|
|
|
{
|
|
|
var seaefield = MsSoftSysTableDAL.GetDefTableDetailList("OP_SEAE");
|
|
|
foreach (var enumValue in seaefield)
|
|
|
{
|
|
|
if (enumValue.FIELDNAME == "MBLNO" && headData.MBLNO.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "主提单号超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "HBLNO" && headData.HBLNO.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "分提单号超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "CUSTNO" && headData.CUSTNO.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "委托编号超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "ORDERNO" && headData.ORDERNO.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "订舱编号超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "SHIPPERID" && headData.SHIPPERID.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "发货人代码超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "CONSIGNEEID" && headData.CONSIGNEEID.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "收货人代码超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "NOTIFYPARTYID" && headData.NOTIFYPARTYID.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "通知人代码超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "SHIPPER" && headData.SHIPPER.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "发货人超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "CONSIGNEE" && headData.CONSIGNEE.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "收货人超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "NOTIFYPARTY" && headData.NOTIFYPARTY.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "通知人超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "AGENTID" && headData.AGENTID.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "代理名称超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "AGENT" && headData.AGENT.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "代理超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "VESSEL" && headData.VESSEL.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "船名超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "VOYNO" && headData.VOYNO.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "航次超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "PlACERECEIPT" && headData.PLACERECEIPT.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "收货地超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "PORTLOADID" && headData.PORTLOADID.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "装货港代码超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "PORTLOAD" && headData.PORTLOAD.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "装货港超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "PORTDISCHARGEID" && headData.PORTDISCHARGEID.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "卸货港代码超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "PORTDISCHARGE" && headData.PORTDISCHARGE.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "卸货港超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "PLACEDELIVERYID" && headData.PLACEDELIVERYID.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "交货地代码超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "PLACEDELIVERY" && headData.PLACEDELIVERY.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "交货地超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "DESTINATIONID" && headData.DESTINATIONID.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "目的地代码超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "DESTINATION" && headData.DESTINATION.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "目的地超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "ISSUEPLACE" && headData.ISSUEPLACE.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "签单地点超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "BLFRT" && headData.BLFRT.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "付费方式超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "PREPARDAT" && headData.PREPARDAT.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "预付地点超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "PAYABLEAT" && headData.PAYABLEAT.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "到付地点超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "SERVICE" && headData.SERVICE.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "运输条款超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "MARKS" && headData.MARKS.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "唛头超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "NOPKGS" && headData.NOPKGS.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "件数包装超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "DESCRIPTION" && headData.DESCRIPTION.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "货物描述超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "GOODSNAME" && headData.GOODSNAME.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "品名超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "KINDPKGS" && headData.KINDPKGS.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "包装超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "LANE" && headData.LANE.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "航线超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "INVNO" && headData.INVNO.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "发票号超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "DCLASS" && headData.DCLASS.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "危险品类别超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "DUNNO" && headData.DUNNO.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "危险品编号超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "REEFERF" && headData.REEFERF.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "冷藏通风量超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "TEMPID" && headData.TEMPID.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "温度单位超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "TEMPSET" && headData.TEMPSET.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "设置温度超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "TEMPMAX" && headData.TEMPMAX.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "最高温度超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "TEMPMIN" && headData.TEMPMIN.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "最低温度超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "CONTRACTNO" && headData.CONTRACTNO.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "运费协议号超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "INSURANCEER" && headData.INSURANCEER.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "保险人超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "INSURANCENO" && headData.INSURANCENO.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "保险单号超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "REMARK" && headData.REMARK.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "备注超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "STLNAME" && headData.STLNAME.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "结算方式超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "EDIREMARK" && headData.EDIREMARK.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "EDI备注超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "MNOTIFYPARTY" && headData.MNOTIFYPARTY.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "主单通知人超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "ENTERP" && headData.ENTERP.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "经营单位超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "SERVICECONTRACTNO" && headData.SERVICECONTRACTNO.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "服务合同号超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "MNOTIFYPARTYID" && headData.MNOTIFYPARTYID.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "签单地点超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "LINKMAN" && headData.LINKMAN.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "客户联系人超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "INSPECTSERVICE" && headData.INSPECTSERVICE.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "报检项目超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "APPLYNO" && headData.APPLYNO.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "申请放箱号超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "MSHIPPERID" && headData.MSHIPPERID.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "MASTER发货人代码超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "CUSTOMNO" && headData.CUSTOMNO.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "报关单号超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "HSCODE" && headData.HSCODE.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "HS代码超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "INSPECTIONNO" && headData.INSPECTIONNO.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "商检单号超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "MSHIPPER" && headData.MSHIPPER.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "MASTER发货人超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "PLACERECEIPTID" && headData.PLACERECEIPTID.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "收货地代码超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "TRADETERM" && headData.TRADETERM.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "贸易条款超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "VESSELID" && headData.VESSELID.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "船舶呼号超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "DPAGE" && headData.DPAGE.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "危险品页号超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "MCONSIGNEEID" && headData.MCONSIGNEEID.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "MASTER收货人代码超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "MCONSIGNEE" && headData.MCONSIGNEE.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "MASTER收货人超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "ENTERPID" && headData.ENTERPID.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "单位编码超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "HUMIDITY" && headData.HUMIDITY.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "湿度超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "TERMSDELIVERY" && headData.TERMSDELIVERY.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "贸易方式超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "DLABEL" && headData.DLABEL.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "危险品标签超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
}
|
|
|
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
if (isPost)
|
|
|
{
|
|
|
var modb = new ModelObjectDB();
|
|
|
DBResult result = modb.Save(headData);
|
|
|
|
|
|
if (result.Success == true)
|
|
|
{
|
|
|
//if (headData.BLTYPE == "拼箱分票" || headData.BLTYPE == "拼箱单票")
|
|
|
// result = MsOpSeaeDAL.SaveDetail(BSNO, bodyList, CookieConfig.GetCookie_UserId(Request), false);
|
|
|
//else
|
|
|
result = MsOpSeaeDAL.SaveDetail(BSNO, bodyList, CookieConfig.GetCookie_UserId(Request), true);
|
|
|
T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
|
|
|
if (opstatus == "add")
|
|
|
{
|
|
|
var blUpSQL = " if (select CID from Op_SeaCover where bsno='" + headData.BSNO + "' AND COVERTITLE='接单') is null insert into Op_SeaCover(CID,BSNO,COVERTITLE,COVERCONTEXT,OPERATOR,OPTIME,ISSYS) values(NEWID(),'" + BSNO + "','接单','','" + Session["SHOWNAME"] + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','1')";
|
|
|
bool bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
|
|
|
}
|
|
|
if (headData.MBLNO != "")
|
|
|
{
|
|
|
var blUpSQL = " if (select CID from Op_SeaCover where bsno='" + headData.BSNO + "' AND COVERTITLE='出号') is null insert into Op_SeaCover(CID,BSNO,COVERTITLE,COVERCONTEXT,OPERATOR,OPTIME,ISSYS) values(NEWID(),'" + BSNO + "','出号','','" + Session["SHOWNAME"] + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','1')";
|
|
|
bool bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
|
|
|
}
|
|
|
|
|
|
var blUpBL = "update op_seae_billmanage set VESSEL='" + headData.VESSEL + "',VOYNO='" + headData.VOYNO + "',ETD='" + headData.ETD + "',PORTLOADID='" + headData.PORTLOADID + "',PORTLOAD='" + headData.PORTLOAD + "',PORTDISCHARGEID='" + headData.PORTDISCHARGEID + "',PORTDISCHARGE='" + headData.PORTDISCHARGE + "' where BSNO='" + headData.BSNO + "'";
|
|
|
bool blBL = T_ALL_DA.GetExecuteSqlCommand(blUpBL);
|
|
|
|
|
|
|
|
|
//if (headData.APPLYNO!=""&& headData.ETD!=null) {
|
|
|
// var blUpSQL1 = " update op_ctnbscard set ETD='"+headData.ETD+"' where APPLYNO='"+headData.APPLYNO+"' ";
|
|
|
// bool bl1 = T_ALL_DA.GetExecuteSqlCommand(blUpSQL1);
|
|
|
|
|
|
//}
|
|
|
|
|
|
//20191210 如果是网上订舱的业务 写回booking端
|
|
|
if (headData.ORDERTYPE == "网上订舱") {
|
|
|
BookingConfirmDAL.SavetoBooking(headData,Session["COMPANYNAME"].ToString());
|
|
|
}
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
MsSysBillNoSetDAL.DeleteBsNo(custno);
|
|
|
}
|
|
|
var jsonRespose = new JsonResponse
|
|
|
{
|
|
|
Success = result.Success,
|
|
|
Message = result.Message,
|
|
|
Data = MsOpSeaeDAL.GetData("BSNO='" + BSNO + "'")
|
|
|
};
|
|
|
|
|
|
|
|
|
MsOpStatusNewDAL sdal = new MsOpStatusNewDAL();
|
|
|
string uname = CookieConfig.GetCookie_UserName(Request);
|
|
|
sdal.SaveStatusTree(BSNO, uname == null ? "" : uname);
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if (iscreatecustno == true)
|
|
|
MsSysBillNoSetDAL.DeleteBsNo(custno);
|
|
|
|
|
|
var jsonRespose = new JsonResponse { Success = false, Message = errorstr + ",不允许保存!" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static string ToDBC(string input)
|
|
|
{
|
|
|
char[] c = input.ToCharArray();
|
|
|
for (int i = 0; i < c.Length; i++)
|
|
|
{
|
|
|
if (c[i] == 12288)
|
|
|
{
|
|
|
c[i] = (char)32;
|
|
|
continue;
|
|
|
}
|
|
|
if (c[i] > 65280 && c[i] < 65375)
|
|
|
c[i] = (char)(c[i] - 65248);
|
|
|
}
|
|
|
return new string(c);
|
|
|
}
|
|
|
public static string DelEndSpace(string input)
|
|
|
{
|
|
|
if (input == "") return "";
|
|
|
|
|
|
|
|
|
input = input.Replace("\n", "\\");
|
|
|
input = input.Replace("\r", " ");
|
|
|
|
|
|
string[] StrList = input.Split('\\');
|
|
|
var result = "";
|
|
|
|
|
|
for (var i = 0; i <= StrList.Length - 1; i++)
|
|
|
{
|
|
|
var tmpstr = StrList[i].TrimEnd();
|
|
|
if (tmpstr != "")
|
|
|
{
|
|
|
if (result == "")
|
|
|
result = tmpstr;
|
|
|
else result = result + Environment.NewLine + tmpstr;
|
|
|
}
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
#region 全角空格转半角空格
|
|
|
|
|
|
public static string FullWidthToHalfWidth(string str)
|
|
|
{
|
|
|
byte[] t = Encoding.Default.GetBytes(str);
|
|
|
for (int i = 0; i < t.Length; i++)
|
|
|
{
|
|
|
if ((t[i].ToString() == "161") && (t[i + 1].ToString() == "161"))
|
|
|
{
|
|
|
t[i] = 32;
|
|
|
if (i + 1 == t.Length - 1)
|
|
|
{
|
|
|
t[i + 1] = 0;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
for (int j = i + 1; j + 1 < t.Length; j++)
|
|
|
{
|
|
|
t[j] = t[j + 1];
|
|
|
if (j + 1 == t.Length - 1)
|
|
|
{
|
|
|
t[j + 1] = 0;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return Encoding.Default.GetString(t);
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
public ContentResult CreateCtnFee(string bsno, string body)
|
|
|
{
|
|
|
var iResult = 0;
|
|
|
var headList = new List<MsChFee>();
|
|
|
var bodyList = JsonConvert.Deserialize<List<MsOpSeaeDetail>>(body);
|
|
|
if (bodyList != null)
|
|
|
{
|
|
|
foreach (var enumValue in bodyList)
|
|
|
{
|
|
|
if (enumValue.TRUCKFEE != "0" && enumValue.TRUCKFEE != "")
|
|
|
{
|
|
|
MsChFee data = new MsChFee();
|
|
|
data.BsNo = "*";
|
|
|
data.GId = Guid.NewGuid().ToString();
|
|
|
data.FeeType = 2;
|
|
|
data.FeeName = "陆运费";
|
|
|
data.CustomerType = "车队";
|
|
|
data.CustomerName = enumValue.TRUCKER;
|
|
|
data.Unit = enumValue.CTNALL;
|
|
|
data.UnitPrice = Convert.ToDecimal(enumValue.TRUCKFEE);
|
|
|
data.Quantity = 1;
|
|
|
data.Amount = Convert.ToDecimal(enumValue.TRUCKFEE);
|
|
|
data.Currency = "RMB";
|
|
|
data.ExChangerate = 1;
|
|
|
data.EnteroPerator = CookieConfig.GetCookie_UserId(Request);
|
|
|
data.IsOpen = "0";
|
|
|
data.IsAdvancedpay = "0";
|
|
|
data.FeeStatus = 1;
|
|
|
data.TaxRate = 0;
|
|
|
data.NoTaxAmount = Convert.ToDecimal(enumValue.TRUCKFEE);
|
|
|
data.TaxUnitPrice = Convert.ToDecimal(enumValue.TRUCKFEE);
|
|
|
data.AccTaxRate = 0;
|
|
|
data.IsInvoice = "0";
|
|
|
data.LOCALCURR = "RMB";
|
|
|
data.Remark = "箱号:" + enumValue.CNTRNO + ",车号:" + enumValue.TRUCKNO + " " + enumValue.REMARK;
|
|
|
headList.Add(data);
|
|
|
}
|
|
|
if (enumValue.STORAGEFEE != "0" && enumValue.STORAGEFEE != "")
|
|
|
{
|
|
|
MsChFee data = new MsChFee();
|
|
|
data.BsNo = "*";
|
|
|
data.GId = Guid.NewGuid().ToString();
|
|
|
data.FeeType = 2;
|
|
|
data.FeeName = "堆存费";
|
|
|
data.CustomerType = "车队";
|
|
|
data.CustomerName = enumValue.TRUCKER;
|
|
|
data.Unit = "天";
|
|
|
data.UnitPrice = Convert.ToDecimal(enumValue.STORAGEPRICE);
|
|
|
data.Quantity = Convert.ToInt16(enumValue.STORAGEDAY) - Convert.ToInt16(enumValue.FREESTORAGEDAY);
|
|
|
data.Amount = Convert.ToDecimal(enumValue.STORAGEFEE);
|
|
|
data.Currency = "RMB";
|
|
|
data.ExChangerate = 1;
|
|
|
data.EnteroPerator = CookieConfig.GetCookie_UserId(Request);
|
|
|
data.IsOpen = "0";
|
|
|
data.IsAdvancedpay = "0";
|
|
|
data.FeeStatus = 1;
|
|
|
data.TaxRate = 0;
|
|
|
data.NoTaxAmount = Convert.ToDecimal(enumValue.STORAGEFEE);
|
|
|
data.TaxUnitPrice = Convert.ToDecimal(enumValue.STORAGEPRICE);
|
|
|
data.AccTaxRate = 0;
|
|
|
data.IsInvoice = "0";
|
|
|
data.LOCALCURR = "RMB";
|
|
|
data.Remark = "箱号:" + enumValue.CNTRNO + ",车号:" + enumValue.TRUCKNO + " " + enumValue.REMARK;
|
|
|
headList.Add(data);
|
|
|
|
|
|
}
|
|
|
if (enumValue.CTNFEE != "0" && enumValue.CTNFEE != "")
|
|
|
{
|
|
|
MsChFee data = new MsChFee();
|
|
|
data.BsNo = "*";
|
|
|
data.GId = Guid.NewGuid().ToString();
|
|
|
data.FeeType = 2;
|
|
|
data.FeeName = "箱使费";
|
|
|
data.CustomerType = "车队";
|
|
|
data.CustomerName = enumValue.TRUCKER;
|
|
|
data.Unit = "天";
|
|
|
data.UnitPrice = Convert.ToDecimal(enumValue.CTNPRICE);
|
|
|
data.Quantity = Convert.ToInt16(enumValue.CTNDAY) - Convert.ToInt16(enumValue.FREECTNDAY);
|
|
|
data.Amount = Convert.ToDecimal(enumValue.CTNFEE);
|
|
|
data.Currency = "RMB";
|
|
|
data.ExChangerate = 1;
|
|
|
data.EnteroPerator = CookieConfig.GetCookie_UserId(Request);
|
|
|
data.IsOpen = "0";
|
|
|
data.IsAdvancedpay = "0";
|
|
|
data.FeeStatus = 1;
|
|
|
data.TaxRate = 0;
|
|
|
data.NoTaxAmount = Convert.ToDecimal(enumValue.CTNFEE);
|
|
|
data.TaxUnitPrice = Convert.ToDecimal(enumValue.CTNPRICE);
|
|
|
data.AccTaxRate = 0;
|
|
|
data.IsInvoice = "0";
|
|
|
data.LOCALCURR = "RMB";
|
|
|
data.Remark = "箱号:" + enumValue.CNTRNO + ",车号:" + enumValue.TRUCKNO + " " + enumValue.REMARK;
|
|
|
headList.Add(data);
|
|
|
|
|
|
}
|
|
|
}
|
|
|
if (headList != null)
|
|
|
{
|
|
|
iResult = MsChFeeDAL.SaveUpdateFee(headList, bsno, CookieConfig.GetCookie_UserId(Request));
|
|
|
}
|
|
|
}
|
|
|
if (iResult == 0 || iResult == 1)
|
|
|
{
|
|
|
var jsonRespose = new JsonResponse { Success = true, Message = "已生成费用!", Data = "" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
var jsonRespose = new JsonResponse { Success = false, Message = "生成费用时出错!", Data = "" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
public ContentResult SaveOpCtn(string bsno, string body, string bltype)
|
|
|
{
|
|
|
DBResult result = null;
|
|
|
var bodyList = JsonConvert.Deserialize<List<MsOpSeaeDetail>>(body);
|
|
|
if (bltype == "拼箱分票" || bltype == "拼箱单票")
|
|
|
result = MsOpSeaeDAL.SaveDetail(bsno, bodyList, CookieConfig.GetCookie_UserId(Request), false);
|
|
|
else
|
|
|
result = MsOpSeaeDAL.SaveDetail(bsno, bodyList, CookieConfig.GetCookie_UserId(Request), true);
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message, Data = "" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
|
|
|
public ContentResult SaveOpCtnDetail(string body, decimal pkgs = 0, decimal kgs = 0, decimal cbm = 0)
|
|
|
{
|
|
|
string errorstr = "";
|
|
|
DBResult result = null;
|
|
|
decimal detailpkgs = 0;
|
|
|
decimal detailkgs = 0;
|
|
|
decimal detailcbm = 0;
|
|
|
var bodyList = JsonConvert.Deserialize<List<MsOpCtnDetail>>(body);
|
|
|
if (bodyList != null)
|
|
|
{
|
|
|
foreach (var enumValue in bodyList)
|
|
|
{
|
|
|
detailpkgs = detailpkgs + enumValue.PKGS;
|
|
|
detailkgs = detailkgs + enumValue.KGS;
|
|
|
detailcbm = detailcbm + enumValue.CBM;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (detailpkgs > pkgs) errorstr = errorstr + " 多品名中 件数总和 超出 集装箱件数!";
|
|
|
if (detailkgs > kgs) errorstr = errorstr + " 多品名中 重量总和 超出 集装箱重量!";
|
|
|
if (detailcbm > cbm) errorstr = errorstr + " 多品名中 立方数总和 超出 集装箱立方!";
|
|
|
|
|
|
if (errorstr != "")
|
|
|
{
|
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = errorstr, Data = "" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
if (bodyList != null)
|
|
|
{
|
|
|
foreach (var enumValue in bodyList)
|
|
|
{
|
|
|
#region 默认值
|
|
|
MsOpCtnDetail headRow = new MsOpCtnDetail();
|
|
|
headRow.CTN_ID = enumValue.CTN_ID == null ? "" : enumValue.CTN_ID.ToString().Trim();//CTN_ID
|
|
|
headRow.PKGS = enumValue.PKGS == null ? 0 : enumValue.PKGS;//件数
|
|
|
headRow.KINDPKGS = enumValue.KINDPKGS == null ? "" : enumValue.KINDPKGS.ToString().Trim();//件数包装
|
|
|
headRow.KGS = enumValue.KGS == null ? 0 : enumValue.KGS;//重量
|
|
|
headRow.CBM = enumValue.CBM == null ? 0 : enumValue.CBM;//尺码
|
|
|
headRow.HSCODE = enumValue.HSCODE == null ? "" : enumValue.HSCODE.ToString().Trim();//HS编码
|
|
|
headRow.DESCRIPTION = enumValue.DESCRIPTION == null ? "" : enumValue.DESCRIPTION.ToString().Trim();//货物描述
|
|
|
headRow.MARKS = enumValue.MARKS == null ? "" : enumValue.MARKS.ToString().Trim();//唛头
|
|
|
headRow.REMARK = enumValue.REMARK == null ? "" : enumValue.REMARK.ToString().Trim();//备注
|
|
|
#endregion
|
|
|
//
|
|
|
if (enumValue.GID.ToString().Trim() == "*")//"add"
|
|
|
{
|
|
|
headRow.GID = Guid.NewGuid().ToString().Trim();
|
|
|
headRow.DbOperationType = DbOperationType.DbotIns;
|
|
|
}
|
|
|
else//"edit"
|
|
|
{
|
|
|
headRow.GID = enumValue.GID.ToString().Trim();//唯一编码
|
|
|
headRow.DbOperationType = DbOperationType.DbotUpd;
|
|
|
}
|
|
|
//
|
|
|
var modb = new ModelObjectDB();
|
|
|
result = modb.Save(headRow);
|
|
|
if (result.Message.ToString().IndexOf("插入重复键") > -1)
|
|
|
{
|
|
|
errorstr += "重复数据不再重复插入!";
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message, Data = "" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
public ContentResult SaveOpManifest(string body, string bsno)
|
|
|
{
|
|
|
string errorstr = "";
|
|
|
DBResult result = null;
|
|
|
var bodyList = JsonConvert.Deserialize<List<MsOpSeaeManifest>>(body);
|
|
|
if (bodyList != null)
|
|
|
{
|
|
|
foreach (var enumValue in bodyList)
|
|
|
{
|
|
|
#region 默认值
|
|
|
MsOpSeaeManifest headRow = new MsOpSeaeManifest();
|
|
|
headRow.PKGS = enumValue.PKGS == null ? 0 : enumValue.PKGS;//件数
|
|
|
headRow.KINDPKGS = enumValue.KINDPKGS == null ? "" : enumValue.KINDPKGS.ToString().Trim();//件数包装
|
|
|
headRow.KGS = enumValue.KGS == null ? 0 : enumValue.KGS;//重量
|
|
|
headRow.CBM = enumValue.CBM == null ? 0 : enumValue.CBM;//尺码
|
|
|
headRow.REMARK = enumValue.REMARK == null ? "" : enumValue.REMARK.ToString().Trim();//备注
|
|
|
headRow.MBLNO = enumValue.MBLNO.Trim();
|
|
|
headRow.SEALNO = enumValue.SEALNO.Trim();
|
|
|
headRow.CNTRNO = enumValue.CNTRNO.Trim();
|
|
|
headRow.DESCRIPTION = enumValue.DESCRIPTION;
|
|
|
|
|
|
#endregion
|
|
|
//
|
|
|
if (enumValue.BSNO.ToString().Trim() == "*")//"add"
|
|
|
{
|
|
|
headRow.GID = enumValue.GID.ToString().Trim();
|
|
|
headRow.BSNO = bsno;
|
|
|
headRow.DbOperationType = DbOperationType.DbotIns;
|
|
|
}
|
|
|
else//"edit"
|
|
|
{
|
|
|
headRow.GID = enumValue.GID.ToString().Trim();//唯一编码
|
|
|
headRow.BSNO = enumValue.BSNO;
|
|
|
headRow.DbOperationType = DbOperationType.DbotUpd;
|
|
|
}
|
|
|
//
|
|
|
var modb = new ModelObjectDB();
|
|
|
result = modb.Save(headRow);
|
|
|
if (result.Message.ToString().IndexOf("插入重复键") > -1)
|
|
|
{
|
|
|
errorstr += "重复数据不再重复插入!";
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message, Data = "" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region 删除
|
|
|
|
|
|
|
|
|
public ContentResult Delete(string data)
|
|
|
{
|
|
|
var head = JsonConvert.Deserialize<MsOpSeae>(data);
|
|
|
var isfee = MsOpSeaeDAL.GetFeeCount(head.BSNO);
|
|
|
if (isfee)
|
|
|
{
|
|
|
var jsonRespose = new JsonResponse { Success = false, Message = "此票业务存在费用,请先删除费用才能删除此票业务!" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
|
|
|
if (head.BLTYPE == "拼箱主票")
|
|
|
{
|
|
|
T_ALL_DA T_ALL_DA = new T_ALL_DA();
|
|
|
var BLCOUNT = T_ALL_DA.GetStrSQL("BLCOUNT", "select count(*) BLCOUNT from OP_SEAE WHERE MASTERNO='" + head.BSNO + "' AND BSNO<>'" + head.BSNO + "'");
|
|
|
if (BLCOUNT == "0")
|
|
|
{
|
|
|
var BSNO = head.BSNO;
|
|
|
var modb = new ModelObjectDB();
|
|
|
DBResult result = modb.Delete(head);
|
|
|
if (result.Success == true)
|
|
|
{
|
|
|
MsOpSeaeDAL.DeleteDetail(BSNO); MsSysBillNoSetDAL.DeleteBsNo(head.CUSTNO);
|
|
|
var blUpSQL = " insert into sys_log(GID,NAME,LOGTYPE,LOGTIME,LOGCONTENT,CREATEUSER) values(NEWID(),'" + head.BSNO + "','删除海运出口','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" + head.MBLNO + '(' + head.CUSTOMERNAME + ')' + "','" + Convert.ToString(Session["USERID"]) + "')";
|
|
|
bool bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
|
|
|
|
|
|
}
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
var jsonRespose = new JsonResponse { Success = false, Message = "此票拼箱主票存在分票业务,请先删除分票信息!" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
T_ALL_DA T_ALL_DA = new T_ALL_DA();
|
|
|
var BLCOUNT = T_ALL_DA.GetStrSQL("BLCOUNT", "select count(*) BLCOUNT from op_letter_truck WHERE TRUCKSTATUS in ('已接单','已派车','已发单','提交派车') and BSNO='" + head.BSNO + "'");
|
|
|
if (BLCOUNT == "0")
|
|
|
{
|
|
|
var BSNO = head.BSNO;
|
|
|
var modb = new ModelObjectDB();
|
|
|
DBResult result = modb.Delete(head);
|
|
|
if (result.Success == true) { MsOpSeaeDAL.DeleteDetail(BSNO); MsSysBillNoSetDAL.DeleteBsNo(head.CUSTNO); }
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
var jsonRespose = new JsonResponse { Success = false, Message = "此票业务存在派车信息,请先删除派车信息!" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public ContentResult DeleteList(string data)
|
|
|
{
|
|
|
var headData = JsonConvert.Deserialize<List<MsOpSeae>>(data);
|
|
|
var errstr = "";
|
|
|
var itemClass = "";
|
|
|
|
|
|
if (headData != null)
|
|
|
{
|
|
|
foreach (var enumValue in headData)
|
|
|
{
|
|
|
var isfee = MsOpSeaeDAL.GetFeeCount(enumValue.BSNO);
|
|
|
if (isfee)
|
|
|
{
|
|
|
if (errstr == "")
|
|
|
errstr = enumValue.CUSTNO;
|
|
|
else
|
|
|
errstr = errstr + "," + enumValue.CUSTNO;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
itemClass = "";
|
|
|
if (enumValue.ORDERTYPE != "网上订舱")
|
|
|
{
|
|
|
|
|
|
//if (enumValue.BLTYPE == "拼箱主票")
|
|
|
//{
|
|
|
T_ALL_DA T_ALL_DA = new T_ALL_DA();
|
|
|
var BLCOUNT = T_ALL_DA.GetStrSQL("BLCOUNT", "select count(*) BLCOUNT from OP_SEAE WHERE MASTERNO='" + enumValue.BSNO + "' AND BSNO<>'" + enumValue.BSNO + "'");
|
|
|
if (BLCOUNT == "0")
|
|
|
{
|
|
|
|
|
|
BLCOUNT = T_ALL_DA.GetStrSQL("BLCOUNT", "select count(*) BLCOUNT from op_letter_truck WHERE TRUCKSTATUS in ('已接单','已派车','已发单','提交派车') and BSNO='" + enumValue.BSNO + "'");
|
|
|
if (BLCOUNT == "0")
|
|
|
{
|
|
|
var BSNO = enumValue.BSNO;
|
|
|
var modb = new ModelObjectDB();
|
|
|
DBResult result = modb.Delete(enumValue);
|
|
|
if (result.Success == true)
|
|
|
{
|
|
|
MsOpSeaeDAL.DeleteDetail(BSNO); MsSysBillNoSetDAL.DeleteBsNo(enumValue.CUSTNO);
|
|
|
var blUpSQL = " insert into sys_log(GID,NAME,LOGTYPE,LOGTIME,LOGCONTENT,CREATEUSER) values(NEWID(),'" + enumValue.BSNO + "','删除海运出口','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" + enumValue.MBLNO + '(' + enumValue.CUSTOMERNAME + ')' + "','" + Convert.ToString(Session["USERID"]) + "')";
|
|
|
bool bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
|
|
|
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
var jsonRespose3 = new JsonResponse { Success = false, Message = "此票业务存在派车信息,请先删除派车信息!" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose3) };
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//var jsonRespose3 = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
//return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose3) };
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "此票拼箱主票存在分票业务,请先删除分票信息!" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
|
|
|
}
|
|
|
|
|
|
//}
|
|
|
//else
|
|
|
//{
|
|
|
|
|
|
// var BSNO = enumValue.BSNO;
|
|
|
// var modb = new ModelObjectDB();
|
|
|
// DBResult result = modb.Delete(enumValue);
|
|
|
// if (result.Success == true) { MsOpSeaeDAL.DeleteDetail(BSNO); MsSysBillNoSetDAL.DeleteBsNo(enumValue.CUSTNO); }
|
|
|
// var jsonRespose1 = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
// return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose1) };
|
|
|
//}
|
|
|
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
itemClass = "网上订舱不能删除";
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (errstr == "") errstr = "删除成功!";
|
|
|
else errstr = errstr + "存在费用,请先删除费用才能删除此票业务!";
|
|
|
if (itemClass == "网上订舱不能删除") { errstr = "网上订舱不能删除"; }
|
|
|
|
|
|
var jsonRespose = new JsonResponse { Success = true, Message = errstr };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
|
}
|
|
|
|
|
|
public ContentResult DeleteDetail(string data)
|
|
|
{
|
|
|
var head = JsonConvert.Deserialize<MsOpSeaeDetail>(data);
|
|
|
DBResult result = MsOpSeaeDAL.DeleteDetail2(head, CookieConfig.GetCookie_UserId(Request), Convert.ToString(Session["COMPANYID"]));
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
public ContentResult DeleteDetailList(string data)
|
|
|
{
|
|
|
var head = JsonConvert.Deserialize<List<MsOpSeaeDetail>>(data);
|
|
|
#region 2018年2月7日17:32:48 鼎世 李进举
|
|
|
//导入主单信息删除原有集装箱分箱信息
|
|
|
if (head != null)
|
|
|
{
|
|
|
string bsno = "";
|
|
|
if (head.Count > 0)
|
|
|
{
|
|
|
bsno = head[0].BSNO;
|
|
|
}
|
|
|
MsOpSeaeDAL.DeleteDetail2(bsno);
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
//if (head != null)
|
|
|
//{
|
|
|
// foreach (var enumValue in head)
|
|
|
// {
|
|
|
// DBResult result = MsOpSeaeDAL.DeleteDetail2(enumValue, CookieConfig.GetCookie_UserId(Request), Convert.ToString(Session["COMPANYID"]));
|
|
|
// }
|
|
|
//}
|
|
|
var jsonRespose = new JsonResponse { Success = true, Message = "删除成功!" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
public ContentResult DeleteOpCtnDetail(string data)
|
|
|
{
|
|
|
var head = JsonConvert.Deserialize<MsOpCtnDetail>(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 DeleteOpManifestDetail(string data)
|
|
|
{
|
|
|
var head = JsonConvert.Deserialize<List<MsOpSeaeManifest>>(data);
|
|
|
|
|
|
if (head != null)
|
|
|
{
|
|
|
foreach (var enumValue in head)
|
|
|
{
|
|
|
|
|
|
var modb = new ModelObjectDB();
|
|
|
DBResult result = modb.Delete(enumValue);
|
|
|
|
|
|
}
|
|
|
}
|
|
|
var jsonRespose = new JsonResponse { Success = true, Message = "删除成功!" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region 退舱
|
|
|
|
|
|
#region 退舱推航次申请
|
|
|
public ContentResult CreateTuiShen(string data, string reason, string tuioptype)
|
|
|
{
|
|
|
var headData = JsonConvert.Deserialize<List<MsOpSeae>>(data);
|
|
|
|
|
|
var result = new DBResult();
|
|
|
var errstr = "";
|
|
|
var iscancel = true;
|
|
|
if (tuioptype == "V")
|
|
|
{
|
|
|
#region 推航次
|
|
|
result = MsOpSeaeDAL.SubmitTuiShen(CookieConfig.GetCookie_UserId(Request), headData, tuioptype, reason);
|
|
|
#endregion
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
#region 退舱
|
|
|
if (headData != null)
|
|
|
{
|
|
|
foreach (var enumValue in headData)
|
|
|
{
|
|
|
|
|
|
var isfee = MsOpSeaeDAL.GetFeeCount(enumValue.BSNO);
|
|
|
if (isfee)
|
|
|
{
|
|
|
if (errstr == "")
|
|
|
errstr = enumValue.CUSTNO + "存在费用";
|
|
|
else
|
|
|
errstr = errstr + "," + enumValue.CUSTNO + "存在费用";
|
|
|
iscancel = false;
|
|
|
}
|
|
|
isfee = MsOpSeaeDAL.GetAmendCount(enumValue.BSNO);
|
|
|
if (isfee)
|
|
|
{
|
|
|
if (errstr == "")
|
|
|
errstr = enumValue.CUSTNO + "存在更改单";
|
|
|
else
|
|
|
errstr = errstr + "," + enumValue.CUSTNO + "存在更改单";
|
|
|
iscancel = false;
|
|
|
}
|
|
|
isfee = MsOpSeaeDAL.GetFenCount(enumValue.BSNO);
|
|
|
if (isfee)
|
|
|
{
|
|
|
if (errstr == "")
|
|
|
errstr = enumValue.CUSTNO + "存在分票";
|
|
|
else
|
|
|
errstr = errstr + "," + enumValue.CUSTNO + "存在分票";
|
|
|
iscancel = false;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (errstr != "")
|
|
|
errstr = errstr + ",不能申请退舱!";
|
|
|
else result = MsOpSeaeDAL.SubmitTuiShen(CookieConfig.GetCookie_UserId(Request), headData, tuioptype, reason);
|
|
|
|
|
|
}
|
|
|
#endregion
|
|
|
}
|
|
|
if (iscancel)
|
|
|
{
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
var jsonRespose = new JsonResponse { Success = false, Message = errstr };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public ContentResult SubmitTuiShenBack(string data)
|
|
|
{
|
|
|
var headData = JsonConvert.Deserialize<List<MsOpSeae>>(data);
|
|
|
|
|
|
var result = new DBResult();
|
|
|
|
|
|
result = MsOpSeaeDAL.SubmitTuiShenBack(CookieConfig.GetCookie_UserId(Request), headData);
|
|
|
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
|
}
|
|
|
|
|
|
public ContentResult AuditTuiShen(string data, string optype)
|
|
|
{
|
|
|
var headData = JsonConvert.Deserialize<List<MsOpSeae>>(data);
|
|
|
|
|
|
var result = new DBResult();
|
|
|
|
|
|
if (optype == "1")
|
|
|
{
|
|
|
|
|
|
result = MsOpSeaeDAL.AuditTuiList(headData, CookieConfig.GetCookie_UserId(Request));
|
|
|
|
|
|
}
|
|
|
else if (optype == "0")
|
|
|
{
|
|
|
result = MsOpSeaeDAL.AuditTuiBackList(headData, CookieConfig.GetCookie_UserId(Request));
|
|
|
|
|
|
}
|
|
|
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
|
}
|
|
|
|
|
|
public ContentResult GetTuiShenData(string condition)
|
|
|
{
|
|
|
MsOpTuiShen head = null;
|
|
|
head = MsOpSeaeDAL.GetTuiShenData(condition);
|
|
|
var json = JsonConvert.Serialize(
|
|
|
new { Success = true, Message = "查询成功", data = head });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
public ContentResult CancelCloseShippingOrderList(string data, string type)
|
|
|
{
|
|
|
var headData = JsonConvert.Deserialize<List<MsOpSeae>>(data);
|
|
|
var errstr = "";
|
|
|
if (headData != null)
|
|
|
{
|
|
|
foreach (var enumValue in headData)
|
|
|
{
|
|
|
var BSNO = enumValue.BSNO;
|
|
|
|
|
|
MsOpSeaeDAL.CancelCloseShippingOrder(BSNO, type);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
var jsonRespose = new JsonResponse { Success = true, Message = "" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
|
}
|
|
|
public ContentResult CancelShippingOrderList(string data, string type)
|
|
|
{
|
|
|
var headData = JsonConvert.Deserialize<List<MsOpSeae>>(data);
|
|
|
var errstr = "";
|
|
|
if (headData != null)
|
|
|
{
|
|
|
foreach (var enumValue in headData)
|
|
|
{
|
|
|
var BSNO = enumValue.BSNO;
|
|
|
|
|
|
if (type == "0")
|
|
|
{
|
|
|
var iscancel = true;
|
|
|
|
|
|
if (iscancel)
|
|
|
MsOpSeaeDAL.CancelShippingOrder(BSNO, type, Convert.ToString(Session["SHOWNAME"]));
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
var iscancel = true;
|
|
|
var isfee = MsOpSeaeDAL.GetFeeCount(enumValue.BSNO);
|
|
|
if (isfee)
|
|
|
{
|
|
|
if (errstr == "")
|
|
|
errstr = enumValue.CUSTNO + "存在费用";
|
|
|
else
|
|
|
errstr = errstr + "," + enumValue.CUSTNO + "存在费用";
|
|
|
iscancel = false;
|
|
|
}
|
|
|
isfee = MsOpSeaeDAL.GetAmendCount(enumValue.BSNO);
|
|
|
if (isfee)
|
|
|
{
|
|
|
if (errstr == "")
|
|
|
errstr = enumValue.CUSTNO + "存在更改单";
|
|
|
else
|
|
|
errstr = errstr + "," + enumValue.CUSTNO + "存在更改单";
|
|
|
iscancel = false;
|
|
|
}
|
|
|
isfee = MsOpSeaeDAL.GetFenCount(enumValue.BSNO);
|
|
|
if (isfee)
|
|
|
{
|
|
|
if (errstr == "")
|
|
|
errstr = enumValue.CUSTNO + "存在分票";
|
|
|
else
|
|
|
errstr = errstr + "," + enumValue.CUSTNO + "存在分票";
|
|
|
iscancel = false;
|
|
|
}
|
|
|
if (iscancel)
|
|
|
MsOpSeaeDAL.CancelShippingOrder(BSNO, type, Convert.ToString(Session["SHOWNAME"]));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
if (type == "1")
|
|
|
{
|
|
|
if (errstr != "") errstr = errstr + "不允许退舱!";
|
|
|
}
|
|
|
else if (errstr != "") errstr = errstr + "不允许取消退舱!";
|
|
|
if (type == "1")
|
|
|
{
|
|
|
if (errstr == "") errstr = "退舱成功!";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if (errstr == "") errstr = "取消退舱成功!";
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
var jsonRespose = new JsonResponse { Success = true, Message = errstr };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region 拼箱操作
|
|
|
public ContentResult GetFenList(int start, int limit, string sort, string condition)
|
|
|
{
|
|
|
var dataList = MsOpSeaeDAL.GetFenList(condition, CookieConfig.GetCookie_UserId(Request), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), 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 GetFenListStr(string sort, string condition)
|
|
|
{
|
|
|
var dataListStr = MsOpSeaeDAL.GetFenListStr(condition, CookieConfig.GetCookie_UserId(Request), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), sort);
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "", data = dataListStr });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
public ContentResult SaveFen(string bsno, string fenbody)
|
|
|
{
|
|
|
var bodyList = JsonConvert.Deserialize<List<MsOpSeae>>(fenbody);
|
|
|
var bodyList2 = new List<MsOpSeae>();
|
|
|
|
|
|
var isPost = true;
|
|
|
var errorstr = "";
|
|
|
if (bodyList != null)
|
|
|
{
|
|
|
foreach (var enumValue in bodyList)
|
|
|
{
|
|
|
if (enumValue.ETA == "") enumValue.ETA = null;
|
|
|
if (enumValue.ETD == "") enumValue.ETD = null;
|
|
|
if (enumValue.STLDATE == "") enumValue.STLDATE = null;
|
|
|
|
|
|
if (enumValue.ISSUEDATE == "" || (Convert.ToDateTime(enumValue.ISSUEDATE) < Convert.ToDateTime("2010-01-01"))) enumValue.ISSUEDATE = null;
|
|
|
if (enumValue.CLOSINGDATE == "") enumValue.CLOSINGDATE = null;
|
|
|
|
|
|
if (enumValue.CUSTNO == "")
|
|
|
{
|
|
|
var isuse = false;
|
|
|
var custno = "";
|
|
|
var billnoset = MsSysBillNoSetDAL.GetData("OPLBNAME='海运出口'AND RULEBLNO='委托编号'", Convert.ToString(Session["COMPANYID"]));
|
|
|
if (billnoset.BILLTYPE != "")
|
|
|
isuse = true;
|
|
|
else
|
|
|
isuse = MsBaseInfoDAL.GetRuleUse("委托编号", "1");
|
|
|
if (isuse)
|
|
|
{
|
|
|
var FENCUSTNOE = MsSysParamSetDAL.GetData("PARAMNAME='FENCUSTNOE'");
|
|
|
if (FENCUSTNOE.PARAMVALUE == "1" && enumValue.MASTERNO != "" && enumValue.BSNO != enumValue.MASTERNO)
|
|
|
{
|
|
|
enumValue.CUSTNO = MsSysBillNoSetDAL.GetFenCustNo(enumValue.MASTERNO, "op_seae");
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
|
|
|
if (billnoset.BILLTYPE != "")
|
|
|
custno = MsSysBillNoSetDAL.GetBillNo(billnoset, enumValue.ETD.ToString().Trim(), enumValue.ACCDATE.ToString().Trim(), "", "", enumValue.SALECORPID);
|
|
|
else
|
|
|
custno = MsOpSeaeDAL.getCodeRule("委托编号", "CUSTNO", enumValue.BSDATE.ToString().Trim(), enumValue.ACCDATE.ToString().Trim(), CookieConfig.GetCookie_UserId(Request), Convert.ToString(Session["COMPANYID"]));
|
|
|
|
|
|
enumValue.CUSTNO = custno;
|
|
|
}
|
|
|
}
|
|
|
//enumValue.CUSTNO = MsOpSeaeDAL.getCodeRule("委托编号", "CUSTNO", enumValue.BSDATE.ToString().Trim(), enumValue.ACCDATE.ToString().Trim(), CookieConfig.GetCookie_UserId(Request), Convert.ToString(Session["COMPANYID"]));
|
|
|
}
|
|
|
|
|
|
enumValue.CNTRTOTAL = enumValue.PKGS.ToString() + enumValue.KINDPKGS + "/" + enumValue.KGS.ToString() + "KGS/" + enumValue.CBM.ToString() + "CBM";
|
|
|
|
|
|
if (enumValue.HBLNO != "" && enumValue.HBLNO != null)
|
|
|
{
|
|
|
var ct = MsOpSeaeDAL.GetRdCount("BSNO<>'" + enumValue.BSNO + "' AND HBLNO='" + enumValue.HBLNO + "'");
|
|
|
if (ct != 0)
|
|
|
{
|
|
|
isPost = false;
|
|
|
errorstr = enumValue.HBLNO + "," + errorstr;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
bodyList2.Add(enumValue);
|
|
|
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
bodyList2.Add(enumValue);
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
DBResult result = null;
|
|
|
if (isPost == false)
|
|
|
{
|
|
|
var jsonRespose = new JsonResponse { Success = false, Message = "分提单号:" + errorstr + "分提单号重复,请修改后重新保存!" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
result = MsOpSeaeDAL.SaveFenList(bsno, bodyList2, Convert.ToString(Session["COMPANYID"]));
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public ContentResult DeleteFen(string fenbody)
|
|
|
{
|
|
|
|
|
|
|
|
|
var bodyList = JsonConvert.Deserialize<List<MsOpSeae>>(fenbody);
|
|
|
DBResult result = null;
|
|
|
|
|
|
var isPost = true;
|
|
|
var errorstr = "";
|
|
|
if (bodyList != null)
|
|
|
{
|
|
|
foreach (var enumValue in bodyList)
|
|
|
{
|
|
|
var isfee = MsOpSeaeDAL.GetFeeCount(enumValue.BSNO);
|
|
|
if (isfee)
|
|
|
{
|
|
|
isPost = false;
|
|
|
errorstr = enumValue.HBLNO + "," + errorstr;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
result = MsOpSeaeDAL.DeleteFen(enumValue.BSNO);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (isPost == false)
|
|
|
{
|
|
|
result.Success = true;
|
|
|
result.Message = "分提单号:" + errorstr + "存在费用信息,无法直接删除!";
|
|
|
};
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
public ContentResult CancelFenAdd(string data)
|
|
|
{
|
|
|
|
|
|
|
|
|
var bodyList = JsonConvert.Deserialize<List<MsOpSeae>>(data);
|
|
|
DBResult result = null;
|
|
|
|
|
|
var isPost = true;
|
|
|
var errorstr = "";
|
|
|
if (bodyList != null)
|
|
|
{
|
|
|
foreach (var enumValue in bodyList)
|
|
|
{
|
|
|
result = MsOpSeaeDAL.CancelFenAdd(enumValue.BSNO);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (isPost == false)
|
|
|
{
|
|
|
result.Success = true;
|
|
|
result.Message = "分提单号:" + errorstr + "存在费用信息,无法直接删除!";
|
|
|
};
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
public ContentResult AddFenAdd(string bsno, string data, string ctnid)
|
|
|
{
|
|
|
var bodyList = JsonConvert.Deserialize<List<MsOpSeae>>(data);
|
|
|
|
|
|
DBResult result = MsOpSeaeDAL.AddFenAdd(bsno, bodyList, ctnid);
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
|
}
|
|
|
|
|
|
public ContentResult GetFenCtnList(string condition)
|
|
|
{
|
|
|
var dataList = MsOpSeaeDAL.GetFenCtnList(condition);
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
public ContentResult SaveFenCtn(string bsno, string fenbody)
|
|
|
{
|
|
|
var bodyList = JsonConvert.Deserialize<List<MsOpSeaeDetail>>(fenbody);
|
|
|
|
|
|
DBResult result = MsOpSeaeDAL.SaveFenCtn(bsno, bodyList);
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
|
}
|
|
|
public ContentResult DeleteFenCtn(string data)
|
|
|
{
|
|
|
var head = JsonConvert.Deserialize<MsOpSeaeDetail>(data);
|
|
|
DBResult result = MsOpSeaeDAL.DeleteFenCtn(head.GID);
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region 批量修改窗体
|
|
|
public ContentResult modify(string data, string modifydata)
|
|
|
{
|
|
|
var bodyList = JsonConvert.Deserialize<List<MsOpSeae>>(data);
|
|
|
var amodifydata = JsonConvert.Deserialize<MsOpSeae>(modifydata);
|
|
|
var result = new DBResult();
|
|
|
|
|
|
if (bodyList != null)
|
|
|
{
|
|
|
result = MsOpSeaeDAL.Modify(bodyList, amodifydata);
|
|
|
}
|
|
|
var jsonRespose = new JsonResponse
|
|
|
{
|
|
|
Success = result.Success,
|
|
|
Message = result.Message,
|
|
|
};
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 客户加载_代理
|
|
|
public ContentResult GetShipperList(string condition)
|
|
|
{
|
|
|
var dataList = MsOpSeaeDAL.GetShipperList(condition);
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
public ContentResult GetShipperListRm(string CODENAME, string condition, string contractno)
|
|
|
{
|
|
|
var conditionstr = "";
|
|
|
if (CODENAME == "")
|
|
|
{
|
|
|
conditionstr = condition;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
conditionstr = condition + " and (CODENAME like '" + CODENAME + "%' or SHORTNAME like '%" + CODENAME + "%') ";
|
|
|
if (!string.IsNullOrEmpty(contractno))
|
|
|
{
|
|
|
conditionstr = conditionstr + " and (SERVICECONTRACTNO='" + contractno + "' or SERVICECONTRACTNO='') ";
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
var dataList = MsOpSeaeDAL.GetShipperList(conditionstr);
|
|
|
if (dataList.Count == 0)
|
|
|
{
|
|
|
var json = JsonConvert.Serialize(new { success = false });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 集装箱列表
|
|
|
public ContentResult GetCtnSum(string condition)
|
|
|
{
|
|
|
var rangstr = MsOpSeaeDAL.GetRangDAStr("index", CookieConfig.GetCookie_UserId(Request), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
|
|
|
if (!string.IsNullOrEmpty(rangstr))
|
|
|
{
|
|
|
if (!string.IsNullOrEmpty(condition))
|
|
|
{
|
|
|
condition = condition + " and " + rangstr;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
condition = rangstr;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
condition = condition.Replace("'", "''");
|
|
|
|
|
|
var strSql = new StringBuilder();
|
|
|
strSql.Append(" declare @sql NVARCHAR(max) ");
|
|
|
strSql.Append(" set @sql='select S.NOBILL,S.PKGS,S.KGS,S.CBM,S.TEU,F.TTLBILL' ");
|
|
|
strSql.Append(" select @sql=@sql+',sum(case when (B.BLTYPE=''整箱'' OR B.BLTYPE=''拼箱主票'') and C.CTNALL='''+t.CTN+''' then C.CTNNUM else 0 end) as C'+t.CTN ");
|
|
|
strSql.Append(" from (select CTN from code_ctn ) as t");
|
|
|
strSql.Append(" set @sql=@sql+' from op_ctn C left join op_seae B on (B.bsno=C.bsno) ");
|
|
|
strSql.Append(" left join (SELECT COUNT(BSNO) AS NOBILL,SUM(KGS) KGS,SUM(PKGS) PKGS,SUM(CBM) CBM,sum(case when (B.BLTYPE=''整箱'' OR B.BLTYPE=''拼箱主票'') THEN B.TEU ELSE 0 END) TEU from op_seae B ");
|
|
|
if (!string.IsNullOrEmpty(condition))
|
|
|
{
|
|
|
strSql.Append(" Where B.BSNO IS NOT NULL AND isnull(B.ISCANCEL,0)<>1 AND B.MASTERNO=B.BSNO AND " + condition);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strSql.Append(" Where B.BSNO IS NOT NULL AND isnull(B.ISCANCEL,0)<>1 AND B.MASTERNO=B.BSNO ");
|
|
|
}
|
|
|
|
|
|
strSql.Append(" ) S ON (1=1) ");
|
|
|
strSql.Append(" left join (SELECT COUNT(BSNO) AS TTLBILL from op_seae B ");
|
|
|
if (!string.IsNullOrEmpty(condition))
|
|
|
{
|
|
|
strSql.Append(" Where isnull(B.ISCANCEL,0)<>1 AND B.BLTYPE<>''拼箱主票'' AND " + condition);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strSql.Append(" Where isnull(B.ISCANCEL,0)<>1 AND B.BLTYPE<>''拼箱主票'' ");
|
|
|
}
|
|
|
|
|
|
strSql.Append(" ) F ON (1=1) ");
|
|
|
|
|
|
if (!string.IsNullOrEmpty(condition))
|
|
|
{
|
|
|
strSql.Append(" Where isnull(B.ISCANCEL,0)<>1 AND B.MASTERNO=B.BSNO AND " + condition);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strSql.Append(" Where isnull(B.ISCANCEL,0)<>1 AND B.MASTERNO=B.BSNO ");
|
|
|
}
|
|
|
|
|
|
strSql.Append(" GROUP BY S.NOBILL,S.KGS,S.PKGS,S.CBM,S.TEU,F.TTLBILL ' ");
|
|
|
strSql.Append(" exec(@sql) ");
|
|
|
|
|
|
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, 1, dbRptResult, "Result_Set", true);
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
public ContentResult GetSaleCtnSum(string condition)
|
|
|
{
|
|
|
condition = condition.Replace("'", "''");
|
|
|
|
|
|
var strSql = new StringBuilder();
|
|
|
strSql.Append(" declare @sql NVARCHAR(max) ");
|
|
|
strSql.Append(" set @sql='select S.NOBILL,S.PKGS,S.KGS,S.CBM' ");
|
|
|
strSql.Append(" select @sql=@sql+',sum(case C.CTNALL when '''+t.CTN+''' then C.CTNNUM else 0 end) as C'+t.CTN ");
|
|
|
strSql.Append(" from (select CTN from code_ctn ) as t");
|
|
|
strSql.Append(" set @sql=@sql+',sum(C.TEU) TEU from op_ctn C left join op_seae B on (B.bsno=C.bsno) ");
|
|
|
strSql.Append(" left join (SELECT COUNT(BSNO) AS NOBILL,SUM(KGS) KGS,SUM(PKGS) PKGS,SUM(CBM) CBM from op_seae B ");
|
|
|
if (!string.IsNullOrEmpty(condition))
|
|
|
{
|
|
|
strSql.Append(" Where " + condition);
|
|
|
}
|
|
|
|
|
|
strSql.Append(" ) S ON (1=1) ");
|
|
|
|
|
|
if (!string.IsNullOrEmpty(condition))
|
|
|
{
|
|
|
strSql.Append(" Where " + condition);
|
|
|
}
|
|
|
|
|
|
strSql.Append(" GROUP BY S.NOBILL,S.KGS,S.PKGS,S.CBM ' ");
|
|
|
strSql.Append(" exec(@sql) ");
|
|
|
|
|
|
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, 1, dbRptResult, "Result_Set", true);
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
public ContentResult GetCtnList(string condition)
|
|
|
{
|
|
|
var rangstr = MsOpSeaeDAL.GetRangDAStr("index", CookieConfig.GetCookie_UserId(Request), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
|
|
|
if (!string.IsNullOrEmpty(rangstr))
|
|
|
{
|
|
|
if (!string.IsNullOrEmpty(condition))
|
|
|
{
|
|
|
condition = condition + " and " + rangstr;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
condition = rangstr;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
var strSql = new StringBuilder();
|
|
|
strSql.Append(" SELECT DISTINCT C.CTNALL from op_ctn C left join op_seae B on (B.bsno=C.bsno) ");
|
|
|
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 GetOpCtnList(int start, int limit, string condition, string sort, string printstr = "false")
|
|
|
{
|
|
|
var rangstr = MsOpSeaeDAL.GetRangDAStr("index", CookieConfig.GetCookie_UserId(Request), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
|
|
|
if (!string.IsNullOrEmpty(rangstr))
|
|
|
{
|
|
|
if (!string.IsNullOrEmpty(condition))
|
|
|
{
|
|
|
condition = condition + " and " + rangstr;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
condition = rangstr;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
var strSql = new StringBuilder();
|
|
|
strSql.Append(" SELECT C.CTN_ID,C.BSNO,C.CTNCODE,C.CTNALL,C.CNTRNO,C.SEALNO,C.PKGS,C.KGS,C.CBM,'F' AS STATUS,B.BSDATE,B.MBLNO,B.VESSEL,B.VOYNO,B.ETD,B.ETA,B.PORTLOADID,");
|
|
|
strSql.Append(" B.PORTLOAD,B.PORTDISCHARGEID,B.PORTDISCHARGE,B.PLACERECEIPT,B.PLACEDELIVERYID,B.PLACEDELIVERY,B.DESTINATIONID,B.DESTINATION,B.SERVICE,B.CARGOID");
|
|
|
strSql.Append(" from OP_CTN C LEFT JOIN OP_SEAE B ON (B.BSNO=C.BSNO) Where B.MBLNO<>'' ");
|
|
|
if (!string.IsNullOrEmpty(condition))
|
|
|
{
|
|
|
strSql.Append(" AND " + condition);
|
|
|
}
|
|
|
|
|
|
var sortstring = DatasetSort.Getsortstring(sort);
|
|
|
if (!string.IsNullOrEmpty(sortstring))
|
|
|
{
|
|
|
strSql.Append(" order by " + sortstring);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
|
|
|
strSql.Append(" order by B.BSDATE desc");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
if ((!string.IsNullOrEmpty(printstr)) && (printstr == "true"))
|
|
|
{
|
|
|
|
|
|
|
|
|
var jsonRespose = new JsonResponse
|
|
|
{
|
|
|
Success = true,
|
|
|
Message = condition,
|
|
|
Data = strSql.ToString()
|
|
|
};
|
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
|
|
|
|
|
|
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 };
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
#region 生成报关信息
|
|
|
public ContentResult SaveBG(string data, string data2, string data3)
|
|
|
{
|
|
|
var aaa = "";
|
|
|
|
|
|
var head = JsonConvert.Deserialize<MsOpSeae>(data.Replace("}", ",") + data2.Replace("{", "").Replace("}", ",") + data3.Replace("{", ""));
|
|
|
|
|
|
var headData = new MsOpApply();
|
|
|
|
|
|
|
|
|
if (headData.CORPID == "" || headData.CORPID == null)
|
|
|
{
|
|
|
headData.CORPID = Convert.ToString(Session["COMPANYID"]);
|
|
|
}
|
|
|
headData.MASTERNO = head.BSNO;
|
|
|
headData.INPUTBY = Convert.ToString(Session["SHOWNAME"]);
|
|
|
|
|
|
headData.BSDATE = DateTime.Now;
|
|
|
headData.DbOperationType = DbOperationType.DbotIns;
|
|
|
headData.CUSTOMERNAME = head.CUSTOMERNAME;
|
|
|
headData.MBLNO = head.MBLNO;
|
|
|
headData.VESSEL = head.VESSEL;
|
|
|
headData.VOYNO = head.VOYNO;
|
|
|
headData.BSSOURCE = head.BSSOURCE;
|
|
|
headData.BSSOURCEDETAIL = head.BSSOURCEDETAIL;
|
|
|
headData.ETD = head.ETD;
|
|
|
headData.ETA = head.ETA;
|
|
|
headData.PKGS = Convert.ToDecimal(head.PKGS);
|
|
|
headData.KGS = Convert.ToDecimal(head.KGS);
|
|
|
headData.CBM = Convert.ToDecimal(head.CBM);
|
|
|
headData.PORTLOAD = head.PORTLOAD;
|
|
|
headData.PORTDISCHARGE = head.PORTDISCHARGE;
|
|
|
headData.SALE = head.SALE;
|
|
|
headData.SALEDEPT = head.SALEDEPT;
|
|
|
headData.BSTYPE = "1";
|
|
|
headData.CUSTOMNO = head.CUSTOMNO;
|
|
|
headData.CUSTOMDATE = head.CUSTOMDATE;
|
|
|
headData.INSPECTIONNO = head.INSPECTIONNO;
|
|
|
headData.INSPECTIONDATE = head.INSPECTIONDATE;
|
|
|
headData.ENTERP = head.ENTERP;
|
|
|
headData.ENTERPID = head.ENTERPID;
|
|
|
|
|
|
var modb = new ModelObjectDB();
|
|
|
DBResult result = modb.Save(headData);
|
|
|
|
|
|
if (result.Success == true)
|
|
|
{
|
|
|
result.Success = true;
|
|
|
result.Message = "生成成功";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
result.Success = false;
|
|
|
result.Message = "生成过程发生错误";
|
|
|
|
|
|
}
|
|
|
|
|
|
var jsonRespose = new JsonResponse
|
|
|
{
|
|
|
Success = result.Success,
|
|
|
Message = result.Message
|
|
|
};
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 生成海运进口信息
|
|
|
public ContentResult SaveToSeai(string bsno, string comp, string op, string custservice)
|
|
|
{
|
|
|
T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
|
|
|
var BLCOUNT = T_ALL_DA.GetStrSQL("BLCOUNT", "select COUNT(*) BLCOUNT from OP_SEAETOSEAI where BSNO='" + bsno + "'");
|
|
|
|
|
|
if (BLCOUNT != "0")
|
|
|
{
|
|
|
var jsonRespose = new JsonResponse { Success = false, Message = "已生成至进口,不允许重复生成!" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
var blUpSQL1 = " delete from OP_SEAETOSEAI where BSNO='" + bsno + "' and ISIMP=0 ";
|
|
|
bool bl1 = T_ALL_DA.GetExecuteSqlCommand(blUpSQL1);
|
|
|
DBResult result = null;
|
|
|
var opList = op.Split(',');
|
|
|
foreach (var opstr in opList)
|
|
|
{
|
|
|
var headData = new MsOpSeaeToSeai();
|
|
|
headData.BSNO = bsno;
|
|
|
headData.SEAIOP = opstr;
|
|
|
headData.SUBCOMPANYID = comp;
|
|
|
headData.ISIMP = "0";
|
|
|
headData.IMPTIME = null;
|
|
|
headData.INPUTTIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
headData.INPUTBY = CookieConfig.GetCookie_UserId(Request);
|
|
|
headData.DbOperationType = DbOperationType.DbotIns;
|
|
|
var modb = new ModelObjectDB();
|
|
|
result = modb.Save(headData);
|
|
|
}
|
|
|
if (result.Success == true)
|
|
|
{
|
|
|
result.Message = "已生成!";
|
|
|
var blUpSQL = "insert into op_status(ST_ID,BSNO,STATUS,ISCOMP,COMPTIME,INPUTTIME,STTYPE) values(NEWID(),'" + bsno + "','生成进口',1,'" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','1')";
|
|
|
bool bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
|
|
|
}
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
public ContentResult SaveToSeaiList(string body, string comp, string op, string custservice)
|
|
|
{
|
|
|
var bodyList = JsonConvert.Deserialize<List<MsOpSeae>>(body);
|
|
|
|
|
|
T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
|
|
|
DBResult result = null;
|
|
|
var i = 0;
|
|
|
|
|
|
if (bodyList != null)
|
|
|
{
|
|
|
foreach (var enumValue in bodyList)
|
|
|
{
|
|
|
var blUpSQL1 = " delete from OP_SEAETOSEAI where BSNO='" + enumValue.BSNO + "' and ISIMP=0 ";
|
|
|
bool bl1 = T_ALL_DA.GetExecuteSqlCommand(blUpSQL1);
|
|
|
|
|
|
var opList = op.Split(',');
|
|
|
foreach (var opstr in opList)
|
|
|
{
|
|
|
var headData = new MsOpSeaeToSeai();
|
|
|
headData.BSNO = enumValue.BSNO;
|
|
|
headData.SEAIOP = opstr;
|
|
|
headData.SUBCOMPANYID = comp;
|
|
|
headData.ISIMP = "0";
|
|
|
headData.IMPTIME = null;
|
|
|
headData.INPUTTIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
headData.INPUTBY = CookieConfig.GetCookie_UserId(Request);
|
|
|
headData.DbOperationType = DbOperationType.DbotIns;
|
|
|
var modb = new ModelObjectDB();
|
|
|
result = modb.Save(headData);
|
|
|
}
|
|
|
if (result.Success == true)
|
|
|
{
|
|
|
i = i + 1;
|
|
|
result.Message = "已生成!";
|
|
|
var blUpSQL = "insert into op_status(ST_ID,BSNO,STATUS,ISCOMP,COMPTIME,INPUTTIME,STTYPE) values(NEWID(),'" + enumValue.BSNO + "','生成进口',1,'" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','1')";
|
|
|
bool bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = "已成功生成(" + i.ToString() + ")票" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
|
}
|
|
|
public static DBResult SaveToSeaiFn(MsOpSeae head,string copystatus,string MASTERNO, string companyid, string username, string userid, out string BSNO, out string CUSTNO)
|
|
|
{
|
|
|
var result = new DBResult();
|
|
|
var headData = new MsOpSeai();
|
|
|
var isuse = false;
|
|
|
var billnoset = MsSysBillNoSetDAL.GetData("OPLBNAME='海运进口'", companyid);
|
|
|
if (billnoset.BILLTYPE != "")
|
|
|
isuse = true;
|
|
|
else
|
|
|
isuse = MsBaseInfoDAL.GetRuleUse("委托编号", "2");
|
|
|
|
|
|
|
|
|
headData.CREATETIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
headData.BSNO = "topseai" + Guid.NewGuid().ToString();
|
|
|
if (MASTERNO != "")
|
|
|
headData.MASTERNO = MASTERNO;
|
|
|
else
|
|
|
headData.MASTERNO = headData.BSNO;
|
|
|
headData.CUSTOMERNAME = head.CUSTOMERNAME;
|
|
|
headData.ORDERTYPE = "出口转入";
|
|
|
headData.MBLNO = head.MBLNO;
|
|
|
headData.VESSEL = head.VESSEL;
|
|
|
headData.VOYNO = head.VOYNO;
|
|
|
headData.SALE = head.SALE;
|
|
|
headData.CARRIER = head.CARRIER;
|
|
|
headData.HBLNO = head.HBLNO;
|
|
|
headData.BSSOURCE = head.BSSOURCE;
|
|
|
headData.BSSOURCEDETAIL = head.BSSOURCEDETAIL;
|
|
|
headData.ETD = head.ETA;
|
|
|
headData.ACCDATE = DateTime.Now.ToString("yyyy-MM");
|
|
|
headData.ETA = head.ETD;
|
|
|
headData.PKGS = Convert.ToDecimal(head.PKGS);
|
|
|
headData.KGS = Convert.ToDecimal(head.KGS);
|
|
|
headData.CBM = Convert.ToDecimal(head.CBM);
|
|
|
headData.PORTLOAD = head.PORTLOAD;
|
|
|
headData.PORTDISCHARGE = head.PORTDISCHARGE;
|
|
|
headData.PORTLOADID = head.PORTLOADID;
|
|
|
headData.PORTDISCHARGEID = head.PORTDISCHARGEID;
|
|
|
headData.SHIPPERID = head.SHIPPERID;
|
|
|
headData.SHIPPER = head.SHIPPER;
|
|
|
headData.CONSIGNEEID = head.CONSIGNEEID;
|
|
|
headData.CONSIGNEE = head.CONSIGNEE;
|
|
|
headData.NOTIFYPARTYID = head.NOTIFYPARTYID;
|
|
|
headData.NOTIFYPARTY = head.NOTIFYPARTY;
|
|
|
headData.MARKS = head.MARKS;
|
|
|
headData.DESCRIPTION = head.DESCRIPTION;
|
|
|
headData.GROSSWEIGHT = head.GROSSWEIGHT;
|
|
|
headData.MEASUREMENT = head.MEASUREMENT;
|
|
|
headData.KINDPKGS = head.KINDPKGS;
|
|
|
headData.NOPKGS = head.NOPKGS;
|
|
|
headData.TOTALNO = head.TOTALNO;
|
|
|
headData.BLFRT = head.BLFRT;
|
|
|
headData.APPLYNO = head.APPLYNO;
|
|
|
headData.CNTR1 = head.CNTR1;
|
|
|
headData.CNTR2 = head.CNTR2;
|
|
|
headData.CNTR3 = head.CNTR3;
|
|
|
headData.CNTR4 = head.CNTR4;
|
|
|
headData.CNTR5 = head.CNTR5;
|
|
|
headData.CNTR6 = head.CNTR6;
|
|
|
headData.CNTR7 = head.CNTR7;
|
|
|
headData.CNTR8 = head.CNTR8;
|
|
|
headData.CNTR9 = head.CNTR9;
|
|
|
headData.CNTR10 = head.CNTR10;
|
|
|
headData.OTCNTR = head.OTCNTR;
|
|
|
headData.CNTRTOTAL = head.CNTRTOTAL;
|
|
|
headData.CNTRNO = head.CNTRNO;
|
|
|
headData.REMARK = head.REMARK;
|
|
|
headData.SALE = username;
|
|
|
headData.TRADETERM = head.TRADETERM;
|
|
|
headData.ISSUETYPE = head.ISSUETYPE;
|
|
|
headData.ISSUEPLACE = head.ISSUEPLACE;
|
|
|
headData.ISSUEPLACEID = head.ISSUEPLACEID;
|
|
|
headData.ISSUEDATE = head.ISSUEDATE;
|
|
|
if (headData.ETA == "") headData.ETA = null;
|
|
|
if (headData.ETD == "") headData.ETD = null;
|
|
|
|
|
|
|
|
|
|
|
|
if (headData.CORPID == "" || headData.CORPID == null)
|
|
|
{
|
|
|
headData.CORPID = companyid;
|
|
|
}
|
|
|
headData.INPUTBY = username;
|
|
|
headData.OP = username;
|
|
|
headData.BSDATE = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
headData.DbOperationType = DbOperationType.DbotIns;
|
|
|
headData.CREATETIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
if (billnoset.BILLTYPE != "")
|
|
|
{
|
|
|
var FENCUSTNOE = MsSysParamSetDAL.GetData("PARAMNAME='FENCUSTNOE'");
|
|
|
if (FENCUSTNOE.PARAMVALUE == "1" && headData.MASTERNO != "" && headData.BSNO != headData.MASTERNO)
|
|
|
{
|
|
|
headData.CUSTNO = MsSysBillNoSetDAL.GetFenCustNo(headData.MASTERNO, "op_seai");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if (headData.ETD!="")
|
|
|
headData.CUSTNO = MsSysBillNoSetDAL.GetBillNo(billnoset, headData.ETD.ToString().Trim(), headData.ACCDATE.ToString().Trim());
|
|
|
else headData.CUSTNO = MsSysBillNoSetDAL.GetBillNo(billnoset, headData.ETA.ToString().Trim(), headData.ACCDATE.ToString().Trim());
|
|
|
|
|
|
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
headData.CUSTNO = MsOpSeaiDAL.getCodeRule("委托编号", "CUSTNO", headData.BSDATE.ToString().Trim(), headData.ACCDATE.ToString().Trim(), userid, companyid);
|
|
|
BSNO = headData.BSNO;
|
|
|
CUSTNO = headData.CUSTNO;
|
|
|
headData.BLTYPE = head.BLTYPE;
|
|
|
var modb = new ModelObjectDB();
|
|
|
result = modb.Save(headData);
|
|
|
|
|
|
if (result.Success)
|
|
|
{
|
|
|
var bodyList = MsOpSeaeDAL.GetBodyList("BSNO='" + head.BSNO + "'");
|
|
|
if (bodyList != null)
|
|
|
{
|
|
|
foreach (var ctnenumValue in bodyList)
|
|
|
{
|
|
|
ctnenumValue.CTN_ID = Guid.NewGuid().ToString();
|
|
|
ctnenumValue.BSNO = BSNO;
|
|
|
ctnenumValue.DbOperationType = DbOperationType.DbotIns;
|
|
|
|
|
|
var modb2 = new ModelObjectDB();
|
|
|
result = modb2.Save(ctnenumValue);
|
|
|
|
|
|
}
|
|
|
}
|
|
|
var feelist = MsChFeeDAL.GetAllDataList("BSNO='" + head.BSNO + "' AND FEEFRT='CC'");
|
|
|
if (feelist != null)
|
|
|
{
|
|
|
for (int _i = 0; _i < feelist.Count; _i++)
|
|
|
{
|
|
|
feelist[_i].BsNo = "*";
|
|
|
feelist[_i].FeeFrt = "PP";
|
|
|
feelist[_i].INPUTMODE = "出口转入";
|
|
|
feelist[_i].WmsOutBsNo = head.BSNO;
|
|
|
}
|
|
|
MsChFeeDAL.SaveFee(feelist, BSNO, userid);
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
|
|
|
public ContentResult SeaeSaveSeai(string data,string copystatus)
|
|
|
{
|
|
|
|
|
|
var ToDataList = JsonConvert.Deserialize<List<MsOpSeaeToSeai>>(data);
|
|
|
DBResult result = null;
|
|
|
var isPost = true;
|
|
|
var errorstr = "";
|
|
|
|
|
|
|
|
|
if (ToDataList != null)
|
|
|
{
|
|
|
T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
|
|
|
foreach (var enumValue in ToDataList)
|
|
|
{
|
|
|
var head = MsOpSeaeDAL.GetData("BSNO='" + enumValue.BSNO + "'");
|
|
|
|
|
|
var headData = new MsOpSeai();
|
|
|
|
|
|
|
|
|
if (enumValue.ISIMP == "1" || enumValue.ISIMP == "True")
|
|
|
{
|
|
|
headData = MsOpSeaiDAL.GetData("BSNO=(SELECT TOP 1 SEAIBSNO FROM OP_SEAETOSEAI WHERE BSNO='" + enumValue.BSNO + "' AND ISIMP=1 ORDER BY IMPTIME DESC)");
|
|
|
var bodyList = MsOpSeaeDAL.GetBodyList("BSNO='" + enumValue.BSNO + "'");
|
|
|
headData.CUSTOMERNAME = head.CUSTOMERNAME;
|
|
|
headData.CARRIER = head.CARRIER;
|
|
|
headData.YARD = head.YARD;
|
|
|
headData.SALE = head.SALE;
|
|
|
headData.HBLNO = head.HBLNO;
|
|
|
headData.MBLNO = head.MBLNO;
|
|
|
headData.VESSEL = head.VESSEL;
|
|
|
headData.VOYNO = head.VOYNO;
|
|
|
headData.BSSOURCE = head.BSSOURCE;
|
|
|
headData.BSSOURCEDETAIL = head.BSSOURCEDETAIL;
|
|
|
headData.ETD = head.ETA;
|
|
|
headData.ETA = head.ETD;
|
|
|
headData.PKGS = Convert.ToDecimal(head.PKGS);
|
|
|
headData.KGS = Convert.ToDecimal(head.KGS);
|
|
|
headData.CBM = Convert.ToDecimal(head.CBM);
|
|
|
headData.PORTLOAD = head.PORTLOAD;
|
|
|
headData.PORTDISCHARGE = head.PORTDISCHARGE;
|
|
|
headData.PORTLOADID = head.PORTLOADID;
|
|
|
headData.PORTDISCHARGEID = head.PORTDISCHARGEID;
|
|
|
headData.SHIPPERID = head.SHIPPERID;
|
|
|
headData.SHIPPER = head.SHIPPER;
|
|
|
headData.CONSIGNEEID = head.CONSIGNEEID;
|
|
|
headData.CONSIGNEE = head.CONSIGNEE;
|
|
|
headData.NOTIFYPARTYID = head.NOTIFYPARTYID;
|
|
|
headData.NOTIFYPARTY = head.NOTIFYPARTY;
|
|
|
headData.MARKS = head.MARKS;
|
|
|
headData.DESCRIPTION = head.DESCRIPTION;
|
|
|
headData.GROSSWEIGHT = head.GROSSWEIGHT;
|
|
|
headData.MEASUREMENT = head.MEASUREMENT;
|
|
|
headData.KINDPKGS = head.KINDPKGS;
|
|
|
headData.NOPKGS = head.NOPKGS;
|
|
|
headData.TOTALNO = head.TOTALNO;
|
|
|
headData.BLFRT = head.BLFRT;
|
|
|
headData.CNTR1 = head.CNTR1;
|
|
|
headData.CNTR2 = head.CNTR2;
|
|
|
headData.CNTR3 = head.CNTR3;
|
|
|
headData.CNTR4 = head.CNTR4;
|
|
|
headData.CNTR5 = head.CNTR5;
|
|
|
headData.CNTR6 = head.CNTR6;
|
|
|
headData.CNTR7 = head.CNTR7;
|
|
|
headData.CNTR8 = head.CNTR8;
|
|
|
headData.CNTR9 = head.CNTR9;
|
|
|
headData.CNTR10 = head.CNTR10;
|
|
|
headData.OTCNTR = head.OTCNTR;
|
|
|
headData.CNTRTOTAL = head.CNTRTOTAL;
|
|
|
headData.CNTRNO = head.CNTRNO;
|
|
|
headData.TRADETERM = head.TRADETERM;
|
|
|
headData.ISSUETYPE = head.ISSUETYPE;
|
|
|
headData.ISSUEPLACE = head.ISSUEPLACE;
|
|
|
headData.ISSUEPLACEID = head.ISSUEPLACEID;
|
|
|
headData.ISSUEDATE = head.ISSUEDATE;
|
|
|
|
|
|
if (headData.ETA == "") headData.ETA = null;
|
|
|
if (headData.ETD == "") headData.ETD = null;
|
|
|
|
|
|
|
|
|
headData.INPUTBY = Convert.ToString(Session["SHOWNAME"]);
|
|
|
headData.BSDATE = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
headData.DbOperationType = DbOperationType.DbotUpd;
|
|
|
headData.BLTYPE = head.BLTYPE;
|
|
|
var modb = new ModelObjectDB();
|
|
|
result = modb.Save(headData);
|
|
|
var BSNO = headData.BSNO;
|
|
|
if (result.Success == true)
|
|
|
{
|
|
|
|
|
|
var blUpSQL = " delete from op_ctn where bsno='" + BSNO + "'";
|
|
|
bool bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
|
|
|
|
|
|
if (bodyList != null)
|
|
|
{
|
|
|
foreach (var ctnenumValue in bodyList)
|
|
|
{
|
|
|
ctnenumValue.CTN_ID = Guid.NewGuid().ToString();
|
|
|
ctnenumValue.BSNO = BSNO;
|
|
|
ctnenumValue.DbOperationType = DbOperationType.DbotIns;
|
|
|
|
|
|
var modb2 = new ModelObjectDB();
|
|
|
result = modb2.Save(ctnenumValue);
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//enumValue.ISIMP = "1";
|
|
|
//enumValue.IMPTIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
//enumValue.DbOperationType = DbOperationType.DbotUpd;
|
|
|
//var modb3 = new ModelObjectDB();
|
|
|
//result = modb3.Save(enumValue);
|
|
|
var blUpSQL1 = " update OP_SEAETOSEAI set ISIMP=1,IMPTIME='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "' where BSNO='" + enumValue.BSNO + "' and ISIMP=0 ";
|
|
|
bool bl1 = T_ALL_DA.GetExecuteSqlCommand(blUpSQL1);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
var BSNO = "";
|
|
|
var CUSTNO = "";
|
|
|
result = SaveToSeaiFn(head, copystatus, "", Convert.ToString(Session["COMPANYID"]), Convert.ToString(Session["SHOWNAME"]), CookieConfig.GetCookie_UserId(Request), out BSNO, out CUSTNO);
|
|
|
|
|
|
|
|
|
if (head.BLTYPE == "拼箱主票")
|
|
|
{
|
|
|
var fendataList = MsOpSeaeDAL.GetFenList("MASTERNO='" + head.BSNO + "' and MASTERNO<>'" + head.BSNO + "' ", CookieConfig.GetCookie_UserId(Request), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), "", false);
|
|
|
if (fendataList != null)
|
|
|
{
|
|
|
foreach (var fenumValue in fendataList)
|
|
|
{
|
|
|
var fenbsno = "";
|
|
|
var fencustno = "";
|
|
|
var iscreate = SaveToSeaiFn(fenumValue, copystatus, BSNO, Convert.ToString(Session["COMPANYID"]), Convert.ToString(Session["SHOWNAME"]), CookieConfig.GetCookie_UserId(Request), out fenbsno, out fencustno);
|
|
|
if (iscreate.Success == false)
|
|
|
{
|
|
|
MsSysBillNoSetDAL.DeleteBsNo(fencustno);
|
|
|
errorstr = errorstr + " 分票:" + fencustno + " 引入发生错误!";
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
if (result.Success == true)
|
|
|
{
|
|
|
|
|
|
var blUpSQL1 = " update OP_SEAETOSEAI set ISIMP=1,IMPTIME='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "' where BSNO='" + enumValue.BSNO + "' and ISIMP=0 ";
|
|
|
bool bl1 = T_ALL_DA.GetExecuteSqlCommand(blUpSQL1);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
MsSysBillNoSetDAL.DeleteBsNo(CUSTNO);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (isPost)
|
|
|
{
|
|
|
result.Success = true;
|
|
|
result.Message = "生成成功";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
result.Success = false;
|
|
|
result.Message = "生成过程发生错误" + errorstr;
|
|
|
|
|
|
}
|
|
|
|
|
|
var jsonRespose = new JsonResponse
|
|
|
{
|
|
|
Success = result.Success,
|
|
|
Message = result.Message
|
|
|
};
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
public ContentResult SaveSeai(string data, string data2, string data3, string body)
|
|
|
{
|
|
|
|
|
|
|
|
|
var head = JsonConvert.Deserialize<MsOpSeae>(data.Replace("}", ",") + data2.Replace("{", "").Replace("}", ",") + data3.Replace("{", ""));
|
|
|
var bodyList = JsonConvert.Deserialize<List<MsOpSeaeDetail>>(body);
|
|
|
var headData = new MsOpSeai();
|
|
|
|
|
|
var isPost = true;
|
|
|
var errorstr = "";
|
|
|
var iscreatecustno = false;
|
|
|
|
|
|
var isuse = false;
|
|
|
var billnoset = MsSysBillNoSetDAL.GetData("OPLBNAME='海运进口'", Convert.ToString(Session["COMPANYID"]));
|
|
|
if (billnoset.BILLTYPE != "")
|
|
|
isuse = true;
|
|
|
else
|
|
|
isuse = MsBaseInfoDAL.GetRuleUse("委托编号", "2");
|
|
|
|
|
|
headData.BSNO = "topseai" + Guid.NewGuid().ToString();
|
|
|
headData.MASTERNO = headData.BSNO;
|
|
|
headData.CUSTOMERNAME = head.CUSTOMERNAME;
|
|
|
headData.MBLNO = head.MBLNO;
|
|
|
headData.HBLNO = head.HBLNO;
|
|
|
headData.CARRIER = head.CARRIER;
|
|
|
headData.SALE = head.SALE;
|
|
|
headData.VESSEL = head.VESSEL;
|
|
|
headData.VOYNO = head.VOYNO;
|
|
|
headData.BSSOURCE = head.BSSOURCE;
|
|
|
headData.BSSOURCEDETAIL = head.BSSOURCEDETAIL;
|
|
|
headData.ETD = head.ETA;
|
|
|
headData.ACCDATE = DateTime.Now.ToString("yyyy-MM");
|
|
|
headData.ETA = head.ETD;
|
|
|
headData.PKGS = Convert.ToDecimal(head.PKGS);
|
|
|
headData.KGS = Convert.ToDecimal(head.KGS);
|
|
|
headData.CBM = Convert.ToDecimal(head.CBM);
|
|
|
headData.PORTLOAD = head.PORTLOAD;
|
|
|
headData.PORTDISCHARGE = head.PORTDISCHARGE;
|
|
|
headData.PORTLOADID = head.PORTLOADID;
|
|
|
headData.PORTDISCHARGEID = head.PORTDISCHARGEID;
|
|
|
headData.SHIPPERID = head.SHIPPERID;
|
|
|
headData.SHIPPER = head.SHIPPER;
|
|
|
headData.CONSIGNEEID = head.CONSIGNEEID;
|
|
|
headData.CONSIGNEE = head.CONSIGNEE;
|
|
|
headData.NOTIFYPARTYID = head.NOTIFYPARTYID;
|
|
|
headData.NOTIFYPARTY = head.NOTIFYPARTY;
|
|
|
headData.MARKS = head.MARKS;
|
|
|
headData.DESCRIPTION = head.DESCRIPTION;
|
|
|
headData.GROSSWEIGHT = head.GROSSWEIGHT;
|
|
|
headData.MEASUREMENT = head.MEASUREMENT;
|
|
|
headData.KINDPKGS = head.KINDPKGS;
|
|
|
headData.NOPKGS = head.NOPKGS;
|
|
|
headData.TOTALNO = head.TOTALNO;
|
|
|
headData.BLFRT = head.BLFRT;
|
|
|
headData.APPLYNO = head.APPLYNO;
|
|
|
|
|
|
if (headData.ETA == "") headData.ETA = null;
|
|
|
if (headData.ETD == "") headData.ETD = null;
|
|
|
|
|
|
if (headData.CUSTNO.Trim() == "" || headData.CUSTNO == null)
|
|
|
{
|
|
|
|
|
|
if (isuse)
|
|
|
{
|
|
|
if (billnoset.BILLTYPE != "")
|
|
|
{
|
|
|
var FENCUSTNOE = MsSysParamSetDAL.GetData("PARAMNAME='FENCUSTNOE'");
|
|
|
if (FENCUSTNOE.PARAMVALUE == "1" && headData.MASTERNO != "" && headData.BSNO != headData.MASTERNO)
|
|
|
{
|
|
|
headData.CUSTNO = MsSysBillNoSetDAL.GetFenCustNo(headData.MASTERNO, "op_seai");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if (headData.ETD != "")
|
|
|
headData.CUSTNO = MsSysBillNoSetDAL.GetBillNo(billnoset, headData.ETD.ToString().Trim(), headData.ACCDATE.ToString().Trim());
|
|
|
else headData.CUSTNO = MsSysBillNoSetDAL.GetBillNo(billnoset, headData.ETA.ToString().Trim(), headData.ACCDATE.ToString().Trim());
|
|
|
iscreatecustno = true;
|
|
|
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
headData.CUSTNO = MsOpSeaiDAL.getCodeRule("委托编号", "CUSTNO", headData.BSDATE.ToString().Trim(), headData.ACCDATE.ToString().Trim(), CookieConfig.GetCookie_UserId(Request), Convert.ToString(Session["COMPANYID"]));
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
|
|
|
var ct = MsOpSeaiDAL.GetRdCount("BSNO<>'" + headData.BSNO + "' AND CUSTNO='" + headData.CUSTNO + "' and CORPID='" + Convert.ToString(Session["COMPANYID"]) + "'");
|
|
|
if (ct != 0)
|
|
|
{
|
|
|
isPost = false;
|
|
|
errorstr = "委托编号重复";
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
if (headData.CUSTNO == "")
|
|
|
{
|
|
|
isPost = false;
|
|
|
errorstr = "委托编号为空";
|
|
|
}
|
|
|
|
|
|
//
|
|
|
if (headData.MBLNO != "" && headData.MBLNO != null && headData.BLTYPE != "拼箱分票")
|
|
|
{
|
|
|
var ct = MsOpSeaiDAL.GetRdCount("BSNO<>'" + headData.BSNO + "' AND MBLNO='" + headData.MBLNO + "' and CORPID='" + Convert.ToString(Session["COMPANYID"]) + "'");
|
|
|
if (ct != 0)
|
|
|
{
|
|
|
isPost = false;
|
|
|
errorstr = "主提单号重复";
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
isuse = MsBaseInfoDAL.GetRuleUse("主提单号", "2");
|
|
|
if (isuse)
|
|
|
{
|
|
|
headData.CUSTNO = MsOpSeaiDAL.getCodeRule("主提单号", "MBLNO", headData.BSDATE.ToString().Trim(), headData.ACCDATE.ToString().Trim(), CookieConfig.GetCookie_UserId(Request), Convert.ToString(Session["COMPANYID"]));
|
|
|
}
|
|
|
}
|
|
|
//
|
|
|
if (headData.HBLNO != "" && headData.HBLNO != null)
|
|
|
{
|
|
|
var ct = MsOpSeaiDAL.GetRdCount("BSNO<>'" + headData.BSNO + "' AND HBLNO='" + headData.HBLNO + "' and CORPID='" + Convert.ToString(Session["COMPANYID"]) + "'");
|
|
|
if (ct != 0)
|
|
|
{
|
|
|
isPost = false;
|
|
|
errorstr = "分提单号重复";
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
isuse = MsBaseInfoDAL.GetRuleUse("分提单号", "2");
|
|
|
if (isuse)
|
|
|
{
|
|
|
headData.HBLNO = MsOpSeaiDAL.getCodeRule("分提单号", "HBLNO", headData.BSDATE.ToString().Trim(), headData.ACCDATE.ToString().Trim(), CookieConfig.GetCookie_UserId(Request), Convert.ToString(Session["COMPANYID"]));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (headData.ORDERNO != "" && headData.ORDERNO != null)
|
|
|
{
|
|
|
var ct = MsOpSeaiDAL.GetRdCount("BSNO<>'" + headData.BSNO + "' AND ORDERNO='" + headData.ORDERNO + "'");
|
|
|
if (ct != 0)
|
|
|
{
|
|
|
isPost = false;
|
|
|
errorstr = "订舱编号重复";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
if (headData.CORPID == "" || headData.CORPID == null)
|
|
|
{
|
|
|
headData.CORPID = Convert.ToString(Session["COMPANYID"]);
|
|
|
}
|
|
|
headData.INPUTBY = Convert.ToString(Session["SHOWNAME"]);
|
|
|
headData.BSDATE = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
headData.DbOperationType = DbOperationType.DbotIns;
|
|
|
headData.ORDERTYPE = "操作录入";
|
|
|
headData.CREATETIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
if (headData.BSTYPE == null)
|
|
|
{
|
|
|
headData.BSTYPE = "普通货";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if (headData.BSTYPE.ToString().Trim() == "")
|
|
|
{
|
|
|
headData.BSTYPE = "普通货";
|
|
|
}
|
|
|
}
|
|
|
//
|
|
|
if (headData.BLTYPE == null)
|
|
|
{
|
|
|
headData.BLTYPE = "整箱";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if (headData.BLTYPE.ToString().Trim() == "")
|
|
|
{
|
|
|
headData.BLTYPE = "整箱";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (isPost)
|
|
|
{
|
|
|
var modb = new ModelObjectDB();
|
|
|
DBResult result = modb.Save(headData);
|
|
|
var BSNO = headData.BSNO;
|
|
|
if (result.Success == true)
|
|
|
{
|
|
|
if (bodyList != null)
|
|
|
{
|
|
|
foreach (var enumValue in bodyList)
|
|
|
{
|
|
|
enumValue.CTN_ID = Guid.NewGuid().ToString();
|
|
|
enumValue.BSNO = BSNO;
|
|
|
enumValue.DbOperationType = DbOperationType.DbotIns;
|
|
|
|
|
|
var modb2 = new ModelObjectDB();
|
|
|
result = modb2.Save(enumValue);
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
result.Success = true;
|
|
|
result.Message = "生成成功";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
result.Success = false;
|
|
|
result.Message = "生成过程发生错误";
|
|
|
MsSysBillNoSetDAL.DeleteBsNo(headData.CUSTNO);
|
|
|
}
|
|
|
|
|
|
var jsonRespose = new JsonResponse
|
|
|
{
|
|
|
Success = result.Success,
|
|
|
Message = result.Message
|
|
|
};
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if (iscreatecustno == true)
|
|
|
MsSysBillNoSetDAL.DeleteBsNo(headData.CUSTNO);
|
|
|
|
|
|
var jsonRespose = new JsonResponse { Success = false, Message = errorstr + ",不允许生成!" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 生成邮件模板
|
|
|
public ContentResult CreateSendMail(string bsno, string mailproject, string bltype)
|
|
|
{
|
|
|
var mailprojectList = MsInfoClientMailProjectDAL.GetBodyList("PROJECTID='" + mailproject + "' AND BLTYPE='" + bltype + "'");
|
|
|
if (mailprojectList.Count != 0)
|
|
|
{
|
|
|
var opseae = MsOpSeaeDAL.GetData("BSNO='" + bsno + "'");
|
|
|
var MAILSENDID = Guid.NewGuid().ToString();
|
|
|
var opmailsend = new OpMailSend();
|
|
|
opmailsend.GID = MAILSENDID;
|
|
|
opmailsend.PROJECTID = mailproject;
|
|
|
opmailsend.BLTYPE = bltype;
|
|
|
opmailsend.BSNO = bsno;
|
|
|
opmailsend.MBLNO = opseae.MBLNO;
|
|
|
opmailsend.RECEIVER = mailprojectList[0].RECEIVER;
|
|
|
opmailsend.SUBJECT = mailprojectList[0].SUBJECT.Replace("[主提单号]", opseae.MBLNO).Replace("[委托编号]", opseae.CUSTNO).Replace("[委托单位]", opseae.CUSTOMERNAME).Replace("[船名]", opseae.VESSEL).Replace("[航次]", opseae.VOYNO);
|
|
|
opmailsend.DESCRIPTION = mailprojectList[0].DESCRIPTION.Replace("[主提单号]", opseae.MBLNO).Replace("[委托编号]", opseae.CUSTNO).Replace("[委托单位]", opseae.CUSTOMERNAME).Replace("[船名]", opseae.VESSEL).Replace("[航次]", opseae.VOYNO);
|
|
|
T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
|
|
|
var mailsign = T_ALL_DA.GetStrSQL("mailsign", "select mailsign from user_baseinfo where USERID='" + Convert.ToString(Session["USERID"]) + "'");
|
|
|
var EMAIL1 = T_ALL_DA.GetStrSQL("EMAIL1", "select EMAIL1 from user_baseinfo where USERID='" + Convert.ToString(Session["USERID"]) + "'");
|
|
|
opmailsend.SIGNATURE = mailsign;
|
|
|
opmailsend.ATTACHMENT = mailprojectList[0].ATTACHMENT.Replace("[主提单号]", opseae.MBLNO).Replace("[委托编号]", opseae.CUSTNO).Replace("[委托单位]", opseae.CUSTOMERNAME).Replace("[船名]", opseae.VESSEL).Replace("[航次]", opseae.VOYNO);
|
|
|
opmailsend.SENDER = EMAIL1;
|
|
|
|
|
|
var MAILTONAME = "admin@dongshengsoft.com";
|
|
|
var PARAMVALUE = MsSysParamSetDAL.GetData("PARAMNAME='MAILTONAME'");
|
|
|
if (PARAMVALUE.PARAMVALUE != "") MAILTONAME = PARAMVALUE.PARAMVALUE;
|
|
|
var MAILTOPASSWORD = "ds!@#)(*";
|
|
|
PARAMVALUE = MsSysParamSetDAL.GetData("PARAMNAME='MAILTOPASSWORD'");
|
|
|
if (PARAMVALUE.PARAMVALUE != "") MAILTOPASSWORD = PARAMVALUE.PARAMVALUE;
|
|
|
var MAILTOSERVER = "smtpcom.263xmail.com";
|
|
|
PARAMVALUE = MsSysParamSetDAL.GetData("PARAMNAME='MAILTOSERVER'");
|
|
|
if (PARAMVALUE.PARAMVALUE != "") MAILTOSERVER = PARAMVALUE.PARAMVALUE;
|
|
|
var MAILTOPORT = "465";
|
|
|
PARAMVALUE = MsSysParamSetDAL.GetData("PARAMNAME='MAILTOPORT'");
|
|
|
if (PARAMVALUE.PARAMVALUE != "") MAILTOPORT = PARAMVALUE.PARAMVALUE;
|
|
|
opmailsend.SENDERUSERNAME = MAILTONAME;
|
|
|
opmailsend.SENDERPASSWORD = MAILTOPASSWORD;
|
|
|
opmailsend.SENDSERVICE = MAILTOSERVER;
|
|
|
opmailsend.SENDERPORT = MAILTOPORT;
|
|
|
var URLSTR = Request.Url.Authority + "/MvcShipping/MsOpMailLog/UpMailLog";
|
|
|
opmailsend.HTTPURL = URLSTR;
|
|
|
opmailsend.DbOperationType = DbOperationType.DbotIns;
|
|
|
var modb = new ModelObjectDB();
|
|
|
modb.Save(opmailsend);
|
|
|
|
|
|
var json = JsonConvert.Serialize(
|
|
|
new { Success = true, Message = "查询成功", Data = MAILSENDID });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
var njson = JsonConvert.Serialize(
|
|
|
new { Success = false, Message = "无邮件方案" });
|
|
|
return new ContentResult() { Content = njson };
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region 分部生成委托
|
|
|
|
|
|
public ContentResult SubCompSave(string opstatus, string data, string data2, string data3, string body, string comp, string op, string custservice)
|
|
|
{
|
|
|
var aaa = "";
|
|
|
var company = MsCompanysDAL.GetNoPicData("GID='" + comp + "'");
|
|
|
var headData = JsonConvert.Deserialize<MsOpSeae>(data.Replace("}", ",") + data2.Replace("{", "").Replace("}", ",") + data3.Replace("{", ""));
|
|
|
var bodyList = JsonConvert.Deserialize<List<MsOpSeaeDetail>>(body);
|
|
|
|
|
|
var BSNO = headData.BSNO;
|
|
|
var isPost = true;
|
|
|
var errorstr = "";
|
|
|
var custno = "";
|
|
|
var NEWBSNO = "topseae" + Guid.NewGuid().ToString();
|
|
|
headData.BSNO = NEWBSNO;
|
|
|
|
|
|
var billnoset = MsSysBillNoSetDAL.GetData("OPLBNAME='海运出口' AND RULEBLNO='委托编号'", Convert.ToString(Session["COMPANYID"]), company.DBNAME);
|
|
|
custno = MsSysBillNoSetDAL.GetBillNo(billnoset, headData.ETD.ToString().Trim(), headData.ACCDATE.ToString().Trim(), company.DBNAME);
|
|
|
headData.CUSTNO = custno;
|
|
|
T_ALL_DA T_ALL_DA = new T_ALL_DA();
|
|
|
var opname = T_ALL_DA.GetStrSQL("SHOWNAME", "select top 1 SHOWNAME from [user] where GID='" + op + "'");
|
|
|
|
|
|
|
|
|
|
|
|
if (headData.CORPID == "" || headData.CORPID == null)
|
|
|
{
|
|
|
headData.CORPID = company.GID;
|
|
|
}
|
|
|
|
|
|
|
|
|
headData.INPUTBY = opname;
|
|
|
headData.BSDATE = DateTime.Now;
|
|
|
headData.BSSTATUS = false;
|
|
|
headData.FEESTATUS = false;
|
|
|
headData.DbOperationType = DbOperationType.DbotIns;
|
|
|
headData.OP = opname;
|
|
|
headData.CUSTSERVICE = custservice;
|
|
|
|
|
|
headData.MASTERNO = headData.BSNO;
|
|
|
|
|
|
if (headData.ETA == "") headData.ETA = null;
|
|
|
if (headData.ETD == "") headData.ETD = null;
|
|
|
if (headData.STLDATE == "") headData.STLDATE = null;
|
|
|
|
|
|
if (headData.ISSUEDATE == "" || (Convert.ToDateTime(headData.ISSUEDATE) < Convert.ToDateTime("2010-01-01"))) headData.ISSUEDATE = null;
|
|
|
if (headData.CLOSINGDATE == "") headData.CLOSINGDATE = null;
|
|
|
if (headData.CLOSEDOCDATE == "") headData.CLOSEDOCDATE = null;
|
|
|
if (headData.INSPECTIONDATE == "") headData.INSPECTIONDATE = null;
|
|
|
if (headData.CUSTOMDATE == "") headData.CUSTOMDATE = null;
|
|
|
if (headData.CLEARCUSTOMDATE == "") headData.CLEARCUSTOMDATE = null;
|
|
|
|
|
|
// headData.VESSEL = MsBaseInfoDAL.DelPortCn(headData.VESSEL);
|
|
|
headData.PORTLOAD = MsBaseInfoDAL.DelPortCn(headData.PORTLOAD);
|
|
|
headData.PORTDISCHARGE = MsBaseInfoDAL.DelPortCn(headData.PORTDISCHARGE);
|
|
|
headData.PLACERECEIPT = MsBaseInfoDAL.DelPortCn(headData.PLACERECEIPT);
|
|
|
headData.PORTDISCHARGE = MsBaseInfoDAL.DelPortCn(headData.PORTDISCHARGE);
|
|
|
headData.DESTINATION = MsBaseInfoDAL.DelPortCn(headData.DESTINATION);
|
|
|
|
|
|
if (headData.BLTYPE == "拼箱分票" || headData.BLTYPE == "拼箱单票")
|
|
|
headData.CNTRTOTAL = headData.PKGS.ToString() + headData.KINDPKGS + "/" + headData.KGS.ToString() + "KGS/" + headData.CBM.ToString() + "CBM";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (isPost)
|
|
|
{
|
|
|
var modb = new ModelObjectDB();
|
|
|
DBResult result = modb.Save(headData, company.DBNAME);
|
|
|
if (result.Success == true)
|
|
|
{
|
|
|
if (headData.BLTYPE == "拼箱分票" || headData.BLTYPE == "拼箱单票")
|
|
|
result = MsOpSeaeDAL.SaveDetail(BSNO, bodyList, CookieConfig.GetCookie_UserId(Request), false, company.DBNAME);
|
|
|
else
|
|
|
result = MsOpSeaeDAL.SaveDetail(BSNO, bodyList, CookieConfig.GetCookie_UserId(Request), true, company.DBNAME);
|
|
|
|
|
|
var feelist = MsChFeeDAL.GetAllDataList("BSNO='" + BSNO + "'");
|
|
|
if (feelist != null)
|
|
|
{
|
|
|
for (int _i = 0; _i < feelist.Count; _i++)
|
|
|
{
|
|
|
feelist[_i].BsNo = "*";
|
|
|
}
|
|
|
MsChFeeDAL.SaveFee(feelist, NEWBSNO, CookieConfig.GetCookie_UserId(Request), company.DBNAME);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
MsSysBillNoSetDAL.DeleteBsNo(custno, company.DBNAME);
|
|
|
}
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
var jsonRespose = new JsonResponse { Success = false, Message = errorstr + "重复,不允许保存!" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public ContentResult SubCompSaveList(string body, string comp, string op, string custservice)
|
|
|
{
|
|
|
var aaa = "";
|
|
|
var company = MsCompanysDAL.GetNoPicData("GID='" + comp + "'");
|
|
|
var bodyList = JsonConvert.Deserialize<List<MsOpSeae>>(body);
|
|
|
var result = new DBResult();
|
|
|
if (bodyList != null)
|
|
|
{
|
|
|
foreach (var headData in bodyList)
|
|
|
{
|
|
|
var BSNO = headData.BSNO;
|
|
|
var isPost = true;
|
|
|
var errorstr = "";
|
|
|
var custno = "";
|
|
|
var NEWBSNO = "topseae" + Guid.NewGuid().ToString();
|
|
|
headData.BSNO = NEWBSNO;
|
|
|
|
|
|
var billnoset = MsSysBillNoSetDAL.GetData("OPLBNAME='海运出口' AND RULEBLNO='委托编号'", Convert.ToString(Session["COMPANYID"]), company.DBNAME);
|
|
|
custno = MsSysBillNoSetDAL.GetBillNo(billnoset, headData.ETD.ToString().Trim(), headData.ACCDATE.ToString().Trim(), company.DBNAME);
|
|
|
headData.CUSTNO = custno;
|
|
|
T_ALL_DA T_ALL_DA = new T_ALL_DA();
|
|
|
var opname = T_ALL_DA.GetStrSQL("SHOWNAME", "select top 1 SHOWNAME from [user] where GID='" + op + "'");
|
|
|
|
|
|
|
|
|
|
|
|
if (headData.CORPID == "" || headData.CORPID == null)
|
|
|
{
|
|
|
headData.CORPID = company.GID;
|
|
|
}
|
|
|
|
|
|
|
|
|
headData.INPUTBY = opname;
|
|
|
headData.BSDATE = DateTime.Now;
|
|
|
headData.BSSTATUS = false;
|
|
|
headData.FEESTATUS = false;
|
|
|
headData.DbOperationType = DbOperationType.DbotIns;
|
|
|
headData.OP = opname;
|
|
|
headData.CUSTSERVICE = custservice;
|
|
|
|
|
|
headData.MASTERNO = headData.BSNO;
|
|
|
|
|
|
if (headData.ETA == "") headData.ETA = null;
|
|
|
if (headData.ETD == "") headData.ETD = null;
|
|
|
if (headData.STLDATE == "") headData.STLDATE = null;
|
|
|
|
|
|
if (headData.ISSUEDATE == "" || (Convert.ToDateTime(headData.ISSUEDATE) < Convert.ToDateTime("2010-01-01"))) headData.ISSUEDATE = null;
|
|
|
if (headData.CLOSINGDATE == "") headData.CLOSINGDATE = null;
|
|
|
if (headData.CLOSEDOCDATE == "") headData.CLOSEDOCDATE = null;
|
|
|
if (headData.INSPECTIONDATE == "") headData.INSPECTIONDATE = null;
|
|
|
if (headData.CUSTOMDATE == "") headData.CUSTOMDATE = null;
|
|
|
if (headData.CLEARCUSTOMDATE == "") headData.CLEARCUSTOMDATE = null;
|
|
|
|
|
|
// headData.VESSEL = MsBaseInfoDAL.DelPortCn(headData.VESSEL);
|
|
|
headData.PORTLOAD = MsBaseInfoDAL.DelPortCn(headData.PORTLOAD);
|
|
|
headData.PORTDISCHARGE = MsBaseInfoDAL.DelPortCn(headData.PORTDISCHARGE);
|
|
|
headData.PLACERECEIPT = MsBaseInfoDAL.DelPortCn(headData.PLACERECEIPT);
|
|
|
headData.PORTDISCHARGE = MsBaseInfoDAL.DelPortCn(headData.PORTDISCHARGE);
|
|
|
headData.DESTINATION = MsBaseInfoDAL.DelPortCn(headData.DESTINATION);
|
|
|
|
|
|
if (headData.BLTYPE == "拼箱分票" || headData.BLTYPE == "拼箱单票")
|
|
|
headData.CNTRTOTAL = headData.PKGS.ToString() + headData.KINDPKGS + "/" + headData.KGS.ToString() + "KGS/" + headData.CBM.ToString() + "CBM";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (isPost)
|
|
|
{
|
|
|
var modb = new ModelObjectDB();
|
|
|
result = modb.Save(headData, company.DBNAME);
|
|
|
|
|
|
if (result.Success == true)
|
|
|
{
|
|
|
var bodyctnList = MsOpSeaeDAL.GetBodyList("BSNO='" + BSNO + "'", "");
|
|
|
|
|
|
if (headData.BLTYPE == "拼箱分票" || headData.BLTYPE == "拼箱单票")
|
|
|
result = MsOpSeaeDAL.SaveDetail(NEWBSNO, bodyctnList, CookieConfig.GetCookie_UserId(Request), false, company.DBNAME);
|
|
|
else
|
|
|
result = MsOpSeaeDAL.SaveDetail(NEWBSNO, bodyctnList, CookieConfig.GetCookie_UserId(Request), true, company.DBNAME);
|
|
|
|
|
|
var feelist = MsChFeeDAL.GetAllDataList("BSNO='" + BSNO + "'");
|
|
|
if (feelist != null)
|
|
|
{
|
|
|
for (int _i = 0; _i < feelist.Count; _i++)
|
|
|
{
|
|
|
feelist[_i].BsNo = "*";
|
|
|
}
|
|
|
MsChFeeDAL.SaveFee(feelist, NEWBSNO, CookieConfig.GetCookie_UserId(Request), company.DBNAME);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
MsSysBillNoSetDAL.DeleteBsNo(custno, company.DBNAME);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
var jsonRespose = new JsonResponse { Success = false, Message = "生成发生错误!" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region 引入 EXCEL
|
|
|
|
|
|
public static string GetExcelValue(Worksheet mySheet, string Local)
|
|
|
{
|
|
|
var result = "";
|
|
|
var aaa = mySheet.Cells.get_Range(Local).Value2; //item
|
|
|
|
|
|
object v11new = aaa;
|
|
|
string strtmp = "";
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
result = strtmp;
|
|
|
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
public ContentResult ImportBillEdit()
|
|
|
{
|
|
|
var jsonRespose = new JsonResponse { Success = false, Message = "" };
|
|
|
|
|
|
if (Request.Files.Count != 1)
|
|
|
{
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "请选择上传的文件";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
var file = Request.Files["LoadExcel"];
|
|
|
if (file == null)
|
|
|
{
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "上传文件发生未知错误,请重新上传";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
var path = Server.MapPath("../../UploadFiles/BulkDetail");
|
|
|
var path2 = Server.MapPath("../../UploadFiles/BulkDetail/");
|
|
|
|
|
|
if (!Directory.Exists(path))
|
|
|
{
|
|
|
Directory.CreateDirectory(path);
|
|
|
}
|
|
|
|
|
|
var size = file.ContentLength;
|
|
|
var name = Path.GetFileName(file.FileName);
|
|
|
var bsno = Request.Form["bsno"];
|
|
|
|
|
|
var usercode = CookieConfig.GetCookie_UserCode(Request);
|
|
|
string filenamepath = usercode + DateTime.Now.ToString("yyyyMMddHHmmssfff") + name;
|
|
|
|
|
|
string filename = path + "\\" + filenamepath;
|
|
|
|
|
|
|
|
|
|
|
|
string excelFilePath = path2 + filenamepath;
|
|
|
|
|
|
|
|
|
if (System.IO.File.Exists(filename))
|
|
|
{
|
|
|
System.IO.File.Delete(filename);
|
|
|
}
|
|
|
file.SaveAs(filename);
|
|
|
|
|
|
if (!System.IO.File.Exists(filename))
|
|
|
{
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "上传的Excel不包含数据01";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
Microsoft.Office.Interop.Excel.Application excel = new Microsoft.Office.Interop.Excel.Application();
|
|
|
|
|
|
if (excel == null)
|
|
|
{
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "无法创建Excel对象,可能您的服务器计算机未安装Excel!!";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//List<string> sheets = ExcelSheetName(filename);
|
|
|
//if (sheets.Count == 0)
|
|
|
//{
|
|
|
// jsonRespose.Success = false;
|
|
|
// jsonRespose.Message = "上传的Excel不包含数据02";
|
|
|
// return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
//}
|
|
|
|
|
|
Workbook workbook = excel.Workbooks.Open(excelFilePath, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
|
|
|
Worksheet mySheet = workbook.Sheets[1] as Worksheet;
|
|
|
|
|
|
try
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
var isuse = false;
|
|
|
|
|
|
|
|
|
var headData = new MsOpSeae();
|
|
|
|
|
|
var aaa = mySheet.Cells.get_Range("H2").Value2; //item
|
|
|
|
|
|
object v11new = aaa;
|
|
|
string strtmp = "";
|
|
|
string strtmp2 = "";
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
headData.MBLNO = strtmp;
|
|
|
|
|
|
}
|
|
|
|
|
|
aaa = mySheet.Cells.get_Range("A3").Value2; //item
|
|
|
|
|
|
v11new = aaa;
|
|
|
strtmp = "";
|
|
|
strtmp2 = "";
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
if (headData.SHIPPER == "")
|
|
|
headData.SHIPPER = strtmp;
|
|
|
else
|
|
|
headData.SHIPPER = headData.SHIPPER + Environment.NewLine + strtmp;
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("A4").Value2; //item
|
|
|
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
if (headData.SHIPPER == "")
|
|
|
headData.SHIPPER = strtmp;
|
|
|
else
|
|
|
headData.SHIPPER = headData.SHIPPER + Environment.NewLine + strtmp;
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("A5").Value2; //item
|
|
|
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
if (headData.SHIPPER == "")
|
|
|
headData.SHIPPER = strtmp;
|
|
|
else
|
|
|
headData.SHIPPER = headData.SHIPPER + Environment.NewLine + strtmp;
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("A6").Value2; //item
|
|
|
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
if (headData.SHIPPER == "")
|
|
|
headData.SHIPPER = strtmp;
|
|
|
else
|
|
|
headData.SHIPPER = headData.SHIPPER + Environment.NewLine + strtmp;
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("A7").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
if (headData.SHIPPER == "")
|
|
|
headData.SHIPPER = strtmp;
|
|
|
else
|
|
|
headData.SHIPPER = headData.SHIPPER + Environment.NewLine + strtmp;
|
|
|
}
|
|
|
|
|
|
aaa = mySheet.Cells.get_Range("E4").Value2; //item
|
|
|
|
|
|
v11new = aaa;
|
|
|
strtmp = "";
|
|
|
strtmp2 = "";
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
if (headData.MNOTIFYPARTY == "")
|
|
|
headData.MNOTIFYPARTY = strtmp;
|
|
|
else
|
|
|
headData.MNOTIFYPARTY = headData.MNOTIFYPARTY + Environment.NewLine + strtmp;
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("E5").Value2; //item
|
|
|
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
if (headData.MNOTIFYPARTY == "")
|
|
|
headData.MNOTIFYPARTY = strtmp;
|
|
|
else
|
|
|
headData.MNOTIFYPARTY = headData.MNOTIFYPARTY + Environment.NewLine + strtmp;
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("E6").Value2; //item
|
|
|
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
if (headData.MNOTIFYPARTY == "")
|
|
|
headData.MNOTIFYPARTY = strtmp;
|
|
|
else
|
|
|
headData.MNOTIFYPARTY = headData.MNOTIFYPARTY + Environment.NewLine + strtmp;
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("E7").Value2; //item
|
|
|
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
if (headData.MNOTIFYPARTY == "")
|
|
|
headData.MNOTIFYPARTY = strtmp;
|
|
|
else
|
|
|
headData.MNOTIFYPARTY = headData.MNOTIFYPARTY + Environment.NewLine + strtmp;
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("E8").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
if (headData.MNOTIFYPARTY == "")
|
|
|
headData.MNOTIFYPARTY = strtmp;
|
|
|
else
|
|
|
headData.MNOTIFYPARTY = headData.MNOTIFYPARTY + Environment.NewLine + strtmp;
|
|
|
}
|
|
|
|
|
|
|
|
|
aaa = mySheet.Cells.get_Range("A10").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
if (headData.CONSIGNEE == "")
|
|
|
headData.CONSIGNEE = strtmp;
|
|
|
else
|
|
|
headData.CONSIGNEE = headData.CONSIGNEE + Environment.NewLine + strtmp;
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("A11").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
if (headData.CONSIGNEE == "")
|
|
|
headData.CONSIGNEE = strtmp;
|
|
|
else
|
|
|
headData.CONSIGNEE = headData.CONSIGNEE + Environment.NewLine + strtmp;
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("A12").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
if (headData.CONSIGNEE == "")
|
|
|
headData.CONSIGNEE = strtmp;
|
|
|
else
|
|
|
headData.CONSIGNEE = headData.CONSIGNEE + Environment.NewLine + strtmp;
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("A13").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
if (headData.CONSIGNEE == "")
|
|
|
headData.CONSIGNEE = strtmp;
|
|
|
else
|
|
|
headData.CONSIGNEE = headData.CONSIGNEE + Environment.NewLine + strtmp;
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("A14").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
if (headData.CONSIGNEE == "")
|
|
|
headData.CONSIGNEE = strtmp;
|
|
|
else
|
|
|
headData.CONSIGNEE = headData.CONSIGNEE + Environment.NewLine + strtmp;
|
|
|
}
|
|
|
|
|
|
aaa = mySheet.Cells.get_Range("A17").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
if (headData.NOTIFYPARTY == "")
|
|
|
headData.NOTIFYPARTY = strtmp;
|
|
|
else
|
|
|
headData.NOTIFYPARTY = headData.NOTIFYPARTY + Environment.NewLine + strtmp;
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("A18").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
if (headData.NOTIFYPARTY == "")
|
|
|
headData.NOTIFYPARTY = strtmp;
|
|
|
else
|
|
|
headData.NOTIFYPARTY = headData.NOTIFYPARTY + Environment.NewLine + strtmp;
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("A19").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
if (headData.NOTIFYPARTY == "")
|
|
|
headData.NOTIFYPARTY = strtmp;
|
|
|
else
|
|
|
headData.NOTIFYPARTY = headData.NOTIFYPARTY + Environment.NewLine + strtmp;
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("A20").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
if (headData.NOTIFYPARTY == "")
|
|
|
headData.NOTIFYPARTY = strtmp;
|
|
|
else
|
|
|
headData.NOTIFYPARTY = headData.NOTIFYPARTY + Environment.NewLine + strtmp;
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("A21").Value2;
|
|
|
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
if (headData.NOTIFYPARTY == "")
|
|
|
headData.NOTIFYPARTY = strtmp;
|
|
|
else
|
|
|
headData.NOTIFYPARTY = headData.NOTIFYPARTY + Environment.NewLine + strtmp;
|
|
|
}
|
|
|
|
|
|
aaa = mySheet.Cells.get_Range("A24").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
headData.VESSEL = strtmp;
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("C24").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
headData.VOYNO = strtmp;
|
|
|
}
|
|
|
|
|
|
aaa = mySheet.Cells.get_Range("D24").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
headData.PORTLOAD = strtmp;
|
|
|
aaa = mySheet.Cells.get_Range("F24").Value2;
|
|
|
}
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
headData.PORTDISCHARGE = strtmp;
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("A26").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
headData.PLACERECEIPT = strtmp;
|
|
|
}
|
|
|
|
|
|
aaa = mySheet.Cells.get_Range("D26").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
headData.PLACEDELIVERY = strtmp;
|
|
|
}
|
|
|
|
|
|
|
|
|
aaa = mySheet.Cells.get_Range("F26").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
headData.BLFRT = strtmp;
|
|
|
}
|
|
|
|
|
|
aaa = mySheet.Cells.get_Range("I26").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
headData.SERVICE = strtmp;
|
|
|
}
|
|
|
|
|
|
|
|
|
aaa = mySheet.Cells.get_Range("A29").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
headData.MARKS = strtmp;
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("C29").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
{
|
|
|
headData.NOPKGS = strtmp;
|
|
|
var pkg = Regex.Match(strtmp, "\\d+").ToString();
|
|
|
if (pkg != "")
|
|
|
{
|
|
|
headData.PKGS = Convert.ToInt16(pkg).ToString();
|
|
|
var kindkgs = strtmp.Substring(pkg.Length, strtmp.Length - pkg.Length);
|
|
|
headData.KINDPKGS = kindkgs;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("D29").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
headData.DESCRIPTION = strtmp;
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("H29").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
{
|
|
|
headData.GROSSWEIGHT = strtmp;
|
|
|
var KGS = Regex.Match(strtmp, "\\d+").ToString();
|
|
|
if (KGS != "")
|
|
|
{
|
|
|
headData.KGS = Convert.ToDecimal(KGS).ToString();
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("I29").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
{
|
|
|
headData.MEASUREMENT = strtmp;
|
|
|
var KGS = Regex.Match(strtmp, "\\d+").ToString();
|
|
|
if (KGS != "")
|
|
|
headData.CBM = Convert.ToDecimal(KGS).ToString();
|
|
|
}
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("D44").Value2;
|
|
|
v11new = aaa;
|
|
|
var bbb = mySheet.Cells.get_Range("E44").Value2; //item
|
|
|
var bodyList = new List<MsOpSeaeDetail>();
|
|
|
|
|
|
var j = 65;
|
|
|
while (GetExcelValue(mySheet, "A" + j.ToString()) != "")
|
|
|
{
|
|
|
MsOpSeaeDetail data = new MsOpSeaeDetail();
|
|
|
data.BSNO = bsno;
|
|
|
data.CTNALL = GetExcelValue(mySheet, "C" + j.ToString());
|
|
|
data.CNTRNO = GetExcelValue(mySheet, "A" + j.ToString());
|
|
|
data.SEALNO = GetExcelValue(mySheet, "B" + j.ToString());
|
|
|
try
|
|
|
{
|
|
|
data.PKGS = Convert.ToInt32(GetExcelValue(mySheet, "D" + j.ToString()));
|
|
|
data.KINDPKGS = GetExcelValue(mySheet, "E" + j.ToString());
|
|
|
data.KGS = Convert.ToDecimal(GetExcelValue(mySheet, "F" + j.ToString()));
|
|
|
data.CBM = Convert.ToDecimal(GetExcelValue(mySheet, "G" + j.ToString()));
|
|
|
}
|
|
|
catch (Exception exception)
|
|
|
{
|
|
|
|
|
|
}
|
|
|
data.GOODSNAME = GetExcelValue(mySheet, "H" + j.ToString()).Replace("'", "''");
|
|
|
data.CTNFEE = GetExcelValue(mySheet, "I" + j.ToString());
|
|
|
data.REMARK = GetExcelValue(mySheet, "G" + j.ToString());
|
|
|
bodyList.Add(data);
|
|
|
j = j + 1;
|
|
|
}
|
|
|
|
|
|
if (bodyList.Count > 0) MsOpSeaeDAL.InsertCtnData(bsno, bodyList);
|
|
|
|
|
|
workbook.Close(true, Type.Missing, Type.Missing);
|
|
|
workbook = null;
|
|
|
excel.Quit();
|
|
|
excel = null;
|
|
|
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { success = true, Message = "上传成功", data = headData });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
workbook.Close(true, Type.Missing, Type.Missing);
|
|
|
workbook = null;
|
|
|
excel.Quit();
|
|
|
excel = null;
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "读取Excel文件出错,请确认文件正确性";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
}
|
|
|
[HttpPost]
|
|
|
public ContentResult ImportSI()
|
|
|
{
|
|
|
var jsonRespose = new JsonResponse { Success = false, Message = "" };
|
|
|
|
|
|
if (Request.Files.Count != 1)
|
|
|
{
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "请选择上传的文件";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
var file = Request.Files["LoadExcel"];
|
|
|
if (file == null)
|
|
|
{
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "上传文件发生未知错误,请重新上传";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
var path = Server.MapPath("../../UploadFiles/BulkDetail");
|
|
|
var path2 = Server.MapPath("../../UploadFiles/BulkDetail/");
|
|
|
|
|
|
if (!Directory.Exists(path))
|
|
|
{
|
|
|
Directory.CreateDirectory(path);
|
|
|
}
|
|
|
|
|
|
var size = file.ContentLength;
|
|
|
var name = Path.GetFileName(file.FileName);
|
|
|
var bsno = Request.Form["bsno"];
|
|
|
|
|
|
var usercode = CookieConfig.GetCookie_UserCode(Request);
|
|
|
string filenamepath = usercode + DateTime.Now.ToString("yyyyMMddHHmmssfff") + name;
|
|
|
|
|
|
string filename = path + "\\" + filenamepath;
|
|
|
|
|
|
|
|
|
|
|
|
string excelFilePath = path2 + filenamepath;
|
|
|
|
|
|
|
|
|
if (System.IO.File.Exists(filename))
|
|
|
{
|
|
|
System.IO.File.Delete(filename);
|
|
|
}
|
|
|
file.SaveAs(filename);
|
|
|
|
|
|
if (!System.IO.File.Exists(filename))
|
|
|
{
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "上传的Excel不包含数据01";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
Microsoft.Office.Interop.Excel.Application excel = new Microsoft.Office.Interop.Excel.Application();
|
|
|
|
|
|
if (excel == null)
|
|
|
{
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "无法创建Excel对象,可能您的服务器计算机未安装Excel!!";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//List<string> sheets = ExcelSheetName(filename);
|
|
|
//if (sheets.Count == 0)
|
|
|
//{
|
|
|
// jsonRespose.Success = false;
|
|
|
// jsonRespose.Message = "上传的Excel不包含数据02";
|
|
|
// return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
//}
|
|
|
|
|
|
Workbook workbook = excel.Workbooks.Open(excelFilePath, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
|
|
|
Worksheet mySheet = workbook.Sheets[1] as Worksheet;
|
|
|
|
|
|
try
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
var isuse = false;
|
|
|
|
|
|
|
|
|
var headData = new MsOpSeae();
|
|
|
|
|
|
|
|
|
var BSNO = "topseae" + Guid.NewGuid().ToString();
|
|
|
|
|
|
var aaa = mySheet.Cells.get_Range("I4").Value2; //item
|
|
|
object v11new = aaa;
|
|
|
string strtmp = "";
|
|
|
string strtmp2 = "";
|
|
|
|
|
|
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
headData.MBLNO = strtmp;
|
|
|
}
|
|
|
|
|
|
MsOpSeae billdata = null;
|
|
|
|
|
|
|
|
|
|
|
|
if (headData.MBLNO != "")
|
|
|
{
|
|
|
billdata = MsOpSeaeDAL.GetData(" MBLNO='" + headData.MBLNO + "'");
|
|
|
}
|
|
|
|
|
|
if (headData.MBLNO == "" || billdata.MBLNO == "")
|
|
|
{
|
|
|
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "业务中未查询到主提单号为" + headData.MBLNO + "的数据!";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
headData.BSNO = billdata.BSNO;
|
|
|
|
|
|
aaa = mySheet.Cells.get_Range("B4").Value2; //item
|
|
|
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
if (headData.SHIPPER == "")
|
|
|
headData.SHIPPER = strtmp;
|
|
|
else
|
|
|
headData.SHIPPER = headData.SHIPPER + Environment.NewLine + strtmp;
|
|
|
}
|
|
|
|
|
|
aaa = mySheet.Cells.get_Range("B11").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
if (headData.CONSIGNEE == "")
|
|
|
headData.CONSIGNEE = strtmp;
|
|
|
else
|
|
|
headData.CONSIGNEE = headData.CONSIGNEE + Environment.NewLine + strtmp;
|
|
|
}
|
|
|
|
|
|
|
|
|
aaa = mySheet.Cells.get_Range("B16").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
if (headData.NOTIFYPARTY == "")
|
|
|
headData.NOTIFYPARTY = strtmp;
|
|
|
else
|
|
|
headData.NOTIFYPARTY = headData.NOTIFYPARTY + Environment.NewLine + strtmp;
|
|
|
}
|
|
|
|
|
|
|
|
|
aaa = mySheet.Cells.get_Range("B21").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
headData.PLACERECEIPT = strtmp;
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("C21").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
headData.PORTLOAD = strtmp;
|
|
|
}
|
|
|
|
|
|
aaa = mySheet.Cells.get_Range("B23").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
headData.VESSEL = strtmp;
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("C23").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
headData.VOYNO = strtmp;
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("B25").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
headData.PORTDISCHARGE = strtmp;
|
|
|
}
|
|
|
|
|
|
|
|
|
aaa = mySheet.Cells.get_Range("C25").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
headData.PLACEDELIVERY = strtmp;
|
|
|
}
|
|
|
|
|
|
aaa = mySheet.Cells.get_Range("I6").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
{
|
|
|
strtmp = strtmp.Substring(strtmp.IndexOf(":") + 1).Trim();
|
|
|
strtmp = strtmp.Substring(strtmp.IndexOf(":") + 1).Trim();
|
|
|
headData.HSCODE = strtmp;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
aaa = mySheet.Cells.get_Range("I7").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
if (headData.REMARK == "")
|
|
|
headData.REMARK = strtmp;
|
|
|
else
|
|
|
headData.REMARK = headData.REMARK + Environment.NewLine + strtmp;
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("I8").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
if (headData.REMARK == "")
|
|
|
headData.REMARK = strtmp;
|
|
|
else
|
|
|
headData.REMARK = headData.REMARK + Environment.NewLine + strtmp;
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("I9").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
if (headData.REMARK == "")
|
|
|
headData.REMARK = strtmp;
|
|
|
else
|
|
|
headData.REMARK = headData.REMARK + Environment.NewLine + strtmp;
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("I17").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
if (headData.REMARK == "")
|
|
|
headData.REMARK = strtmp;
|
|
|
else
|
|
|
headData.REMARK = headData.REMARK + Environment.NewLine + strtmp;
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("B28").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
headData.MARKS = strtmp;
|
|
|
}
|
|
|
|
|
|
|
|
|
aaa = mySheet.Cells.get_Range("C28").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
{
|
|
|
headData.NOPKGS = strtmp;
|
|
|
var pkg = Regex.Match(strtmp, "\\d+").ToString();
|
|
|
if (pkg != "")
|
|
|
{
|
|
|
headData.PKGS = Convert.ToInt16(pkg).ToString();
|
|
|
var kindkgs = strtmp.Substring(pkg.Length, strtmp.Length - pkg.Length);
|
|
|
headData.KINDPKGS = kindkgs;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("D28").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
headData.DESCRIPTION = strtmp;
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("I28").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
{
|
|
|
headData.GROSSWEIGHT = strtmp + "KGS";
|
|
|
// var KGS = Regex.Match(strtmp, "\\d+").ToString();
|
|
|
if (strtmp != "")
|
|
|
{
|
|
|
headData.KGS = Convert.ToDecimal(strtmp).ToString();
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("K28").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
{
|
|
|
headData.MEASUREMENT = strtmp + "CBM";
|
|
|
// var KGS = Regex.Match(strtmp, "\\d+").ToString();
|
|
|
if (strtmp != "")
|
|
|
headData.CBM = Convert.ToDecimal(strtmp).ToString();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
aaa = mySheet.Cells.get_Range("I36").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
headData.SERVICE = strtmp;
|
|
|
}
|
|
|
|
|
|
aaa = mySheet.Cells.get_Range("K36").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
headData.CNTRTOTAL = strtmp;
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("I38").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
headData.BLFRT = strtmp;
|
|
|
}
|
|
|
|
|
|
aaa = mySheet.Cells.get_Range("B38").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
headData.CNTRSEALNO = strtmp;
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("C42").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
headData.TOTALNO = strtmp;
|
|
|
}
|
|
|
|
|
|
|
|
|
workbook.Close(true, Type.Missing, Type.Missing);
|
|
|
workbook = null;
|
|
|
excel.Quit();
|
|
|
excel = null;
|
|
|
|
|
|
bool isSucess = true;
|
|
|
|
|
|
|
|
|
|
|
|
if (!isSucess)
|
|
|
{
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "上传失败!";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
|
}
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { success = true, Message = "上传成功", data = headData, billdata = billdata });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
catch (Exception execError)
|
|
|
{
|
|
|
workbook.Close(true, Type.Missing, Type.Missing);
|
|
|
workbook = null;
|
|
|
excel.Quit();
|
|
|
excel = null;
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "读取Excel文件出错,请确认文件正确性" + execError.Message;
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public ContentResult SaveImpSi(string data)
|
|
|
{
|
|
|
//var headData = JsonConvert.Deserialize<MsOpSeaeAms>(data);
|
|
|
var headData = JsonConvert.Deserialize<MsOpSeae>(data);
|
|
|
var ImportFieldData = JsonConvert.Deserialize<MsOpSeaeImpField>(data);
|
|
|
var billdata = MsOpSeaeDAL.GetData(" BSNO='" + headData.BSNO + "'");
|
|
|
|
|
|
billdata.DbOperationType = DbOperationType.DbotUpd;
|
|
|
billdata.ModelUIStatus = "E";
|
|
|
if (ImportFieldData.ISSHIPPER) billdata.SHIPPER = headData.SHIPPER;
|
|
|
if (ImportFieldData.ISCONSIGNEE) billdata.CONSIGNEE = headData.CONSIGNEE;
|
|
|
if (ImportFieldData.ISNOTIFYPARTY) billdata.NOTIFYPARTY = headData.NOTIFYPARTY;
|
|
|
if (ImportFieldData.ISETD) billdata.ETD = headData.ETD;
|
|
|
if (ImportFieldData.ISETA) billdata.ETA = headData.ETA;
|
|
|
if (ImportFieldData.ISVESSEL) billdata.VESSEL = headData.VESSEL;
|
|
|
if (ImportFieldData.ISVOYNO) billdata.VOYNO = headData.VOYNO;
|
|
|
if (ImportFieldData.ISPORTLOAD) billdata.PORTLOAD = headData.PORTLOAD;
|
|
|
if (ImportFieldData.ISPORTDISCHARGE) billdata.PORTDISCHARGE = headData.PORTDISCHARGE;
|
|
|
if (ImportFieldData.ISDESTINATION) billdata.DESTINATION = headData.DESTINATION;
|
|
|
if (ImportFieldData.ISPLACEDELIVERY) billdata.PLACEDELIVERY = headData.PLACEDELIVERY;
|
|
|
if (ImportFieldData.ISSERVICE) billdata.SERVICE = headData.SERVICE;
|
|
|
if (ImportFieldData.ISISSUETYPE) billdata.ISSUETYPE = headData.ISSUETYPE;
|
|
|
if (ImportFieldData.ISNOBILL) billdata.NOBILL = headData.NOBILL;
|
|
|
if (ImportFieldData.ISISSUEDATE) billdata.ISSUEDATE = headData.ISSUEDATE;
|
|
|
if (ImportFieldData.ISISSUEPLACE) billdata.ISSUEPLACE = headData.ISSUEPLACE;
|
|
|
if (ImportFieldData.ISBLFRT) billdata.BLFRT = headData.BLFRT;
|
|
|
if (ImportFieldData.ISPREPARDAT) billdata.PREPARDAT = headData.PREPARDAT;
|
|
|
if (ImportFieldData.ISHSCODE) billdata.HSCODE = headData.HSCODE;
|
|
|
if (ImportFieldData.ISPAYABLEAT) billdata.PAYABLEAT = headData.PAYABLEAT;
|
|
|
if (ImportFieldData.ISMARKS) billdata.MARKS = headData.MARKS;
|
|
|
if (ImportFieldData.ISDESCRIPTION) billdata.DESCRIPTION = headData.DESCRIPTION;
|
|
|
if (ImportFieldData.ISPKGS) billdata.PKGS = headData.PKGS;
|
|
|
if (ImportFieldData.ISKINDPKGS) billdata.KINDPKGS = headData.KINDPKGS;
|
|
|
if (ImportFieldData.ISKGS) billdata.KGS = headData.KGS;
|
|
|
if (ImportFieldData.ISCBM) billdata.CBM = headData.CBM;
|
|
|
if (ImportFieldData.ISTOTALNO) billdata.TOTALNO = headData.TOTALNO;
|
|
|
if (ImportFieldData.ISREMARK) billdata.REMARK = headData.REMARK;
|
|
|
|
|
|
|
|
|
|
|
|
var modb = new ModelObjectDB();
|
|
|
DBResult result = modb.Save(billdata);
|
|
|
|
|
|
var jsonRespose = new JsonResponse
|
|
|
{
|
|
|
Success = result.Success,
|
|
|
Message = result.Message
|
|
|
};
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
|
}
|
|
|
[HttpPost]
|
|
|
public ContentResult ImportBill()
|
|
|
{
|
|
|
var jsonRespose = new JsonResponse { Success = false, Message = "" };
|
|
|
|
|
|
if (Request.Files.Count != 1)
|
|
|
{
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "请选择上传的文件";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
var file = Request.Files["LoadExcel"];
|
|
|
if (file == null)
|
|
|
{
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "上传文件发生未知错误,请重新上传";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
var path = Server.MapPath("../../UploadFiles/BulkDetail");
|
|
|
var path2 = Server.MapPath("../../UploadFiles/BulkDetail/");
|
|
|
|
|
|
if (!Directory.Exists(path))
|
|
|
{
|
|
|
Directory.CreateDirectory(path);
|
|
|
}
|
|
|
|
|
|
var size = file.ContentLength;
|
|
|
var name = Path.GetFileName(file.FileName);
|
|
|
var bsno = Request.Form["bsno"];
|
|
|
|
|
|
var usercode = CookieConfig.GetCookie_UserCode(Request);
|
|
|
string filenamepath = usercode + DateTime.Now.ToString("yyyyMMddHHmmssfff") + name;
|
|
|
|
|
|
string filename = path + "\\" + filenamepath;
|
|
|
|
|
|
|
|
|
|
|
|
string excelFilePath = path2 + filenamepath;
|
|
|
|
|
|
|
|
|
if (System.IO.File.Exists(filename))
|
|
|
{
|
|
|
System.IO.File.Delete(filename);
|
|
|
}
|
|
|
file.SaveAs(filename);
|
|
|
|
|
|
if (!System.IO.File.Exists(filename))
|
|
|
{
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "上传的Excel不包含数据01";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
Microsoft.Office.Interop.Excel.Application excel = new Microsoft.Office.Interop.Excel.Application();
|
|
|
|
|
|
if (excel == null)
|
|
|
{
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "无法创建Excel对象,可能您的服务器计算机未安装Excel!!";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//List<string> sheets = ExcelSheetName(filename);
|
|
|
//if (sheets.Count == 0)
|
|
|
//{
|
|
|
// jsonRespose.Success = false;
|
|
|
// jsonRespose.Message = "上传的Excel不包含数据02";
|
|
|
// return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
//}
|
|
|
|
|
|
Workbook workbook = excel.Workbooks.Open(excelFilePath, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
|
|
|
Worksheet mySheet = workbook.Sheets[1] as Worksheet;
|
|
|
|
|
|
try
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
var isuse = false;
|
|
|
|
|
|
|
|
|
var headData = new MsOpSeae();
|
|
|
|
|
|
|
|
|
var BSNO = "topseae" + Guid.NewGuid().ToString();
|
|
|
headData.BSNO = BSNO;
|
|
|
headData.MASTERNO = BSNO;
|
|
|
|
|
|
var aaa = mySheet.Cells.get_Range("A3").Value2; //item
|
|
|
|
|
|
object v11new = aaa;
|
|
|
string strtmp = "";
|
|
|
string strtmp2 = "";
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
if (headData.SHIPPER == "")
|
|
|
headData.SHIPPER = strtmp;
|
|
|
else
|
|
|
headData.SHIPPER = headData.SHIPPER + Environment.NewLine + strtmp;
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("A4").Value2; //item
|
|
|
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
if (headData.SHIPPER == "")
|
|
|
headData.SHIPPER = strtmp;
|
|
|
else
|
|
|
headData.SHIPPER = headData.SHIPPER + Environment.NewLine + strtmp;
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("A5").Value2; //item
|
|
|
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
if (headData.SHIPPER == "")
|
|
|
headData.SHIPPER = strtmp;
|
|
|
else
|
|
|
headData.SHIPPER = headData.SHIPPER + Environment.NewLine + strtmp;
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("A6").Value2; //item
|
|
|
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
if (headData.SHIPPER == "")
|
|
|
headData.SHIPPER = strtmp;
|
|
|
else
|
|
|
headData.SHIPPER = headData.SHIPPER + Environment.NewLine + strtmp;
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("A7").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
if (headData.SHIPPER == "")
|
|
|
headData.SHIPPER = strtmp;
|
|
|
else
|
|
|
headData.SHIPPER = headData.SHIPPER + Environment.NewLine + strtmp;
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("A10").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
if (headData.CONSIGNEE == "")
|
|
|
headData.CONSIGNEE = strtmp;
|
|
|
else
|
|
|
headData.CONSIGNEE = headData.CONSIGNEE + Environment.NewLine + strtmp;
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("A11").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
if (headData.CONSIGNEE == "")
|
|
|
headData.CONSIGNEE = strtmp;
|
|
|
else
|
|
|
headData.CONSIGNEE = headData.CONSIGNEE + Environment.NewLine + strtmp;
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("A12").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
if (headData.CONSIGNEE == "")
|
|
|
headData.CONSIGNEE = strtmp;
|
|
|
else
|
|
|
headData.CONSIGNEE = headData.CONSIGNEE + Environment.NewLine + strtmp;
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("A13").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
if (headData.CONSIGNEE == "")
|
|
|
headData.CONSIGNEE = strtmp;
|
|
|
else
|
|
|
headData.CONSIGNEE = headData.CONSIGNEE + Environment.NewLine + strtmp;
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("A14").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
if (headData.CONSIGNEE == "")
|
|
|
headData.CONSIGNEE = strtmp;
|
|
|
else
|
|
|
headData.CONSIGNEE = headData.CONSIGNEE + Environment.NewLine + strtmp;
|
|
|
}
|
|
|
|
|
|
aaa = mySheet.Cells.get_Range("A17").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
if (headData.NOTIFYPARTY == "")
|
|
|
headData.NOTIFYPARTY = strtmp;
|
|
|
else
|
|
|
headData.NOTIFYPARTY = headData.NOTIFYPARTY + Environment.NewLine + strtmp;
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("A18").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
if (headData.NOTIFYPARTY == "")
|
|
|
headData.NOTIFYPARTY = strtmp;
|
|
|
else
|
|
|
headData.NOTIFYPARTY = headData.NOTIFYPARTY + Environment.NewLine + strtmp;
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("A19").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
if (headData.NOTIFYPARTY == "")
|
|
|
headData.NOTIFYPARTY = strtmp;
|
|
|
else
|
|
|
headData.NOTIFYPARTY = headData.NOTIFYPARTY + Environment.NewLine + strtmp;
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("A20").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
if (headData.NOTIFYPARTY == "")
|
|
|
headData.NOTIFYPARTY = strtmp;
|
|
|
else
|
|
|
headData.NOTIFYPARTY = headData.NOTIFYPARTY + Environment.NewLine + strtmp;
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("A21").Value2;
|
|
|
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
if (headData.NOTIFYPARTY == "")
|
|
|
headData.NOTIFYPARTY = strtmp;
|
|
|
else
|
|
|
headData.NOTIFYPARTY = headData.NOTIFYPARTY + Environment.NewLine + strtmp;
|
|
|
}
|
|
|
|
|
|
aaa = mySheet.Cells.get_Range("A24").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
headData.VESSEL = strtmp;
|
|
|
}
|
|
|
|
|
|
aaa = mySheet.Cells.get_Range("D24").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
headData.PORTLOAD = strtmp;
|
|
|
aaa = mySheet.Cells.get_Range("F24").Value2;
|
|
|
}
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
headData.PORTDISCHARGE = strtmp;
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("A26").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
headData.PLACERECEIPT = strtmp;
|
|
|
}
|
|
|
|
|
|
aaa = mySheet.Cells.get_Range("D26").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
headData.PLACEDELIVERY = strtmp;
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("F26").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
headData.MBLNO = strtmp;
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("A29").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
headData.MARKS = strtmp;
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("C29").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
{
|
|
|
headData.NOPKGS = strtmp;
|
|
|
var pkg = Regex.Match(strtmp, "\\d+").ToString();
|
|
|
if (pkg != "")
|
|
|
{
|
|
|
headData.PKGS = Convert.ToInt16(pkg).ToString();
|
|
|
var kindkgs = strtmp.Substring(pkg.Length, strtmp.Length - pkg.Length);
|
|
|
headData.KINDPKGS = kindkgs;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("D29").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
headData.DESCRIPTION = strtmp;
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("G29").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
{
|
|
|
headData.GROSSWEIGHT = strtmp;
|
|
|
var KGS = Regex.Match(strtmp, "\\d+").ToString();
|
|
|
if (KGS != "")
|
|
|
{
|
|
|
headData.KGS = Convert.ToDecimal(KGS).ToString();
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("H29").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
{
|
|
|
headData.MEASUREMENT = strtmp;
|
|
|
var KGS = Regex.Match(strtmp, "\\d+").ToString();
|
|
|
if (KGS != "")
|
|
|
headData.CBM = Convert.ToDecimal(KGS).ToString();
|
|
|
}
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("D44").Value2;
|
|
|
v11new = aaa;
|
|
|
var bbb = mySheet.Cells.get_Range("E44").Value2; //item
|
|
|
var bodyList = new List<MsOpSeaeDetail>();
|
|
|
if (GetExcelValue(mySheet, "A65") != "")
|
|
|
{
|
|
|
var j = 65;
|
|
|
while (GetExcelValue(mySheet, "A" + j.ToString()) != "")
|
|
|
{
|
|
|
MsOpSeaeDetail data = new MsOpSeaeDetail();
|
|
|
data.BSNO = BSNO;
|
|
|
data.CTNALL = GetExcelValue(mySheet, "C" + j.ToString());
|
|
|
data.CNTRNO = GetExcelValue(mySheet, "A" + j.ToString());
|
|
|
data.SEALNO = GetExcelValue(mySheet, "B" + j.ToString());
|
|
|
try
|
|
|
{
|
|
|
data.PKGS = Convert.ToInt32(GetExcelValue(mySheet, "D" + j.ToString()));
|
|
|
data.KINDPKGS = GetExcelValue(mySheet, "E" + j.ToString());
|
|
|
data.KGS = Convert.ToDecimal(GetExcelValue(mySheet, "F" + j.ToString()));
|
|
|
data.CBM = Convert.ToDecimal(GetExcelValue(mySheet, "G" + j.ToString()));
|
|
|
}
|
|
|
catch (Exception exception)
|
|
|
{
|
|
|
|
|
|
}
|
|
|
data.GOODSNAME = GetExcelValue(mySheet, "H" + j.ToString()).Replace("'", "''");
|
|
|
data.CTNFEE = GetExcelValue(mySheet, "I" + j.ToString());
|
|
|
data.REMARK = GetExcelValue(mySheet, "G" + j.ToString());
|
|
|
bodyList.Add(data);
|
|
|
j = j + 1;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
object v11new2 = bbb;
|
|
|
|
|
|
if (v11new != null && v11new2 != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
{
|
|
|
|
|
|
MsOpSeaeDetail headRow = new MsOpSeaeDetail();
|
|
|
headRow.CTN_ID = Guid.NewGuid().ToString();
|
|
|
headRow.BSNO = BSNO;
|
|
|
headRow.CTNALL = strtmp;
|
|
|
strtmp2 = v11new2.ToString();
|
|
|
if (strtmp2 != "")
|
|
|
headRow.CTNNUM = Convert.ToInt16(strtmp2);
|
|
|
headRow.DbOperationType = DbOperationType.DbotIns;
|
|
|
var modb1 = new ModelObjectDB();
|
|
|
modb1.Save(headRow);
|
|
|
headData.CNTRTOTAL = strtmp + "*" + strtmp2;
|
|
|
}
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("D45").Value2;
|
|
|
v11new = aaa;
|
|
|
bbb = mySheet.Cells.get_Range("E45").Value2; //item
|
|
|
|
|
|
v11new2 = bbb;
|
|
|
|
|
|
if (v11new != null && v11new2 != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
{
|
|
|
|
|
|
MsOpSeaeDetail headRow = new MsOpSeaeDetail();
|
|
|
headRow.CTN_ID = Guid.NewGuid().ToString();
|
|
|
headRow.BSNO = BSNO;
|
|
|
headRow.CTNALL = strtmp;
|
|
|
strtmp = v11new2.ToString();
|
|
|
if (strtmp != "")
|
|
|
headRow.CTNNUM = Convert.ToInt16(strtmp);
|
|
|
headRow.DbOperationType = DbOperationType.DbotIns;
|
|
|
var modb2 = new ModelObjectDB();
|
|
|
modb2.Save(headRow);
|
|
|
headData.CNTRTOTAL = headData.CNTRTOTAL + " " + strtmp + "*" + strtmp2;
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
aaa = mySheet.Cells.get_Range("D47").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
headData.BLFRT = strtmp;
|
|
|
}
|
|
|
|
|
|
var custno = "";
|
|
|
//var billnoset = MsSysBillNoSetDAL.GetData("OPLBNAME='海运出口'", Convert.ToString(Session["COMPANYID"]));
|
|
|
//if (billnoset.BILLTYPE != "")
|
|
|
// isuse = true;
|
|
|
//else
|
|
|
// isuse = MsBaseInfoDAL.GetRuleUse("委托编号", "1");
|
|
|
//if (headData.CUSTNO == "")
|
|
|
//{
|
|
|
// if (isuse)
|
|
|
// {
|
|
|
// if (billnoset.BILLTYPE != "")
|
|
|
// custno = MsSysBillNoSetDAL.GetBillNo(billnoset, headData.ETD.ToString().Trim(), headData.ACCDATE.ToString().Trim(), "", headData.OP);
|
|
|
// else
|
|
|
// custno = MsOpSeaeDAL.getCodeRule("委托编号", "CUSTNO", headData.BSDATE.ToString().Trim(), headData.ACCDATE.ToString().Trim(), CookieConfig.GetCookie_UserId(Request), Convert.ToString(Session["COMPANYID"]));
|
|
|
|
|
|
// headData.CUSTNO = custno;
|
|
|
|
|
|
// }
|
|
|
|
|
|
//}
|
|
|
headData.INPUTBY = Convert.ToString(Session["SHOWNAME"]);
|
|
|
headData.BSDATE = DateTime.Now;
|
|
|
headData.BSSTATUS = false;
|
|
|
headData.FEESTATUS = false;
|
|
|
headData.DbOperationType = DbOperationType.DbotIns;
|
|
|
headData.BLTYPE = "整箱";
|
|
|
headData.FENPIAO = "0";
|
|
|
|
|
|
if (headData.CORPID == "" || headData.CORPID == null)
|
|
|
{
|
|
|
headData.CORPID = Convert.ToString(Session["COMPANYID"]);
|
|
|
}
|
|
|
|
|
|
if (headData.MASTERNO == null || headData.MASTERNO == "") { headData.MASTERNO = headData.BSNO; }
|
|
|
|
|
|
if (headData.ETA == "") headData.ETA = null;
|
|
|
if (headData.ETD == "") headData.ETD = null;
|
|
|
if (headData.STLDATE == "") headData.STLDATE = null;
|
|
|
|
|
|
if (headData.ISSUEDATE == "" || (Convert.ToDateTime(headData.ISSUEDATE) < Convert.ToDateTime("2010-01-01"))) headData.ISSUEDATE = null;
|
|
|
if (headData.CLOSINGDATE == "") headData.CLOSINGDATE = null;
|
|
|
if (headData.CLOSEDOCDATE == "") headData.CLOSEDOCDATE = null;
|
|
|
if (headData.INSPECTIONDATE == "") headData.INSPECTIONDATE = null;
|
|
|
if (headData.CUSTOMDATE == "") headData.CUSTOMDATE = null;
|
|
|
if (headData.CLEARCUSTOMDATE == "") headData.CLEARCUSTOMDATE = null;
|
|
|
|
|
|
var modb = new ModelObjectDB();
|
|
|
DBResult result = modb.Save(headData);
|
|
|
if (result.Success && (bodyList.Count > 0)) MsOpSeaeDAL.InsertCtnData(BSNO, bodyList);
|
|
|
|
|
|
workbook.Close(true, Type.Missing, Type.Missing);
|
|
|
workbook = null;
|
|
|
excel.Quit();
|
|
|
excel = null;
|
|
|
|
|
|
bool isSucess = result.Success;
|
|
|
|
|
|
|
|
|
|
|
|
if (!isSucess)
|
|
|
{
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "上传失败!";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
|
}
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { success = true, Message = "上传成功", data = headData });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
workbook.Close(true, Type.Missing, Type.Missing);
|
|
|
workbook = null;
|
|
|
excel.Quit();
|
|
|
excel = null;
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "读取Excel文件出错,请确认文件正确性";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
}
|
|
|
|
|
|
[HttpPost]
|
|
|
public ContentResult ImportBillData()
|
|
|
{
|
|
|
var jsonRespose = new JsonResponse { Success = false, Message = "" };
|
|
|
|
|
|
if (Request.Files.Count != 1)
|
|
|
{
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "请选择上传的文件";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
var file = Request.Files["LoadExcel"];
|
|
|
if (file == null)
|
|
|
{
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "上传文件发生未知错误,请重新上传";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
var path = Server.MapPath("../../UploadFiles/BulkDetail");
|
|
|
var path2 = Server.MapPath("../../UploadFiles/BulkDetail/");
|
|
|
|
|
|
if (!Directory.Exists(path))
|
|
|
{
|
|
|
Directory.CreateDirectory(path);
|
|
|
}
|
|
|
|
|
|
var size = file.ContentLength;
|
|
|
var name = Path.GetFileName(file.FileName);
|
|
|
var bsno = Request.Form["bsno"];
|
|
|
|
|
|
var usercode = CookieConfig.GetCookie_UserCode(Request);
|
|
|
string filenamepath = usercode + DateTime.Now.ToString("yyyyMMddHHmmssfff") + name;
|
|
|
|
|
|
string filename = path + "\\" + filenamepath;
|
|
|
|
|
|
|
|
|
|
|
|
string excelFilePath = path2 + filenamepath;
|
|
|
|
|
|
|
|
|
if (System.IO.File.Exists(filename))
|
|
|
{
|
|
|
System.IO.File.Delete(filename);
|
|
|
}
|
|
|
file.SaveAs(filename);
|
|
|
|
|
|
if (!System.IO.File.Exists(filename))
|
|
|
{
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "上传的Excel不包含数据01";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
Microsoft.Office.Interop.Excel.Application excel = new Microsoft.Office.Interop.Excel.Application();
|
|
|
|
|
|
if (excel == null)
|
|
|
{
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "无法创建Excel对象,可能您的服务器计算机未安装Excel!!";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//List<string> sheets = ExcelSheetName(filename);
|
|
|
//if (sheets.Count == 0)
|
|
|
//{
|
|
|
// jsonRespose.Success = false;
|
|
|
// jsonRespose.Message = "上传的Excel不包含数据02";
|
|
|
// return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
//}
|
|
|
|
|
|
Workbook workbook = excel.Workbooks.Open(excelFilePath, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
|
|
|
Worksheet mySheet = workbook.Sheets[1] as Worksheet;
|
|
|
|
|
|
try
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
var isuse = false;
|
|
|
|
|
|
|
|
|
var headData = new MsOpSeaeBill();
|
|
|
|
|
|
|
|
|
var AS_ID = Guid.NewGuid().ToString();
|
|
|
headData.BSNO = bsno;
|
|
|
headData.AS_ID = AS_ID;
|
|
|
|
|
|
var aaa = mySheet.Cells.get_Range("A3").Value2; //item
|
|
|
|
|
|
object v11new = aaa;
|
|
|
string strtmp = "";
|
|
|
string strtmp2 = "";
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
if (headData.SHIPPER == "")
|
|
|
headData.SHIPPER = strtmp;
|
|
|
else
|
|
|
headData.SHIPPER = headData.SHIPPER + Environment.NewLine + strtmp;
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("A4").Value2; //item
|
|
|
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
if (headData.SHIPPER == "")
|
|
|
headData.SHIPPER = strtmp;
|
|
|
else
|
|
|
headData.SHIPPER = headData.SHIPPER + Environment.NewLine + strtmp;
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("A5").Value2; //item
|
|
|
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
if (headData.SHIPPER == "")
|
|
|
headData.SHIPPER = strtmp;
|
|
|
else
|
|
|
headData.SHIPPER = headData.SHIPPER + Environment.NewLine + strtmp;
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("A6").Value2; //item
|
|
|
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
if (headData.SHIPPER == "")
|
|
|
headData.SHIPPER = strtmp;
|
|
|
else
|
|
|
headData.SHIPPER = headData.SHIPPER + Environment.NewLine + strtmp;
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("A7").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
if (headData.SHIPPER == "")
|
|
|
headData.SHIPPER = strtmp;
|
|
|
else
|
|
|
headData.SHIPPER = headData.SHIPPER + Environment.NewLine + strtmp;
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("A10").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
if (headData.CONSIGNEE == "")
|
|
|
headData.CONSIGNEE = strtmp;
|
|
|
else
|
|
|
headData.CONSIGNEE = headData.CONSIGNEE + Environment.NewLine + strtmp;
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("A11").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
if (headData.CONSIGNEE == "")
|
|
|
headData.CONSIGNEE = strtmp;
|
|
|
else
|
|
|
headData.CONSIGNEE = headData.CONSIGNEE + Environment.NewLine + strtmp;
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("A12").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
if (headData.CONSIGNEE == "")
|
|
|
headData.CONSIGNEE = strtmp;
|
|
|
else
|
|
|
headData.CONSIGNEE = headData.CONSIGNEE + Environment.NewLine + strtmp;
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("A13").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
if (headData.CONSIGNEE == "")
|
|
|
headData.CONSIGNEE = strtmp;
|
|
|
else
|
|
|
headData.CONSIGNEE = headData.CONSIGNEE + Environment.NewLine + strtmp;
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("A14").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
if (headData.CONSIGNEE == "")
|
|
|
headData.CONSIGNEE = strtmp;
|
|
|
else
|
|
|
headData.CONSIGNEE = headData.CONSIGNEE + Environment.NewLine + strtmp;
|
|
|
}
|
|
|
|
|
|
aaa = mySheet.Cells.get_Range("A17").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
if (headData.NOTIFYPARTY == "")
|
|
|
headData.NOTIFYPARTY = strtmp;
|
|
|
else
|
|
|
headData.NOTIFYPARTY = headData.NOTIFYPARTY + Environment.NewLine + strtmp;
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("A18").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
if (headData.NOTIFYPARTY == "")
|
|
|
headData.NOTIFYPARTY = strtmp;
|
|
|
else
|
|
|
headData.NOTIFYPARTY = headData.NOTIFYPARTY + Environment.NewLine + strtmp;
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("A19").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
if (headData.NOTIFYPARTY == "")
|
|
|
headData.NOTIFYPARTY = strtmp;
|
|
|
else
|
|
|
headData.NOTIFYPARTY = headData.NOTIFYPARTY + Environment.NewLine + strtmp;
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("A20").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
if (headData.NOTIFYPARTY == "")
|
|
|
headData.NOTIFYPARTY = strtmp;
|
|
|
else
|
|
|
headData.NOTIFYPARTY = headData.NOTIFYPARTY + Environment.NewLine + strtmp;
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("A21").Value2;
|
|
|
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
if (headData.NOTIFYPARTY == "")
|
|
|
headData.NOTIFYPARTY = strtmp;
|
|
|
else
|
|
|
headData.NOTIFYPARTY = headData.NOTIFYPARTY + Environment.NewLine + strtmp;
|
|
|
}
|
|
|
|
|
|
aaa = mySheet.Cells.get_Range("A24").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
headData.VESSEL = strtmp;
|
|
|
}
|
|
|
|
|
|
aaa = mySheet.Cells.get_Range("D24").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
headData.PORTLOAD = strtmp;
|
|
|
aaa = mySheet.Cells.get_Range("F24").Value2;
|
|
|
}
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
headData.PORTDISCHARGE = strtmp;
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("A26").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
headData.PLACERECEIPT = strtmp;
|
|
|
}
|
|
|
|
|
|
aaa = mySheet.Cells.get_Range("D26").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
headData.PLACEDELIVERY = strtmp;
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("F26").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
headData.MBLNO = strtmp;
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("A29").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
headData.MARKS = strtmp;
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("C29").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
{
|
|
|
headData.NOPKGS = strtmp;
|
|
|
var pkg = Regex.Match(strtmp, "\\d+").ToString();
|
|
|
if (pkg != "")
|
|
|
{
|
|
|
headData.PKGS = Convert.ToInt16(pkg);
|
|
|
var kindkgs = strtmp.Substring(pkg.Length, strtmp.Length - pkg.Length);
|
|
|
headData.KINDPKGS = kindkgs;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("D29").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
headData.DESCRIPTION = strtmp;
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("G29").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
{
|
|
|
headData.GROSSWEIGHT = strtmp;
|
|
|
var KGS = Regex.Match(strtmp, "\\d+").ToString();
|
|
|
if (KGS != "")
|
|
|
{
|
|
|
headData.KGS = Convert.ToDecimal(KGS);
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("H29").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
{
|
|
|
headData.MEASUREMENT = strtmp;
|
|
|
var KGS = Regex.Match(strtmp, "\\d+").ToString();
|
|
|
if (KGS != "")
|
|
|
headData.CBM = Convert.ToDecimal(KGS);
|
|
|
}
|
|
|
}
|
|
|
var bodyList = new List<MsOpSeaeDetail>();
|
|
|
if (GetExcelValue(mySheet, "A65") != "")
|
|
|
{
|
|
|
var j = 65;
|
|
|
while (GetExcelValue(mySheet, "A" + j.ToString()) != "")
|
|
|
{
|
|
|
MsOpSeaeDetail data = new MsOpSeaeDetail();
|
|
|
data.BSNO = AS_ID;
|
|
|
data.CTNALL = GetExcelValue(mySheet, "C" + j.ToString());
|
|
|
data.CNTRNO = GetExcelValue(mySheet, "A" + j.ToString());
|
|
|
data.SEALNO = GetExcelValue(mySheet, "B" + j.ToString());
|
|
|
try
|
|
|
{
|
|
|
data.PKGS = Convert.ToInt32(GetExcelValue(mySheet, "D" + j.ToString()));
|
|
|
data.KINDPKGS = GetExcelValue(mySheet, "E" + j.ToString());
|
|
|
data.KGS = Convert.ToDecimal(GetExcelValue(mySheet, "F" + j.ToString()));
|
|
|
data.CBM = Convert.ToDecimal(GetExcelValue(mySheet, "G" + j.ToString()));
|
|
|
}
|
|
|
catch (Exception exception)
|
|
|
{
|
|
|
|
|
|
}
|
|
|
data.GOODSNAME = GetExcelValue(mySheet, "H" + j.ToString()).Replace("'", "''");
|
|
|
data.CTNFEE = GetExcelValue(mySheet, "I" + j.ToString());
|
|
|
data.REMARK = GetExcelValue(mySheet, "G" + j.ToString());
|
|
|
bodyList.Add(data);
|
|
|
j = j + 1;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
|
|
|
|
|
|
aaa = mySheet.Cells.get_Range("D44").Value2;
|
|
|
v11new = aaa;
|
|
|
var bbb = mySheet.Cells.get_Range("E44").Value2; //item
|
|
|
|
|
|
object v11new2 = bbb;
|
|
|
|
|
|
if (v11new != null && v11new2 != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
{
|
|
|
|
|
|
MsOpSeaeDetail headRow = new MsOpSeaeDetail();
|
|
|
headRow.CTN_ID = Guid.NewGuid().ToString();
|
|
|
headRow.BSNO = AS_ID;
|
|
|
headRow.CTNALL = strtmp;
|
|
|
strtmp2 = v11new2.ToString();
|
|
|
if (strtmp2 != "")
|
|
|
headRow.CTNNUM = Convert.ToInt16(strtmp2);
|
|
|
headRow.DbOperationType = DbOperationType.DbotIns;
|
|
|
var modb1 = new ModelObjectDB();
|
|
|
modb1.Save(headRow);
|
|
|
headData.CNTRTOTAL = strtmp + "*" + strtmp2;
|
|
|
}
|
|
|
}
|
|
|
aaa = mySheet.Cells.get_Range("D45").Value2;
|
|
|
v11new = aaa;
|
|
|
bbb = mySheet.Cells.get_Range("E45").Value2; //item
|
|
|
|
|
|
v11new2 = bbb;
|
|
|
|
|
|
if (v11new != null && v11new2 != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
{
|
|
|
|
|
|
MsOpSeaeDetail headRow = new MsOpSeaeDetail();
|
|
|
headRow.CTN_ID = Guid.NewGuid().ToString();
|
|
|
headRow.BSNO = AS_ID;
|
|
|
headRow.CTNALL = strtmp;
|
|
|
strtmp = v11new2.ToString();
|
|
|
if (strtmp != "")
|
|
|
headRow.CTNNUM = Convert.ToInt16(strtmp);
|
|
|
headRow.DbOperationType = DbOperationType.DbotIns;
|
|
|
var modb2 = new ModelObjectDB();
|
|
|
modb2.Save(headRow);
|
|
|
headData.CNTRTOTAL = headData.CNTRTOTAL + " " + strtmp + "*" + strtmp2;
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
aaa = mySheet.Cells.get_Range("D47").Value2;
|
|
|
v11new = aaa;
|
|
|
if (v11new != null)
|
|
|
{
|
|
|
strtmp = v11new.ToString();
|
|
|
if (strtmp != "")
|
|
|
headData.BLFRT = strtmp;
|
|
|
}
|
|
|
|
|
|
var custno = "";
|
|
|
//var billnoset = MsSysBillNoSetDAL.GetData("OPLBNAME='海运出口'", Convert.ToString(Session["COMPANYID"]));
|
|
|
//if (billnoset.BILLTYPE != "")
|
|
|
// isuse = true;
|
|
|
//else
|
|
|
// isuse = MsBaseInfoDAL.GetRuleUse("委托编号", "1");
|
|
|
//if (headData.CUSTNO == "")
|
|
|
//{
|
|
|
// if (isuse)
|
|
|
// {
|
|
|
// if (billnoset.BILLTYPE != "")
|
|
|
// custno = MsSysBillNoSetDAL.GetBillNo(billnoset, headData.ETD.ToString().Trim(), headData.ACCDATE.ToString().Trim(), "", headData.OP);
|
|
|
// else
|
|
|
// custno = MsOpSeaeDAL.getCodeRule("委托编号", "CUSTNO", headData.BSDATE.ToString().Trim(), headData.ACCDATE.ToString().Trim(), CookieConfig.GetCookie_UserId(Request), Convert.ToString(Session["COMPANYID"]));
|
|
|
|
|
|
// headData.CUSTNO = custno;
|
|
|
|
|
|
// }
|
|
|
|
|
|
//}
|
|
|
headData.INPUTBY = Convert.ToString(Session["SHOWNAME"]);
|
|
|
|
|
|
headData.DbOperationType = DbOperationType.DbotIns;
|
|
|
|
|
|
|
|
|
|
|
|
if (headData.ETA == "") headData.ETA = null;
|
|
|
if (headData.ETD == "") headData.ETD = null;
|
|
|
|
|
|
|
|
|
if (headData.ISSUEDATE == "" || (Convert.ToDateTime(headData.ISSUEDATE) < Convert.ToDateTime("2010-01-01"))) headData.ISSUEDATE = null;
|
|
|
if (headData.CLOSINGDATE == "") headData.CLOSINGDATE = null;
|
|
|
|
|
|
|
|
|
var modb = new ModelObjectDB();
|
|
|
DBResult result = modb.Save(headData);
|
|
|
if ((result.Success) && (bodyList.Count > 0)) MsOpSeaeDAL.InsertCtnData(AS_ID, bodyList);
|
|
|
|
|
|
workbook.Close(true, Type.Missing, Type.Missing);
|
|
|
workbook = null;
|
|
|
excel.Quit();
|
|
|
excel = null;
|
|
|
|
|
|
bool isSucess = result.Success;
|
|
|
|
|
|
|
|
|
|
|
|
if (!isSucess)
|
|
|
{
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "上传失败!";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
|
}
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { success = true, Message = "上传成功", data = headData });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
workbook.Close(true, Type.Missing, Type.Missing);
|
|
|
workbook = null;
|
|
|
excel.Quit();
|
|
|
excel = null;
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "读取Excel文件出错,请确认文件正确性";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
public ContentResult ImportCtn()
|
|
|
{
|
|
|
var jsonRespose = new JsonResponse { Success = false, Message = "" };
|
|
|
|
|
|
if (Request.Files.Count != 1)
|
|
|
{
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "请选择上传的文件";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
var file = Request.Files["LoadExcel"];
|
|
|
if (file == null)
|
|
|
{
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "上传文件发生未知错误,请重新上传";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
var path = Server.MapPath("../../UploadFiles/BulkDetail");
|
|
|
|
|
|
if (!Directory.Exists(path))
|
|
|
{
|
|
|
Directory.CreateDirectory(path);
|
|
|
}
|
|
|
|
|
|
var size = file.ContentLength;
|
|
|
var name = Path.GetFileName(file.FileName);
|
|
|
var bsno = Request.Form["bsno"];
|
|
|
|
|
|
var usercode = CookieConfig.GetCookie_UserCode(Request);
|
|
|
string filename = path + "\\" + usercode + DateTime.Now.ToString("yyyyMMddHHmmssfff") + name;
|
|
|
|
|
|
if (System.IO.File.Exists(filename))
|
|
|
{
|
|
|
System.IO.File.Delete(filename);
|
|
|
}
|
|
|
file.SaveAs(filename);
|
|
|
|
|
|
if (!System.IO.File.Exists(filename))
|
|
|
{
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "上传的Excel不包含数据01";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
|
|
|
var ExcelExt = "";
|
|
|
try
|
|
|
{
|
|
|
ExcelExt = WebConfigurationManager.AppSettings["ExcelExt"].ToString();
|
|
|
}
|
|
|
catch
|
|
|
{
|
|
|
|
|
|
}
|
|
|
if (ExcelExt == "" || ExcelExt == null) ExcelExt = "Excel 8.0;HDR=Yes;IMEX=1";
|
|
|
|
|
|
List<string> sheets = ExcelSheetName(filename, ExcelExt);
|
|
|
if (sheets.Count == 0)
|
|
|
{
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "上传的Excel不包含数据02";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
try
|
|
|
{
|
|
|
var sheetname = sheets[0];
|
|
|
string excelConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filename +
|
|
|
";Extended Properties="+ ExcelExt;
|
|
|
if (filename.ToLower().IndexOf(".xlsx") > 0)
|
|
|
{
|
|
|
excelConn = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + filename +
|
|
|
";Extended Properties=\"Excel 12.0 Xml;HDR=Yes\"";
|
|
|
|
|
|
}
|
|
|
OleDbDataAdapter oada = new OleDbDataAdapter("select * from [" + sheetname + "A1:N]", excelConn);
|
|
|
DataSet ds = new DataSet();
|
|
|
oada.Fill(ds);
|
|
|
|
|
|
if (ds.Tables.Count == 0)
|
|
|
{
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "上传的Excel不包含数据03";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
var table = ds.Tables[0];
|
|
|
if (table.Rows.Count == 0)
|
|
|
{
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "上传的Excel不包含数据04";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var message = string.Empty;
|
|
|
List<MsOpSeaeDetail> headList;
|
|
|
|
|
|
bool isSucess = false;
|
|
|
isSucess = MsOpSeaeDAL.ImportCtnData(bsno, Request, table, out message, out headList);
|
|
|
|
|
|
|
|
|
if (!isSucess)
|
|
|
{
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = message;
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { success = true, Message = "上传成功,共生成" + Convert.ToString(headList.Count) + "个托单", data = headList.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "读取Excel文件出错,请确认文件正确性"+e.Message;
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
}
|
|
|
public ContentResult ImportCtnDetail()
|
|
|
{
|
|
|
var jsonRespose = new JsonResponse { Success = false, Message = "" };
|
|
|
|
|
|
if (Request.Files.Count != 1)
|
|
|
{
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "请选择上传的文件";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
var file = Request.Files["LoadExcel"];
|
|
|
if (file == null)
|
|
|
{
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "上传文件发生未知错误,请重新上传";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
var path = Server.MapPath("../../UploadFiles/BulkDetail");
|
|
|
|
|
|
if (!Directory.Exists(path))
|
|
|
{
|
|
|
Directory.CreateDirectory(path);
|
|
|
}
|
|
|
|
|
|
var size = file.ContentLength;
|
|
|
var name = Path.GetFileName(file.FileName);
|
|
|
var bsno = Request.Form["CTN_ID"];
|
|
|
|
|
|
var usercode = CookieConfig.GetCookie_UserCode(Request);
|
|
|
string filename = path + "\\" + usercode + DateTime.Now.ToString("yyyyMMddHHmmssfff") + name;
|
|
|
|
|
|
if (System.IO.File.Exists(filename))
|
|
|
{
|
|
|
System.IO.File.Delete(filename);
|
|
|
}
|
|
|
file.SaveAs(filename);
|
|
|
|
|
|
if (!System.IO.File.Exists(filename))
|
|
|
{
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "上传的Excel不包含数据01";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
|
|
|
var ExcelExt = "";
|
|
|
try
|
|
|
{
|
|
|
ExcelExt = WebConfigurationManager.AppSettings["ExcelExt"].ToString();
|
|
|
}
|
|
|
catch
|
|
|
{
|
|
|
|
|
|
}
|
|
|
if (ExcelExt == "" || ExcelExt == null) ExcelExt = "Excel 8.0;HDR=Yes;IMEX=1";
|
|
|
|
|
|
List<string> sheets = ExcelSheetName(filename, ExcelExt);
|
|
|
if (sheets.Count == 0)
|
|
|
{
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "上传的Excel不包含数据02";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
try
|
|
|
{
|
|
|
var sheetname = sheets[0];
|
|
|
string excelConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filename +
|
|
|
";Extended Properties="+ ExcelExt;
|
|
|
if (filename.ToLower().IndexOf(".xlsx") > 0)
|
|
|
{
|
|
|
excelConn = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + filename +
|
|
|
";Extended Properties=\"Excel 12.0 Xml;HDR=Yes\"";
|
|
|
|
|
|
}
|
|
|
OleDbDataAdapter oada = new OleDbDataAdapter("select * from [" + sheetname + "A1:N]", excelConn);
|
|
|
DataSet ds = new DataSet();
|
|
|
oada.Fill(ds);
|
|
|
|
|
|
if (ds.Tables.Count == 0)
|
|
|
{
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "上传的Excel不包含数据03";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
var table = ds.Tables[0];
|
|
|
if (table.Rows.Count == 0 || table.Rows.Count == 1)
|
|
|
{
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "上传的Excel不包含数据04";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var message = string.Empty;
|
|
|
List<MsOpCtnDetail> headList;
|
|
|
|
|
|
bool isSucess = false;
|
|
|
isSucess = MsOpSeaeDAL.ImportCtnDetail(bsno, Request, table, out message, out headList);
|
|
|
|
|
|
|
|
|
if (!isSucess)
|
|
|
{
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = message;
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { success = true, Message = "上传成功,共生成" + Convert.ToString(headList.Count) + "个明细", data = headList.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "读取Excel文件出错,请确认文件正确性";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
}
|
|
|
[HttpPost]
|
|
|
public ContentResult ImportCtnAndDetail()
|
|
|
{
|
|
|
var jsonRespose = new JsonResponse { Success = false, Message = "" };
|
|
|
|
|
|
if (Request.Files.Count != 1)
|
|
|
{
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "请选择上传的文件";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
var file = Request.Files["LoadExcel"];
|
|
|
if (file == null)
|
|
|
{
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "上传文件发生未知错误,请重新上传";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
var path = Server.MapPath("../../UploadFiles/BulkDetail");
|
|
|
|
|
|
if (!Directory.Exists(path))
|
|
|
{
|
|
|
Directory.CreateDirectory(path);
|
|
|
}
|
|
|
|
|
|
var size = file.ContentLength;
|
|
|
var name = Path.GetFileName(file.FileName);
|
|
|
var bsno = Request.Form["bsno"];
|
|
|
|
|
|
var usercode = CookieConfig.GetCookie_UserCode(Request);
|
|
|
string filename = path + "\\" + usercode + DateTime.Now.ToString("yyyyMMddHHmmssfff") + name;
|
|
|
|
|
|
if (System.IO.File.Exists(filename))
|
|
|
{
|
|
|
System.IO.File.Delete(filename);
|
|
|
}
|
|
|
file.SaveAs(filename);
|
|
|
|
|
|
if (!System.IO.File.Exists(filename))
|
|
|
{
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "上传的Excel不包含数据01";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
|
|
|
var ExcelExt = "";
|
|
|
try
|
|
|
{
|
|
|
ExcelExt = WebConfigurationManager.AppSettings["ExcelExt"].ToString();
|
|
|
}
|
|
|
catch
|
|
|
{
|
|
|
|
|
|
}
|
|
|
if (ExcelExt == "" || ExcelExt == null) ExcelExt = "Excel 8.0;HDR=Yes;IMEX=1";
|
|
|
|
|
|
List<string> sheets = ExcelSheetName(filename, ExcelExt);
|
|
|
if (sheets.Count == 0)
|
|
|
{
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "上传的Excel不包含数据02";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
try
|
|
|
{
|
|
|
var sheetname = sheets[0];
|
|
|
string excelConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filename +
|
|
|
";Extended Properties="+ ExcelExt;
|
|
|
if (filename.ToLower().IndexOf(".xlsx") > 0 || filename.ToLower().IndexOf(".xlsm") > 0)
|
|
|
{
|
|
|
excelConn = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + filename +
|
|
|
";Extended Properties=\"Excel 12.0 Xml;HDR=Yes\"";
|
|
|
|
|
|
}
|
|
|
OleDbDataAdapter oada = new OleDbDataAdapter("select * from [" + sheetname + "A1:N]", excelConn);
|
|
|
DataSet ds = new DataSet();
|
|
|
oada.Fill(ds);
|
|
|
|
|
|
if (ds.Tables.Count == 0)
|
|
|
{
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "上传的Excel不包含数据03";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
var table = ds.Tables[0];
|
|
|
if (table.Rows.Count == 0 || table.Rows.Count == 1)
|
|
|
{
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "上传的Excel不包含数据04";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var message = string.Empty;
|
|
|
List<MsOpSeaeDetail> headList;
|
|
|
|
|
|
bool isSucess = false;
|
|
|
isSucess = MsOpSeaeDAL.ImportCtnAndDetailData(bsno, Request, table, out message, out headList);
|
|
|
|
|
|
|
|
|
if (!isSucess)
|
|
|
{
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = message;
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { success = true, Message = "上传成功,共生成" + Convert.ToString(headList.Count) + "个托单", data = headList.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "读取Excel文件出错,请确认文件正确性";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
}
|
|
|
|
|
|
[HttpPost]
|
|
|
public ContentResult ImportMN()
|
|
|
{
|
|
|
var jsonRespose = new JsonResponse { Success = false, Message = "" };
|
|
|
|
|
|
if (Request.Files.Count != 1)
|
|
|
{
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "请选择上传的文件";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
var file = Request.Files["LoadExcel"];
|
|
|
if (file == null)
|
|
|
{
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "上传文件发生未知错误,请重新上传";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
var path = Server.MapPath("../../UploadFiles/BulkDetail");
|
|
|
|
|
|
if (!Directory.Exists(path))
|
|
|
{
|
|
|
Directory.CreateDirectory(path);
|
|
|
}
|
|
|
|
|
|
var size = file.ContentLength;
|
|
|
var name = Path.GetFileName(file.FileName);
|
|
|
var bsno = Request.Form["bsno"];
|
|
|
|
|
|
var usercode = CookieConfig.GetCookie_UserCode(Request);
|
|
|
string filename = path + "\\" + usercode + DateTime.Now.ToString("yyyyMMddHHmmssfff") + name;
|
|
|
|
|
|
if (System.IO.File.Exists(filename))
|
|
|
{
|
|
|
System.IO.File.Delete(filename);
|
|
|
}
|
|
|
file.SaveAs(filename);
|
|
|
|
|
|
if (!System.IO.File.Exists(filename))
|
|
|
{
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "上传的Excel不包含数据01";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
|
|
|
var ExcelExt = "";
|
|
|
try
|
|
|
{
|
|
|
ExcelExt = WebConfigurationManager.AppSettings["ExcelExt"].ToString();
|
|
|
}
|
|
|
catch
|
|
|
{
|
|
|
|
|
|
}
|
|
|
if (ExcelExt == "" || ExcelExt == null) ExcelExt = "Excel 8.0;HDR=Yes;IMEX=1";
|
|
|
|
|
|
List<string> sheets = ExcelSheetName(filename, ExcelExt);
|
|
|
if (sheets.Count == 0)
|
|
|
{
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "上传的Excel不包含数据02";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
try
|
|
|
{
|
|
|
var sheetname = sheets[0];
|
|
|
string excelConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filename +
|
|
|
";Extended Properties="+ ExcelExt;
|
|
|
if (filename.ToLower().IndexOf(".xlsx") > 0)
|
|
|
{
|
|
|
excelConn = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + filename +
|
|
|
";Extended Properties=\"Excel 12.0 Xml;HDR=Yes\"";
|
|
|
|
|
|
}
|
|
|
OleDbDataAdapter oada = new OleDbDataAdapter("select * from [" + sheetname + "]", excelConn);
|
|
|
DataSet ds = new DataSet();
|
|
|
oada.Fill(ds);
|
|
|
|
|
|
if (ds.Tables.Count == 0)
|
|
|
{
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "上传的Excel不包含数据03";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
var table = ds.Tables[0];
|
|
|
if (table.Rows.Count == 0 || table.Rows.Count == 1)
|
|
|
{
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "上传的Excel不包含数据04";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var message = string.Empty;
|
|
|
List<MsOpSeaeDetail> headList;
|
|
|
|
|
|
bool isSucess = false;
|
|
|
isSucess = MsOpSeaeDAL.ImportMNData(bsno, Request, table, out message, out headList);
|
|
|
|
|
|
|
|
|
if (!isSucess)
|
|
|
{
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = message;
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { success = true, Message = "上传成功,共生成" + Convert.ToString(headList.Count) + "个托单", data = headList.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "读取Excel文件出错,请确认文件正确性";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
public List<string> ExcelSheetName(string filepath,string ExcelExt)
|
|
|
{
|
|
|
var al = new List<string>();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
string strConn;
|
|
|
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filepath + ";Extended Properties="+ ExcelExt;
|
|
|
if (filepath.ToLower().IndexOf(".xlsx") > 0 || filepath.ToLower().IndexOf(".xlsm") > 0)
|
|
|
{
|
|
|
strConn = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + filepath +
|
|
|
";Extended Properties=\"Excel 12.0 Xml;HDR=Yes\"";
|
|
|
|
|
|
}
|
|
|
OleDbConnection conn = new OleDbConnection(strConn);
|
|
|
conn.Open();
|
|
|
System.Data.DataTable sheetNames = conn.GetOleDbSchemaTable
|
|
|
(System.Data.OleDb.OleDbSchemaGuid.Tables, new object[] { null, null, null, "TABLE" });
|
|
|
conn.Close();
|
|
|
|
|
|
foreach (DataRow dr in sheetNames.Rows)
|
|
|
{
|
|
|
al.Add(dr[2].ToString());
|
|
|
}
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
return new List<string>();
|
|
|
}
|
|
|
|
|
|
return al;
|
|
|
}
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region 东胜VGM发送
|
|
|
public ContentResult CreateAndSendVGM(string mblno, string userid, string type,string bsno)
|
|
|
{
|
|
|
string path = Server.MapPath("../../VGMFile/");
|
|
|
string filepath = "";
|
|
|
|
|
|
T_ALL_DA T_ALL_DA = new T_ALL_DA();
|
|
|
var CARRIERID = T_ALL_DA.GetStrSQL("CODENAME", "select top 1 CODENAME from [info_client] where SHORTNAME in (select CARRIER FROM OP_SEAE WHERE MBLNO='" + mblno + "')");
|
|
|
|
|
|
var USEDSVGMPOST = MsSysParamSetDAL.GetData("PARAMNAME='USEDSVGMPOST'");
|
|
|
if (USEDSVGMPOST.PARAMVALUE == "1")
|
|
|
{
|
|
|
var error = "";
|
|
|
var DSVGMID = MsSysParamSetDAL.GetData("PARAMNAME='DSVGMID'").PARAMVALUE;
|
|
|
var DSVGMKEY = MsSysParamSetDAL.GetData("PARAMNAME='DSVGMKEY'").PARAMVALUE;
|
|
|
if (DSVGMID == "")
|
|
|
{ error = error + "<br />东胜VGM用户ID不能为空"; }
|
|
|
if (DSVGMKEY == "")
|
|
|
{ error = error + "<br />东胜VGM用户秘钥不能为空"; }
|
|
|
|
|
|
|
|
|
MsDsVgm DsVgm = new MsDsVgm();
|
|
|
DsVgm.ac = "vgm";
|
|
|
DsVgm.uid = DSVGMID;
|
|
|
DsVgm.skey = DSVGMKEY;
|
|
|
DsVgm.optype = type;
|
|
|
var opseae = MsOpSeaeDAL.GetData("BSNO='"+bsno+"'");
|
|
|
MsOpSeaVgm opSeaVgm = new MsOpSeaVgm();
|
|
|
opSeaVgm.MBLNO = mblno;
|
|
|
opSeaVgm.CARRIER = CARRIERID;
|
|
|
opSeaVgm.ZongZhongLiang = opseae.KGS.ToString();
|
|
|
if (opseae.KGS.ToString() == "0")
|
|
|
{ error = error + "<br />总总量不能为空"; }
|
|
|
opSeaVgm.ETD = opseae.ETD;
|
|
|
if (opseae.ETD==null||opseae.ETD.ToString() == "")
|
|
|
{ error = error + "<br />开船日期不能为空"; }
|
|
|
opSeaVgm.BeiZhu = opseae.OP;
|
|
|
var MsOpSeaVgmCtnList = new List<MsOpSeaVgmCtn>();
|
|
|
List<MsOpSeaeDetail> ctnlist = MsOpSeaeDAL.GetBodyList("bsno='"+bsno+"'");
|
|
|
foreach (var ctnitems in ctnlist) {
|
|
|
MsOpSeaVgmCtn OpSeaVgmCtn = new MsOpSeaVgmCtn();
|
|
|
OpSeaVgmCtn.CNTRNO = ctnitems.CNTRNO;
|
|
|
if (ctnitems.CNTRNO == "")
|
|
|
{ error = error + "<br />箱号不能为空"; }
|
|
|
OpSeaVgmCtn.CTNALL = ctnitems.CTNALL;
|
|
|
if (ctnitems.CNTRNO == "")
|
|
|
{ error = error + "<br />箱型不能为空"; }
|
|
|
OpSeaVgmCtn.SEALNO = ctnitems.SEALNO;
|
|
|
if (ctnitems.CNTRNO == "")
|
|
|
{ error = error + "<br />封号不能为空"; }
|
|
|
OpSeaVgmCtn.ChengZhongZhongLiang = ctnitems.WEIGHKGS.ToString();
|
|
|
if (ctnitems.WEIGHKGS.ToString() == "0"|| ctnitems.WEIGHKGS.ToString() == "")
|
|
|
{ error = error + "<br />称重重量不能为空"; }
|
|
|
OpSeaVgmCtn.ChengZhongShiJian = ctnitems.WEIGHDATE;
|
|
|
if (ctnitems.WEIGHDATE.ToString() == "")
|
|
|
{ error = error + "<br />称重时间不能为空"; }
|
|
|
|
|
|
MsOpSeaVgmCtnList.Add(OpSeaVgmCtn);
|
|
|
}
|
|
|
if (error != "") {
|
|
|
var jsonerror = JsonConvert.Serialize(new { Success = false, Message =error});
|
|
|
return new ContentResult() { Content = jsonerror };
|
|
|
}
|
|
|
|
|
|
Dictionary<string, string> dict = new Dictionary<string, string>();
|
|
|
dict.Add("ac","vgm");
|
|
|
dict.Add("uid", DSVGMID);
|
|
|
dict.Add("skey", DSVGMKEY);
|
|
|
dict.Add("optype", type);
|
|
|
dict.Add("mdata", JsonConvert.Serialize(opSeaVgm));
|
|
|
dict.Add("ctndata", JsonConvert.Serialize(MsOpSeaVgmCtnList.ToList()));
|
|
|
|
|
|
|
|
|
|
|
|
var DsVgmUrl = "";
|
|
|
try
|
|
|
{
|
|
|
DsVgmUrl = WebConfigurationManager.AppSettings["DsVgmUrl"].ToString();
|
|
|
}
|
|
|
catch
|
|
|
{
|
|
|
|
|
|
}
|
|
|
if (DsVgmUrl == "" || DsVgmUrl == null) DsVgmUrl = "http://myshipping.net:8654/Interface/CustVGM.ashx";
|
|
|
|
|
|
|
|
|
string rtn = WebRequestHelper.DoPost(DsVgmUrl, dict, 30 * 1000);
|
|
|
if (rtn == "操作太频繁" || rtn == "参数有误" || rtn == "参数有误!" || rtn == "身份验证错误!" || rtn == "箱号格式错误!" || rtn == "箱号重复" || rtn == "封号重复") {
|
|
|
var json = JsonConvert.Serialize(new { Success =false, Message = rtn});
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
//string rtn = WebRequestHelper.DoPost("http://47.104.73.97:8090/Interface/CustVGM.ashx", json, 30 * 1000);
|
|
|
return new ContentResult() { Content = rtn };
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
|
|
|
|
|
|
string msg = vgmDAL.writeAndSendVgmXml(mblno, userid, type, path, CARRIERID, out filepath);
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = msg, totalCount = 10, data = filepath });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public ContentResult GetVGMStatus(string mblno, string userid, string type, string bsno)
|
|
|
{
|
|
|
string path = Server.MapPath("../../VGMFile/");
|
|
|
string filepath = "";
|
|
|
|
|
|
var error = "";
|
|
|
var DSVGMID = MsSysParamSetDAL.GetData("PARAMNAME='DSVGMID'").PARAMVALUE;
|
|
|
var DSVGMKEY = MsSysParamSetDAL.GetData("PARAMNAME='DSVGMKEY'").PARAMVALUE;
|
|
|
if (DSVGMID == "")
|
|
|
{ error = error + "<br />东胜VGM用户ID不能为空"; }
|
|
|
if (DSVGMKEY == "")
|
|
|
{ error = error + "<br />东胜VGM用户秘钥不能为空"; }
|
|
|
|
|
|
Dictionary<string, string> dict = new Dictionary<string, string>();
|
|
|
dict.Add("ac", "vgm");
|
|
|
dict.Add("uid", DSVGMID);
|
|
|
dict.Add("skey", DSVGMKEY);
|
|
|
dict.Add("mblno", mblno);
|
|
|
|
|
|
var DsVgmUrl = "";
|
|
|
try
|
|
|
{
|
|
|
DsVgmUrl = WebConfigurationManager.AppSettings["DsVgmUrl"].ToString();
|
|
|
}
|
|
|
catch
|
|
|
{
|
|
|
|
|
|
}
|
|
|
if (DsVgmUrl == "" || DsVgmUrl == null) DsVgmUrl = "http://myshipping.net:8654/Interface/CustVGM.ashx";
|
|
|
|
|
|
|
|
|
string rtn = WebRequestHelper.DoPost(DsVgmUrl, dict, 30 * 1000);
|
|
|
if (rtn == "操作太频繁" || rtn == "参数有误" || rtn == "参数有误!" || rtn == "身份验证错误!" || rtn == "箱号格式错误!" || rtn == "箱号重复" || rtn == "封号重复")
|
|
|
{
|
|
|
var json = JsonConvert.Serialize(new { Success = false, Message = rtn });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
return new ContentResult() { Content = rtn };
|
|
|
|
|
|
}
|
|
|
|
|
|
public ContentResult DownloadVGM(string mblno, string userid, string type)
|
|
|
{
|
|
|
string path = Server.MapPath("../../VGMFile/");
|
|
|
string filepath = "";
|
|
|
string outMessage = "";
|
|
|
bool rst = vgmDAL.WriteFile(mblno, userid, type, path, out filepath, out outMessage);
|
|
|
var json = JsonConvert.Serialize(new { Success = rst, Message = rst ? "生成成功" : outMessage, totalCount = 10, data = filepath });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
public ContentResult PiLiangZhengPiaoTiJiao(string bsno, int statusvalue)
|
|
|
{
|
|
|
string message = "";
|
|
|
string tip = "";
|
|
|
|
|
|
var rst = MsOpSeaeDAL.PiLiangZhengPiaoTiJiao(bsno, statusvalue, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), out message);
|
|
|
if (message != "")
|
|
|
{
|
|
|
tip = "(" + message + ")";
|
|
|
}
|
|
|
if (rst)
|
|
|
{
|
|
|
|
|
|
var jsonRespose = new JsonResponse { Success = true, Message = "提交成功 " + tip };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
|
|
|
var jsonRespose = new JsonResponse { Success = false, Message = "提交失败 " + tip };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public ContentResult CheckMBLNONeedConfirmIsExist(string mblno, string bsno)
|
|
|
{
|
|
|
if (mblno == "" || mblno == null)
|
|
|
{
|
|
|
var jsonRespose = new JsonResponse { Success = false, Message = "" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
var rst = MsOpSeaeDAL.CheckMBLNONeedConfirmIsExist(mblno, bsno);
|
|
|
if (rst)
|
|
|
{
|
|
|
var jsonRespose = new JsonResponse { Success = true, Message = "" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
|
|
|
var jsonRespose = new JsonResponse { Success = false, Message = "" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public ContentResult IsShowDelButton(string mblno)
|
|
|
{
|
|
|
var OpSeaeListAllowDel = MsSysParamSetDAL.GetData("PARAMNAME='OpSeaeListAllowDel'");
|
|
|
if (OpSeaeListAllowDel.PARAMVALUE == "1")
|
|
|
{
|
|
|
var jsonRespose = new JsonResponse { Success = true, Message = "", Data = "1" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
var jsonRespose = new JsonResponse { Success = true, Message = "", Data = "0" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 青岛港单票查询
|
|
|
/// </summary>
|
|
|
/// <param name="tdhType"></param>
|
|
|
/// <param name="jckType"></param>
|
|
|
/// <param name="value"></param>
|
|
|
/// <returns></returns>
|
|
|
|
|
|
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 箱货信息类
|
|
|
/// </summary>
|
|
|
public class BoxCNT
|
|
|
{
|
|
|
/// <summary>
|
|
|
/// eq:'WIY'
|
|
|
/// </summary>
|
|
|
public string CNTR_IYC_TYPE { get; set; }
|
|
|
/// <summary>
|
|
|
/// 箱号
|
|
|
/// </summary>
|
|
|
public string CNTR_NO { get; set; }
|
|
|
/// <summary>
|
|
|
/// 历史
|
|
|
/// </summary>
|
|
|
public string CNTR_PKID { get; set; }
|
|
|
/// <summary>
|
|
|
/// 配载
|
|
|
/// </summary>
|
|
|
public string CNTR_STOWAGEFG { get; set; }
|
|
|
/// <summary>
|
|
|
/// 详细
|
|
|
/// </summary>
|
|
|
public string CNTR_TID { get; set; }
|
|
|
/// <summary>
|
|
|
/// 状态
|
|
|
/// </summary>
|
|
|
public string CNT_STATUS { get; set; }
|
|
|
/// <summary>
|
|
|
/// 运抵
|
|
|
/// </summary>
|
|
|
public string COSTCO_FG { get; set; }
|
|
|
/// <summary>
|
|
|
/// 海放
|
|
|
/// </summary>
|
|
|
public string CUSPASSFG { get; set; }
|
|
|
/// <summary>
|
|
|
/// 码放
|
|
|
/// </summary>
|
|
|
public string DOCK_PASSFG { get; set; }
|
|
|
/// <summary>
|
|
|
/// 英文船名
|
|
|
/// </summary>
|
|
|
public string FIRST_VSL_VOY { get; set; }
|
|
|
/// <summary>
|
|
|
/// 国检
|
|
|
/// </summary>
|
|
|
public string GJ_PASSFG { get; set; }
|
|
|
/// <summary>
|
|
|
/// 进场时间
|
|
|
/// </summary>
|
|
|
public string INYARD_DATE_TIME { get; set; }
|
|
|
/// <summary>
|
|
|
/// 进场方式
|
|
|
/// </summary>
|
|
|
public string INYARD_OPMODE { get; set; }
|
|
|
/// <summary>
|
|
|
/// 海事
|
|
|
/// </summary>
|
|
|
public string MSAPASSFG { get; set; }
|
|
|
/// <summary>
|
|
|
/// 出场时间
|
|
|
/// </summary>
|
|
|
public string OUTYARD_DATE_TIME { get; set; }
|
|
|
/// <summary>
|
|
|
/// 出场方式
|
|
|
/// </summary>
|
|
|
public string OUTYARD_OPMODE { get; set; }
|
|
|
/// <summary>
|
|
|
/// 中文船名
|
|
|
/// </summary>
|
|
|
public string SECOND_VSL_VOY { get; set; }
|
|
|
/// <summary>
|
|
|
/// eq:'5'
|
|
|
/// </summary>
|
|
|
public string SOURCE_VERSION { get; set; }
|
|
|
/// <summary>
|
|
|
/// 码头
|
|
|
/// </summary>
|
|
|
public string TERM { get; set; }
|
|
|
/// <summary>
|
|
|
/// eq:'100307'
|
|
|
/// </summary>
|
|
|
public string TER_SID { get; set; }
|
|
|
/// <summary>
|
|
|
/// 箱型
|
|
|
/// </summary>
|
|
|
public string VNT_TYPE { get; set; }
|
|
|
/// <summary>
|
|
|
/// eq:'5100307564001'
|
|
|
/// </summary>
|
|
|
public string VOY_EXP_PKID { get; set; }
|
|
|
/// <summary>
|
|
|
/// eq:'100307564001'
|
|
|
/// </summary>
|
|
|
public string VOY_EXP_SKEY { get; set; }
|
|
|
/// <summary>
|
|
|
/// eq:''
|
|
|
/// </summary>
|
|
|
public string VOY_IMP_PKID { get; set; }
|
|
|
/// <summary>
|
|
|
/// 外理
|
|
|
/// </summary>
|
|
|
public string WLPASSFG { get; set; }
|
|
|
}
|
|
|
}
|
|
|
|