|
|
|
|
using System;
|
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Net.Mail;
|
|
|
|
|
using System.Web.Mvc;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using DSWeb.Areas.CommMng.Models;
|
|
|
|
|
using DSWeb.EntityDA;
|
|
|
|
|
using DSWeb.MvcShipping.Models.MsSeaeOrder;
|
|
|
|
|
using HcUtility.Comm;
|
|
|
|
|
using HcUtility.Core;
|
|
|
|
|
using Microsoft.Practices.EnterpriseLibrary.Data;
|
|
|
|
|
using System.Data.SqlClient;
|
|
|
|
|
using DSWeb.MvcShipping.DAL.MsSysBillNoSet;
|
|
|
|
|
using DSWeb.TruckMng.Helper.Repository;
|
|
|
|
|
using DSWeb.MvcShipping.Models.MsOpSeae;
|
|
|
|
|
using DSWeb.MvcShipping.DAL.MsSysParamSet;
|
|
|
|
|
using CommonTool.MailKit;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using DSWeb.MvcShipping.Models.MsOpMailLog;
|
|
|
|
|
using DSWeb.Areas.SysMng.DAL.SysUser;
|
|
|
|
|
using DSWeb.Areas.Import.DAL.ReceiptDoc;
|
|
|
|
|
using MimeKit.Text;
|
|
|
|
|
|
|
|
|
|
namespace DSWeb.MvcShipping.DAL.MsSeaeOrderDAL
|
|
|
|
|
{
|
|
|
|
|
public class MsSeaeOrderDAL
|
|
|
|
|
{
|
|
|
|
|
#region 查询
|
|
|
|
|
static public List<MsSeaeOrder> GetDataList(int start, int limit, string strCondition, string userid, string usercode, string companyid,string sort = null)
|
|
|
|
|
{
|
|
|
|
|
var rangstr = GetRangDAStr("index", userid, usercode, companyid);
|
|
|
|
|
if (!string.IsNullOrEmpty(rangstr))
|
|
|
|
|
{
|
|
|
|
|
if (!string.IsNullOrEmpty(strCondition))
|
|
|
|
|
{
|
|
|
|
|
strCondition = strCondition + " and " + rangstr;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
strCondition = rangstr;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
var strSql = new StringBuilder();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
strSql.Append(@"SELECT * from (SELECT row_number() over (");
|
|
|
|
|
|
|
|
|
|
var sortstring = DatasetSort.Getsortstring(sort);
|
|
|
|
|
if (!string.IsNullOrEmpty(sortstring))
|
|
|
|
|
{
|
|
|
|
|
strSql.Append(" order by " + sortstring);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var SeaeDefaultSort = MsSysParamSetDAL.GetData("PARAMNAME='SeaeOrderDefaultSort'");
|
|
|
|
|
if (SeaeDefaultSort.PARAMVALUE != "")
|
|
|
|
|
strSql.Append(" order by " + SeaeDefaultSort.PARAMVALUE);
|
|
|
|
|
else
|
|
|
|
|
strSql.Append(" order by BSDATE desc");
|
|
|
|
|
}
|
|
|
|
|
strSql.Append(@") as num , ");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
strSql.Append("ORDNO,BSNO,ORSTATUS,ORREASON,BSDATE,CUSTOMERNAME,ORDTYPE,SHIPPERID,CONSIGNEEID,NOTIFYPARTYID,YARD");
|
|
|
|
|
strSql.Append(",SHIPPER,CONSIGNEE,NOTIFYPARTY,VESSEL,VOYNO,ETD,PlACERECEIPT,PlACERECEIPTID,PORTLOADID,PORTLOAD,PORTDISCHARGEID,PORTDISCHARGE");
|
|
|
|
|
strSql.Append(",PLACEDELIVERYID,PLACEDELIVERY,DESTINATIONID,DESTINATION,NOBILL,ISSUETYPE,ISSUEDATE,ISSUEPLACE,ISSUEPLACEID,BLFRT");
|
|
|
|
|
strSql.Append(",PREPARDAT,PAYABLEAT,[SERVICE],MARKS,NOPKGS,[DESCRIPTION],GOODSNAME,GROSSWEIGHT,MEASUREMENT,PKGS,KINDPKGS");
|
|
|
|
|
strSql.Append(",KGS,CBM,TOTALNO,CNTRTOTAL,INPUTBY,INVNO,CARGOID,HSCODE,DCLASS,DUNNO,REEFERF,TEMPID,TEMPSET,TEMPMAX,TEMPMIN");
|
|
|
|
|
strSql.Append(",CUSTOMSNUM,REMARK,STATUS1,STATUS2,STATUS3,STATUS4,STATUS5,ISFUMIGATION,ISSTORAGE,ISLAND,ISCUSTOMS,ISINSPECTION");
|
|
|
|
|
strSql.Append(",ISBOOKING,ISAGENT,ISHBLNO,SERVICE9,SERVICE10,STLNAME,STLDATE,OCEANFEE,ISUSD,ISCOMMISSIONBACK,CARRIER,CARRIERATTN");
|
|
|
|
|
strSql.Append(",CARRIERTEL,CARRIEREMAIL,FORWARDER,FORWARDERATTN,FORWARDERTEL,FORWARDEREMAIL,SALE,PACKINGTYPE,BLTYPE,OP,FRCUSTSERVICE");
|
|
|
|
|
strSql.Append(",CUSTSERVICE,doc,AUDITOPERATOR,AUDITDATE,DPAGE,DLABEL,LINKMAN,BILLNUM,AGENTID,AGENT,TRANSPORT");
|
|
|
|
|
strSql.Append(",(CASE ORSTATUS WHEN '8' THEN '确认订舱' WHEN '0' THEN '审核通过' WHEN '1' THEN '提交审核' WHEN '2' THEN '驳回' WHEN '4' THEN '退舱' else '录入状态' end) as ORSTATUSREF ");
|
|
|
|
|
strSql.Append(",(SELECT CUSTNO FROM V_OP_BILL V WHERE V.BSNO=B.BSNO) as CUSTNO ");
|
|
|
|
|
strSql.Append(",(SELECT MBLNO FROM V_OP_BILL V WHERE V.BSNO=B.BSNO) as MBLNOREF,MBLNO,SALEDEPT,BSSOURCE,BSSOURCEDETAIL,(select top 1 sale from info_client where SHORTNAME=B.CUSTOMERNAME) DEFSALE ");
|
|
|
|
|
strSql.Append(",dbo.F_GetBillCrmFeeStatus(B.BSNO,1) DRFEESTATUS");
|
|
|
|
|
strSql.Append(",dbo.F_GetBillCrmFeeStatus(B.BSNO,2) CRFEESTATUS");
|
|
|
|
|
strSql.Append(",'' SenderMobile,'' SenderEmail,CONTRACTNO,'' AMSSHIPPER,'' AMSCONSIGNEE,'' AMSNOTIFYPARTY,CONFIRMOP,CONFIRMDATE,OPERATOR,OPERATORTEL,FBP,DESTFBP,MAXWEIGHT,PLANPROFIT,OPERATOREMAIL,LANE,SERVICECONTRACTNO ");
|
|
|
|
|
strSql.Append(",SALECORPID,(select [NAME] from [company] where GID=B.SALECORPID) as SALECORP ");
|
|
|
|
|
strSql.Append(" from crm_seaeorder B");
|
|
|
|
|
if (!string.IsNullOrEmpty(strCondition))
|
|
|
|
|
{
|
|
|
|
|
strSql.Append(" where " + strCondition);
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
strSql.Append(@")as t ");
|
|
|
|
|
strSql.Append(string.Format("where t.num>{0} and t.num<={1} order by t.num ", start, start + limit)); //
|
|
|
|
|
|
|
|
|
|
var isNoForward = MsBaseInfoDAL.MsBaseInfoDAL.GetUserModuleEnable("modMsNoForward", userid);
|
|
|
|
|
return SetData(strSql,"",isNoForward);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static int getTotalCount(string strCondition, string userid, string usercode, string companyid)
|
|
|
|
|
{
|
|
|
|
|
var rangstr = GetRangDAStr("index", userid, usercode, companyid);
|
|
|
|
|
if (!string.IsNullOrEmpty(rangstr))
|
|
|
|
|
{
|
|
|
|
|
if (!string.IsNullOrEmpty(strCondition))
|
|
|
|
|
{
|
|
|
|
|
strCondition = strCondition + " and " + rangstr;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
strCondition = rangstr;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
StringBuilder strSql = new StringBuilder();
|
|
|
|
|
strSql.Append("select count(*) ");
|
|
|
|
|
strSql.Append(" from crm_seaeorder B ");
|
|
|
|
|
if (!string.IsNullOrEmpty(strCondition))
|
|
|
|
|
{
|
|
|
|
|
strSql.Append(" where " + strCondition);
|
|
|
|
|
}
|
|
|
|
|
int cnt = 0;
|
|
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
|
|
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
|
|
|
|
|
{
|
|
|
|
|
while (reader.Read())
|
|
|
|
|
{
|
|
|
|
|
cnt = Convert.ToInt32(reader[0]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return cnt;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static public DBResult GetDataListStr(string strCondition, string userid, string usercode, string companyid, string sort = null)
|
|
|
|
|
{
|
|
|
|
|
var result = new DBResult();
|
|
|
|
|
var rangstr = GetRangDAStr("index", userid, usercode, companyid);
|
|
|
|
|
if (!string.IsNullOrEmpty(rangstr))
|
|
|
|
|
{
|
|
|
|
|
if (!string.IsNullOrEmpty(strCondition))
|
|
|
|
|
{
|
|
|
|
|
strCondition = strCondition + " and " + rangstr;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
strCondition = rangstr;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
var strSql = new StringBuilder();
|
|
|
|
|
strSql.Append("SELECT ORDNO,BSNO,ORSTATUS,ORREASON,BSDATE,CUSTOMERNAME,ORDTYPE,SHIPPERID,CONSIGNEEID,NOTIFYPARTYID,YARD");
|
|
|
|
|
strSql.Append(",SHIPPER,CONSIGNEE,NOTIFYPARTY,VESSEL,VOYNO,ETD,PlACERECEIPT,PlACERECEIPTID,PORTLOADID,PORTLOAD,PORTDISCHARGEID,PORTDISCHARGE");
|
|
|
|
|
strSql.Append(",PLACEDELIVERYID,PLACEDELIVERY,DESTINATIONID,DESTINATION,NOBILL,ISSUETYPE,ISSUEDATE,ISSUEPLACE,ISSUEPLACEID,BLFRT");
|
|
|
|
|
strSql.Append(",PREPARDAT,PAYABLEAT,[SERVICE],MARKS,NOPKGS,[DESCRIPTION],GOODSNAME,GROSSWEIGHT,MEASUREMENT,PKGS,KINDPKGS");
|
|
|
|
|
strSql.Append(",KGS,CBM,TOTALNO,CNTRTOTAL,INPUTBY,INVNO,CARGOID,HSCODE,DCLASS,DUNNO,REEFERF,TEMPID,TEMPSET,TEMPMAX,TEMPMIN");
|
|
|
|
|
strSql.Append(",CUSTOMSNUM,REMARK,STATUS1,STATUS2,STATUS3,STATUS4,STATUS5,ISFUMIGATION,ISSTORAGE,ISLAND,ISCUSTOMS,ISINSPECTION");
|
|
|
|
|
strSql.Append(",ISBOOKING,ISAGENT,ISHBLNO,SERVICE9,SERVICE10,STLNAME,STLDATE,OCEANFEE,ISUSD,ISCOMMISSIONBACK,CARRIER,CARRIERATTN");
|
|
|
|
|
strSql.Append(",CARRIERTEL,CARRIEREMAIL,FORWARDER,FORWARDERATTN,FORWARDERTEL,FORWARDEREMAIL,SALE,PACKINGTYPE,BLTYPE,OP,FRCUSTSERVICE");
|
|
|
|
|
strSql.Append(",CUSTSERVICE,doc,AUDITOPERATOR,AUDITDATE,DPAGE,DLABEL,LINKMAN,BILLNUM,AGENTID,AGENT,TRANSPORT");
|
|
|
|
|
strSql.Append(",(CASE ORSTATUS WHEN '8' THEN '确认订舱' WHEN '0' THEN '审核通过' WHEN '1' THEN '提交审核' WHEN '2' THEN '驳回' WHEN '4' THEN '退舱' else '录入状态' end) as ORSTATUSREF ");
|
|
|
|
|
strSql.Append(",(SELECT CUSTNO FROM V_OP_BILL V WHERE V.BSNO=B.BSNO) as CUSTNO ");
|
|
|
|
|
strSql.Append(",(SELECT MBLNO FROM V_OP_BILL V WHERE V.BSNO=B.BSNO) as MBLNOREF,MBLNO,SALEDEPT,BSSOURCE,BSSOURCEDETAIL,(select top 1 sale from info_client where SHORTNAME=B.CUSTOMERNAME) DEFSALE ");
|
|
|
|
|
strSql.Append(",dbo.F_GetBillCrmFeeStatus(B.BSNO,1) DRFEESTATUS");
|
|
|
|
|
strSql.Append(",dbo.F_GetBillCrmFeeStatus(B.BSNO,2) CRFEESTATUS");
|
|
|
|
|
strSql.Append(",'' SenderMobile,'' SenderEmail,CONTRACTNO,'' AMSSHIPPER,'' AMSCONSIGNEE,'' AMSNOTIFYPARTY,CONFIRMOP,CONFIRMDATE,OPERATOR,OPERATORTEL,FBP,DESTFBP,MAXWEIGHT,PLANPROFIT,OPERATOREMAIL,LANE,SERVICECONTRACTNO ");
|
|
|
|
|
strSql.Append(",SALECORPID,(select [NAME] from [company] where GID=B.SALECORPID) as SALECORP ");
|
|
|
|
|
strSql.Append(" from crm_seaeorder B");
|
|
|
|
|
if (!string.IsNullOrEmpty(strCondition))
|
|
|
|
|
{
|
|
|
|
|
strSql.Append(" where " + strCondition);
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
var sortstring = DatasetSort.Getsortstring(sort);
|
|
|
|
|
if (!string.IsNullOrEmpty(sortstring))
|
|
|
|
|
{
|
|
|
|
|
strSql.Append(" order by " + sortstring);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
strSql.Append(" order by BSDATE desc");
|
|
|
|
|
}
|
|
|
|
|
result.Data = strSql.ToString();
|
|
|
|
|
result.Message = strCondition;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static public MsSeaeOrder GetData(string condition,string userid)
|
|
|
|
|
{
|
|
|
|
|
var strSql = new StringBuilder();
|
|
|
|
|
strSql.Append("SELECT ORDNO,BSNO,ORSTATUS,ORREASON,BSDATE,CUSTOMERNAME,ORDTYPE,SHIPPERID,CONSIGNEEID,NOTIFYPARTYID,YARD");
|
|
|
|
|
strSql.Append(",SHIPPER,CONSIGNEE,NOTIFYPARTY,VESSEL,VOYNO,ETD,PlACERECEIPT,PlACERECEIPTID,PORTLOADID,PORTLOAD,PORTDISCHARGEID,PORTDISCHARGE");
|
|
|
|
|
strSql.Append(",PLACEDELIVERYID,PLACEDELIVERY,DESTINATIONID,DESTINATION,NOBILL,ISSUETYPE,ISSUEDATE,ISSUEPLACE,ISSUEPLACEID,BLFRT");
|
|
|
|
|
strSql.Append(",PREPARDAT,PAYABLEAT,[SERVICE],MARKS,NOPKGS,[DESCRIPTION],GOODSNAME,GROSSWEIGHT,MEASUREMENT,PKGS,KINDPKGS");
|
|
|
|
|
strSql.Append(",KGS,CBM,TOTALNO,CNTRTOTAL,INPUTBY,INVNO,CARGOID,HSCODE,DCLASS,DUNNO,REEFERF,TEMPID,TEMPSET,TEMPMAX,TEMPMIN");
|
|
|
|
|
strSql.Append(",CUSTOMSNUM,REMARK,STATUS1,STATUS2,STATUS3,STATUS4,STATUS5,ISFUMIGATION,ISSTORAGE,ISLAND,ISCUSTOMS,ISINSPECTION");
|
|
|
|
|
strSql.Append(",ISBOOKING,ISAGENT,ISHBLNO,SERVICE9,SERVICE10,STLNAME,STLDATE,OCEANFEE,ISUSD,ISCOMMISSIONBACK,CARRIER,CARRIERATTN");
|
|
|
|
|
strSql.Append(",CARRIERTEL,CARRIEREMAIL,FORWARDER,FORWARDERATTN,FORWARDERTEL,FORWARDEREMAIL,SALE,PACKINGTYPE,BLTYPE,OP,FRCUSTSERVICE");
|
|
|
|
|
strSql.Append(",CUSTSERVICE,doc,AUDITOPERATOR,AUDITDATE,DPAGE,DLABEL,LINKMAN,BILLNUM,AGENTID,AGENT,TRANSPORT");
|
|
|
|
|
strSql.Append(",(CASE ORSTATUS WHEN '8' THEN '确认订舱' WHEN '0' THEN '审核通过' WHEN '1' THEN '提交审核' WHEN '2' THEN '驳回' WHEN '4' THEN '退舱' else '录入状态' end) as ORSTATUSREF ");
|
|
|
|
|
strSql.Append(",(SELECT CUSTNO FROM V_OP_BILL V WHERE V.BSNO=B.BSNO) as CUSTNO ");
|
|
|
|
|
strSql.Append(",(SELECT MBLNO FROM V_OP_BILL V WHERE V.BSNO=B.BSNO) as MBLNOREF,MBLNO,SALEDEPT,BSSOURCE,BSSOURCEDETAIL,(select top 1 sale from info_client where SHORTNAME=B.CUSTOMERNAME) DEFSALE ");
|
|
|
|
|
strSql.Append(",dbo.F_GetBillCrmFeeStatus(B.BSNO,1) DRFEESTATUS");
|
|
|
|
|
strSql.Append(",dbo.F_GetBillCrmFeeStatus(B.BSNO,2) CRFEESTATUS");
|
|
|
|
|
strSql.Append(",'' SenderMobile,'' SenderEmail,CONTRACTNO,'' AMSSHIPPER,'' AMSCONSIGNEE,'' AMSNOTIFYPARTY,CONFIRMOP,CONFIRMDATE,OPERATOR,OPERATORTEL,FBP,DESTFBP,MAXWEIGHT,PLANPROFIT,OPERATOREMAIL,LANE,SERVICECONTRACTNO ");
|
|
|
|
|
strSql.Append(",SALECORPID,(select [NAME] from [company] where GID=B.SALECORPID) as SALECORP ");
|
|
|
|
|
|
|
|
|
|
strSql.Append(" from crm_seaeorder B");
|
|
|
|
|
if (!string.IsNullOrEmpty(condition))
|
|
|
|
|
{
|
|
|
|
|
strSql.Append(" where " + condition);
|
|
|
|
|
}
|
|
|
|
|
var isNoForward = MsBaseInfoDAL.MsBaseInfoDAL.GetUserModuleEnable("modMsNoForward", userid);
|
|
|
|
|
|
|
|
|
|
var list =SetData(strSql,"", isNoForward);
|
|
|
|
|
if (list.Count > 0)
|
|
|
|
|
return list[0];
|
|
|
|
|
return new MsSeaeOrder();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static List<MsSeaeOrder> SetData(StringBuilder strSql,string dbstr="",bool isNoForward=false)
|
|
|
|
|
{
|
|
|
|
|
var headList = new List<MsSeaeOrder>();
|
|
|
|
|
Database db=null;
|
|
|
|
|
if (dbstr!="")
|
|
|
|
|
db = DatabaseFactory.CreateDatabase(dbstr);
|
|
|
|
|
else
|
|
|
|
|
db = DatabaseFactory.CreateDatabase();
|
|
|
|
|
|
|
|
|
|
SqlCommand cmd = new SqlCommand();
|
|
|
|
|
cmd.CommandText = strSql.ToString();
|
|
|
|
|
cmd.CommandTimeout = 120000; //要加这一句
|
|
|
|
|
|
|
|
|
|
using (IDataReader reader = db.ExecuteReader(cmd))
|
|
|
|
|
{
|
|
|
|
|
while (reader.Read())
|
|
|
|
|
{
|
|
|
|
|
MsSeaeOrder data = new MsSeaeOrder();
|
|
|
|
|
#region Set DB data to Object
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
data.LANE = reader["LANE"] == null ? "" : Convert.ToString(reader["LANE"]);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception)
|
|
|
|
|
{
|
|
|
|
|
data.LANE = "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
data.ORDNO = Convert.ToString(reader["ORDNO"]);//委托
|
|
|
|
|
data.BSNO = Convert.ToString(reader["BSNO"]);//业务编号
|
|
|
|
|
//字段过滤器(判断是否存在该列)
|
|
|
|
|
reader.GetSchemaTable().DefaultView.RowFilter = "ColumnName= 'SERVICECONTRACTNO'";
|
|
|
|
|
if (reader.GetSchemaTable().DefaultView.Count > 0)
|
|
|
|
|
data.SERVICECONTRACTNO = Convert.ToString(reader["SERVICECONTRACTNO"]);
|
|
|
|
|
|
|
|
|
|
data.BLTYPE = Convert.ToString(reader["BLTYPE"]);//装运方式
|
|
|
|
|
data.ORSTATUS = Convert.ToString(reader["ORSTATUS"]);//主编号
|
|
|
|
|
data.ORSTATUSREF = Convert.ToString(reader["ORSTATUSREF"]);//委托编号
|
|
|
|
|
data.ORREASON = Convert.ToString(reader["ORREASON"]);//分提单号
|
|
|
|
|
data.BSDATE = Convert.ToDateTime(reader["BSDATE"]);//接单日期
|
|
|
|
|
data.MBLNO = Convert.ToString(reader["MBLNO"]);//主提单号
|
|
|
|
|
if (data.MBLNO=="") data.MBLNO = Convert.ToString(reader["MBLNOREF"]);//主提单号
|
|
|
|
|
data.CUSTNO = Convert.ToString(reader["CUSTNO"]);//主提单号
|
|
|
|
|
data.CUSTOMERNAME = Convert.ToString(reader["CUSTOMERNAME"]);//委托单位
|
|
|
|
|
data.ORDTYPE = Convert.ToString(reader["ORDTYPE"]);//业务状态
|
|
|
|
|
data.SHIPPERID = Convert.ToString(reader["SHIPPERID"]);//发货人
|
|
|
|
|
data.CONSIGNEEID = Convert.ToString(reader["CONSIGNEEID"]);//收货人
|
|
|
|
|
data.NOTIFYPARTYID = Convert.ToString(reader["NOTIFYPARTYID"]);//通知人
|
|
|
|
|
data.SHIPPER = Convert.ToString(reader["SHIPPER"]).Replace(@"\\\\", "\n").Replace(@"^", "\'").Replace(@"&-add-", "+"); //发货人内容
|
|
|
|
|
data.CONSIGNEE = Convert.ToString(reader["CONSIGNEE"]).Replace(@"\\\\", "\n").Replace(@"^", "\'").Replace(@"&-add-", "+");//收货人内容
|
|
|
|
|
data.NOTIFYPARTY = Convert.ToString(reader["NOTIFYPARTY"]).Replace(@"\\\\", "\n").Replace(@"^", "\'").Replace(@"&-add-", "+");//通知人内容
|
|
|
|
|
data.VESSEL = Convert.ToString(reader["VESSEL"]);//船名
|
|
|
|
|
data.VOYNO = Convert.ToString(reader["VOYNO"]);//航次
|
|
|
|
|
if (reader["ETD"] != DBNull.Value)
|
|
|
|
|
data.ETD = Convert.ToDateTime(reader["ETD"]).ToString("yyyy-MM-dd");//到港日期
|
|
|
|
|
data.PORTLOADID = Convert.ToString(reader["PORTLOADID"]);//装货港代码
|
|
|
|
|
data.PORTLOAD = Convert.ToString(reader["PORTLOAD"]);//装货港
|
|
|
|
|
data.TRANSPORT = Convert.ToString(reader["TRANSPORT"]);//装货港
|
|
|
|
|
data.PORTDISCHARGEID = Convert.ToString(reader["PORTDISCHARGEID"]);//卸货港代码
|
|
|
|
|
data.PORTDISCHARGE = Convert.ToString(reader["PORTDISCHARGE"]).Replace(@"^", "\'");//卸货港
|
|
|
|
|
data.PLACERECEIPT = Convert.ToString(reader["PlACERECEIPT"]).Replace(@"^", "\'");//收货地
|
|
|
|
|
data.PLACERECEIPTID = Convert.ToString(reader["PlACERECEIPTID"]).Replace(@"^", "\'");//收货地
|
|
|
|
|
data.PLACEDELIVERYID = Convert.ToString(reader["PLACEDELIVERYID"]);//交货地代码
|
|
|
|
|
data.PLACEDELIVERY = Convert.ToString(reader["PLACEDELIVERY"]).Replace(@"^", "\'");//交货地
|
|
|
|
|
data.DESTINATIONID = Convert.ToString(reader["DESTINATIONID"]);//目的地代码
|
|
|
|
|
data.DESTINATION = Convert.ToString(reader["DESTINATION"]).Replace(@"^", "\'");//目的地
|
|
|
|
|
data.NOBILL = Convert.ToString(reader["NOBILL"]);//提单份数
|
|
|
|
|
data.ISSUETYPE = Convert.ToString(reader["ISSUETYPE"]);//签单方式
|
|
|
|
|
if (reader["ISSUEDATE"] != DBNull.Value)
|
|
|
|
|
data.ISSUEDATE = Convert.ToDateTime(reader["ISSUEDATE"]).ToString("yyyy-MM-dd");//预抵日期
|
|
|
|
|
data.ISSUEPLACE = Convert.ToString(reader["ISSUEPLACE"]);//签单地点
|
|
|
|
|
data.ISSUEPLACEID = Convert.ToString(reader["ISSUEPLACEID"]);//签单地点
|
|
|
|
|
data.BLFRT = Convert.ToString(reader["BLFRT"]);//付费方式
|
|
|
|
|
data.PREPARDAT = Convert.ToString(reader["PREPARDAT"]);//预付地点
|
|
|
|
|
data.PAYABLEAT = Convert.ToString(reader["PAYABLEAT"]);//到付地点
|
|
|
|
|
data.SERVICE = Convert.ToString(reader["SERVICE"]);//运输条款
|
|
|
|
|
data.MARKS = Convert.ToString(reader["MARKS"]).Replace(@"\\\\", "\n").Replace(@"^", "\'").Replace(@"&-add-", "+"); //唛头
|
|
|
|
|
//data.NOPKGS = Convert.ToString(reader["NOPKGS"]).Replace(@"\\\\", "\n").Replace(@"^", "\'");//件数包装
|
|
|
|
|
string _pkgs = Convert.ToString(reader["PKGS"].ToString());
|
|
|
|
|
/*for (int iCount = 0; iCount < 5; iCount++)
|
|
|
|
|
{
|
|
|
|
|
int _lengthPkgs = _pkgs.Length;
|
|
|
|
|
char _tempPkgs = _pkgs[_lengthPkgs - 1];
|
|
|
|
|
if (_tempPkgs == '0') { _pkgs = _pkgs.Substring(0, _lengthPkgs - 1); }
|
|
|
|
|
else { break; }
|
|
|
|
|
}
|
|
|
|
|
if (_pkgs[_pkgs.Length - 1] == '.') { _pkgs = _pkgs.Substring(0, _pkgs.Length - 1); }*/
|
|
|
|
|
data.NOPKGS = Convert.ToString(_pkgs + reader["KINDPKGS"].ToString());//件数包装
|
|
|
|
|
data.DESCRIPTION = Convert.ToString(reader["DESCRIPTION"]).Replace(@"\\\\", "\n").Replace(@"^", "\'").Replace(@"&-add-", "+"); //货物描述
|
|
|
|
|
data.GOODSNAME = Convert.ToString(reader["GOODSNAME"]);//品名
|
|
|
|
|
//data.GROSSWEIGHT = Convert.ToString(reader["GROSSWEIGHT"]).Replace(@"\\\\", "\n").Replace(@"^", "\'"); //货物毛重
|
|
|
|
|
string _kgs = Convert.ToString(reader["KGS"]);
|
|
|
|
|
for (int iCount = 0; iCount < 5; iCount++)
|
|
|
|
|
{
|
|
|
|
|
int _lengthKgs = _kgs.Length;
|
|
|
|
|
char _tempKgs = _kgs[_lengthKgs - 1];
|
|
|
|
|
if (_tempKgs == '0') { _kgs = _kgs.Substring(0, _lengthKgs - 1); }
|
|
|
|
|
else { break; }
|
|
|
|
|
}
|
|
|
|
|
if (_kgs[_kgs.Length - 1] == '.') { _kgs = _kgs.Substring(0, _kgs.Length - 1); }
|
|
|
|
|
data.GROSSWEIGHT = _kgs + "KGS"; //货物毛重
|
|
|
|
|
//data.MEASUREMENT = Convert.ToString(reader["MEASUREMENT"]).Replace(@"\\\\", "\n").Replace(@"^", "\'"); //货物尺码
|
|
|
|
|
string _cbm = Convert.ToString(reader["CBM"]);
|
|
|
|
|
for (int iCount = 0; iCount < 5; iCount++)
|
|
|
|
|
{
|
|
|
|
|
int _lengthCbm = _cbm.Length;
|
|
|
|
|
char _tempCbm = _cbm[_lengthCbm - 1];
|
|
|
|
|
if (_tempCbm == '0') { _cbm = _cbm.Substring(0, _lengthCbm - 1); }
|
|
|
|
|
else { break; }
|
|
|
|
|
}
|
|
|
|
|
if (_cbm[_cbm.Length - 1] == '.') { _cbm = _cbm.Substring(0, _cbm.Length - 1); }
|
|
|
|
|
data.MEASUREMENT = _cbm + "CBM"; //货物尺码
|
|
|
|
|
data.PKGS = Convert.ToString(_pkgs);//件数
|
|
|
|
|
data.KINDPKGS = Convert.ToString(reader["KINDPKGS"]);//件数包装
|
|
|
|
|
data.KGS = Convert.ToString(_kgs);//毛重
|
|
|
|
|
data.CBM = Convert.ToString(_cbm);//立方数/尺码
|
|
|
|
|
data.TOTALNO = Convert.ToString(reader["TOTALNO"]);//件数大写
|
|
|
|
|
data.CNTRTOTAL = Convert.ToString(reader["CNTRTOTAL"]);//集装箱全部内容
|
|
|
|
|
data.INPUTBY = Convert.ToString(reader["INPUTBY"]);//录入人
|
|
|
|
|
data.OPERATORTEL = Convert.ToString(reader["SenderMobile"]);//录入人
|
|
|
|
|
data.OPERATOREMAIL = Convert.ToString(reader["SenderEmail"]);//录入人
|
|
|
|
|
data.INVNO = Convert.ToString(reader["INVNO"]);//发票号
|
|
|
|
|
data.CARGOID = Convert.ToString(reader["CARGOID"]);//货物标识
|
|
|
|
|
data.HSCODE = Convert.ToString(reader["HSCODE"]);
|
|
|
|
|
data.DCLASS = Convert.ToString(reader["DCLASS"]);//危险品分类/等级
|
|
|
|
|
data.DUNNO = Convert.ToString(reader["DUNNO"]);//危险品编号
|
|
|
|
|
data.DPAGE = Convert.ToString(reader["DPAGE"]);//危险品页号
|
|
|
|
|
data.DLABEL = Convert.ToString(reader["DLABEL"]);//危险品标签
|
|
|
|
|
data.LINKMAN = Convert.ToString(reader["LINKMAN"]);//危险品联系人
|
|
|
|
|
data.REEFERF = Convert.ToString(reader["REEFERF"]);//冷藏通风量
|
|
|
|
|
if (Convert.ToString(reader["TEMPID"]) != "undefined")
|
|
|
|
|
data.TEMPID = Convert.ToString(reader["TEMPID"]);//温度单位
|
|
|
|
|
data.TEMPSET = Convert.ToString(reader["TEMPSET"]);//设置温度
|
|
|
|
|
data.TEMPMAX = Convert.ToString(reader["TEMPMAX"]);//最高温度
|
|
|
|
|
data.TEMPMIN = Convert.ToString(reader["TEMPMIN"]);//最低温度
|
|
|
|
|
data.CUSTOMSNUM = Convert.ToInt32(reader["CUSTOMSNUM"]);//报关票数
|
|
|
|
|
data.REMARK = Convert.ToString(reader["REMARK"]).Replace(@"\\\\", "\n").Replace(@"^", "\'").Replace(@"&-add-", "+");//备注
|
|
|
|
|
if (reader["STATUS1"] != DBNull.Value)
|
|
|
|
|
data.STATUS1 = Convert.ToBoolean(reader["STATUS1"]);//状态1
|
|
|
|
|
if (reader["STATUS2"] != DBNull.Value)
|
|
|
|
|
data.STATUS2 = Convert.ToBoolean(reader["STATUS2"]);//状态2
|
|
|
|
|
if (reader["STATUS3"] != DBNull.Value)
|
|
|
|
|
data.STATUS3 = Convert.ToBoolean(reader["STATUS3"]);//状态3
|
|
|
|
|
if (reader["STATUS4"] != DBNull.Value)
|
|
|
|
|
data.STATUS4 = Convert.ToBoolean(reader["STATUS4"]);//状态4
|
|
|
|
|
if (reader["STATUS5"] != DBNull.Value)
|
|
|
|
|
data.STATUS5 = Convert.ToBoolean(reader["STATUS5"]);//状态5
|
|
|
|
|
if (reader["ISFUMIGATION"] != DBNull.Value)
|
|
|
|
|
data.ISFUMIGATION = Convert.ToBoolean(reader["ISFUMIGATION"]);//熏蒸
|
|
|
|
|
if (reader["ISSTORAGE"] != DBNull.Value)
|
|
|
|
|
data.ISSTORAGE = Convert.ToBoolean(reader["ISSTORAGE"]);//仓储
|
|
|
|
|
if (reader["ISLAND"] != DBNull.Value)
|
|
|
|
|
data.ISLAND = Convert.ToBoolean(reader["ISLAND"]);//陆运
|
|
|
|
|
if (reader["ISCUSTOMS"] != DBNull.Value)
|
|
|
|
|
data.ISCUSTOMS = Convert.ToBoolean(reader["ISCUSTOMS"]);//报关
|
|
|
|
|
if (reader["ISINSPECTION"] != DBNull.Value)
|
|
|
|
|
data.ISINSPECTION = Convert.ToBoolean(reader["ISINSPECTION"]);//报检
|
|
|
|
|
if (reader["ISBOOKING"] != DBNull.Value)
|
|
|
|
|
data.ISBOOKING = Convert.ToBoolean(reader["ISBOOKING"]);//订舱
|
|
|
|
|
if (reader["ISAGENT"] != DBNull.Value)
|
|
|
|
|
data.ISAGENT = Convert.ToBoolean(reader["ISAGENT"]);//使用代理
|
|
|
|
|
if (reader["ISHBLNO"] != DBNull.Value)
|
|
|
|
|
data.ISHBLNO = Convert.ToBoolean(reader["ISHBLNO"]);//分单签单
|
|
|
|
|
if (reader["SERVICE9"] != DBNull.Value)
|
|
|
|
|
data.SERVICE9 = Convert.ToBoolean(reader["SERVICE9"]);//服务项目9
|
|
|
|
|
if (reader["SERVICE10"] != DBNull.Value)
|
|
|
|
|
data.SERVICE10 = Convert.ToBoolean(reader["SERVICE10"]);//服务项目10
|
|
|
|
|
data.STLNAME = Convert.ToString(reader["STLNAME"]);//结算方式
|
|
|
|
|
if (reader["STLDATE"] != DBNull.Value)
|
|
|
|
|
data.STLDATE = Convert.ToDateTime(reader["STLDATE"]).ToString("yyyy-MM-dd");//结算时间
|
|
|
|
|
if (reader["OCEANFEE"] != DBNull.Value)
|
|
|
|
|
data.OCEANFEE = Convert.ToDecimal(reader["OCEANFEE"]);//
|
|
|
|
|
if (reader["ISUSD"] != DBNull.Value)
|
|
|
|
|
data.ISUSD = Convert.ToBoolean(reader["ISUSD"]);//
|
|
|
|
|
if (reader["ISCOMMISSIONBACK"] != DBNull.Value)
|
|
|
|
|
data.ISCOMMISSIONBACK = Convert.ToBoolean(reader["ISCOMMISSIONBACK"]);//
|
|
|
|
|
data.CARRIER = Convert.ToString(reader["CARRIER"]);//船公司
|
|
|
|
|
data.CARRIERATTN = Convert.ToString(reader["CARRIERATTN"]);//船公司
|
|
|
|
|
data.CARRIERTEL = Convert.ToString(reader["CARRIERTEL"]);//船公司
|
|
|
|
|
data.CARRIEREMAIL = Convert.ToString(reader["CARRIEREMAIL"]);//船公司
|
|
|
|
|
if (isNoForward)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
data.FORWARDER = Convert.ToString(reader["FORWARDER"]);//订舱公司
|
|
|
|
|
data.FORWARDERATTN = Convert.ToString(reader["FORWARDERATTN"]);//订舱公司
|
|
|
|
|
data.FORWARDERTEL = Convert.ToString(reader["FORWARDERTEL"]);//订舱公司
|
|
|
|
|
data.FORWARDEREMAIL = Convert.ToString(reader["FORWARDEREMAIL"]);//订舱公司
|
|
|
|
|
}
|
|
|
|
|
data.SALE = Convert.ToString(reader["SALE"]);//揽货人
|
|
|
|
|
data.SALEDEPT = Convert.ToString(reader["SALEDEPT"]);//部门
|
|
|
|
|
data.DEFSALE = Convert.ToString(reader["DEFSALE"]);//揽货人
|
|
|
|
|
data.PACKINGTYPE = Convert.ToString(reader["PACKINGTYPE"]);//装箱类型
|
|
|
|
|
data.BLTYPE = Convert.ToString(reader["BLTYPE"]);//装运方式
|
|
|
|
|
data.OP = Convert.ToString(reader["OP"]);//操作员
|
|
|
|
|
data.CUSTSERVICE = Convert.ToString(reader["CUSTSERVICE"]);//客服员
|
|
|
|
|
data.FRCUSTSERVICE = Convert.ToString(reader["FRCUSTSERVICE"]);//客服员
|
|
|
|
|
data.DOC = Convert.ToString(reader["DOC"]);//单证
|
|
|
|
|
data.AUDITOPERATOR = Convert.ToString(reader["AUDITOPERATOR"]);//审核人
|
|
|
|
|
if (reader["AUDITDATE"] != DBNull.Value)
|
|
|
|
|
data.AUDITDATE = Convert.ToDateTime(reader["AUDITDATE"]).ToString("yyyy-MM-dd HH:mm:ss");//截港日期
|
|
|
|
|
if (reader["CONFIRMDATE"] != DBNull.Value)
|
|
|
|
|
data.CONFIRMDATE = Convert.ToDateTime(reader["CONFIRMDATE"]).ToString("yyyy-MM-dd HH:mm:ss");//截港日期
|
|
|
|
|
|
|
|
|
|
data.CONFIRMOP = Convert.ToString(reader["CONFIRMOP"]);//确认人
|
|
|
|
|
|
|
|
|
|
data.OPERATORTEL = Convert.ToString(reader["SenderMobile"]);//
|
|
|
|
|
data.OPERATOREMAIL = Convert.ToString(reader["SenderEmail"]);//
|
|
|
|
|
if (data.OPERATORTEL!="")
|
|
|
|
|
data.OPERATORTEL = Convert.ToString(reader["OPERATORTEL"]);//
|
|
|
|
|
if (data.OPERATOREMAIL != "")
|
|
|
|
|
data.OPERATOREMAIL = Convert.ToString(reader["OPERATOREMAIL"]);//
|
|
|
|
|
data.OPERATOR = Convert.ToString(reader["OPERATOR"]);//
|
|
|
|
|
data.FBP = Convert.ToString(reader["FBP"]);//
|
|
|
|
|
data.DESTFBP = Convert.ToString(reader["DESTFBP"]);//
|
|
|
|
|
data.MAXWEIGHT = Convert.ToString(reader["MAXWEIGHT"]);//
|
|
|
|
|
data.PLANPROFIT = Convert.ToString(reader["PLANPROFIT"]);//
|
|
|
|
|
data.CONTRACTNO = Convert.ToString(reader["CONTRACTNO"]);
|
|
|
|
|
data.AMSShipper = Convert.ToString(reader["AMSSHIPPER"]).Replace(@"\\\\", "\n").Replace(@"^", "\'").Replace(@"&-add-", "+");
|
|
|
|
|
data.AMSConsignee = Convert.ToString(reader["AMSCONSIGNEE"]).Replace(@"\\\\", "\n").Replace(@"^", "\'").Replace(@"&-add-", "+");
|
|
|
|
|
data.AMSNotifyparty = Convert.ToString(reader["AMSNOTIFYPARTY"]).Replace(@"\\\\", "\n").Replace(@"^", "\'").Replace(@"&-add-", "+");
|
|
|
|
|
data.AGENTID = Convert.ToString(reader["AGENTID"]);//
|
|
|
|
|
data.AGENT = Convert.ToString(reader["AGENT"]);//
|
|
|
|
|
data.YARD = Convert.ToString(reader["YARD"]);//
|
|
|
|
|
data.DRFEESTATUS = getfeestatus(Convert.ToString(reader["DRFEESTATUS"]));
|
|
|
|
|
data.CRFEESTATUS = getfeestatus(Convert.ToString(reader["CRFEESTATUS"]));
|
|
|
|
|
data.BSSOURCE = Convert.ToString(reader["BSSOURCE"]);//
|
|
|
|
|
data.BSSOURCEDETAIL = Convert.ToString(reader["BSSOURCEDETAIL"]);//
|
|
|
|
|
data.SALECORPID= Convert.ToString(reader["SALECORPID"]);//
|
|
|
|
|
data.SALECORP = Convert.ToString(reader["SALECORP"]);//
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
headList.Add(data);
|
|
|
|
|
}
|
|
|
|
|
reader.Close();
|
|
|
|
|
}
|
|
|
|
|
return headList;
|
|
|
|
|
}
|
|
|
|
|
public static string getfeestatus(string feestatusint)
|
|
|
|
|
{
|
|
|
|
|
var result = "";
|
|
|
|
|
if (feestatusint == "0:")
|
|
|
|
|
{
|
|
|
|
|
return "审核通过";
|
|
|
|
|
}
|
|
|
|
|
else if (feestatusint == "1:")
|
|
|
|
|
{
|
|
|
|
|
return "录入状态";
|
|
|
|
|
}
|
|
|
|
|
else if (feestatusint == "2:")
|
|
|
|
|
{
|
|
|
|
|
return "提交审核";
|
|
|
|
|
}
|
|
|
|
|
else if (feestatusint == "8:")
|
|
|
|
|
{
|
|
|
|
|
return "部分结算";
|
|
|
|
|
}
|
|
|
|
|
else if (feestatusint == "9:")
|
|
|
|
|
{
|
|
|
|
|
return "结算完毕";
|
|
|
|
|
}
|
|
|
|
|
else if (feestatusint == "")
|
|
|
|
|
{
|
|
|
|
|
return "未录入";
|
|
|
|
|
}
|
|
|
|
|
else if (feestatusint == "3:")
|
|
|
|
|
{
|
|
|
|
|
return "申请修改";
|
|
|
|
|
}
|
|
|
|
|
else if (feestatusint == "4:")
|
|
|
|
|
{
|
|
|
|
|
return "申请删除";
|
|
|
|
|
}
|
|
|
|
|
else if (feestatusint == "6:")
|
|
|
|
|
{
|
|
|
|
|
return "驳回提交";
|
|
|
|
|
}
|
|
|
|
|
else if (feestatusint == "7:")
|
|
|
|
|
{
|
|
|
|
|
return "驳回申请";
|
|
|
|
|
}
|
|
|
|
|
else if (feestatusint.IndexOf("9:") > -1)
|
|
|
|
|
{
|
|
|
|
|
return "部分结算";
|
|
|
|
|
}
|
|
|
|
|
else if (feestatusint.IndexOf("8:") > -1)
|
|
|
|
|
{
|
|
|
|
|
return "部分结算";
|
|
|
|
|
}
|
|
|
|
|
else if (feestatusint.IndexOf("0:") > -1)
|
|
|
|
|
{
|
|
|
|
|
return "部分审核";
|
|
|
|
|
}
|
|
|
|
|
else if (feestatusint.IndexOf("2:") > -1)
|
|
|
|
|
{
|
|
|
|
|
return "部分提交";
|
|
|
|
|
}
|
|
|
|
|
else if (feestatusint.IndexOf("6:") > -1)
|
|
|
|
|
{
|
|
|
|
|
return "驳回提交";
|
|
|
|
|
}
|
|
|
|
|
else if (feestatusint.IndexOf("7:") > -1)
|
|
|
|
|
{
|
|
|
|
|
return "驳回申请";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 明细表
|
|
|
|
|
static public List<MsSeaeOrderCtn> GetBodyList(string strCondition)
|
|
|
|
|
{
|
|
|
|
|
var strSql = new StringBuilder();
|
|
|
|
|
strSql.Append("SELECT [CTN_ID],[ORDNO],[CTNNUM],[CTNALL],[REMARK] from crm_seaeorderctn");
|
|
|
|
|
if (strCondition.Trim() != String.Empty)
|
|
|
|
|
{
|
|
|
|
|
strSql.Append(" where " + strCondition);
|
|
|
|
|
}
|
|
|
|
|
strSql.Append(" order by ORDNO,CTNALL");
|
|
|
|
|
return SetBodyData(strSql);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static List<MsSeaeOrderCtn> SetBodyData(StringBuilder strSql)
|
|
|
|
|
{
|
|
|
|
|
var bodyList = new List<MsSeaeOrderCtn>();
|
|
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
|
|
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
|
|
|
|
|
{
|
|
|
|
|
while (reader.Read())
|
|
|
|
|
{
|
|
|
|
|
MsSeaeOrderCtn data = new MsSeaeOrderCtn();
|
|
|
|
|
#region Set DB data to Object
|
|
|
|
|
data.CTN_ID = Convert.ToString(reader["CTN_ID"]);//编号
|
|
|
|
|
data.ORDNO = Convert.ToString(reader["ORDNO"]);//业务编号
|
|
|
|
|
data.CTNNUM = Convert.ToInt32(reader["CTNNUM"]);//箱量
|
|
|
|
|
data.CTNALL = Convert.ToString(reader["CTNALL"]);//表现形式
|
|
|
|
|
data.REMARK = Convert.ToString(reader["REMARK"]);//备注
|
|
|
|
|
#endregion
|
|
|
|
|
bodyList.Add(data);
|
|
|
|
|
}
|
|
|
|
|
reader.Close();
|
|
|
|
|
}
|
|
|
|
|
return bodyList;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 保存明细
|
|
|
|
|
public static DBResult SaveDetail(MsSeaeOrder headData, List<MsSeaeOrderCtn> bodyList, string userid)
|
|
|
|
|
{
|
|
|
|
|
var result = new DBResult();
|
|
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
|
|
using (var conn = db.CreateConnection())
|
|
|
|
|
{
|
|
|
|
|
conn.Open();
|
|
|
|
|
var tran = conn.BeginTransaction();
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var cntr = "";
|
|
|
|
|
if (bodyList != null)
|
|
|
|
|
{
|
|
|
|
|
foreach (var enumValue in bodyList)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (enumValue.ORDNO == "*")
|
|
|
|
|
{
|
|
|
|
|
var cmdInsert = db.GetSqlStringCommand(@"insert into crm_seaeorderctn (CTN_ID,ORDNO,CTNNUM,CTNALL,REMARK) values (newid(),'" + headData.ORDNO + "'," + enumValue.CTNNUM + ",'" + enumValue.CTNALL + "','" + enumValue.REMARK + "')");
|
|
|
|
|
db.ExecuteNonQuery(cmdInsert, tran);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var cmdUpdate = db.GetSqlStringCommand(@"update crm_seaeorderctn set CTNNUM=" + enumValue.CTNNUM + ",CTNALL='" + enumValue.CTNALL + "',REMARK='" + enumValue.REMARK + "' where ORDNO='" + enumValue.ORDNO + "' AND CTN_ID='" + enumValue.CTN_ID + "'");
|
|
|
|
|
db.ExecuteNonQuery(cmdUpdate, tran);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
cntr = cntr + enumValue.CTNALL + '*' + enumValue.CTNNUM + "/";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
var cmdUpdateBs = db.GetSqlStringCommand(@"update crm_seaeorder set CNTRTOTAL='" + cntr + "' where ORDNO='" + headData.ORDNO + "'");
|
|
|
|
|
db.ExecuteNonQuery(cmdUpdateBs, tran);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tran.Commit();
|
|
|
|
|
}
|
|
|
|
|
catch (Exception)
|
|
|
|
|
{
|
|
|
|
|
tran.Rollback();
|
|
|
|
|
result.Success = false;
|
|
|
|
|
result.Message = "保存出现错误,请重试或联系系统管理员";
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
result.Success = true;
|
|
|
|
|
result.Message = "保存成功" + result.Message;
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static DBResult UpdateCtnTotal(string ORDNO)
|
|
|
|
|
{
|
|
|
|
|
var result = new DBResult();
|
|
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
|
|
using (var conn = db.CreateConnection())
|
|
|
|
|
{
|
|
|
|
|
conn.Open();
|
|
|
|
|
var tran = conn.BeginTransaction();
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
var bodyList = GetBodyList("ORDNO='"+ORDNO+"'");
|
|
|
|
|
var cntr = "";
|
|
|
|
|
if (bodyList != null)
|
|
|
|
|
{
|
|
|
|
|
foreach (var enumValue in bodyList)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cntr = cntr + enumValue.CTNALL + '*' + enumValue.CTNNUM + "/";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
var cmdUpdateBs = db.GetSqlStringCommand(@"update crm_seaeorder set CNTRTOTAL='" + cntr + "' where ORDNO='" + ORDNO + "'");
|
|
|
|
|
db.ExecuteNonQuery(cmdUpdateBs, tran);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tran.Commit();
|
|
|
|
|
}
|
|
|
|
|
catch (Exception)
|
|
|
|
|
{
|
|
|
|
|
tran.Rollback();
|
|
|
|
|
result.Success = false;
|
|
|
|
|
result.Message = "保存出现错误,请重试或联系系统管理员";
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
result.Success = true;
|
|
|
|
|
result.Message = "保存成功" + result.Message;
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//判断单号是否重复
|
|
|
|
|
static public int GetRdCount(string strCondition)
|
|
|
|
|
{
|
|
|
|
|
var strSql = new StringBuilder();
|
|
|
|
|
strSql.Append("SELECT Count(BSNO) AS CT from crm_seaeorder");
|
|
|
|
|
if (strCondition.Trim() != String.Empty)
|
|
|
|
|
{
|
|
|
|
|
strSql.Append(" where " + strCondition);
|
|
|
|
|
}
|
|
|
|
|
var ct=0;
|
|
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
|
|
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
|
|
|
|
|
{
|
|
|
|
|
while (reader.Read())
|
|
|
|
|
{
|
|
|
|
|
ct = Convert.ToInt16(reader["CT"]);
|
|
|
|
|
}
|
|
|
|
|
reader.Close();
|
|
|
|
|
}
|
|
|
|
|
return ct;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 删除
|
|
|
|
|
public static DBResult DeleteDetail(MsSeaeOrder headData)
|
|
|
|
|
{
|
|
|
|
|
var result = new DBResult();
|
|
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
|
|
using (var conn = db.CreateConnection())
|
|
|
|
|
{
|
|
|
|
|
conn.Open();
|
|
|
|
|
var tran = conn.BeginTransaction();
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
var cmdDelete = db.GetSqlStringCommand("delete from crm_seaeorderctn where ORDNO='" + headData.ORDNO + "'");
|
|
|
|
|
db.ExecuteNonQuery(cmdDelete, tran);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tran.Commit();
|
|
|
|
|
}
|
|
|
|
|
catch (Exception)
|
|
|
|
|
{
|
|
|
|
|
tran.Rollback();
|
|
|
|
|
|
|
|
|
|
result.Success = false;
|
|
|
|
|
result.Message = "删除出现错误,请重试或联系系统管理员";
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
result.Success = true;
|
|
|
|
|
result.Message = "操作成功";
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static DBResult DeleteDetail2(MsSeaeOrderCtn headData)
|
|
|
|
|
{
|
|
|
|
|
var result = new DBResult();
|
|
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
|
|
using (var conn = db.CreateConnection())
|
|
|
|
|
{
|
|
|
|
|
conn.Open();
|
|
|
|
|
var tran = conn.BeginTransaction();
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
var cmdDelete = db.GetSqlStringCommand("delete from crm_seaeorderctn where CTN_ID='" + headData.CTN_ID + "'");
|
|
|
|
|
db.ExecuteNonQuery(cmdDelete, tran);
|
|
|
|
|
tran.Commit();
|
|
|
|
|
}
|
|
|
|
|
catch (Exception)
|
|
|
|
|
{
|
|
|
|
|
tran.Rollback();
|
|
|
|
|
result.Success = false;
|
|
|
|
|
result.Message = "删除出现错误,请重试或联系系统管理员";
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UpdateCtnTotal(headData.ORDNO);
|
|
|
|
|
|
|
|
|
|
result.Success = true;
|
|
|
|
|
result.Message = "操作成功";
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 判断是否有费用
|
|
|
|
|
public static bool GetFeeCount(string BSNO)
|
|
|
|
|
{
|
|
|
|
|
var isfee = false;
|
|
|
|
|
var strSql = new StringBuilder();
|
|
|
|
|
strSql.Append("Select count(*) as count ");
|
|
|
|
|
strSql.Append(" from ch_fee ");
|
|
|
|
|
strSql.Append(" where BSNO='" + BSNO+"'");
|
|
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
|
|
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
|
|
|
|
|
{
|
|
|
|
|
while (reader.Read())
|
|
|
|
|
{
|
|
|
|
|
var evData = Convert.ToInt32(reader["count"]);
|
|
|
|
|
if (evData > 0) { isfee = true; };
|
|
|
|
|
}
|
|
|
|
|
reader.Close();
|
|
|
|
|
}
|
|
|
|
|
return isfee;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 审核通过处理
|
|
|
|
|
|
|
|
|
|
static public List<MsSeaeOrder> GetAuditDataList(string strCondition, string userid, string usercode, string companyid, string sort = null)
|
|
|
|
|
{
|
|
|
|
|
var rangstr = "";
|
|
|
|
|
|
|
|
|
|
var ORDERAUDITMUSTBE = MsSysParamSetDAL.GetData("PARAMNAME='ORDERAUDITMUSTBE'");
|
|
|
|
|
if (ORDERAUDITMUSTBE.PARAMVALUE == "1")
|
|
|
|
|
{
|
|
|
|
|
rangstr = " AUDITOPERATOR='"+ usercode + "'";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
rangstr = GetRangDAStr("audit", userid, usercode, companyid);
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrEmpty(rangstr))
|
|
|
|
|
{
|
|
|
|
|
if (!string.IsNullOrEmpty(strCondition))
|
|
|
|
|
{
|
|
|
|
|
strCondition = strCondition + " and " + rangstr;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
strCondition = rangstr;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
var strSql = new StringBuilder();
|
|
|
|
|
strSql.Append("SELECT ORDNO,BSNO,ORSTATUS,ORREASON,BSDATE,MBLNO,CUSTOMERNAME,ORDTYPE,SHIPPERID,CONSIGNEEID,NOTIFYPARTYID,YARD");
|
|
|
|
|
strSql.Append(",SHIPPER,CONSIGNEE,NOTIFYPARTY,VESSEL,VOYNO,ETD,PlACERECEIPT,PlACERECEIPTID,PORTLOADID,PORTLOAD,PORTDISCHARGEID,PORTDISCHARGE");
|
|
|
|
|
strSql.Append(",PLACEDELIVERYID,PLACEDELIVERY,DESTINATIONID,DESTINATION,NOBILL,ISSUETYPE,ISSUEDATE,ISSUEPLACE,ISSUEPLACEID,BLFRT");
|
|
|
|
|
strSql.Append(",PREPARDAT,PAYABLEAT,[SERVICE],MARKS,NOPKGS,[DESCRIPTION],GOODSNAME,GROSSWEIGHT,MEASUREMENT,PKGS,KINDPKGS");
|
|
|
|
|
strSql.Append(",KGS,CBM,TOTALNO,CNTRTOTAL,INPUTBY,INVNO,CARGOID,DCLASS,DUNNO,REEFERF,TEMPID,TEMPSET,TEMPMAX,TEMPMIN");
|
|
|
|
|
strSql.Append(",CUSTOMSNUM,REMARK,STATUS1,STATUS2,STATUS3,STATUS4,STATUS5,ISFUMIGATION,ISSTORAGE,ISLAND,ISCUSTOMS,ISINSPECTION");
|
|
|
|
|
strSql.Append(",ISBOOKING,ISAGENT,ISHBLNO,SERVICE9,SERVICE10,STLNAME,STLDATE,OCEANFEE,ISUSD,ISCOMMISSIONBACK,CARRIER,CARRIERATTN");
|
|
|
|
|
strSql.Append(",CARRIERTEL,CARRIEREMAIL,FORWARDER,FORWARDERATTN,FORWARDERTEL,FORWARDEREMAIL,SALE,PACKINGTYPE,BLTYPE,OP,FRCUSTSERVICE");
|
|
|
|
|
strSql.Append(",CUSTSERVICE,doc,AUDITOPERATOR,AUDITDATE,DPAGE,DLABEL,LINKMAN,BILLNUM,HSCODE,AGENTID,AGENT,TRANSPORT");
|
|
|
|
|
strSql.Append(",(CASE ORSTATUS WHEN '8' THEN '确认订舱' WHEN '0' THEN '审核通过' WHEN '1' THEN '提交审核' WHEN '2' THEN '驳回' WHEN '4' THEN '退舱' else '录入状态' end) as ORSTATUSREF ");
|
|
|
|
|
strSql.Append(",(SELECT CUSTNO FROM V_OP_BILL V WHERE V.BSNO=B.BSNO) as CUSTNO ");
|
|
|
|
|
strSql.Append(",(SELECT MBLNO FROM V_OP_BILL V WHERE V.BSNO=B.BSNO) as MBLNOREF,SALEDEPT,BSSOURCE,BSSOURCEDETAIL,(select top 1 sale from info_client where SHORTNAME=B.CUSTOMERNAME) DEFSALE ");
|
|
|
|
|
strSql.Append(",dbo.F_GetBillCrmFeeStatus(B.BSNO,1) DRFEESTATUS");
|
|
|
|
|
strSql.Append(",dbo.F_GetBillCrmFeeStatus(B.BSNO,2) CRFEESTATUS");
|
|
|
|
|
strSql.Append(",'' SenderMobile,'' SenderEmail,CONTRACTNO,'' AMSSHIPPER,'' AMSCONSIGNEE,'' AMSNOTIFYPARTY,CONFIRMOP,CONFIRMDATE,OPERATOR,OPERATORTEL,FBP,DESTFBP,MAXWEIGHT,PLANPROFIT,OPERATOREMAIL,LANE ");
|
|
|
|
|
strSql.Append(",SALECORPID,(select [NAME] from [company] where GID=B.SALECORPID) as SALECORP ");
|
|
|
|
|
|
|
|
|
|
strSql.Append(" from crm_seaeorder B");
|
|
|
|
|
if (!string.IsNullOrEmpty(strCondition))
|
|
|
|
|
{
|
|
|
|
|
strSql.Append(" where " + strCondition);
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
var sortstring = DatasetSort.Getsortstring(sort);
|
|
|
|
|
if (!string.IsNullOrEmpty(sortstring))
|
|
|
|
|
{
|
|
|
|
|
strSql.Append(" order by " + sortstring);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
strSql.Append(" order by BSDATE desc");
|
|
|
|
|
}
|
|
|
|
|
return SetData(strSql);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static DBResult AddOrderDetail(string bsno,string ordno,string userid,string companyid)
|
|
|
|
|
{
|
|
|
|
|
var result = new DBResult();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
|
|
using (var conn = db.CreateConnection())
|
|
|
|
|
{
|
|
|
|
|
conn.Open();
|
|
|
|
|
var tran = conn.BeginTransaction();
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var cmdInsert =
|
|
|
|
|
db.GetSqlStringCommand(
|
|
|
|
|
@"insert into op_ctn (CTN_ID,BSNO,CTNCODE,[SIZE],CTN,CTNNUM,TEU,CTNALL,CNTRNO,SEALNO,PKGS,KGS,CBM,REMARK,KINDPKGS,TAREWEIGHT,GOODSNAME)
|
|
|
|
|
values (@CTN_ID,@BSNO,@CTNCODE,@SIZE,@CTN,@CTNNUM,@TEU,@CTNALL,@CNTRNO,@SEALNO,@PKGS,@KGS,@CBM,@REMARK,@KINDPKGS,@TAREWEIGHT,@GOODSNAME) ");
|
|
|
|
|
|
|
|
|
|
var cmdInsertfee =
|
|
|
|
|
db.GetSqlStringCommand(
|
|
|
|
|
@"INSERT ch_fee (GID, BSNO, FEETYPE, FEENAME, FEEDESCRIPTION, CUSTOMERTYPE, CUSTOMERNAME, UNIT, UNITPRICE, QUANTITY, AMOUNT, CURRENCY,
|
|
|
|
|
EXCHANGERATE, REASON, REMARK, COMMISSIONRATE,ENTEROPERATOR, ENTERDATE,ISOPEN, ISADVANCEDPAY, SORT, FEESTATUS,TAXRATE,NOTAXAMOUNT,ACCTAXRATE,LINENUM,TAXUNITPRICE,FEEFRT,ISCRMORDERFEE)
|
|
|
|
|
SELECT NEWID(), @BSNO, FEETYPE, FEENAME, FEEDESCRIPTION, CUSTOMERTYPE, CUSTOMERNAME, UNIT, UNITPRICE, QUANTITY, AMOUNT, CURRENCY,
|
|
|
|
|
EXCHANGERATE, REASON, REMARK, COMMISSIONRATE,ENTEROPERATOR, ENTERDATE,ISOPEN, ISADVANCEDPAY, SORT, FEESTATUS,TAXRATE,NOTAXAMOUNT,ACCTAXRATE,LINENUM,TAXUNITPRICE,'PP',1
|
|
|
|
|
From ch_fee_order where BSNO=@ORDNO");
|
|
|
|
|
|
|
|
|
|
var bodyList = MsSeaeOrderDAL.GetBodyList("ORDNO='" +ordno + "'");
|
|
|
|
|
if (bodyList != null)
|
|
|
|
|
{
|
|
|
|
|
foreach (var enumValue in bodyList)
|
|
|
|
|
{
|
|
|
|
|
int SIZE = int.Parse(enumValue.CTNALL.ToString().Trim().Substring(0, 2));
|
|
|
|
|
string CTN = enumValue.CTNALL.ToString().Trim().Substring(2);
|
|
|
|
|
int TEU = enumValue.CTNNUM;
|
|
|
|
|
int iTEU = int.Parse(enumValue.CTNALL.ToString().Trim().Substring(0, 1));
|
|
|
|
|
if (iTEU == 4)
|
|
|
|
|
{
|
|
|
|
|
TEU = TEU * 2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var feedoid = Guid.NewGuid().ToString();
|
|
|
|
|
cmdInsert.Parameters.Clear();
|
|
|
|
|
db.AddInParameter(cmdInsert, "@CTN_ID", DbType.String, feedoid);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@BSNO", DbType.String,bsno);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@CTNCODE", DbType.String,"");
|
|
|
|
|
db.AddInParameter(cmdInsert, "@SIZE", DbType.Int16, SIZE);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@CTN", DbType.String, CTN);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@CTNNUM", DbType.Int16, enumValue.CTNNUM);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@TEU", DbType.Int16, TEU);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@CTNALL", DbType.String, enumValue.CTNALL);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@CNTRNO", DbType.String, "");
|
|
|
|
|
db.AddInParameter(cmdInsert, "@SEALNO", DbType.String, "");
|
|
|
|
|
db.AddInParameter(cmdInsert, "@PKGS", DbType.Int16, null);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@KGS", DbType.Decimal, null);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@CBM", DbType.Decimal, null);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@TAREWEIGHT", DbType.Int16, null);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@REMARK", DbType.String, "");
|
|
|
|
|
db.AddInParameter(cmdInsert, "@KINDPKGS", DbType.String, "");
|
|
|
|
|
db.AddInParameter(cmdInsert, "@GOODSNAME", DbType.String, "");
|
|
|
|
|
db.ExecuteNonQuery(cmdInsert, tran);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cmdInsertfee.Parameters.Clear();
|
|
|
|
|
db.AddInParameter(cmdInsertfee, "@BSNO", DbType.String, bsno);
|
|
|
|
|
db.AddInParameter(cmdInsertfee, "@ORDNO", DbType.String, bsno);
|
|
|
|
|
db.ExecuteNonQuery(cmdInsertfee, tran);
|
|
|
|
|
tran.Commit();
|
|
|
|
|
|
|
|
|
|
var SALEORDERAUDITFEESUBMIT = MsSysParamSetDAL.GetData("PARAMNAME='SALEORDERAUDITFEESUBMIT'");
|
|
|
|
|
if (SALEORDERAUDITFEESUBMIT.PARAMVALUE == "1") {
|
|
|
|
|
var feelist = MsChFeeDAL.MsChFeeDAL.GetDataList("BSNO='" + bsno + "'", 0, "", "", "", "");
|
|
|
|
|
if (feelist != null) {
|
|
|
|
|
|
|
|
|
|
var ISSALEWORK = MsSysParamSetDAL.GetData("PARAMNAME='SALESUBMITFEE'");
|
|
|
|
|
|
|
|
|
|
Chfee_AuditDAL.Chfee_AuditDAL.SubmitAuditNew("op_Seae", userid, feelist, true, "", ISSALEWORK.PARAMVALUE,companyid);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
result.Success = true;
|
|
|
|
|
result.Message = "保存成功" + result.Message;
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception)
|
|
|
|
|
{
|
|
|
|
|
tran.Rollback();
|
|
|
|
|
result.Success = false;
|
|
|
|
|
result.Message = "保存出现错误,请重试或联系系统管理员";
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
result.Success = true;
|
|
|
|
|
result.Message = "保存成功" + result.Message;
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 确认订舱
|
|
|
|
|
|
|
|
|
|
public static DBResult OrderToOp(MsSeaeOrder OrderData, string accdate, string op, string custservice, string FORWARDER, string ORREMARK,string OPNAME,string COMPANYID,string userid)
|
|
|
|
|
{
|
|
|
|
|
var result = new DBResult();
|
|
|
|
|
var headData = new MsOpSeae();
|
|
|
|
|
OrderData.CONFIRMOP = OPNAME;
|
|
|
|
|
OrderData.CONFIRMDATE = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
OrderData.ORSTATUS = "8";
|
|
|
|
|
if (OrderData.PKGS == "") OrderData.PKGS = "0";
|
|
|
|
|
if (OrderData.KGS == "") OrderData.KGS = "0";
|
|
|
|
|
if (OrderData.CBM == "") OrderData.CBM = "0";
|
|
|
|
|
OrderData.DbOperationType = DbOperationType.DbotUpd;
|
|
|
|
|
OrderData.ModelUIStatus = "E";
|
|
|
|
|
if (OrderData.ETD == "") OrderData.ETD = null;
|
|
|
|
|
if (OrderData.STLDATE == "") OrderData.STLDATE = null;
|
|
|
|
|
|
|
|
|
|
if (OrderData.ISSUEDATE == "") OrderData.ISSUEDATE = null;
|
|
|
|
|
if (OrderData.CONFIRMDATE == "") OrderData.CONFIRMDATE = null;
|
|
|
|
|
if (OrderData.AUDITDATE == "") OrderData.AUDITDATE = null;
|
|
|
|
|
|
|
|
|
|
headData.CORPID = COMPANYID;
|
|
|
|
|
|
|
|
|
|
headData.INPUTBY = OPNAME;
|
|
|
|
|
headData.BSDATE = DateTime.Now;
|
|
|
|
|
headData.BSSTATUS = false;
|
|
|
|
|
headData.FEESTATUS = false;
|
|
|
|
|
headData.DbOperationType = DbOperationType.DbotIns;
|
|
|
|
|
if (FORWARDER != "")
|
|
|
|
|
headData.FORWARDER = FORWARDER;
|
|
|
|
|
else
|
|
|
|
|
headData.FORWARDER = OrderData.FORWARDER;
|
|
|
|
|
headData.BSNO = OrderData.BSNO;
|
|
|
|
|
headData.MBLNO = OrderData.MBLNO;
|
|
|
|
|
headData.CARRIER = OrderData.CARRIER;
|
|
|
|
|
headData.CUSTOMERNAME = OrderData.CUSTOMERNAME;
|
|
|
|
|
headData.OPERATOR = OrderData.OPERATOR;
|
|
|
|
|
headData.OPERATORTEL = OrderData.OPERATORTEL;
|
|
|
|
|
headData.OPERATOREMAIL = OrderData.OPERATOREMAIL;
|
|
|
|
|
headData.ORDERTYPE = "销售订舱";
|
|
|
|
|
headData.SHIPPERID = OrderData.SHIPPERID;
|
|
|
|
|
headData.CONSIGNEEID = OrderData.CONSIGNEEID;
|
|
|
|
|
headData.NOTIFYPARTYID = OrderData.NOTIFYPARTYID;
|
|
|
|
|
headData.SHIPPER = OrderData.SHIPPER;
|
|
|
|
|
headData.CONSIGNEE = OrderData.CONSIGNEE;
|
|
|
|
|
headData.NOTIFYPARTY = OrderData.NOTIFYPARTY;
|
|
|
|
|
headData.VESSEL = OrderData.VESSEL;
|
|
|
|
|
headData.VOYNO = OrderData.VOYNO;
|
|
|
|
|
headData.ETD = OrderData.ETD;
|
|
|
|
|
if (OrderData.PORTLOADID != "")
|
|
|
|
|
headData.PORTLOADID = OrderData.PORTLOADID;
|
|
|
|
|
else headData.PORTLOADID = GetPortEDICodeByEname(OrderData.PORTLOAD);
|
|
|
|
|
headData.PORTLOAD = OrderData.PORTLOAD;
|
|
|
|
|
headData.PORTDISCHARGEID = OrderData.PORTDISCHARGEID;
|
|
|
|
|
headData.PORTDISCHARGE = OrderData.PORTDISCHARGE;
|
|
|
|
|
headData.PLACERECEIPT = OrderData.PLACERECEIPT;
|
|
|
|
|
headData.PLACERECEIPTID = OrderData.PLACERECEIPTID;
|
|
|
|
|
headData.PLACEDELIVERYID = OrderData.PLACEDELIVERYID;
|
|
|
|
|
headData.PLACEDELIVERY = OrderData.PLACEDELIVERY;
|
|
|
|
|
headData.DESTINATIONID = OrderData.DESTINATIONID;
|
|
|
|
|
headData.DESTINATION = OrderData.DESTINATION;
|
|
|
|
|
headData.NOBILL = OrderData.NOBILL;
|
|
|
|
|
headData.ISSUETYPE = OrderData.ISSUETYPE;
|
|
|
|
|
headData.ISSUEDATE = OrderData.ISSUEDATE;
|
|
|
|
|
headData.ISSUEPLACE = OrderData.ISSUEPLACE;
|
|
|
|
|
headData.ISSUEPLACEID = OrderData.ISSUEPLACEID;
|
|
|
|
|
headData.BLFRT = OrderData.BLFRT;
|
|
|
|
|
headData.PREPARDAT = OrderData.PREPARDAT;
|
|
|
|
|
headData.PAYABLEAT = OrderData.PAYABLEAT;
|
|
|
|
|
|
|
|
|
|
headData.SERVICE = OrderData.SERVICE;
|
|
|
|
|
|
|
|
|
|
headData.SERVICECONTRACTNO = OrderData.SERVICECONTRACTNO;
|
|
|
|
|
headData.MARKS = OrderData.MARKS;
|
|
|
|
|
headData.NOPKGS = OrderData.NOPKGS;
|
|
|
|
|
headData.DESCRIPTION = OrderData.DESCRIPTION;
|
|
|
|
|
headData.GOODSNAME = OrderData.GOODSNAME;
|
|
|
|
|
if (OrderData.CBM == "0")
|
|
|
|
|
headData.GROSSWEIGHT = "";
|
|
|
|
|
else
|
|
|
|
|
headData.GROSSWEIGHT = OrderData.GROSSWEIGHT;
|
|
|
|
|
if (OrderData.KGS == "0")
|
|
|
|
|
headData.MEASUREMENT = "";
|
|
|
|
|
else
|
|
|
|
|
headData.MEASUREMENT = OrderData.MEASUREMENT;
|
|
|
|
|
headData.PKGS = Convert.ToDecimal(OrderData.PKGS).ToString();
|
|
|
|
|
headData.KINDPKGS = OrderData.KINDPKGS;
|
|
|
|
|
headData.KGS = Convert.ToDecimal(OrderData.KGS).ToString();
|
|
|
|
|
headData.CBM = Convert.ToDecimal(OrderData.CBM).ToString();
|
|
|
|
|
headData.TOTALNO = OrderData.TOTALNO;
|
|
|
|
|
headData.HSCODE = OrderData.HSCODE;
|
|
|
|
|
headData.CARGOID = OrderData.CARGOID;
|
|
|
|
|
headData.DCLASS = OrderData.DCLASS;
|
|
|
|
|
headData.DPAGE = OrderData.DPAGE;
|
|
|
|
|
headData.DUNNO = OrderData.DUNNO;
|
|
|
|
|
headData.DLABEL = OrderData.DLABEL;
|
|
|
|
|
headData.LINKMAN = OrderData.LINKMAN;
|
|
|
|
|
headData.REEFERF = OrderData.REEFERF;
|
|
|
|
|
headData.TEMPID = OrderData.TEMPID;
|
|
|
|
|
headData.TEMPSET = OrderData.TEMPSET;
|
|
|
|
|
headData.TEMPMAX = OrderData.TEMPMAX;
|
|
|
|
|
headData.TEMPMIN = OrderData.TEMPMIN;
|
|
|
|
|
headData.CUSTOMSNUM = OrderData.CUSTOMSNUM;
|
|
|
|
|
var remark = OrderData.REMARK;
|
|
|
|
|
if (OrderData.FBP != "0" && OrderData.FBP != "")
|
|
|
|
|
remark = remark + " 免箱天数:" + OrderData.FBP;
|
|
|
|
|
if (OrderData.DESTFBP != "0" && OrderData.DESTFBP != "")
|
|
|
|
|
remark = remark + " 目的港免箱天数:" + OrderData.DESTFBP;
|
|
|
|
|
if (OrderData.MAXWEIGHT != "")
|
|
|
|
|
remark = remark + " 限重:" + OrderData.MAXWEIGHT;
|
|
|
|
|
if (ORREMARK != "")
|
|
|
|
|
remark = remark + " 确认订舱备注:" + ORREMARK;
|
|
|
|
|
headData.OPERATORFAX = remark;//备注
|
|
|
|
|
headData.STATUS1 = OrderData.STATUS1;//状态1
|
|
|
|
|
headData.STATUS2 = OrderData.STATUS2;//状态2
|
|
|
|
|
headData.STATUS3 = OrderData.STATUS3;//状态3
|
|
|
|
|
headData.STATUS4 = OrderData.STATUS4;//状态4
|
|
|
|
|
headData.STATUS5 = OrderData.STATUS5;//状态5
|
|
|
|
|
headData.ISFUMIGATION = OrderData.ISFUMIGATION;//熏蒸
|
|
|
|
|
headData.ISSTORAGE = OrderData.ISSTORAGE;//仓储
|
|
|
|
|
headData.ISLAND = OrderData.ISLAND;//陆运
|
|
|
|
|
headData.ISCUSTOMS = OrderData.ISCUSTOMS;//报关
|
|
|
|
|
headData.ISINSPECTION = OrderData.ISINSPECTION;//报检
|
|
|
|
|
headData.ISBOOKING = OrderData.ISBOOKING;//订舱
|
|
|
|
|
headData.ISAGENT = OrderData.ISAGENT;//使用代理
|
|
|
|
|
headData.ISHBLNO = OrderData.ISHBLNO;//分单签单
|
|
|
|
|
headData.SERVICE9 = OrderData.SERVICE9;//服务项目9
|
|
|
|
|
headData.SERVICE10 = OrderData.SERVICE10;//服务项目10
|
|
|
|
|
headData.STLNAME = OrderData.STLNAME;//结算方式
|
|
|
|
|
headData.STLDATE = OrderData.STLDATE;//结算时间
|
|
|
|
|
headData.SALE = OrderData.SALE;//揽货人
|
|
|
|
|
headData.PACKINGTYPE = OrderData.PACKINGTYPE;//装箱类型
|
|
|
|
|
headData.BLTYPE = OrderData.BLTYPE;//装运方式
|
|
|
|
|
headData.OP = op;//操作员
|
|
|
|
|
headData.CUSTSERVICE = custservice;//客服员
|
|
|
|
|
headData.FRCUSTSERVICE = OrderData.FRCUSTSERVICE;//单证
|
|
|
|
|
headData.DOC = OrderData.DOC;//单证
|
|
|
|
|
headData.AGENTID = OrderData.AGENTID;//单证
|
|
|
|
|
headData.AGENT = OrderData.AGENT;//单证
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var cntr = "";
|
|
|
|
|
var bodyList = MsSeaeOrderDAL.GetBodyList("ORDNO='" + OrderData.ORDNO + "'");
|
|
|
|
|
if (bodyList != null)
|
|
|
|
|
{
|
|
|
|
|
foreach (var enumValue in bodyList)
|
|
|
|
|
{
|
|
|
|
|
cntr = cntr + enumValue.CTNALL + '*' + enumValue.CTNNUM + "/";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
OrderData.CNTRTOTAL = cntr;
|
|
|
|
|
headData.CNTRTOTAL = OrderData.CNTRTOTAL;
|
|
|
|
|
|
|
|
|
|
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 == "") headData.ISSUEDATE = null;
|
|
|
|
|
if (headData.CLOSINGDATE == "") headData.CLOSINGDATE = null;
|
|
|
|
|
headData.LANE = OrderData.LANE;
|
|
|
|
|
headData.YARD = OrderData.YARD;
|
|
|
|
|
headData.SALEDEPT = OrderData.SALEDEPT;
|
|
|
|
|
headData.INVNO = OrderData.INVNO;
|
|
|
|
|
headData.BSSOURCE = OrderData.BSSOURCE;
|
|
|
|
|
headData.BSSOURCEDETAIL = OrderData.BSSOURCEDETAIL;
|
|
|
|
|
headData.CONTRACTNO = OrderData.CONTRACTNO;
|
|
|
|
|
|
|
|
|
|
var billnoset = MsSysBillNoSetDAL.GetData("OPLBNAME='海运出口' AND RULEBLNO='委托编号'",COMPANYID);
|
|
|
|
|
if (billnoset.BILLTYPE != "")
|
|
|
|
|
headData.CUSTNO = MsSysBillNoSetDAL.GetBillNo(billnoset, headData.ETD.ToString().Trim(), headData.ACCDATE.ToString().Trim(), "", headData.OP);
|
|
|
|
|
T_ALL_DA T_ALL_DA = new T_ALL_DA();
|
|
|
|
|
if (!string.IsNullOrEmpty(headData.SALECORPID))
|
|
|
|
|
{
|
|
|
|
|
headData.SALECORPID = OrderData.SALECORPID;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var SALECORPID = T_ALL_DA.GetStrSQL("COMPANYID", "select top 1 COMPANYID from [VW_user] where SHOWNAME='" + op + "'");
|
|
|
|
|
headData.SALECORPID = SALECORPID;
|
|
|
|
|
}
|
|
|
|
|
var modb = new ModelObjectDB();
|
|
|
|
|
result = modb.Save(headData);
|
|
|
|
|
var BSNO = headData.BSNO;
|
|
|
|
|
if (result.Success == true)
|
|
|
|
|
{
|
|
|
|
|
result = modb.Save(OrderData);
|
|
|
|
|
result = MsSeaeOrderDAL.AddOrderDetail(OrderData.BSNO, OrderData.ORDNO, userid, COMPANYID);
|
|
|
|
|
|
|
|
|
|
MsOpSeaeDAL.MsOpSeaeDAL.getCNTRTOTAL(OrderData.BSNO, "op_seae");
|
|
|
|
|
var USERID = T_ALL_DA.GetStrSQL("GID", "select top 1 GID from [user] where SHOWNAME='" + op + "'");
|
|
|
|
|
var Msgdata = new SYSMessagemb();
|
|
|
|
|
Msgdata.GID = Guid.NewGuid().ToString();
|
|
|
|
|
Msgdata.NAME = "SALEORDER";
|
|
|
|
|
Msgdata.DESCRIPTION = headData.SALE + "销售订舱";
|
|
|
|
|
Msgdata.MESSAGECONTENT = headData.SALE + "有新业务订舱," + " 委托编号:" + headData.CUSTNO;
|
|
|
|
|
Msgdata.RECEIVER = USERID;
|
|
|
|
|
Msgdata.CREATETIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
Msgdata.ISREAD = "0";
|
|
|
|
|
Msgdata.READCOUNT = "0";
|
|
|
|
|
Msgdata.TYPE = "0";
|
|
|
|
|
Msgdata.TASKURL = "";
|
|
|
|
|
Msgdata.TASKID = headData.BSNO;
|
|
|
|
|
Msgdata.NUMBER = "0";
|
|
|
|
|
Msgdata.RECVTYPE = "2";
|
|
|
|
|
Msgdata.DbOperationType = DbOperationType.DbotIns;
|
|
|
|
|
Msgdata.ModelUIStatus = "I";
|
|
|
|
|
|
|
|
|
|
var Msgmodb = new ModelObjectRepository();
|
|
|
|
|
Msgmodb.Save(Msgdata);
|
|
|
|
|
var blUpSQL = "insert into Op_SeaCover(CID,BSNO,COVERTITLE,COVERCONTEXT,OPERATOR,OPTIME,ISSYS) values(NEWID(),'" + BSNO + "','销售订舱确认','" + headData.REMARK + "','" + OPNAME+ "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','1')";
|
|
|
|
|
bool bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
|
|
|
|
|
USERID = T_ALL_DA.GetStrSQL("GID", "select top 1 GID from [user] where SHOWNAME='" + headData.SALE+ "'");
|
|
|
|
|
Msgdata = new SYSMessagemb();
|
|
|
|
|
Msgdata.GID = Guid.NewGuid().ToString();
|
|
|
|
|
Msgdata.NAME = "SALEORDER";
|
|
|
|
|
Msgdata.DESCRIPTION = headData.SALE + "销售订舱";
|
|
|
|
|
Msgdata.MESSAGECONTENT = "订舱号:" + OrderData.ORDNO+ "已订舱, 委托编号:" + headData.CUSTNO;
|
|
|
|
|
Msgdata.RECEIVER = USERID;
|
|
|
|
|
Msgdata.CREATETIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
Msgdata.ISREAD = "0";
|
|
|
|
|
Msgdata.READCOUNT = "0";
|
|
|
|
|
Msgdata.TYPE = "0";
|
|
|
|
|
Msgdata.TASKURL = "";
|
|
|
|
|
Msgdata.TASKID = headData.BSNO;
|
|
|
|
|
Msgdata.NUMBER = "0";
|
|
|
|
|
Msgdata.RECVTYPE = "2";
|
|
|
|
|
Msgdata.DbOperationType = DbOperationType.DbotIns;
|
|
|
|
|
Msgdata.ModelUIStatus = "I";
|
|
|
|
|
|
|
|
|
|
Msgmodb.Save(Msgdata);
|
|
|
|
|
|
|
|
|
|
var PARAMVALUE = MsSysParamSetDAL.GetData("PARAMNAME='ORDERSENDMAIL'");
|
|
|
|
|
if (PARAMVALUE.PARAMVALUE == "1")
|
|
|
|
|
{
|
|
|
|
|
var mailtitle = "NEW BOOKING:" + headData.CUSTNO+ " 操作主管已确认订舱";
|
|
|
|
|
var Body = new StringBuilder();
|
|
|
|
|
Body.Append("<html> <Body>");
|
|
|
|
|
Body.Append("<br />NEW BOOKING:<br />业务编号:" + headData.CUSTNO);
|
|
|
|
|
Body.Append("<br />客户名称:" + headData.CUSTOMERNAME);
|
|
|
|
|
Body.Append("<br />揽货人" + headData.SALE);
|
|
|
|
|
Body.Append("<br />录入人" + headData.INPUTBY);
|
|
|
|
|
Body.Append("<br />港口:" + headData.DESTINATION);
|
|
|
|
|
Body.Append("<br />船期:" + headData.ETD);
|
|
|
|
|
Body.Append("<br />船公司:" + headData.CARRIER);
|
|
|
|
|
Body.Append("<br />箱量:" + headData.CNTRTOTAL);
|
|
|
|
|
Body.Append("<br />备注:" + OrderData.REMARK);
|
|
|
|
|
Body.Append("</Body></html> ");
|
|
|
|
|
|
|
|
|
|
//var mailcontext = "NEW BOOKING:\r\n" + "业务编号:" + headData.CUSTNO + "\r\n客户名称:" + headData.CUSTOMERNAME + "\r\n揽货人:" + headData.SALE + "\r\n港口:" + headData.DESTINATION
|
|
|
|
|
// + "\r\n船期:" + headData.ETD + "\r\n船公司:" + headData.CARRIER + "\r\n箱量:" + headData.CNTRTOTAL + "\r\n备注:" + OrderData.REMARK;
|
|
|
|
|
var mailto = "";
|
|
|
|
|
var oplist = SysUserDAL.GetDataList("U.SHOWNAME='" + op + "' or U.SHOWNAME='" + headData.SALE + "' or U.SHOWNAME='" + OrderData.INPUTBY + "' ");
|
|
|
|
|
foreach (var opbs in oplist)
|
|
|
|
|
{
|
|
|
|
|
if (opbs.EMAIL1 != "")
|
|
|
|
|
{
|
|
|
|
|
if (mailto == "")
|
|
|
|
|
mailto = opbs.EMAIL1;
|
|
|
|
|
else
|
|
|
|
|
mailto = mailto + ";" + opbs.EMAIL1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (mailto != "")
|
|
|
|
|
{
|
|
|
|
|
var doclist = ReceiptDocDAL.GetDocList("BSNO='" + headData.BSNO + "'", " MODIFIEDTIME DESC ");
|
|
|
|
|
var j = 0;
|
|
|
|
|
var filepath = "";
|
|
|
|
|
foreach (var doc in doclist)
|
|
|
|
|
{
|
|
|
|
|
if (j == 0)
|
|
|
|
|
{
|
|
|
|
|
filepath = doc.Driect_URL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
j = j = 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
result = SendMailWithFile(mailtitle, Body.ToString(), filepath, mailto, OPNAME);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
public static DBResult SendMailWithFile(string title, string context, string filePath, string MailToAddress,string username)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var result = new DBResult();
|
|
|
|
|
if (MailToAddress == "")
|
|
|
|
|
{
|
|
|
|
|
result.Success = false;
|
|
|
|
|
result.Message = "邮箱不能为空!";
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
var MAILISSSL = false;
|
|
|
|
|
PARAMVALUE = MsSysParamSetDAL.GetData("PARAMNAME='MAILISSSL'");
|
|
|
|
|
if (PARAMVALUE.PARAMVALUE == "1") MAILISSSL = true;
|
|
|
|
|
|
|
|
|
|
filePath = System.Web.HttpContext.Current.Server.MapPath(filePath);
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
var recipients = new List<string>();
|
|
|
|
|
var ccList = new List<string>();
|
|
|
|
|
string[] emailList = MailToAddress.Split(';');
|
|
|
|
|
foreach (var m in emailList)
|
|
|
|
|
{
|
|
|
|
|
if (m.Trim() != "")
|
|
|
|
|
recipients.Add(m);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var filename = Path.GetFileName(filePath);
|
|
|
|
|
var fileExt = Path.GetExtension(filename);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var mailBodyEntity = new MailBodyEntity()
|
|
|
|
|
{
|
|
|
|
|
Body = context,
|
|
|
|
|
MailBodyType = TextFormat.Html,
|
|
|
|
|
Cc = ccList,
|
|
|
|
|
//MailBodyType = "html",
|
|
|
|
|
MailFiles = new List<MailFile>() {
|
|
|
|
|
new MailFile { MailFilePath = filePath, MailFileSubType = fileExt, MailFileType =fileExt }
|
|
|
|
|
},
|
|
|
|
|
Recipients = recipients,
|
|
|
|
|
Sender = MAILTONAME,
|
|
|
|
|
SenderAddress = MAILTONAME,
|
|
|
|
|
Subject = title,
|
|
|
|
|
};
|
|
|
|
|
var sendServerConfiguration = new SendServerConfigurationEntity()
|
|
|
|
|
{
|
|
|
|
|
SenderPassword = MAILTOPASSWORD,
|
|
|
|
|
SmtpPort = Convert.ToInt32(MAILTOPORT),
|
|
|
|
|
IsSsl = MAILISSSL,
|
|
|
|
|
MailEncoding = "utf-8",
|
|
|
|
|
SenderAccount = MAILTONAME,
|
|
|
|
|
SmtpHost = MAILTOSERVER,
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var Mailresult = MailHelper.SendMail(mailBodyEntity, sendServerConfiguration);
|
|
|
|
|
if (Mailresult.ResultStatus == true)
|
|
|
|
|
{
|
|
|
|
|
var head = new OpMailLog();
|
|
|
|
|
head.BSNO = "";
|
|
|
|
|
head.BLTYPE = "销售订舱审核通过";
|
|
|
|
|
head.RECEIVER = MailToAddress;
|
|
|
|
|
head.SUBJECT = title;
|
|
|
|
|
head.DESCRIPTION = context;
|
|
|
|
|
head.ATTACHMENT = "../../ AutoDuiFiles / Excels" + filename;
|
|
|
|
|
head.SENDER = username;
|
|
|
|
|
head.SENDTIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
head.DbOperationType = DbOperationType.DbotIns;
|
|
|
|
|
var modb = new ModelObjectDB();
|
|
|
|
|
modb.Save(head);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
result.Success = Mailresult.ResultStatus;
|
|
|
|
|
result.Message = Mailresult.ResultInformation;
|
|
|
|
|
return result;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
result.Success = false;
|
|
|
|
|
result.Message = ex.Message;
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
result.Success = true;
|
|
|
|
|
result.Message = "发送成功!";
|
|
|
|
|
return result;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static public string GetPortEDICodeByEname(string port)
|
|
|
|
|
{
|
|
|
|
|
string EDICODE = "";
|
|
|
|
|
|
|
|
|
|
var strSql = new StringBuilder();
|
|
|
|
|
strSql.Append("select EDICODE from code_disport where PORT='" + port + "'");
|
|
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
|
|
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
|
|
|
|
|
{
|
|
|
|
|
while (reader.Read())
|
|
|
|
|
{
|
|
|
|
|
EDICODE = Convert.ToString(reader["EDICODE"]).Trim();
|
|
|
|
|
}
|
|
|
|
|
reader.Close();
|
|
|
|
|
}
|
|
|
|
|
if (EDICODE.Trim() == "")
|
|
|
|
|
{
|
|
|
|
|
var strSql2 = new StringBuilder();
|
|
|
|
|
strSql2.Append("select EDICODE from code_loadport where PORT='" + port + "' ");
|
|
|
|
|
db = DatabaseFactory.CreateDatabase();
|
|
|
|
|
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql2.ToString()))
|
|
|
|
|
{
|
|
|
|
|
while (reader.Read())
|
|
|
|
|
{
|
|
|
|
|
EDICODE = Convert.ToString(reader["EDICODE"]).Trim();
|
|
|
|
|
}
|
|
|
|
|
reader.Close();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return EDICODE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 网上订舱处理
|
|
|
|
|
|
|
|
|
|
static public List<MsSeaeOrder> GetWebDataList(string strCondition, string sort = null)
|
|
|
|
|
{
|
|
|
|
|
var strSql = new StringBuilder();
|
|
|
|
|
strSql.AppendLine("SELECT top 20 BSNO ORDNO,BSNO,BSSTATUS as ORSTATUS,BLTYPE,BSDATE, ");
|
|
|
|
|
strSql.AppendLine("case when (select COUNT(*) from dbo.BookingCargoSpaceChange where userID != '' and fieldName='MBLNO' and isContainer=0 and dbo.BookingCargoSpaceChange.BSNO=B.BSNO and del_sign=0)=0 then MBLNO else (select fieldValue from dbo.BookingCargoSpaceChange where userID != '' and fieldName='MBLNO' and isContainer=0 and BSNO=B.BSNO and del_sign=0) end AS MBLNO, ");
|
|
|
|
|
strSql.AppendLine("case when (select COUNT(*) from dbo.BookingCargoSpaceChange where userID != '' and fieldName='SHIPPER' and isContainer=0 and dbo.BookingCargoSpaceChange.BSNO=B.BSNO and del_sign=0)=0 then SHIPPER else (select fieldValue from dbo.BookingCargoSpaceChange where userID != '' and fieldName='SHIPPER' and isContainer=0 and BSNO=B.BSNO and del_sign=0) end AS SHIPPER, ");
|
|
|
|
|
strSql.AppendLine("case when (select COUNT(*) from dbo.BookingCargoSpaceChange where userID != '' and fieldName='CONSIGNEE' and isContainer=0 and dbo.BookingCargoSpaceChange.BSNO=B.BSNO and del_sign=0)=0 then CONSIGNEE else (select fieldValue from dbo.BookingCargoSpaceChange where userID != '' and fieldName='CONSIGNEE' and isContainer=0 and BSNO=B.BSNO and del_sign=0) end AS CONSIGNEE, ");
|
|
|
|
|
strSql.AppendLine("case when (select COUNT(*) from dbo.BookingCargoSpaceChange where userID != '' and fieldName='NOTIFYPARTY' and isContainer=0 and dbo.BookingCargoSpaceChange.BSNO=B.BSNO and del_sign=0)=0 then NOTIFYPARTY else (select fieldValue from dbo.BookingCargoSpaceChange where userID != '' and fieldName='NOTIFYPARTY' and isContainer=0 and BSNO=B.BSNO and del_sign=0) end AS NOTIFYPARTY, ");
|
|
|
|
|
strSql.AppendLine("case when (select COUNT(*) from dbo.BookingCargoSpaceChange where userID != '' and fieldName='VESSEL' and isContainer=0 and dbo.BookingCargoSpaceChange.BSNO=B.BSNO and del_sign=0)=0 then VESSEL else (select fieldValue from dbo.BookingCargoSpaceChange where userID != '' and fieldName='VESSEL' and isContainer=0 and BSNO=B.BSNO and del_sign=0) end AS VESSEL, ");
|
|
|
|
|
strSql.AppendLine("case when (select COUNT(*) from dbo.BookingCargoSpaceChange where userID != '' and fieldName='VOYNO' and isContainer=0 and dbo.BookingCargoSpaceChange.BSNO=B.BSNO and del_sign=0)=0 then VOYNO else (select fieldValue from dbo.BookingCargoSpaceChange where userID != '' and fieldName='VOYNO' and isContainer=0 and BSNO=B.BSNO and del_sign=0) end AS VOYNO, ");
|
|
|
|
|
strSql.AppendLine("case when (select COUNT(*) from dbo.BookingCargoSpaceChange where userID != '' and fieldName='PlACERECEIPT' and isContainer=0 and dbo.BookingCargoSpaceChange.BSNO=B.BSNO and del_sign=0)=0 then PlACERECEIPT else (select fieldValue from dbo.BookingCargoSpaceChange where userID != '' and fieldName='PlACERECEIPT' and isContainer=0 and BSNO=B.BSNO and del_sign=0) end AS PlACERECEIPT, ");
|
|
|
|
|
strSql.AppendLine("case when (select COUNT(*) from dbo.BookingCargoSpaceChange where userID != '' and fieldName='PORTLOAD' and isContainer=0 and dbo.BookingCargoSpaceChange.BSNO=B.BSNO and del_sign=0)=0 then PORTLOAD else (select fieldValue from dbo.BookingCargoSpaceChange where userID != '' and fieldName='PORTLOAD' and isContainer=0 and BSNO=B.BSNO and del_sign=0) end AS PORTLOAD, ");
|
|
|
|
|
strSql.AppendLine("case when (select COUNT(*) from dbo.BookingCargoSpaceChange where userID != '' and fieldName='PORTDISCHARGE' and isContainer=0 and dbo.BookingCargoSpaceChange.BSNO=B.BSNO and del_sign=0)=0 then PORTDISCHARGE else (select fieldValue from dbo.BookingCargoSpaceChange where userID != '' and fieldName='PORTDISCHARGE' and isContainer=0 and BSNO=B.BSNO and del_sign=0) end AS PORTDISCHARGE, ");
|
|
|
|
|
strSql.AppendLine("case when (select COUNT(*) from dbo.BookingCargoSpaceChange where userID != '' and fieldName='PLACEDELIVERY' and isContainer=0 and dbo.BookingCargoSpaceChange.BSNO=B.BSNO and del_sign=0)=0 then PLACEDELIVERY else (select fieldValue from dbo.BookingCargoSpaceChange where userID != '' and fieldName='PLACEDELIVERY' and isContainer=0 and BSNO=B.BSNO and del_sign=0) end AS PLACEDELIVERY, ");
|
|
|
|
|
strSql.AppendLine("case when (select COUNT(*) from dbo.BookingCargoSpaceChange where userID != '' and fieldName='BLFRT' and isContainer=0 and dbo.BookingCargoSpaceChange.BSNO=B.BSNO and del_sign=0)=0 then BLFRT else (select fieldValue from dbo.BookingCargoSpaceChange where userID != '' and fieldName='BLFRT' and isContainer=0 and BSNO=B.BSNO and del_sign=0) end AS BLFRT, ");
|
|
|
|
|
strSql.AppendLine("case when (select COUNT(*) from dbo.BookingCargoSpaceChange where userID != '' and fieldName='SERVICE' and isContainer=0 and dbo.BookingCargoSpaceChange.BSNO=B.BSNO and del_sign=0)=0 then [SERVICE] else (select fieldValue from dbo.BookingCargoSpaceChange where userID != '' and fieldName='SERVICE' and isContainer=0 and BSNO=B.BSNO and del_sign=0) end AS [SERVICE], ");
|
|
|
|
|
strSql.AppendLine("case when (select COUNT(*) from dbo.BookingCargoSpaceChange where userID != '' and fieldName='MARKS' and isContainer=0 and dbo.BookingCargoSpaceChange.BSNO=B.BSNO and del_sign=0)=0 then MARKS else (select fieldValue from dbo.BookingCargoSpaceChange where userID != '' and fieldName='MARKS' and isContainer=0 and BSNO=B.BSNO and del_sign=0) end AS MARKS, ");
|
|
|
|
|
strSql.AppendLine("case when (select COUNT(*) from dbo.BookingCargoSpaceChange where userID != '' and fieldName='DESCRIPTION' and isContainer=0 and dbo.BookingCargoSpaceChange.BSNO=B.BSNO and del_sign=0)=0 then [DESCRIPTION] else (select fieldValue from dbo.BookingCargoSpaceChange where userID != '' and fieldName='DESCRIPTION' and isContainer=0 and BSNO=B.BSNO and del_sign=0) end AS [DESCRIPTION], ");
|
|
|
|
|
strSql.AppendLine("case when (select COUNT(*) from dbo.BookingCargoSpaceChange where userID != '' and fieldName='GOODSNAME' and isContainer=0 and dbo.BookingCargoSpaceChange.BSNO=B.BSNO and del_sign=0)=0 then GOODSNAME else (select fieldValue from dbo.BookingCargoSpaceChange where userID != '' and fieldName='GOODSNAME' and isContainer=0 and BSNO=B.BSNO and del_sign=0) end AS GOODSNAME, ");
|
|
|
|
|
strSql.AppendLine("case when (select COUNT(*) from dbo.BookingCargoSpaceChange where userID != '' and fieldName='GROSSWEIGHT' and isContainer=0 and dbo.BookingCargoSpaceChange.BSNO=B.BSNO and del_sign=0)=0 then GROSSWEIGHT else (select fieldValue from dbo.BookingCargoSpaceChange where userID != '' and fieldName='GROSSWEIGHT' and isContainer=0 and BSNO=B.BSNO and del_sign=0) end AS GROSSWEIGHT, ");
|
|
|
|
|
strSql.AppendLine("case when (select COUNT(*) from dbo.BookingCargoSpaceChange where userID != '' and fieldName='MEASUREMENT' and isContainer=0 and dbo.BookingCargoSpaceChange.BSNO=B.BSNO and del_sign=0)=0 then MEASUREMENT else (select fieldValue from dbo.BookingCargoSpaceChange where userID != '' and fieldName='MEASUREMENT' and isContainer=0 and BSNO=B.BSNO and del_sign=0) end AS MEASUREMENT, ");
|
|
|
|
|
strSql.AppendLine("case when (select COUNT(*) from dbo.BookingCargoSpaceChange where userID != '' and fieldName='PKGS' and isContainer=0 and dbo.BookingCargoSpaceChange.BSNO=B.BSNO and del_sign=0)=0 then PKGS else (select fieldValue from dbo.BookingCargoSpaceChange where userID != '' and fieldName='PKGS' and isContainer=0 and BSNO=B.BSNO and del_sign=0) end AS PKGS, ");
|
|
|
|
|
strSql.AppendLine("case when (select COUNT(*) from dbo.BookingCargoSpaceChange where userID != '' and fieldName='KINDPKGS' and isContainer=0 and dbo.BookingCargoSpaceChange.BSNO=B.BSNO and del_sign=0)=0 then KINDPKGS else (select fieldValue from dbo.BookingCargoSpaceChange where userID != '' and fieldName='KINDPKGS' and isContainer=0 and BSNO=B.BSNO and del_sign=0) end AS KINDPKGS, ");
|
|
|
|
|
strSql.AppendLine("case when (select COUNT(*) from dbo.BookingCargoSpaceChange where userID != '' and fieldName='KGS' and isContainer=0 and dbo.BookingCargoSpaceChange.BSNO=B.BSNO and del_sign=0)=0 then KGS else (select fieldValue from dbo.BookingCargoSpaceChange where userID != '' and fieldName='KGS' and isContainer=0 and BSNO=B.BSNO and del_sign=0) end AS KGS, ");
|
|
|
|
|
strSql.AppendLine("case when (select COUNT(*) from dbo.BookingCargoSpaceChange where userID != '' and fieldName='CBM' and isContainer=0 and dbo.BookingCargoSpaceChange.BSNO=B.BSNO and del_sign=0)=0 then CBM else (select fieldValue from dbo.BookingCargoSpaceChange where userID != '' and fieldName='CBM' and isContainer=0 and BSNO=B.BSNO and del_sign=0) end AS CBM, ");
|
|
|
|
|
strSql.AppendLine("case when (select COUNT(*) from dbo.BookingCargoSpaceChange where userID != '' and fieldName='TOTALNO' and isContainer=0 and dbo.BookingCargoSpaceChange.BSNO=B.BSNO and del_sign=0)=0 then TOTALNO else (select fieldValue from dbo.BookingCargoSpaceChange where userID != '' and fieldName='TOTALNO' and isContainer=0 and BSNO=B.BSNO and del_sign=0) end AS TOTALNO, ");
|
|
|
|
|
strSql.AppendLine("case when (select COUNT(*) from dbo.BookingCargoSpaceChange where userID != '' and fieldName='CNTR' and isContainer=0 and dbo.BookingCargoSpaceChange.BSNO=B.BSNO and del_sign=0)=0 then CNTR else (select fieldValue from dbo.BookingCargoSpaceChange where userID != '' and fieldName='CNTR' and isContainer=0 and BSNO=B.BSNO and del_sign=0) end AS CNTRTOTAL, ");
|
|
|
|
|
strSql.AppendLine("case when (select COUNT(*) from dbo.BookingCargoSpaceChange where userID != '' and fieldName='CARGOID' and isContainer=0 and dbo.BookingCargoSpaceChange.BSNO=B.BSNO and del_sign=0)=0 then CARGOID else (select fieldValue from dbo.BookingCargoSpaceChange where userID != '' and fieldName='CARGOID' and isContainer=0 and BSNO=B.BSNO and del_sign=0) end AS CARGOID, ");
|
|
|
|
|
strSql.AppendLine("case when (select COUNT(*) from dbo.BookingCargoSpaceChange where userID != '' and fieldName='DCLASS' and isContainer=0 and dbo.BookingCargoSpaceChange.BSNO=B.BSNO and del_sign=0)=0 then DCLASS else (select fieldValue from dbo.BookingCargoSpaceChange where userID != '' and fieldName='DCLASS' and isContainer=0 and BSNO=B.BSNO and del_sign=0) end AS DCLASS, ");
|
|
|
|
|
strSql.AppendLine("case when (select COUNT(*) from dbo.BookingCargoSpaceChange where userID != '' and fieldName='DUNNO' and isContainer=0 and dbo.BookingCargoSpaceChange.BSNO=B.BSNO and del_sign=0)=0 then DUNNO else (select fieldValue from dbo.BookingCargoSpaceChange where userID != '' and fieldName='DUNNO' and isContainer=0 and BSNO=B.BSNO and del_sign=0) end AS DUNNO, ");
|
|
|
|
|
strSql.AppendLine("case when (select COUNT(*) from dbo.BookingCargoSpaceChange where userID != '' and fieldName='REEFERF' and isContainer=0 and dbo.BookingCargoSpaceChange.BSNO=B.BSNO and del_sign=0)=0 then REEFERF else (select fieldValue from dbo.BookingCargoSpaceChange where userID != '' and fieldName='REEFERF' and isContainer=0 and BSNO=B.BSNO and del_sign=0) end AS REEFERF, ");
|
|
|
|
|
strSql.AppendLine("case when (select COUNT(*) from dbo.BookingCargoSpaceChange where userID != '' and fieldName='TEMPID' and isContainer=0 and dbo.BookingCargoSpaceChange.BSNO=B.BSNO and del_sign=0)=0 then TEMPID else (select fieldValue from dbo.BookingCargoSpaceChange where userID != '' and fieldName='TEMPID' and isContainer=0 and BSNO=B.BSNO and del_sign=0) end AS TEMPID, ");
|
|
|
|
|
strSql.AppendLine("case when (select COUNT(*) from dbo.BookingCargoSpaceChange where userID != '' and fieldName='TEMPSET' and isContainer=0 and dbo.BookingCargoSpaceChange.BSNO=B.BSNO and del_sign=0)=0 then TEMPSET else (select fieldValue from dbo.BookingCargoSpaceChange where userID != '' and fieldName='TEMPSET' and isContainer=0 and BSNO=B.BSNO and del_sign=0) end AS TEMPSET, ");
|
|
|
|
|
strSql.AppendLine("case when (select COUNT(*) from dbo.BookingCargoSpaceChange where userID != '' and fieldName='BOOKINGDESCRIPTION' and isContainer=0 and dbo.BookingCargoSpaceChange.BSNO=B.BSNO and del_sign=0)=0 then BOOKINGDESCRIPTION else (select fieldValue from dbo.BookingCargoSpaceChange where userID != '' and fieldName='BOOKINGDESCRIPTION' and isContainer=0 and BSNO=B.BSNO and del_sign=0) end AS REMARK, ");
|
|
|
|
|
strSql.AppendLine("case when (select COUNT(*) from dbo.BookingCargoSpaceChange where userID != '' and fieldName='DPAGE' and isContainer=0 and dbo.BookingCargoSpaceChange.BSNO=B.BSNO and del_sign=0)=0 then DPAGE else (select fieldValue from dbo.BookingCargoSpaceChange where userID != '' and fieldName='DPAGE' and isContainer=0 and BSNO=B.BSNO and del_sign=0) end AS DPAGE, ");
|
|
|
|
|
strSql.AppendLine("case when (select COUNT(*) from dbo.BookingCargoSpaceChange where userID != '' and fieldName='DLABEL' and isContainer=0 and dbo.BookingCargoSpaceChange.BSNO=B.BSNO and del_sign=0)=0 then DLABEL else (select fieldValue from dbo.BookingCargoSpaceChange where userID != '' and fieldName='DLABEL' and isContainer=0 and BSNO=B.BSNO and del_sign=0) end AS DLABEL, ");
|
|
|
|
|
strSql.AppendLine("case when (select COUNT(*) from dbo.BookingCargoSpaceChange where userID != '' and fieldName='LINKMAN' and isContainer=0 and dbo.BookingCargoSpaceChange.BSNO=B.BSNO and del_sign=0)=0 then LINKMAN else (select fieldValue from dbo.BookingCargoSpaceChange where userID != '' and fieldName='LINKMAN' and isContainer=0 and BSNO=B.BSNO and del_sign=0) end AS LINKMAN, ");
|
|
|
|
|
strSql.AppendLine("case when (select COUNT(*) from dbo.BookingCargoSpaceChange where userID != '' and fieldName='ISSUEWAY' and isContainer=0 and dbo.BookingCargoSpaceChange.BSNO=B.BSNO and del_sign=0)=0 then ISSUEWAY else (select fieldValue from dbo.BookingCargoSpaceChange where userID != '' and fieldName='ISSUEWAY' and isContainer=0 and BSNO=B.BSNO and del_sign=0) end AS ISSUETYPE, ");
|
|
|
|
|
strSql.AppendLine("case when (select COUNT(*) from dbo.BookingCargoSpaceChange where userID != '' and fieldName='BILLNUM' and isContainer=0 and dbo.BookingCargoSpaceChange.BSNO=B.BSNO and del_sign=0)=0 then BILLNUM else (select fieldValue from dbo.BookingCargoSpaceChange where userID != '' and fieldName='BILLNUM' and isContainer=0 and BSNO=B.BSNO and del_sign=0) end AS BILLNUM, ");
|
|
|
|
|
strSql.AppendLine("(Select name from Company where companyID=B.companyID) as CUSTOMERNAME, ");
|
|
|
|
|
strSql.AppendLine("'网上订舱' ORDTYPE,SHIPPERID,CONSIGNEEID,NOTIFYPARTYID,ETD,PORTLOADID,PORTDISCHARGEID, ");
|
|
|
|
|
strSql.AppendLine("PLACEDELIVERYID,DESTINATIONID,DESTINATION,ISSUEDATE,ISSUEPLACE,PREPARDAT,PAYABLEAT,HSCODE, ");//NOBILL,ISSUETYPE,
|
|
|
|
|
strSql.AppendLine("NOPKGS,(SELECT userName FROM UserInfo WHERE userID=B.INPUTBY) INPUTBY, ");
|
|
|
|
|
strSql.AppendLine("'' INVNO,0 CUSTOMSNUM,STATUS1,STATUS2,STATUS3,STATUS4,STATUS5,0 ISFUMIGATION,TEMPMAX,TEMPMIN, ");
|
|
|
|
|
strSql.AppendLine("0 ISSTORAGE,0 ISLAND,0 ISCUSTOMS,0 ISINSPECTION,0 ISBOOKING,0 ISAGENT,0 ISHBLNO, ");
|
|
|
|
|
strSql.AppendLine("0 SERVICE9,0 SERVICE10,'' STLNAME,null STLDATE,0 OCEANFEE,0 ISUSD, ");
|
|
|
|
|
strSql.AppendLine("0 ISCOMMISSIONBACK,CARRIER,'' CARRIERATTN,'' CARRIERTEL,'' CARRIEREMAIL, ");
|
|
|
|
|
strSql.AppendLine("'' FORWARDER,'' FORWARDERATTN,'' FORWARDERTEL,'' FORWARDEREMAIL,'' SALE, ");
|
|
|
|
|
strSql.AppendLine("PACKINGTYPE,'' BLTYPE,OP,'' CUSTSERVICE,'' doc,ISSUEWAY,BILLNUM,'' AGENTID,'' AGENT, ");
|
|
|
|
|
strSql.AppendLine("(SELECT userName FROM UserInfo WHERE userID=B.AUDITOR) AUDITOPERATOR, ");
|
|
|
|
|
strSql.AppendLine("'' AUDITDATE, ");
|
|
|
|
|
strSql.AppendLine("(Select className from InfoClass where classID=B.BSSTATUS) as ORSTATUSREF , ");
|
|
|
|
|
strSql.AppendLine("(select top 1 Remark from BookingCargoSpaceStatus where flowid=B.BSSTATUS and bsno=B.bsno order by subdate desc) ORREASON , ");
|
|
|
|
|
strSql.AppendLine("(select mobile from userinfo where userid=inputby) SenderMobile, ");
|
|
|
|
|
strSql.AppendLine("(select email from userinfo where userid=inputby) SenderEmail ,CUSTNO, ");
|
|
|
|
|
strSql.AppendLine("CONTRACTNO,AMSSHIPPER,AMSCONSIGNEE,AMSNOTIFYPARTY,'' CONFIRMOP,null CONFIRMDATE,'' OPERATOR,'' OPERATORTEL,'0' FBP,'0' DESTFBP,'' MAXWEIGHT,'' PLANPROFIT,'' OPERATOREMAIL ");
|
|
|
|
|
strSql.AppendLine(" from BookingCargoSpace B");
|
|
|
|
|
if (!string.IsNullOrEmpty(strCondition))
|
|
|
|
|
{
|
|
|
|
|
strSql.AppendLine(" where " + strCondition);
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
var sortstring = DatasetSort.Getsortstring(sort);
|
|
|
|
|
if (!string.IsNullOrEmpty(sortstring))
|
|
|
|
|
{
|
|
|
|
|
strSql.AppendLine(" order by " + sortstring);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
strSql.AppendLine(" order by BSDATE desc");
|
|
|
|
|
}
|
|
|
|
|
return SetWebData(strSql,"SHIPPINGBOX");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static List<MsSeaeOrder> SetWebData(StringBuilder strSql, string dbstr = "")
|
|
|
|
|
{
|
|
|
|
|
var headList = new List<MsSeaeOrder>();
|
|
|
|
|
Database db = null;
|
|
|
|
|
if (dbstr != "")
|
|
|
|
|
db = DatabaseFactory.CreateDatabase(dbstr);
|
|
|
|
|
else
|
|
|
|
|
db = DatabaseFactory.CreateDatabase();
|
|
|
|
|
|
|
|
|
|
SqlCommand cmd = new SqlCommand();
|
|
|
|
|
cmd.CommandText = strSql.ToString();
|
|
|
|
|
cmd.CommandTimeout = 120000; //要加这一句
|
|
|
|
|
|
|
|
|
|
using (IDataReader reader = db.ExecuteReader(cmd))
|
|
|
|
|
{
|
|
|
|
|
while (reader.Read())
|
|
|
|
|
{
|
|
|
|
|
MsSeaeOrder data = new MsSeaeOrder();
|
|
|
|
|
#region Set DB data to Object
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
data.ORDNO = Convert.ToString(reader["ORDNO"]);//委托
|
|
|
|
|
data.BSNO = Convert.ToString(reader["BSNO"]);//业务编号
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
data.BLTYPE = Convert.ToString(reader["BLTYPE"]);//装运方式
|
|
|
|
|
data.ORSTATUS = Convert.ToString(reader["ORSTATUS"]);//主编号
|
|
|
|
|
data.ORSTATUSREF = Convert.ToString(reader["ORSTATUSREF"]);//委托编号
|
|
|
|
|
data.ORREASON = Convert.ToString(reader["ORREASON"]);//分提单号
|
|
|
|
|
data.BSDATE = Convert.ToDateTime(reader["BSDATE"]);//接单日期
|
|
|
|
|
data.MBLNO = Convert.ToString(reader["MBLNO"]);//主提单号
|
|
|
|
|
data.CUSTNO = Convert.ToString(reader["CUSTNO"]);//主提单号
|
|
|
|
|
data.CUSTOMERNAME = Convert.ToString(reader["CUSTOMERNAME"]);//委托单位
|
|
|
|
|
data.ORDTYPE = Convert.ToString(reader["ORDTYPE"]);//业务状态
|
|
|
|
|
data.SHIPPERID = Convert.ToString(reader["SHIPPERID"]);//发货人
|
|
|
|
|
data.CONSIGNEEID = Convert.ToString(reader["CONSIGNEEID"]);//收货人
|
|
|
|
|
data.NOTIFYPARTYID = Convert.ToString(reader["NOTIFYPARTYID"]);//通知人
|
|
|
|
|
data.SHIPPER = Convert.ToString(reader["SHIPPER"]).Replace(@"\\\\", "\n").Replace(@"^", "\'").Replace(@"&-add-", "+"); //发货人内容
|
|
|
|
|
data.CONSIGNEE = Convert.ToString(reader["CONSIGNEE"]).Replace(@"\\\\", "\n").Replace(@"^", "\'").Replace(@"&-add-", "+");//收货人内容
|
|
|
|
|
data.NOTIFYPARTY = Convert.ToString(reader["NOTIFYPARTY"]).Replace(@"\\\\", "\n").Replace(@"^", "\'").Replace(@"&-add-", "+");//通知人内容
|
|
|
|
|
data.VESSEL = Convert.ToString(reader["VESSEL"]);//船名
|
|
|
|
|
data.VOYNO = Convert.ToString(reader["VOYNO"]);//航次
|
|
|
|
|
if (reader["ETD"] != DBNull.Value)
|
|
|
|
|
data.ETD = Convert.ToDateTime(reader["ETD"]).ToString("yyyy-MM-dd");//到港日期
|
|
|
|
|
data.PORTLOADID = Convert.ToString(reader["PORTLOADID"]);//装货港代码
|
|
|
|
|
data.PORTLOAD = Convert.ToString(reader["PORTLOAD"]);//装货港
|
|
|
|
|
data.PORTDISCHARGEID = Convert.ToString(reader["PORTDISCHARGEID"]);//卸货港代码
|
|
|
|
|
data.PORTDISCHARGE = Convert.ToString(reader["PORTDISCHARGE"]).Replace(@"^", "\'");//卸货港
|
|
|
|
|
data.PLACERECEIPT = Convert.ToString(reader["PlACERECEIPT"]).Replace(@"^", "\'");//收货地
|
|
|
|
|
data.PLACEDELIVERYID = Convert.ToString(reader["PLACEDELIVERYID"]);//交货地代码
|
|
|
|
|
data.PLACEDELIVERY = Convert.ToString(reader["PLACEDELIVERY"]).Replace(@"^", "\'");//交货地
|
|
|
|
|
data.DESTINATIONID = Convert.ToString(reader["DESTINATIONID"]);//目的地代码
|
|
|
|
|
data.DESTINATION = Convert.ToString(reader["DESTINATION"]).Replace(@"^", "\'");//目的地
|
|
|
|
|
data.NOBILL = Convert.ToString(reader["BILLNUM"]);//提单份数
|
|
|
|
|
data.ISSUETYPE = Convert.ToString(reader["ISSUETYPE"]);//签单方式
|
|
|
|
|
if (reader["ISSUEDATE"] != DBNull.Value)
|
|
|
|
|
data.ISSUEDATE = Convert.ToDateTime(reader["ISSUEDATE"]).ToString("yyyy-MM-dd");//预抵日期
|
|
|
|
|
data.ISSUEPLACE = Convert.ToString(reader["ISSUEPLACE"]);//签单地点
|
|
|
|
|
data.BLFRT = Convert.ToString(reader["BLFRT"]);//付费方式
|
|
|
|
|
data.PREPARDAT = Convert.ToString(reader["PREPARDAT"]);//预付地点
|
|
|
|
|
data.PAYABLEAT = Convert.ToString(reader["PAYABLEAT"]);//到付地点
|
|
|
|
|
data.SERVICE = Convert.ToString(reader["SERVICE"]);//运输条款
|
|
|
|
|
data.MARKS = Convert.ToString(reader["MARKS"]).Replace(@"\\\\", "\n").Replace(@"^", "\'").Replace(@"&-add-", "+"); //唛头
|
|
|
|
|
//data.NOPKGS = Convert.ToString(reader["NOPKGS"]).Replace(@"\\\\", "\n").Replace(@"^", "\'");//件数包装
|
|
|
|
|
string _pkgs = Convert.ToString(reader["PKGS"].ToString());
|
|
|
|
|
/*for (int iCount = 0; iCount < 5; iCount++)
|
|
|
|
|
{
|
|
|
|
|
int _lengthPkgs = _pkgs.Length;
|
|
|
|
|
char _tempPkgs = _pkgs[_lengthPkgs - 1];
|
|
|
|
|
if (_tempPkgs == '0') { _pkgs = _pkgs.Substring(0, _lengthPkgs - 1); }
|
|
|
|
|
else { break; }
|
|
|
|
|
}
|
|
|
|
|
if (_pkgs[_pkgs.Length - 1] == '.') { _pkgs = _pkgs.Substring(0, _pkgs.Length - 1); }*/
|
|
|
|
|
data.NOPKGS = Convert.ToString(_pkgs + reader["KINDPKGS"].ToString());//件数包装
|
|
|
|
|
data.DESCRIPTION = Convert.ToString(reader["DESCRIPTION"]).Replace(@"\\\\", "\n").Replace(@"^", "\'").Replace(@"&-add-", "+"); //货物描述
|
|
|
|
|
data.GOODSNAME = Convert.ToString(reader["GOODSNAME"]);//品名
|
|
|
|
|
//data.GROSSWEIGHT = Convert.ToString(reader["GROSSWEIGHT"]).Replace(@"\\\\", "\n").Replace(@"^", "\'"); //货物毛重
|
|
|
|
|
string _kgs = Convert.ToString(reader["KGS"]);
|
|
|
|
|
for (int iCount = 0; iCount < 5; iCount++)
|
|
|
|
|
{
|
|
|
|
|
int _lengthKgs = _kgs.Length;
|
|
|
|
|
char _tempKgs = _kgs[_lengthKgs - 1];
|
|
|
|
|
if (_tempKgs == '0') { _kgs = _kgs.Substring(0, _lengthKgs - 1); }
|
|
|
|
|
else { break; }
|
|
|
|
|
}
|
|
|
|
|
if (_kgs[_kgs.Length - 1] == '.') { _kgs = _kgs.Substring(0, _kgs.Length - 1); }
|
|
|
|
|
data.GROSSWEIGHT = _kgs + "KGS"; //货物毛重
|
|
|
|
|
//data.MEASUREMENT = Convert.ToString(reader["MEASUREMENT"]).Replace(@"\\\\", "\n").Replace(@"^", "\'"); //货物尺码
|
|
|
|
|
string _cbm = Convert.ToString(reader["CBM"]);
|
|
|
|
|
for (int iCount = 0; iCount < 5; iCount++)
|
|
|
|
|
{
|
|
|
|
|
int _lengthCbm = _cbm.Length;
|
|
|
|
|
char _tempCbm = _cbm[_lengthCbm - 1];
|
|
|
|
|
if (_tempCbm == '0') { _cbm = _cbm.Substring(0, _lengthCbm - 1); }
|
|
|
|
|
else { break; }
|
|
|
|
|
}
|
|
|
|
|
if (_cbm[_cbm.Length - 1] == '.') { _cbm = _cbm.Substring(0, _cbm.Length - 1); }
|
|
|
|
|
data.MEASUREMENT = _cbm + "CBM"; //货物尺码
|
|
|
|
|
data.PKGS = Convert.ToString(_pkgs);//件数
|
|
|
|
|
data.KINDPKGS = Convert.ToString(reader["KINDPKGS"]);//件数包装
|
|
|
|
|
data.KGS = Convert.ToString(_kgs);//毛重
|
|
|
|
|
data.CBM = Convert.ToString(_cbm);//立方数/尺码
|
|
|
|
|
data.TOTALNO = Convert.ToString(reader["TOTALNO"]);//件数大写
|
|
|
|
|
data.CNTRTOTAL = Convert.ToString(reader["CNTRTOTAL"]);//集装箱全部内容
|
|
|
|
|
data.INPUTBY = Convert.ToString(reader["INPUTBY"]);//录入人
|
|
|
|
|
data.OPERATORTEL = Convert.ToString(reader["SenderMobile"]);//录入人
|
|
|
|
|
data.OPERATOREMAIL = Convert.ToString(reader["SenderEmail"]);//录入人
|
|
|
|
|
data.INVNO = Convert.ToString(reader["INVNO"]);//发票号
|
|
|
|
|
data.CARGOID = Convert.ToString(reader["CARGOID"]);//货物标识
|
|
|
|
|
data.HSCODE = Convert.ToString(reader["HSCODE"]);
|
|
|
|
|
data.DCLASS = Convert.ToString(reader["DCLASS"]);//危险品分类/等级
|
|
|
|
|
data.DUNNO = Convert.ToString(reader["DUNNO"]);//危险品编号
|
|
|
|
|
data.DPAGE = Convert.ToString(reader["DPAGE"]);//危险品页号
|
|
|
|
|
data.DLABEL = Convert.ToString(reader["DLABEL"]);//危险品标签
|
|
|
|
|
data.LINKMAN = Convert.ToString(reader["LINKMAN"]);//危险品联系人
|
|
|
|
|
data.REEFERF = Convert.ToString(reader["REEFERF"]);//冷藏通风量
|
|
|
|
|
if (Convert.ToString(reader["TEMPID"]) != "undefined")
|
|
|
|
|
data.TEMPID = Convert.ToString(reader["TEMPID"]);//温度单位
|
|
|
|
|
data.TEMPSET = Convert.ToString(reader["TEMPSET"]);//设置温度
|
|
|
|
|
data.TEMPMAX = Convert.ToString(reader["TEMPMAX"]);//最高温度
|
|
|
|
|
data.TEMPMIN = Convert.ToString(reader["TEMPMIN"]);//最低温度
|
|
|
|
|
data.CUSTOMSNUM = Convert.ToInt32(reader["CUSTOMSNUM"]);//报关票数
|
|
|
|
|
data.REMARK = Convert.ToString(reader["REMARK"]).Replace(@"\\\\", "\n").Replace(@"^", "\'").Replace(@"&-add-", "+");//备注
|
|
|
|
|
if (reader["STATUS1"] != DBNull.Value)
|
|
|
|
|
data.STATUS1 = Convert.ToBoolean(reader["STATUS1"]);//状态1
|
|
|
|
|
if (reader["STATUS2"] != DBNull.Value)
|
|
|
|
|
data.STATUS2 = Convert.ToBoolean(reader["STATUS2"]);//状态2
|
|
|
|
|
if (reader["STATUS3"] != DBNull.Value)
|
|
|
|
|
data.STATUS3 = Convert.ToBoolean(reader["STATUS3"]);//状态3
|
|
|
|
|
if (reader["STATUS4"] != DBNull.Value)
|
|
|
|
|
data.STATUS4 = Convert.ToBoolean(reader["STATUS4"]);//状态4
|
|
|
|
|
if (reader["STATUS5"] != DBNull.Value)
|
|
|
|
|
data.STATUS5 = Convert.ToBoolean(reader["STATUS5"]);//状态5
|
|
|
|
|
if (reader["ISFUMIGATION"] != DBNull.Value)
|
|
|
|
|
data.ISFUMIGATION = Convert.ToBoolean(reader["ISFUMIGATION"]);//熏蒸
|
|
|
|
|
if (reader["ISSTORAGE"] != DBNull.Value)
|
|
|
|
|
data.ISSTORAGE = Convert.ToBoolean(reader["ISSTORAGE"]);//仓储
|
|
|
|
|
if (reader["ISLAND"] != DBNull.Value)
|
|
|
|
|
data.ISLAND = Convert.ToBoolean(reader["ISLAND"]);//陆运
|
|
|
|
|
if (reader["ISCUSTOMS"] != DBNull.Value)
|
|
|
|
|
data.ISCUSTOMS = Convert.ToBoolean(reader["ISCUSTOMS"]);//报关
|
|
|
|
|
if (reader["ISINSPECTION"] != DBNull.Value)
|
|
|
|
|
data.ISINSPECTION = Convert.ToBoolean(reader["ISINSPECTION"]);//报检
|
|
|
|
|
if (reader["ISBOOKING"] != DBNull.Value)
|
|
|
|
|
data.ISBOOKING = Convert.ToBoolean(reader["ISBOOKING"]);//订舱
|
|
|
|
|
if (reader["ISAGENT"] != DBNull.Value)
|
|
|
|
|
data.ISAGENT = Convert.ToBoolean(reader["ISAGENT"]);//使用代理
|
|
|
|
|
if (reader["ISHBLNO"] != DBNull.Value)
|
|
|
|
|
data.ISHBLNO = Convert.ToBoolean(reader["ISHBLNO"]);//分单签单
|
|
|
|
|
if (reader["SERVICE9"] != DBNull.Value)
|
|
|
|
|
data.SERVICE9 = Convert.ToBoolean(reader["SERVICE9"]);//服务项目9
|
|
|
|
|
if (reader["SERVICE10"] != DBNull.Value)
|
|
|
|
|
data.SERVICE10 = Convert.ToBoolean(reader["SERVICE10"]);//服务项目10
|
|
|
|
|
data.STLNAME = Convert.ToString(reader["STLNAME"]);//结算方式
|
|
|
|
|
if (reader["STLDATE"] != DBNull.Value)
|
|
|
|
|
data.STLDATE = Convert.ToDateTime(reader["STLDATE"]).ToString("yyyy-MM-dd");//结算时间
|
|
|
|
|
if (reader["OCEANFEE"] != DBNull.Value)
|
|
|
|
|
data.OCEANFEE = Convert.ToDecimal(reader["OCEANFEE"]);//
|
|
|
|
|
if (reader["ISUSD"] != DBNull.Value)
|
|
|
|
|
data.ISUSD = Convert.ToBoolean(reader["ISUSD"]);//
|
|
|
|
|
if (reader["ISCOMMISSIONBACK"] != DBNull.Value)
|
|
|
|
|
data.ISCOMMISSIONBACK = Convert.ToBoolean(reader["ISCOMMISSIONBACK"]);//
|
|
|
|
|
data.CARRIER = Convert.ToString(reader["CARRIER"]);//船公司
|
|
|
|
|
data.CARRIERATTN = Convert.ToString(reader["CARRIERATTN"]);//船公司
|
|
|
|
|
data.CARRIERTEL = Convert.ToString(reader["CARRIERTEL"]);//船公司
|
|
|
|
|
data.CARRIEREMAIL = Convert.ToString(reader["CARRIEREMAIL"]);//船公司
|
|
|
|
|
data.FORWARDER = Convert.ToString(reader["FORWARDER"]);//订舱公司
|
|
|
|
|
data.FORWARDERATTN = Convert.ToString(reader["FORWARDERATTN"]);//订舱公司
|
|
|
|
|
data.FORWARDERTEL = Convert.ToString(reader["FORWARDERTEL"]);//订舱公司
|
|
|
|
|
data.FORWARDEREMAIL = Convert.ToString(reader["FORWARDEREMAIL"]);//订舱公司
|
|
|
|
|
data.SALE = Convert.ToString(reader["SALE"]);//揽货人
|
|
|
|
|
data.PACKINGTYPE = Convert.ToString(reader["PACKINGTYPE"]);//装箱类型
|
|
|
|
|
data.BLTYPE = Convert.ToString(reader["BLTYPE"]);//装运方式
|
|
|
|
|
data.OP = Convert.ToString(reader["OP"]);//操作员
|
|
|
|
|
data.CUSTSERVICE = Convert.ToString(reader["CUSTSERVICE"]);//客服员
|
|
|
|
|
data.DOC = Convert.ToString(reader["DOC"]);//单证
|
|
|
|
|
data.AUDITOPERATOR = Convert.ToString(reader["AUDITOPERATOR"]);//审核人
|
|
|
|
|
|
|
|
|
|
if (reader["AUDITDATE"] != DBNull.Value)
|
|
|
|
|
data.AUDITDATE = Convert.ToDateTime(reader["AUDITDATE"]).ToString("yyyy-MM-dd HH:mm:ss");//截港日期
|
|
|
|
|
if (reader["CONFIRMDATE"] != DBNull.Value)
|
|
|
|
|
data.CONFIRMDATE = Convert.ToDateTime(reader["CONFIRMDATE"]).ToString("yyyy-MM-dd HH:mm:ss");//截港日期
|
|
|
|
|
data.CONFIRMOP = Convert.ToString(reader["CONFIRMOP"]);//确认人
|
|
|
|
|
data.OPERATORTEL = Convert.ToString(reader["SenderMobile"]);//
|
|
|
|
|
data.OPERATOREMAIL = Convert.ToString(reader["SenderEmail"]);//
|
|
|
|
|
if (data.OPERATORTEL != "")
|
|
|
|
|
data.OPERATORTEL = Convert.ToString(reader["OPERATORTEL"]);//
|
|
|
|
|
if (data.OPERATOREMAIL != "")
|
|
|
|
|
data.OPERATOREMAIL = Convert.ToString(reader["OPERATOREMAIL"]);//
|
|
|
|
|
data.OPERATOR = Convert.ToString(reader["OPERATOR"]);//
|
|
|
|
|
data.FBP = Convert.ToString(reader["FBP"]);//
|
|
|
|
|
data.DESTFBP = Convert.ToString(reader["DESTFBP"]);//
|
|
|
|
|
data.MAXWEIGHT = Convert.ToString(reader["MAXWEIGHT"]);//
|
|
|
|
|
data.PLANPROFIT = Convert.ToString(reader["PLANPROFIT"]);//
|
|
|
|
|
data.CONTRACTNO = Convert.ToString(reader["CONTRACTNO"]);
|
|
|
|
|
data.AMSShipper = Convert.ToString(reader["AMSSHIPPER"]).Replace(@"\\\\", "\n").Replace(@"^", "\'").Replace(@"&-add-", "+");
|
|
|
|
|
data.AMSConsignee = Convert.ToString(reader["AMSCONSIGNEE"]).Replace(@"\\\\", "\n").Replace(@"^", "\'").Replace(@"&-add-", "+");
|
|
|
|
|
data.AMSNotifyparty = Convert.ToString(reader["AMSNOTIFYPARTY"]).Replace(@"\\\\", "\n").Replace(@"^", "\'").Replace(@"&-add-", "+");
|
|
|
|
|
data.AGENTID = Convert.ToString(reader["AGENTID"]);//
|
|
|
|
|
data.AGENT = Convert.ToString(reader["AGENT"]);//
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
headList.Add(data);
|
|
|
|
|
}
|
|
|
|
|
reader.Close();
|
|
|
|
|
}
|
|
|
|
|
return headList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static public MsSeaeOrder GetWebData(string condition)
|
|
|
|
|
{
|
|
|
|
|
var strSql = new StringBuilder();
|
|
|
|
|
strSql.Append("SELECT top 50 BSNO ORDNO,BSNO,BSSTATUS as ORSTATUS,BLTYPE,BSDATE, ");
|
|
|
|
|
strSql.AppendLine("case when (select COUNT(*) from dbo.BookingCargoSpaceChange where userID != '' and fieldName='MBLNO' and isContainer=0 and dbo.BookingCargoSpaceChange.BSNO=B.BSNO and del_sign=0)=0 then MBLNO else (select fieldValue from dbo.BookingCargoSpaceChange where userID != '' and fieldName='MBLNO' and isContainer=0 and BSNO=B.BSNO and del_sign=0) end AS MBLNO, ");
|
|
|
|
|
strSql.AppendLine("case when (select COUNT(*) from dbo.BookingCargoSpaceChange where userID != '' and fieldName='SHIPPER' and isContainer=0 and dbo.BookingCargoSpaceChange.BSNO=B.BSNO and del_sign=0)=0 then SHIPPER else (select fieldValue from dbo.BookingCargoSpaceChange where userID != '' and fieldName='SHIPPER' and isContainer=0 and BSNO=B.BSNO and del_sign=0) end AS SHIPPER, ");
|
|
|
|
|
strSql.AppendLine("case when (select COUNT(*) from dbo.BookingCargoSpaceChange where userID != '' and fieldName='CONSIGNEE' and isContainer=0 and dbo.BookingCargoSpaceChange.BSNO=B.BSNO and del_sign=0)=0 then CONSIGNEE else (select fieldValue from dbo.BookingCargoSpaceChange where userID != '' and fieldName='CONSIGNEE' and isContainer=0 and BSNO=B.BSNO and del_sign=0) end AS CONSIGNEE, ");
|
|
|
|
|
strSql.AppendLine("case when (select COUNT(*) from dbo.BookingCargoSpaceChange where userID != '' and fieldName='NOTIFYPARTY' and isContainer=0 and dbo.BookingCargoSpaceChange.BSNO=B.BSNO and del_sign=0)=0 then NOTIFYPARTY else (select fieldValue from dbo.BookingCargoSpaceChange where userID != '' and fieldName='NOTIFYPARTY' and isContainer=0 and BSNO=B.BSNO and del_sign=0) end AS NOTIFYPARTY, ");
|
|
|
|
|
strSql.AppendLine("case when (select COUNT(*) from dbo.BookingCargoSpaceChange where userID != '' and fieldName='VESSEL' and isContainer=0 and dbo.BookingCargoSpaceChange.BSNO=B.BSNO and del_sign=0)=0 then VESSEL else (select fieldValue from dbo.BookingCargoSpaceChange where userID != '' and fieldName='VESSEL' and isContainer=0 and BSNO=B.BSNO and del_sign=0) end AS VESSEL, ");
|
|
|
|
|
strSql.AppendLine("case when (select COUNT(*) from dbo.BookingCargoSpaceChange where userID != '' and fieldName='VOYNO' and isContainer=0 and dbo.BookingCargoSpaceChange.BSNO=B.BSNO and del_sign=0)=0 then VOYNO else (select fieldValue from dbo.BookingCargoSpaceChange where userID != '' and fieldName='VOYNO' and isContainer=0 and BSNO=B.BSNO and del_sign=0) end AS VOYNO, ");
|
|
|
|
|
strSql.AppendLine("case when (select COUNT(*) from dbo.BookingCargoSpaceChange where userID != '' and fieldName='PlACERECEIPT' and isContainer=0 and dbo.BookingCargoSpaceChange.BSNO=B.BSNO and del_sign=0)=0 then PlACERECEIPT else (select fieldValue from dbo.BookingCargoSpaceChange where userID != '' and fieldName='PlACERECEIPT' and isContainer=0 and BSNO=B.BSNO and del_sign=0) end AS PlACERECEIPT, ");
|
|
|
|
|
strSql.AppendLine("case when (select COUNT(*) from dbo.BookingCargoSpaceChange where userID != '' and fieldName='PORTLOAD' and isContainer=0 and dbo.BookingCargoSpaceChange.BSNO=B.BSNO and del_sign=0)=0 then PORTLOAD else (select fieldValue from dbo.BookingCargoSpaceChange where userID != '' and fieldName='PORTLOAD' and isContainer=0 and BSNO=B.BSNO and del_sign=0) end AS PORTLOAD, ");
|
|
|
|
|
strSql.AppendLine("case when (select COUNT(*) from dbo.BookingCargoSpaceChange where userID != '' and fieldName='PORTDISCHARGE' and isContainer=0 and dbo.BookingCargoSpaceChange.BSNO=B.BSNO and del_sign=0)=0 then PORTDISCHARGE else (select fieldValue from dbo.BookingCargoSpaceChange where userID != '' and fieldName='PORTDISCHARGE' and isContainer=0 and BSNO=B.BSNO and del_sign=0) end AS PORTDISCHARGE, ");
|
|
|
|
|
strSql.AppendLine("case when (select COUNT(*) from dbo.BookingCargoSpaceChange where userID != '' and fieldName='PLACEDELIVERY' and isContainer=0 and dbo.BookingCargoSpaceChange.BSNO=B.BSNO and del_sign=0)=0 then PLACEDELIVERY else (select fieldValue from dbo.BookingCargoSpaceChange where userID != '' and fieldName='PLACEDELIVERY' and isContainer=0 and BSNO=B.BSNO and del_sign=0) end AS PLACEDELIVERY, ");
|
|
|
|
|
strSql.AppendLine("case when (select COUNT(*) from dbo.BookingCargoSpaceChange where userID != '' and fieldName='BLFRT' and isContainer=0 and dbo.BookingCargoSpaceChange.BSNO=B.BSNO and del_sign=0)=0 then BLFRT else (select fieldValue from dbo.BookingCargoSpaceChange where userID != '' and fieldName='BLFRT' and isContainer=0 and BSNO=B.BSNO and del_sign=0) end AS BLFRT, ");
|
|
|
|
|
strSql.AppendLine("case when (select COUNT(*) from dbo.BookingCargoSpaceChange where userID != '' and fieldName='SERVICE' and isContainer=0 and dbo.BookingCargoSpaceChange.BSNO=B.BSNO and del_sign=0)=0 then [SERVICE] else (select fieldValue from dbo.BookingCargoSpaceChange where userID != '' and fieldName='SERVICE' and isContainer=0 and BSNO=B.BSNO and del_sign=0) end AS [SERVICE], ");
|
|
|
|
|
strSql.AppendLine("case when (select COUNT(*) from dbo.BookingCargoSpaceChange where userID != '' and fieldName='MARKS' and isContainer=0 and dbo.BookingCargoSpaceChange.BSNO=B.BSNO and del_sign=0)=0 then MARKS else (select fieldValue from dbo.BookingCargoSpaceChange where userID != '' and fieldName='MARKS' and isContainer=0 and BSNO=B.BSNO and del_sign=0) end AS MARKS, ");
|
|
|
|
|
strSql.AppendLine("case when (select COUNT(*) from dbo.BookingCargoSpaceChange where userID != '' and fieldName='DESCRIPTION' and isContainer=0 and dbo.BookingCargoSpaceChange.BSNO=B.BSNO and del_sign=0)=0 then [DESCRIPTION] else (select fieldValue from dbo.BookingCargoSpaceChange where userID != '' and fieldName='DESCRIPTION' and isContainer=0 and BSNO=B.BSNO and del_sign=0) end AS [DESCRIPTION], ");
|
|
|
|
|
strSql.AppendLine("case when (select COUNT(*) from dbo.BookingCargoSpaceChange where userID != '' and fieldName='GOODSNAME' and isContainer=0 and dbo.BookingCargoSpaceChange.BSNO=B.BSNO and del_sign=0)=0 then GOODSNAME else (select fieldValue from dbo.BookingCargoSpaceChange where userID != '' and fieldName='GOODSNAME' and isContainer=0 and BSNO=B.BSNO and del_sign=0) end AS GOODSNAME, ");
|
|
|
|
|
strSql.AppendLine("case when (select COUNT(*) from dbo.BookingCargoSpaceChange where userID != '' and fieldName='GROSSWEIGHT' and isContainer=0 and dbo.BookingCargoSpaceChange.BSNO=B.BSNO and del_sign=0)=0 then GROSSWEIGHT else (select fieldValue from dbo.BookingCargoSpaceChange where userID != '' and fieldName='GROSSWEIGHT' and isContainer=0 and BSNO=B.BSNO and del_sign=0) end AS GROSSWEIGHT, ");
|
|
|
|
|
strSql.AppendLine("case when (select COUNT(*) from dbo.BookingCargoSpaceChange where userID != '' and fieldName='MEASUREMENT' and isContainer=0 and dbo.BookingCargoSpaceChange.BSNO=B.BSNO and del_sign=0)=0 then MEASUREMENT else (select fieldValue from dbo.BookingCargoSpaceChange where userID != '' and fieldName='MEASUREMENT' and isContainer=0 and BSNO=B.BSNO and del_sign=0) end AS MEASUREMENT, ");
|
|
|
|
|
strSql.AppendLine("case when (select COUNT(*) from dbo.BookingCargoSpaceChange where userID != '' and fieldName='PKGS' and isContainer=0 and dbo.BookingCargoSpaceChange.BSNO=B.BSNO and del_sign=0)=0 then PKGS else (select fieldValue from dbo.BookingCargoSpaceChange where userID != '' and fieldName='PKGS' and isContainer=0 and BSNO=B.BSNO and del_sign=0) end AS PKGS, ");
|
|
|
|
|
strSql.AppendLine("case when (select COUNT(*) from dbo.BookingCargoSpaceChange where userID != '' and fieldName='KINDPKGS' and isContainer=0 and dbo.BookingCargoSpaceChange.BSNO=B.BSNO and del_sign=0)=0 then KINDPKGS else (select fieldValue from dbo.BookingCargoSpaceChange where userID != '' and fieldName='KINDPKGS' and isContainer=0 and BSNO=B.BSNO and del_sign=0) end AS KINDPKGS, ");
|
|
|
|
|
strSql.AppendLine("case when (select COUNT(*) from dbo.BookingCargoSpaceChange where userID != '' and fieldName='KGS' and isContainer=0 and dbo.BookingCargoSpaceChange.BSNO=B.BSNO and del_sign=0)=0 then KGS else (select fieldValue from dbo.BookingCargoSpaceChange where userID != '' and fieldName='KGS' and isContainer=0 and BSNO=B.BSNO and del_sign=0) end AS KGS, ");
|
|
|
|
|
strSql.AppendLine("case when (select COUNT(*) from dbo.BookingCargoSpaceChange where userID != '' and fieldName='CBM' and isContainer=0 and dbo.BookingCargoSpaceChange.BSNO=B.BSNO and del_sign=0)=0 then CBM else (select fieldValue from dbo.BookingCargoSpaceChange where userID != '' and fieldName='CBM' and isContainer=0 and BSNO=B.BSNO and del_sign=0) end AS CBM, ");
|
|
|
|
|
strSql.AppendLine("case when (select COUNT(*) from dbo.BookingCargoSpaceChange where userID != '' and fieldName='TOTALNO' and isContainer=0 and dbo.BookingCargoSpaceChange.BSNO=B.BSNO and del_sign=0)=0 then TOTALNO else (select fieldValue from dbo.BookingCargoSpaceChange where userID != '' and fieldName='TOTALNO' and isContainer=0 and BSNO=B.BSNO and del_sign=0) end AS TOTALNO, ");
|
|
|
|
|
strSql.AppendLine("case when (select COUNT(*) from dbo.BookingCargoSpaceChange where userID != '' and fieldName='CNTR' and isContainer=0 and dbo.BookingCargoSpaceChange.BSNO=B.BSNO and del_sign=0)=0 then CNTR else (select fieldValue from dbo.BookingCargoSpaceChange where userID != '' and fieldName='CNTR' and isContainer=0 and BSNO=B.BSNO and del_sign=0) end AS CNTRTOTAL, ");
|
|
|
|
|
strSql.AppendLine("case when (select COUNT(*) from dbo.BookingCargoSpaceChange where userID != '' and fieldName='CARGOID' and isContainer=0 and dbo.BookingCargoSpaceChange.BSNO=B.BSNO and del_sign=0)=0 then CARGOID else (select fieldValue from dbo.BookingCargoSpaceChange where userID != '' and fieldName='CARGOID' and isContainer=0 and BSNO=B.BSNO and del_sign=0) end AS CARGOID, ");
|
|
|
|
|
strSql.AppendLine("case when (select COUNT(*) from dbo.BookingCargoSpaceChange where userID != '' and fieldName='DCLASS' and isContainer=0 and dbo.BookingCargoSpaceChange.BSNO=B.BSNO and del_sign=0)=0 then DCLASS else (select fieldValue from dbo.BookingCargoSpaceChange where userID != '' and fieldName='DCLASS' and isContainer=0 and BSNO=B.BSNO and del_sign=0) end AS DCLASS, ");
|
|
|
|
|
strSql.AppendLine("case when (select COUNT(*) from dbo.BookingCargoSpaceChange where userID != '' and fieldName='DUNNO' and isContainer=0 and dbo.BookingCargoSpaceChange.BSNO=B.BSNO and del_sign=0)=0 then DUNNO else (select fieldValue from dbo.BookingCargoSpaceChange where userID != '' and fieldName='DUNNO' and isContainer=0 and BSNO=B.BSNO and del_sign=0) end AS DUNNO, ");
|
|
|
|
|
strSql.AppendLine("case when (select COUNT(*) from dbo.BookingCargoSpaceChange where userID != '' and fieldName='REEFERF' and isContainer=0 and dbo.BookingCargoSpaceChange.BSNO=B.BSNO and del_sign=0)=0 then REEFERF else (select fieldValue from dbo.BookingCargoSpaceChange where userID != '' and fieldName='REEFERF' and isContainer=0 and BSNO=B.BSNO and del_sign=0) end AS REEFERF, ");
|
|
|
|
|
strSql.AppendLine("case when (select COUNT(*) from dbo.BookingCargoSpaceChange where userID != '' and fieldName='TEMPID' and isContainer=0 and dbo.BookingCargoSpaceChange.BSNO=B.BSNO and del_sign=0)=0 then TEMPID else (select fieldValue from dbo.BookingCargoSpaceChange where userID != '' and fieldName='TEMPID' and isContainer=0 and BSNO=B.BSNO and del_sign=0) end AS TEMPID, ");
|
|
|
|
|
strSql.AppendLine("case when (select COUNT(*) from dbo.BookingCargoSpaceChange where userID != '' and fieldName='TEMPSET' and isContainer=0 and dbo.BookingCargoSpaceChange.BSNO=B.BSNO and del_sign=0)=0 then TEMPSET else (select fieldValue from dbo.BookingCargoSpaceChange where userID != '' and fieldName='TEMPSET' and isContainer=0 and BSNO=B.BSNO and del_sign=0) end AS TEMPSET, ");
|
|
|
|
|
strSql.AppendLine("case when (select COUNT(*) from dbo.BookingCargoSpaceChange where userID != '' and fieldName='BOOKINGDESCRIPTION' and isContainer=0 and dbo.BookingCargoSpaceChange.BSNO=B.BSNO and del_sign=0)=0 then BOOKINGDESCRIPTION else (select fieldValue from dbo.BookingCargoSpaceChange where userID != '' and fieldName='BOOKINGDESCRIPTION' and isContainer=0 and BSNO=B.BSNO and del_sign=0) end AS REMARK, ");
|
|
|
|
|
strSql.AppendLine("case when (select COUNT(*) from dbo.BookingCargoSpaceChange where userID != '' and fieldName='DPAGE' and isContainer=0 and dbo.BookingCargoSpaceChange.BSNO=B.BSNO and del_sign=0)=0 then DPAGE else (select fieldValue from dbo.BookingCargoSpaceChange where userID != '' and fieldName='DPAGE' and isContainer=0 and BSNO=B.BSNO and del_sign=0) end AS DPAGE, ");
|
|
|
|
|
strSql.AppendLine("case when (select COUNT(*) from dbo.BookingCargoSpaceChange where userID != '' and fieldName='DLABEL' and isContainer=0 and dbo.BookingCargoSpaceChange.BSNO=B.BSNO and del_sign=0)=0 then DLABEL else (select fieldValue from dbo.BookingCargoSpaceChange where userID != '' and fieldName='DLABEL' and isContainer=0 and BSNO=B.BSNO and del_sign=0) end AS DLABEL, ");
|
|
|
|
|
strSql.AppendLine("case when (select COUNT(*) from dbo.BookingCargoSpaceChange where userID != '' and fieldName='LINKMAN' and isContainer=0 and dbo.BookingCargoSpaceChange.BSNO=B.BSNO and del_sign=0)=0 then LINKMAN else (select fieldValue from dbo.BookingCargoSpaceChange where userID != '' and fieldName='LINKMAN' and isContainer=0 and BSNO=B.BSNO and del_sign=0) end AS LINKMAN, ");
|
|
|
|
|
strSql.AppendLine("case when (select COUNT(*) from dbo.BookingCargoSpaceChange where userID != '' and fieldName='ISSUEWAY' and isContainer=0 and dbo.BookingCargoSpaceChange.BSNO=B.BSNO and del_sign=0)=0 then ISSUEWAY else (select fieldValue from dbo.BookingCargoSpaceChange where userID != '' and fieldName='ISSUEWAY' and isContainer=0 and BSNO=B.BSNO and del_sign=0) end AS ISSUETYPE, ");
|
|
|
|
|
strSql.AppendLine("case when (select COUNT(*) from dbo.BookingCargoSpaceChange where userID != '' and fieldName='BILLNUM' and isContainer=0 and dbo.BookingCargoSpaceChange.BSNO=B.BSNO and del_sign=0)=0 then BILLNUM else (select fieldValue from dbo.BookingCargoSpaceChange where userID != '' and fieldName='BILLNUM' and isContainer=0 and BSNO=B.BSNO and del_sign=0) end AS BILLNUM, ");
|
|
|
|
|
strSql.Append("(Select name from Company where companyID=B.companyID) as CUSTOMERNAME, ");
|
|
|
|
|
strSql.Append("'网上订舱' ORDTYPE,SHIPPERID,CONSIGNEEID,NOTIFYPARTYID,ETD,PORTLOADID,PORTDISCHARGEID, ");
|
|
|
|
|
strSql.Append("PLACEDELIVERYID,DESTINATIONID,DESTINATION,ISSUEDATE,ISSUEPLACE,PREPARDAT,PAYABLEAT,HSCODE,'' AGENTID,'' AGENT, ");//NOBILL,ISSUETYPE,
|
|
|
|
|
strSql.Append("NOPKGS,(SELECT userName FROM UserInfo WHERE userID=B.INPUTBY) INPUTBY, ");
|
|
|
|
|
strSql.Append("'' INVNO,0 CUSTOMSNUM,STATUS1,STATUS2,STATUS3,STATUS4,STATUS5,0 ISFUMIGATION,TEMPMAX,TEMPMIN, ");
|
|
|
|
|
strSql.Append("0 ISSTORAGE,0 ISLAND,0 ISCUSTOMS,0 ISINSPECTION,0 ISBOOKING,0 ISAGENT,0 ISHBLNO, ");
|
|
|
|
|
strSql.Append("0 SERVICE9,0 SERVICE10,'' STLNAME,null STLDATE,0 OCEANFEE,0 ISUSD, ");
|
|
|
|
|
strSql.Append("0 ISCOMMISSIONBACK,CARRIER,'' CARRIERATTN,'' CARRIERTEL,'' CARRIEREMAIL, ");
|
|
|
|
|
strSql.Append("'' FORWARDER,'' FORWARDERATTN,'' FORWARDERTEL,'' FORWARDEREMAIL,'' SALE, ");
|
|
|
|
|
strSql.Append("PACKINGTYPE,'' BLTYPE,OP,'' CUSTSERVICE,'' doc, ");
|
|
|
|
|
strSql.Append("(SELECT userName FROM UserInfo WHERE userID=B.AUDITOR) AUDITOPERATOR, ");
|
|
|
|
|
strSql.Append("'' AUDITDATE, ");
|
|
|
|
|
strSql.Append("(Select className from InfoClass where classID=B.BSSTATUS) as ORSTATUSREF , ");
|
|
|
|
|
strSql.Append("(select top 1 Remark from BookingCargoSpaceStatus where flowid=B.BSSTATUS and bsno=B.bsno order by subdate desc) ORREASON , ");
|
|
|
|
|
strSql.Append("(select mobile from userinfo where userid=inputby) SenderMobile, ");
|
|
|
|
|
strSql.Append("(select email from userinfo where userid=inputby) SenderEmail ,CUSTNO, ");
|
|
|
|
|
strSql.Append("CONTRACTNO,AMSSHIPPER,AMSCONSIGNEE,AMSNOTIFYPARTY,'' CONFIRMOP,null CONFIRMDATE,'' OPERATOR,'' OPERATORTEL,'0' FBP,'0' DESTFBP,'' MAXWEIGHT,'' PLANPROFIT,'' OPERATOREMAIL ");
|
|
|
|
|
strSql.Append(" from BookingCargoSpace B");
|
|
|
|
|
if (!string.IsNullOrEmpty(condition))
|
|
|
|
|
{
|
|
|
|
|
strSql.Append(" where " + condition);
|
|
|
|
|
}
|
|
|
|
|
var list = SetWebData(strSql, "SHIPPINGBOX");
|
|
|
|
|
if (list.Count > 0)
|
|
|
|
|
return list[0];
|
|
|
|
|
return new MsSeaeOrder();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static public List<MsOpSeaeWebOrderCtn> GetWebBodyList(string strCondition)
|
|
|
|
|
{
|
|
|
|
|
var strSql = new StringBuilder();
|
|
|
|
|
|
|
|
|
|
/*strSql.AppendLine("if(exists(select * from BookingCargoContainer where " + strCondition + " and del_sign is null)) ");
|
|
|
|
|
strSql.AppendLine("begin ");
|
|
|
|
|
strSql.AppendLine("select CTN_ID as id,BSNO,CTN,CTNNUM,CNTRNO,SEALNO,PKGS,KGS,CBM,KINDPKGS,[CTN_EXHIBIT] as CTNALL,CTNCODE,SIZE,REMARK ");
|
|
|
|
|
strSql.AppendLine("from BookingCargoContainer where " + strCondition + " and (del_sign=0 or del_sign is null) ");
|
|
|
|
|
strSql.AppendLine("end ");
|
|
|
|
|
strSql.AppendLine("else ");
|
|
|
|
|
strSql.AppendLine("begin ");
|
|
|
|
|
strSql.AppendLine("select CTN_ID as id,BSNO,CTN,CTNNUM,CNTRNO,SEALNO,PKGS,KGS,CBM,KINDPKGS,[CTN_EXHIBIT] as CTNALL,CTNCODE,SIZE,REMARK ");
|
|
|
|
|
strSql.AppendLine("from BookingCargoContainer where " + strCondition + " and (del_sign!=1) ");
|
|
|
|
|
strSql.AppendLine("UNION ");
|
|
|
|
|
strSql.AppendLine("select distinct A.CTN_ID as id,A.BSNO, ");
|
|
|
|
|
strSql.AppendLine("(select B.fieldValue from BookingCargoSpaceChange as B where B.changeID=A.changeID and B.isContainer=1 and B.fieldName='CTN' ) as CTN, ");
|
|
|
|
|
strSql.AppendLine("(select B.fieldValue from BookingCargoSpaceChange as B where B.changeID=A.changeID and B.isContainer=1 and B.fieldName='CTNNUM' ) as CTNNUM, ");
|
|
|
|
|
strSql.AppendLine("(select B.fieldValue from BookingCargoSpaceChange as B where B.changeID=A.changeID and B.isContainer=1 and B.fieldName='CNTRNO' ) as CNTRNO, ");
|
|
|
|
|
strSql.AppendLine("(select B.fieldValue from BookingCargoSpaceChange as B where B.changeID=A.changeID and B.isContainer=1 and B.fieldName='SEALNO' ) as SEALNO, ");
|
|
|
|
|
strSql.AppendLine("(select B.fieldValue from BookingCargoSpaceChange as B where B.changeID=A.changeID and B.isContainer=1 and B.fieldName='PKGS' ) as PKGS, ");
|
|
|
|
|
strSql.AppendLine("(select B.fieldValue from BookingCargoSpaceChange as B where B.changeID=A.changeID and B.isContainer=1 and B.fieldName='KGS' ) as KGS, ");
|
|
|
|
|
strSql.AppendLine("(select B.fieldValue from BookingCargoSpaceChange as B where B.changeID=A.changeID and B.isContainer=1 and B.fieldName='CBM' ) as CBM, ");
|
|
|
|
|
strSql.AppendLine("(select B.fieldValue from BookingCargoSpaceChange as B where B.changeID=A.changeID and B.isContainer=1 and B.fieldName='KINDPKGS' ) as KINDPKGS, ");
|
|
|
|
|
strSql.AppendLine("(select top 1 C.boxType from BookingCargoSpaceChange as B left join BoxTypeInfo as C on B.fieldValue=C.boxTypeID where B.changeID=A.changeID and B.isContainer=1 and B.fieldName='CTN' and C.del_sign=0 ) as CTNALL, ");
|
|
|
|
|
strSql.AppendLine("'' as CTNCODE,'' as SIZE,'' as REMARK ");
|
|
|
|
|
strSql.AppendLine("from BookingCargoSpaceChange as A ");
|
|
|
|
|
strSql.AppendLine("where A." + strCondition + " and A.del_sign=0 and A.CTN_ID!='' ");
|
|
|
|
|
strSql.AppendLine("end ");*/
|
|
|
|
|
|
|
|
|
|
strSql.AppendLine("if(exists(select * from BookingCargoSpaceChange where " + strCondition + " and isContainer=1 and del_sign=0)) ");
|
|
|
|
|
strSql.AppendLine("begin ");
|
|
|
|
|
strSql.AppendLine("select distinct A.CTN_ID as id,A.BSNO, ");
|
|
|
|
|
strSql.AppendLine("(select B.fieldValue from BookingCargoSpaceChange as B where B.changeID=A.changeID and B.isContainer=1 and B.fieldName='CTN' ) as CTN, ");
|
|
|
|
|
strSql.AppendLine("(select B.fieldValue from BookingCargoSpaceChange as B where B.changeID=A.changeID and B.isContainer=1 and B.fieldName='CTNNUM' ) as CTNNUM, ");
|
|
|
|
|
strSql.AppendLine("(select B.fieldValue from BookingCargoSpaceChange as B where B.changeID=A.changeID and B.isContainer=1 and B.fieldName='CNTRNO' ) as CNTRNO, ");
|
|
|
|
|
strSql.AppendLine("(select B.fieldValue from BookingCargoSpaceChange as B where B.changeID=A.changeID and B.isContainer=1 and B.fieldName='SEALNO' ) as SEALNO, ");
|
|
|
|
|
strSql.AppendLine("(select B.fieldValue from BookingCargoSpaceChange as B where B.changeID=A.changeID and B.isContainer=1 and B.fieldName='PKGS' ) as PKGS, ");
|
|
|
|
|
strSql.AppendLine("(select B.fieldValue from BookingCargoSpaceChange as B where B.changeID=A.changeID and B.isContainer=1 and B.fieldName='KGS' ) as KGS, ");
|
|
|
|
|
strSql.AppendLine("(select B.fieldValue from BookingCargoSpaceChange as B where B.changeID=A.changeID and B.isContainer=1 and B.fieldName='CBM' ) as CBM, ");
|
|
|
|
|
strSql.AppendLine("(select B.fieldValue from BookingCargoSpaceChange as B where B.changeID=A.changeID and B.isContainer=1 and B.fieldName='KINDPKGS' ) as KINDPKGS, ");
|
|
|
|
|
strSql.AppendLine("(select top 1 C.boxType from BookingCargoSpaceChange as B left join BoxTypeInfo as C on B.fieldValue=C.boxTypeID where B.changeID=A.changeID and B.isContainer=1 and B.fieldName='CTN' and C.del_sign=0 ) as CTNALL, ");
|
|
|
|
|
strSql.AppendLine("'' as CTNCODE,'' as SIZE,'' as REMARK ");
|
|
|
|
|
strSql.AppendLine("from BookingCargoSpaceChange as A ");
|
|
|
|
|
strSql.AppendLine("where A." + strCondition + " and A.del_sign=0 and A.CTN_ID!='' ");
|
|
|
|
|
strSql.AppendLine("union ");
|
|
|
|
|
strSql.AppendLine("select CTN_ID,BSNO, ");
|
|
|
|
|
strSql.AppendLine("CTN,CTNNUM,CNTRNO,SEALNO,PKGS,KGS,CBM,KINDPKGS, ");
|
|
|
|
|
strSql.AppendLine("(select top 1 boxType from BoxTypeInfo where boxTypeID=A.CTN) as CTNALL, ");
|
|
|
|
|
strSql.AppendLine("'' as CTNCODE,'' as SIZE,'' as REMARK ");
|
|
|
|
|
strSql.AppendLine("from BookingCargoContainer as A ");
|
|
|
|
|
strSql.AppendLine("where " + strCondition + " and del_sign=0 ");
|
|
|
|
|
strSql.AppendLine("UNION ");
|
|
|
|
|
strSql.AppendLine("select CTN_ID,BSNO, ");
|
|
|
|
|
strSql.AppendLine("CTN,CTNNUM,CNTRNO,SEALNO,PKGS,KGS,CBM,KINDPKGS, ");
|
|
|
|
|
strSql.AppendLine("(select top 1 boxType from BoxTypeInfo where boxTypeID=A.CTN) as CTNALL, ");
|
|
|
|
|
strSql.AppendLine("'' as CTNCODE,'' as SIZE,'' as REMARK ");
|
|
|
|
|
strSql.AppendLine("from BookingCargoContainer as A ");
|
|
|
|
|
strSql.AppendLine("where " + strCondition + " and del_sign IS NULL ");
|
|
|
|
|
strSql.AppendLine("end");
|
|
|
|
|
strSql.AppendLine("else");
|
|
|
|
|
strSql.AppendLine("begin ");
|
|
|
|
|
strSql.AppendLine("select CTN_ID as id,BSNO,CTN,CTNNUM,CNTRNO,SEALNO,PKGS,KGS,CBM,KINDPKGS, ");
|
|
|
|
|
strSql.AppendLine("(select top 1 C.boxType from BoxTypeInfo as C where C.boxTypeID=A.CTN ) as CTNALL,");
|
|
|
|
|
strSql.AppendLine("'' as CTNCODE,'' as SIZE,'' as REMARK ");
|
|
|
|
|
strSql.AppendLine("from BookingCargoContainer as A where " + strCondition + " and (del_sign=0 or del_sign is null) ");
|
|
|
|
|
strSql.AppendLine("end");
|
|
|
|
|
|
|
|
|
|
return SetWebBodyData(strSql);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static List<MsOpSeaeWebOrderCtn> SetWebBodyData(StringBuilder strSql)
|
|
|
|
|
{
|
|
|
|
|
var bodyList = new List<MsOpSeaeWebOrderCtn>();
|
|
|
|
|
Database db = DatabaseFactory.CreateDatabase("SHIPPINGBOX");
|
|
|
|
|
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
|
|
|
|
|
{
|
|
|
|
|
while (reader.Read())
|
|
|
|
|
{
|
|
|
|
|
MsOpSeaeWebOrderCtn data = new MsOpSeaeWebOrderCtn();
|
|
|
|
|
#region Set DB data to Object
|
|
|
|
|
data.CTN_ID = Convert.ToString(reader["id"]);//编号 CTN_ID
|
|
|
|
|
data.BSNO = Convert.ToString(reader["BSNO"]);//业务编号
|
|
|
|
|
data.CTNCODE = Convert.ToString(reader["CTNCODE"]);//箱型代码
|
|
|
|
|
data.SIZE = Convert.ToString(reader["SIZE"]);//尺寸
|
|
|
|
|
data.CTN = Convert.ToString(reader["CTN"]);//箱型
|
|
|
|
|
data.CTNEXHIBIT = Convert.ToString(reader["CTNALL"]);//箱型
|
|
|
|
|
data.CTNALL = Convert.ToString(reader["CTNALL"]);//CTNALL
|
|
|
|
|
data.CTNNUM = Convert.ToInt32(reader["CTNNUM"]);//箱量
|
|
|
|
|
data.CNTRNO = Convert.ToString(reader["CNTRNO"]);//箱号
|
|
|
|
|
data.SEALNO = Convert.ToString(reader["SEALNO"]);//封号
|
|
|
|
|
if (reader["PKGS"] != DBNull.Value)
|
|
|
|
|
data.PKGS = Convert.ToInt32(reader["PKGS"]);//件数
|
|
|
|
|
if (reader["KGS"] != DBNull.Value)
|
|
|
|
|
data.KGS = Convert.ToDecimal(reader["KGS"]);//重量(货重)
|
|
|
|
|
if (reader["CBM"] != DBNull.Value)
|
|
|
|
|
data.CBM = Convert.ToDecimal(reader["CBM"]);//尺码
|
|
|
|
|
data.REMARK = Convert.ToString(reader["REMARK"]);//备注
|
|
|
|
|
data.KINDPKGS = Convert.ToString(reader["KINDPKGS"]);//包装类型
|
|
|
|
|
#endregion
|
|
|
|
|
bodyList.Add(data);
|
|
|
|
|
}
|
|
|
|
|
reader.Close();
|
|
|
|
|
}
|
|
|
|
|
return bodyList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static public List<MsSeaeOrderStatus> GetOrderStatus(string strCondition)
|
|
|
|
|
{
|
|
|
|
|
var strSql = new StringBuilder();
|
|
|
|
|
strSql.Append("SELECT classID,className from InfoClass where parentID='CI20150711000001' OR parentID='CI_BLC' ");
|
|
|
|
|
strSql.Append(" order by classID ");
|
|
|
|
|
return SetOrderStatusData(strSql);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static List<MsSeaeOrderStatus> SetOrderStatusData(StringBuilder strSql)
|
|
|
|
|
{
|
|
|
|
|
var bodyList = new List<MsSeaeOrderStatus>();
|
|
|
|
|
Database db = DatabaseFactory.CreateDatabase("SHIPPINGBOX");
|
|
|
|
|
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
|
|
|
|
|
{
|
|
|
|
|
while (reader.Read())
|
|
|
|
|
{
|
|
|
|
|
MsSeaeOrderStatus data = new MsSeaeOrderStatus();
|
|
|
|
|
#region Set DB data to Object
|
|
|
|
|
data.STATUS_ID = Convert.ToString(reader["classID"]);//编号
|
|
|
|
|
data.STATUSSTR = Convert.ToString(reader["className"]);//业务编号
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
bodyList.Add(data);
|
|
|
|
|
}
|
|
|
|
|
reader.Close();
|
|
|
|
|
}
|
|
|
|
|
return bodyList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*********************************************/
|
|
|
|
|
/* */
|
|
|
|
|
/*********************************************/
|
|
|
|
|
public static DBResult WebAddOrderDetail(string bsno, List<MsOpSeaeWebOrderCtn> orderCtnlist)
|
|
|
|
|
{
|
|
|
|
|
var result = new DBResult();
|
|
|
|
|
Hashtable ht = new Hashtable();
|
|
|
|
|
|
|
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
|
|
Database db2=DatabaseFactory.CreateDatabase();
|
|
|
|
|
|
|
|
|
|
using (var conn = db.CreateConnection())
|
|
|
|
|
{
|
|
|
|
|
conn.Open();
|
|
|
|
|
var tran = conn.BeginTransaction();
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var cmdInsert =
|
|
|
|
|
db.GetSqlStringCommand(
|
|
|
|
|
@"insert into op_ctn (CTN_ID,BSNO,CTNCODE,[SIZE],CTN,CTNNUM,TEU,CTNALL,CNTRNO,SEALNO,PKGS,KGS,CBM,REMARK,KINDPKGS,TAREWEIGHT,GOODSNAME,CTNSTATUS)
|
|
|
|
|
values (@CTN_ID,@BSNO,@CTNCODE,@SIZE,@CTN,@CTNNUM,@TEU,@CTNALL,@CNTRNO,@SEALNO,@PKGS,@KGS,@CBM,@REMARK,@KINDPKGS,@TAREWEIGHT,@GOODSNAME,'F') ");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (orderCtnlist != null)
|
|
|
|
|
{
|
|
|
|
|
foreach (var enumValue in orderCtnlist)
|
|
|
|
|
{
|
|
|
|
|
int SIZE = int.Parse(enumValue.CTNALL.ToString().Trim().Substring(0, 2));
|
|
|
|
|
string CTN = enumValue.CTN.ToString().Trim().Substring(2);
|
|
|
|
|
int TEU = enumValue.CTNNUM;
|
|
|
|
|
int iTEU = int.Parse(enumValue.CTNALL.ToString().Trim().Substring(0, 1));
|
|
|
|
|
if (iTEU == 4)
|
|
|
|
|
{
|
|
|
|
|
TEU = TEU * 2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var feedoid = Guid.NewGuid().ToString();
|
|
|
|
|
cmdInsert.Parameters.Clear();
|
|
|
|
|
db.AddInParameter(cmdInsert, "@CTN_ID", DbType.String, feedoid);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@BSNO", DbType.String, bsno);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@CTNCODE", DbType.String, "");
|
|
|
|
|
db.AddInParameter(cmdInsert, "@SIZE", DbType.Int16, SIZE);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@CTN", DbType.String, CTN);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@CTNNUM", DbType.Int16, enumValue.CTNNUM);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@TEU", DbType.Int16, TEU);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@CTNALL", DbType.String, enumValue.CTNALL);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@CNTRNO", DbType.String, "");
|
|
|
|
|
db.AddInParameter(cmdInsert, "@SEALNO", DbType.String, "");
|
|
|
|
|
db.AddInParameter(cmdInsert, "@PKGS", DbType.Int16,enumValue.PKGS);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@KGS", DbType.Decimal, enumValue.KGS);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@CBM", DbType.Decimal, enumValue.CBM);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@TAREWEIGHT", DbType.Int16, null);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@REMARK", DbType.String, "");
|
|
|
|
|
db.AddInParameter(cmdInsert, "@KINDPKGS", DbType.String, "");
|
|
|
|
|
db.AddInParameter(cmdInsert, "@GOODSNAME", DbType.String, "");
|
|
|
|
|
db.ExecuteNonQuery(cmdInsert, tran);
|
|
|
|
|
|
|
|
|
|
if (!ht.Contains(enumValue.CTNALL))
|
|
|
|
|
{
|
|
|
|
|
ht.Add(enumValue.CTNALL, enumValue.CTNNUM);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
string cntrno = "";
|
|
|
|
|
foreach (DictionaryEntry de in ht)
|
|
|
|
|
{
|
|
|
|
|
cntrno += de.Key.ToString() + "*" + de.Value.ToString() + " ";
|
|
|
|
|
}
|
|
|
|
|
cntrno = cntrno.Substring(0, cntrno.Length - 1);
|
|
|
|
|
var cmdUpdate =
|
|
|
|
|
db.GetSqlStringCommand(
|
|
|
|
|
@"update op_seae set CNTRTOTAL=@CNTRTOTAL where BSNO=@BSNO ");
|
|
|
|
|
cmdUpdate.Parameters.Clear();
|
|
|
|
|
db2.AddInParameter(cmdUpdate, "@CNTRTOTAL", DbType.String, cntrno);
|
|
|
|
|
db2.AddInParameter(cmdUpdate,"@BSNO",DbType.String,bsno);
|
|
|
|
|
db2.ExecuteNonQuery(cmdUpdate, tran);
|
|
|
|
|
|
|
|
|
|
tran.Commit();
|
|
|
|
|
|
|
|
|
|
result.Success = true;
|
|
|
|
|
result.Message = "保存成功" + result.Message;
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception)
|
|
|
|
|
{
|
|
|
|
|
tran.Rollback();
|
|
|
|
|
result.Success = false;
|
|
|
|
|
result.Message = "保存出现错误,请重试或联系系统管理员";
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
result.Success = true;
|
|
|
|
|
result.Message = "保存成功" + result.Message;
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static DBResult AuditWebOrder(string bsno, string mblno, string vessel, string voyno)
|
|
|
|
|
{
|
|
|
|
|
var result = new DBResult();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Database db = DatabaseFactory.CreateDatabase("SHIPPINGBOX");
|
|
|
|
|
using (var conn = db.CreateConnection())
|
|
|
|
|
{
|
|
|
|
|
conn.Open();
|
|
|
|
|
var tran = conn.BeginTransaction();
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var cmdUpdate =
|
|
|
|
|
db.GetSqlStringCommand(
|
|
|
|
|
@" Update BookingCargoSpace set BookingTYPE=1,bsstatus='CI20150711000006',MBLNO=@MBLNO,VESSEL=@VESSEL,VOYNO=@VOYNO where bsno=@BSNO ");
|
|
|
|
|
|
|
|
|
|
cmdUpdate.Parameters.Clear();
|
|
|
|
|
db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, bsno);
|
|
|
|
|
db.AddInParameter(cmdUpdate, "@MBLNO", DbType.String, mblno);
|
|
|
|
|
db.AddInParameter(cmdUpdate, "@VESSEL", DbType.String, vessel);
|
|
|
|
|
db.AddInParameter(cmdUpdate, "@VOYNO", DbType.String, voyno);
|
|
|
|
|
db.ExecuteNonQuery(cmdUpdate, tran);
|
|
|
|
|
|
|
|
|
|
tran.Commit();
|
|
|
|
|
}
|
|
|
|
|
catch (Exception)
|
|
|
|
|
{
|
|
|
|
|
tran.Rollback();
|
|
|
|
|
|
|
|
|
|
result.Success = false;
|
|
|
|
|
result.Message = "保存出现错误,请重试或联系系统管理员";
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
result.Success = true;
|
|
|
|
|
result.Message = "保存成功" + result.Message;
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
internal static DBResult ShenModify(MsOpSeae NewData, MsOpSeae OldData, List<MsOpSeaeDetail> bodyList, List<MsOpSeaeDetail> oldbodyList, string bstype,string bsno, string userid)
|
|
|
|
|
{
|
|
|
|
|
var result = new DBResult();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
|
|
using (var conn = db.CreateConnection())
|
|
|
|
|
{
|
|
|
|
|
conn.Open();
|
|
|
|
|
var tran = conn.BeginTransaction();
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
//var cmdUpdateOld =
|
|
|
|
|
// db.GetSqlStringCommand(
|
|
|
|
|
// @"update op_seae_modify set APPLYSTATUS=0 WHERE BSNO=@BSNO ");
|
|
|
|
|
var cmdInsert =
|
|
|
|
|
db.GetSqlStringCommand(
|
|
|
|
|
@"insert into op_seae_modify ([GID],[APPLYTYPE],[BSTYPE],[REASON],[BSNO] ,CUSTOMERNAME,[MBLNO],[HBLNO],[OP]
|
|
|
|
|
,[CUSTSERVICE],[SALE],[CARRIER],[FORWARDER],[TRUCKER],[DOC],[FRCUSTSERVICE]
|
|
|
|
|
,[VESSEL],[VOYNO],[YARD],[ETD],[PORTDISCHARGEID],[PORTDISCHARGE],[PLACEDELIVERYID]
|
|
|
|
|
,[PLACEDELIVERY],[DESTINATIONID],[DESTINATION],[LANE],ISSUETYPE
|
|
|
|
|
,[APPLYID],[APPLYUSER],[APPLYTIME],[APPLYSTATUS])
|
|
|
|
|
values (@GID,@APPLYTYPE,@BSTYPE,@REASON,@BSNO ,@CUSTOMERNAME,@MBLNO,@HBLNO,@OP
|
|
|
|
|
,@CUSTSERVICE,@SALE,@CARRIER,@FORWARDER,@TRUCKER,@DOC,@FRCUSTSERVICE
|
|
|
|
|
,@VESSEL,@VOYNO,@YARD,@ETD,@PORTDISCHARGEID,@PORTDISCHARGE,@PLACEDELIVERYID
|
|
|
|
|
,@PLACEDELIVERY,@DESTINATIONID,@DESTINATION,@LANE,@ISSUETYPE
|
|
|
|
|
,@APPLYID,@APPLYUSER,@APPLYTIME,@APPLYSTATUS) ");
|
|
|
|
|
|
|
|
|
|
//var cmdUpdate =
|
|
|
|
|
//db.GetSqlStringCommand(
|
|
|
|
|
// @"UPDATE CH_FEE SET FEESTATUS=3 WHERE GID=@GID ");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var GROUPID = Guid.NewGuid().ToString();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//cmdUpdateOld.Parameters.Clear();
|
|
|
|
|
//db.AddInParameter(cmdUpdateOld, "@BSNO", DbType.String, OldData.BSNO);
|
|
|
|
|
//db.ExecuteNonQuery(cmdUpdateOld, tran);
|
|
|
|
|
|
|
|
|
|
cmdInsert.Parameters.Clear();
|
|
|
|
|
db.AddInParameter(cmdInsert, "@GID", DbType.String, GROUPID);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@APPLYTYPE", DbType.Int16, 2);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@BSTYPE", DbType.String, bstype);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@REASON", DbType.String, NewData.REMARK);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@BSNO", DbType.String, bsno);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@CUSTOMERNAME", DbType.String, NewData.CUSTOMERNAME);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@MBLNO", DbType.String, NewData.MBLNO);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@HBLNO", DbType.String, NewData.HBLNO);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@OP", DbType.String, NewData.OP);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@CUSTSERVICE", DbType.String, NewData.CUSTSERVICE);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@SALE", DbType.String, NewData.SALE);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@CARRIER", DbType.String, NewData.CARRIER);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@FORWARDER", DbType.String, NewData.FORWARDER);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@TRUCKER", DbType.String, NewData.TRUCKER);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@DOC", DbType.String, NewData.DOC);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@FRCUSTSERVICE", DbType.String, NewData.FRCUSTSERVICE);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@VESSEL", DbType.String, NewData.VESSEL);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@VOYNO", DbType.String, NewData.VOYNO);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@YARD", DbType.String, NewData.YARD);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@ETD", DbType.String, NewData.ETD);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@PORTDISCHARGEID", DbType.String, NewData.PORTDISCHARGEID);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@PORTDISCHARGE", DbType.String, NewData.PORTDISCHARGE);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@PLACEDELIVERYID", DbType.String, NewData.PLACEDELIVERYID);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@PLACEDELIVERY", DbType.String, NewData.PLACEDELIVERY);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@DESTINATIONID", DbType.String, NewData.DESTINATIONID);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@DESTINATION", DbType.String, NewData.DESTINATION);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@LANE", DbType.String, NewData.LANE);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@ISSUETYPE", DbType.String, NewData.ISSUETYPE);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@APPLYID", DbType.String, GROUPID);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@APPLYUSER", DbType.String, userid);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@APPLYTIME", DbType.String, DateTime.Now.ToString());
|
|
|
|
|
db.AddInParameter(cmdInsert, "@APPLYSTATUS", DbType.Int16, 1);
|
|
|
|
|
db.ExecuteNonQuery(cmdInsert, tran);
|
|
|
|
|
|
|
|
|
|
var OLDDATAID = Guid.NewGuid().ToString();
|
|
|
|
|
cmdInsert.Parameters.Clear();
|
|
|
|
|
db.AddInParameter(cmdInsert, "@GID", DbType.String, OLDDATAID);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@APPLYTYPE", DbType.Int16, 1);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@BSTYPE", DbType.String, bstype);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@REASON", DbType.String, "");
|
|
|
|
|
db.AddInParameter(cmdInsert, "@BSNO", DbType.String, bsno);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@CUSTOMERNAME", DbType.String, OldData.CUSTOMERNAME);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@MBLNO", DbType.String, OldData.MBLNO);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@HBLNO", DbType.String, OldData.HBLNO);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@OP", DbType.String, OldData.OP);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@CUSTSERVICE", DbType.String, OldData.CUSTSERVICE);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@SALE", DbType.String, OldData.SALE);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@CARRIER", DbType.String, OldData.CARRIER);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@FORWARDER", DbType.String, OldData.FORWARDER);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@TRUCKER", DbType.String, OldData.TRUCKER);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@DOC", DbType.String, OldData.DOC);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@FRCUSTSERVICE", DbType.String, OldData.FRCUSTSERVICE);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@VESSEL", DbType.String, OldData.VESSEL);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@VOYNO", DbType.String, OldData.VOYNO);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@YARD", DbType.String, OldData.YARD);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@ETD", DbType.String, OldData.ETD);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@PORTDISCHARGEID", DbType.String, OldData.PORTDISCHARGEID);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@PORTDISCHARGE", DbType.String, OldData.PORTDISCHARGE);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@PLACEDELIVERYID", DbType.String, OldData.PLACEDELIVERYID);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@PLACEDELIVERY", DbType.String, OldData.PLACEDELIVERY);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@DESTINATIONID", DbType.String, OldData.DESTINATIONID);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@DESTINATION", DbType.String, OldData.DESTINATION);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@LANE", DbType.String, OldData.LANE);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@ISSUETYPE", DbType.String, OldData.ISSUETYPE);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@APPLYID", DbType.String, GROUPID);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@APPLYUSER", DbType.String, userid);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@APPLYTIME", DbType.String, DateTime.Now.ToString());
|
|
|
|
|
db.AddInParameter(cmdInsert, "@APPLYSTATUS", DbType.Int16, 1);
|
|
|
|
|
db.ExecuteNonQuery(cmdInsert, tran);
|
|
|
|
|
|
|
|
|
|
if (bodyList != null)
|
|
|
|
|
{
|
|
|
|
|
//var StrSerialNo = "('1000'";
|
|
|
|
|
foreach (var enumValue in bodyList)
|
|
|
|
|
{
|
|
|
|
|
var SIZE = enumValue.CTNALL.ToString().Trim().Substring(0, 2);
|
|
|
|
|
string CTN = enumValue.CTNALL.ToString().Trim().Substring(2);
|
|
|
|
|
int TEU = enumValue.CTNNUM;
|
|
|
|
|
var iTEU = enumValue.CTNALL.ToString().Trim().Substring(0, 1);
|
|
|
|
|
if (iTEU == "4")
|
|
|
|
|
{
|
|
|
|
|
TEU = TEU * 2;
|
|
|
|
|
}
|
|
|
|
|
else if (iTEU == "L")
|
|
|
|
|
{
|
|
|
|
|
TEU = 0;
|
|
|
|
|
}
|
|
|
|
|
if (enumValue.TRUCKFEE == "") enumValue.TRUCKFEE = "0";
|
|
|
|
|
if (enumValue.FREESTORAGEDAY == "") enumValue.FREESTORAGEDAY = "0";
|
|
|
|
|
if (enumValue.STORAGEDAY == "") enumValue.STORAGEDAY = "0";
|
|
|
|
|
if (enumValue.STORAGEPRICE == "") enumValue.STORAGEPRICE = "0";
|
|
|
|
|
if (enumValue.STORAGEFEE == "") enumValue.STORAGEFEE = "0";
|
|
|
|
|
if (enumValue.FREECTNDAY == "") enumValue.FREECTNDAY = "0";
|
|
|
|
|
if (enumValue.CTNDAY == "") enumValue.CTNDAY = "0";
|
|
|
|
|
if (enumValue.CTNPRICE == "") enumValue.CTNPRICE = "0";
|
|
|
|
|
if (enumValue.CTNFEE == "") enumValue.CTNFEE = "0";
|
|
|
|
|
var cmdInsertCtn = db.GetSqlStringCommand(@"insert into op_ctn_modify (GID,APPLYTYPE,MODIFYID,CTN_ID,BSNO,CTNCODE,[SIZE],CTN,CTNNUM,TEU,CTNALL,CNTRNO,SEALNO,PKGS,KGS,CBM,REMARK,KINDPKGS,TAREWEIGHT,GOODSNAME,CTNSTATUS,MASTERNO,WEIGHTYPE,WEIGHKGS,WEIGHATTN,WEIGHTEL,WEIGHSIGN,WEIGHDATE,TRUCKER,TRUCKFEE,FREESTORAGEDAY,STORAGEDAY,STORAGEPRICE,STORAGEFEE,
|
|
|
|
|
FREECTNDAY,CTNDAY,CTNPRICE,CTNFEE,TRUCKNO,VGMCONNCOM,VGMADDR,VGMEMAIL) values (NEWID(),2,'"+GROUPID+"','" + enumValue.CTN_ID
|
|
|
|
|
+ "','" + enumValue.BSNO + "','" + enumValue.CTNCODE + "','" + SIZE + "','" + CTN + "'," + enumValue.CTNNUM + "," + TEU + ",'" + enumValue.CTNALL + "','" + enumValue.CNTRNO + "','" + enumValue.SEALNO + "','" + enumValue.PKGS + "'," + enumValue.KGS + "," + enumValue.CBM + ",'" + enumValue.REMARK + "','" + enumValue.KINDPKGS + "'," + enumValue.TAREWEIGHT + ",'','"
|
|
|
|
|
+ enumValue.CTNSTATUS + "','" + enumValue.MASTERNO + "','" + enumValue.WEIGHTYPE + "'," + enumValue.WEIGHKGS + ",'" + enumValue.WEIGHATTN + "','" + enumValue.WEIGHTEL + "','" + enumValue.WEIGHSIGN + "','" + enumValue.WEIGHDATE + "','" + enumValue.TRUCKER + "'," + enumValue.TRUCKFEE
|
|
|
|
|
+ "," + enumValue.FREESTORAGEDAY + "," + enumValue.STORAGEDAY + "," + enumValue.STORAGEPRICE + "," + enumValue.STORAGEFEE + "," + enumValue.FREECTNDAY + "," + enumValue.CTNDAY + "," + enumValue.CTNPRICE + "," + enumValue.CTNFEE + ",'" + enumValue.TRUCKNO + "','" + enumValue.VGMCONNCOM + "','" + enumValue.VGMADDR + "','" + enumValue.VGMEMAIL + "')");
|
|
|
|
|
db.ExecuteNonQuery(cmdInsertCtn, tran);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (oldbodyList != null)
|
|
|
|
|
{
|
|
|
|
|
//var StrSerialNo = "('1000'";
|
|
|
|
|
foreach (var enumValue in oldbodyList)
|
|
|
|
|
{
|
|
|
|
|
var SIZE = enumValue.CTNALL.ToString().Trim().Substring(0, 2);
|
|
|
|
|
string CTN = enumValue.CTNALL.ToString().Trim().Substring(2);
|
|
|
|
|
int TEU = enumValue.CTNNUM;
|
|
|
|
|
var iTEU = enumValue.CTNALL.ToString().Trim().Substring(0, 1);
|
|
|
|
|
if (iTEU == "4")
|
|
|
|
|
{
|
|
|
|
|
TEU = TEU * 2;
|
|
|
|
|
}
|
|
|
|
|
else if (iTEU == "L")
|
|
|
|
|
{
|
|
|
|
|
TEU = 0;
|
|
|
|
|
}
|
|
|
|
|
if (enumValue.TRUCKFEE == "") enumValue.TRUCKFEE = "0";
|
|
|
|
|
if (enumValue.FREESTORAGEDAY == "") enumValue.FREESTORAGEDAY = "0";
|
|
|
|
|
if (enumValue.STORAGEDAY == "") enumValue.STORAGEDAY = "0";
|
|
|
|
|
if (enumValue.STORAGEPRICE == "") enumValue.STORAGEPRICE = "0";
|
|
|
|
|
if (enumValue.STORAGEFEE == "") enumValue.STORAGEFEE = "0";
|
|
|
|
|
if (enumValue.FREECTNDAY == "") enumValue.FREECTNDAY = "0";
|
|
|
|
|
if (enumValue.CTNDAY == "") enumValue.CTNDAY = "0";
|
|
|
|
|
if (enumValue.CTNPRICE == "") enumValue.CTNPRICE = "0";
|
|
|
|
|
if (enumValue.CTNFEE == "") enumValue.CTNFEE = "0";
|
|
|
|
|
var cmdInsertCtn = db.GetSqlStringCommand(@"insert into op_ctn_modify (GID,APPLYTYPE,MODIFYID,CTN_ID,BSNO,CTNCODE,[SIZE],CTN,CTNNUM,TEU,CTNALL,CNTRNO,SEALNO,PKGS,KGS,CBM,REMARK,KINDPKGS,TAREWEIGHT,GOODSNAME,CTNSTATUS,MASTERNO,WEIGHTYPE,WEIGHKGS,WEIGHATTN,WEIGHTEL,WEIGHSIGN,WEIGHDATE,TRUCKER,TRUCKFEE,FREESTORAGEDAY,STORAGEDAY,STORAGEPRICE,STORAGEFEE,
|
|
|
|
|
FREECTNDAY,CTNDAY,CTNPRICE,CTNFEE,TRUCKNO,VGMCONNCOM,VGMADDR,VGMEMAIL) values (NEWID(),1,'" + OLDDATAID + "','" + enumValue.CTN_ID
|
|
|
|
|
+ "','" + enumValue.BSNO + "','" + enumValue.CTNCODE + "','" + SIZE + "','" + CTN + "'," + enumValue.CTNNUM + "," + TEU + ",'" + enumValue.CTNALL + "','" + enumValue.CNTRNO + "','" + enumValue.SEALNO + "','" + enumValue.PKGS + "'," + enumValue.KGS + "," + enumValue.CBM + ",'" + enumValue.REMARK + "','" + enumValue.KINDPKGS + "'," + enumValue.TAREWEIGHT + ",'','"
|
|
|
|
|
+ enumValue.CTNSTATUS + "','" + enumValue.MASTERNO + "','" + enumValue.WEIGHTYPE + "'," + enumValue.WEIGHKGS + ",'" + enumValue.WEIGHATTN + "','" + enumValue.WEIGHTEL + "','" + enumValue.WEIGHSIGN + "','" + enumValue.WEIGHDATE + "','" + enumValue.TRUCKER + "'," + enumValue.TRUCKFEE
|
|
|
|
|
+ "," + enumValue.FREESTORAGEDAY + "," + enumValue.STORAGEDAY + "," + enumValue.STORAGEPRICE + "," + enumValue.STORAGEFEE + "," + enumValue.FREECTNDAY + "," + enumValue.CTNDAY + "," + enumValue.CTNPRICE + "," + enumValue.CTNFEE + ",'" + enumValue.TRUCKNO + "','" + enumValue.VGMCONNCOM + "','" + enumValue.VGMADDR + "','" + enumValue.VGMEMAIL + "')");
|
|
|
|
|
db.ExecuteNonQuery(cmdInsertCtn, tran);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Resultmb WorkResult = WorkFlowDAL.WorkFlowStart(WorkFlowName, NewFee.GId, saleid, mblno, OldFee.BsNo, "");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//if (WorkResult.Success == true)
|
|
|
|
|
//{
|
|
|
|
|
|
|
|
|
|
// cmdUpdate.Parameters.Clear();
|
|
|
|
|
// db.AddInParameter(cmdUpdate, "@GID", DbType.String, NewFee.GId);
|
|
|
|
|
// db.ExecuteNonQuery(cmdUpdate, tran);
|
|
|
|
|
|
|
|
|
|
// if (WorkResult.islast == true)
|
|
|
|
|
// {
|
|
|
|
|
// var cmdupdate = db.GetSqlStringCommand(@"update ch_fee set FEENAME=a.FEENAME,CUSTOMERNAME=a.CUSTOMERNAME,UNIT=a.UNIT,UNITPRICE=a.UNITPRICE,
|
|
|
|
|
// QUANTITY=a.QUANTITY,AMOUNT=a.AMOUNT,CURRENCY=a.CURRENCY,EXCHANGERATE=a.EXCHANGERATE,REASON=a.REASON,REMARK=a.REMARK,
|
|
|
|
|
// TAXRATE=a.TAXRATE,NOTAXAMOUNT=a.NOTAXAMOUNT,ACCTAXRATE=a.ACCTAXRATE,TAXUNITPRICE=a.TAXUNITPRICE,MANAGER=a.MANAGER,FEESTATUS=0
|
|
|
|
|
// from ch_fee left join ch_fee_modify a on (a.FEEID=ch_fee.GID and a.APPLYSTATUS=1 AND a.APPLYTYPE=2 ) where ch_fee.GID=@GID");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// db.AddInParameter(cmdupdate, "@GID", DbType.String, NewFee.GId);
|
|
|
|
|
// db.ExecuteNonQuery(cmdupdate, tran);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// var cmdupdateModify = db.GetSqlStringCommand("update ch_fee_modify set applystatus=2,audituser=@audituser,audittime=@audittime where FEEID=@GID and applystatus=1");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// cmdupdateModify.Parameters.Clear();
|
|
|
|
|
// db.AddInParameter(cmdupdateModify, "@GID", DbType.String, NewFee.GId);
|
|
|
|
|
// db.AddInParameter(cmdupdateModify, "@audituser", DbType.String, userid);
|
|
|
|
|
// db.AddInParameter(cmdupdateModify, "@audittime", DbType.Date, DateTime.Now);
|
|
|
|
|
// db.ExecuteNonQuery(cmdupdateModify, tran);
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
//else
|
|
|
|
|
//{
|
|
|
|
|
|
|
|
|
|
// tran.Rollback();
|
|
|
|
|
|
|
|
|
|
// result.Success = false;
|
|
|
|
|
// result.Message = "申请修改出现错误,请重试或联系系统管理员";
|
|
|
|
|
|
|
|
|
|
// return result;
|
|
|
|
|
//}
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
result = new DBResult();
|
|
|
|
|
result.Success = true;
|
|
|
|
|
result.Message = "申请修改成功";
|
|
|
|
|
|
|
|
|
|
tran.Commit();
|
|
|
|
|
}
|
|
|
|
|
catch (Exception)
|
|
|
|
|
{
|
|
|
|
|
tran.Rollback();
|
|
|
|
|
|
|
|
|
|
result.Success = false;
|
|
|
|
|
result.Message = "申请修改出现错误,请重试或联系系统管理员";
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
result.Success = true;
|
|
|
|
|
result.Message = "申请修改成功";
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
internal static DBResult AuditModifyList(List<MsSeaeModify> NewDataList, string userid)
|
|
|
|
|
{
|
|
|
|
|
var result = new DBResult();
|
|
|
|
|
var SALEORDERDEPTBYOP= MsSysParamSetDAL.GetData("PARAMNAME='SALEORDERDEPTBYOP'").PARAMVALUE;
|
|
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
|
|
using (var conn = db.CreateConnection())
|
|
|
|
|
{
|
|
|
|
|
conn.Open();
|
|
|
|
|
var tran = conn.BeginTransaction();
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (NewDataList != null)
|
|
|
|
|
{
|
|
|
|
|
foreach (var NewData in NewDataList)
|
|
|
|
|
{
|
|
|
|
|
var MsOpSeae = MsOpSeaeDAL.MsOpSeaeDAL.GetData("BSNO='" + NewData.BSNO + "'");
|
|
|
|
|
if (MsOpSeae.CUSTNO != "")
|
|
|
|
|
{
|
|
|
|
|
var strSql = new StringBuilder();
|
|
|
|
|
|
|
|
|
|
if (NewData.MBLNO != MsOpSeae.MBLNO && NewData.MBLNO != null)
|
|
|
|
|
strSql.Append(",MBLNO='" + NewData.MBLNO + "'");
|
|
|
|
|
if (NewData.SALE != MsOpSeae.SALE && NewData.SALE != null)
|
|
|
|
|
strSql.Append(",SALE='" + NewData.SALE + "'");
|
|
|
|
|
if (NewData.OP != MsOpSeae.OP && NewData.OP != null)
|
|
|
|
|
{
|
|
|
|
|
strSql.Append(",OP='" + NewData.OP + "'");
|
|
|
|
|
if (SALEORDERDEPTBYOP=="1") strSql.Append(",SALEDEPT=(SELECT TOP 1 DEPTNAME FROM VW_user WHERE SHOWNAME='" + NewData.OP + "') ");
|
|
|
|
|
}
|
|
|
|
|
if (NewData.CUSTSERVICE != MsOpSeae.CUSTSERVICE && NewData.CUSTSERVICE != null)
|
|
|
|
|
strSql.Append(",CUSTSERVICE='" + NewData.CUSTSERVICE + "'");
|
|
|
|
|
if (NewData.DOC != MsOpSeae.DOC && NewData.DOC != null)
|
|
|
|
|
strSql.Append(",DOC='" + NewData.DOC + "'");
|
|
|
|
|
if (NewData.CUSTOMERNAME != MsOpSeae.CUSTOMERNAME && NewData.CUSTOMERNAME != null)
|
|
|
|
|
strSql.Append(",CUSTOMERNAME='" + NewData.CUSTOMERNAME + "'");
|
|
|
|
|
if (NewData.CARRIER != MsOpSeae.CARRIER && NewData.CARRIER != null)
|
|
|
|
|
strSql.Append(",CARRIER='" + NewData.CARRIER + "'");
|
|
|
|
|
if (NewData.FORWARDER != MsOpSeae.FORWARDER && NewData.FORWARDER != null)
|
|
|
|
|
strSql.Append(",FORWARDER='" + NewData.FORWARDER + "'");
|
|
|
|
|
if (NewData.ETD != MsOpSeae.ETD && NewData.ETD != null)
|
|
|
|
|
strSql.Append(",ETD='" + NewData.ETD + "'");
|
|
|
|
|
if (NewData.PORTDISCHARGE != MsOpSeae.PORTDISCHARGE && NewData.PORTDISCHARGE != null)
|
|
|
|
|
strSql.Append(",PORTDISCHARGE='" + NewData.PORTDISCHARGE + "'");
|
|
|
|
|
if (NewData.DESTINATION != MsOpSeae.DESTINATION && NewData.DESTINATION != null)
|
|
|
|
|
strSql.Append(",DESTINATION='" + NewData.DESTINATION + "'");
|
|
|
|
|
if (NewData.PLACEDELIVERY != MsOpSeae.PLACEDELIVERY && NewData.PLACEDELIVERY != null)
|
|
|
|
|
strSql.Append(",PLACEDELIVERY='" + NewData.PLACEDELIVERY + "'");
|
|
|
|
|
if (NewData.LANE != MsOpSeae.LANE && NewData.LANE != null)
|
|
|
|
|
strSql.Append(",LANE='" + NewData.LANE + "'");
|
|
|
|
|
if (NewData.ISSUETYPE != MsOpSeae.ISSUETYPE && NewData.ISSUETYPE != null)
|
|
|
|
|
strSql.Append(",ISSUETYPE='" + NewData.ISSUETYPE + "'");
|
|
|
|
|
if (NewData.YARD != MsOpSeae.YARD && NewData.YARD != null)
|
|
|
|
|
strSql.Append(",YARD='" + NewData.YARD + "'");
|
|
|
|
|
if (NewData.VESSEL != MsOpSeae.VESSEL && NewData.VESSEL != null)
|
|
|
|
|
strSql.Append(",VESSEL='" + NewData.VESSEL + "'");
|
|
|
|
|
if (NewData.VOYNO != MsOpSeae.VOYNO && NewData.VOYNO != null)
|
|
|
|
|
strSql.Append(",VOYNO='" + NewData.VOYNO + "'");
|
|
|
|
|
if (strSql.ToString() != "")
|
|
|
|
|
{
|
|
|
|
|
strSql.Append(" where BSNO='" + NewData.BSNO + "' ");
|
|
|
|
|
var cmdupdate =
|
|
|
|
|
db.GetSqlStringCommand("update op_seae set bsno=bsno" + strSql.ToString());
|
|
|
|
|
db.ExecuteNonQuery(cmdupdate, tran);
|
|
|
|
|
var cmdupdate2 =
|
|
|
|
|
db.GetSqlStringCommand("update crm_seaeorder set bsno=bsno" + strSql.ToString());
|
|
|
|
|
db.ExecuteNonQuery(cmdupdate2, tran);
|
|
|
|
|
var cmdupdate3 =
|
|
|
|
|
db.GetSqlStringCommand("update op_seae_modify set APPLYSTATUS=0,AUDITUSER='" + userid + "',AUDITTIME=GETDATE() where APPLYID='" + NewData.APPLYID + "'");
|
|
|
|
|
db.ExecuteNonQuery(cmdupdate3, tran);
|
|
|
|
|
}
|
|
|
|
|
var cmddeleteCtn =
|
|
|
|
|
db.GetSqlStringCommand("delete from op_ctn where BSNO='"+NewData.BSNO+"'");
|
|
|
|
|
db.ExecuteNonQuery(cmddeleteCtn, tran);
|
|
|
|
|
var cmdInsertCtn = db.GetSqlStringCommand(@"insert into op_ctn (CTN_ID,BSNO,CTNCODE,[SIZE],CTN,CTNNUM,TEU,CTNALL,CNTRNO,SEALNO,PKGS,KGS,CBM,REMARK,KINDPKGS,TAREWEIGHT,GOODSNAME,CTNSTATUS,MASTERNO,WEIGHTYPE,WEIGHKGS,WEIGHATTN,WEIGHTEL,WEIGHSIGN,WEIGHDATE,TRUCKER,TRUCKFEE,FREESTORAGEDAY,STORAGEDAY,STORAGEPRICE,STORAGEFEE,
|
|
|
|
|
FREECTNDAY,CTNDAY,CTNPRICE,CTNFEE,TRUCKNO,VGMCONNCOM,VGMADDR,VGMEMAIL) SELECT CTN_ID,BSNO,CTNCODE,[SIZE],CTN,CTNNUM,TEU,CTNALL,CNTRNO,SEALNO,PKGS,KGS,CBM,REMARK,KINDPKGS,TAREWEIGHT,GOODSNAME,CTNSTATUS,MASTERNO,WEIGHTYPE,WEIGHKGS,WEIGHATTN,WEIGHTEL,WEIGHSIGN,WEIGHDATE,TRUCKER,TRUCKFEE,FREESTORAGEDAY,STORAGEDAY,STORAGEPRICE,STORAGEFEE,
|
|
|
|
|
FREECTNDAY,CTNDAY,CTNPRICE,CTNFEE,TRUCKNO,VGMCONNCOM,VGMADDR,VGMEMAIL FROM op_ctn_modify where APPLYTYPE=2 AND MODIFYID='"+NewData.GID+"'");
|
|
|
|
|
db.ExecuteNonQuery(cmdInsertCtn, tran);
|
|
|
|
|
|
|
|
|
|
var cmddeleteorderCtn =
|
|
|
|
|
db.GetSqlStringCommand("delete from crm_seaeorderctn where ORDNO in (select ORDNO from crm_seaeorder where BSNO='" + NewData.BSNO + "')");
|
|
|
|
|
db.ExecuteNonQuery(cmddeleteorderCtn, tran);
|
|
|
|
|
var cmdInsertorderCtn = db.GetSqlStringCommand(@"insert into crm_seaeorderctn (CTN_ID,ORDNO,CTNALL,CTNNUM)
|
|
|
|
|
SELECT NEWID(),(select TOP 1 ORDNO from crm_seaeorder where BSNO='" + NewData.BSNO + "'),CTNALL,SUM(CTNNUM) FROM op_ctn_modify where APPLYTYPE=2 AND MODIFYID='" + NewData.GID + "' GROUP BY CTNALL");
|
|
|
|
|
db.ExecuteNonQuery(cmdInsertorderCtn, tran);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
tran.Commit();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
tran.Rollback();
|
|
|
|
|
|
|
|
|
|
result.Success = false;
|
|
|
|
|
result.Message = "修改出现错误,请重试或联系系统管理员"+e.Message;
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
result.Success = true;
|
|
|
|
|
result.Message = "申请修改成功";
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static DBResult AuditBackModifyList(List<MsSeaeModify> NewDataList,string reason, string userid)
|
|
|
|
|
{
|
|
|
|
|
var result = new DBResult();
|
|
|
|
|
|
|
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
|
|
using (var conn = db.CreateConnection())
|
|
|
|
|
{
|
|
|
|
|
conn.Open();
|
|
|
|
|
var tran = conn.BeginTransaction();
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (NewDataList != null)
|
|
|
|
|
{
|
|
|
|
|
foreach (var NewData in NewDataList)
|
|
|
|
|
{
|
|
|
|
|
var cmdupdate3 =
|
|
|
|
|
db.GetSqlStringCommand("update op_seae_modify set APPLYSTATUS=4,AUDITREMARK='"+reason+"',AUDITUSER='" + userid + "',AUDITTIME=GETDATE() where APPLYID='" + NewData.APPLYID + "'");
|
|
|
|
|
db.ExecuteNonQuery(cmdupdate3, tran);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
tran.Commit();
|
|
|
|
|
}
|
|
|
|
|
catch (Exception)
|
|
|
|
|
{
|
|
|
|
|
tran.Rollback();
|
|
|
|
|
|
|
|
|
|
result.Success = false;
|
|
|
|
|
result.Message = "驳回出现错误,请重试或联系系统管理员";
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
result.Success = true;
|
|
|
|
|
result.Message = "驳回成功";
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static DBResult AuditBackWebOrder(string bsno,string reason)
|
|
|
|
|
{
|
|
|
|
|
var result = new DBResult();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Database db = DatabaseFactory.CreateDatabase("SHIPPINGBOX");
|
|
|
|
|
using (var conn = db.CreateConnection())
|
|
|
|
|
{
|
|
|
|
|
conn.Open();
|
|
|
|
|
var tran = conn.BeginTransaction();
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var cmdUpdate =
|
|
|
|
|
db.GetSqlStringCommand( //驳回 05
|
|
|
|
|
@" Update BookingCargoSpace set bsstatus='CI20150711000005' where bsno=@BSNO "
|
|
|
|
|
+ " Insert into BookingCargoSpaceStatus (BSNO,FLowType,FlowID,Remark,subdate,del_sign) values("
|
|
|
|
|
+ " @BSNO3,'CI20150711000001','CI20150711000005',@PendingReason,getdate(),0) ");
|
|
|
|
|
|
|
|
|
|
cmdUpdate.Parameters.Clear();
|
|
|
|
|
db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, bsno);
|
|
|
|
|
db.AddInParameter(cmdUpdate, "@BSNO3", DbType.String, bsno);
|
|
|
|
|
db.AddInParameter(cmdUpdate, "@PendingReason", DbType.String, reason);
|
|
|
|
|
db.ExecuteNonQuery(cmdUpdate, tran);
|
|
|
|
|
|
|
|
|
|
tran.Commit();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception)
|
|
|
|
|
{
|
|
|
|
|
tran.Rollback();
|
|
|
|
|
|
|
|
|
|
result.Success = false;
|
|
|
|
|
result.Message = "保存出现错误,请重试或联系系统管理员";
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
result.Success = true;
|
|
|
|
|
result.Message = "保存成功" + result.Message;
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*static private bool IsNotEqual(string strCondition)
|
|
|
|
|
{
|
|
|
|
|
bool _equal = false;
|
|
|
|
|
|
|
|
|
|
var ordercontainer = GetWebBodyList(strCondition);
|
|
|
|
|
var opcontainer = MsOpSeaeDAL.MsOpSeaeDAL.GetBodyList(strCondition);
|
|
|
|
|
|
|
|
|
|
if (ordercontainer[1].ToString() != opcontainer[1].ToString())
|
|
|
|
|
{
|
|
|
|
|
_equal = true;
|
|
|
|
|
}
|
|
|
|
|
if (ordercontainer[2].ToString() != opcontainer[4].ToString())
|
|
|
|
|
{
|
|
|
|
|
_equal = true;
|
|
|
|
|
}
|
|
|
|
|
if (ordercontainer[3].ToString() != opcontainer[5].ToString())
|
|
|
|
|
{
|
|
|
|
|
_equal = true;
|
|
|
|
|
}
|
|
|
|
|
if (ordercontainer[4].ToString() != opcontainer[8].ToString())
|
|
|
|
|
{
|
|
|
|
|
_equal = true;
|
|
|
|
|
}
|
|
|
|
|
if (ordercontainer[5].ToString() != opcontainer[9].ToString())
|
|
|
|
|
{
|
|
|
|
|
_equal = true;
|
|
|
|
|
}
|
|
|
|
|
if (ordercontainer[6].ToString() != opcontainer[10].ToString())
|
|
|
|
|
{
|
|
|
|
|
_equal = true;
|
|
|
|
|
}
|
|
|
|
|
if (ordercontainer[7].ToString() != opcontainer[11].ToString())
|
|
|
|
|
{
|
|
|
|
|
_equal = true;
|
|
|
|
|
}
|
|
|
|
|
if (ordercontainer[8].ToString() != opcontainer[12].ToString())
|
|
|
|
|
{
|
|
|
|
|
_equal = true;
|
|
|
|
|
}
|
|
|
|
|
if (ordercontainer[9].ToString() != opcontainer[14].ToString())
|
|
|
|
|
{
|
|
|
|
|
_equal = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return _equal;
|
|
|
|
|
}*/
|
|
|
|
|
|
|
|
|
|
static public MsSeaeOrderBill GetWebBillData(string strCondition, string sort = null)
|
|
|
|
|
{
|
|
|
|
|
var orderbill = GetWebData(strCondition);
|
|
|
|
|
var opbill = MsOpSeaeDAL.MsOpSeaeDAL.GetData(strCondition);
|
|
|
|
|
MsSeaeOrderBill data = new MsSeaeOrderBill();
|
|
|
|
|
|
|
|
|
|
data.ORDNO = orderbill.ORDNO;//委托
|
|
|
|
|
data.BSNO = orderbill.BSNO;//业务编号
|
|
|
|
|
//data.BSSOURCE = orderbill.BSSOURCE;
|
|
|
|
|
data.ORSTATUS =orderbill.ORSTATUS;//
|
|
|
|
|
data.ORSTATUSREF =orderbill.ORSTATUSREF;//
|
|
|
|
|
data.ORREASON =orderbill.ORREASON;//分提单号
|
|
|
|
|
data.BSDATE = orderbill.BSDATE;//接单日期
|
|
|
|
|
data.MBLNO = orderbill.MBLNO;//主提单号
|
|
|
|
|
data.CUSTNO =orderbill.CUSTNO;//主提单号
|
|
|
|
|
data.CUSTOMERNAME =orderbill.CUSTOMERNAME;//委托单位
|
|
|
|
|
data.ORDTYPE =orderbill.ORDTYPE;//业务状态
|
|
|
|
|
data.SHIPPER =orderbill.SHIPPER; //发货人内容
|
|
|
|
|
data.CONSIGNEE =orderbill.CONSIGNEE;//收货人内容
|
|
|
|
|
data.NOTIFYPARTY =orderbill.NOTIFYPARTY;//通知人内容
|
|
|
|
|
data.VESSEL = orderbill.VESSEL;//船名
|
|
|
|
|
data.VOYNO = orderbill.VOYNO;//航次
|
|
|
|
|
data.ETD = orderbill.ETD;//到港日期
|
|
|
|
|
data.PORTLOADID = orderbill.PORTLOADID;//装货港代码
|
|
|
|
|
data.PORTLOAD = orderbill.PORTLOAD;//装货港
|
|
|
|
|
data.PORTDISCHARGEID = orderbill.PORTDISCHARGEID;//卸货港代码
|
|
|
|
|
data.PORTDISCHARGE = orderbill.PORTDISCHARGE.Replace("^", "'");//卸货港
|
|
|
|
|
data.PLACERECEIPT = orderbill.PLACERECEIPT.Replace("^", "'");//收货地
|
|
|
|
|
data.PLACEDELIVERYID = orderbill.PLACEDELIVERYID;//交货地代码
|
|
|
|
|
data.PLACEDELIVERY = orderbill.PLACEDELIVERY.Replace("^", "'");//交货地
|
|
|
|
|
data.DESTINATIONID = orderbill.DESTINATIONID;//目的地代码
|
|
|
|
|
data.DESTINATION = orderbill.DESTINATION.Replace("^", "'");//目的地
|
|
|
|
|
data.NOBILL = orderbill.NOBILL;//提单份数
|
|
|
|
|
data.ISSUETYPE =orderbill.ISSUETYPE;//签单方式
|
|
|
|
|
data.ISSUEDATE =orderbill.ISSUEDATE;//预抵日期
|
|
|
|
|
data.ISSUEPLACE =orderbill.ISSUEPLACE;//签单地点
|
|
|
|
|
data.BLFRT =orderbill.BLFRT;//付费方式
|
|
|
|
|
data.PREPARDAT =orderbill.PREPARDAT;//预付地点
|
|
|
|
|
data.PAYABLEAT =orderbill.PAYABLEAT;//到付地点
|
|
|
|
|
data.SERVICE =orderbill.SERVICE;//运输条款
|
|
|
|
|
data.MARKS = orderbill.MARKS.Replace("^", "'");//唛头
|
|
|
|
|
data.NOPKGS =orderbill.NOPKGS;//件数包装
|
|
|
|
|
data.DESCRIPTION =orderbill.DESCRIPTION.Replace("^","'");//货物描述
|
|
|
|
|
data.GOODSNAME =orderbill.GOODSNAME;//品名
|
|
|
|
|
data.GROSSWEIGHT =orderbill.GROSSWEIGHT;//货物毛重
|
|
|
|
|
data.MEASUREMENT =orderbill.MEASUREMENT;//货物尺码
|
|
|
|
|
data.PKGS = Convert.ToDecimal(orderbill.PKGS);//件数
|
|
|
|
|
data.KINDPKGS =orderbill.KINDPKGS;//件数包装
|
|
|
|
|
data.KGS =Convert.ToDecimal(orderbill.KGS);//毛重
|
|
|
|
|
data.CBM =Convert.ToDecimal( orderbill.CBM);//立方数/尺码
|
|
|
|
|
data.TOTALNO =orderbill.TOTALNO;//件数大写
|
|
|
|
|
data.CNTRTOTAL = orderbill.CNTRTOTAL;//集装箱全部内容
|
|
|
|
|
data.INPUTBY =orderbill.INPUTBY;//录入人
|
|
|
|
|
data.OPERATORTEL = orderbill.OPERATORTEL;//录入人
|
|
|
|
|
data.OPERATOREMAIL =orderbill.OPERATOREMAIL;//录入人
|
|
|
|
|
data.CARGOID =orderbill.CARGOID;//货物标识
|
|
|
|
|
data.HSCODE = orderbill.HSCODE;
|
|
|
|
|
data.DCLASS =orderbill.DCLASS;//危险品分类/等级
|
|
|
|
|
data.DUNNO =orderbill.DUNNO;//危险品编号
|
|
|
|
|
data.DPAGE =orderbill.DPAGE;//危险品页号
|
|
|
|
|
data.DLABEL =orderbill.DLABEL;//危险品标签
|
|
|
|
|
data.LINKMAN =orderbill.LINKMAN;//危险品联系人
|
|
|
|
|
data.REEFERF = orderbill.REEFERF;//冷藏通风量
|
|
|
|
|
data.TEMPID = orderbill.TEMPID;//温度单位
|
|
|
|
|
data.TEMPSET = orderbill.TEMPSET;//设置温度
|
|
|
|
|
data.TEMPMAX =orderbill.TEMPMAX;//最高温度
|
|
|
|
|
data.TEMPMIN =orderbill.TEMPMIN;//最低温度
|
|
|
|
|
data.REMARK = orderbill.REMARK;//备注
|
|
|
|
|
data.BLTYPE =orderbill.BLTYPE;//装运方式
|
|
|
|
|
data.OP =orderbill.OP;//操作员
|
|
|
|
|
data.CUSTSERVICE = orderbill.CUSTSERVICE;//客服员
|
|
|
|
|
data.DOC =orderbill.DOC;//单证
|
|
|
|
|
data.AUDITOPERATOR =orderbill.AUDITDATE;//审核人
|
|
|
|
|
data.AUDITDATE =orderbill.AUDITDATE;//审核日期
|
|
|
|
|
data.OPERATORTEL =orderbill.OPERATORTEL;//
|
|
|
|
|
data.OPERATOREMAIL =orderbill.OPERATOREMAIL;//
|
|
|
|
|
if (orderbill.SHIPPER != opbill.SHIPPER)
|
|
|
|
|
data.UPSHIPPER = true;
|
|
|
|
|
data.ASSHIPPER = opbill.SHIPPER;
|
|
|
|
|
if (orderbill.CONSIGNEE != opbill.CONSIGNEE)
|
|
|
|
|
data.UPCONSIGNEE = true;
|
|
|
|
|
data.ASCONSIGNEE = opbill.CONSIGNEE;
|
|
|
|
|
if (orderbill.NOTIFYPARTY != opbill.NOTIFYPARTY)
|
|
|
|
|
data.UPNOTIFYPARTY = true;
|
|
|
|
|
data.ASNOTIFYPARTY = opbill.NOTIFYPARTY;
|
|
|
|
|
if (orderbill.VESSEL != opbill.VESSEL)
|
|
|
|
|
data.UPVESSEL= true;
|
|
|
|
|
data.ASVESSEL = opbill.VESSEL;
|
|
|
|
|
|
|
|
|
|
if (orderbill.VOYNO != opbill.VOYNO)
|
|
|
|
|
data.UPVOYNO = true;
|
|
|
|
|
data.ASVOYNO = opbill.VOYNO;
|
|
|
|
|
|
|
|
|
|
if (orderbill.PORTLOAD != opbill.PORTLOAD)
|
|
|
|
|
data.UPPORTLOAD = true;
|
|
|
|
|
data.ASPORTLOAD= opbill.PORTLOAD;
|
|
|
|
|
|
|
|
|
|
if (orderbill.PORTDISCHARGE != opbill.PORTDISCHARGE)
|
|
|
|
|
data.UPPORTDISCHARGE = true;
|
|
|
|
|
data.ASPORTDISCHARGE = opbill.PORTDISCHARGE;
|
|
|
|
|
if (orderbill.PLACEDELIVERY != opbill.PLACEDELIVERY)
|
|
|
|
|
data.UPPLACEDELIVERY = true;
|
|
|
|
|
data.ASPLACEDELIVERY = opbill.PLACEDELIVERY;
|
|
|
|
|
|
|
|
|
|
if (orderbill.DESTINATION != opbill.DESTINATION)
|
|
|
|
|
data.UPDESTINATION = true;
|
|
|
|
|
data.ASDESTINATION = opbill.DESTINATION;
|
|
|
|
|
|
|
|
|
|
if (orderbill.PKGS != opbill.PKGS)
|
|
|
|
|
data.UPPKGS = true;
|
|
|
|
|
data.ASPKGS =Convert.ToString(opbill.PKGS);
|
|
|
|
|
if (orderbill.KINDPKGS != opbill.KINDPKGS)
|
|
|
|
|
data.UPKINDPKGS = true;
|
|
|
|
|
data.ASKINDPKGS = Convert.ToString(opbill.KINDPKGS);
|
|
|
|
|
|
|
|
|
|
if (orderbill.KGS != opbill.KGS)
|
|
|
|
|
data.UPKGS = true;
|
|
|
|
|
data.ASKGS = Convert.ToString(opbill.KGS);
|
|
|
|
|
if (orderbill.CBM!= opbill.CBM)
|
|
|
|
|
data.UPCBM = true;
|
|
|
|
|
data.ASCBM = Convert.ToString(opbill.CBM);
|
|
|
|
|
if (orderbill.TOTALNO != opbill.TOTALNO)
|
|
|
|
|
data.UPTOTALNO = true;
|
|
|
|
|
data.ASTOTALNO = opbill.TOTALNO;
|
|
|
|
|
|
|
|
|
|
if (orderbill.MARKS != opbill.MARKS)
|
|
|
|
|
data.UPMARKS = true;
|
|
|
|
|
data.ASMARKS = opbill.MARKS;
|
|
|
|
|
if (orderbill.DESCRIPTION != opbill.DESCRIPTION)
|
|
|
|
|
data.UPDESCRIPTION = true;
|
|
|
|
|
data.ASDESCRIPTION = opbill.DESCRIPTION;
|
|
|
|
|
|
|
|
|
|
if (orderbill.SERVICE != opbill.SERVICE)
|
|
|
|
|
data.UPSERVICE = true;
|
|
|
|
|
data.ASSERVICE = opbill.SERVICE;
|
|
|
|
|
if (orderbill.CARGOID != opbill.CARGOID)
|
|
|
|
|
data.UPCARGOID = true;
|
|
|
|
|
data.ASCARGOID = opbill.CARGOID;
|
|
|
|
|
|
|
|
|
|
if (orderbill.HSCODE != opbill.HSCODE)
|
|
|
|
|
data.UPHSCODE = true;
|
|
|
|
|
data.ASHSCODE = opbill.HSCODE;
|
|
|
|
|
|
|
|
|
|
if (orderbill.DCLASS != opbill.DCLASS)
|
|
|
|
|
data.UPDCLASS = true;
|
|
|
|
|
data.ASDCLASS = opbill.DCLASS;
|
|
|
|
|
|
|
|
|
|
if (orderbill.DUNNO != opbill.DUNNO)
|
|
|
|
|
data.UPDUNNO = true;
|
|
|
|
|
data.ASDUNNO = opbill.DUNNO;
|
|
|
|
|
|
|
|
|
|
if (orderbill.DPAGE != opbill.DPAGE)
|
|
|
|
|
data.UPDPAGE = true;
|
|
|
|
|
data.ASDPAGE = opbill.DPAGE;
|
|
|
|
|
|
|
|
|
|
if (orderbill.DLABEL != opbill.DLABEL)
|
|
|
|
|
data.UPDLABEL = true;
|
|
|
|
|
data.ASDLABEL = opbill.DLABEL;
|
|
|
|
|
|
|
|
|
|
if (orderbill.LINKMAN != opbill.LINKMAN)
|
|
|
|
|
data.UPLINKMAN = true;
|
|
|
|
|
data.ASLINKMAN = opbill.LINKMAN;
|
|
|
|
|
|
|
|
|
|
if (orderbill.REEFERF != opbill.REEFERF)
|
|
|
|
|
data.UPREEFERF = true;
|
|
|
|
|
data.ASREEFERF = opbill.REEFERF;
|
|
|
|
|
|
|
|
|
|
if (orderbill.TEMPID != opbill.TEMPID)
|
|
|
|
|
data.UPTEMPID = true;
|
|
|
|
|
data.ASTEMPID = opbill.TEMPID;
|
|
|
|
|
|
|
|
|
|
if (orderbill.TEMPSET != opbill.TEMPSET)
|
|
|
|
|
data.UPTEMPSET = true;
|
|
|
|
|
data.ASTEMPSET = opbill.TEMPSET;
|
|
|
|
|
|
|
|
|
|
if (orderbill.TEMPMAX != opbill.TEMPMAX)
|
|
|
|
|
data.UPTEMPMAX = true;
|
|
|
|
|
data.ASTEMPMAX = opbill.TEMPMAX;
|
|
|
|
|
|
|
|
|
|
if (orderbill.TEMPMIN != opbill.TEMPMIN)
|
|
|
|
|
data.UPTEMPMIN = true;
|
|
|
|
|
data.ASTEMPMIN = opbill.TEMPMIN;
|
|
|
|
|
|
|
|
|
|
if (orderbill.BLFRT != opbill.BLFRT)
|
|
|
|
|
data.UPBLFRT = true;
|
|
|
|
|
data.ASBLFRT = opbill.BLFRT;
|
|
|
|
|
|
|
|
|
|
if (orderbill.PREPARDAT != opbill.PREPARDAT)
|
|
|
|
|
data.UPPREPARDAT = true;
|
|
|
|
|
data.ASPREPARDAT = opbill.PREPARDAT;
|
|
|
|
|
if (orderbill.PAYABLEAT != opbill.PAYABLEAT)
|
|
|
|
|
data.UPPAYABLEAT = true;
|
|
|
|
|
data.ASPAYABLEAT = opbill.PAYABLEAT;
|
|
|
|
|
|
|
|
|
|
if (orderbill.ISSUETYPE != opbill.ISSUETYPE)
|
|
|
|
|
data.UPISSUETYPE = true;
|
|
|
|
|
data.ASISSUETYPE = opbill.ISSUETYPE;
|
|
|
|
|
|
|
|
|
|
if (orderbill.ISSUEDATE != opbill.ISSUEDATE)
|
|
|
|
|
data.UPISSUEDATE = true;
|
|
|
|
|
data.ASISSUEDATE = opbill.ISSUEDATE;
|
|
|
|
|
|
|
|
|
|
if (orderbill.ISSUEPLACE != opbill.ISSUEPLACE)
|
|
|
|
|
data.UPISSUEPLACE = true;
|
|
|
|
|
data.ASISSUEPLACE = opbill.ISSUEPLACE;
|
|
|
|
|
|
|
|
|
|
data.UPCTN = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return data;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static DBResult WebAddOrderBillDetail(string bsno, List<MsOpSeaeWebOrderCtn> orderCtnlist)
|
|
|
|
|
{
|
|
|
|
|
var result = new DBResult();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
|
|
using (var conn = db.CreateConnection())
|
|
|
|
|
{
|
|
|
|
|
conn.Open();
|
|
|
|
|
var tran = conn.BeginTransaction();
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var cmdDelete =
|
|
|
|
|
db.GetSqlStringCommand(
|
|
|
|
|
@" delete from op_ctn where BSNO=@BSNO ");
|
|
|
|
|
cmdDelete.Parameters.Clear();
|
|
|
|
|
db.AddInParameter(cmdDelete, "@BSNO", DbType.String, bsno);
|
|
|
|
|
db.ExecuteNonQuery(cmdDelete, tran);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var cmdInsert =
|
|
|
|
|
db.GetSqlStringCommand(
|
|
|
|
|
@"insert into op_ctn (CTN_ID,BSNO,CTNCODE,[SIZE],CTN,CTNNUM,TEU,CTNALL,CNTRNO,SEALNO,PKGS,KGS,CBM,REMARK,KINDPKGS,TAREWEIGHT,GOODSNAME,CTNSTATUS)
|
|
|
|
|
values (@CTN_ID,@BSNO,@CTNCODE,@SIZE,@CTN,@CTNNUM,@TEU,@CTNALL,@CNTRNO,@SEALNO,@PKGS,@KGS,@CBM,@REMARK,@KINDPKGS,@TAREWEIGHT,@GOODSNAME,'F') ");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (orderCtnlist != null)
|
|
|
|
|
{
|
|
|
|
|
foreach (var enumValue in orderCtnlist)
|
|
|
|
|
{
|
|
|
|
|
int SIZE = int.Parse(enumValue.CTN.ToString().Trim().Substring(0, 2));
|
|
|
|
|
string CTN = enumValue.CTNALL.ToString().Trim().Substring(2);
|
|
|
|
|
int TEU = enumValue.CTNNUM;
|
|
|
|
|
int iTEU = int.Parse(enumValue.CTN.ToString().Trim().Substring(0, 1));
|
|
|
|
|
if (iTEU == 4)
|
|
|
|
|
{
|
|
|
|
|
TEU = TEU * 2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var feedoid = Guid.NewGuid().ToString();
|
|
|
|
|
cmdInsert.Parameters.Clear();
|
|
|
|
|
db.AddInParameter(cmdInsert, "@CTN_ID", DbType.String, feedoid);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@BSNO", DbType.String, bsno);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@CTNCODE", DbType.String, "");
|
|
|
|
|
db.AddInParameter(cmdInsert, "@SIZE", DbType.Int16, SIZE);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@CTN", DbType.String, CTN);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@CTNNUM", DbType.Int16, enumValue.CTNNUM);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@TEU", DbType.Int16, TEU);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@CTNALL", DbType.String, enumValue.CTNALL);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@CNTRNO", DbType.String, enumValue.CNTRNO);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@SEALNO", DbType.String,enumValue.SEALNO);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@PKGS", DbType.Int16, enumValue.PKGS);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@KGS", DbType.Decimal, enumValue.KGS);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@CBM", DbType.Decimal, enumValue.CBM);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@TAREWEIGHT", DbType.Int16, null);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@REMARK", DbType.String, enumValue.REMARK);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@KINDPKGS", DbType.String, enumValue.KINDPKGS);
|
|
|
|
|
db.AddInParameter(cmdInsert, "@GOODSNAME", DbType.String, "");
|
|
|
|
|
db.ExecuteNonQuery(cmdInsert, tran);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
tran.Commit();
|
|
|
|
|
|
|
|
|
|
result.Success = true;
|
|
|
|
|
result.Message = "保存成功" + result.Message;
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception)
|
|
|
|
|
{
|
|
|
|
|
tran.Rollback();
|
|
|
|
|
result.Success = false;
|
|
|
|
|
result.Message = "保存出现错误,请重试或联系系统管理员";
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
result.Success = true;
|
|
|
|
|
result.Message = "保存成功" + result.Message;
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static DBResult AuditWebOrderBill(string bsno,string mblno)
|
|
|
|
|
{
|
|
|
|
|
var result = new DBResult();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Database db = DatabaseFactory.CreateDatabase("SHIPPINGBOX");
|
|
|
|
|
using (var conn = db.CreateConnection())
|
|
|
|
|
{
|
|
|
|
|
conn.Open();
|
|
|
|
|
var tran = conn.BeginTransaction();
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var cmdUPD =
|
|
|
|
|
db.GetSqlStringCommand(
|
|
|
|
|
@" Update BookingCargoSpaceStatus set FlowID='CI_BLC_Rec' where bsno=@BSNO and FlowType='CI_BLC'
|
|
|
|
|
Update BookingCargoSpace set BSSTATUS='CI_BLC_Rec' where bsno=@BSNO2 and BSSTATUS='CI_BLC_Send'
|
|
|
|
|
");
|
|
|
|
|
|
|
|
|
|
cmdUPD.Parameters.Clear();
|
|
|
|
|
db.AddInParameter(cmdUPD, "@BSNO", DbType.String, bsno);
|
|
|
|
|
db.AddInParameter(cmdUPD, "@BSNO2", DbType.String, bsno);
|
|
|
|
|
db.ExecuteNonQuery(cmdUPD, tran);
|
|
|
|
|
|
|
|
|
|
tran.Commit();
|
|
|
|
|
}
|
|
|
|
|
catch (Exception)
|
|
|
|
|
{
|
|
|
|
|
tran.Rollback();
|
|
|
|
|
|
|
|
|
|
result.Success = false;
|
|
|
|
|
result.Message = "保存出现错误,请重试或联系系统管理员";
|
|
|
|
|
|
|
|
|
|
//return result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
Database db2 = DatabaseFactory.CreateDatabase();
|
|
|
|
|
using (var conn2 = db2.CreateConnection())
|
|
|
|
|
{
|
|
|
|
|
conn2.Open();
|
|
|
|
|
var tran2 = conn2.BeginTransaction();
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var cmd2 =
|
|
|
|
|
db2.GetSqlStringCommand(
|
|
|
|
|
@" update op_seae set MBLNO=@MBLNO where BSNO=@BSNO ");
|
|
|
|
|
cmd2.Parameters.Clear();
|
|
|
|
|
db2.AddInParameter(cmd2, "@BSNO", DbType.String, bsno);
|
|
|
|
|
db2.AddInParameter(cmd2, "@MBLNO", DbType.String, mblno);
|
|
|
|
|
db2.ExecuteNonQuery(cmd2, tran2);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tran2.Commit();
|
|
|
|
|
|
|
|
|
|
result.Success = true;
|
|
|
|
|
result.Message = "保存成功" + result.Message;
|
|
|
|
|
//return result;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception)
|
|
|
|
|
{
|
|
|
|
|
tran2.Rollback();
|
|
|
|
|
result.Success = false;
|
|
|
|
|
result.Message = "保存出现错误,请重试或联系系统管理员";
|
|
|
|
|
//return result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
result.Success = true;
|
|
|
|
|
result.Message = "保存成功" + result.Message;
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static DBResult AuditBackWebOrderBill(string bsno, string reason)
|
|
|
|
|
{
|
|
|
|
|
var result = new DBResult();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Database db = DatabaseFactory.CreateDatabase("SHIPPINGBOX");
|
|
|
|
|
using (var conn = db.CreateConnection())
|
|
|
|
|
{
|
|
|
|
|
conn.Open();
|
|
|
|
|
var tran = conn.BeginTransaction();
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var cmdUpdate =
|
|
|
|
|
db.GetSqlStringCommand(
|
|
|
|
|
@" Insert into BookingCargoSpaceStatus (BSNO,FLowType,FlowID,Remark,subdate,del_sign) values(@BSNO,'CI20150711000001','CI20150711000005',@PendingReason,getdate(),0)"
|
|
|
|
|
+ "Update BookingCargoSpace set BSSTATUS='CI_BLC_Refuse' where bsno=@BSNO2");// and FlowType='CI_BLC'
|
|
|
|
|
|
|
|
|
|
cmdUpdate.Parameters.Clear();
|
|
|
|
|
db.AddInParameter(cmdUpdate, "@BSNO", DbType.String, bsno);
|
|
|
|
|
db.AddInParameter(cmdUpdate, "@BSNO2", DbType.String, bsno);
|
|
|
|
|
db.AddInParameter(cmdUpdate, "@PendingReason", DbType.String, reason);
|
|
|
|
|
db.ExecuteNonQuery(cmdUpdate, tran);
|
|
|
|
|
|
|
|
|
|
tran.Commit();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception)
|
|
|
|
|
{
|
|
|
|
|
tran.Rollback();
|
|
|
|
|
|
|
|
|
|
result.Success = false;
|
|
|
|
|
result.Message = "保存出现错误,请重试或联系系统管理员";
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
result.Success = true;
|
|
|
|
|
result.Message = "保存成功" + result.Message;
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
public static void SendMailLocalhost(string MailType, MsSeaeOrder Opseae, string ORREASON)
|
|
|
|
|
{
|
|
|
|
|
System.Net.Mail.MailMessage msg = new System.Net.Mail.MailMessage();
|
|
|
|
|
//首先获取发件人 发件公司 发件邮箱(委托方) // 收件人 收件公司 收件邮箱(承运方)
|
|
|
|
|
var strSql = new StringBuilder();
|
|
|
|
|
strSql.Append(" select case AUDITOR WHEN '' then ");
|
|
|
|
|
strSql.Append(" (select email from userinfo where userid in (select userid from login where companyID=FORWARDER) and departmentID='CompanyMaster') ");
|
|
|
|
|
strSql.Append(" else (select email from userinfo where userid=AUDITOR) end ReceiverEmail ");
|
|
|
|
|
strSql.Append(" ,case AUDITOR WHEN '' then ");
|
|
|
|
|
strSql.Append(" (select username from userinfo where userid in (select userid from login where companyID=FORWARDER) and departmentID='CompanyMaster') ");
|
|
|
|
|
strSql.Append(" else (select username from userinfo where userid=AUDITOR) end Receivername ");
|
|
|
|
|
strSql.Append(" ,u.username sendername,u.email senderEmail ");
|
|
|
|
|
strSql.Append(" ,(select fullname from company where companyid=bcs.forwarder) receiverCompany ");
|
|
|
|
|
strSql.Append(" ,(select fullname from company where companyid=bcs.companyid) sendercompany ");
|
|
|
|
|
strSql.Append(" ,(select Mobile from userinfo where userid=bcs.inputby) senderMobile ");
|
|
|
|
|
strSql.Append(" ,(select Mobile from userinfo where userid=bcs.Auditor) receiverMobile ");
|
|
|
|
|
strSql.Append(" ,bcs.* ");
|
|
|
|
|
strSql.Append(" from BookingCargoSpace bcs ");
|
|
|
|
|
strSql.Append(" left join userinfo U on u.userid = bcs.inputby ");
|
|
|
|
|
strSql.Append(" where bsno='" + Opseae.BSNO + "' ");
|
|
|
|
|
|
|
|
|
|
DataSet ds = new DataSet();
|
|
|
|
|
Database db = DatabaseFactory.CreateDatabase("SHIPPINGBOX");
|
|
|
|
|
|
|
|
|
|
var SenderName = "";
|
|
|
|
|
var SenderEmail = "";
|
|
|
|
|
var SenderCompany = "";
|
|
|
|
|
var SenderMobile = "";
|
|
|
|
|
var ReceiverName = "";
|
|
|
|
|
var ReceiverEmail = "";
|
|
|
|
|
var ReceiverCompany = "";
|
|
|
|
|
var ReceiverMobile = "";
|
|
|
|
|
var EmailText = new StringBuilder();
|
|
|
|
|
var EmailTitle = new StringBuilder();
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
|
|
|
|
|
{
|
|
|
|
|
while (reader.Read())
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
SenderName = Convert.ToString(reader["SenderName"]);
|
|
|
|
|
SenderEmail = Convert.ToString(reader["SenderEmail"]);
|
|
|
|
|
SenderCompany = Convert.ToString(reader["SenderCompany"]);
|
|
|
|
|
SenderMobile = Convert.ToString(reader["SenderMobile"]);
|
|
|
|
|
ReceiverName = Convert.ToString(reader["ReceiverName"]);
|
|
|
|
|
ReceiverEmail = Convert.ToString(reader["ReceiverEmail"]);
|
|
|
|
|
ReceiverCompany = Convert.ToString(reader["ReceiverCompany"]);
|
|
|
|
|
ReceiverMobile = Convert.ToString(reader["ReceiverMobile"]);
|
|
|
|
|
EmailTitle.Clear();
|
|
|
|
|
EmailTitle.Append("");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
reader.Close();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (MailType == "拒绝订舱" || MailType == "待定" || MailType == "拒绝提单确认")
|
|
|
|
|
{
|
|
|
|
|
msg.To.Add(SenderEmail);
|
|
|
|
|
msg.From = new MailAddress(ReceiverEmail, ReceiverName, System.Text.Encoding.UTF8);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
msg.To.Add(ReceiverEmail);
|
|
|
|
|
msg.From = new MailAddress(SenderEmail, SenderName, System.Text.Encoding.UTF8);
|
|
|
|
|
}
|
|
|
|
|
/* 上面3个参数分别是发件人地址(可以随便写),发件人姓名,编码*/
|
|
|
|
|
var Subject = "";
|
|
|
|
|
var Body = new StringBuilder();
|
|
|
|
|
|
|
|
|
|
if (MailType == "拒绝订舱")
|
|
|
|
|
{
|
|
|
|
|
Subject = " 拒绝订舱提醒:From " + ReceiverCompany;
|
|
|
|
|
if (Opseae.ETD != "")
|
|
|
|
|
Subject = Subject + " 船期" + Opseae.ETD;
|
|
|
|
|
if (Opseae.CNTRTOTAL != "")
|
|
|
|
|
Subject = Subject + " 箱型箱量" + Opseae.CNTRTOTAL;
|
|
|
|
|
if (Opseae.DESTINATION != "")
|
|
|
|
|
Subject = Subject + " 目的地" + Opseae.DESTINATION;
|
|
|
|
|
|
|
|
|
|
Body.Append("<html> <Body>");
|
|
|
|
|
Body.Append("<br />您好,您通过ShippingBox所订业务被拒绝,理由如下:<br />" + REHH(ORREASON));
|
|
|
|
|
Body.Append("<br />订舱代理公司:" + ReceiverCompany);
|
|
|
|
|
Body.Append("<br />操作人:" + ReceiverName + " 电话:" + ReceiverMobile + " 邮箱:" + ReceiverEmail);
|
|
|
|
|
|
|
|
|
|
if (Opseae.CNTRTOTAL != "")
|
|
|
|
|
Body.Append("<br />箱型箱量:" + Opseae.CNTRTOTAL);
|
|
|
|
|
if (Opseae.ETD != "")
|
|
|
|
|
Body.Append("<br />船期:" + Opseae.ETD);
|
|
|
|
|
if (Opseae.DESTINATION != "")
|
|
|
|
|
Body.Append("<br />目的地:" + Opseae.DESTINATION);
|
|
|
|
|
if (Opseae.REMARK != "")
|
|
|
|
|
Body.Append("<br />订舱说明:" + Opseae.REMARK);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (MailType == "拒绝提单确认")
|
|
|
|
|
{
|
|
|
|
|
Subject = " 拒绝提单确认:From " + ReceiverCompany;
|
|
|
|
|
if (Opseae.ETD != "")
|
|
|
|
|
Subject = Subject + " 船期" + Opseae.ETD;
|
|
|
|
|
if (Opseae.CNTRTOTAL != "")
|
|
|
|
|
Subject = Subject + " 箱型箱量" + Opseae.CNTRTOTAL;
|
|
|
|
|
if (Opseae.DESTINATION != "")
|
|
|
|
|
Subject = Subject + " 目的地" + Opseae.DESTINATION;
|
|
|
|
|
|
|
|
|
|
Body.Append("<html> <Body>");
|
|
|
|
|
Body.Append("<br />您好,您通过ShippingBox所提交提单确认被拒绝,理由如下:<br />" + REHH(ORREASON));
|
|
|
|
|
Body.Append("<br />订舱代理公司:" + ReceiverCompany);
|
|
|
|
|
Body.Append("<br />操作人:" + ReceiverName + " 电话:" + ReceiverMobile + " 邮箱:" + ReceiverEmail);
|
|
|
|
|
|
|
|
|
|
if (Opseae.CNTRTOTAL != "")
|
|
|
|
|
Body.Append("<br />箱型箱量:" + Opseae.CNTRTOTAL);
|
|
|
|
|
if (Opseae.ETD != "")
|
|
|
|
|
Body.Append("<br />船期:" + Opseae.ETD);
|
|
|
|
|
if (Opseae.DESTINATION != "")
|
|
|
|
|
Body.Append("<br />目的地:" + Opseae.DESTINATION);
|
|
|
|
|
if (Opseae.REMARK != "")
|
|
|
|
|
Body.Append("<br />订舱说明:" + Opseae.REMARK);
|
|
|
|
|
}
|
|
|
|
|
//Body = SetBottom(Body, Opseae.BSNO);
|
|
|
|
|
|
|
|
|
|
msg.Subject = Subject;//邮件标题
|
|
|
|
|
msg.SubjectEncoding = System.Text.Encoding.UTF8;//邮件标题编码
|
|
|
|
|
msg.Body = Body.ToString();//邮件内容
|
|
|
|
|
msg.BodyEncoding = System.Text.Encoding.UTF8;//邮件内容编码
|
|
|
|
|
msg.IsBodyHtml = true;//是否是HTML邮件
|
|
|
|
|
msg.Priority = MailPriority.High;//邮件优先级
|
|
|
|
|
var content = "";
|
|
|
|
|
AlternateView htmlBody = AlternateView.CreateAlternateViewFromString(content, null, "text/html");
|
|
|
|
|
/*
|
|
|
|
|
LinkedResource lrImage = new LinkedResource(@"D:\DSWebservice\a.jpg", "image/gif");
|
|
|
|
|
lrImage.ContentId = "Email001";
|
|
|
|
|
htmlBody.LinkedResources.Add(lrImage);
|
|
|
|
|
msg.AlternateViews.Add(htmlBody);*/
|
|
|
|
|
|
|
|
|
|
SmtpClient client = new SmtpClient();
|
|
|
|
|
client.Credentials = new System.Net.NetworkCredential("admin@dongshengsoft.com", "ds!@#)(*");
|
|
|
|
|
//在71info.com注册的邮箱和密码
|
|
|
|
|
client.Host = "smtpcom.263xmail.com";
|
|
|
|
|
client.EnableSsl = false;
|
|
|
|
|
client.Port = 465;
|
|
|
|
|
object userState = msg;
|
|
|
|
|
var Result = "";
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
//client.SendAsync(msg, userState);
|
|
|
|
|
//简单一点儿可以
|
|
|
|
|
client.Send(msg);
|
|
|
|
|
//MessageBox.Show("发送成功");
|
|
|
|
|
}
|
|
|
|
|
catch (System.Net.Mail.SmtpException ex)
|
|
|
|
|
{
|
|
|
|
|
Result = ex.Message;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static string REHH(string str)
|
|
|
|
|
{
|
|
|
|
|
var _s = "";
|
|
|
|
|
if (!string.IsNullOrEmpty(str))
|
|
|
|
|
{
|
|
|
|
|
_s = str.Replace("\n", "<br />");
|
|
|
|
|
}
|
|
|
|
|
return _s;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//public static StringBuilder SetBottom(StringBuilder Body, string BSNO)
|
|
|
|
|
//{
|
|
|
|
|
// Body.Append("<br />ShippingBoxNO.:" + BSNO);
|
|
|
|
|
// Body.Append("<br /> **********本邮件由<a href=http://www.shippingbox.cc style=\"color:blue;\">ShippingBox订舱平台</a>自动发送 *************");
|
|
|
|
|
// Body.Append("<br />本邮件仅提供当前货物部分摘要信息,详情请以双方约定为准!");
|
|
|
|
|
// Body.Append("<br /> <img src=\"http://123.57.17.72:8027/images/public/logo01.png\" />");
|
|
|
|
|
// Body.Append(" </Body></html>");
|
|
|
|
|
// Body.Append("<br /> <a href=http://www.shippingbox.cc style=\"color:blue;\">www.shippingbox.cc</a>");
|
|
|
|
|
|
|
|
|
|
// return Body;
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
#region 权限范围
|
|
|
|
|
public static string GetRangDAStr(string tb, string userid, string username, string companyid)
|
|
|
|
|
{
|
|
|
|
|
string str = "";
|
|
|
|
|
var strSql = new StringBuilder();
|
|
|
|
|
strSql.Append("SELECT ");
|
|
|
|
|
strSql.Append(" VISIBLERANGE,OPERATERANGE,AUTHORITYID,VSSQL ");
|
|
|
|
|
strSql.Append(" from VW_User_Authority ");
|
|
|
|
|
if (tb == "audit")
|
|
|
|
|
{
|
|
|
|
|
strSql.Append(" where [NAME]='modSeaeOrderAudit' and USERID='" + userid + "' and ISDELETE=0");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
strSql.Append(" where [NAME]='modSeaeOrderList' and USERID='" + userid + "' and ISDELETE=0");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
string visiblerange = "4";
|
|
|
|
|
string operaterange = "4";
|
|
|
|
|
string AUTHORITYID = "";
|
|
|
|
|
string VSSQL = "";
|
|
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
while (reader.Read())
|
|
|
|
|
{
|
|
|
|
|
visiblerange = Convert.ToString(reader["VISIBLERANGE"]);
|
|
|
|
|
operaterange = Convert.ToString(reader["OPERATERANGE"]);
|
|
|
|
|
AUTHORITYID = Convert.ToString(reader["AUTHORITYID"]);
|
|
|
|
|
VSSQL = Convert.ToString(reader["VSSQL"]);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
reader.Close();
|
|
|
|
|
}
|
|
|
|
|
if (visiblerange == "4")
|
|
|
|
|
{
|
|
|
|
|
str = "1=2";
|
|
|
|
|
}
|
|
|
|
|
else if (visiblerange == "3")
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
str = " (OP='" + username + "' OR SALE='" + username + "' or CUSTSERVICE='" + username + "' or DOC='" + username + "' or INPUTBY='" + username + "')";
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else if (visiblerange == "5")
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var userstr = new StringBuilder();
|
|
|
|
|
userstr.Append(" select SHOWNAME from VW_user where COMPANYID in (select COMPANYID from user_authority_range_company where userid='" + userid + "' and AUTHORITYID='" + AUTHORITYID + "' and VISIBLERANGE=1)");
|
|
|
|
|
Database userdb = DatabaseFactory.CreateDatabase();
|
|
|
|
|
using (IDataReader reader = userdb.ExecuteReader(CommandType.Text, userstr.ToString()))
|
|
|
|
|
{
|
|
|
|
|
str = "";
|
|
|
|
|
while (reader.Read())
|
|
|
|
|
{
|
|
|
|
|
if (str == "")
|
|
|
|
|
{
|
|
|
|
|
str = " (OP='" + Convert.ToString(reader["SHOWNAME"]) + "' OR SALE='" + Convert.ToString(reader["SHOWNAME"]) + "' OR CUSTSERVICE='" + Convert.ToString(reader["SHOWNAME"]) + "' OR DOC='" + Convert.ToString(reader["SHOWNAME"]) + "' OR INPUTBY='" + Convert.ToString(reader["SHOWNAME"]) + "' ";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
str = str + " or OP='" + Convert.ToString(reader["SHOWNAME"]) + "' OR SALE='" + Convert.ToString(reader["SHOWNAME"]) + "' OR CUSTSERVICE='" + Convert.ToString(reader["SHOWNAME"]) + "' OR DOC='" + Convert.ToString(reader["SHOWNAME"]) + "' OR INPUTBY='" + Convert.ToString(reader["SHOWNAME"]) + "' ";
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
str = str + ")";
|
|
|
|
|
reader.Close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else if (visiblerange == "6")
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var userstr = new StringBuilder();
|
|
|
|
|
userstr.Append(" select OPID,(select SHOWNAME from [user] where GID=user_authority_range_op.OPID) SHOWNAME from user_authority_range_op where userid='" + userid + "' and AUTHORITYID='" + AUTHORITYID + "' and VISIBLERANGE=1");
|
|
|
|
|
Database userdb = DatabaseFactory.CreateDatabase();
|
|
|
|
|
using (IDataReader reader = userdb.ExecuteReader(CommandType.Text, userstr.ToString()))
|
|
|
|
|
{
|
|
|
|
|
str = "";
|
|
|
|
|
while (reader.Read())
|
|
|
|
|
{
|
|
|
|
|
if (str == "")
|
|
|
|
|
{
|
|
|
|
|
str = " (OP='" + Convert.ToString(reader["SHOWNAME"]) + "' OR SALE='" + Convert.ToString(reader["SHOWNAME"]) + "' OR CUSTSERVICE='" + Convert.ToString(reader["SHOWNAME"]) + "' OR DOC='" + Convert.ToString(reader["SHOWNAME"]) + "' OR INPUTBY='" + Convert.ToString(reader["SHOWNAME"]) + "' ";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
str = str + " or OP='" + Convert.ToString(reader["SHOWNAME"]) + "' OR SALE='" + Convert.ToString(reader["SHOWNAME"]) + "' OR CUSTSERVICE='" + Convert.ToString(reader["SHOWNAME"]) + "' OR DOC='" + Convert.ToString(reader["SHOWNAME"]) + "' OR INPUTBY='" + Convert.ToString(reader["SHOWNAME"]) + "' ";
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
str = str + ")";
|
|
|
|
|
reader.Close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else if (visiblerange == "2")
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var rangeDa = new RangeDA();
|
|
|
|
|
var deptname = rangeDa.GetDEPTNAME(userid);
|
|
|
|
|
var userstr = new StringBuilder();
|
|
|
|
|
userstr.Append(" select SHOWNAME from [user] where GID in (select USERID from user_company where COMPANYID='" + companyid + "') and GID in (select userid from user_baseinfo where DEPTNAME='" + deptname + "')");
|
|
|
|
|
Database userdb = DatabaseFactory.CreateDatabase();
|
|
|
|
|
using (IDataReader reader = userdb.ExecuteReader(CommandType.Text, userstr.ToString()))
|
|
|
|
|
{
|
|
|
|
|
str = "";
|
|
|
|
|
while (reader.Read())
|
|
|
|
|
{
|
|
|
|
|
if (str == "")
|
|
|
|
|
{
|
|
|
|
|
str = " (OP='" + Convert.ToString(reader["SHOWNAME"]) + "' OR SALE='" + Convert.ToString(reader["SHOWNAME"]) + "' OR CUSTSERVICE='" + Convert.ToString(reader["SHOWNAME"]) + "' OR DOC='" + Convert.ToString(reader["SHOWNAME"]) + "' OR INPUTBY='" + Convert.ToString(reader["SHOWNAME"]) + "' ";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
str = str + " or OP='" + Convert.ToString(reader["SHOWNAME"]) + "' OR SALE='" + Convert.ToString(reader["SHOWNAME"]) + "' OR CUSTSERVICE='" + Convert.ToString(reader["SHOWNAME"]) + "' OR DOC='" + Convert.ToString(reader["SHOWNAME"]) + "' OR INPUTBY='" + Convert.ToString(reader["SHOWNAME"]) + "' ";
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
str = str + ")";
|
|
|
|
|
reader.Close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else if (visiblerange == "1")
|
|
|
|
|
{
|
|
|
|
|
var rangeDa = new RangeDA();
|
|
|
|
|
var userstr = new StringBuilder();
|
|
|
|
|
userstr.Append(" select SHOWNAME from [user] where GID in (select USERID from user_company where COMPANYID='" + companyid + "') ");
|
|
|
|
|
Database userdb = DatabaseFactory.CreateDatabase();
|
|
|
|
|
using (IDataReader reader = userdb.ExecuteReader(CommandType.Text, userstr.ToString()))
|
|
|
|
|
{
|
|
|
|
|
str = "";
|
|
|
|
|
while (reader.Read())
|
|
|
|
|
{
|
|
|
|
|
if (str == "")
|
|
|
|
|
{
|
|
|
|
|
str = " (OP='" + Convert.ToString(reader["SHOWNAME"]) + "' OR SALE='" + Convert.ToString(reader["SHOWNAME"]) + "' OR CUSTSERVICE='" + Convert.ToString(reader["SHOWNAME"]) + "' OR DOC='" + Convert.ToString(reader["SHOWNAME"]) + "' OR INPUTBY='" + Convert.ToString(reader["SHOWNAME"]) + "' ";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
str = str + " or OP='" + Convert.ToString(reader["SHOWNAME"]) + "' OR SALE='" + Convert.ToString(reader["SHOWNAME"]) + "' OR CUSTSERVICE='" + Convert.ToString(reader["SHOWNAME"]) + "' OR DOC='" + Convert.ToString(reader["SHOWNAME"]) + "' OR INPUTBY='" + Convert.ToString(reader["SHOWNAME"]) + "'";
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
str = str + ")";
|
|
|
|
|
reader.Close();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
VSSQL = VSSQL.Trim();
|
|
|
|
|
if (!string.IsNullOrEmpty(VSSQL))
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(str))
|
|
|
|
|
{
|
|
|
|
|
str = str + " and (" + VSSQL + ") ";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
str = " (" + VSSQL + ") ";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return str;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static string GetModifyRangDAStr(string userid, string username, string companyid)
|
|
|
|
|
{
|
|
|
|
|
string str = "";
|
|
|
|
|
var strSql = new StringBuilder();
|
|
|
|
|
strSql.Append("SELECT ");
|
|
|
|
|
strSql.Append(" VISIBLERANGE,OPERATERANGE,AUTHORITYID,VSSQL ");
|
|
|
|
|
strSql.Append(" from VW_User_Authority ");
|
|
|
|
|
strSql.Append(" where [NAME]='modSeaeModifyList' and USERID='" + userid + "' and ISDELETE=0");
|
|
|
|
|
|
|
|
|
|
string visiblerange = "4";
|
|
|
|
|
string operaterange = "4";
|
|
|
|
|
string AUTHORITYID = "";
|
|
|
|
|
string VSSQL = "";
|
|
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
while (reader.Read())
|
|
|
|
|
{
|
|
|
|
|
visiblerange = Convert.ToString(reader["VISIBLERANGE"]);
|
|
|
|
|
operaterange = Convert.ToString(reader["OPERATERANGE"]);
|
|
|
|
|
AUTHORITYID = Convert.ToString(reader["AUTHORITYID"]);
|
|
|
|
|
VSSQL = Convert.ToString(reader["VSSQL"]);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
reader.Close();
|
|
|
|
|
}
|
|
|
|
|
if (visiblerange == "4")
|
|
|
|
|
{
|
|
|
|
|
str = "1=2";
|
|
|
|
|
}
|
|
|
|
|
else if (visiblerange == "3")
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
str = " APPLYUSER='" + userid + "' ";
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else if (visiblerange == "5")
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var userstr = new StringBuilder();
|
|
|
|
|
userstr.Append(" select userid from VW_user where COMPANYID in (select COMPANYID from user_authority_range_company where userid='" + userid + "' and AUTHORITYID='" + AUTHORITYID + "' and VISIBLERANGE=1)");
|
|
|
|
|
Database userdb = DatabaseFactory.CreateDatabase();
|
|
|
|
|
using (IDataReader reader = userdb.ExecuteReader(CommandType.Text, userstr.ToString()))
|
|
|
|
|
{
|
|
|
|
|
str = "";
|
|
|
|
|
while (reader.Read())
|
|
|
|
|
{
|
|
|
|
|
if (str == "")
|
|
|
|
|
{
|
|
|
|
|
str = " (APPLYUSER='" + Convert.ToString(reader["userid"]) + "' ";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
str = str + " or APPLYUSER='" + Convert.ToString(reader["userid"]) + "' ";
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
str = str + ")";
|
|
|
|
|
reader.Close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else if (visiblerange == "6")
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var userstr = new StringBuilder();
|
|
|
|
|
userstr.Append(" select OPID,(select SHOWNAME from [user] where GID=user_authority_range_op.OPID) SHOWNAME from user_authority_range_op where userid='" + userid + "' and AUTHORITYID='" + AUTHORITYID + "' and VISIBLERANGE=1");
|
|
|
|
|
Database userdb = DatabaseFactory.CreateDatabase();
|
|
|
|
|
using (IDataReader reader = userdb.ExecuteReader(CommandType.Text, userstr.ToString()))
|
|
|
|
|
{
|
|
|
|
|
str = "";
|
|
|
|
|
while (reader.Read())
|
|
|
|
|
{
|
|
|
|
|
if (str == "")
|
|
|
|
|
{
|
|
|
|
|
str = " (APPLYUSER='" + Convert.ToString(reader["OPID"]) + "' ";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
str = str + " or APPLYUSER='" + Convert.ToString(reader["OPID"]) + "' ";
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
str = str + ")";
|
|
|
|
|
reader.Close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else if (visiblerange == "2")
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var rangeDa = new RangeDA();
|
|
|
|
|
var deptname = rangeDa.GetDEPTNAME(userid);
|
|
|
|
|
var userstr = new StringBuilder();
|
|
|
|
|
userstr.Append(" select GID from [user] where GID in (select USERID from user_company where COMPANYID='" + companyid + "') and GID in (select userid from user_baseinfo where DEPTNAME='" + deptname + "')");
|
|
|
|
|
Database userdb = DatabaseFactory.CreateDatabase();
|
|
|
|
|
using (IDataReader reader = userdb.ExecuteReader(CommandType.Text, userstr.ToString()))
|
|
|
|
|
{
|
|
|
|
|
str = "";
|
|
|
|
|
while (reader.Read())
|
|
|
|
|
{
|
|
|
|
|
if (str == "")
|
|
|
|
|
{
|
|
|
|
|
str = " (APPLYUSER='" + Convert.ToString(reader["GID"]) + "' ";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
str = str + " or APPLYUSER='" + Convert.ToString(reader["GID"]) + "'";
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
str = str + ")";
|
|
|
|
|
reader.Close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else if (visiblerange == "1")
|
|
|
|
|
{
|
|
|
|
|
var rangeDa = new RangeDA();
|
|
|
|
|
var userstr = new StringBuilder();
|
|
|
|
|
userstr.Append(" select USERID from user_company where COMPANYID='" + companyid + "' ");
|
|
|
|
|
Database userdb = DatabaseFactory.CreateDatabase();
|
|
|
|
|
using (IDataReader reader = userdb.ExecuteReader(CommandType.Text, userstr.ToString()))
|
|
|
|
|
{
|
|
|
|
|
str = "";
|
|
|
|
|
while (reader.Read())
|
|
|
|
|
{
|
|
|
|
|
if (str == "")
|
|
|
|
|
{
|
|
|
|
|
str = " (APPLYUSER='" + Convert.ToString(reader["USERID"]) + "'";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
str = str + " or APPLYUSER='" + Convert.ToString(reader["USERID"]) + "' ";
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
str = str + ")";
|
|
|
|
|
reader.Close();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
VSSQL = VSSQL.Trim();
|
|
|
|
|
if (!string.IsNullOrEmpty(VSSQL))
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(str))
|
|
|
|
|
{
|
|
|
|
|
str = str + " and (" + VSSQL + ") ";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
str = " (" + VSSQL + ") ";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return str;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|