|
|
using System;
|
|
|
using System.Data;
|
|
|
using System.Data.Common;
|
|
|
using System.Collections;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Text;
|
|
|
using DSWeb.MvcShipping.Models.MsOpSeae;
|
|
|
using DSWeb.MvcShipping.Models.MsOpSeaeBill;
|
|
|
using DSWeb.MvcShipping.Models.MsOpStatus;
|
|
|
using Microsoft.Practices.EnterpriseLibrary.Data;
|
|
|
using DSWeb.EntityDA;
|
|
|
using DSWeb.Areas.CommMng.Models;
|
|
|
using HcUtility.Comm;
|
|
|
using System.Data.SqlClient;
|
|
|
using DSWeb.DataAccess;
|
|
|
using HcUtility.Core;
|
|
|
using DSWeb.Areas.CommMng.DAL;
|
|
|
using DotNet4.Utilities;
|
|
|
using DSWeb.MvcShipping.DAL.MsSysParamSet;
|
|
|
using System.Web;
|
|
|
using DSWeb.MvcShipping.DAL.DsSendmail;
|
|
|
using DSWeb.MvcShipping.DAL.MsBaseInfoDAL;
|
|
|
using DSWeb.MvcShipping.DAL.MsSysBillNoSet;
|
|
|
using DSWeb.Areas.SysMng.DAL.SysUser;
|
|
|
using DSWeb.MvcShipping.DAL.MsInfoClient;
|
|
|
using DSWeb.SoftMng.DAL.SoftSysTable;
|
|
|
using DSWeb.Areas.MvcShipping.DAL.BookingConfirm;
|
|
|
using DSWeb.Areas.MvcShipping.DAL;
|
|
|
using DSWeb.Common.DB;
|
|
|
using System.Linq;
|
|
|
using DSWeb.MvcShipping.Models.MsSeaeOrder;
|
|
|
|
|
|
namespace DSWeb.MvcShipping.DAL.MsOpSeaeDAL
|
|
|
{
|
|
|
public class MsOpSeaeDAL
|
|
|
{
|
|
|
#region 查询
|
|
|
static public List<MsOpSeae> GetDataList ( string strCondition, string userid, string usercode, string companyid, string sort = null, string load = null )
|
|
|
{
|
|
|
var rangstr = GetRangDAStr("index", userid, usercode, companyid);
|
|
|
if (!string.IsNullOrEmpty(rangstr))
|
|
|
{
|
|
|
if (!string.IsNullOrEmpty(strCondition))
|
|
|
{
|
|
|
strCondition = strCondition + " and " + rangstr;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strCondition = rangstr;
|
|
|
}
|
|
|
}
|
|
|
//var Feninlist = MsSysParamSetDAL.GetData("PARAMNAME='Feninlist'");
|
|
|
//if (Feninlist.PARAMVALUE != "1") {
|
|
|
// if (!string.IsNullOrEmpty(strCondition))
|
|
|
// {
|
|
|
// strCondition = " MASTERNO=BSNO and " + strCondition;
|
|
|
// }
|
|
|
// else
|
|
|
// {
|
|
|
// strCondition = " MASTERNO=BSNO ";
|
|
|
// }
|
|
|
//}
|
|
|
|
|
|
|
|
|
//
|
|
|
var strSql = new StringBuilder();
|
|
|
//if (load == "true")
|
|
|
//{
|
|
|
// strSql.Append("SELECT top 200 B.BSNO,MASTERNO,ORDERTYPE,ORDTYPE,ORDERNO,BSSTATUS,FEESTATUS,BSDATE,ACCDATE,MBLNO,HBLNO,CUSTNO,TRANSNO,CUSTOMERNAME,BLTYPE,SHIPPERID,");
|
|
|
// strSql.Append("CONSIGNEEID,NOTIFYPARTYID,'' SHIPPER,'' CONSIGNEE,'' NOTIFYPARTY,AGENTID,'' AGENT,YARD,VESSEL,VOYNO,ETD,CLOSINGDATE,ETA,");
|
|
|
//}
|
|
|
//else
|
|
|
//{
|
|
|
strSql.Append("SELECT OP_SEAE.BSNO,MASTERNO,ORDERTYPE,ORDTYPE,ORDERNO,BSSTATUS,FEESTATUS,BSDATE,ACCDATE,MBLNO,HBLNO,APPLYNO,CUSTNO,TRANSNO,CUSTOMERNAME,BLTYPE,SHIPPERID,");
|
|
|
strSql.Append("CONSIGNEEID,NOTIFYPARTYID,SHIPPER,CONSIGNEE,NOTIFYPARTY,AGENTID,AGENT,YARD,VESSEL,VOYNO,ETD,ETD2,CLOSINGDATE,ETA,VESSEL2N,VOYNO2N,VESSELID2N,");
|
|
|
//}
|
|
|
strSql.Append("PlACERECEIPT,PORTLOADID,PORTLOAD,PORTDISCHARGEID,PORTDISCHARGE,PLACEDELIVERYID,PLACEDELIVERY,DESTINATIONID,DESTINATION,COPYNOBILL,");
|
|
|
strSql.Append("NOBILL,ISSUETYPE,ISSUEDATE,ISSUEPLACE,BLFRT,PREPARDAT,PREPARDATID,PAYABLEAT,[SERVICE],MARKS,CNTRSEALNO,NOPKGS,[DESCRIPTION],GOODSNAME,");
|
|
|
strSql.Append("GROSSWEIGHT,MEASUREMENT,PKGS,KINDPKGS,KGS,CBM,TOTALNO,CNTRNO,CNTR1,CNTR2,CNTR3,CNTR4,CNTR5,CNTR6,CNTR7,CNTR8,CNTR9,CNTR10,OTCNTR,");
|
|
|
strSql.Append("TEU,CNTRTOTAL,INPUTBY,OP,CUSTSERVICE,FRCUSTSERVICE,LANE,SALE,CARRIER,FORWARDER,CUSTOMSER,TRUCKER,INVNO,CARGOID,DCLASS,DUNNO,DPAGE,DLABEL,LINKMAN,");
|
|
|
strSql.Append("REEFERF,TEMPID,TEMPSET,TEMPMAX,TEMPMIN,HUMIDITY,BSSOURCE,BSSOURCEDETAIL,CUSTOMSNUM,CONTRACTNO,INSURANCEER,INSURANCENO,INAMOUT,ISVOU,VOUNO,REMARK,STATUS1,");
|
|
|
strSql.Append("STATUS2,STATUS3,STATUS4,STATUS5,ISFUMIGATION,ISSTORAGE,ISLAND,ISCUSTOMS,ISINSPECTION,ISBOOKING,ISAGENT,ISHBLNO,SERVICE9,SERVICE10,DOC,PACKINGTYPE,");
|
|
|
strSql.Append("WAREHOUSE,CLOSEDOCDATE,INTOPORTDATE,CORPID,SALEDEPT,MBLFRT,CREATETIME,STLNAME,dbo.trimdate(STLDATE) STLDATE,OPERATORCODE,OPERATOR,OPERATOREMAIL,OPERATORTEL,OPERATORFAX,");
|
|
|
strSql.Append("FINANCIALSTAFFCODE,FINANCIALSTAFF,FINANCIALSTAFFEMAIL,FINANCIALSTAFFTEL,FINANCIALSTAFFFAX,PLACERECEIPTID,SOURCECODE,ISCONTAINERSOC,VESSELID,ISSUEPLACEID,HSCODE");
|
|
|
strSql.Append(",TRANSTATUS,EDIREMARK,SERVICECONTRACTNO,(CASE BSSTATUS WHEN 1 THEN '锁定' else '未锁定' end) as BSSTATUSREF ");
|
|
|
strSql.Append(",(CASE FEESTATUS WHEN 1 THEN '锁定' else '未锁定' end) as FEESTATUSREF,TRANSPORT ");
|
|
|
//strSql.Append(",(SELECT TOP 1 STATUS FROM OP_STATUS WHERE BSNO=OP_SEAE.BSNO ORDER BY COMPTIME DESC,INPUTTIME DESC) as OPSTATUS ");
|
|
|
strSql.Append(",(SELECT TOP 1 STATUS FROM V_OP_STATUS WITH (NOLOCK) WHERE BSNO=OP_SEAE.BSNO ORDER BY COMPTIME DESC,INPUTTIME DESC) as OPSTATUS");
|
|
|
strSql.Append(",(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=97018 and EnumValueID=OP_SEAE.MANIFESTSTATUS) as MANIFESTSTATUSREF");
|
|
|
strSql.Append(",CUSTOMNO,ENTERPID,ENTERP,INSPECTIONNO,INSPECTIONDATE,CUSTOMDATE,CLEARCUSTOMDATE,ISMOREGOOD,TERMSDELIVERY,INSPECTSERVICE,TRADETERM,0 FENPIAO,ISGAIQIAN,WARNCOUNT");
|
|
|
|
|
|
strSql.Append(",dbo.F_GetBillDrFeeStatus(OP_SEAE.BSNO) DRFEESTATUS");
|
|
|
strSql.Append(",dbo.F_GetBillCrFeeStatus(OP_SEAE.BSNO) CRFEESTATUS,ISPRINTPR,MAILPROJECT");
|
|
|
// strSql.Append(",S.STATUS as OPSTATUS ");
|
|
|
strSql.Append(",(SELECT COUNT(*) FROM OP_AMEND WHERE PARENTID=OP_SEAE.BSNO) as AMENDCOUNT,SHIPAGENCY ");
|
|
|
strSql.Append(",I.TTLDR,I.TTLINVDR,I.TTLDUIDR,I.TTLCR,I.TTLINVCR,I.TTLDUICR,0 YJCR,0 HYFDR,0 HYFCR,0 BGFDR,0 NODAY");
|
|
|
strSql.Append(",(SELECT COUNT(*) FROM OP_APPLY WHERE MASTERNO=OP_SEAE.BSNO) as APPLYCOUNT ");
|
|
|
|
|
|
//20161117 邓羽 增加对提单签发状态的查询
|
|
|
strSql.Append(",(SELECT TOP 1 BLSTATUS FROM op_blissue WHERE BSNO=OP_SEAE.BSNO) BLISSUESTATUS,ISCANCEL,ISTUI,TRANSREMARK,PRERECORD ");
|
|
|
|
|
|
strSql.Append(",MSHIPPERID,MCONSIGNEEID,MNOTIFYPARTYID,MSHIPPER,MCONSIGNEE,MNOTIFYPARTY,ATD,DELIVERYDATE,YARDATTN,YARDTEL,BillFeeStatus,SALECORPID,'' MDESCRIPTION ");
|
|
|
strSql.Append(",(select [NAME] from [company] where GID=OP_SEAE.SALECORPID) as SALECORP");
|
|
|
strSql.Append(",0 CUSTOMSSTATUS,0 PORTSTATUS,0 EXPSTATUS,0 TRUCKCTNSTATUS,0 CTNRETURNSTATUS,0 HGYDSTATUS,TRUCKSTATUS,0 ATASTATUS,0 STCSSTATUS,0 RCVESTATUS,'' COUNTRY,EDI_TIME,VGM_TIME ");
|
|
|
|
|
|
strSql.Append(",STUFF((SELECT ',' + CNTRNO FROM op_ctn ctn WHERE ctn.BSNO = op_seae.BSNO FOR xml path('')),1, 1, '') AS CNTRNOALL ");
|
|
|
strSql.Append(",STUFF((SELECT ',' + SEALNO FROM op_ctn ctn WHERE ctn.BSNO = op_seae.BSNO FOR xml path('')),1, 1, '') AS SEALNOALL ");
|
|
|
|
|
|
strSql.Append(",dbo.F_STATUS_BULIAO(OP_SEAE.bsno) STATUS_BULIAO,dbo.F_STATUS_VGM(OP_SEAE.bsno) STATUS_VGM,dbo.F_STATUS_EDI(OP_SEAE.bsno) STATUS_EDI ");
|
|
|
strSql.Append(",(select top 1 ORDNO from crm_seaeorder where bsno=OP_SEAE.BSNO ) ORDNO");
|
|
|
strSql.Append(",(select top 1 CUSTOMERNAME from crm_seaeorder_fen where MASTERNO = OP_SEAE.BSNO order by ordno) FEN_CUSTOMERNAME");
|
|
|
strSql.Append(",ISEI");
|
|
|
strSql.Append(" from OP_SEAE ");
|
|
|
strSql.Append(" LEFT JOIN v_op_gain_dr_INV I ON (I.BSNO=OP_SEAE.BSNO) ");
|
|
|
// strSql.Append(" left join V_OP_STATUS S ON (S.BSNO=B.BSNO) ");
|
|
|
|
|
|
if (!string.IsNullOrEmpty(strCondition))
|
|
|
{
|
|
|
strSql.Append(" where MASTERNO=OP_SEAE.BSNO AND EXISTS ( select 1 from OP_SEAE B WHERE OP_SEAE.BSNO=B.MASTERNO AND " + strCondition + " )");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strSql.Append(" where MASTERNO=OP_SEAE.BSNO ");
|
|
|
|
|
|
}
|
|
|
//
|
|
|
var sortstring = DatasetSort.Getsortstring(sort);
|
|
|
if (!string.IsNullOrEmpty(sortstring))
|
|
|
{
|
|
|
if (sortstring.ToUpper().IndexOf("OPSTATUS") >= 0)
|
|
|
strSql.Append(" order by " + sortstring.Replace("OPSTATUS", "(SELECT TOP 1 STATUS FROM V_OP_STATUS WITH (NOLOCK) WHERE BSNO=OP_SEAE.BSNO ORDER BY COMPTIME DESC,INPUTTIME DESC)"));
|
|
|
else if (sortstring.ToUpper().IndexOf("DRFEESTATUS") >= 0)
|
|
|
strSql.Append(" order by " + sortstring.Replace("DRFEESTATUS", " dbo.F_GetBillDrFeeStatus(OP_SEAE.BSNO) "));
|
|
|
else if (sortstring.ToUpper().IndexOf("CRFEESTATUS") >= 0)
|
|
|
strSql.Append(" order by " + sortstring.Replace("CRFEESTATUS", " dbo.F_GetBillCrFeeStatus(OP_SEAE.BSNO) "));
|
|
|
else if (sortstring.ToUpper().IndexOf("BSSTATUSREF") >= 0)
|
|
|
strSql.Append(" order by " + sortstring.Replace("BSSTATUSREF", " BSSTATUS "));
|
|
|
else if (sortstring.ToUpper().IndexOf("FEESTATUSREF") >= 0)
|
|
|
strSql.Append(" order by " + sortstring.Replace("FEESTATUSREF", " FEESTATUS "));
|
|
|
else if (sortstring.ToUpper().IndexOf("AMEND") >= 0)
|
|
|
strSql.Append(" order by " + sortstring.Replace("AMEND", " CASE WHEN (SELECT COUNT(*) FROM OP_AMEND WHERE PARENTID=OP_SEAE.BSNO)>0 THEN 1 ELSE 0 END "));
|
|
|
else if (sortstring.ToUpper().IndexOf("DRINVSTATUS") >= 0)
|
|
|
strSql.Append(" order by " + sortstring.Replace("DRINVSTATUS", " CASE WHEN ISNULL(I.TTLINVDR,0)=0 THEN '未开票' ELSE CASE WHEN ISNULL(I.TTLINVDR,0)=ISNULL(I.TTLDR,0) THEN '已开票' ELSE '部分开票' END END "));
|
|
|
else if (sortstring.ToUpper().IndexOf("DRDUISTATUS") >= 0)
|
|
|
strSql.Append(" order by " + sortstring.Replace("DRDUISTATUS", " CASE WHEN ISNULL(I.TTLDUIDR,0)=0 THEN '未对账' ELSE CASE WHEN ISNULL(I.TTLDUIDR,0)=ISNULL(I.TTLDR,0) THEN '已对账' ELSE '部分对账' END END "));
|
|
|
else
|
|
|
{
|
|
|
sortstring = sortstring.Replace("SALECORP", "OP_SEAE.SALECORPID");
|
|
|
strSql.Append(" order by " + sortstring);
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
var SeaeDefaultSort = MsSysParamSetDAL.GetData("PARAMNAME='SeaeDefaultSort'");
|
|
|
if (SeaeDefaultSort.PARAMVALUE != "")
|
|
|
strSql.Append(" order by " + SeaeDefaultSort.PARAMVALUE );
|
|
|
else
|
|
|
strSql.Append(" order by BSDATE desc");
|
|
|
}
|
|
|
return SetData(strSql);
|
|
|
}
|
|
|
|
|
|
static public List<MsOpSeae> GetDataList(int start, int limit, string strCondition, string userid, string usercode, string companyid, string sort = null, string load = null)
|
|
|
{
|
|
|
var rangstr = GetRangDAStr("index", userid, usercode, companyid);
|
|
|
if (!string.IsNullOrEmpty(rangstr))
|
|
|
{
|
|
|
if (!string.IsNullOrEmpty(strCondition))
|
|
|
{
|
|
|
strCondition = strCondition + " and " + rangstr;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strCondition = rangstr;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
var isNoForward = MsBaseInfoDAL.MsBaseInfoDAL.GetUserModuleEnable("modMsNoForward", userid);
|
|
|
|
|
|
var strSql = new StringBuilder();
|
|
|
|
|
|
strSql.Append(@"SELECT *,'' COUNTRY from (SELECT row_number() over (");
|
|
|
|
|
|
var sortstring = DatasetSort.Getsortstring(sort);
|
|
|
if (!string.IsNullOrEmpty(sortstring))
|
|
|
{
|
|
|
if (sortstring.ToUpper().IndexOf("OPSTATUS") >= 0)
|
|
|
strSql.Append(" order by " + sortstring.Replace("OPSTATUS", "(SELECT TOP 1 STATUS FROM V_OP_STATUS WITH (NOLOCK) WHERE BSNO=OP_SEAE.BSNO ORDER BY COMPTIME DESC,INPUTTIME DESC)"));
|
|
|
else if (sortstring.ToUpper().IndexOf("DRFEESTATUS") >= 0)
|
|
|
strSql.Append(" order by " + sortstring.Replace("DRFEESTATUS", " dbo.F_GetBillDrFeeStatus(OP_SEAE.BSNO) "));
|
|
|
else if (sortstring.ToUpper().IndexOf("CRFEESTATUS") >= 0)
|
|
|
strSql.Append(" order by " + sortstring.Replace("CRFEESTATUS", " dbo.F_GetBillCrFeeStatus(OP_SEAE.BSNO) "));
|
|
|
else if (sortstring.ToUpper().IndexOf("BSSTATUSREF") >= 0)
|
|
|
strSql.Append(" order by " + sortstring.Replace("BSSTATUSREF", " BSSTATUS "));
|
|
|
else if (sortstring.ToUpper().IndexOf("FEESTATUSREF") >= 0)
|
|
|
strSql.Append(" order by " + sortstring.Replace("FEESTATUSREF", " FEESTATUS "));
|
|
|
else if (sortstring.ToUpper().IndexOf("AMEND") >= 0)
|
|
|
strSql.Append(" order by " + sortstring.Replace("AMEND", " CASE WHEN (SELECT COUNT(*) FROM OP_AMEND WHERE PARENTID=OP_SEAE.BSNO)>0 THEN 1 ELSE 0 END "));
|
|
|
else if (sortstring.ToUpper().IndexOf("DRINVSTATUS") >= 0)
|
|
|
strSql.Append(" order by " + sortstring.Replace("DRINVSTATUS", " CASE WHEN ISNULL(I.TTLINVDR,0)=0 THEN '未开票' ELSE CASE WHEN ISNULL(I.TTLINVDR,0)=ISNULL(I.TTLDR,0) THEN '已开票' ELSE '部分开票' END END "));
|
|
|
else if (sortstring.ToUpper().IndexOf("DRDUISTATUS") >= 0)
|
|
|
strSql.Append(" order by " + sortstring.Replace("DRDUISTATUS", " CASE WHEN ISNULL(I.TTLDUIDR,0)=0 THEN '未对账' ELSE CASE WHEN ISNULL(I.TTLDUIDR,0)=ISNULL(I.TTLDR,0) THEN '已对账' ELSE '部分对账' END END "));
|
|
|
else
|
|
|
{
|
|
|
sortstring= sortstring.Replace("SALECORP", "OP_SEAE.SALECORPID");
|
|
|
strSql.Append(" order by " + sortstring);
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
var SeaeDefaultSort = MsSysParamSetDAL.GetData("PARAMNAME='SeaeDefaultSort'");
|
|
|
if (SeaeDefaultSort.PARAMVALUE != "")
|
|
|
strSql.Append(" order by " + SeaeDefaultSort.PARAMVALUE );
|
|
|
else
|
|
|
strSql.Append(" order by BSDATE desc");
|
|
|
}
|
|
|
strSql.Append(@") as num , ");
|
|
|
|
|
|
strSql.Append("OP_SEAE.BSNO,MASTERNO,ORDERTYPE,ORDTYPE,ORDERNO,BSSTATUS,FEESTATUS,BSDATE,ACCDATE,MBLNO,HBLNO,APPLYNO,CUSTNO,TRANSNO,CUSTOMERNAME,BLTYPE,SHIPPERID,");
|
|
|
strSql.Append("CONSIGNEEID,NOTIFYPARTYID,SHIPPER,CONSIGNEE,NOTIFYPARTY,AGENTID,AGENT,YARD,VESSEL,VOYNO,ETD,ETD2,CLOSINGDATE,ETA,VESSEL2N,VOYNO2N,VESSELID2N,");
|
|
|
|
|
|
strSql.Append("PlACERECEIPT,PORTLOADID,PORTLOAD,PORTDISCHARGEID,PORTDISCHARGE,PLACEDELIVERYID,PLACEDELIVERY,DESTINATIONID,DESTINATION,COPYNOBILL,");
|
|
|
strSql.Append("NOBILL,ISSUETYPE,ISSUEDATE,ISSUEPLACE,BLFRT,PREPARDAT,PREPARDATID,PAYABLEAT,[SERVICE],MARKS,CNTRSEALNO,NOPKGS,[DESCRIPTION],GOODSNAME,");
|
|
|
strSql.Append("GROSSWEIGHT,MEASUREMENT,PKGS,KINDPKGS,KGS,CBM,TOTALNO,CNTRNO,CNTR1,CNTR2,CNTR3,CNTR4,CNTR5,CNTR6,CNTR7,CNTR8,CNTR9,CNTR10,OTCNTR,");
|
|
|
strSql.Append("TEU,CNTRTOTAL,INPUTBY,OP,CUSTSERVICE,FRCUSTSERVICE,LANE,SALE,CARRIER,FORWARDER,CUSTOMSER,TRUCKER,INVNO,CARGOID,DCLASS,DUNNO,DPAGE,DLABEL,LINKMAN,");
|
|
|
strSql.Append("REEFERF,TEMPID,TEMPSET,TEMPMAX,TEMPMIN,HUMIDITY,BSSOURCE,BSSOURCEDETAIL,CUSTOMSNUM,CONTRACTNO,INSURANCEER,INSURANCENO,INAMOUT,ISVOU,VOUNO,REMARK,STATUS1,");
|
|
|
strSql.Append("STATUS2,STATUS3,STATUS4,STATUS5,ISFUMIGATION,ISSTORAGE,ISLAND,ISCUSTOMS,ISINSPECTION,ISBOOKING,ISAGENT,ISHBLNO,SERVICE9,SERVICE10,DOC,PACKINGTYPE,");
|
|
|
strSql.Append("WAREHOUSE,CLOSEDOCDATE,INTOPORTDATE,CORPID,SALEDEPT,MBLFRT,CREATETIME,STLNAME,dbo.trimdate(STLDATE) STLDATE,OPERATORCODE,OPERATOR,OPERATOREMAIL,OPERATORTEL,OPERATORFAX,");
|
|
|
strSql.Append("FINANCIALSTAFFCODE,FINANCIALSTAFF,FINANCIALSTAFFEMAIL,FINANCIALSTAFFTEL,FINANCIALSTAFFFAX,PLACERECEIPTID,SOURCECODE,ISCONTAINERSOC,VESSELID,ISSUEPLACEID,HSCODE");
|
|
|
strSql.Append(",TRANSTATUS,EDIREMARK,SERVICECONTRACTNO,(CASE BSSTATUS WHEN 1 THEN '锁定' else '未锁定' end) as BSSTATUSREF ");
|
|
|
strSql.Append(",(CASE FEESTATUS WHEN 1 THEN '锁定' else '未锁定' end) as FEESTATUSREF,TRANSPORT ");
|
|
|
strSql.Append(",(SELECT TOP 1 STATUS FROM V_OP_STATUS WITH (NOLOCK) WHERE BSNO=OP_SEAE.BSNO ORDER BY COMPTIME DESC,INPUTTIME DESC) as OPSTATUS");
|
|
|
strSql.Append(",(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=97018 and EnumValueID=OP_SEAE.MANIFESTSTATUS) as MANIFESTSTATUSREF");
|
|
|
strSql.Append(",CUSTOMNO,ENTERPID,ENTERP,INSPECTIONNO,INSPECTIONDATE,CUSTOMDATE,CLEARCUSTOMDATE,ISMOREGOOD,TERMSDELIVERY,INSPECTSERVICE,TRADETERM,0 FENPIAO,ISGAIQIAN,WARNCOUNT");
|
|
|
|
|
|
strSql.Append(",dbo.F_GetBillDrFeeStatus(OP_SEAE.BSNO) DRFEESTATUS");
|
|
|
strSql.Append(",dbo.F_GetBillCrFeeStatus(OP_SEAE.BSNO) CRFEESTATUS,ISPRINTPR,MAILPROJECT");
|
|
|
|
|
|
strSql.Append(",(SELECT COUNT(*) FROM OP_AMEND WHERE PARENTID=OP_SEAE.BSNO) as AMENDCOUNT,SHIPAGENCY ");
|
|
|
strSql.Append(",I.TTLDR,I.TTLINVDR,I.TTLDUIDR,I.TTLCR,I.TTLINVCR,I.TTLDUICR,0 YJCR,0 HYFDR,0 HYFCR,0 BGFDR,0 NODAY");
|
|
|
strSql.Append(",(SELECT COUNT(*) FROM OP_APPLY WHERE MASTERNO=OP_SEAE.BSNO) as APPLYCOUNT ");
|
|
|
|
|
|
|
|
|
strSql.Append(",(SELECT TOP 1 BLSTATUS FROM op_blissue WHERE BSNO=OP_SEAE.BSNO) BLISSUESTATUS,ISCANCEL,ISTUI,TRANSREMARK,PRERECORD ");
|
|
|
|
|
|
strSql.Append(",MSHIPPERID,MCONSIGNEEID,MNOTIFYPARTYID,MSHIPPER,MCONSIGNEE,MNOTIFYPARTY,ATD,DELIVERYDATE,YARDATTN,YARDTEL,BillFeeStatus,SALECORPID,'' MDESCRIPTION ");
|
|
|
strSql.Append(",(select [NAME] from [company] where GID=OP_SEAE.SALECORPID) as SALECORP,(select TOP 1 COLOR FROM code_op_status_detail WITH (NOLOCK) WHERE OPSTATUS = (CASE WHEN (SELECT TOP 1 [STATUS] FROM V_OP_STATUS WHERE BSNO=OP_SEAE.BSNO ORDER BY COMPTIME DESC,INPUTTIME DESC) is null THEN '接受委托' else (SELECT TOP 1[STATUS] FROM V_OP_STATUS WHERE BSNO = OP_SEAE.BSNO ORDER BY COMPTIME DESC, INPUTTIME DESC) end))AS COLOR");
|
|
|
strSql.Append(" ,V.CUSTOMSSTATUS,V.PORTSTATUS,V.EXPSTATUS,V.TRUCKCTNSTATUS,V.CTNRETURNSTATUS,V.HGYDSTATUS,TRUCKSTATUS,V.ATASTATUS,V.STCSSTATUS,V.RCVESTATUS ,EDI_TIME,VGM_TIME ");
|
|
|
|
|
|
|
|
|
strSql.Append(",STUFF((SELECT ',' + CNTRNO FROM op_ctn ctn WHERE ctn.BSNO = op_seae.BSNO FOR xml path('')),1, 1, '') AS CNTRNOALL ");
|
|
|
strSql.Append(", STUFF((SELECT ',' + SEALNO FROM op_ctn ctn WHERE ctn.BSNO = op_seae.BSNO FOR xml path('')),1, 1, '') AS SEALNOALL ");
|
|
|
strSql.Append(",dbo.F_STATUS_BULIAO(OP_SEAE.bsno) STATUS_BULIAO,dbo.F_STATUS_VGM(OP_SEAE.bsno) STATUS_VGM,dbo.F_STATUS_EDI(OP_SEAE.bsno) STATUS_EDI ");
|
|
|
strSql.Append(",(select top 1 ORDNO from crm_seaeorder where bsno=OP_SEAE.BSNO ) ORDNO");
|
|
|
strSql.Append(",(select top 1 CUSTOMERNAME from crm_seaeorder_fen where MASTERNO = OP_SEAE.BSNO order by ordno) FEN_CUSTOMERNAME");
|
|
|
strSql.Append(",ISEI");
|
|
|
strSql.Append(" from OP_SEAE ");
|
|
|
strSql.Append(" LEFT JOIN v_op_gain_dr_INV I ON (I.BSNO=OP_SEAE.BSNO) ");
|
|
|
|
|
|
strSql.Append(" left join (select bsno, sum(case when[status] = '海关放行' then 1 else 0 end) CUSTOMSSTATUS, sum(case when [status] = '运抵报告' then 1 else 0 end) HGYDSTATUS , sum(case when[status] = '码头放行' then 1 else 0 end) PORTSTATUS");
|
|
|
strSql.Append(", sum(case when[status] = '装船出运' then 1 else 0 end) EXPSTATUS, sum(case when [status] = '空箱出场' then 1 else case when [status] = '部分空出' then 2 else 0 end end) TRUCKCTNSTATUS");
|
|
|
strSql.Append(", sum(case when[status] = '到港' then 1 else 0 end) ATASTATUS, sum(case when [status] = '目的港提箱' then 1 else case when [status] = '部分目的港提箱' then 2 else 0 end end) STCSSTATUS ");
|
|
|
strSql.Append(", sum(case when [status] = '目的港返空' then 1 else case when [status] = '部分目的港返空' then 2 else 0 end end) RCVESTATUS ");
|
|
|
strSql.Append(", sum(case when[status] = '重箱返场' then 1 else case when [status] = '部分重返' then 2 else 0 end end) CTNRETURNSTATUS from op_status WITH (NOLOCK) GROUP BY BSNO) as v on(v.bsno = OP_SEAE.BSNO) ");
|
|
|
|
|
|
if (!string.IsNullOrEmpty(strCondition))
|
|
|
{
|
|
|
strSql.Append(" where MASTERNO=OP_SEAE.BSNO AND EXISTS ( select 1 from OP_SEAE B WHERE OP_SEAE.BSNO=B.MASTERNO AND " + strCondition + " )");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strSql.Append(" where MASTERNO=OP_SEAE.BSNO ");
|
|
|
|
|
|
}
|
|
|
strSql.Append(@")as t ");
|
|
|
strSql.Append(string.Format("where t.num>{0} and t.num<={1} order by t.num ", start, start + limit)); //
|
|
|
|
|
|
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 OP_SEAE ");
|
|
|
strSql.Append(" LEFT JOIN v_op_gain_dr_INV I ON (I.BSNO=OP_SEAE.BSNO) ");
|
|
|
|
|
|
if (!string.IsNullOrEmpty(strCondition))
|
|
|
{
|
|
|
strSql.Append(" where MASTERNO=OP_SEAE.BSNO AND EXISTS ( select 1 from OP_SEAE B WHERE OP_SEAE.BSNO=B.MASTERNO AND " + strCondition + " )");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strSql.Append(" where MASTERNO=OP_SEAE.BSNO ");
|
|
|
|
|
|
}
|
|
|
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 List<MsOpSeae> GetSaleDataList (int start, int limit, string strCondition, string username, string sort = null, string load = null,string userid="",string companyid="")
|
|
|
{
|
|
|
var rangstr = GetSaleRangDAStr("index", userid, username, 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))
|
|
|
{
|
|
|
if (sortstring.ToUpper().IndexOf("OPSTATUS") >= 0)
|
|
|
strSql.Append(" order by " + sortstring.Replace("OPSTATUS", "(SELECT TOP 1 STATUS FROM V_OP_STATUS WITH (NOLOCK) WHERE BSNO=B.BSNO ORDER BY COMPTIME DESC,INPUTTIME DESC)"));
|
|
|
else if (sortstring.ToUpper().IndexOf("DRFEESTATUS") >= 0)
|
|
|
strSql.Append(" order by " + sortstring.Replace("DRFEESTATUS", " dbo.F_GetBillDrFeeStatus(B.BSNO) "));
|
|
|
else if (sortstring.ToUpper().IndexOf("CRFEESTATUS") >= 0)
|
|
|
strSql.Append(" order by " + sortstring.Replace("CRFEESTATUS", " dbo.F_GetBillCrFeeStatus(B.BSNO) "));
|
|
|
else if (sortstring.ToUpper().IndexOf("BSSTATUSREF") >= 0)
|
|
|
strSql.Append(" order by " + sortstring.Replace("BSSTATUSREF", " BSSTATUS "));
|
|
|
else if (sortstring.ToUpper().IndexOf("FEESTATUSREF") >= 0)
|
|
|
strSql.Append(" order by " + sortstring.Replace("FEESTATUSREF", " FEESTATUS "));
|
|
|
else if (sortstring.ToUpper().IndexOf("AMEND") >= 0)
|
|
|
strSql.Append(" order by " + sortstring.Replace("AMEND", " CASE WHEN (SELECT COUNT(*) FROM OP_AMEND WHERE PARENTID=B.BSNO)>0 THEN 1 ELSE 0 END "));
|
|
|
else if (sortstring.ToUpper().IndexOf("DRINVSTATUS") >= 0)
|
|
|
strSql.Append(" order by " + sortstring.Replace("DRINVSTATUS", " CASE WHEN ISNULL(I.TTLINVDR,0)=0 THEN '未开票' ELSE CASE WHEN ISNULL(I.TTLINVDR,0)=ISNULL(I.TTLDR,0) THEN '已开票' ELSE '部分开票' END END "));
|
|
|
else if (sortstring.ToUpper().IndexOf("DRDUISTATUS") >= 0)
|
|
|
strSql.Append(" order by " + sortstring.Replace("DRDUISTATUS", " CASE WHEN ISNULL(I.TTLDUIDR,0)=0 THEN '未对账' ELSE CASE WHEN ISNULL(I.TTLDUIDR,0)=ISNULL(I.TTLDR,0) THEN '已对账' ELSE '部分对账' END END "));
|
|
|
|
|
|
else
|
|
|
{
|
|
|
sortstring = sortstring.Replace("SALECORP", "B.SALECORPID");
|
|
|
strSql.Append(" order by " + sortstring);
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
var SeaeDefaultSort = MsSysParamSetDAL.GetData("PARAMNAME='SeaeDefaultSort'");
|
|
|
if (SeaeDefaultSort.PARAMVALUE != "")
|
|
|
strSql.Append(" order by " + SeaeDefaultSort.PARAMVALUE);
|
|
|
else
|
|
|
strSql.Append(" order by BSDATE desc");
|
|
|
}
|
|
|
strSql.Append(@") as num , ");
|
|
|
|
|
|
strSql.Append(" B.BSNO,MASTERNO,ORDERTYPE,ORDTYPE,ORDERNO,BSSTATUS,FEESTATUS,BSDATE,ACCDATE,MBLNO,HBLNO,CUSTNO,APPLYNO,TRANSNO,CUSTOMERNAME,BLTYPE,SHIPPERID,");
|
|
|
strSql.Append("CONSIGNEEID,NOTIFYPARTYID,SHIPPER,CONSIGNEE,NOTIFYPARTY,AGENTID,AGENT,YARD,VESSEL,VOYNO,ETD,ETD2,CLOSINGDATE,ETA,VESSEL2N,VOYNO2N,VESSELID2N,");
|
|
|
|
|
|
strSql.Append("PlACERECEIPT,PORTLOADID,PORTLOAD,PORTDISCHARGEID,PORTDISCHARGE,PLACEDELIVERYID,PLACEDELIVERY,DESTINATIONID,DESTINATION,COPYNOBILL,");
|
|
|
strSql.Append("NOBILL,ISSUETYPE,ISSUEDATE,ISSUEPLACE,BLFRT,PREPARDAT,PREPARDATID,PAYABLEAT,[SERVICE],MARKS,CNTRSEALNO,NOPKGS,[DESCRIPTION],GOODSNAME,");
|
|
|
strSql.Append("GROSSWEIGHT,MEASUREMENT,PKGS,KINDPKGS,KGS,CBM,TOTALNO,CNTRNO,CNTR1,CNTR2,CNTR3,CNTR4,CNTR5,CNTR6,CNTR7,CNTR8,CNTR9,CNTR10,OTCNTR,");
|
|
|
strSql.Append("TEU,CNTRTOTAL,B.INPUTBY,OP,CUSTSERVICE,FRCUSTSERVICE,LANE,SALE,CARRIER,FORWARDER,CUSTOMSER,TRUCKER,INVNO,CARGOID,DCLASS,DUNNO,DPAGE,DLABEL,LINKMAN,");
|
|
|
strSql.Append("REEFERF,TEMPID,TEMPSET,TEMPMAX,TEMPMIN,HUMIDITY,BSSOURCE,BSSOURCEDETAIL,CUSTOMSNUM,CONTRACTNO,INSURANCEER,INSURANCENO,INAMOUT,ISVOU,VOUNO,B.REMARK,STATUS1,");
|
|
|
strSql.Append("STATUS2,STATUS3,STATUS4,STATUS5,ISFUMIGATION,ISSTORAGE,ISLAND,ISCUSTOMS,ISINSPECTION,ISBOOKING,ISAGENT,ISHBLNO,SERVICE9,SERVICE10,DOC,PACKINGTYPE,");
|
|
|
strSql.Append("WAREHOUSE,CLOSEDOCDATE,INTOPORTDATE,CORPID,SALEDEPT,MBLFRT,CREATETIME,STLNAME,dbo.trimdate(STLDATE) STLDATE,OPERATORCODE,OPERATOR,OPERATOREMAIL,OPERATORTEL,OPERATORFAX,");
|
|
|
strSql.Append("FINANCIALSTAFFCODE,FINANCIALSTAFF,FINANCIALSTAFFEMAIL,FINANCIALSTAFFTEL,FINANCIALSTAFFFAX,PLACERECEIPTID,SOURCECODE,ISCONTAINERSOC,VESSELID,ISSUEPLACEID,HSCODE");
|
|
|
strSql.Append(",TRANSTATUS,EDIREMARK,SERVICECONTRACTNO,(CASE BSSTATUS WHEN 1 THEN '锁定' else '未锁定' end) as BSSTATUSREF ");
|
|
|
strSql.Append(",(CASE FEESTATUS WHEN 1 THEN '锁定' else '未锁定' end) as FEESTATUSREF,TRANSPORT ");
|
|
|
strSql.Append(",(SELECT TOP 1 STATUS FROM V_OP_STATUS WITH (NOLOCK) WHERE BSNO=B.BSNO ORDER BY COMPTIME DESC,INPUTTIME DESC) as OPSTATUS ");
|
|
|
strSql.Append(",(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=97018 and EnumValueID=B.MANIFESTSTATUS) as MANIFESTSTATUSREF");
|
|
|
strSql.Append(",CUSTOMNO,ENTERPID,ENTERP,INSPECTIONNO,INSPECTIONDATE,CUSTOMDATE,CLEARCUSTOMDATE,ISMOREGOOD,TERMSDELIVERY,INSPECTSERVICE,TRADETERM,0 FENPIAO,ISGAIQIAN,WARNCOUNT");
|
|
|
strSql.Append(",dbo.F_GetBillDrFeeStatus(B.BSNO) DRFEESTATUS");
|
|
|
strSql.Append(",dbo.F_GetBillCrFeeStatus(B.BSNO) CRFEESTATUS,ISPRINTPR,MAILPROJECT,0 AMENDCOUNT,0 as APPLYCOUNT,ISCANCEL,ISTUI,TRANSREMARK,PRERECORD ");
|
|
|
strSql.Append(",SHIPAGENCY");
|
|
|
strSql.Append(",I.TTLDR,I.TTLINVDR,I.TTLDUIDR,I.TTLCR,I.TTLINVCR,I.TTLDUICR,0 YJCR,0 HYFDR,0 HYFCR,0 BGFDR,0 NODAY");
|
|
|
strSql.Append(",'' MSHIPPERID,'' MCONSIGNEEID,'' MNOTIFYPARTYID,'' MSHIPPER,'' MCONSIGNEE,'' MNOTIFYPARTY,null ATD,DELIVERYDATE,YARDATTN,YARDTEL ");
|
|
|
|
|
|
//20161117 邓羽 增加对提单签发状态的查询
|
|
|
strSql.Append(",(SELECT TOP 1 BLSTATUS FROM op_blissue WHERE BSNO=B.BSNO) BLISSUESTATUS,B.BillFeeStatus,SALECORPID,'' MDESCRIPTION ");
|
|
|
strSql.Append(",(select [NAME] from [company] where GID=B.SALECORPID) as SALECORP,(select TOP 1 COLOR FROM code_op_status_detail WITH (NOLOCK) WHERE OPSTATUS = (CASE WHEN (SELECT TOP 1 [STATUS] FROM V_OP_STATUS WITH (NOLOCK) WHERE BSNO=B.BSNO ORDER BY COMPTIME DESC,INPUTTIME DESC) is null THEN '接受委托' else (SELECT TOP 1[STATUS] FROM V_OP_STATUS WITH (NOLOCK) WHERE BSNO = B.BSNO ORDER BY COMPTIME DESC, INPUTTIME DESC) end))AS COLOR");
|
|
|
strSql.Append(" ,V.CUSTOMSSTATUS,V.PORTSTATUS,V.EXPSTATUS,V.TRUCKCTNSTATUS,V.CTNRETURNSTATUS,V.HGYDSTATUS,TRUCKSTATUS,V.ATASTATUS,V.STCSSTATUS,V.RCVESTATUS ");
|
|
|
strSql.Append(",CASE WHEN len(DESTINATIONID)<>5 THEN '' ELSE (select top 1 c_country_name from t_sys_country_code where c_country_code=LEFT(DESTINATIONID,2)) END as COUNTRY,EDI_TIME,VGM_TIME ");
|
|
|
strSql.Append(",STUFF((SELECT ',' + CNTRNO FROM op_ctn ctn WHERE ctn.BSNO = B.BSNO FOR xml path('')),1, 1, '') AS CNTRNOALL ");
|
|
|
strSql.Append(",STUFF((SELECT ',' + SEALNO FROM op_ctn ctn WHERE ctn.BSNO = B.BSNO FOR xml path('')),1, 1, '') AS SEALNOALL ");
|
|
|
strSql.Append(",(select top 1 ORDNO from crm_seaeorder where bsno=B.BSNO ) ORDNO");
|
|
|
strSql.Append(",(select top 1 CUSTOMERNAME from crm_seaeorder_fen where MASTERNO = b.BSNO order by ordno) FEN_CUSTOMERNAME");
|
|
|
strSql.Append(",B.ISEI");
|
|
|
strSql.Append(" from OP_SEAE B");
|
|
|
strSql.Append(" LEFT JOIN v_op_gain_dr_INV I ON (I.BSNO=B.BSNO) ");
|
|
|
strSql.Append(" left join (select bsno, sum(case when[status] = '海关放行' then 1 else 0 end) CUSTOMSSTATUS, sum(case when [status] = '运抵报告' then 1 else 0 end) HGYDSTATUS , sum(case when[status] = '码头放行' then 1 else 0 end) PORTSTATUS");
|
|
|
strSql.Append(", sum(case when[status] = '装船出运' then 1 else 0 end) EXPSTATUS, sum(case when [status] = '空箱出场' then 1 else case when [status] = '部分空出' then 2 else 0 end end) TRUCKCTNSTATUS");
|
|
|
strSql.Append(", sum(case when[status] = '到港' then 1 else 0 end) ATASTATUS, sum(case when [status] = '目的港提箱' then 1 else case when [status] = '部分目的港提箱' then 2 else 0 end end) STCSSTATUS ");
|
|
|
strSql.Append(", sum(case when [status] = '目的港返空' then 1 else case when [status] = '部分目的港返空' then 2 else 0 end end) RCVESTATUS ");
|
|
|
strSql.Append(", sum(case when[status] = '重箱返场' then 1 else case when [status] = '部分重返' then 2 else 0 end end) CTNRETURNSTATUS from op_status WITH (NOLOCK) GROUP BY BSNO) as v on(v.bsno = B.BSNO) ");
|
|
|
|
|
|
|
|
|
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));
|
|
|
|
|
|
return SetData(strSql);
|
|
|
}
|
|
|
|
|
|
|
|
|
public static int getSaleTotalCount(string strCondition, string username, string userid, string companyid)
|
|
|
{
|
|
|
var rangstr = GetSaleRangDAStr("index", userid, username, 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 OP_SEAE B");
|
|
|
strSql.Append(" LEFT JOIN v_op_gain_dr_INV I ON (I.BSNO=B.BSNO) ");
|
|
|
strSql.Append(" left join (select bsno, sum(case when[status] = '海关放行' then 1 else 0 end) CUSTOMSSTATUS, sum(case when [status] = '运抵报告' then 1 else 0 end) HGYDSTATUS , sum(case when[status] = '码头放行' then 1 else 0 end) PORTSTATUS");
|
|
|
strSql.Append(", sum(case when[status] = '装船出运' then 1 else 0 end) EXPSTATUS, sum(case when [status] = '空箱出场' then 1 else case when [status] = '部分空出' then 2 else 0 end end) TRUCKCTNSTATUS");
|
|
|
strSql.Append(", sum(case when[status] = '到港' then 1 else 0 end) ATASTATUS, sum(case when [status] = '目的港提箱' then 1 else case when [status] = '部分目的港提箱' then 2 else 0 end end) STCSSTATUS ");
|
|
|
strSql.Append(", sum(case when [status] = '目的港返空' then 1 else case when [status] = '部分目的港返空' then 2 else 0 end end) RCVESTATUS ");
|
|
|
strSql.Append(", sum(case when[status] = '重箱返场' then 1 else case when [status] = '部分重返' then 2 else 0 end end) CTNRETURNSTATUS from op_status WITH (NOLOCK) GROUP BY BSNO) as v on(v.bsno = B.BSNO) ");
|
|
|
|
|
|
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 List<MsOpSeae> GetCancelDataList(int start, int limit, string strCondition, string userid, string usercode, string companyid, string sort = null, string load = null)
|
|
|
{
|
|
|
var rangstr = GetRangDAStr("index", userid, usercode, companyid);
|
|
|
if (!string.IsNullOrEmpty(rangstr))
|
|
|
{
|
|
|
if (!string.IsNullOrEmpty(strCondition))
|
|
|
{
|
|
|
strCondition = strCondition + " and " + rangstr;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strCondition = rangstr;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
var isNoForward = MsBaseInfoDAL.MsBaseInfoDAL.GetUserModuleEnable("modMsNoForward", userid);
|
|
|
|
|
|
var strSql = new StringBuilder();
|
|
|
|
|
|
strSql.Append(@"SELECT *,'' COUNTRY from (SELECT row_number() over (");
|
|
|
|
|
|
var sortstring = DatasetSort.Getsortstring(sort);
|
|
|
if (!string.IsNullOrEmpty(sortstring))
|
|
|
{
|
|
|
if (sortstring.ToUpper().IndexOf("OPSTATUS") >= 0)
|
|
|
strSql.Append(" order by " + sortstring.Replace("OPSTATUS", "(SELECT TOP 1 STATUS FROM V_OP_STATUS WITH (NOLOCK) WHERE BSNO=OP_SEAE.BSNO ORDER BY COMPTIME DESC,INPUTTIME DESC)"));
|
|
|
else if (sortstring.ToUpper().IndexOf("DRFEESTATUS") >= 0)
|
|
|
strSql.Append(" order by " + sortstring.Replace("DRFEESTATUS", " dbo.F_GetBillDrFeeStatus(OP_SEAE.BSNO) "));
|
|
|
else if (sortstring.ToUpper().IndexOf("CRFEESTATUS") >= 0)
|
|
|
strSql.Append(" order by " + sortstring.Replace("CRFEESTATUS", " dbo.F_GetBillCrFeeStatus(OP_SEAE.BSNO) "));
|
|
|
else if (sortstring.ToUpper().IndexOf("BSSTATUSREF") >= 0)
|
|
|
strSql.Append(" order by " + sortstring.Replace("BSSTATUSREF", " BSSTATUS "));
|
|
|
else if (sortstring.ToUpper().IndexOf("FEESTATUSREF") >= 0)
|
|
|
strSql.Append(" order by " + sortstring.Replace("FEESTATUSREF", " FEESTATUS "));
|
|
|
else if (sortstring.ToUpper().IndexOf("AMEND") >= 0)
|
|
|
strSql.Append(" order by " + sortstring.Replace("AMEND", " CASE WHEN (SELECT COUNT(*) FROM OP_AMEND WHERE PARENTID=OP_SEAE.BSNO)>0 THEN 1 ELSE 0 END "));
|
|
|
else if (sortstring.ToUpper().IndexOf("DRINVSTATUS") >= 0)
|
|
|
strSql.Append(" order by " + sortstring.Replace("DRINVSTATUS", " CASE WHEN ISNULL(I.TTLINVDR,0)=0 THEN '未开票' ELSE CASE WHEN ISNULL(I.TTLINVDR,0)=ISNULL(I.TTLDR,0) THEN '已开票' ELSE '部分开票' END END "));
|
|
|
else if (sortstring.ToUpper().IndexOf("DRDUISTATUS") >= 0)
|
|
|
strSql.Append(" order by " + sortstring.Replace("DRDUISTATUS", " CASE WHEN ISNULL(I.TTLDUIDR,0)=0 THEN '未对账' ELSE CASE WHEN ISNULL(I.TTLDUIDR,0)=ISNULL(I.TTLDR,0) THEN '已对账' ELSE '部分对账' END END "));
|
|
|
else
|
|
|
{
|
|
|
sortstring = sortstring.Replace("SALECORP", "OP_SEAE.SALECORPID");
|
|
|
strSql.Append(" order by " + sortstring);
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
var SeaeDefaultSort = MsSysParamSetDAL.GetData("PARAMNAME='SeaeDefaultSort'");
|
|
|
if (SeaeDefaultSort.PARAMVALUE != "")
|
|
|
strSql.Append(" order by " + SeaeDefaultSort.PARAMVALUE);
|
|
|
else
|
|
|
strSql.Append(" order by BSDATE desc");
|
|
|
}
|
|
|
strSql.Append(@") as num , ");
|
|
|
|
|
|
strSql.Append("OP_SEAE.BSNO,MASTERNO,ORDERTYPE,ORDTYPE,ORDERNO,BSSTATUS,FEESTATUS,BSDATE,ACCDATE,MBLNO,HBLNO,APPLYNO,CUSTNO,TRANSNO,CUSTOMERNAME,BLTYPE,SHIPPERID,");
|
|
|
strSql.Append("CONSIGNEEID,NOTIFYPARTYID,SHIPPER,CONSIGNEE,NOTIFYPARTY,AGENTID,AGENT,YARD,VESSEL,VOYNO,ETD,ETD2,CLOSINGDATE,ETA,VESSEL2N,VOYNO2N,VESSELID2N,");
|
|
|
|
|
|
strSql.Append("PlACERECEIPT,PORTLOADID,PORTLOAD,PORTDISCHARGEID,PORTDISCHARGE,PLACEDELIVERYID,PLACEDELIVERY,DESTINATIONID,DESTINATION,COPYNOBILL,");
|
|
|
strSql.Append("NOBILL,ISSUETYPE,ISSUEDATE,ISSUEPLACE,BLFRT,PREPARDAT,PREPARDATID,PAYABLEAT,[SERVICE],MARKS,CNTRSEALNO,NOPKGS,[DESCRIPTION],GOODSNAME,");
|
|
|
strSql.Append("GROSSWEIGHT,MEASUREMENT,PKGS,KINDPKGS,KGS,CBM,TOTALNO,CNTRNO,CNTR1,CNTR2,CNTR3,CNTR4,CNTR5,CNTR6,CNTR7,CNTR8,CNTR9,CNTR10,OTCNTR,");
|
|
|
strSql.Append("TEU,CNTRTOTAL,INPUTBY,OP,CUSTSERVICE,FRCUSTSERVICE,LANE,SALE,CARRIER,FORWARDER,CUSTOMSER,TRUCKER,INVNO,CARGOID,DCLASS,DUNNO,DPAGE,DLABEL,LINKMAN,");
|
|
|
strSql.Append("REEFERF,TEMPID,TEMPSET,TEMPMAX,TEMPMIN,HUMIDITY,BSSOURCE,BSSOURCEDETAIL,CUSTOMSNUM,CONTRACTNO,INSURANCEER,INSURANCENO,INAMOUT,ISVOU,VOUNO,REMARK,STATUS1,");
|
|
|
strSql.Append("STATUS2,STATUS3,STATUS4,STATUS5,ISFUMIGATION,ISSTORAGE,ISLAND,ISCUSTOMS,ISINSPECTION,ISBOOKING,ISAGENT,ISHBLNO,SERVICE9,SERVICE10,DOC,PACKINGTYPE,");
|
|
|
strSql.Append("WAREHOUSE,CLOSEDOCDATE,INTOPORTDATE,CORPID,SALEDEPT,MBLFRT,CREATETIME,STLNAME,dbo.trimdate(STLDATE) STLDATE,OPERATORCODE,OPERATOR,OPERATOREMAIL,OPERATORTEL,OPERATORFAX,");
|
|
|
strSql.Append("FINANCIALSTAFFCODE,FINANCIALSTAFF,FINANCIALSTAFFEMAIL,FINANCIALSTAFFTEL,FINANCIALSTAFFFAX,PLACERECEIPTID,SOURCECODE,ISCONTAINERSOC,VESSELID,ISSUEPLACEID,HSCODE");
|
|
|
strSql.Append(",TRANSTATUS,EDIREMARK,SERVICECONTRACTNO,(CASE BSSTATUS WHEN 1 THEN '锁定' else '未锁定' end) as BSSTATUSREF ");
|
|
|
strSql.Append(",(CASE FEESTATUS WHEN 1 THEN '锁定' else '未锁定' end) as FEESTATUSREF,TRANSPORT ");
|
|
|
strSql.Append(",(SELECT TOP 1 STATUS FROM V_OP_STATUS WITH (NOLOCK) WHERE BSNO=OP_SEAE.BSNO ORDER BY COMPTIME DESC,INPUTTIME DESC) as OPSTATUS");
|
|
|
strSql.Append(",(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=97018 and EnumValueID=OP_SEAE.MANIFESTSTATUS) as MANIFESTSTATUSREF");
|
|
|
strSql.Append(",CUSTOMNO,ENTERPID,ENTERP,INSPECTIONNO,INSPECTIONDATE,CUSTOMDATE,CLEARCUSTOMDATE,ISMOREGOOD,TERMSDELIVERY,INSPECTSERVICE,TRADETERM,0 FENPIAO,ISGAIQIAN,WARNCOUNT");
|
|
|
|
|
|
strSql.Append(",dbo.F_GetBillDrFeeStatus(OP_SEAE.BSNO) DRFEESTATUS");
|
|
|
strSql.Append(",dbo.F_GetBillCrFeeStatus(OP_SEAE.BSNO) CRFEESTATUS,ISPRINTPR,MAILPROJECT");
|
|
|
|
|
|
strSql.Append(",(SELECT COUNT(*) FROM OP_AMEND WHERE PARENTID=OP_SEAE.BSNO) as AMENDCOUNT,SHIPAGENCY ");
|
|
|
strSql.Append(",I.TTLDR,I.TTLINVDR,I.TTLDUIDR,I.TTLCR,I.TTLINVCR,I.TTLDUICR,0 YJCR,0 HYFDR,0 HYFCR,0 BGFDR,0 NODAY");
|
|
|
strSql.Append(",(SELECT COUNT(*) FROM OP_APPLY WHERE MASTERNO=OP_SEAE.BSNO) as APPLYCOUNT ");
|
|
|
|
|
|
|
|
|
strSql.Append(",(SELECT TOP 1 BLSTATUS FROM op_blissue WHERE BSNO=OP_SEAE.BSNO) BLISSUESTATUS,ISCANCEL,ISTUI,(select top 1 REASON FROM op_tuishen WHERE BSNO=OP_SEAE.BSNO) TRANSREMARK,PRERECORD ");
|
|
|
|
|
|
strSql.Append(",MSHIPPERID,MCONSIGNEEID,MNOTIFYPARTYID,MSHIPPER,MCONSIGNEE,MNOTIFYPARTY,ATD,DELIVERYDATE,YARDATTN,YARDTEL,BillFeeStatus,SALECORPID,'' MDESCRIPTION ");
|
|
|
strSql.Append(",(select [NAME] from [company] where GID=OP_SEAE.SALECORPID) as SALECORP,(select TOP 1 COLOR FROM code_op_status_detail WITH (NOLOCK) WHERE OPSTATUS = (CASE WHEN (SELECT TOP 1 [STATUS] FROM V_OP_STATUS WHERE BSNO=OP_SEAE.BSNO ORDER BY COMPTIME DESC,INPUTTIME DESC) is null THEN '接受委托' else (SELECT TOP 1[STATUS] FROM V_OP_STATUS WHERE BSNO = OP_SEAE.BSNO ORDER BY COMPTIME DESC, INPUTTIME DESC) end))AS COLOR");
|
|
|
strSql.Append(",0 CUSTOMSSTATUS,0 PORTSTATUS,0 EXPSTATUS,0 TRUCKCTNSTATUS,0 CTNRETURNSTATUS,0 HGYDSTATUS,TRUCKSTATUS,0 ATASTATUS,0 STCSSTATUS,0 RCVESTATUS,'' COUNTRY ,EDI_TIME,VGM_TIME ");
|
|
|
strSql.Append(",STUFF((SELECT ',' + CNTRNO FROM op_ctn ctn WHERE ctn.BSNO = op_seae.BSNO FOR xml path('')),1, 1, '') AS CNTRNOALL ");
|
|
|
strSql.Append(",STUFF((SELECT ',' + SEALNO FROM op_ctn ctn WHERE ctn.BSNO = op_seae.BSNO FOR xml path('')),1, 1, '') AS SEALNOALL ");
|
|
|
|
|
|
strSql.Append(",(select top 1 ORDNO from crm_seaeorder where bsno=OP_SEAE.BSNO ) ORDNO");
|
|
|
strSql.Append(",(select top 1 CUSTOMERNAME from crm_seaeorder_fen where MASTERNO = OP_SEAE.BSNO order by ordno) FEN_CUSTOMERNAME");
|
|
|
strSql.Append(",ISEI");
|
|
|
strSql.Append(" from OP_SEAE ");
|
|
|
strSql.Append(" LEFT JOIN v_op_gain_dr_INV I ON (I.BSNO=OP_SEAE.BSNO) ");
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(strCondition))
|
|
|
{
|
|
|
strSql.Append(" where MASTERNO=OP_SEAE.BSNO AND EXISTS ( select 1 from OP_SEAE B WHERE OP_SEAE.BSNO=B.MASTERNO AND " + strCondition + " )");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strSql.Append(" where MASTERNO=OP_SEAE.BSNO ");
|
|
|
|
|
|
}
|
|
|
strSql.Append(@")as t ");
|
|
|
strSql.Append(string.Format("where t.num>{0} and t.num<={1} order by t.num ", start, start + limit)); //
|
|
|
|
|
|
return SetData(strSql, isNoForward);
|
|
|
}
|
|
|
|
|
|
|
|
|
#region 更改单
|
|
|
|
|
|
static public List<MsOpSeae> GetAmendDataList(int start, int limit, string strCondition, string userid, string usercode, string companyid, string sort = null, string load = 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))
|
|
|
{
|
|
|
sortstring=sortstring.Replace("FEESTATUS", "A.FEESTATUS").Replace("TRANSNO", "A.AMENDNO").Replace("EDIREMARK", "A.REASON").Replace("ACCDATE", "A.ACCDATE")
|
|
|
.Replace("CREATETIME", "A.CREATETIME").Replace("REMARK", "A.REMARK").Replace("MSHIPPERID", "(select showname from [user] where gid=f.Auditoperator) ").Replace("MCONSIGNEEID", "f.AUDITDATE ");
|
|
|
|
|
|
strSql.Append(" order by " + sortstring);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
var SeaeDefaultSort = MsSysParamSetDAL.GetData("PARAMNAME='SeaeDefaultSort'");
|
|
|
if (SeaeDefaultSort.PARAMVALUE != "")
|
|
|
strSql.Append(" order by " + SeaeDefaultSort.PARAMVALUE );
|
|
|
else
|
|
|
strSql.Append(" order by BSDATE desc");
|
|
|
}
|
|
|
strSql.Append(@") as num , ");
|
|
|
|
|
|
strSql.Append("A.BSNO,A.PARENTID MASTERNO,B.ORDERTYPE,B.ORDTYPE,B.ORDERNO,BSSTATUS,A.FEESTATUS,BSDATE,A.ACCDATE,MBLNO,HBLNO,APPLYNO,CUSTNO,A.AMENDNO TRANSNO,CUSTOMERNAME,BLTYPE,SHIPPERID,");
|
|
|
strSql.Append("CONSIGNEEID,NOTIFYPARTYID,SHIPPER,CONSIGNEE,NOTIFYPARTY,AGENTID,AGENT,YARD,VESSEL,VOYNO,ETD,ETD2,CLOSINGDATE,ETA,VESSEL2N,VOYNO2N,VESSELID2N,");
|
|
|
|
|
|
strSql.Append("PlACERECEIPT,PORTLOADID,PORTLOAD,PORTDISCHARGEID,PORTDISCHARGE,PLACEDELIVERYID,PLACEDELIVERY,DESTINATIONID,DESTINATION,COPYNOBILL,");
|
|
|
strSql.Append("NOBILL,ISSUETYPE,ISSUEDATE,ISSUEPLACE,BLFRT,PREPARDAT,PREPARDATID,PAYABLEAT,[SERVICE],MARKS,CNTRSEALNO,NOPKGS,[DESCRIPTION],GOODSNAME,");
|
|
|
strSql.Append("GROSSWEIGHT,MEASUREMENT,PKGS,KINDPKGS,KGS,CBM,TOTALNO,CNTRNO,CNTR1,CNTR2,CNTR3,CNTR4,CNTR5,CNTR6,CNTR7,CNTR8,CNTR9,CNTR10,OTCNTR,");
|
|
|
strSql.Append("TEU,CNTRTOTAL,INPUTBY,OP,CUSTSERVICE,FRCUSTSERVICE,LANE,A.SALE,CARRIER,FORWARDER,CUSTOMSER,TRUCKER,INVNO,CARGOID,DCLASS,DUNNO,DPAGE,DLABEL,LINKMAN,");
|
|
|
strSql.Append("REEFERF,TEMPID,TEMPSET,TEMPMAX,TEMPMIN,HUMIDITY,BSSOURCE,BSSOURCEDETAIL,CUSTOMSNUM,CONTRACTNO,INSURANCEER,INSURANCENO,INAMOUT,A.ISVOU,A.VOUNO,A.REMARKS REMARK,STATUS1,");
|
|
|
strSql.Append("STATUS2,STATUS3,STATUS4,STATUS5,ISFUMIGATION,ISSTORAGE,ISLAND,ISCUSTOMS,ISINSPECTION,ISBOOKING,ISAGENT,ISHBLNO,SERVICE9,SERVICE10,DOC,PACKINGTYPE,");
|
|
|
strSql.Append("WAREHOUSE,CLOSEDOCDATE,INTOPORTDATE,CORPID,SALEDEPT,MBLFRT,A.CREATETIME,STLNAME,dbo.trimdate(STLDATE) STLDATE,OPERATORCODE,OPERATOR,OPERATOREMAIL,OPERATORTEL,OPERATORFAX,");
|
|
|
strSql.Append("FINANCIALSTAFFCODE,FINANCIALSTAFF,FINANCIALSTAFFEMAIL,FINANCIALSTAFFTEL,FINANCIALSTAFFFAX,PLACERECEIPTID,SOURCECODE,ISCONTAINERSOC,VESSELID,ISSUEPLACEID,HSCODE");
|
|
|
strSql.Append(",TRANSTATUS,A.REASON EDIREMARK,SERVICECONTRACTNO,(CASE BSSTATUS WHEN 1 THEN '锁定' else '未锁定' end) as BSSTATUSREF ");
|
|
|
strSql.Append(",(CASE A.FEESTATUS WHEN 1 THEN '锁定' else '未锁定' end) as FEESTATUSREF,TRANSPORT ");
|
|
|
strSql.Append(",(SELECT TOP 1 STATUS FROM V_OP_STATUS WITH (NOLOCK) WHERE BSNO=B.BSNO ORDER BY COMPTIME DESC,INPUTTIME DESC) as OPSTATUS");
|
|
|
strSql.Append(",'' as MANIFESTSTATUSREF");
|
|
|
strSql.Append(",CUSTOMNO,ENTERPID,ENTERP,INSPECTIONNO,INSPECTIONDATE,CUSTOMDATE,CLEARCUSTOMDATE,ISMOREGOOD,TERMSDELIVERY,INSPECTSERVICE,TRADETERM,0 FENPIAO,B.ISGAIQIAN,B.WARNCOUNT");
|
|
|
|
|
|
strSql.Append(",dbo.F_GetBillDrFeeStatus(A.BSNO) DRFEESTATUS");
|
|
|
strSql.Append(",dbo.F_GetBillCrFeeStatus(A.BSNO) CRFEESTATUS,ISPRINTPR,B.MAILPROJECT");
|
|
|
|
|
|
strSql.Append(",(SELECT COUNT(*) FROM OP_AMEND WHERE PARENTID=A.PARENTID) as AMENDCOUNT,SHIPAGENCY ");
|
|
|
strSql.Append(",I.TTLDR,I.TTLINVDR,I.TTLDUIDR,I.TTLCR,I.TTLINVCR,I.TTLDUICR,0 YJCR,0 HYFDR,0 HYFCR,0 BGFDR,0 NODAY");
|
|
|
strSql.Append(",0 as APPLYCOUNT ");
|
|
|
|
|
|
|
|
|
strSql.Append(",(SELECT TOP 1 BLSTATUS FROM op_blissue WHERE BSNO=B.BSNO) BLISSUESTATUS,ISCANCEL,ISTUI,TRANSREMARK,PRERECORD ");
|
|
|
|
|
|
strSql.Append(",(select showname from [user] where gid=f.Auditoperator) MSHIPPERID,dbo.trimdate(f.AUDITDATE) MCONSIGNEEID,MNOTIFYPARTYID,MSHIPPER,MCONSIGNEE,MNOTIFYPARTY,ATD,DELIVERYDATE,YARDATTN,YARDTEL,A.BillFeeStatus,B.SALECORPID,'' MDESCRIPTION ");
|
|
|
strSql.Append(",(select [NAME] from [company] where GID=B.SALECORPID) as SALECORP");
|
|
|
strSql.Append(",0 CUSTOMSSTATUS,0 PORTSTATUS,0 EXPSTATUS,0 TRUCKCTNSTATUS,0 CTNRETURNSTATUS,0 HGYDSTATUS ,B.TRUCKSTATUS,0 ATASTATUS,0 STCSSTATUS,0 RCVESTATUS,'' COUNTRY,EDI_TIME,VGM_TIME ");
|
|
|
strSql.Append(",STUFF((SELECT ',' + CNTRNO FROM op_ctn ctn WHERE ctn.BSNO = B.BSNO FOR xml path('')),1, 1, '') AS CNTRNOALL ");
|
|
|
strSql.Append(",STUFF((SELECT ',' + SEALNO FROM op_ctn ctn WHERE ctn.BSNO = B.BSNO FOR xml path('')),1, 1, '') AS SEALNOALL ");
|
|
|
strSql.Append(",(select top 1 ORDNO from crm_seaeorder where bsno=B.BSNO ) ORDNO");
|
|
|
strSql.Append(",(select top 1 CUSTOMERNAME from crm_seaeorder_fen where MASTERNO = b.BSNO order by ordno) FEN_CUSTOMERNAME");
|
|
|
strSql.Append(",B.ISEI");
|
|
|
strSql.Append(" from OP_AMEND A ");
|
|
|
strSql.Append(" LEFT JOIN OP_SEAE B ON (B.BSNO=A.PARENTID)");
|
|
|
strSql.Append(" LEFT JOIN v_op_gain_dr_INV I ON (I.BSNO=A.BSNO) ");
|
|
|
strSql.Append(" LEFT JOIN V_FEE_LASTAUDIT f ON (f.BSNO=A.BSNO AND f.NUM=1) ");
|
|
|
|
|
|
|
|
|
strSql.Append(" WHERE B.BSNO IS NOT NULL ");
|
|
|
|
|
|
if (!string.IsNullOrEmpty(strCondition))
|
|
|
{
|
|
|
strSql.Append(" AND " + strCondition );
|
|
|
}
|
|
|
|
|
|
strSql.Append(@")as t ");
|
|
|
strSql.Append(string.Format("where t.num>={0} and t.num<={1} order by t.num", start, start + limit)); //
|
|
|
|
|
|
return SetData(strSql);
|
|
|
}
|
|
|
|
|
|
public static int getAmendTotalCount(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 OP_AMEND A ");
|
|
|
strSql.Append(" left join OP_SEAE B ON (B.BSNO=A.PARENTID)");
|
|
|
strSql.Append(" LEFT JOIN v_op_gain_dr_INV I ON (I.BSNO=A.BSNO) ");
|
|
|
|
|
|
strSql.Append(" WHERE B.BSNO IS NOT NULL ");
|
|
|
|
|
|
if (!string.IsNullOrEmpty(strCondition))
|
|
|
{
|
|
|
strSql.Append(" AND " + 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;
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
static public DBResult GetAmendDataStr(string strCondition, string userid, string usercode, string companyid, string sort = null, string load = 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 A.BSNO,A.PARENTID MASTERNO,B.ORDERTYPE,B.ORDTYPE,B.ORDERNO,BSSTATUS,A.FEESTATUS,BSDATE,A.ACCDATE,MBLNO,HBLNO,APPLYNO,CUSTNO,A.AMENDNO TRANSNO,CUSTOMERNAME,BLTYPE,SHIPPERID,");
|
|
|
strSql.Append("CONSIGNEEID,NOTIFYPARTYID,SHIPPER,CONSIGNEE,NOTIFYPARTY,AGENTID,AGENT,YARD,VESSEL,VOYNO,ETD,CLOSINGDATE,ETA,VESSEL2N,VOYNO2N,VESSELID2N,");
|
|
|
|
|
|
strSql.Append("PlACERECEIPT,PORTLOADID,PORTLOAD,PORTDISCHARGEID,PORTDISCHARGE,PLACEDELIVERYID,PLACEDELIVERY,DESTINATIONID,DESTINATION,COPYNOBILL,");
|
|
|
strSql.Append("NOBILL,ISSUETYPE,ISSUEDATE,ISSUEPLACE,BLFRT,PREPARDAT,PREPARDATID,PAYABLEAT,[SERVICE],MARKS,CNTRSEALNO,NOPKGS,[DESCRIPTION],GOODSNAME,");
|
|
|
strSql.Append("GROSSWEIGHT,MEASUREMENT,PKGS,KINDPKGS,KGS,CBM,TOTALNO,CNTRNO,CNTR1,CNTR2,CNTR3,CNTR4,CNTR5,CNTR6,CNTR7,CNTR8,CNTR9,CNTR10,OTCNTR,");
|
|
|
strSql.Append("TEU,CNTRTOTAL,INPUTBY,OP,CUSTSERVICE,LANE,A.SALE,CARRIER,FORWARDER,CUSTOMSER,TRUCKER,INVNO,CARGOID,DCLASS,DUNNO,DPAGE,DLABEL,LINKMAN,");
|
|
|
strSql.Append("REEFERF,TEMPID,TEMPSET,TEMPMAX,TEMPMIN,HUMIDITY,BSSOURCE,BSSOURCEDETAIL,CUSTOMSNUM,CONTRACTNO,INSURANCEER,INSURANCENO,INAMOUT,A.ISVOU,A.VOUNO,A.REMARKS REMARK,STATUS1,");
|
|
|
strSql.Append("STATUS2,STATUS3,STATUS4,STATUS5,ISFUMIGATION,ISSTORAGE,ISLAND,ISCUSTOMS,ISINSPECTION,ISBOOKING,ISAGENT,ISHBLNO,SERVICE9,SERVICE10,DOC,PACKINGTYPE,");
|
|
|
strSql.Append("WAREHOUSE,CLOSEDOCDATE,INTOPORTDATE,CORPID,SALEDEPT,MBLFRT,A.CREATETIME,STLNAME,dbo.trimdate(STLDATE) STLDATE,OPERATORCODE,OPERATOR,OPERATOREMAIL,OPERATORTEL,OPERATORFAX,");
|
|
|
strSql.Append("FINANCIALSTAFFCODE,FINANCIALSTAFF,FINANCIALSTAFFEMAIL,FINANCIALSTAFFTEL,FINANCIALSTAFFFAX,PLACERECEIPTID,SOURCECODE,ISCONTAINERSOC,VESSELID,ISSUEPLACEID,HSCODE");
|
|
|
strSql.Append(",TRANSTATUS,A.REASON EDIREMARK,SERVICECONTRACTNO,(CASE BSSTATUS WHEN 1 THEN '锁定' else '未锁定' end) as BSSTATUSREF ");
|
|
|
strSql.Append(",(CASE A.FEESTATUS WHEN 1 THEN '锁定' else '未锁定' end) as FEESTATUSREF,TRANSPORT ");
|
|
|
strSql.Append(",(SELECT TOP 1 STATUS FROM V_OP_STATUS WITH (NOLOCK) WHERE BSNO=B.BSNO ORDER BY COMPTIME DESC,INPUTTIME DESC) as OPSTATUS");
|
|
|
strSql.Append(",'' as MANIFESTSTATUSREF");
|
|
|
strSql.Append(",CUSTOMNO,ENTERPID,ENTERP,INSPECTIONNO,INSPECTIONDATE,CUSTOMDATE,CLEARCUSTOMDATE,ISMOREGOOD,TERMSDELIVERY,INSPECTSERVICE,TRADETERM,0 FENPIAO,B.ISGAIQIAN,B.WARNCOUNT");
|
|
|
|
|
|
strSql.Append(",dbo.F_GetBillDrFeeStatus(A.BSNO) DRFEESTATUS");
|
|
|
strSql.Append(",dbo.F_GetBillCrFeeStatus(A.BSNO) CRFEESTATUS,ISPRINTPR");
|
|
|
|
|
|
strSql.Append(",0 as AMENDCOUNT,SHIPAGENCY ");
|
|
|
strSql.Append(",I.TTLDR,I.TTLINVDR,I.TTLDUIDR,I.TTLCR,I.TTLINVCR,I.TTLDUICR,0 YJCR,0 HYFDR,0 HYFCR,0 BGFDR,0 NODAY");
|
|
|
strSql.Append(",0 as APPLYCOUNT ");
|
|
|
|
|
|
|
|
|
strSql.Append(",(SELECT TOP 1 BLSTATUS FROM op_blissue WHERE BSNO=B.BSNO) BLISSUESTATUS,ISCANCEL,ISTUI ");
|
|
|
|
|
|
strSql.Append(",MSHIPPERID,MCONSIGNEEID,MNOTIFYPARTYID,MSHIPPER,MCONSIGNEE,MNOTIFYPARTY,ATD,DELIVERYDATE,YARDATTN,YARDTEL,SALECORPID ");
|
|
|
strSql.Append(",(select [NAME] from [company] where GID=B.SALECORPID) as SALECORP");
|
|
|
strSql.Append(",0 CUSTOMSSTATUS,0 PORTSTATUS,0 EXPSTATUS,0 TRUCKCTNSTATUS,0 CTNRETURNSTATUS,0 HGYDSTATUS,TRUCKSTATUS,0 ATASTATUS,0 STCSSTATUS,0 RCVESTATUS ");
|
|
|
|
|
|
strSql.Append(" from OP_AMEND A ");
|
|
|
strSql.Append(" LEFT JOIN OP_SEAE B ON (B.BSNO=A.PARENTID)");
|
|
|
strSql.Append(" LEFT JOIN v_op_gain_dr_INV I ON (I.BSNO=A.BSNO) ");
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(strCondition))
|
|
|
{
|
|
|
strSql.Append(" where " + strCondition);
|
|
|
}
|
|
|
|
|
|
var sortstring = DatasetSort.Getsortstring(sort);
|
|
|
if (!string.IsNullOrEmpty(sortstring))
|
|
|
{
|
|
|
sortstring = sortstring.Replace("FEESTATUS", "A.FEESTATUS").Replace("TRANSNO", "A.AMENDNO").Replace("EDIREMARK", "A.REASON").Replace("ACCDATE", "A.ACCDATE")
|
|
|
.Replace("CREATETIME", "A.CREATETIME").Replace("REMARK", "A.REMARK").Replace("SALECORP", "B.SALECORPID");
|
|
|
|
|
|
strSql.Append(" order by " + sortstring);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
var SeaeDefaultSort = MsSysParamSetDAL.GetData("PARAMNAME='SeaeDefaultSort'");
|
|
|
if (SeaeDefaultSort.PARAMVALUE != "")
|
|
|
strSql.Append(" order by " + SeaeDefaultSort.PARAMVALUE );
|
|
|
else
|
|
|
strSql.Append(" order by BSDATE desc");
|
|
|
}
|
|
|
|
|
|
result.Data = strSql.ToString();
|
|
|
result.Message = strCondition;
|
|
|
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
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 * ");
|
|
|
strSql.Append(",CASE WHEN ISNULL(TTLINVCR,0)=0 THEN '未开票' WHEN ISNULL(TTLINVCR,0)=ISNULL(TTLCR,0) THEN '已开票' WHEN ISNULL(TTLINVCR,0)!=ISNULL(TTLCR,0) THEN '部分开票' END CRINVSTATUS ");
|
|
|
strSql.Append(",CASE WHEN ISNULL(TTLINVDR,0)=0 THEN '未开票' WHEN ISNULL(TTLINVDR,0)=ISNULL(TTLDR,0) THEN '已开票' WHEN ISNULL(TTLINVDR,0)!=ISNULL(TTLDR,0) THEN '部分开票' END DRINVSTATUS ");
|
|
|
strSql.Append(",CASE WHEN ISNULL(TTLDUIDR,0)=0 THEN '未对账' WHEN ISNULL(TTLDUIDR,0)=ISNULL(TTLDR,0) THEN '已对账' WHEN ISNULL(TTLDUIDR,0)!=ISNULL(TTLDR,0) THEN '部分对账' END DRDUISTATUS ");
|
|
|
strSql.Append(",APPLYCOUNT ISAPPLY,AMENDCOUNT AMEND from (");
|
|
|
strSql.Append("SELECT OP_SEAE.BSNO,MASTERNO,ORDERTYPE,ORDTYPE,ORDERNO,BSSTATUS,FEESTATUS,BSDATE,ACCDATE,MBLNO,HBLNO,APPLYNO,CUSTNO,TRANSNO,CUSTOMERNAME,BLTYPE,SHIPPERID,");
|
|
|
strSql.Append("CONSIGNEEID,NOTIFYPARTYID,SHIPPER,CONSIGNEE,NOTIFYPARTY,AGENTID,AGENT,YARD,VESSEL,VOYNO,ETD,ETD2,CLOSINGDATE,ETA,VESSEL2N,VOYNO2N,VESSELID2N,");
|
|
|
|
|
|
strSql.Append("PlACERECEIPT,PORTLOADID,PORTLOAD,PORTDISCHARGEID,PORTDISCHARGE,PLACEDELIVERYID,PLACEDELIVERY,DESTINATIONID,DESTINATION,COPYNOBILL,");
|
|
|
strSql.Append("NOBILL,ISSUETYPE,ISSUEDATE,ISSUEPLACE,BLFRT,PREPARDAT,PREPARDATID,PAYABLEAT,[SERVICE],MARKS,CNTRSEALNO,NOPKGS,[DESCRIPTION],GOODSNAME,");
|
|
|
strSql.Append("GROSSWEIGHT,MEASUREMENT,PKGS,KINDPKGS,KGS,CBM,TOTALNO,CNTRNO,CNTR1,CNTR2,CNTR3,CNTR4,CNTR5,CNTR6,CNTR7,CNTR8,CNTR9,CNTR10,OTCNTR,");
|
|
|
strSql.Append("TEU,CNTRTOTAL,INPUTBY,OP,CUSTSERVICE,FRCUSTSERVICE,LANE,SALE,CARRIER,FORWARDER,CUSTOMSER,TRUCKER,INVNO,CARGOID,DCLASS,DUNNO,DPAGE,DLABEL,LINKMAN,");
|
|
|
strSql.Append("REEFERF,TEMPID,TEMPSET,TEMPMAX,TEMPMIN,HUMIDITY,BSSOURCE,BSSOURCEDETAIL,CUSTOMSNUM,CONTRACTNO,INSURANCEER,INSURANCENO,INAMOUT,ISVOU,VOUNO,REMARK,STATUS1,");
|
|
|
strSql.Append("STATUS2,STATUS3,STATUS4,STATUS5,ISFUMIGATION,ISSTORAGE,ISLAND,ISCUSTOMS,ISINSPECTION,ISBOOKING,ISAGENT,ISHBLNO,SERVICE9,SERVICE10,DOC,PACKINGTYPE,");
|
|
|
strSql.Append("WAREHOUSE,CLOSEDOCDATE,INTOPORTDATE,CORPID,SALEDEPT,MBLFRT,CREATETIME,STLNAME,dbo.trimdate(STLDATE) STLDATE,OPERATORCODE,OPERATOR,OPERATOREMAIL,OPERATORTEL,OPERATORFAX,");
|
|
|
strSql.Append("FINANCIALSTAFFCODE,FINANCIALSTAFF,FINANCIALSTAFFEMAIL,FINANCIALSTAFFTEL,FINANCIALSTAFFFAX,PLACERECEIPTID,SOURCECODE,ISCONTAINERSOC,VESSELID,ISSUEPLACEID,HSCODE");
|
|
|
strSql.Append(",TRANSTATUS,EDIREMARK,SERVICECONTRACTNO,(CASE BSSTATUS WHEN 1 THEN '锁定' else '未锁定' end) as BSSTATUSREF ");
|
|
|
strSql.Append(",(CASE FEESTATUS WHEN 1 THEN '锁定' else '未锁定' end) as FEESTATUSREF,TRANSPORT ");
|
|
|
strSql.Append(",(SELECT TOP 1 STATUS FROM V_OP_STATUS WITH (NOLOCK) WHERE BSNO=OP_SEAE.BSNO ORDER BY COMPTIME DESC,INPUTTIME DESC) as OPSTATUS");
|
|
|
strSql.Append(",(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=97018 and EnumValueID=OP_SEAE.MANIFESTSTATUS) as MANIFESTSTATUSREF");
|
|
|
strSql.Append(",CUSTOMNO,ENTERPID,ENTERP,INSPECTIONNO,INSPECTIONDATE,CUSTOMDATE,CLEARCUSTOMDATE,ISMOREGOOD,TERMSDELIVERY,INSPECTSERVICE,TRADETERM,0 FENPIAO,ISGAIQIAN,WARNCOUNT");
|
|
|
|
|
|
strSql.Append(",dbo.F_GetBillDrFeeStatus(OP_SEAE.BSNO) DRFEESTATUS");
|
|
|
strSql.Append(",dbo.F_GetBillCrFeeStatus(OP_SEAE.BSNO) CRFEESTATUS,ISPRINTPR,MAILPROJECT");
|
|
|
|
|
|
strSql.Append(",(SELECT COUNT(*) FROM OP_AMEND WHERE PARENTID=OP_SEAE.BSNO) as AMENDCOUNT,SHIPAGENCY ");
|
|
|
strSql.Append(",I.TTLDR,I.TTLINVDR,I.TTLDUIDR,I.TTLCR,I.TTLINVCR,I.TTLDUICR,0 YJCR,0 HYFDR,0 HYFCR,0 BGFDR,0 NODAY");
|
|
|
strSql.Append(",(SELECT COUNT(*) FROM OP_APPLY WHERE MASTERNO=OP_SEAE.BSNO) as APPLYCOUNT ");
|
|
|
|
|
|
|
|
|
strSql.Append(",(SELECT TOP 1 BLSTATUS FROM op_blissue WHERE BSNO=OP_SEAE.BSNO) BLISSUESTATUS,ISCANCEL,ISTUI,TRANSREMARK,PRERECORD ");
|
|
|
|
|
|
strSql.Append(",MSHIPPERID,MCONSIGNEEID,MNOTIFYPARTYID,MSHIPPER,MCONSIGNEE,MNOTIFYPARTY,ATD,DELIVERYDATE,YARDATTN,YARDTEL,BillFeeStatus,SALECORPID,'' MDESCRIPTION ");
|
|
|
strSql.Append(",(select [NAME] from [company] where GID=OP_SEAE.SALECORPID) as SALECORP,(select TOP 1 COLOR FROM code_op_status_detail WITH (NOLOCK) WHERE OPSTATUS = (CASE WHEN (SELECT TOP 1 [STATUS] FROM V_OP_STATUS WHERE BSNO=OP_SEAE.BSNO ORDER BY COMPTIME DESC,INPUTTIME DESC) is null THEN '接受委托' else (SELECT TOP 1[STATUS] FROM V_OP_STATUS WHERE BSNO = OP_SEAE.BSNO ORDER BY COMPTIME DESC, INPUTTIME DESC) end))AS COLOR");
|
|
|
strSql.Append(" ,V.CUSTOMSSTATUS,V.PORTSTATUS,V.EXPSTATUS,V.TRUCKCTNSTATUS,V.CTNRETURNSTATUS,V.HGYDSTATUS,TRUCKSTATUS,V.ATASTATUS,V.STCSSTATUS,V.RCVESTATUS ,'' COUNTRY,EDI_TIME,VGM_TIME ");
|
|
|
|
|
|
strSql.Append(",STUFF((SELECT ',' + CNTRNO FROM op_ctn ctn WHERE ctn.BSNO = op_seae.BSNO FOR xml path('')),1, 1, '') AS CNTRNOALL ");
|
|
|
strSql.Append(",STUFF((SELECT ',' + SEALNO FROM op_ctn ctn WHERE ctn.BSNO = op_seae.BSNO FOR xml path('')),1, 1, '') AS SEALNOALL ");
|
|
|
|
|
|
strSql.Append(",dbo.F_STATUS_BULIAO(OP_SEAE.bsno) STATUS_BULIAO,dbo.F_STATUS_VGM(OP_SEAE.bsno) STATUS_VGM,dbo.F_STATUS_EDI(OP_SEAE.bsno) STATUS_EDI ");
|
|
|
strSql.Append(",(select top 1 ORDNO from crm_seaeorder where bsno=OP_SEAE.BSNO ) ORDNO");
|
|
|
strSql.Append(",(select top 1 CUSTOMERNAME from crm_seaeorder_fen where MASTERNO = OP_SEAE.BSNO order by ordno) FEN_CUSTOMERNAME");
|
|
|
strSql.Append(",ISEI");
|
|
|
|
|
|
strSql.Append(" from OP_SEAE ");
|
|
|
strSql.Append(" LEFT JOIN v_op_gain_dr_INV I ON (I.BSNO=OP_SEAE.BSNO) ");
|
|
|
|
|
|
strSql.Append(" left join (select bsno, sum(case when[status] = '海关放行' then 1 else 0 end) CUSTOMSSTATUS, sum(case when [status] = '运抵报告' then 1 else 0 end) HGYDSTATUS , sum(case when[status] = '码头放行' then 1 else 0 end) PORTSTATUS");
|
|
|
strSql.Append(", sum(case when[status] = '装船出运' then 1 else 0 end) EXPSTATUS, sum(case when [status] = '空箱出场' then 1 else case when [status] = '部分空出' then 2 else 0 end end) TRUCKCTNSTATUS");
|
|
|
strSql.Append(", sum(case when[status] = '到港' then 1 else 0 end) ATASTATUS, sum(case when [status] = '目的港提箱' then 1 else case when [status] = '部分目的港提箱' then 2 else 0 end end) STCSSTATUS ");
|
|
|
strSql.Append(", sum(case when [status] = '目的港返空' then 1 else case when [status] = '部分目的港返空' then 2 else 0 end end) RCVESTATUS ");
|
|
|
strSql.Append(", sum(case when[status] = '重箱返场' then 1 else case when [status] = '部分重返' then 2 else 0 end end) CTNRETURNSTATUS from op_status WITH (NOLOCK) GROUP BY BSNO) as v on(v.bsno = OP_SEAE.BSNO) ");
|
|
|
|
|
|
if (!string.IsNullOrEmpty(strCondition))
|
|
|
{
|
|
|
strSql.Append(" where MASTERNO=OP_SEAE.BSNO AND EXISTS ( select 1 from OP_SEAE B WHERE OP_SEAE.BSNO=B.MASTERNO AND " + strCondition + " )");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strSql.Append(" where MASTERNO=OP_SEAE.BSNO ");
|
|
|
|
|
|
}
|
|
|
strSql.Append(" ) as T ");
|
|
|
|
|
|
//
|
|
|
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 MsOpSeae GetData ( string condition,string userid="")
|
|
|
{
|
|
|
var strSql = new StringBuilder();
|
|
|
strSql.Append("SELECT BSNO,MASTERNO,ORDERTYPE,ORDTYPE,ORDERNO,BSSTATUS,FEESTATUS,BSDATE,ACCDATE,MBLNO,HBLNO,CUSTNO,APPLYNO,TRANSNO,CUSTOMERNAME,BLTYPE,SHIPPERID,");
|
|
|
strSql.Append("CONSIGNEEID,NOTIFYPARTYID,SHIPPER,CONSIGNEE,NOTIFYPARTY,AGENTID,AGENT,YARD,VESSEL,VOYNO,ETD,ETD2,CLOSINGDATE,ETA,VESSEL2N,VOYNO2N,VESSELID2N,");
|
|
|
strSql.Append("PlACERECEIPT,PORTLOADID,PORTLOAD,PORTDISCHARGEID,PORTDISCHARGE,PLACEDELIVERYID,PLACEDELIVERY,DESTINATIONID,DESTINATION,COPYNOBILL,");
|
|
|
strSql.Append("NOBILL,ISSUETYPE,ISSUEDATE,ISSUEPLACE,BLFRT,PREPARDAT,PREPARDATID,PAYABLEAT,[SERVICE],MARKS,CNTRSEALNO,NOPKGS,[DESCRIPTION],GOODSNAME,");
|
|
|
strSql.Append("GROSSWEIGHT,MEASUREMENT,PKGS,KINDPKGS,KGS,CBM,TOTALNO,CNTRNO,CNTR1,CNTR2,CNTR3,CNTR4,CNTR5,CNTR6,CNTR7,CNTR8,CNTR9,CNTR10,OTCNTR,");
|
|
|
strSql.Append("TEU,CNTRTOTAL,INPUTBY,OP,CUSTSERVICE,FRCUSTSERVICE,LANE,SALE,CARRIER,FORWARDER,CUSTOMSER,TRUCKER,INVNO,CARGOID,DCLASS,DUNNO,DPAGE,DLABEL,LINKMAN,");
|
|
|
strSql.Append("REEFERF,TEMPID,TEMPSET,TEMPMAX,TEMPMIN,HUMIDITY,BSSOURCE,BSSOURCEDETAIL,CUSTOMSNUM,CONTRACTNO,INSURANCEER,INSURANCENO,INAMOUT,ISVOU,VOUNO,REMARK,STATUS1,");
|
|
|
strSql.Append("STATUS2,STATUS3,STATUS4,STATUS5,ISFUMIGATION,ISSTORAGE,ISLAND,ISCUSTOMS,ISINSPECTION,ISBOOKING,ISAGENT,ISHBLNO,SERVICE9,SERVICE10,DOC,PACKINGTYPE,");
|
|
|
strSql.Append("WAREHOUSE,CLOSEDOCDATE,INTOPORTDATE,CORPID,SALEDEPT,MBLFRT,CREATETIME,STLNAME,dbo.trimdate(STLDATE) STLDATE,OPERATORCODE,OPERATOR,OPERATOREMAIL,OPERATORTEL,OPERATORFAX,");
|
|
|
strSql.Append("FINANCIALSTAFFCODE,FINANCIALSTAFF,FINANCIALSTAFFEMAIL,FINANCIALSTAFFTEL,FINANCIALSTAFFFAX,PLACERECEIPTID,SOURCECODE,ISCONTAINERSOC,VESSELID,ISSUEPLACEID,HSCODE");
|
|
|
strSql.Append(",TRANSTATUS,EDIREMARK,SERVICECONTRACTNO,(CASE BSSTATUS WHEN 1 THEN '锁定' else '未锁定' end) as BSSTATUSREF ");
|
|
|
strSql.Append(",(CASE FEESTATUS WHEN 1 THEN '锁定' else '未锁定' end) as FEESTATUSREF,TRANSPORT ");
|
|
|
strSql.Append(",'' as OPSTATUS ");
|
|
|
strSql.Append(",(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=97018 and EnumValueID=B.MANIFESTSTATUS) as MANIFESTSTATUSREF");
|
|
|
strSql.Append(",CUSTOMNO,ENTERPID,ENTERP,INSPECTIONNO,INSPECTIONDATE,CUSTOMDATE,CLEARCUSTOMDATE,ISMOREGOOD,TERMSDELIVERY,INSPECTSERVICE,TRADETERM,0 FENPIAO,ISGAIQIAN,WARNCOUNT");
|
|
|
strSql.Append(",'' DRFEESTATUS");
|
|
|
strSql.Append(",'' CRFEESTATUS");
|
|
|
strSql.Append(",SHIPAGENCY,ISPRINTPR,MAILPROJECT,0 AMENDCOUNT,0 as APPLYCOUNT,0 TTLDR,0 TTLINVDR,0 TTLDUIDR,0 TTLCR,0 TTLINVCR,0 TTLDUICR,0 YJCR,0 HYFDR,0 HYFCR,0 BGFDR,0 NODAY,ISCANCEL,ISTUI,''TRANSREMARK,PRERECORD ");
|
|
|
strSql.Append(",MSHIPPERID,MCONSIGNEEID,MNOTIFYPARTYID,MSHIPPER,MCONSIGNEE,MNOTIFYPARTY,ATD,DELIVERYDATE,YARDATTN,YARDTEL ");
|
|
|
|
|
|
// strSql.Append(",(SELECT COUNT(*) FROM OP_SEAE WHERE BSNO<>MASTERNO AND MASTERNO=B.BSNO) as FENPIAO ");
|
|
|
|
|
|
//20161117 邓羽 增加对提单签发状态的查询
|
|
|
strSql.Append(",isnull(BLISSUESTATUS,'') BLISSUESTATUS,B.BillFeeStatus,SALECORPID,MDESCRIPTION ");
|
|
|
strSql.Append(",(select [NAME] from [company] where GID=B.SALECORPID) as SALECORP");
|
|
|
strSql.Append(",0 CUSTOMSSTATUS,0 PORTSTATUS,0 EXPSTATUS,0 TRUCKCTNSTATUS,0 CTNRETURNSTATUS,0 HGYDSTATUS,TRUCKSTATUS,0 ATASTATUS,0 STCSSTATUS,0 RCVESTATUS ");
|
|
|
strSql.Append(",CASE WHEN len(DESTINATIONID)<>5 THEN '' ELSE (select top 1 c_country_name from t_sys_country_code where c_country_code=LEFT(DESTINATIONID,2)) END as COUNTRY,EDI_TIME,VGM_TIME ");
|
|
|
strSql.Append(",STUFF((SELECT ',' + CNTRNO FROM op_ctn ctn WHERE ctn.BSNO = B.BSNO FOR xml path('')),1, 1, '') AS CNTRNOALL ");
|
|
|
strSql.Append(",STUFF((SELECT ',' + SEALNO FROM op_ctn ctn WHERE ctn.BSNO = B.BSNO FOR xml path('')),1, 1, '') AS SEALNOALL ");
|
|
|
strSql.Append(",(select top 1 ORDNO from crm_seaeorder where bsno=B.BSNO ) ORDNO");
|
|
|
strSql.Append(",(select top 1 CUSTOMERNAME from crm_seaeorder_fen where MASTERNO = b.BSNO order by ordno) FEN_CUSTOMERNAME");
|
|
|
strSql.Append(",B.ISEI");
|
|
|
strSql.Append(" from OP_SEAE 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 MsOpSeae();
|
|
|
}
|
|
|
|
|
|
static public List<MsOpSeae> GetFenList ( string strCondition, string userid, string usercode, string companyid, string sort = null,bool norang=true)
|
|
|
{
|
|
|
|
|
|
if (norang)
|
|
|
{
|
|
|
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 B.BSNO,MASTERNO,ORDERTYPE,ORDTYPE,ORDERNO,BSSTATUS,FEESTATUS,BSDATE,ACCDATE,MBLNO,HBLNO,CUSTNO,APPLYNO,TRANSNO,CUSTOMERNAME,BLTYPE,SHIPPERID,");
|
|
|
strSql.Append("CONSIGNEEID,NOTIFYPARTYID,SHIPPER,CONSIGNEE,NOTIFYPARTY,AGENTID,AGENT,YARD,VESSEL,VOYNO,ETD,ETD2,CLOSINGDATE,ETA,VESSEL2N,VOYNO2N,VESSELID2N,");
|
|
|
|
|
|
strSql.Append("PlACERECEIPT,PORTLOADID,PORTLOAD,PORTDISCHARGEID,PORTDISCHARGE,PLACEDELIVERYID,PLACEDELIVERY,DESTINATIONID,DESTINATION,COPYNOBILL,");
|
|
|
strSql.Append("NOBILL,ISSUETYPE,ISSUEDATE,ISSUEPLACE,BLFRT,PREPARDAT,PREPARDATID,PAYABLEAT,[SERVICE],MARKS,CNTRSEALNO,NOPKGS,[DESCRIPTION],GOODSNAME,");
|
|
|
strSql.Append("GROSSWEIGHT,MEASUREMENT,PKGS,KINDPKGS,KGS,CBM,TOTALNO,CNTRNO,CNTR1,CNTR2,CNTR3,CNTR4,CNTR5,CNTR6,CNTR7,CNTR8,CNTR9,CNTR10,OTCNTR,");
|
|
|
strSql.Append("TEU,CNTRTOTAL,B.INPUTBY,OP,CUSTSERVICE,FRCUSTSERVICE,LANE,SALE,CARRIER,FORWARDER,CUSTOMSER,TRUCKER,INVNO,CARGOID,DCLASS,DUNNO,DPAGE,DLABEL,LINKMAN,");
|
|
|
strSql.Append("REEFERF,TEMPID,TEMPSET,TEMPMAX,TEMPMIN,HUMIDITY,BSSOURCE,BSSOURCEDETAIL,CUSTOMSNUM,CONTRACTNO,INSURANCEER,INSURANCENO,INAMOUT,ISVOU,VOUNO,B.REMARK,STATUS1,");
|
|
|
strSql.Append("STATUS2,STATUS3,STATUS4,STATUS5,ISFUMIGATION,ISSTORAGE,ISLAND,ISCUSTOMS,ISINSPECTION,ISBOOKING,ISAGENT,ISHBLNO,SERVICE9,SERVICE10,DOC,PACKINGTYPE,");
|
|
|
strSql.Append("WAREHOUSE,CLOSEDOCDATE,INTOPORTDATE,CORPID,SALEDEPT,MBLFRT,CREATETIME,STLNAME,dbo.trimdate(STLDATE) STLDATE,OPERATORCODE,OPERATOR,OPERATOREMAIL,OPERATORTEL,OPERATORFAX,");
|
|
|
strSql.Append("FINANCIALSTAFFCODE,FINANCIALSTAFF,FINANCIALSTAFFEMAIL,FINANCIALSTAFFTEL,FINANCIALSTAFFFAX,PLACERECEIPTID,SOURCECODE,ISCONTAINERSOC,VESSELID,ISSUEPLACEID,HSCODE");
|
|
|
strSql.Append(",TRANSTATUS,EDIREMARK,SERVICECONTRACTNO,(CASE BSSTATUS WHEN 1 THEN '锁定' else '未锁定' end) as BSSTATUSREF ");
|
|
|
strSql.Append(",(CASE FEESTATUS WHEN 1 THEN '锁定' else '未锁定' end) as FEESTATUSREF,TRANSPORT ");
|
|
|
strSql.Append(",(SELECT TOP 1 STATUS FROM V_OP_STATUS WITH (NOLOCK) WHERE BSNO=B.BSNO ORDER BY COMPTIME DESC,INPUTTIME DESC) as OPSTATUS ");
|
|
|
strSql.Append(",(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=97018 and EnumValueID=B.MANIFESTSTATUS) as MANIFESTSTATUSREF");
|
|
|
strSql.Append(",CUSTOMNO,ENTERPID,ENTERP,INSPECTIONNO,INSPECTIONDATE,CUSTOMDATE,CLEARCUSTOMDATE,ISMOREGOOD,TERMSDELIVERY,INSPECTSERVICE,TRADETERM,0 FENPIAO,ISGAIQIAN,WARNCOUNT");
|
|
|
strSql.Append(",dbo.F_GetBillDrFeeStatus(B.BSNO) DRFEESTATUS");
|
|
|
strSql.Append(",dbo.F_GetBillCrFeeStatus(B.BSNO) CRFEESTATUS");
|
|
|
strSql.Append(",SHIPAGENCY,ISPRINTPR,MAILPROJECT,0 AMENDCOUNT,0 as APPLYCOUNT,0 TTLDR,0 TTLINVDR,0 TTLDUIDR,0 TTLCR,0 TTLINVCR,0 TTLDUICR,0 YJCR,0 HYFDR,0 HYFCR,0 BGFDR,0 NODAY,ISCANCEL,ISTUI,'' TRANSREMARK,PRERECORD");
|
|
|
strSql.Append(",'' MSHIPPERID,'' MCONSIGNEEID,'' MNOTIFYPARTYID,'' MSHIPPER,'' MCONSIGNEE,'' MNOTIFYPARTY,ATD,DELIVERYDATE,YARDATTN,YARDTEL ");
|
|
|
|
|
|
|
|
|
// strSql.Append(",S.STATUS as OPSTATUS ");
|
|
|
|
|
|
// strSql.Append(",(SELECT COUNT(*) FROM OP_SEAE WHERE BSNO<>MASTERNO AND MASTERNO=B.BSNO) as FENPIAO ");
|
|
|
//20161117 邓羽 增加对提单签发状态的查询
|
|
|
strSql.Append(",isnull(BLISSUESTATUS,'') BLISSUESTATUS,B.BillFeeStatus,SALECORPID,'' MDESCRIPTION ");
|
|
|
strSql.Append(",(select [NAME] from [company] where GID=B.SALECORPID) as SALECORP");
|
|
|
strSql.Append(",0 CUSTOMSSTATUS,0 PORTSTATUS,0 EXPSTATUS,0 TRUCKCTNSTATUS,0 CTNRETURNSTATUS,0 HGYDSTATUS,TRUCKSTATUS,0 ATASTATUS,0 STCSSTATUS,0 RCVESTATUS,'' COUNTRY,EDI_TIME,VGM_TIME ");
|
|
|
strSql.Append(",STUFF((SELECT ',' + CNTRNO FROM op_ctn ctn WHERE ctn.BSNO = B.BSNO FOR xml path('')),1, 1, '') AS CNTRNOALL ");
|
|
|
strSql.Append(",STUFF((SELECT ',' + SEALNO FROM op_ctn ctn WHERE ctn.BSNO = B.BSNO FOR xml path('')),1, 1, '') AS SEALNOALL ");
|
|
|
strSql.Append(",(select top 1 ORDNO from crm_seaeorder where bsno=B.BSNO ) ORDNO");
|
|
|
strSql.Append(",(select top 1 CUSTOMERNAME from crm_seaeorder_fen where MASTERNO = b.BSNO order by ordno) FEN_CUSTOMERNAME");
|
|
|
strSql.Append(",B.ISEI");
|
|
|
strSql.Append(" from OP_SEAE B");
|
|
|
// strSql.Append(" left join V_OP_STATUS S ON (S.BSNO=B.BSNO) ");
|
|
|
|
|
|
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);
|
|
|
}
|
|
|
|
|
|
static public string GetFenListStr(string strCondition, string userid, string usercode, string companyid, string sort = null, bool norang = true)
|
|
|
{
|
|
|
|
|
|
if (norang)
|
|
|
{
|
|
|
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 B.BSNO,MASTERNO,ORDERTYPE,ORDTYPE,ORDERNO,BSSTATUS,FEESTATUS,BSDATE,ACCDATE,MBLNO,HBLNO,CUSTNO,APPLYNO,TRANSNO,CUSTOMERNAME,BLTYPE,SHIPPERID,");
|
|
|
strSql.Append("CONSIGNEEID,NOTIFYPARTYID,SHIPPER,CONSIGNEE,NOTIFYPARTY,AGENTID,AGENT,YARD,VESSEL,VOYNO,ETD,CLOSINGDATE,ETA,VESSEL2N,VOYNO2N,VESSELID2N,");
|
|
|
|
|
|
strSql.Append("PlACERECEIPT,PORTLOADID,PORTLOAD,PORTDISCHARGEID,PORTDISCHARGE,PLACEDELIVERYID,PLACEDELIVERY,DESTINATIONID,DESTINATION,COPYNOBILL,");
|
|
|
strSql.Append("NOBILL,ISSUETYPE,ISSUEDATE,ISSUEPLACE,BLFRT,PREPARDAT,PREPARDATID,PAYABLEAT,[SERVICE],MARKS,CNTRSEALNO,NOPKGS,[DESCRIPTION],GOODSNAME,");
|
|
|
strSql.Append("GROSSWEIGHT,MEASUREMENT,PKGS,KINDPKGS,KGS,CBM,TOTALNO,CNTRNO,CNTR1,CNTR2,CNTR3,CNTR4,CNTR5,CNTR6,CNTR7,CNTR8,CNTR9,CNTR10,OTCNTR,");
|
|
|
strSql.Append("TEU,CNTRTOTAL,B.INPUTBY,OP,CUSTSERVICE,LANE,SALE,CARRIER,FORWARDER,CUSTOMSER,TRUCKER,INVNO,CARGOID,DCLASS,DUNNO,DPAGE,DLABEL,LINKMAN,");
|
|
|
strSql.Append("REEFERF,TEMPID,TEMPSET,TEMPMAX,TEMPMIN,HUMIDITY,BSSOURCE,BSSOURCEDETAIL,CUSTOMSNUM,CONTRACTNO,INSURANCEER,INSURANCENO,INAMOUT,ISVOU,VOUNO,B.REMARK,STATUS1,");
|
|
|
strSql.Append("STATUS2,STATUS3,STATUS4,STATUS5,ISFUMIGATION,ISSTORAGE,ISLAND,ISCUSTOMS,ISINSPECTION,ISBOOKING,ISAGENT,ISHBLNO,SERVICE9,SERVICE10,DOC,PACKINGTYPE,");
|
|
|
strSql.Append("WAREHOUSE,CLOSEDOCDATE,INTOPORTDATE,CORPID,SALEDEPT,MBLFRT,CREATETIME,STLNAME,dbo.trimdate(STLDATE) STLDATE,OPERATORCODE,OPERATOR,OPERATOREMAIL,OPERATORTEL,OPERATORFAX,");
|
|
|
strSql.Append("FINANCIALSTAFFCODE,FINANCIALSTAFF,FINANCIALSTAFFEMAIL,FINANCIALSTAFFTEL,FINANCIALSTAFFFAX,PLACERECEIPTID,SOURCECODE,ISCONTAINERSOC,VESSELID,ISSUEPLACEID,HSCODE");
|
|
|
strSql.Append(",TRANSTATUS,EDIREMARK,SERVICECONTRACTNO,(CASE BSSTATUS WHEN 1 THEN '锁定' else '未锁定' end) as BSSTATUSREF ");
|
|
|
strSql.Append(",(CASE FEESTATUS WHEN 1 THEN '锁定' else '未锁定' end) as FEESTATUSREF,TRANSPORT ");
|
|
|
strSql.Append(",(SELECT TOP 1 STATUS FROM V_OP_STATUS WITH (NOLOCK) WHERE BSNO=B.BSNO ORDER BY COMPTIME DESC,INPUTTIME DESC) as OPSTATUS ");
|
|
|
strSql.Append(",(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=97018 and EnumValueID=B.MANIFESTSTATUS) as MANIFESTSTATUSREF");
|
|
|
strSql.Append(",CUSTOMNO,ENTERPID,ENTERP,INSPECTIONNO,INSPECTIONDATE,CUSTOMDATE,CLEARCUSTOMDATE,ISMOREGOOD,TERMSDELIVERY,INSPECTSERVICE,TRADETERM,0 FENPIAO,ISGAIQIAN,WARNCOUNT");
|
|
|
strSql.Append(",dbo.F_GetBillDrFeeStatus(B.BSNO) DRFEESTATUS");
|
|
|
strSql.Append(",dbo.F_GetBillCrFeeStatus(B.BSNO) CRFEESTATUS");
|
|
|
strSql.Append(",SHIPAGENCY,ISPRINTPR,MAILPROJECT,0 AMENDCOUNT,0 as APPLYCOUNT,0 TTLDR,0 TTLINVDR,0 TTLCR,0 TTLINVCR,0 TTLDUICR,0 YJCR,0 HYFDR,0 HYFCR,0 BGFDR,0 NODAY,ISCANCEL,ISTUI");
|
|
|
strSql.Append(",'' MSHIPPERID,'' MCONSIGNEEID,'' MNOTIFYPARTYID,'' MSHIPPER,'' MCONSIGNEE,'' MNOTIFYPARTY,ATD,DELIVERYDATE,YARDATTN,YARDTEL ");
|
|
|
|
|
|
|
|
|
// strSql.Append(",S.STATUS as OPSTATUS ");
|
|
|
|
|
|
// strSql.Append(",(SELECT COUNT(*) FROM OP_SEAE WHERE BSNO<>MASTERNO AND MASTERNO=B.BSNO) as FENPIAO ");
|
|
|
//20161117 邓羽 增加对提单签发状态的查询
|
|
|
strSql.Append(",isnull(BLISSUESTATUS,'') BLISSUESTATUS,BillFeeStatus,SALECORPID ");
|
|
|
strSql.Append(",(select [NAME] from [company] where GID=B.SALECORPID) as SALECORP");
|
|
|
strSql.Append(",0 CUSTOMSSTATUS,0 PORTSTATUS,0 EXPSTATUS,0 TRUCKCTNSTATUS,0 CTNRETURNSTATUS,0 HGYDSTATUS,TRUCKSTATUS,0 ATASTATUS,0 STCSSTATUS,0 RCVESTATUS ");
|
|
|
|
|
|
strSql.Append(" from OP_SEAE B");
|
|
|
// strSql.Append(" left join V_OP_STATUS S ON (S.BSNO=B.BSNO) ");
|
|
|
|
|
|
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 strSql.ToString();
|
|
|
}
|
|
|
|
|
|
private static List<MsOpSeae> SetData ( StringBuilder strSql,bool isNoForward=false)
|
|
|
{
|
|
|
var headList = new List<MsOpSeae>();
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
|
|
|
{
|
|
|
while (reader.Read())
|
|
|
{
|
|
|
MsOpSeae data = new MsOpSeae();
|
|
|
#region Set DB data to Object
|
|
|
data.BSNO = Convert.ToString(reader["BSNO"]);//业务编号
|
|
|
//字段过滤器(判断是否存在该列)
|
|
|
reader.GetSchemaTable().DefaultView.RowFilter = "ColumnName= 'COLOR'";
|
|
|
if (reader.GetSchemaTable().DefaultView.Count > 0)
|
|
|
data.COLOR= Convert.ToString(reader["COLOR"]);
|
|
|
data.ORDERTYPE = Convert.ToString(reader["ORDERTYPE"]);//委托方式
|
|
|
data.MASTERNO = Convert.ToString(reader["MASTERNO"]);//主编号
|
|
|
data.CUSTNO = Convert.ToString(reader["CUSTNO"]);//委托编号
|
|
|
data.MBLNO = Convert.ToString(reader["MBLNO"]);//主提单号
|
|
|
data.HBLNO = Convert.ToString(reader["HBLNO"]);//分提单号
|
|
|
data.APPLYNO = Convert.ToString(reader["APPLYNO"]);//放箱申请单号
|
|
|
if (reader["BSSTATUS"] != DBNull.Value)
|
|
|
data.BSSTATUS = Convert.ToBoolean(reader["BSSTATUS"]);//业务状态
|
|
|
if (reader["FEESTATUS"] != DBNull.Value)
|
|
|
data.FEESTATUS = Convert.ToBoolean(reader["FEESTATUS"]);//费用状态
|
|
|
data.BSSTATUSREF = Convert.ToString(reader["BSSTATUSREF"]);// 业务状态
|
|
|
data.FEESTATUSREF = Convert.ToString(reader["FEESTATUSREF"]);// 费用状态
|
|
|
data.MANIFESTSTATUS = Convert.ToString(reader["MANIFESTSTATUSREF"]); //舱单状态
|
|
|
if (Convert.ToString(reader["OPSTATUS"]) != "")
|
|
|
data.OPSTATUS = Convert.ToString(reader["OPSTATUS"]);// 费用状态
|
|
|
data.DRFEESTATUS = getfeestatus(Convert.ToString(reader["DRFEESTATUS"]));
|
|
|
data.CRFEESTATUS = getfeestatus(Convert.ToString(reader["CRFEESTATUS"]));
|
|
|
if (reader["AMENDCOUNT"] != DBNull.Value)
|
|
|
data.AMEND = Convert.ToString(reader["AMENDCOUNT"]);//是否有更改单
|
|
|
if (reader["APPLYCOUNT"] != DBNull.Value)
|
|
|
data.ISAPPLY = Convert.ToString(reader["APPLYCOUNT"]);//是否生成报关
|
|
|
if (reader["BSDATE"] != DBNull.Value)
|
|
|
data.BSDATE = Convert.ToDateTime(reader["BSDATE"]);//接单日期
|
|
|
data.ACCDATE = Convert.ToString(reader["ACCDATE"]);//会计期间
|
|
|
data.CUSTOMERNAME = Convert.ToString(reader["CUSTOMERNAME"]);//委托单位
|
|
|
data.BSSOURCE = Convert.ToString(reader["BSSOURCE"]);//业务来源
|
|
|
data.BSSOURCEDETAIL = Convert.ToString(reader["BSSOURCEDETAIL"]);//来源明细
|
|
|
data.INPUTBY = Convert.ToString(reader["INPUTBY"]);//录入人
|
|
|
data.OP = Convert.ToString(reader["OP"]);//操作员
|
|
|
data.CUSTSERVICE = Convert.ToString(reader["CUSTSERVICE"]);//客服员
|
|
|
data.FRCUSTSERVICE = Convert.ToString(reader["FRCUSTSERVICE"]);//海外客服员
|
|
|
data.SALE = Convert.ToString(reader["SALE"]);//揽货人
|
|
|
data.CORPID = Convert.ToString(reader["CORPID"]);//分公司代码
|
|
|
data.SALECORPID = Convert.ToString(reader["SALECORPID"]);//分公司代码
|
|
|
data.SALECORP = Convert.ToString(reader["SALECORP"]);//分公司代码
|
|
|
data.SALEDEPT = Convert.ToString(reader["SALEDEPT"]);//所属部门
|
|
|
data.CREATETIME = Convert.ToString(reader["CREATETIME"]);//创建时间
|
|
|
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");//到港日期
|
|
|
|
|
|
if (reader["ETD2"] != DBNull.Value)
|
|
|
data.ETD2 = Convert.ToDateTime(reader["ETD2"]).ToString("yyyy-MM-dd");//到港日期
|
|
|
|
|
|
if (reader["ATD"] != DBNull.Value)
|
|
|
data.ATD = Convert.ToDateTime(reader["ATD"]).ToString("yyyy-MM-dd");//到港日期
|
|
|
if (reader["DELIVERYDATE"] != DBNull.Value)
|
|
|
data.DELIVERYDATE = Convert.ToDateTime(reader["DELIVERYDATE"]).ToString("yyyy-MM-dd");//交货日期
|
|
|
data.VESSEL2N = Convert.ToString(reader["VESSEL2N"]);//船名
|
|
|
data.VOYNO2N = Convert.ToString(reader["VOYNO2N"]);//航次
|
|
|
data.VESSELID2N = Convert.ToString(reader["VESSELID2N"]);//航次
|
|
|
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"]);//卸货港
|
|
|
data.CNTRNO = Convert.ToString(reader["CNTRNO"]);//集装箱大写
|
|
|
if (reader["CNTR1"] != DBNull.Value)
|
|
|
data.CNTR1 = Convert.ToInt32(reader["CNTR1"]);//箱型1
|
|
|
if (reader["CNTR2"] != DBNull.Value)
|
|
|
data.CNTR2 = Convert.ToInt32(reader["CNTR2"]);//箱型2
|
|
|
if (reader["CNTR3"] != DBNull.Value)
|
|
|
data.CNTR3 = Convert.ToInt32(reader["CNTR3"]);//箱型3
|
|
|
if (reader["CNTR4"] != DBNull.Value)
|
|
|
data.CNTR4 = Convert.ToInt32(reader["CNTR4"]);//箱型4
|
|
|
if (reader["CNTR5"] != DBNull.Value)
|
|
|
data.CNTR5 = Convert.ToInt32(reader["CNTR5"]);//箱型5
|
|
|
if (reader["CNTR6"] != DBNull.Value)
|
|
|
data.CNTR6 = Convert.ToInt32(reader["CNTR6"]);//箱型6
|
|
|
if (reader["CNTR7"] != DBNull.Value)
|
|
|
data.CNTR7 = Convert.ToInt32(reader["CNTR7"]);//箱型7
|
|
|
if (reader["CNTR8"] != DBNull.Value)
|
|
|
data.CNTR8 = Convert.ToInt32(reader["CNTR8"]);//箱型8
|
|
|
if (reader["CNTR9"] != DBNull.Value)
|
|
|
data.CNTR9 = Convert.ToInt32(reader["CNTR9"]);//箱型9
|
|
|
if (reader["CNTR10"] != DBNull.Value)
|
|
|
data.CNTR10 = Convert.ToInt32(reader["CNTR10"]);//箱型10
|
|
|
if (reader["OTCNTR"] != DBNull.Value)
|
|
|
data.OTCNTR = Convert.ToInt32(reader["OTCNTR"]);//其他箱型
|
|
|
if (reader["TEU"] != DBNull.Value)
|
|
|
data.TEU = Convert.ToInt32(reader["TEU"]);//箱TEU
|
|
|
data.CNTRTOTAL = Convert.ToString(reader["CNTRTOTAL"]);//集装箱全部内容
|
|
|
data.GOODSNAME = Convert.ToString(reader["GOODSNAME"]);//品名
|
|
|
data.CONTRACTNO = Convert.ToString(reader["CONTRACTNO"]);//合同号
|
|
|
if (reader["KGS"] != DBNull.Value)
|
|
|
data.KGS = Convert.ToString(reader["KGS"]);//毛重
|
|
|
data.CUSTOMSER = Convert.ToString(reader["CUSTOMSER"]);//报关行
|
|
|
if (reader["PKGS"] != DBNull.Value)
|
|
|
data.PKGS = Convert.ToString(reader["PKGS"]);//件数
|
|
|
if (reader["ISVOU"] != DBNull.Value)
|
|
|
data.ISVOU = Convert.ToBoolean(reader["ISVOU"]);//是否生成凭证
|
|
|
data.VOUNO = Convert.ToString(reader["VOUNO"]);//凭证号
|
|
|
data.KINDPKGS = Convert.ToString(reader["KINDPKGS"]);//件数包装
|
|
|
data.REMARK = Convert.ToString(reader["REMARK"]).Replace(@"\\\\", "\n").Replace(@"^", "\'");//备注
|
|
|
data.YARD = Convert.ToString(reader["YARD"]);//场站/靠泊码头
|
|
|
data.YARDATTN = Convert.ToString(reader["YARDATTN"]);//场站/靠泊码头
|
|
|
data.YARDTEL = Convert.ToString(reader["YARDTEL"]);//场站/靠泊码头
|
|
|
data.BLTYPE = Convert.ToString(reader["BLTYPE"]);//装运方式
|
|
|
if (reader["CBM"] != DBNull.Value)
|
|
|
data.CBM = Convert.ToString(reader["CBM"]);//立方数/尺码
|
|
|
data.CNTRSEALNO = Convert.ToString(reader["CNTRSEALNO"]);//箱号封号
|
|
|
data.CARRIER = Convert.ToString(reader["CARRIER"]);//船公司
|
|
|
data.TRUCKER = Convert.ToString(reader["TRUCKER"]);//承运车队
|
|
|
if (reader["CUSTOMSNUM"] != DBNull.Value)
|
|
|
data.CUSTOMSNUM = Convert.ToInt32(reader["CUSTOMSNUM"]);//报关票数
|
|
|
if (reader["PRERECORD"] != DBNull.Value)
|
|
|
data.PRERECORD = Convert.ToInt32(reader["PRERECORD"]);//报关票数
|
|
|
data.NOPKGS = Convert.ToString(reader["NOPKGS"]);//件数包装
|
|
|
if (reader["GROSSWEIGHT"] != DBNull.Value)
|
|
|
data.GROSSWEIGHT = Convert.ToString(reader["GROSSWEIGHT"]);//货物毛重
|
|
|
if (reader["MEASUREMENT"] != DBNull.Value)
|
|
|
data.MEASUREMENT = Convert.ToString(reader["MEASUREMENT"]);//货物尺码
|
|
|
data.DESCRIPTION = Convert.ToString(reader["DESCRIPTION"]);//货物描述
|
|
|
data.TOTALNO = Convert.ToString(reader["TOTALNO"]);//件数大写
|
|
|
data.TRANSNO = Convert.ToString(reader["TRANSNO"]);//运单号
|
|
|
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(@"^", "\'");//发货人内容
|
|
|
data.CONSIGNEE = Convert.ToString(reader["CONSIGNEE"]).Replace(@"\\\\", "\n").Replace(@"^", "\'");//收货人内容
|
|
|
data.NOTIFYPARTY = Convert.ToString(reader["NOTIFYPARTY"]).Replace(@"\\\\", "\n").Replace(@"^", "\'");//通知人内容
|
|
|
data.MSHIPPERID = Convert.ToString(reader["MSHIPPERID"]);//发货人
|
|
|
data.MCONSIGNEEID = Convert.ToString(reader["MCONSIGNEEID"]);//收货人
|
|
|
data.MNOTIFYPARTYID = Convert.ToString(reader["MNOTIFYPARTYID"]);//通知人
|
|
|
data.MSHIPPER = Convert.ToString(reader["MSHIPPER"]).Replace(@"\\\\", "\n").Replace(@"^", "\'");//发货人内容
|
|
|
data.MCONSIGNEE = Convert.ToString(reader["MCONSIGNEE"]).Replace(@"\\\\", "\n").Replace(@"^", "\'");//收货人内容
|
|
|
data.MNOTIFYPARTY = Convert.ToString(reader["MNOTIFYPARTY"]).Replace(@"\\\\", "\n").Replace(@"^", "\'");//通知人内容
|
|
|
|
|
|
data.AGENTID = Convert.ToString(reader["AGENTID"]);//国外代理
|
|
|
data.AGENT = Convert.ToString(reader["AGENT"]);//国外代理内容
|
|
|
if (reader["CLOSINGDATE"] != DBNull.Value)
|
|
|
data.CLOSINGDATE = Convert.ToDateTime(reader["CLOSINGDATE"]).ToString("yyyy-MM-dd HH:mm:ss");//截港日期
|
|
|
if (reader["ETA"] != DBNull.Value)
|
|
|
data.ETA = Convert.ToDateTime(reader["ETA"]).ToString("yyyy-MM-dd");//预抵日期
|
|
|
|
|
|
if (reader["EDI_TIME"] != DBNull.Value)
|
|
|
data.EDI_TIME = Convert.ToDateTime(reader["EDI_TIME"]).ToString("yyyy-MM-dd HH:mm:ss");//
|
|
|
if (reader["VGM_TIME"] != DBNull.Value)
|
|
|
data.VGM_TIME = Convert.ToDateTime(reader["VGM_TIME"]).ToString("yyyy-MM-dd HH:mm:ss");//
|
|
|
|
|
|
data.PLACERECEIPT = Convert.ToString(reader["PlACERECEIPT"]);//收货地
|
|
|
data.PLACERECEIPTID = Convert.ToString(reader["PLACERECEIPTID"]);//收货地
|
|
|
data.PLACEDELIVERYID = Convert.ToString(reader["PLACEDELIVERYID"]);//交货地代码
|
|
|
data.PLACEDELIVERY = Convert.ToString(reader["PLACEDELIVERY"]);//交货地
|
|
|
data.DESTINATIONID = Convert.ToString(reader["DESTINATIONID"]);//目的地代码
|
|
|
data.DESTINATION = Convert.ToString(reader["DESTINATION"]);//目的地
|
|
|
data.NOBILL = Convert.ToString(reader["NOBILL"]);//提单份数
|
|
|
data.COPYNOBILL = Convert.ToString(reader["COPYNOBILL"]);//提单份数
|
|
|
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.PREPARDATID = Convert.ToString(reader["PREPARDATID"]);//预付地点
|
|
|
data.PAYABLEAT = Convert.ToString(reader["PAYABLEAT"]);//到付地点
|
|
|
data.SERVICE = Convert.ToString(reader["SERVICE"]);//运输条款
|
|
|
data.MARKS = Convert.ToString(reader["MARKS"]);//唛头
|
|
|
data.LANE = Convert.ToString(reader["LANE"]);//航线
|
|
|
if (isNoForward&& data.ORDERTYPE=="销售订舱")
|
|
|
data.FORWARDER ="订舱中心";//订舱公司
|
|
|
else
|
|
|
data.FORWARDER = Convert.ToString(reader["FORWARDER"]);//订舱公司
|
|
|
data.INVNO = Convert.ToString(reader["INVNO"]);//发票号
|
|
|
data.CARGOID = Convert.ToString(reader["CARGOID"]);//货物标识
|
|
|
data.DCLASS = Convert.ToString(reader["DCLASS"]);//危险品分类/等级
|
|
|
data.DUNNO = Convert.ToString(reader["DUNNO"]);//危险品编号
|
|
|
data.REEFERF = Convert.ToString(reader["REEFERF"]);//冷藏通风量
|
|
|
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.HUMIDITY = Convert.ToString(reader["HUMIDITY"]);//湿度
|
|
|
data.ORDTYPE = Convert.ToString(reader["ORDTYPE"]);//订舱类型
|
|
|
data.ORDERNO = Convert.ToString(reader["ORDERNO"]);//订舱编号
|
|
|
data.INSURANCEER = Convert.ToString(reader["INSURANCEER"]);//保险人
|
|
|
data.INSURANCENO = Convert.ToString(reader["INSURANCENO"]);//保险单号
|
|
|
if (reader["INAMOUT"] != DBNull.Value)
|
|
|
data.INAMOUT = Convert.ToDecimal(reader["INAMOUT"]);//保险金额
|
|
|
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.DOC = Convert.ToString(reader["DOC"]);//单证
|
|
|
data.PACKINGTYPE = Convert.ToString(reader["PACKINGTYPE"]);//装箱类型
|
|
|
data.WAREHOUSE = Convert.ToString(reader["WAREHOUSE"]);//仓库
|
|
|
if (reader["CLOSEDOCDATE"] != DBNull.Value)
|
|
|
data.CLOSEDOCDATE = Convert.ToDateTime(reader["CLOSEDOCDATE"]).ToString("yyyy-MM-dd HH:mm:ss");//截单日期
|
|
|
data.INTOPORTDATE = Convert.ToString(reader["INTOPORTDATE"]);//集港日期
|
|
|
data.MBLFRT = Convert.ToString(reader["MBLFRT"]);//MBL付费方式
|
|
|
data.STLNAME = Convert.ToString(reader["STLNAME"]);//结算方式
|
|
|
data.STLDATE = Convert.ToString(reader["STLDATE"]);//结算时间
|
|
|
data.OPERATORCODE = Convert.ToString(reader["OPERATORCODE"]);//客户操作代码
|
|
|
data.OPERATOR = Convert.ToString(reader["OPERATOR"]);//客户操作名称
|
|
|
data.OPERATOREMAIL = Convert.ToString(reader["OPERATOREMAIL"]);//操作电子邮箱
|
|
|
data.OPERATORTEL = Convert.ToString(reader["OPERATORTEL"]);//操作电话
|
|
|
data.OPERATORFAX = Convert.ToString(reader["OPERATORFAX"]);//操作传真
|
|
|
data.FINANCIALSTAFFCODE = Convert.ToString(reader["FINANCIALSTAFFCODE"]);//客户财务代码
|
|
|
data.FINANCIALSTAFF = Convert.ToString(reader["FINANCIALSTAFF"]);//客户财务名称
|
|
|
data.FINANCIALSTAFFEMAIL = Convert.ToString(reader["FINANCIALSTAFFEMAIL"]);//财务电子邮箱
|
|
|
try
|
|
|
{
|
|
|
if (reader["FINANCIALSTAFFTEL"] != DBNull.Value)
|
|
|
data.FINANCIALSTAFFTEL = Convert.ToDateTime(reader["FINANCIALSTAFFTEL"]).ToString("yyyy-MM-dd");//
|
|
|
}
|
|
|
catch (Exception e) {
|
|
|
|
|
|
|
|
|
}
|
|
|
//data.FINANCIALSTAFFTEL = Convert.ToString(reader["FINANCIALSTAFFTEL"]);//财务电话
|
|
|
data.FINANCIALSTAFFFAX = Convert.ToString(reader["FINANCIALSTAFFFAX"]);//财务传真
|
|
|
data.SOURCECODE = Convert.ToString(reader["SOURCECODE"]);//集装箱(器)来源代码
|
|
|
if (reader["ISCONTAINERSOC"] != DBNull.Value)
|
|
|
data.ISCONTAINERSOC = Convert.ToBoolean(reader["ISCONTAINERSOC"]);//货主箱标志,是否自有箱
|
|
|
data.DPAGE = Convert.ToString(reader["DPAGE"]);//危险品页号
|
|
|
data.DLABEL = Convert.ToString(reader["DLABEL"]);//危险品标签
|
|
|
data.LINKMAN = Convert.ToString(reader["LINKMAN"]);//危险品联系人
|
|
|
data.VESSELID = Convert.ToString(reader["VESSELID"]);//船舶呼号
|
|
|
data.ISSUEPLACEID = Convert.ToString(reader["ISSUEPLACEID"]);//提单签发地代码
|
|
|
data.HSCODE = Convert.ToString(reader["HSCODE"]);//HS编码
|
|
|
data.TRANSTATUS = Convert.ToString(reader["TRANSTATUS"]);//出运状态
|
|
|
data.EDIREMARK = Convert.ToString(reader["EDIREMARK"]);//EDI备注
|
|
|
data.SERVICECONTRACTNO = Convert.ToString(reader["SERVICECONTRACTNO"]);//EDI备注
|
|
|
data.CUSTOMNO = Convert.ToString(reader["CUSTOMNO"]);//报关单号
|
|
|
if (reader["CUSTOMDATE"] != DBNull.Value)
|
|
|
data.CUSTOMDATE = Convert.ToDateTime(reader["CUSTOMDATE"]).ToString("yyyy-MM-dd");//
|
|
|
data.INSPECTIONNO = Convert.ToString(reader["INSPECTIONNO"]);//商检号
|
|
|
if (reader["INSPECTIONDATE"] != DBNull.Value)
|
|
|
data.INSPECTIONDATE = Convert.ToDateTime(reader["INSPECTIONDATE"]).ToString("yyyy-MM-dd");//
|
|
|
data.ENTERP = Convert.ToString(reader["ENTERP"]);//经营单位
|
|
|
data.ENTERPID = Convert.ToString(reader["ENTERPID"]);//经营单位代码
|
|
|
if (reader["CLEARCUSTOMDATE"] != DBNull.Value)
|
|
|
data.CLEARCUSTOMDATE = Convert.ToDateTime(reader["CLEARCUSTOMDATE"]).ToString("yyyy-MM-dd");//
|
|
|
data.TERMSDELIVERY = Convert.ToString(reader["TERMSDELIVERY"]);//经营单位
|
|
|
data.INSPECTSERVICE = Convert.ToString(reader["INSPECTSERVICE"]);//经营单位代码
|
|
|
data.TRADETERM = Convert.ToString(reader["TRADETERM"]);//贸易条款
|
|
|
data.SHIPAGENCY = Convert.ToString(reader["SHIPAGENCY"]);//船代
|
|
|
|
|
|
if (reader["ISMOREGOOD"] != DBNull.Value)
|
|
|
data.ISMOREGOOD = Convert.ToBoolean(reader["ISMOREGOOD"]);//多品名
|
|
|
if (Convert.ToString(reader["BLTYPE"]) == "拼箱主票"|| Convert.ToString(reader["BLTYPE"]) == "合票主票")
|
|
|
data.FENPIAO = "1";//件数
|
|
|
else
|
|
|
data.FENPIAO = "0";//件数
|
|
|
data.ISPRINTPR = Convert.ToString(reader["ISPRINTPR"]);
|
|
|
data.MAILPROJECT = Convert.ToString(reader["MAILPROJECT"]);
|
|
|
|
|
|
//20161117 邓羽 增加对提单签发状态的查询
|
|
|
data.BLISSUESTATUS = Convert.ToString(reader["BLISSUESTATUS"]);
|
|
|
|
|
|
decimal ttldr = 0;
|
|
|
decimal ttlduidr = 0;
|
|
|
if (reader["TTLDR"] != DBNull.Value)
|
|
|
ttldr = Convert.ToDecimal(reader["TTLDR"]);
|
|
|
decimal ttlinvdr = 0;
|
|
|
if (reader["TTLINVDR"] != DBNull.Value)
|
|
|
ttlinvdr = Convert.ToDecimal(reader["TTLINVDR"]);
|
|
|
if (reader["TTLDUIDR"] != DBNull.Value)
|
|
|
ttlduidr = Convert.ToDecimal(reader["TTLDUIDR"]);
|
|
|
|
|
|
if (ttlinvdr == 0) data.DRINVSTATUS = "未开票";
|
|
|
else if (ttlinvdr == ttldr) data.DRINVSTATUS = "已开票";
|
|
|
else if (ttlinvdr != ttldr) data.DRINVSTATUS = "部分开票";
|
|
|
|
|
|
if (ttlduidr == 0) data.DRDUISTATUS = "未对账";
|
|
|
else if (ttlduidr == ttldr) data.DRDUISTATUS = "已对账";
|
|
|
else if (ttlduidr != ttldr) data.DRDUISTATUS = "部分对账";
|
|
|
|
|
|
decimal ttlcr = 0;
|
|
|
decimal ttlduicr = 0;
|
|
|
if (reader["TTLCR"] != DBNull.Value)
|
|
|
ttlcr = Convert.ToDecimal(reader["TTLCR"]);
|
|
|
decimal ttlinvcr = 0;
|
|
|
if (reader["TTLINVCR"] != DBNull.Value)
|
|
|
ttlinvcr = Convert.ToDecimal(reader["TTLINVCR"]);
|
|
|
if (reader["TTLDUICR"] != DBNull.Value)
|
|
|
ttlduicr = Convert.ToDecimal(reader["TTLDUICR"]);
|
|
|
if (ttlinvcr == 0) data.CRINVSTATUS = "未开票";
|
|
|
else if (ttlinvcr == ttlcr) data.CRINVSTATUS = "已开票";
|
|
|
else if (ttlinvcr != ttlcr) data.CRINVSTATUS = "部分开票";
|
|
|
|
|
|
if (ttlduicr == 0) data.CRDUISTATUS = "未对账";
|
|
|
else if (ttlduicr == ttldr) data.CRDUISTATUS = "已对账";
|
|
|
else if (ttlduicr != ttldr) data.CRDUISTATUS = "部分对账";
|
|
|
|
|
|
|
|
|
|
|
|
data.ISCANCEL = Convert.ToString(reader["ISCANCEL"]);
|
|
|
data.ISTUI = Convert.ToString(reader["ISTUI"]);
|
|
|
data.BillFeeStatus = Convert.ToString(reader["BillFeeStatus"]);
|
|
|
if (reader["CUSTOMSSTATUS"] != DBNull.Value)
|
|
|
data.CUSTOMSSTATUS = Convert.ToInt32(reader["CUSTOMSSTATUS"]);
|
|
|
if (reader["PORTSTATUS"] != DBNull.Value)
|
|
|
data.PORTSTATUS = Convert.ToInt32(reader["PORTSTATUS"]);
|
|
|
if (reader["EXPSTATUS"] != DBNull.Value)
|
|
|
data.EXPSTATUS = Convert.ToInt32(reader["EXPSTATUS"]);
|
|
|
if (reader["TRUCKCTNSTATUS"] != DBNull.Value)
|
|
|
data.TRUCKCTNSTATUS = Convert.ToInt32(reader["TRUCKCTNSTATUS"]);
|
|
|
if (reader["CTNRETURNSTATUS"] != DBNull.Value)
|
|
|
data.CTNRETURNSTATUS = Convert.ToInt32(reader["CTNRETURNSTATUS"]);
|
|
|
if (reader["ATASTATUS"] != DBNull.Value)
|
|
|
data.ATASTATUS = Convert.ToInt32(reader["ATASTATUS"]);
|
|
|
if (reader["STCSSTATUS"] != DBNull.Value)
|
|
|
data.STCSSTATUS = Convert.ToInt32(reader["STCSSTATUS"]);
|
|
|
if (reader["HGYDSTATUS"] != DBNull.Value)
|
|
|
data.HGYDSTATUS = Convert.ToInt32(reader["HGYDSTATUS"]);
|
|
|
if (reader["RCVESTATUS"] != DBNull.Value)
|
|
|
data.RCVESTATUS = Convert.ToInt32(reader["RCVESTATUS"]);
|
|
|
|
|
|
|
|
|
if (reader["ISGAIQIAN"] != DBNull.Value)
|
|
|
data.ISGAIQIAN = Convert.ToBoolean(reader["ISGAIQIAN"]);//状态1
|
|
|
if (reader["WARNCOUNT"] != DBNull.Value)
|
|
|
data.WARNCOUNT = Convert.ToInt32(reader["WARNCOUNT"]);
|
|
|
data.TRUCKSTATUS = Convert.ToString(reader["TRUCKSTATUS"]);
|
|
|
data.TRANSREMARK= Convert.ToString(reader["TRANSREMARK"]);
|
|
|
data.MDESCRIPTION = Convert.ToString(reader["MDESCRIPTION"]);
|
|
|
data.COUNTRY= Convert.ToString(reader["COUNTRY"]);
|
|
|
data.NODAY = Convert.ToString(reader["NODAY"]);
|
|
|
data.YJCR = Convert.ToString(reader["YJCR"]);
|
|
|
data.HYFDR = Convert.ToString(reader["HYFDR"]);
|
|
|
data.HYFCR = Convert.ToString(reader["HYFCR"]);
|
|
|
data.BGFDR = Convert.ToString(reader["BGFDR"]);
|
|
|
data.GROUPBS = data.ETD +"-"+ data.CARRIER+ "-" + data.LANE +"-"+ data.VESSEL+data.VOYNO;
|
|
|
|
|
|
data.CNTRNOALL = Convert.ToString(reader["CNTRNOALL"]);
|
|
|
data.SEALNOALL = Convert.ToString(reader["SEALNOALL"]);
|
|
|
|
|
|
|
|
|
|
|
|
if (BasicDataRefDAL.ReadFieldExist(reader, "STATUS_BULIAO"))
|
|
|
{
|
|
|
data.STATUS_BULIAO = Convert.ToString(reader["STATUS_BULIAO"]);
|
|
|
}
|
|
|
if (BasicDataRefDAL.ReadFieldExist(reader, "STATUS_VGM"))
|
|
|
{
|
|
|
data.STATUS_VGM = Convert.ToString(reader["STATUS_VGM"]);
|
|
|
}
|
|
|
if (BasicDataRefDAL.ReadFieldExist(reader, "STATUS_EDI"))
|
|
|
{
|
|
|
data.STATUS_EDI = Convert.ToString(reader["STATUS_EDI"]);
|
|
|
}
|
|
|
|
|
|
data.ORDNO = Convert.ToString(reader["ORDNO"]);
|
|
|
data.FEN_CUSTOMERNAME = Convert.ToString(reader["FEN_CUSTOMERNAME"]);
|
|
|
|
|
|
data.ISEI = Convert.ToString(reader["ISEI"]);
|
|
|
#endregion
|
|
|
headList.Add(data);
|
|
|
}
|
|
|
reader.Close();
|
|
|
}
|
|
|
return headList;
|
|
|
}
|
|
|
|
|
|
static public List<MsOpSeae> GetFeeDataList(int start, int limit, string strCondition, string userid, string usercode, string companyid, string sort = null, string load = null)
|
|
|
{
|
|
|
var rangstr = GetRangDAStr("index", userid, usercode, companyid);
|
|
|
if (!string.IsNullOrEmpty(rangstr))
|
|
|
{
|
|
|
if (!string.IsNullOrEmpty(strCondition))
|
|
|
{
|
|
|
strCondition = strCondition + " and " + rangstr;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strCondition = rangstr;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
var isNoForward = MsBaseInfoDAL.MsBaseInfoDAL.GetUserModuleEnable("modMsNoForward", userid);
|
|
|
|
|
|
var strSql = new StringBuilder();
|
|
|
|
|
|
strSql.Append(@"SELECT *,'' COUNTRY from (SELECT row_number() over (");
|
|
|
|
|
|
var sortstring = DatasetSort.Getsortstring(sort);
|
|
|
if (!string.IsNullOrEmpty(sortstring))
|
|
|
{
|
|
|
if (sortstring.ToUpper().IndexOf("OPSTATUS") >= 0)
|
|
|
strSql.Append(" order by " + sortstring.Replace("OPSTATUS", "(SELECT TOP 1 STATUS FROM V_OP_STATUS WITH (NOLOCK) WHERE BSNO=OP_SEAE.BSNO ORDER BY COMPTIME DESC,INPUTTIME DESC)"));
|
|
|
else if (sortstring.ToUpper().IndexOf("DRFEESTATUS") >= 0)
|
|
|
strSql.Append(" order by " + sortstring.Replace("DRFEESTATUS", " dbo.F_GetBillDrFeeStatus(OP_SEAE.BSNO) "));
|
|
|
else if (sortstring.ToUpper().IndexOf("CRFEESTATUS") >= 0)
|
|
|
strSql.Append(" order by " + sortstring.Replace("CRFEESTATUS", " dbo.F_GetBillCrFeeStatus(OP_SEAE.BSNO) "));
|
|
|
else if (sortstring.ToUpper().IndexOf("BSSTATUSREF") >= 0)
|
|
|
strSql.Append(" order by " + sortstring.Replace("BSSTATUSREF", " BSSTATUS "));
|
|
|
else if (sortstring.ToUpper().IndexOf("FEESTATUSREF") >= 0)
|
|
|
strSql.Append(" order by " + sortstring.Replace("FEESTATUSREF", " FEESTATUS "));
|
|
|
else if (sortstring.ToUpper().IndexOf("AMEND") >= 0)
|
|
|
strSql.Append(" order by " + sortstring.Replace("AMEND", " CASE WHEN (SELECT COUNT(*) FROM OP_AMEND WHERE PARENTID=OP_SEAE.BSNO)>0 THEN 1 ELSE 0 END "));
|
|
|
else if (sortstring.ToUpper().IndexOf("DRINVSTATUS") >= 0)
|
|
|
strSql.Append(" order by " + sortstring.Replace("DRINVSTATUS", " CASE WHEN ISNULL(I.TTLINVDR,0)=0 THEN '未开票' ELSE CASE WHEN ISNULL(I.TTLINVDR,0)=ISNULL(I.TTLDR,0) THEN '已开票' ELSE '部分开票' END END "));
|
|
|
else if (sortstring.ToUpper().IndexOf("DRDUISTATUS") >= 0)
|
|
|
strSql.Append(" order by " + sortstring.Replace("DRDUISTATUS", " CASE WHEN ISNULL(I.TTLDUIDR,0)=0 THEN '未对账' ELSE CASE WHEN ISNULL(I.TTLDUIDR,0)=ISNULL(I.TTLDR,0) THEN '已对账' ELSE '部分对账' END END "));
|
|
|
else if (sortstring.ToUpper().IndexOf("GROUPBS") >= 0)
|
|
|
strSql.Append(" order by " + sortstring.Replace("GROUPBS", " ISNULL(ETD,GETDATE()+1000) DESC,CARRIER,LANE,DESTINATION,VESSEL,VOYNO desc "));
|
|
|
else
|
|
|
{
|
|
|
sortstring = sortstring.Replace("SALECORP", "OP_SEAE.SALECORPID");
|
|
|
strSql.Append(" order by " + sortstring);
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
//var SeaeDefaultSort = MsSysParamSetDAL.GetData("PARAMNAME='SeaeDefaultSort'");
|
|
|
//if (SeaeDefaultSort.PARAMVALUE != "")
|
|
|
// strSql.Append(" order by " + SeaeDefaultSort.PARAMVALUE);
|
|
|
//else
|
|
|
strSql.Append(" order by ISNULL(ETD,GETDATE()+1000),CARRIER,LANE,VESSEL,VOYNO desc");
|
|
|
}
|
|
|
strSql.Append(@") as num , ");
|
|
|
|
|
|
strSql.Append("OP_SEAE.BSNO,MASTERNO,ORDERTYPE,ORDTYPE,ORDERNO,BSSTATUS,FEESTATUS,BSDATE,ACCDATE,MBLNO,HBLNO,APPLYNO,CUSTNO,TRANSNO,CUSTOMERNAME,BLTYPE,SHIPPERID,");
|
|
|
strSql.Append("CONSIGNEEID,NOTIFYPARTYID,SHIPPER,CONSIGNEE,NOTIFYPARTY,AGENTID,AGENT,YARD,VESSEL,VOYNO,ETD,ETD2,CLOSINGDATE,ETA,VESSEL2N,VOYNO2N,VESSELID2N,");
|
|
|
|
|
|
strSql.Append("PlACERECEIPT,PORTLOADID,PORTLOAD,PORTDISCHARGEID,PORTDISCHARGE,PLACEDELIVERYID,PLACEDELIVERY,DESTINATIONID,DESTINATION,COPYNOBILL,");
|
|
|
strSql.Append("NOBILL,ISSUETYPE,ISSUEDATE,ISSUEPLACE,BLFRT,PREPARDAT,PREPARDATID,PAYABLEAT,[SERVICE],MARKS,CNTRSEALNO,NOPKGS,[DESCRIPTION],GOODSNAME,");
|
|
|
strSql.Append("GROSSWEIGHT,MEASUREMENT,PKGS,KINDPKGS,KGS,CBM,TOTALNO,CNTRNO,CNTR1,CNTR2,CNTR3,CNTR4,CNTR5,CNTR6,CNTR7,CNTR8,CNTR9,CNTR10,OTCNTR,");
|
|
|
strSql.Append("TEU,CNTRTOTAL,INPUTBY,OP,CUSTSERVICE,FRCUSTSERVICE,LANE,SALE,CARRIER,FORWARDER,CUSTOMSER,TRUCKER,INVNO,CARGOID,DCLASS,DUNNO,DPAGE,DLABEL,LINKMAN,");
|
|
|
strSql.Append("REEFERF,TEMPID,TEMPSET,TEMPMAX,TEMPMIN,HUMIDITY,BSSOURCE,BSSOURCEDETAIL,CUSTOMSNUM,CONTRACTNO,INSURANCEER,INSURANCENO,INAMOUT,ISVOU,VOUNO,REMARK,STATUS1,");
|
|
|
strSql.Append("STATUS2,STATUS3,STATUS4,STATUS5,ISFUMIGATION,ISSTORAGE,ISLAND,ISCUSTOMS,ISINSPECTION,ISBOOKING,ISAGENT,ISHBLNO,SERVICE9,SERVICE10,DOC,PACKINGTYPE,");
|
|
|
strSql.Append("WAREHOUSE,CLOSEDOCDATE,INTOPORTDATE,CORPID,SALEDEPT,MBLFRT,CREATETIME,STLNAME,dbo.trimdate(STLDATE) STLDATE,OPERATORCODE,OPERATOR,OPERATOREMAIL,OPERATORTEL,OPERATORFAX,");
|
|
|
strSql.Append("FINANCIALSTAFFCODE,FINANCIALSTAFF,FINANCIALSTAFFEMAIL,FINANCIALSTAFFTEL,FINANCIALSTAFFFAX,PLACERECEIPTID,SOURCECODE,ISCONTAINERSOC,VESSELID,ISSUEPLACEID,HSCODE");
|
|
|
strSql.Append(",TRANSTATUS,EDIREMARK,SERVICECONTRACTNO,(CASE BSSTATUS WHEN 1 THEN '锁定' else '未锁定' end) as BSSTATUSREF ");
|
|
|
strSql.Append(",(CASE FEESTATUS WHEN 1 THEN '锁定' else '未锁定' end) as FEESTATUSREF,TRANSPORT ");
|
|
|
strSql.Append(",(SELECT TOP 1 STATUS FROM V_OP_STATUS WITH (NOLOCK) WHERE BSNO=OP_SEAE.BSNO ORDER BY COMPTIME DESC,INPUTTIME DESC) as OPSTATUS");
|
|
|
strSql.Append(",(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=97018 and EnumValueID=OP_SEAE.MANIFESTSTATUS) as MANIFESTSTATUSREF");
|
|
|
strSql.Append(",CUSTOMNO,ENTERPID,ENTERP,INSPECTIONNO,INSPECTIONDATE,CUSTOMDATE,CLEARCUSTOMDATE,ISMOREGOOD,TERMSDELIVERY,INSPECTSERVICE,TRADETERM,0 FENPIAO,ISGAIQIAN,WARNCOUNT");
|
|
|
|
|
|
strSql.Append(",dbo.F_GetBillDrFeeStatus(OP_SEAE.BSNO) DRFEESTATUS");
|
|
|
strSql.Append(",dbo.F_GetBillCrFeeStatus(OP_SEAE.BSNO) CRFEESTATUS,ISPRINTPR,MAILPROJECT");
|
|
|
|
|
|
strSql.Append(",(SELECT COUNT(*) FROM OP_AMEND WHERE PARENTID=OP_SEAE.BSNO) as AMENDCOUNT,SHIPAGENCY ");
|
|
|
strSql.Append(",I.TTLDR,I.TTLINVDR,I.TTLDUIDR,I.TTLCR,I.TTLINVCR,I.TTLDUICR,I.YJCR,I.HYFDR,I.HYFCR,I.BGFDR,case ETD when '' then 0 else case when I.TTLBALDR<>0 then DATEDIFF([day],CASE WHEN STLDATE IS NULL THEN ETD ELSE STLDATE END,GETDATE()) ");
|
|
|
strSql.Append(" else 0 end end AS NODAY");
|
|
|
strSql.Append(",(SELECT COUNT(*) FROM OP_APPLY WHERE MASTERNO=OP_SEAE.BSNO) as APPLYCOUNT ");
|
|
|
|
|
|
|
|
|
strSql.Append(",(SELECT TOP 1 BLSTATUS FROM op_blissue WHERE BSNO=OP_SEAE.BSNO) BLISSUESTATUS,ISCANCEL,ISTUI,TRANSREMARK,PRERECORD ");
|
|
|
|
|
|
strSql.Append(",MSHIPPERID,MCONSIGNEEID,MNOTIFYPARTYID,MSHIPPER,MCONSIGNEE,MNOTIFYPARTY,ATD,DELIVERYDATE,YARDATTN,YARDTEL,BillFeeStatus,SALECORPID,'' MDESCRIPTION ");
|
|
|
strSql.Append(",(select [NAME] from [company] where GID=OP_SEAE.SALECORPID) as SALECORP,(select TOP 1 COLOR FROM code_op_status_detail WITH (NOLOCK) WHERE OPSTATUS = (CASE WHEN (SELECT TOP 1 [STATUS] FROM V_OP_STATUS WHERE BSNO=OP_SEAE.BSNO ORDER BY COMPTIME DESC,INPUTTIME DESC) is null THEN '接受委托' else (SELECT TOP 1[STATUS] FROM V_OP_STATUS WHERE BSNO = OP_SEAE.BSNO ORDER BY COMPTIME DESC, INPUTTIME DESC) end))AS COLOR");
|
|
|
strSql.Append(" ,V.CUSTOMSSTATUS,V.PORTSTATUS,V.EXPSTATUS,V.TRUCKCTNSTATUS,V.CTNRETURNSTATUS,V.HGYDSTATUS,TRUCKSTATUS,V.ATASTATUS,V.STCSSTATUS,V.RCVESTATUS ,EDI_TIME,VGM_TIME ");
|
|
|
strSql.Append(",STUFF((SELECT ',' + CNTRNO FROM op_ctn ctn WHERE ctn.BSNO = op_seae.BSNO FOR xml path('')),1, 1, '') AS CNTRNOALL ");
|
|
|
strSql.Append(",STUFF((SELECT ',' + SEALNO FROM op_ctn ctn WHERE ctn.BSNO = op_seae.BSNO FOR xml path('')),1, 1, '') AS SEALNOALL ");
|
|
|
|
|
|
strSql.Append(",(select top 1 ORDNO from crm_seaeorder where bsno=OP_SEAE.BSNO ) ORDNO");
|
|
|
strSql.Append(",(select top 1 CUSTOMERNAME from crm_seaeorder_fen where MASTERNO = OP_SEAE.BSNO order by ordno) FEN_CUSTOMERNAME");
|
|
|
strSql.Append(",ISEI");
|
|
|
strSql.Append(" from OP_SEAE ");
|
|
|
strSql.Append(" LEFT JOIN v_op_gain_bs I ON (I.BSNO=OP_SEAE.BSNO) ");
|
|
|
|
|
|
strSql.Append(" left join (select bsno, sum(case when[status] = '海关放行' then 1 else 0 end) CUSTOMSSTATUS, sum(case when [status] = '运抵报告' then 1 else 0 end) HGYDSTATUS , sum(case when[status] = '码头放行' then 1 else 0 end) PORTSTATUS");
|
|
|
strSql.Append(", sum(case when[status] = '装船出运' then 1 else 0 end) EXPSTATUS, sum(case when [status] = '空箱出场' then 1 else case when [status] = '部分空出' then 2 else 0 end end) TRUCKCTNSTATUS");
|
|
|
strSql.Append(", sum(case when[status] = '到港' then 1 else 0 end) ATASTATUS, sum(case when [status] = '目的港提箱' then 1 else case when [status] = '部分目的港提箱' then 2 else 0 end end) STCSSTATUS ");
|
|
|
strSql.Append(", sum(case when [status] = '目的港返空' then 1 else case when [status] = '部分目的港返空' then 2 else 0 end end) RCVESTATUS ");
|
|
|
strSql.Append(", sum(case when[status] = '重箱返场' then 1 else case when [status] = '部分重返' then 2 else 0 end end) CTNRETURNSTATUS from op_status WITH (NOLOCK) GROUP BY BSNO) as v on(v.bsno = OP_SEAE.BSNO) ");
|
|
|
|
|
|
if (!string.IsNullOrEmpty(strCondition))
|
|
|
{
|
|
|
strSql.Append(" where MASTERNO=OP_SEAE.BSNO AND EXISTS ( select 1 from OP_SEAE B WHERE OP_SEAE.BSNO=B.MASTERNO AND " + strCondition + " )");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strSql.Append(" where MASTERNO=OP_SEAE.BSNO ");
|
|
|
|
|
|
}
|
|
|
strSql.Append(@")as t ");
|
|
|
strSql.Append(string.Format("where t.num>{0} and t.num<={1} order by t.num ", start, start + limit)); //
|
|
|
|
|
|
return SetData(strSql, isNoForward);
|
|
|
}
|
|
|
|
|
|
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.IndexOf("6:") > -1)
|
|
|
{
|
|
|
return "驳回提交";
|
|
|
}
|
|
|
else if (feestatusint.IndexOf("7:") > -1)
|
|
|
{
|
|
|
return "驳回申请";
|
|
|
}
|
|
|
else if (feestatusint.IndexOf("1:") > -1)
|
|
|
{
|
|
|
return "部分录入";
|
|
|
}
|
|
|
else if (feestatusint.IndexOf("2:") > -1)
|
|
|
{
|
|
|
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 "部分提交";
|
|
|
}
|
|
|
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
|
|
|
static public List<MsOpSeaeSum> GetDataListSum ( string strCondition, string userid, string usercode, string companyid, string sort = null,bool norang=false )
|
|
|
{
|
|
|
if (!norang)
|
|
|
{
|
|
|
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 Count(B.BSNO) as NOBILL,");
|
|
|
strSql.Append("sum(B.PKGS) as PKGS,sum(B.KGS) as KGS,sum(B.CBM) as CBM,sum(B.CNTR1) as CNTR1,sum(B.CNTR2) as CNTR2,sum(B.CNTR3) as CNTR3");
|
|
|
strSql.Append(",sum(B.CNTR4) as CNTR4,sum(B.CNTR5) as CNTR5,sum(B.CNTR6) as CNTR6,sum(B.CNTR7) as CNTR7");
|
|
|
strSql.Append(",sum(B.CNTR8) as CNTR8,sum(B.CNTR9) as CNTR9,sum(B.CNTR10) as CNTR10,sum(B.OTCNTR) as OTCNTR, sum(TEU) as TEU");
|
|
|
strSql.Append(" from OP_SEAE B ");
|
|
|
if (!string.IsNullOrEmpty(strCondition))
|
|
|
{
|
|
|
strSql.Append(" where " + strCondition);
|
|
|
}
|
|
|
|
|
|
return SetDataSum(strSql);
|
|
|
}
|
|
|
|
|
|
static public List<MsOpSeaeSum> GetSaleDataListSum ( string strCondition, string usercode, string sort = null )
|
|
|
{
|
|
|
|
|
|
//
|
|
|
var strSql = new StringBuilder();
|
|
|
strSql.Append("SELECT Count(B.BSNO) as NOBILL,");
|
|
|
strSql.Append("sum(B.PKGS) as PKGS,sum(B.KGS) as KGS,sum(B.CBM) as CBM,sum(B.CNTR1) as CNTR1,sum(B.CNTR2) as CNTR2,sum(B.CNTR3) as CNTR3");
|
|
|
strSql.Append(",sum(B.CNTR4) as CNTR4,sum(B.CNTR5) as CNTR5,sum(B.CNTR6) as CNTR6,sum(B.CNTR7) as CNTR7");
|
|
|
strSql.Append(",sum(B.CNTR8) as CNTR8,sum(B.CNTR9) as CNTR9,sum(B.CNTR10) as CNTR10,sum(B.OTCNTR) as OTCNTR, sum(TEU) as TEU");
|
|
|
strSql.Append(" from OP_SEAE B ");
|
|
|
if (!string.IsNullOrEmpty(strCondition))
|
|
|
{
|
|
|
strSql.Append(" where B.SALE='" + usercode + "' AND " + strCondition);
|
|
|
}
|
|
|
|
|
|
return SetDataSum(strSql);
|
|
|
}
|
|
|
|
|
|
|
|
|
private static List<MsOpSeaeSum> SetDataSum ( StringBuilder strSql )
|
|
|
{
|
|
|
var headList = new List<MsOpSeaeSum>();
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
|
|
|
{
|
|
|
while (reader.Read())
|
|
|
{
|
|
|
MsOpSeaeSum data = new MsOpSeaeSum();
|
|
|
#region Set DB data to Object
|
|
|
|
|
|
data.NOBILL = Convert.ToInt32(reader["NOBILL"]);//票数
|
|
|
if (reader["CNTR1"] != DBNull.Value)
|
|
|
data.CNTR1 = Convert.ToInt32(reader["CNTR1"]);//箱型1
|
|
|
if (reader["CNTR2"] != DBNull.Value)
|
|
|
data.CNTR2 = Convert.ToInt32(reader["CNTR2"]);//箱型2
|
|
|
if (reader["CNTR3"] != DBNull.Value)
|
|
|
data.CNTR3 = Convert.ToInt32(reader["CNTR3"]);//箱型3
|
|
|
if (reader["CNTR4"] != DBNull.Value)
|
|
|
data.CNTR4 = Convert.ToInt32(reader["CNTR4"]);//箱型4
|
|
|
if (reader["CNTR5"] != DBNull.Value)
|
|
|
data.CNTR5 = Convert.ToInt32(reader["CNTR5"]);//箱型5
|
|
|
if (reader["CNTR6"] != DBNull.Value)
|
|
|
data.CNTR6 = Convert.ToInt32(reader["CNTR6"]);//箱型6
|
|
|
if (reader["CNTR7"] != DBNull.Value)
|
|
|
data.CNTR7 = Convert.ToInt32(reader["CNTR7"]);//箱型7
|
|
|
if (reader["CNTR8"] != DBNull.Value)
|
|
|
data.CNTR8 = Convert.ToInt32(reader["CNTR8"]);//箱型8
|
|
|
if (reader["CNTR9"] != DBNull.Value)
|
|
|
data.CNTR9 = Convert.ToInt32(reader["CNTR9"]);//箱型9
|
|
|
if (reader["CNTR10"] != DBNull.Value)
|
|
|
data.CNTR10 = Convert.ToInt32(reader["CNTR10"]);//箱型10
|
|
|
if (reader["OTCNTR"] != DBNull.Value)
|
|
|
data.OTCNTR = Convert.ToInt32(reader["OTCNTR"]);//其他箱型
|
|
|
if (reader["TEU"] != DBNull.Value)
|
|
|
data.TEU = Convert.ToInt32(reader["TEU"]);//箱TEU
|
|
|
if (reader["KGS"] != DBNull.Value)
|
|
|
data.KGS = Convert.ToDecimal(reader["KGS"]);//毛重
|
|
|
if (reader["PKGS"] != DBNull.Value)
|
|
|
data.PKGS = Convert.ToInt32(reader["PKGS"]);//件数
|
|
|
if (reader["CBM"] != DBNull.Value)
|
|
|
data.CBM = Convert.ToDecimal(reader["CBM"]);//立方数/尺码
|
|
|
|
|
|
#endregion
|
|
|
headList.Add(data);
|
|
|
}
|
|
|
reader.Close();
|
|
|
}
|
|
|
return headList;
|
|
|
}
|
|
|
|
|
|
#region 保存
|
|
|
public static DBResult DoSave(string opstatus, MsOpSeae headData, List<MsOpSeaeDetail> bodyList,string userid,string username,string companyid,string companyname)
|
|
|
{
|
|
|
|
|
|
var result = new DBResult();
|
|
|
|
|
|
var cdc = new CommonDataContext();
|
|
|
var _sale = cdc.VW_user.FirstOrDefault(x => x.SHOWNAME == headData.SALE);
|
|
|
|
|
|
headData.SALECORPID = _sale.COMPANYID;
|
|
|
|
|
|
var isPost = true;
|
|
|
var errorstr = "";
|
|
|
var isuse = false;
|
|
|
var iscreatecustno = false;
|
|
|
var custno = "";
|
|
|
var billnoset = MsSysBillNoSetDAL.GetData("OPLBNAME='海运出口' AND RULEBLNO='委托编号' ", _sale.COMPANYID);
|
|
|
if (billnoset.BILLTYPE != "")
|
|
|
isuse = true;
|
|
|
else
|
|
|
isuse = MsBaseInfoDAL.MsBaseInfoDAL.GetRuleUse("委托编号", "1");
|
|
|
if (headData.CUSTNO.Trim() == "" || headData.CUSTNO == null)
|
|
|
{
|
|
|
if (isuse)
|
|
|
{
|
|
|
var FENCUSTNOE = MsSysParamSetDAL.GetData("PARAMNAME='FENCUSTNOE'");
|
|
|
if (FENCUSTNOE.PARAMVALUE == "1" && headData.MASTERNO != "" && headData.BSNO != headData.MASTERNO)
|
|
|
{
|
|
|
headData.CUSTNO = MsSysBillNoSetDAL.GetFenCustNo(headData.MASTERNO, "op_seae");
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
|
|
|
if (billnoset.BILLTYPE != "")
|
|
|
{
|
|
|
var CUSTOMHEAD = "";
|
|
|
if (billnoset.CUSTOMHEAD != "")
|
|
|
{
|
|
|
var HBLCUSTOMHEAD = billnoset.CUSTOMHEAD;
|
|
|
if ((HBLCUSTOMHEAD.IndexOf("[SALE]") >= 0) && !string.IsNullOrEmpty(headData.SALE))
|
|
|
{
|
|
|
var user = SysUserDAL.GetData("u.SHOWNAME='" + headData.SALE + "'");
|
|
|
if (!string.IsNullOrEmpty(user.NOCODE))
|
|
|
HBLCUSTOMHEAD = HBLCUSTOMHEAD.Replace("[SALE]", user.NOCODE);
|
|
|
|
|
|
}
|
|
|
if ((HBLCUSTOMHEAD.IndexOf("[OP]") >= 0) && !string.IsNullOrEmpty(headData.OP))
|
|
|
{
|
|
|
var user = SysUserDAL.GetData("u.SHOWNAME='" + headData.OP + "'");
|
|
|
if (!string.IsNullOrEmpty(user.NOCODE))
|
|
|
HBLCUSTOMHEAD = HBLCUSTOMHEAD.Replace("[OP]", user.NOCODE);
|
|
|
}
|
|
|
CUSTOMHEAD = HBLCUSTOMHEAD;
|
|
|
var CUST = MsInfoClientDAL.GetData("SHORTNAME='" + headData.CUSTOMERNAME + "'");
|
|
|
CUSTOMHEAD = CUSTOMHEAD.Replace("[CUSTCODE]", CUST.CODENAME);
|
|
|
}
|
|
|
|
|
|
|
|
|
custno = MsSysBillNoSetDAL.GetBillNo(billnoset, headData.ETD.ToString().Trim(), headData.ACCDATE.ToString().Trim(), "", headData.OP, headData.SALECORPID, CUSTOMHEAD);
|
|
|
}
|
|
|
else
|
|
|
custno = MsOpSeaeDAL.getCodeRule("委托编号", "CUSTNO", headData.BSDATE.ToString().Trim(), headData.ACCDATE.ToString().Trim(),userid,companyid);
|
|
|
iscreatecustno = true;
|
|
|
headData.CUSTNO = custno;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
var ct = MsOpSeaeDAL.GetRdCount("BSNO<>'" + headData.BSNO + "' AND CUSTNO='" + headData.CUSTNO + "' and CORPID='" + companyid + "' ");
|
|
|
if (ct != 0)
|
|
|
{
|
|
|
isPost = false;
|
|
|
errorstr = "委托编号" + headData.CUSTNO + "重复";
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (headData.CORPID == "" || headData.CORPID == null)
|
|
|
{
|
|
|
headData.CORPID =companyid;
|
|
|
}
|
|
|
if (headData.CUSTNO == "")
|
|
|
{
|
|
|
isPost = false;
|
|
|
errorstr = "委托编号为空";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
/*
|
|
|
var At = MsOpSeaeDAL.GetRdCount("MASTERNO<>'" + headData.BSNO + "' AND CUSTNO='" + headData.CUSTNO + "' and CORPID='" + Convert.ToString(Session["COMPANYID"]) + "'");
|
|
|
if (At != 0)
|
|
|
{
|
|
|
isPost = false;
|
|
|
errorstr = "委托编号<" + headData.CUSTNO + ">重复";
|
|
|
}
|
|
|
* */
|
|
|
}
|
|
|
T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
|
|
|
var mblreapeat = MsSysParamSetDAL.GetData("PARAMNAME='SeaeMblrepeat'");
|
|
|
|
|
|
if (mblreapeat.PARAMVALUE != "1" && headData.MBLNO != "" && headData.MBLNO != null && headData.BLTYPE != "拼箱分票")
|
|
|
{
|
|
|
|
|
|
var OPLISTNOCANCEL = MsSysParamSetDAL.GetData("PARAMNAME='OPLISTNOCANCEL'").PARAMVALUE;
|
|
|
if (OPLISTNOCANCEL == "1")
|
|
|
{
|
|
|
var condition = "BSNO<>'" + headData.BSNO + "' AND ISCANCEL<>'1' AND MBLNO='" + headData.MBLNO + "' and CORPID='" + companyid + "' ";
|
|
|
var ct = MsOpSeaeDAL.GetRdCount(condition);
|
|
|
if (ct != 0)
|
|
|
{
|
|
|
isPost = false;
|
|
|
var 重复记录 = MsOpSeaeDAL.GetData(condition);
|
|
|
errorstr = $"船东单号重复,订单号【{重复记录.ORDNO}】,操作【{重复记录.OP}】,销售【{重复记录.SALE}】;";
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
var condition = "BSNO<>'" + headData.BSNO + "' AND MBLNO='" + headData.MBLNO + "' and CORPID='" + companyid + "' ";
|
|
|
var ct = MsOpSeaeDAL.GetRdCount(condition);
|
|
|
if (ct != 0)
|
|
|
{
|
|
|
isPost = false;
|
|
|
var 重复记录 = MsOpSeaeDAL.GetData(condition);
|
|
|
errorstr = $"船东单号重复,订单号【{重复记录.ORDNO}】,操作【{重复记录.OP}】,销售【{重复记录.SALE}】;";
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (headData.HBLNO.Trim() == "" || headData.HBLNO == null)
|
|
|
{
|
|
|
var billnosethblno = MsSysBillNoSetDAL.GetData("OPLBNAME='海运出口' AND RULEBLNO='分提单号' ", companyid);
|
|
|
if (billnosethblno.BILLTYPE != "" && billnosethblno.ISAUTO == "1")
|
|
|
{
|
|
|
if (billnosethblno.CUSTOMHEAD != "")
|
|
|
{
|
|
|
var HBLCUSTOMHEAD = billnosethblno.CUSTOMHEAD;
|
|
|
var bssource = BasicDataRefDAL.GetSourceData("SOURCENAME='" + headData.BSSOURCE + "'");
|
|
|
var lanelist = BasicDataRefDAL.GetCodeLaneList();
|
|
|
var lane = lanelist.Find(x => x.LANE == headData.LANE);
|
|
|
var bstypelist = PubSysDAL.GetEnumValueList(97042, "");
|
|
|
var bstype = bstypelist.Find(x => x.EnumValueName == headData.BLTYPE);
|
|
|
HBLCUSTOMHEAD = HBLCUSTOMHEAD.Replace("[BS]", bssource.SOURCECODE);
|
|
|
if (lane != null)
|
|
|
HBLCUSTOMHEAD = HBLCUSTOMHEAD.Replace("[LN]", lane.LANEID);
|
|
|
if (bstype != null)
|
|
|
HBLCUSTOMHEAD = HBLCUSTOMHEAD.Replace("[BT]", bstype.EnumValueName_2);
|
|
|
// HBLCUSTOMHEAD = HBLCUSTOMHEAD.Replace("[BS]", bssource.SOURCECODE);
|
|
|
// HBLCUSTOMHEAD = HBLCUSTOMHEAD.Replace("[BS]", bssource.SOURCECODE);
|
|
|
|
|
|
var hblno = MsSysBillNoSetDAL.GetBillNoHblno(billnosethblno, headData.ETD.ToString().Trim(), headData.ACCDATE.ToString().Trim(), HBLCUSTOMHEAD);
|
|
|
headData.HBLNO = hblno;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
var hblno = MsSysBillNoSetDAL.GetBillNo(billnosethblno, headData.ETD.ToString().Trim(), headData.ACCDATE.ToString().Trim(), "", headData.OP, headData.SALECORPID);
|
|
|
headData.HBLNO = hblno;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
|
|
|
var hblreapeat = MsSysParamSetDAL.GetData("PARAMNAME='SeaeHblrepeat'");
|
|
|
if (hblreapeat.PARAMVALUE != "1" && headData.HBLNO != "" && headData.HBLNO != null)
|
|
|
{
|
|
|
var ct = MsOpSeaeDAL.GetRdCount("BSNO<>'" + headData.BSNO + "' AND HBLNO='" + headData.HBLNO + "' and CORPID='" + companyid + "'");
|
|
|
if (ct != 0)
|
|
|
{
|
|
|
isPost = false;
|
|
|
errorstr = "货代单号重复";
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(headData.ORDERNO))
|
|
|
{
|
|
|
var condition = "ORDERNO like '%" + headData.ORDERNO + "%' AND BSNO<>'" + headData.BSNO + "' and ISCANCEL='0' ";
|
|
|
var ct = MsOpSeaeDAL.GetRdCount(condition);
|
|
|
if (ct != 0)
|
|
|
{
|
|
|
isPost = false;
|
|
|
var BC重复的记录 = MsOpSeaeDAL.GetData(condition);
|
|
|
errorstr += $"BC号重复,订单号【{BC重复的记录.ORDNO}】,操作【{BC重复的记录.OP}】,销售【{BC重复的记录.SALE}】;";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//if (headData.ORDERNO != "" && headData.ORDERNO != null)
|
|
|
//{
|
|
|
// var ct = MsOpSeaeDAL.GetRdCount("BSNO<>'" + headData.BSNO + "' AND ORDERNO='" + headData.ORDERNO + "' and CORPID='" + Convert.ToString(Session["COMPANYID"]) + "'");
|
|
|
// if (ct != 0)
|
|
|
// {
|
|
|
// isPost = false;
|
|
|
// errorstr = "订舱编号";
|
|
|
// }
|
|
|
//}
|
|
|
|
|
|
if (headData.ETD != "" && headData.CUSTOMERNAME != "")// headData.STLDATE == "" &&
|
|
|
{
|
|
|
//根据客户、开船日计算账期
|
|
|
|
|
|
var _dmb = MsInfoClientDAL.GetSTLDATE(headData.CUSTOMERNAME, "海运出口", headData.ETD, headData.SALE);
|
|
|
headData.STLNAME = _dmb.STLNAME;
|
|
|
headData.STLDATE = _dmb.STLDATE;
|
|
|
|
|
|
if (_dmb.STLNAME == "")
|
|
|
{
|
|
|
headData.STLNAME = "现结买单";
|
|
|
headData.STLDATE = headData.ETD;
|
|
|
}
|
|
|
if (_dmb.BSSOURCE != "") headData.BSSOURCE = _dmb.BSSOURCE;
|
|
|
}
|
|
|
var nowperiod = ChMonthCloseDAL.ChMonthCloseDAL.GetData("",companyid);
|
|
|
if (opstatus == "add")
|
|
|
{
|
|
|
headData.INPUTBY =username;
|
|
|
headData.CREATETIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
headData.BSSTATUS = false;
|
|
|
headData.FEESTATUS = false;
|
|
|
headData.DbOperationType = DbOperationType.DbotIns;
|
|
|
headData.ISCANCEL = "0";
|
|
|
|
|
|
if (Convert.ToDateTime(nowperiod.PERIOD + "-01") > Convert.ToDateTime(headData.ACCDATE + "-01"))
|
|
|
{
|
|
|
|
|
|
result.Success = false;
|
|
|
result.Message = "已月末结转,不允许添加业务!";
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
else if (opstatus == "edit")
|
|
|
{
|
|
|
headData.DbOperationType = DbOperationType.DbotUpd;
|
|
|
headData.ModelUIStatus = "E";
|
|
|
if (Convert.ToDateTime(nowperiod.PERIOD + "-01") > Convert.ToDateTime(headData.ACCDATE + "-01"))
|
|
|
{
|
|
|
|
|
|
var ACCDATE = T_ALL_DA.GetStrSQL("ACCDATE", "select ACCDATE from v_op_bill WHERE BSNO='" + headData.BSNO + "'");
|
|
|
if (ACCDATE != headData.ACCDATE)
|
|
|
{
|
|
|
result.Success = false;
|
|
|
result.Message = "已月末结转,不允许修改会计期间!";
|
|
|
|
|
|
return result;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
headData.DbOperationType = DbOperationType.DbotDel;
|
|
|
}
|
|
|
if (headData.MASTERNO == null || headData.MASTERNO == "") { headData.MASTERNO = headData.BSNO; }
|
|
|
headData.BSDATE = DateTime.Now;
|
|
|
|
|
|
if (headData.ETA == "") headData.ETA = null;
|
|
|
if (headData.ETD == "") headData.ETD = null;
|
|
|
if (headData.ETD2 == "") headData.ETD2 = null;
|
|
|
if (headData.STLDATE == "") headData.STLDATE = null;
|
|
|
if (headData.ATD == "") headData.ATD = null;
|
|
|
if (headData.DELIVERYDATE == "") headData.DELIVERYDATE = null;
|
|
|
|
|
|
if (headData.ISSUEDATE == "" || (Convert.ToDateTime(headData.ISSUEDATE) < Convert.ToDateTime("2010-01-01"))) headData.ISSUEDATE = null;
|
|
|
if (headData.CLOSINGDATE == "") headData.CLOSINGDATE = null;
|
|
|
if (headData.CLOSEDOCDATE == "") headData.CLOSEDOCDATE = null;
|
|
|
if (headData.INSPECTIONDATE == "") headData.INSPECTIONDATE = null;
|
|
|
if (headData.CUSTOMDATE == "") headData.CUSTOMDATE = null;
|
|
|
if (headData.CLEARCUSTOMDATE == "") headData.CLEARCUSTOMDATE = null;
|
|
|
if (headData.FINANCIALSTAFFTEL == "") headData.FINANCIALSTAFFTEL = null;
|
|
|
if (!string.IsNullOrEmpty(headData.ETD) && !string.IsNullOrEmpty(headData.CLOSINGDATE))
|
|
|
{
|
|
|
if (Convert.ToDateTime(headData.ETD + " 23:59:59") < Convert.ToDateTime(headData.CLOSINGDATE))
|
|
|
{
|
|
|
isPost = false;
|
|
|
errorstr = "截港日期不允许小于开船日期";
|
|
|
|
|
|
}
|
|
|
}
|
|
|
if (!string.IsNullOrEmpty(headData.ETD) && !string.IsNullOrEmpty(headData.CLOSEDOCDATE))
|
|
|
{
|
|
|
if (Convert.ToDateTime(headData.ETD + " 23:59:59") < Convert.ToDateTime(headData.CLOSEDOCDATE))
|
|
|
{
|
|
|
isPost = false;
|
|
|
errorstr = "截单日期不允许小于开船日期";
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
headData.BSSOURCE = headData.BSSOURCE.Trim();
|
|
|
|
|
|
headData.MBLNO = headData.MBLNO.Trim();
|
|
|
headData.SHIPPER = FullWidthToHalfWidth(ToDBC(headData.SHIPPER));
|
|
|
headData.SHIPPER = DelEndSpace(headData.SHIPPER);
|
|
|
headData.CONSIGNEE = FullWidthToHalfWidth(ToDBC(headData.CONSIGNEE));
|
|
|
headData.CONSIGNEE = DelEndSpace(headData.CONSIGNEE);
|
|
|
headData.NOTIFYPARTY = FullWidthToHalfWidth(ToDBC(headData.NOTIFYPARTY));
|
|
|
headData.NOTIFYPARTY = DelEndSpace(headData.NOTIFYPARTY);
|
|
|
//headData.MSHIPPER = ToDBC(headData.MSHIPPER);
|
|
|
//headData.MSHIPPER = DelEndSpace(headData.MSHIPPER);
|
|
|
//headData.MCONSIGNEE = ToDBC(headData.MCONSIGNEE);
|
|
|
//headData.MCONSIGNEE = DelEndSpace(headData.MCONSIGNEE);
|
|
|
//headData.MNOTIFYPARTY = ToDBC(headData.MNOTIFYPARTY);
|
|
|
//headData.MNOTIFYPARTY = DelEndSpace(headData.MNOTIFYPARTY);
|
|
|
headData.MARKS = FullWidthToHalfWidth(ToDBC(headData.MARKS));
|
|
|
headData.DESCRIPTION = FullWidthToHalfWidth(ToDBC(headData.DESCRIPTION));
|
|
|
if (headData.KGS == "") headData.KGS = "0";
|
|
|
if (headData.PKGS == "") headData.PKGS = "0";
|
|
|
if (headData.CBM == "") headData.CBM = "0";
|
|
|
headData.SALE = headData.SALE.Trim();
|
|
|
headData.CUSTSERVICE = headData.CUSTSERVICE.Trim();
|
|
|
headData.DOC = headData.DOC.Trim();
|
|
|
headData.FRCUSTSERVICE = headData.FRCUSTSERVICE.Trim();
|
|
|
|
|
|
// headData.VESSEL = MsBaseInfoDAL.DelPortCn(headData.VESSEL);
|
|
|
//headData.PORTLOAD = MsBaseInfoDAL.DelPortCn(headData.PORTLOAD);
|
|
|
//headData.PORTDISCHARGE = MsBaseInfoDAL.DelPortCn(headData.PORTDISCHARGE);
|
|
|
//headData.PLACERECEIPT = MsBaseInfoDAL.DelPortCn(headData.PLACERECEIPT);
|
|
|
//headData.PORTDISCHARGE = MsBaseInfoDAL.DelPortCn(headData.PORTDISCHARGE);
|
|
|
//headData.DESTINATION = MsBaseInfoDAL.DelPortCn(headData.DESTINATION);
|
|
|
|
|
|
//if (headData.BLTYPE=="拼箱分票" || headData.BLTYPE=="拼箱单票")
|
|
|
// headData.CNTRTOTAL = headData.PKGS.ToString() + headData.KINDPKGS + "/" + headData.KGS.ToString()+ "KGS/" + headData.CBM.ToString()+ "CBM";
|
|
|
if (headData.BLTYPE == "拼箱分票" && headData.MASTERNO != headData.BSNO)
|
|
|
{
|
|
|
decimal Mpkgs = 0;
|
|
|
decimal Mkgs = 0;
|
|
|
decimal Mcbm = 0;
|
|
|
var Fpkgs = Convert.ToInt32(headData.PKGS);
|
|
|
decimal Fkgs = Convert.ToDecimal(headData.KGS);
|
|
|
decimal Fcbm = Convert.ToDecimal(headData.CBM);
|
|
|
|
|
|
var MSeaeList = MsOpSeaeDAL.GetFenList("BSNO='" + headData.MASTERNO + "'",userid,username, companyid);
|
|
|
if (MSeaeList.Count != 0)
|
|
|
{
|
|
|
var MSeae = MSeaeList[0];
|
|
|
Mpkgs = Convert.ToInt32(MSeae.PKGS);
|
|
|
Mkgs = Convert.ToDecimal(MSeae.KGS);
|
|
|
Mcbm = Convert.ToDecimal(MSeae.CBM);
|
|
|
}
|
|
|
|
|
|
var FenSumList = MsOpSeaeDAL.GetDataListSum("MASTERNO='" + headData.MASTERNO + "' AND BSNO<>MASTERNO AND BSNO<>'" + headData.BSNO + "'",userid,username,companyid, null, true);
|
|
|
if (FenSumList.Count != 0)
|
|
|
{
|
|
|
var FSeae = FenSumList[0];
|
|
|
Fpkgs = Fpkgs + Convert.ToInt32(FSeae.PKGS);
|
|
|
Fkgs = Fkgs + Convert.ToDecimal(FSeae.KGS);
|
|
|
Fcbm = Fcbm + Convert.ToDecimal(FSeae.CBM);
|
|
|
}
|
|
|
if (Fpkgs > Mpkgs || Fkgs > Mkgs || Fcbm > Mcbm)
|
|
|
{
|
|
|
isPost = false;
|
|
|
errorstr = "分票合计件重尺不能大于主票的件重尺";
|
|
|
}
|
|
|
|
|
|
}
|
|
|
if (headData.BLTYPE != "拼箱主票" && headData.BLTYPE != "合票主票" && headData.BLTYPE != "整箱")
|
|
|
{
|
|
|
var ct = MsOpSeaeDAL.GetRdCount("BSNO<>'" + headData.BSNO + "' AND MASTERNO='" + headData.BSNO + "' and CORPID='" + companyid+ "'");
|
|
|
if (ct != 0)
|
|
|
{
|
|
|
isPost = false;
|
|
|
errorstr = "此票下有分票信息,装运方式必须为拼箱主票和合票主票";
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
var BSNO = headData.BSNO;
|
|
|
|
|
|
#region 判断字段长度
|
|
|
if (isPost)
|
|
|
{
|
|
|
var seaefield = MsSoftSysTableDAL.GetDefTableDetailList("OP_SEAE");
|
|
|
foreach (var enumValue in seaefield)
|
|
|
{
|
|
|
if (enumValue.FIELDNAME == "MBLNO" && headData.MBLNO.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "主提单号超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "HBLNO" && headData.HBLNO.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "分提单号超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "CUSTNO" && headData.CUSTNO.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "委托编号超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "ORDERNO" && headData.ORDERNO.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "订舱编号超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "SHIPPERID" && headData.SHIPPERID.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "发货人代码超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "CONSIGNEEID" && headData.CONSIGNEEID.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "收货人代码超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "NOTIFYPARTYID" && headData.NOTIFYPARTYID.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "通知人代码超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "SHIPPER" && headData.SHIPPER.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "发货人超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "CONSIGNEE" && headData.CONSIGNEE.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "收货人超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "NOTIFYPARTY" && headData.NOTIFYPARTY.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "通知人超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "AGENTID" && headData.AGENTID.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "代理名称超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "AGENT" && headData.AGENT.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "代理超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "VESSEL" && headData.VESSEL.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "船名超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "VOYNO" && headData.VOYNO.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "航次超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "PlACERECEIPT" && headData.PLACERECEIPT.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "收货地超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "PORTLOADID" && headData.PORTLOADID.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "装货港代码超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "PORTLOAD" && headData.PORTLOAD.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "装货港超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "PORTDISCHARGEID" && headData.PORTDISCHARGEID.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "卸货港代码超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "PORTDISCHARGE" && headData.PORTDISCHARGE.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "卸货港超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "PLACEDELIVERYID" && headData.PLACEDELIVERYID.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "交货地代码超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "PLACEDELIVERY" && headData.PLACEDELIVERY.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "交货地超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "DESTINATIONID" && headData.DESTINATIONID.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "目的地代码超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "DESTINATION" && headData.DESTINATION.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "目的地超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "ISSUEPLACE" && headData.ISSUEPLACE.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "签单地点超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "BLFRT" && headData.BLFRT.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "付费方式超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "PREPARDAT" && headData.PREPARDAT.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "预付地点超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "PAYABLEAT" && headData.PAYABLEAT.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "到付地点超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "SERVICE" && headData.SERVICE.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "运输条款超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "MARKS" && headData.MARKS.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "唛头超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "NOPKGS" && headData.NOPKGS.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "件数包装超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "DESCRIPTION" && headData.DESCRIPTION.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "货物描述超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "GOODSNAME" && headData.GOODSNAME.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "品名超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "KINDPKGS" && headData.KINDPKGS.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "包装超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "LANE" && headData.LANE.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "航线超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "INVNO" && headData.INVNO.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "发票号超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "DCLASS" && headData.DCLASS.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "危险品类别超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "DUNNO" && headData.DUNNO.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "危险品编号超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "REEFERF" && headData.REEFERF.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "冷藏通风量超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "TEMPID" && headData.TEMPID.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "温度单位超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "TEMPSET" && headData.TEMPSET.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "设置温度超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "TEMPMAX" && headData.TEMPMAX.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "最高温度超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "TEMPMIN" && headData.TEMPMIN.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "最低温度超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "CONTRACTNO" && headData.CONTRACTNO.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "运费协议号超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "INSURANCEER" && headData.INSURANCEER.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "保险人超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "INSURANCENO" && headData.INSURANCENO.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "保险单号超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "REMARK" && headData.REMARK.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "备注超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "STLNAME" && headData.STLNAME.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "结算方式超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "EDIREMARK" && headData.EDIREMARK.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "EDI备注超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "MNOTIFYPARTY" && headData.MNOTIFYPARTY.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "主单通知人超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "ENTERP" && headData.ENTERP.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "经营单位超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "SERVICECONTRACTNO" && headData.SERVICECONTRACTNO.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "参考号超长,字段长度限制" + enumValue.FIELDLEN; }//服务合同号
|
|
|
if (enumValue.FIELDNAME == "MNOTIFYPARTYID" && headData.MNOTIFYPARTYID.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "签单地点超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "LINKMAN" && headData.LINKMAN.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "客户联系人超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "INSPECTSERVICE" && headData.INSPECTSERVICE.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "报检项目超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "APPLYNO" && headData.APPLYNO.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "申请放箱号超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "MSHIPPERID" && headData.MSHIPPERID.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "MASTER发货人代码超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "CUSTOMNO" && headData.CUSTOMNO.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "报关单号超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "HSCODE" && headData.HSCODE.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "HS代码超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "INSPECTIONNO" && headData.INSPECTIONNO.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "商检单号超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "MSHIPPER" && headData.MSHIPPER.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "MASTER发货人超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "PLACERECEIPTID" && headData.PLACERECEIPTID.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "收货地代码超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "TRADETERM" && headData.TRADETERM.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "贸易条款超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "VESSELID" && headData.VESSELID.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "船舶呼号超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "DPAGE" && headData.DPAGE.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "危险品页号超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "MCONSIGNEEID" && headData.MCONSIGNEEID.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "MASTER收货人代码超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "MCONSIGNEE" && headData.MCONSIGNEE.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "MASTER收货人超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "ENTERPID" && headData.ENTERPID.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "单位编码超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "HUMIDITY" && headData.HUMIDITY.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "湿度超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "TERMSDELIVERY" && headData.TERMSDELIVERY.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "贸易方式超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "DLABEL" && headData.DLABEL.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "危险品标签超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
}
|
|
|
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
if (isPost)
|
|
|
{
|
|
|
//增加分单对主单的箱信息计算结果
|
|
|
|
|
|
//MsSeaeOrderDAL.SetCtnInfo(ref headData, bodyList);
|
|
|
|
|
|
var modb = new ModelObjectDB();
|
|
|
result = modb.Save(headData);
|
|
|
|
|
|
if (result.Success == true)
|
|
|
{
|
|
|
|
|
|
result = MsOpSeaeDAL.SaveDetail(BSNO, bodyList, userid, true);
|
|
|
|
|
|
if (opstatus == "add")
|
|
|
{
|
|
|
var blUpSQL = " if (select CID from Op_SeaCover where bsno='" + headData.BSNO + "' AND COVERTITLE='接单') is null insert into Op_SeaCover(CID,BSNO,COVERTITLE,COVERCONTEXT,OPERATOR,OPTIME,ISSYS) values(NEWID(),'" + BSNO + "','接单','','" + username + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','1')";
|
|
|
bool bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
|
|
|
}
|
|
|
if (headData.MBLNO != "")
|
|
|
{
|
|
|
var blUpSQL = " if (select CID from Op_SeaCover where bsno='" + headData.BSNO + "' AND COVERTITLE='出号') is null insert into Op_SeaCover(CID,BSNO,COVERTITLE,COVERCONTEXT,OPERATOR,OPTIME,ISSYS) values(NEWID(),'" + BSNO + "','出号','','" +username + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','1')";
|
|
|
bool bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
|
|
|
}
|
|
|
|
|
|
var blUpBL = "update op_seae_billmanage set VESSEL='" + headData.VESSEL + "',VOYNO='" + headData.VOYNO + "',ETD='" + headData.ETD + "',PORTLOADID='" + headData.PORTLOADID + "',PORTLOAD='" + headData.PORTLOAD + "' where BSNO='" + headData.BSNO + "'";
|
|
|
bool blBL = T_ALL_DA.GetExecuteSqlCommand(blUpBL);
|
|
|
|
|
|
|
|
|
//if (headData.APPLYNO!=""&& headData.ETD!=null) {
|
|
|
// var blUpSQL1 = " update op_ctnbscard set ETD='"+headData.ETD+"' where APPLYNO='"+headData.APPLYNO+"' ";
|
|
|
// bool bl1 = T_ALL_DA.GetExecuteSqlCommand(blUpSQL1);
|
|
|
|
|
|
//}
|
|
|
|
|
|
//20191210 如果是网上订舱的业务 写回booking端
|
|
|
if (headData.ORDERTYPE == "网上订舱")
|
|
|
{
|
|
|
BookingConfirmDAL.SavetoBooking(headData,companyname);
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if (iscreatecustno == true)
|
|
|
MsSysBillNoSetDAL.DeleteBsNo(custno);
|
|
|
}
|
|
|
|
|
|
MsOpStatusNewDAL sdal = new MsOpStatusNewDAL();
|
|
|
string uname =username;
|
|
|
sdal.SaveStatusTree(BSNO, uname == null ? "" : uname);
|
|
|
result.Data = BSNO;
|
|
|
return result;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if (iscreatecustno == true)
|
|
|
MsSysBillNoSetDAL.DeleteBsNo(custno);
|
|
|
result.Success = false;
|
|
|
result.Message = errorstr + ",不允许保存!";
|
|
|
return result;
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public static string ToDBC(string input)
|
|
|
{
|
|
|
char[] c = input.ToCharArray();
|
|
|
for (int i = 0; i < c.Length; i++)
|
|
|
{
|
|
|
if (c[i] == 12288)
|
|
|
{
|
|
|
c[i] = (char)32;
|
|
|
continue;
|
|
|
}
|
|
|
if (c[i] > 65280 && c[i] < 65375)
|
|
|
c[i] = (char)(c[i] - 65248);
|
|
|
}
|
|
|
return new string(c);
|
|
|
}
|
|
|
public static string DelEndSpace(string input)
|
|
|
{
|
|
|
if (input == "") return "";
|
|
|
|
|
|
|
|
|
input = input.Replace("\n", "\\");
|
|
|
input = input.Replace("\r", " ");
|
|
|
|
|
|
string[] StrList = input.Split('\\');
|
|
|
var result = "";
|
|
|
|
|
|
for (var i = 0; i <= StrList.Length - 1; i++)
|
|
|
{
|
|
|
var tmpstr = StrList[i].TrimEnd();
|
|
|
if (tmpstr != "")
|
|
|
{
|
|
|
if (result == "")
|
|
|
result = tmpstr;
|
|
|
else result = result + Environment.NewLine + tmpstr;
|
|
|
}
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
#region 全角空格转半角空格
|
|
|
|
|
|
public static string FullWidthToHalfWidth(string str)
|
|
|
{
|
|
|
byte[] t = Encoding.Default.GetBytes(str);
|
|
|
for (int i = 0; i < t.Length; i++)
|
|
|
{
|
|
|
if ((t[i].ToString() == "161") && (t[i + 1].ToString() == "161"))
|
|
|
{
|
|
|
t[i] = 32;
|
|
|
if (i + 1 == t.Length - 1)
|
|
|
{
|
|
|
t[i + 1] = 0;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
for (int j = i + 1; j + 1 < t.Length; j++)
|
|
|
{
|
|
|
t[j] = t[j + 1];
|
|
|
if (j + 1 == t.Length - 1)
|
|
|
{
|
|
|
t[j + 1] = 0;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return Encoding.Default.GetString(t);
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region 明细表
|
|
|
static public List<MsOpSeaeDetail> GetBodyList ( string strCondition,string sort=null )
|
|
|
{
|
|
|
var strSql = new StringBuilder();
|
|
|
strSql.Append("SELECT [CTN_ID],[BSNO],isnull(CTNCODE,1) as [CTNCODE],[SIZE],[CTN],[CTNNUM],[TEU],[CTNALL],op_ctn.CNTRNO,[SEALNO],[PKGS],[KGS],[CBM],[REMARK],[KINDPKGS],[TAREWEIGHT],[VGMCONNCOM],[GOODSNAME],CTNSTATUS,op_ctn.MASTERNO,WEIGHTYPE,WEIGHKGS,WEIGHATTN,WEIGHTEL,WEIGHSIGN,WEIGHDATE ");
|
|
|
strSql.Append(" ,TRUCKER,TRUCKNO,TRUCKFEE,FREESTORAGEDAY,STORAGEDAY,STORAGEPRICE,STORAGEFEE,FREECTNDAY,CTNDAY,CTNPRICE,CTNFEE,TiXiangShiJian,");
|
|
|
strSql.Append(" f.FENPKGS,f.FENKGS,f.FENCBM,VGMADDR,VGMEMAIL,ISTEMP from op_ctn left join V_FEN_CTN_SUM f on (f.MASTERNO=op_ctn.BSNO and f.CNTRNO=op_ctn.CNTRNO) ");
|
|
|
if (strCondition.Trim() != String.Empty)
|
|
|
{
|
|
|
strSql.Append(" where " + strCondition);
|
|
|
}
|
|
|
var sortstring = DatasetSort.Getsortstring(sort);
|
|
|
if (!string.IsNullOrEmpty(sortstring))
|
|
|
{
|
|
|
strSql.Append(" order by " + sortstring);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strSql.Append(" order by BSNO,CTNCODE,CTNALL");
|
|
|
}
|
|
|
return SetBodyData(strSql);
|
|
|
}
|
|
|
public static List<MsOpSeaeDetail> SetBodyData ( StringBuilder strSql )
|
|
|
{
|
|
|
var bodyList = new List<MsOpSeaeDetail>();
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
|
|
|
{
|
|
|
while (reader.Read())
|
|
|
{
|
|
|
MsOpSeaeDetail data = new MsOpSeaeDetail();
|
|
|
#region Set DB data to Object
|
|
|
data.VGMCONNCOM = Convert.ToString(reader["VGMCONNCOM"]);//vgm联系公司
|
|
|
data.CTN_ID = Convert.ToString(reader["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.CTNNUM = Convert.ToInt32(reader["CTNNUM"]);//箱量
|
|
|
if (reader["TEU"] != DBNull.Value)
|
|
|
data.TEU = Convert.ToInt32(reader["TEU"]);//TEU
|
|
|
data.CTNALL = Convert.ToString(reader["CTNALL"]);//表现形式
|
|
|
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"]);//包装类型
|
|
|
if (reader["TAREWEIGHT"] != DBNull.Value)
|
|
|
data.TAREWEIGHT = Convert.ToDecimal(reader["TAREWEIGHT"]);//箱皮重
|
|
|
data.GOODSNAME = Convert.ToString(reader["GOODSNAME"]);//品名
|
|
|
data.WEIGHTYPE = Convert.ToString(reader["WEIGHTYPE"]);
|
|
|
if (reader["WEIGHKGS"] != DBNull.Value)
|
|
|
data.WEIGHKGS = Convert.ToDecimal(reader["WEIGHKGS"]);//
|
|
|
data.WEIGHATTN = Convert.ToString(reader["WEIGHATTN"]);
|
|
|
data.WEIGHTEL = Convert.ToString(reader["WEIGHTEL"]);
|
|
|
data.WEIGHSIGN = Convert.ToString(reader["WEIGHSIGN"]);
|
|
|
data.WEIGHDATE = Convert.ToString(reader["WEIGHDATE"]);
|
|
|
data.VGMADDR = Convert.ToString(reader["VGMADDR"]);
|
|
|
data.VGMEMAIL = Convert.ToString(reader["VGMEMAIL"]);
|
|
|
data.ISTEMP = Convert.ToString(reader["ISTEMP"]);
|
|
|
data.CTNSTATUS = Convert.ToString(reader["CTNSTATUS"]);
|
|
|
data.MASTERNO = Convert.ToString(reader["MASTERNO"]);
|
|
|
if (reader["FENPKGS"] != DBNull.Value)
|
|
|
data.FENPKGS = Convert.ToInt32(reader["FENPKGS"]);//件数
|
|
|
if (reader["FENKGS"] != DBNull.Value)
|
|
|
data.FENKGS = Convert.ToDecimal(reader["FENKGS"]);//重量(货重)
|
|
|
if (reader["FENCBM"] != DBNull.Value)
|
|
|
data.FENCBM = Convert.ToDecimal(reader["FENCBM"]);//尺码
|
|
|
data.TRUCKNO = Convert.ToString(reader["TRUCKNO"]);
|
|
|
data.TRUCKER = Convert.ToString(reader["TRUCKER"]);
|
|
|
if (reader["FREESTORAGEDAY"] != DBNull.Value)
|
|
|
data.FREESTORAGEDAY = Convert.ToString(reader["FREESTORAGEDAY"]);
|
|
|
if (reader["STORAGEDAY"] != DBNull.Value)
|
|
|
data.STORAGEDAY = Convert.ToString(reader["STORAGEDAY"]);
|
|
|
if (reader["FREECTNDAY"] != DBNull.Value)
|
|
|
data.FREECTNDAY = Convert.ToString(reader["FREECTNDAY"]);
|
|
|
if (reader["CTNDAY"] != DBNull.Value)
|
|
|
data.CTNDAY = Convert.ToString(reader["CTNDAY"]);
|
|
|
if (reader["TRUCKFEE"] != DBNull.Value)
|
|
|
data.TRUCKFEE = Convert.ToString(reader["TRUCKFEE"]);
|
|
|
if (reader["STORAGEPRICE"] != DBNull.Value)
|
|
|
data.STORAGEPRICE = Convert.ToString(reader["STORAGEPRICE"]);
|
|
|
if (reader["STORAGEFEE"] != DBNull.Value)
|
|
|
data.STORAGEFEE = Convert.ToString(reader["STORAGEFEE"]);
|
|
|
if (reader["CTNPRICE"] != DBNull.Value)
|
|
|
data.CTNPRICE = Convert.ToString(reader["CTNPRICE"]);
|
|
|
if (reader["CTNFEE"] != DBNull.Value)
|
|
|
data.CTNFEE = Convert.ToString(reader["CTNFEE"]);
|
|
|
data.TIXIANGSHIJIAN = Convert.ToString(reader["TiXiangShiJian"]);
|
|
|
|
|
|
#endregion
|
|
|
bodyList.Add(data);
|
|
|
}
|
|
|
reader.Close();
|
|
|
}
|
|
|
return bodyList;
|
|
|
}
|
|
|
|
|
|
static public List<MsOpSeaeDetail> GetBodyListSum ( string strCondition )
|
|
|
{
|
|
|
var strSql = new StringBuilder();
|
|
|
strSql.Append("SELECT SUM(CTNNUM) AS CTNNUM,[CTNALL],SUM(TEU) TEU,SUM(PKGS) PKGS,SUM(KGS) KGS,SUM(CBM) CBM from op_ctn");
|
|
|
if (strCondition.Trim() != String.Empty)
|
|
|
{
|
|
|
strSql.Append(" where " + strCondition);
|
|
|
}
|
|
|
strSql.Append(" Group by CTNALL");
|
|
|
return SetBodyDataSum(strSql);
|
|
|
}
|
|
|
static public List<MsOpSeaeDetail> GetBodyListBSNOSum(string strCondition)
|
|
|
{
|
|
|
var strSql = new StringBuilder();
|
|
|
strSql.Append("SELECT SUM(CTNNUM) AS CTNNUM,'' CTNALL,SUM(TEU) TEU,SUM(PKGS) PKGS,SUM(KGS) KGS,SUM(CBM) CBM from op_ctn");
|
|
|
if (strCondition.Trim() != String.Empty)
|
|
|
{
|
|
|
strSql.Append(" where " + strCondition);
|
|
|
}
|
|
|
// strSql.Append(" Group by CTNALL");
|
|
|
return SetBodyDataSum(strSql);
|
|
|
}
|
|
|
static public List<MsOpSeaeDetail> GetTDBSNOSum(string strCondition)
|
|
|
{
|
|
|
var strSql = new StringBuilder();
|
|
|
strSql.Append("SELECT 0 AS CTNNUM,'' CTNALL,0 TEU,SUM(PKGS) PKGS,SUM(KGS) KGS,SUM(CBM) CBM from op_seae_billmanage");
|
|
|
if (strCondition.Trim() != String.Empty)
|
|
|
{
|
|
|
strSql.Append(" where " + strCondition);
|
|
|
}
|
|
|
// strSql.Append(" Group by CTNALL");
|
|
|
return SetBodyDataSum(strSql);
|
|
|
}
|
|
|
private static List<MsOpSeaeDetail> SetBodyDataSum ( StringBuilder strSql )
|
|
|
{
|
|
|
var bodyList = new List<MsOpSeaeDetail>();
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
|
|
|
{
|
|
|
while (reader.Read())
|
|
|
{
|
|
|
MsOpSeaeDetail data = new MsOpSeaeDetail();
|
|
|
#region Set DB data to Object
|
|
|
if (reader["CTNNUM"] != DBNull.Value)
|
|
|
data.CTNNUM = Convert.ToInt32(reader["CTNNUM"]);//箱量
|
|
|
data.CTNALL = Convert.ToString(reader["CTNALL"]);//表现形式
|
|
|
if (reader["TEU"] != DBNull.Value)
|
|
|
data.TEU = Convert.ToInt32(reader["TEU"]);//箱量
|
|
|
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"]);
|
|
|
#endregion
|
|
|
bodyList.Add(data);
|
|
|
}
|
|
|
reader.Close();
|
|
|
}
|
|
|
return bodyList;
|
|
|
}
|
|
|
|
|
|
static public List<MsOpCtnDetail> GetOpCtnDetailList ( string strCondition )
|
|
|
{
|
|
|
var strSql = new StringBuilder();
|
|
|
strSql.Append("SELECT *,CNTRNO=(select top 1 CNTRNO from op_ctn where [CTN_ID]=op_ctn_detail.[CTN_ID]),CTNALL=(select top 1 CTNALL from op_ctn where [CTN_ID]=op_ctn_detail.[CTN_ID]) from op_ctn_detail");
|
|
|
if (strCondition.Trim() != String.Empty)
|
|
|
{
|
|
|
strSql.Append(" where " + strCondition);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strSql.Append(" where 1<0");
|
|
|
}
|
|
|
strSql.Append(" order by [CTN_ID],[ID]");
|
|
|
return SetOpCtnDetailData(strSql);
|
|
|
}
|
|
|
private static List<MsOpCtnDetail> SetOpCtnDetailData ( StringBuilder strSql )
|
|
|
{
|
|
|
var bodyList = new List<MsOpCtnDetail>();
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
|
|
|
{
|
|
|
while (reader.Read())
|
|
|
{
|
|
|
MsOpCtnDetail data = new MsOpCtnDetail();
|
|
|
#region Set DB data to Object
|
|
|
data.GID = (reader["GID"] == null ? "" : Convert.ToString(reader["GID"]));//GID
|
|
|
data.CTN_ID = (reader["CTN_ID"] == null ? "" : Convert.ToString(reader["CTN_ID"]));//CTN_ID
|
|
|
data.PKGS = (reader["PKGS"] == null ? 0 : Convert.ToInt32(reader["PKGS"]));//件数
|
|
|
data.KINDPKGS = (reader["KINDPKGS"] == null ? "" : Convert.ToString(reader["KINDPKGS"]));//件数包装
|
|
|
data.KGS = (reader["KGS"] == null ? 0 : Convert.ToDecimal(reader["KGS"]));//重量
|
|
|
data.CBM = (reader["CBM"] == null ? 0 : Convert.ToDecimal(reader["CBM"]));//尺码
|
|
|
data.HSCODE = (reader["HSCODE"] == null ? "" : Convert.ToString(reader["HSCODE"]));//HS编码
|
|
|
data.DESCRIPTION = (reader["DESCRIPTION"] == null ? "" : Convert.ToString(reader["DESCRIPTION"]));//货物描述
|
|
|
data.MARKS = (reader["MARKS"] == null ? "" : Convert.ToString(reader["MARKS"]));//唛头
|
|
|
data.REMARK = (reader["REMARK"] == null ? "" : Convert.ToString(reader["REMARK"]));//备注
|
|
|
data.CNTRNO = (reader["CNTRNO"] == null ? "" : Convert.ToString(reader["CNTRNO"]));
|
|
|
data.CTNALL = (reader["CTNALL"] == null ? "" : Convert.ToString(reader["CTNALL"]));
|
|
|
#endregion
|
|
|
bodyList.Add(data);
|
|
|
}
|
|
|
reader.Close();
|
|
|
}
|
|
|
return bodyList;
|
|
|
}
|
|
|
|
|
|
static public List<MsOpSeaeManifest> GetManifestList ( string strCondition )
|
|
|
{
|
|
|
var strSql = new StringBuilder();
|
|
|
strSql.Append("SELECT [GID],[BSNO],[MBLNO],[CNTRNO],[SEALNO],[PKGS],[KGS],[CBM],[REMARK],KINDPKGS,[DESCRIPTION] from op_manifest");
|
|
|
if (strCondition.Trim() != String.Empty)
|
|
|
{
|
|
|
strSql.Append(" where " + strCondition);
|
|
|
}
|
|
|
strSql.Append(" order by MBLNO");
|
|
|
return SetManifestData(strSql);
|
|
|
}
|
|
|
|
|
|
static public List<MsOpSeaeManifest> GetManifestSumList ( string strCondition )
|
|
|
{
|
|
|
var strSql = new StringBuilder();
|
|
|
strSql.Append("SELECT '' GID,[BSNO],[MBLNO],'' CNTRNO,'' SEALNO,sum(PKGS) PKGS,SUM(KGS) KGS ,SUM(CBM) CBM,'' REMARK, KINDPKGS,DESCRIPTION from op_manifest");
|
|
|
if (strCondition.Trim() != String.Empty)
|
|
|
{
|
|
|
strSql.Append(" where " + strCondition);
|
|
|
}
|
|
|
strSql.Append(" GROUP BY BSNO,MBLNO,KINDPKGS,DESCRIPTION ");
|
|
|
strSql.Append(" order by MBLNO");
|
|
|
return SetManifestData(strSql);
|
|
|
}
|
|
|
static public List<MsOpSeaeManifest> GetManifestBsNoSumList(string strCondition)
|
|
|
{
|
|
|
var strSql = new StringBuilder();
|
|
|
strSql.Append("SELECT '' GID,[BSNO],'' CNTRNO,'' SEALNO,sum(PKGS) PKGS,SUM(KGS) KGS ,SUM(CBM) CBM,'' REMARK,'' KINDPKGS,'' MBLNO,'' DESCRIPTION from op_manifest");
|
|
|
if (strCondition.Trim() != String.Empty)
|
|
|
{
|
|
|
strSql.Append(" where " + strCondition);
|
|
|
}
|
|
|
strSql.Append(" GROUP BY BSNO ");
|
|
|
return SetManifestData(strSql);
|
|
|
}
|
|
|
private static List<MsOpSeaeManifest> SetManifestData ( StringBuilder strSql )
|
|
|
{
|
|
|
var bodyList = new List<MsOpSeaeManifest>();
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
|
|
|
{
|
|
|
while (reader.Read())
|
|
|
{
|
|
|
MsOpSeaeManifest data = new MsOpSeaeManifest();
|
|
|
#region Set DB data to Object
|
|
|
data.GID = Convert.ToString(reader["GID"]);//编号
|
|
|
data.BSNO = Convert.ToString(reader["BSNO"]);//业务编号
|
|
|
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"]);//包装类型
|
|
|
data.MBLNO = Convert.ToString(reader["MBLNO"]);//品名
|
|
|
data.DESCRIPTION = Convert.ToString(reader["DESCRIPTION"]);//品名
|
|
|
#endregion
|
|
|
bodyList.Add(data);
|
|
|
}
|
|
|
reader.Close();
|
|
|
}
|
|
|
return bodyList;
|
|
|
}
|
|
|
|
|
|
static public List<MsOpStatus> GetOpStatusStandard()
|
|
|
{
|
|
|
var strSql = new StringBuilder();
|
|
|
strSql.AppendLine("SELECT [STATUS] from op_status with (NOLOCK) ");
|
|
|
strSql.AppendLine("WHERE STTYPE='0' ");
|
|
|
strSql.AppendLine("order by ST_ID DESC ");
|
|
|
return SetStatusStandardData(strSql);
|
|
|
}
|
|
|
|
|
|
private static List<MsOpStatus> SetStatusStandardData(StringBuilder strSql)
|
|
|
{
|
|
|
var bodyList = new List<MsOpStatus>();
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
|
|
|
{
|
|
|
while (reader.Read())
|
|
|
{
|
|
|
MsOpStatus data = new MsOpStatus();
|
|
|
#region Set DB data to Object
|
|
|
data.STATUS = Convert.ToString(reader["STATUS"]);//编号
|
|
|
#endregion
|
|
|
bodyList.Add(data);
|
|
|
}
|
|
|
reader.Close();
|
|
|
}
|
|
|
return bodyList;
|
|
|
}
|
|
|
|
|
|
static public List<MsOpStatus> GetOpStatus(string bsno)
|
|
|
{
|
|
|
StringBuilder sql = new StringBuilder();
|
|
|
sql.AppendLine("SELECT ST_ID, STATUS, COMPTIME ");
|
|
|
sql.AppendLine("FROM op_status with (NOLOCK) ");
|
|
|
sql.AppendLine("WHERE BSNO = '" + bsno + "' ");
|
|
|
sql.AppendLine("ORDER BY COMPTIME asc ");
|
|
|
return SetStatusData(sql);
|
|
|
}
|
|
|
static public List<MsOpStatus> SearchOpStatus(string mblno)
|
|
|
{
|
|
|
StringBuilder sql = new StringBuilder();
|
|
|
sql.AppendLine("SELECT ST_ID, STATUS, COMPTIME ");
|
|
|
sql.AppendLine("FROM op_status with (NOLOCK) ");
|
|
|
sql.AppendLine("WHERE BSNO = (select BSNO from op_seae where MBLNO='" + mblno + "') ");
|
|
|
sql.AppendLine("ORDER BY COMPTIME asc ");
|
|
|
return SetStatusData(sql);
|
|
|
}
|
|
|
private static List<MsOpStatus> SetStatusData(StringBuilder sql)
|
|
|
{
|
|
|
var bodyList = new List<MsOpStatus>();
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
using (IDataReader reader = db.ExecuteReader(CommandType.Text, sql.ToString()))
|
|
|
{
|
|
|
while (reader.Read())
|
|
|
{
|
|
|
MsOpStatus data = new MsOpStatus();
|
|
|
#region Set DB data to Object
|
|
|
data.ST_ID = Convert.ToString(reader["ST_ID"]);
|
|
|
data.STATUS = Convert.ToString(reader["STATUS"]);//编号
|
|
|
data.COMPTIME = Convert.ToString(reader["COMPTIME"]).Replace("/", "-");
|
|
|
#endregion
|
|
|
bodyList.Add(data);
|
|
|
}
|
|
|
reader.Close();
|
|
|
}
|
|
|
return bodyList;
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 保存明细
|
|
|
public static DBResult SaveDetail ( string bsno, List<MsOpSeaeDetail> bodyList, string userid, bool updatetotal, string dbname = "" )
|
|
|
{
|
|
|
var result = new DBResult();
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
if (dbname != "") db = DatabaseFactory.CreateDatabase(dbname);
|
|
|
var tempctnstr = "";
|
|
|
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 (newid(),@BSNO,@CTNCODE,@SIZE,@CTN,@CTNNUM,@TEU,@CTNALL,@CNTRNO,@SEALNO,@PKGS,@KGS,@CBM,@REMARK,@KINDPKGS,@TAREWEIGHT,@GOODSNAME) ");
|
|
|
|
|
|
//var cmdUpdate = db.GetSqlStringCommand(@"update op_ctn set CTNCODE=@CTNCODE,SIZE=@SIZE,CTN=@CTN,CTNNUM=@CTNNUM,TEU=@TEU,CTNALL=@CTNALL,CNTRNO=@CNTRNO,SEALNO=@SEALNO,PKGS=@PKGS,KGS=@KGS,CBM=@CBM,REMARK=@REMARK,KINDPKGS=@KINDPKGS,TAREWEIGHT=@TAREWEIGHT where BSNO=@BSNO AND CTN_ID=@CTN_ID ");
|
|
|
|
|
|
if (bodyList != null)
|
|
|
{
|
|
|
//var StrSerialNo = "('1000'";
|
|
|
foreach (var enumValue in bodyList)
|
|
|
{
|
|
|
//StrSerialNo = StrSerialNo + ",'" + Convert.ToString(enumValue.CTN_ID) + "'";
|
|
|
var SIZE = enumValue.CTNALL.ToString().Trim().Substring(0, 2);
|
|
|
string CTN = enumValue.CTNALL.ToString().Trim().Substring(2);
|
|
|
if (enumValue.CTNALL.IndexOf("'")>0) CTN = enumValue.CTNALL.ToString().Trim().Substring(3);
|
|
|
|
|
|
|
|
|
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";
|
|
|
|
|
|
//
|
|
|
if (enumValue.BSNO == "*")
|
|
|
{
|
|
|
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,MASTERNO,WEIGHTYPE,WEIGHKGS,WEIGHATTN,WEIGHTEL,WEIGHSIGN,WEIGHDATE,TRUCKER,TRUCKFEE,FREESTORAGEDAY,STORAGEDAY,STORAGEPRICE,STORAGEFEE,FREECTNDAY,CTNDAY,CTNPRICE,CTNFEE,TRUCKNO,VGMCONNCOM,VGMADDR,VGMEMAIL,ISTEMP,TIXIANGSHIJIAN) values ('" + enumValue.CTN_ID
|
|
|
+ "','" + bsno + "','" + enumValue.CTNCODE + "','" + SIZE + "','" + CTN + "'," + enumValue.CTNNUM + "," + TEU + ",'" + enumValue.CTNALL.Replace("'","''") + "','" + 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 + "','" + enumValue.ISTEMP + "','" + enumValue.TIXIANGSHIJIAN + "')");
|
|
|
db.ExecuteNonQuery(cmdInsert, tran);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
var cmdUpdate = db.GetSqlStringCommand(@"update op_ctn set CTNCODE='" + enumValue.CTNCODE + "',[SIZE]='" + SIZE + "',CTN='" + CTN + "',CTNNUM=" + enumValue.CTNNUM + ",TEU=" + TEU + ",CTNALL='" + enumValue.CTNALL.Replace("'", "''") + "',CNTRNO='" + enumValue.CNTRNO + "',SEALNO='" + enumValue.SEALNO + "',PKGS='" + enumValue.PKGS + "',KGS=" + enumValue.KGS
|
|
|
+ ",CBM=" + enumValue.CBM + ",REMARK='" + enumValue.REMARK + "',KINDPKGS='" + enumValue.KINDPKGS + "',TAREWEIGHT=" + enumValue.TAREWEIGHT + ",CTNSTATUS='" + enumValue.CTNSTATUS + "',MASTERNO='" + enumValue.MASTERNO + "',WEIGHTYPE='" + enumValue.WEIGHTYPE + "',WEIGHKGS=" + enumValue.WEIGHKGS + ",WEIGHATTN='"
|
|
|
+ enumValue.WEIGHATTN + "',WEIGHTEL='" + enumValue.WEIGHTEL + "',WEIGHSIGN='" + enumValue.WEIGHSIGN + "',WEIGHDATE='" + enumValue.WEIGHDATE + "',TRUCKER='" + enumValue.TRUCKER + "',TRUCKFEE=" + enumValue.TRUCKFEE + ",FREESTORAGEDAY=" + enumValue.FREESTORAGEDAY + ",STORAGEDAY=" + enumValue.STORAGEDAY
|
|
|
+ ",STORAGEPRICE=" + enumValue.STORAGEPRICE + ",STORAGEFEE=" + enumValue.STORAGEFEE + ",FREECTNDAY=" + enumValue.FREECTNDAY + ",CTNDAY=" + enumValue.CTNDAY + ",CTNPRICE=" + enumValue.CTNPRICE + ",CTNFEE=" + enumValue.CTNFEE + ",TRUCKNO='" + enumValue.TRUCKNO + "',VGMCONNCOM='" + enumValue.VGMCONNCOM + "',VGMADDR='" + enumValue.VGMADDR + "',VGMEMAIL='" + enumValue.VGMEMAIL + "',ISTEMP='" + enumValue.ISTEMP + "',TIXIANGSHIJIAN='"+ enumValue.TIXIANGSHIJIAN + "'"
|
|
|
+ " where BSNO='" + bsno + "' AND CTN_ID='" + enumValue.CTN_ID + "'");
|
|
|
db.ExecuteNonQuery(cmdUpdate, tran);
|
|
|
}
|
|
|
if (enumValue.CNTRNO != "")
|
|
|
{
|
|
|
var FeeCount = db.ExecuteScalar(tran,CommandType.Text, "SELECT COUNT(1) as FeeCount from OP_CTN where ISTEMP='1' AND CNTRNO='" + enumValue.CNTRNO + "' AND EXISTS (SELECT 1 FROM OP_SEAI B WHERE B.BSNO=OP_CTN.BSNO) ");
|
|
|
var IntFeeCount = Convert.ToInt16(FeeCount);
|
|
|
if (IntFeeCount != 0)
|
|
|
{
|
|
|
if (tempctnstr == "")
|
|
|
tempctnstr = enumValue.CNTRNO;
|
|
|
else
|
|
|
tempctnstr = tempctnstr +","+ enumValue.CNTRNO;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
//StrSerialNo = StrSerialNo + ")";
|
|
|
//var cmdDelete = db.GetSqlStringCommand("delete from op_ctn where BSNO='" + bsno + "' and CTN_ID not in " + StrSerialNo);
|
|
|
//db.ExecuteNonQuery(cmdDelete, tran);
|
|
|
}
|
|
|
|
|
|
//
|
|
|
tran.Commit();
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
tran.Rollback();
|
|
|
result.Success = false;
|
|
|
result.Message = "保存出现错误,请重试或联系系统管理员";
|
|
|
return result;
|
|
|
}
|
|
|
}
|
|
|
//
|
|
|
if (updatetotal)
|
|
|
getCNTRTOTAL(bsno, "op_seae");
|
|
|
else
|
|
|
getCNTRTOTALFen(bsno, "op_seae");
|
|
|
//
|
|
|
|
|
|
if (tempctnstr != "") tempctnstr ="箱号:"+tempctnstr + "为暂进箱,请处理!";
|
|
|
|
|
|
result.Success = true;
|
|
|
result.Message = "保存成功" + result.Message+ tempctnstr;
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public static DBResult SaveBillDetail ( string bsno, List<MsOpSeaeDetail> bodyList, string userid )
|
|
|
{
|
|
|
var result = new DBResult();
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
using (var conn = db.CreateConnection())
|
|
|
{
|
|
|
conn.Open();
|
|
|
var tran = conn.BeginTransaction();
|
|
|
try
|
|
|
{
|
|
|
|
|
|
if (bodyList != null)
|
|
|
{
|
|
|
//var cmddelete = db.GetSqlStringCommand(@"delete from op_ctn where BSNO='" + bsno + "'");
|
|
|
//db.ExecuteNonQuery(cmddelete, tran);
|
|
|
foreach (var enumValue in bodyList)
|
|
|
{
|
|
|
var SIZE = enumValue.CTNALL.ToString().Trim().Substring(0, 2);
|
|
|
string CTN = enumValue.CTNALL.ToString().Trim().Substring(2);
|
|
|
if (enumValue.CTNALL.IndexOf("'")>0) CTN = enumValue.CTNALL.ToString().Trim().Substring(3);
|
|
|
|
|
|
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";
|
|
|
|
|
|
//
|
|
|
if (enumValue.BSNO == "*")
|
|
|
{
|
|
|
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,MASTERNO,WEIGHTYPE,WEIGHKGS,WEIGHATTN,WEIGHTEL,WEIGHSIGN,WEIGHDATE,TRUCKER,TRUCKFEE,FREESTORAGEDAY,STORAGEDAY,STORAGEPRICE,STORAGEFEE,FREECTNDAY,CTNDAY,CTNPRICE,CTNFEE,TRUCKNO,VGMCONNCOM,VGMADDR,VGMEMAIL) values ('" + enumValue.CTN_ID
|
|
|
+ "','" + bsno + "','" + enumValue.CTNCODE + "','" + SIZE + "','" + CTN + "'," + enumValue.CTNNUM + "," + TEU + ",'" + enumValue.CTNALL.Replace("'","''") + "','" + 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(cmdInsert, tran);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
var cmdUpdate = db.GetSqlStringCommand(@"update op_ctn set CTNCODE='" + enumValue.CTNCODE + "',[SIZE]='" + SIZE + "',CTN='" + CTN + "',CTNNUM=" + enumValue.CTNNUM + ",TEU=" + TEU + ",CTNALL='" + enumValue.CTNALL.Replace("'", "''") + "',CNTRNO='" + enumValue.CNTRNO + "',SEALNO='" + enumValue.SEALNO + "',PKGS='" + enumValue.PKGS + "',KGS=" + enumValue.KGS
|
|
|
+ ",CBM=" + enumValue.CBM + ",REMARK='" + enumValue.REMARK + "',KINDPKGS='" + enumValue.KINDPKGS + "',TAREWEIGHT=" + enumValue.TAREWEIGHT + ",CTNSTATUS='" + enumValue.CTNSTATUS + "',MASTERNO='" + enumValue.MASTERNO + "',WEIGHTYPE='" + enumValue.WEIGHTYPE + "',WEIGHKGS=" + enumValue.WEIGHKGS + ",WEIGHATTN='"
|
|
|
+ enumValue.WEIGHATTN + "',WEIGHTEL='" + enumValue.WEIGHTEL + "',WEIGHSIGN='" + enumValue.WEIGHSIGN + "',WEIGHDATE='" + enumValue.WEIGHDATE + "',TRUCKER='" + enumValue.TRUCKER + "',TRUCKFEE=" + enumValue.TRUCKFEE + ",FREESTORAGEDAY=" + enumValue.FREESTORAGEDAY + ",STORAGEDAY=" + enumValue.STORAGEDAY
|
|
|
+ ",STORAGEPRICE=" + enumValue.STORAGEPRICE + ",STORAGEFEE=" + enumValue.STORAGEFEE + ",FREECTNDAY=" + enumValue.FREECTNDAY + ",CTNDAY=" + enumValue.CTNDAY + ",CTNPRICE=" + enumValue.CTNPRICE + ",CTNFEE=" + enumValue.CTNFEE + ",TRUCKNO='" + enumValue.TRUCKNO + "',VGMCONNCOM='" + enumValue.VGMCONNCOM + "',VGMADDR='" + enumValue.VGMADDR + "',VGMEMAIL='" + enumValue.VGMEMAIL + "'"
|
|
|
+ " where BSNO='" + bsno + "' AND CTN_ID='" + enumValue.CTN_ID + "'");
|
|
|
db.ExecuteNonQuery(cmdUpdate, tran);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
//
|
|
|
tran.Commit();
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
tran.Rollback();
|
|
|
result.Success = false;
|
|
|
result.Message = "保存出现错误,请重试或联系系统管理员";
|
|
|
return result;
|
|
|
}
|
|
|
}
|
|
|
getCNTRTOTALBill(bsno);
|
|
|
result.Success = true;
|
|
|
result.Message = "保存成功" + result.Message;
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
//合计当前业务的集装箱信息,更新op_seai中的CNTRTOTAL,CNTRSEALNO两个字段
|
|
|
public static void getCNTRTOTAL ( string strBSNO, string bstype )
|
|
|
{
|
|
|
int iTEU = 0;
|
|
|
string strCNTRTOTAL = "";
|
|
|
string strCNTRNO = "";
|
|
|
string str = "";
|
|
|
T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
|
|
|
DataSet dsDisp = T_ALL_DA.GetAllSQL("select * from code_ctn_disp");// where CORPID = '" + strCORPID + "'";
|
|
|
DataSet ds = T_ALL_DA.GetAllSQL("select * from op_ctn where BSNO='" + strBSNO + "'");
|
|
|
//
|
|
|
str = "update " + bstype + " set CNTR1=0,CNTR2=0,CNTR3=0,CNTR4=0,CNTR5=0,CNTR6=0,CNTR7=0,CNTR8=0,CNTR9=0,CNTR10=0,OTCNTR=0 where BSNO='" + strBSNO + "'";
|
|
|
bool bl3 = T_ALL_DA.GetExecuteSqlCommand(str);
|
|
|
var SEALNONOPKGS= MsSysParamSetDAL.GetData("PARAMNAME='SEALNONOPKGS'").PARAMVALUE;
|
|
|
if (ds != null)
|
|
|
{
|
|
|
if (ds.Tables[0].Rows.Count > 0)
|
|
|
{
|
|
|
foreach (DataTable myTable in ds.Tables)
|
|
|
{
|
|
|
foreach (DataRow myRow in myTable.Rows)//遍历表
|
|
|
{
|
|
|
|
|
|
if (SEALNONOPKGS == "1")
|
|
|
{
|
|
|
strCNTRNO += myRow["CNTRNO"].ToString().Trim() + "/" + myRow["SEALNO"].ToString().Trim() + "/" + myRow["CTNALL"].ToString().Replace("'", "''").Trim()+ "\r\n";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
|
|
|
strCNTRNO += myRow["CNTRNO"].ToString().Trim() + "/" + myRow["SEALNO"].ToString().Trim() + "/" + myRow["CTNALL"].ToString().Replace("'", "''").Trim()
|
|
|
+ "/" + myRow["PKGS"].ToString().Trim() + myRow["KINDPKGS"].ToString().Trim() + "/" + myRow["KGS"].ToString().Trim() + "KGS/" + myRow["CBM"].ToString().Trim() + "CBM\r\n";
|
|
|
}
|
|
|
iTEU += int.Parse(myRow["TEU"].ToString().Trim());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//
|
|
|
str = "select CTNALL,sum(CTNNUM) as hj from op_ctn where BSNO='" + strBSNO + "' group by CTNALL order by CTNALL";
|
|
|
ds = T_ALL_DA.GetAllSQL(str);
|
|
|
foreach (DataTable myTable in ds.Tables)
|
|
|
{
|
|
|
foreach (DataRow myRow in myTable.Rows)//遍历表
|
|
|
{
|
|
|
strCNTRTOTAL += myRow["CTNALL"].ToString().Replace("'", "''").Trim() + "*" + myRow["hj"].ToString().Trim() + " / ";
|
|
|
//
|
|
|
if (dsDisp == null)
|
|
|
{
|
|
|
string sHJ = T_ALL_DA.GetStrSQL("hj", "select sum(CTNNUM) as hj from op_ctn where BSNO='" + strBSNO + "'");
|
|
|
str = "update " + bstype + " set OTCNTR=OTCNTR+" + myRow["hj"].ToString().Trim() + " where BSNO='" + strBSNO + "'";
|
|
|
bool bl2 = T_ALL_DA.GetExecuteSqlCommand(str);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
int j = 0;
|
|
|
for (int i = 1; i < 11; i++)
|
|
|
{
|
|
|
if (dsDisp.Tables[0].Rows[0][i].ToString().Trim().Equals(myRow["CTNALL"].ToString().Replace("'", "''").Trim()))
|
|
|
{
|
|
|
str = "update " + bstype + " set CNTR" + i + "=CNTR" + i + "+" + myRow["hj"].ToString().Trim() + " where BSNO='" + strBSNO + "'";
|
|
|
j = j + 1;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
if (j == 0)
|
|
|
{
|
|
|
str = "update " + bstype + " set OTCNTR=OTCNTR+" + myRow["hj"].ToString().Trim() + " where BSNO='" + strBSNO + "'";
|
|
|
}
|
|
|
bool bl2 = T_ALL_DA.GetExecuteSqlCommand(str);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
strCNTRTOTAL = strCNTRTOTAL.Trim().Substring(0, strCNTRTOTAL.Trim().Length - 1);
|
|
|
}
|
|
|
}
|
|
|
str = "update op_seae set CNTRTOTAL='" + strCNTRTOTAL + "',CNTRSEALNO='" + strCNTRNO + "',TEU=" + iTEU + " where BSNO='" + strBSNO + "'";
|
|
|
bool bl = T_ALL_DA.GetExecuteSqlCommand(str);
|
|
|
}
|
|
|
|
|
|
public static void getCNTRTOTALFen(string strBSNO, string bstype)
|
|
|
{
|
|
|
string strCNTRNO = "";
|
|
|
string str = "";
|
|
|
|
|
|
|
|
|
T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
|
|
|
DataSet dsDisp = T_ALL_DA.GetAllSQL("select * from code_ctn_disp");// where CORPID = '" + strCORPID + "'";
|
|
|
DataSet ds = T_ALL_DA.GetAllSQL("select * from op_ctn where BSNO='" + strBSNO + "'");
|
|
|
str = "update " + bstype + " set CNTR1=0,CNTR2=0,CNTR3=0,CNTR4=0,CNTR5=0,CNTR6=0,CNTR7=0,CNTR8=0,CNTR9=0,CNTR10=0,OTCNTR=0,TEU=0 where BSNO='" + strBSNO + "'";
|
|
|
bool bl3 = T_ALL_DA.GetExecuteSqlCommand(str);
|
|
|
if (ds != null)
|
|
|
{
|
|
|
if (ds.Tables[0].Rows.Count > 0)
|
|
|
{
|
|
|
foreach (DataTable myTable in ds.Tables)
|
|
|
{
|
|
|
foreach (DataRow myRow in myTable.Rows)//遍历表
|
|
|
{
|
|
|
strCNTRNO += myRow["CNTRNO"].ToString().Trim() + "/" + myRow["SEALNO"].ToString().Trim() + "/" + myRow["CTNALL"].ToString().Replace("'", "''").Trim() + "\r\n";
|
|
|
|
|
|
}
|
|
|
}
|
|
|
//
|
|
|
|
|
|
|
|
|
}
|
|
|
str = "update op_seae set CNTRSEALNO='" + strCNTRNO + "' where BSNO='" + strBSNO + "'";
|
|
|
bool bl = T_ALL_DA.GetExecuteSqlCommand(str);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public static void getCNTRTOTAL2 ( string strBSNO, string bstype )
|
|
|
{
|
|
|
int iTEU = 0;
|
|
|
string strCNTRTOTAL = "";
|
|
|
string strCNTRNO = "";
|
|
|
string str = "";
|
|
|
decimal pkgs = 0;
|
|
|
decimal kgs = 0;
|
|
|
decimal cbm = 0;
|
|
|
string kindpkgs = "";
|
|
|
var SEALNONOPKGS = MsSysParamSetDAL.GetData("PARAMNAME='SEALNONOPKGS'").PARAMVALUE;
|
|
|
T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
|
|
|
DataSet dsDisp = T_ALL_DA.GetAllSQL("select * from code_ctn_disp");// where CORPID = '" + strCORPID + "'";
|
|
|
DataSet ds = T_ALL_DA.GetAllSQL("select * from op_ctn where BSNO='" + strBSNO + "'");
|
|
|
str = "update " + bstype + " set CNTR1=0,CNTR2=0,CNTR3=0,CNTR4=0,CNTR5=0,CNTR6=0,CNTR7=0,CNTR8=0,CNTR9=0,CNTR10=0,OTCNTR=0 where BSNO='" + strBSNO + "'";
|
|
|
bool bl3 = T_ALL_DA.GetExecuteSqlCommand(str);
|
|
|
if (ds != null)
|
|
|
{
|
|
|
if (ds.Tables[0].Rows.Count > 0)
|
|
|
{
|
|
|
foreach (DataTable myTable in ds.Tables)
|
|
|
{
|
|
|
foreach (DataRow myRow in myTable.Rows)//遍历表
|
|
|
{
|
|
|
|
|
|
if (SEALNONOPKGS == "1")
|
|
|
{
|
|
|
strCNTRNO += myRow["CNTRNO"].ToString().Trim() + "/" + myRow["SEALNO"].ToString().Trim() + "/" + myRow["CTNALL"].ToString().Replace("'", "''").Trim() + "\r\n";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
|
|
|
strCNTRNO += myRow["CNTRNO"].ToString().Trim() + "/" + myRow["SEALNO"].ToString().Trim() + "/" + myRow["CTNALL"].ToString().Replace("'", "''").Trim()
|
|
|
+ "/" + myRow["PKGS"].ToString().Trim() + myRow["KINDPKGS"].ToString().Trim() + "/" + myRow["KGS"].ToString().Trim() + "KGS/" + myRow["CBM"].ToString().Trim() + "CBM\r\n";
|
|
|
}
|
|
|
iTEU += int.Parse(myRow["TEU"].ToString().Trim());
|
|
|
pkgs += Convert.ToDecimal(myRow["PKGS"].ToString().Trim());
|
|
|
kgs += Convert.ToDecimal(myRow["KGS"].ToString().Trim());
|
|
|
cbm += Convert.ToDecimal(myRow["CBM"].ToString().Trim());
|
|
|
kindpkgs = myRow["KINDPKGS"].ToString().Trim();
|
|
|
}
|
|
|
}
|
|
|
//
|
|
|
|
|
|
//
|
|
|
str = "select CTNALL,sum(CTNNUM) as hj from op_ctn where BSNO='" + strBSNO + "' group by CTNALL order by CTNALL";
|
|
|
ds = T_ALL_DA.GetAllSQL(str);
|
|
|
foreach (DataTable myTable in ds.Tables)
|
|
|
{
|
|
|
foreach (DataRow myRow in myTable.Rows)//遍历表
|
|
|
{
|
|
|
strCNTRTOTAL += myRow["CTNALL"].ToString().Replace("'", "''").Trim() + "*" + myRow["hj"].ToString().Trim() + " / ";
|
|
|
//
|
|
|
if (dsDisp == null)
|
|
|
{
|
|
|
string sHJ = T_ALL_DA.GetStrSQL("hj", "select sum(CTNNUM) as hj from op_ctn where BSNO='" + strBSNO + "'");
|
|
|
str = "update " + bstype + " set OTCNTR=OTCNTR+" + myRow["hj"].ToString().Trim() + " where BSNO='" + strBSNO + "'";
|
|
|
bool bl2 = T_ALL_DA.GetExecuteSqlCommand(str);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
int j = 0;
|
|
|
for (int i = 1; i < 11; i++)
|
|
|
{
|
|
|
if (dsDisp.Tables[0].Rows[0][i].ToString().Trim().Equals(myRow["CTNALL"].ToString().Replace("'", "''").Trim()))
|
|
|
{
|
|
|
str = "update " + bstype + " set CNTR" + i + "=CNTR" + i + "+" + myRow["hj"].ToString().Trim() + " where BSNO='" + strBSNO + "'";
|
|
|
j = j + 1;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
if (j == 0)
|
|
|
{
|
|
|
str = "update " + bstype + " set OTCNTR=OTCNTR+" + myRow["hj"].ToString().Trim() + " where BSNO='" + strBSNO + "'";
|
|
|
}
|
|
|
bool bl2 = T_ALL_DA.GetExecuteSqlCommand(str);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
strCNTRTOTAL = strCNTRTOTAL.Trim().Substring(0, strCNTRTOTAL.Trim().Length - 1);
|
|
|
}
|
|
|
}
|
|
|
str = "update op_seae set CNTRTOTAL='" + strCNTRTOTAL + "',CNTRSEALNO='" + strCNTRNO + "',TEU=" + iTEU + ",PKGS=" + pkgs + ",KGS=" + kgs + ",CBM=" + cbm + ",NOPKGS='" + pkgs.ToString() + kindpkgs + "',GROSSWEIGHT='" + kgs.ToString() + "KGS',MEASUREMENT='" + cbm.ToString() + "CBM' where BSNO='" + strBSNO + "'";
|
|
|
bool bl = T_ALL_DA.GetExecuteSqlCommand(str);
|
|
|
}
|
|
|
|
|
|
public static void getCNTRTOTALBill ( string strBSNO )
|
|
|
{
|
|
|
int iTEU = 0;
|
|
|
string strCNTRTOTAL = "";
|
|
|
string strCNTRNO = "";
|
|
|
string str = "";
|
|
|
decimal pkgs = 0;
|
|
|
decimal kgs = 0;
|
|
|
decimal cbm = 0;
|
|
|
string kindpkgs = "";
|
|
|
var SEALNONOPKGS = MsSysParamSetDAL.GetData("PARAMNAME='SEALNONOPKGS'").PARAMVALUE;
|
|
|
T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
|
|
|
DataSet dsDisp = T_ALL_DA.GetAllSQL("select * from code_ctn_disp");// where CORPID = '" + strCORPID + "'";
|
|
|
DataSet ds = T_ALL_DA.GetAllSQL("select * from op_ctn where BSNO='" + strBSNO + "'");
|
|
|
if (ds != null)
|
|
|
{
|
|
|
if (ds.Tables[0].Rows.Count > 0)
|
|
|
{
|
|
|
foreach (DataTable myTable in ds.Tables)
|
|
|
{
|
|
|
foreach (DataRow myRow in myTable.Rows)//遍历表
|
|
|
{
|
|
|
if (SEALNONOPKGS == "1")
|
|
|
{
|
|
|
strCNTRNO += myRow["CNTRNO"].ToString().Trim() + "/" + myRow["SEALNO"].ToString().Trim() + "/" + myRow["CTNALL"].ToString().Replace("'", "''").Trim() + "\r\n";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
|
|
|
strCNTRNO += myRow["CNTRNO"].ToString().Trim() + "/" + myRow["SEALNO"].ToString().Trim() + "/" + myRow["CTNALL"].ToString().Replace("'", "''").Trim()
|
|
|
+ "/" + myRow["PKGS"].ToString().Trim() + myRow["KINDPKGS"].ToString().Trim() + "/" + myRow["KGS"].ToString().Trim() + "KGS/" + myRow["CBM"].ToString().Trim() + "CBM\r\n";
|
|
|
}
|
|
|
iTEU += int.Parse(myRow["TEU"].ToString().Trim());
|
|
|
pkgs += Convert.ToDecimal(myRow["PKGS"].ToString().Trim());
|
|
|
kgs += Convert.ToDecimal(myRow["KGS"].ToString().Trim());
|
|
|
cbm += Convert.ToDecimal(myRow["CBM"].ToString().Trim());
|
|
|
kindpkgs = myRow["KINDPKGS"].ToString().Trim();
|
|
|
}
|
|
|
}
|
|
|
//
|
|
|
|
|
|
//
|
|
|
str = "select CTNALL,sum(CTNNUM) as hj from op_ctn where BSNO='" + strBSNO + "' group by CTNALL order by CTNALL";
|
|
|
ds = T_ALL_DA.GetAllSQL(str);
|
|
|
foreach (DataTable myTable in ds.Tables)
|
|
|
{
|
|
|
foreach (DataRow myRow in myTable.Rows)//遍历表
|
|
|
{
|
|
|
strCNTRTOTAL += myRow["CTNALL"].ToString().Replace("'", "''").Trim() + "*" + myRow["hj"].ToString().Trim() + " / ";
|
|
|
}
|
|
|
}
|
|
|
strCNTRTOTAL = strCNTRTOTAL.Trim().Substring(0, strCNTRTOTAL.Trim().Length - 1);
|
|
|
}
|
|
|
}
|
|
|
str = "update op_seae_billmanage set CNTRTOTAL='" + strCNTRTOTAL + "',CNTRSEALNO='" + strCNTRNO + "' where AS_ID='" + strBSNO + "'";
|
|
|
bool bl = T_ALL_DA.GetExecuteSqlCommand(str);
|
|
|
}
|
|
|
|
|
|
|
|
|
public static void getCNTRTOTALAllBill(string strBSNO)
|
|
|
{
|
|
|
int iTEU = 0;
|
|
|
string strCNTRTOTAL = "";
|
|
|
string strCNTRNO = "";
|
|
|
string str = "";
|
|
|
decimal pkgs = 0;
|
|
|
decimal kgs = 0;
|
|
|
decimal cbm = 0;
|
|
|
string kindpkgs = "";
|
|
|
var SEALNONOPKGS = MsSysParamSetDAL.GetData("PARAMNAME='SEALNONOPKGS'").PARAMVALUE;
|
|
|
T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
|
|
|
DataSet dsDisp = T_ALL_DA.GetAllSQL("select * from code_ctn_disp");// where CORPID = '" + strCORPID + "'";
|
|
|
DataSet ds = T_ALL_DA.GetAllSQL("select * from op_ctn where BSNO='" + strBSNO + "'");
|
|
|
if (ds != null)
|
|
|
{
|
|
|
if (ds.Tables[0].Rows.Count > 0)
|
|
|
{
|
|
|
foreach (DataTable myTable in ds.Tables)
|
|
|
{
|
|
|
foreach (DataRow myRow in myTable.Rows)//遍历表
|
|
|
{
|
|
|
if (SEALNONOPKGS == "1")
|
|
|
{
|
|
|
strCNTRNO += myRow["CNTRNO"].ToString().Trim() + "/" + myRow["SEALNO"].ToString().Trim() + "/" + myRow["CTNALL"].ToString().Replace("'", "''").Trim() + "\r\n";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strCNTRNO += myRow["CNTRNO"].ToString().Trim() + "/" + myRow["SEALNO"].ToString().Trim() + "/" + myRow["CTNALL"].ToString().Replace("'", "''").Trim()
|
|
|
+ "/" + myRow["PKGS"].ToString().Trim() + myRow["KINDPKGS"].ToString().Trim() + "/" + myRow["KGS"].ToString().Trim() + "KGS/" + myRow["CBM"].ToString().Trim() + "CBM\r\n";
|
|
|
}
|
|
|
iTEU += int.Parse(myRow["TEU"].ToString().Trim());
|
|
|
pkgs += Convert.ToDecimal(myRow["PKGS"].ToString().Trim());
|
|
|
kgs += Convert.ToDecimal(myRow["KGS"].ToString().Trim());
|
|
|
cbm += Convert.ToDecimal(myRow["CBM"].ToString().Trim());
|
|
|
kindpkgs = myRow["KINDPKGS"].ToString().Trim();
|
|
|
}
|
|
|
}
|
|
|
//
|
|
|
|
|
|
//
|
|
|
str = "select CTNALL,sum(CTNNUM) as hj from op_ctn where BSNO='" + strBSNO + "' group by CTNALL order by CTNALL";
|
|
|
ds = T_ALL_DA.GetAllSQL(str);
|
|
|
foreach (DataTable myTable in ds.Tables)
|
|
|
{
|
|
|
foreach (DataRow myRow in myTable.Rows)//遍历表
|
|
|
{
|
|
|
strCNTRTOTAL += myRow["CTNALL"].ToString().Replace("'", "''").Trim() + "*" + myRow["hj"].ToString().Trim() + " / ";
|
|
|
}
|
|
|
}
|
|
|
strCNTRTOTAL = strCNTRTOTAL.Trim().Substring(0, strCNTRTOTAL.Trim().Length - 1);
|
|
|
}
|
|
|
}
|
|
|
str = "update op_seae_billmanage set CNTRTOTAL='" + strCNTRTOTAL + "',CNTRSEALNO='" + strCNTRNO + "',PKGS = " + pkgs + ",KGS = " + kgs + ",CBM = " + cbm + ",NOPKGS = '" + pkgs.ToString() + kindpkgs + "',GROSSWEIGHT = '" + kgs.ToString() + "KGS',MEASUREMENT = '" + cbm.ToString() + "CBM' where AS_ID='" + strBSNO + "'";
|
|
|
bool bl = T_ALL_DA.GetExecuteSqlCommand(str);
|
|
|
}
|
|
|
|
|
|
//判断单号是否重复
|
|
|
static public int GetRdCount ( string strCondition )
|
|
|
{
|
|
|
var strSql = new StringBuilder();
|
|
|
strSql.Append("SELECT Count(BSNO) AS CT from op_seae (NOLOCK) ");
|
|
|
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 void SetFenInfo(ref MsSeaeOrder headData)
|
|
|
//{
|
|
|
// var Marks = headData.MARKS;
|
|
|
// var Description = headData.DESCRIPTION;
|
|
|
// if (bodyList != null)
|
|
|
// {
|
|
|
// foreach (var enumValue in bodyList)
|
|
|
// {
|
|
|
// if(Marks.Contains(enumValue.ma))
|
|
|
// }
|
|
|
// }
|
|
|
// headData.CNTRTOTAL = cntr;
|
|
|
// headData.TEU = teu;
|
|
|
//}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region 退舱
|
|
|
public static DBResult CancelShippingOrder ( string bsno,string type,string op,string isdelctn)
|
|
|
{
|
|
|
var result = new DBResult();
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
using (var conn = db.CreateConnection())
|
|
|
{
|
|
|
conn.Open();
|
|
|
var tran = conn.BeginTransaction();
|
|
|
try
|
|
|
{
|
|
|
|
|
|
|
|
|
if (type == "1")
|
|
|
{
|
|
|
if (isdelctn == "1")
|
|
|
{
|
|
|
var cmdUpdate = db.GetSqlStringCommand("update op_seae set iscancel='" + type + "',TEU=0,CNTR1=0,CNTR2=0,CNTR3=0,CNTR4=0,CNTR5=0,CNTR6=0,CNTR7=0,CNTR8=0,CNTR9=0,CNTR10=0,OTCNTR=0,CNTRTOTAL='',BLFRT='FREE',YARD='退舱',ISSUETYPE='无单' where bsno='" + bsno + "'");
|
|
|
db.ExecuteNonQuery(cmdUpdate, tran);
|
|
|
var cmdDeletectn = db.GetSqlStringCommand("delete from op_ctn where bsno='" + bsno + "'");
|
|
|
db.ExecuteNonQuery(cmdDeletectn, tran);
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
var cmdUpdate = db.GetSqlStringCommand("update op_seae set iscancel='" + type + "' where bsno='" + bsno + "'");
|
|
|
db.ExecuteNonQuery(cmdUpdate, tran);
|
|
|
}
|
|
|
|
|
|
|
|
|
var cmdDelete = db.GetSqlStringCommand("insert into op_status(ST_ID,BSNO,STATUS,ISCOMP,COMPTIME,INPUTTIME,STTYPE,COMPOP,INPUTBY) values(NEWID(),'" + bsno + "','退舱',1,'" + DateTime.Now.ToString() + "','" + DateTime.Now.ToString() + "','1','" + op + "','" + op + "')");
|
|
|
db.ExecuteNonQuery(cmdDelete, tran);
|
|
|
var cmdUpdateOrder = db.GetSqlStringCommand("update crm_seaeorder set ORSTATUS=4 where bsno='" + bsno + "'");
|
|
|
db.ExecuteNonQuery(cmdUpdateOrder, tran);
|
|
|
}
|
|
|
else {
|
|
|
var cmdUpdate = db.GetSqlStringCommand("update op_seae set iscancel='" + type + "' where bsno='" + bsno + "'");
|
|
|
db.ExecuteNonQuery(cmdUpdate, tran);
|
|
|
var cmdDelete = db.GetSqlStringCommand("insert into op_status(ST_ID,BSNO,STATUS,ISCOMP,COMPTIME,INPUTTIME,STTYPE,COMPOP,INPUTBY) values(NEWID(),'" + bsno + "','接受委托',1,'" + DateTime.Now.ToString() + "','" + DateTime.Now.ToString() + "','1','" + op + "','" + op + "')");
|
|
|
db.ExecuteNonQuery(cmdDelete, tran);
|
|
|
var cmdUpdateOrder = db.GetSqlStringCommand("update crm_seaeorder set ORSTATUS=-1 where bsno='" + bsno + "'");
|
|
|
db.ExecuteNonQuery(cmdUpdateOrder, tran);
|
|
|
}
|
|
|
|
|
|
tran.Commit();
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
tran.Rollback();
|
|
|
|
|
|
result.Success = false;
|
|
|
result.Message = "退舱出现错误,请重试或联系系统管理员";
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (type == "1")
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
|
|
|
Database db2 = DatabaseFactory.CreateDatabase("SHIPPINGBOX");
|
|
|
using (var conn2 = db2.CreateConnection())
|
|
|
{
|
|
|
conn2.Open();
|
|
|
var tran2 = conn2.BeginTransaction();
|
|
|
try
|
|
|
{
|
|
|
//var cmdDelete = db.GetSqlStringCommand("insert into op_status(ST_ID,BSNO,STATUS,ISCOMP,COMPTIME,INPUTTIME,STTYPE) values('" + bsno + "','" + bsno + "','退舱',1,'" + DateTime.Now.ToString() + "','" + DateTime.Now.ToString() + "','1')");
|
|
|
//db.ExecuteNonQuery(cmdDelete, tran);
|
|
|
var cmdUpdate = db2.GetSqlStringCommand("update BookingCargoSpace set BSSTATUS='CI20150711000007' where BSNO='" + bsno + "'");
|
|
|
db2.ExecuteNonQuery(cmdUpdate, tran2);
|
|
|
|
|
|
tran2.Commit();
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
tran2.Rollback();
|
|
|
|
|
|
result.Success = false;
|
|
|
result.Message = "退舱出现错误,请重试或联系系统管理员";
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
}
|
|
|
|
|
|
}
|
|
|
result.Success = true;
|
|
|
result.Message = "操作成功";
|
|
|
return result;
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 取消自动锁定
|
|
|
public static DBResult CancelCloseShippingOrder(string bsno, string type)
|
|
|
{
|
|
|
var result = new DBResult();
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
using (var conn = db.CreateConnection())
|
|
|
{
|
|
|
conn.Open();
|
|
|
var tran = conn.BeginTransaction();
|
|
|
try
|
|
|
{
|
|
|
if (type == "1")
|
|
|
{
|
|
|
var cmdUpdate = db.GetSqlStringCommand("update op_seae set STATUS5=1 where bsno='" + bsno + "'");
|
|
|
db.ExecuteNonQuery(cmdUpdate, tran);
|
|
|
}
|
|
|
else {
|
|
|
var cmdUpdate = db.GetSqlStringCommand("update op_seae set STATUS5=0 where bsno='" + bsno + "'");
|
|
|
db.ExecuteNonQuery(cmdUpdate, tran);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
tran.Commit();
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
tran.Rollback();
|
|
|
|
|
|
result.Success = false;
|
|
|
result.Message = "退舱出现错误,请重试或联系系统管理员";
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
result.Success = true;
|
|
|
result.Message = "操作成功";
|
|
|
return result;
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 删除
|
|
|
public static DBResult DeleteDetail ( string bsno )
|
|
|
{
|
|
|
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 + "'");
|
|
|
db.ExecuteNonQuery(cmdDelete, tran);
|
|
|
var cmdDeleteams = db.GetSqlStringCommand("delete from op_seae_ams where BSNO='" + bsno + "'");
|
|
|
db.ExecuteNonQuery(cmdDeleteams, tran);
|
|
|
var cmdDeletebill = db.GetSqlStringCommand("delete from op_seae_billmanage where BSNO='" + bsno + "'");
|
|
|
db.ExecuteNonQuery(cmdDeletebill, tran);
|
|
|
var cmdDeleteamend = db.GetSqlStringCommand("delete from op_amend where PARENTID='" + bsno + "'");
|
|
|
db.ExecuteNonQuery(cmdDeleteamend, 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 ( MsOpSeaeDetail headData,string userid,string companyid )
|
|
|
{
|
|
|
var result = new DBResult();
|
|
|
|
|
|
var OPLETTERTRUCKCANTDELCTN= MsSysParamSetDAL.GetData("PARAMNAME='OPLETTERTRUCKCANTDELCTN'").PARAMVALUE;
|
|
|
|
|
|
T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
|
|
|
|
|
|
var BLCOUNT = T_ALL_DA.GetStrSQL("BLCOUNT", "select count(*) BLCOUNT from op_letter_yard_ctn C LEFT JOIN op_letter L ON (L.LE_ID=C.LE_ID) WHERE L.BSNO = '"+headData.BSNO+"'");
|
|
|
if (BLCOUNT == "0"|| OPLETTERTRUCKCANTDELCTN=="0")
|
|
|
{
|
|
|
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
using (var conn = db.CreateConnection())
|
|
|
{
|
|
|
conn.Open();
|
|
|
var tran = conn.BeginTransaction();
|
|
|
try
|
|
|
{
|
|
|
var cmdDelete = db.GetSqlStringCommand("delete from op_ctn_detail where CTN_ID='" + headData.CTN_ID + "'");
|
|
|
db.ExecuteNonQuery(cmdDelete, tran);
|
|
|
|
|
|
cmdDelete = db.GetSqlStringCommand("delete from op_ctn where CTN_ID='" + headData.CTN_ID + "' and BSNO='" + headData.BSNO + "'");
|
|
|
db.ExecuteNonQuery(cmdDelete, tran);
|
|
|
|
|
|
|
|
|
var blUpSQL = " insert into sys_log(GID,NAME,LOGTYPE,LOGTIME,LOGCONTENT,CREATEUSER) values(NEWID(),'" + headData.BSNO + "','删除集装箱明细','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" + headData.CNTRNO + "','" + userid + "')";
|
|
|
bool bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
|
|
|
if (companyid == "Comcab2d43f60454327af30a131fc1d3abd")
|
|
|
{
|
|
|
var BSSTATUS = T_ALL_DA.GetStrSQL("BSSTATUS", "select BSSTATUS from OP_SEAE where BSNO='" + headData.BSNO + "'");
|
|
|
if (BSSTATUS == "1" || BSSTATUS.ToUpper() == "TRUE")
|
|
|
{
|
|
|
var mailtopic = "提醒:删除集装箱明细";
|
|
|
var mailbody = "提醒:删除集装箱明细" + headData.CNTRNO + " USERID:" + userid;
|
|
|
SendEmail se = new SendEmail("CS003@dongshengsoft.com", "admin@dongshengsoft.com", "", "", mailtopic, mailbody, false);
|
|
|
se.SetSmtp("admin@dongshengsoft.com", "ds!@#)(*", "smtpcom.263xmail.com", 465, false, System.Net.Mail.MailPriority.Normal);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
tran.Commit();
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
tran.Rollback();
|
|
|
result.Success = false;
|
|
|
result.Message = "删除出现错误,请重试或联系系统管理员";
|
|
|
return result;
|
|
|
}
|
|
|
}
|
|
|
getCNTRTOTAL(headData.BSNO, "op_seae");
|
|
|
|
|
|
} else
|
|
|
{
|
|
|
result.Success = false;
|
|
|
result.Message = "删除出现错误,已生成派车,不允许删除集装箱!";
|
|
|
return result;
|
|
|
|
|
|
}
|
|
|
//
|
|
|
//
|
|
|
result.Success = true;
|
|
|
result.Message = "操作成功";
|
|
|
return result;
|
|
|
}
|
|
|
#region 2018年2月7日17:29:23 鼎世 李进举
|
|
|
//导入主单信息是删除原有集装箱分箱信息
|
|
|
public static void DeleteDetail2 (string bsno )
|
|
|
{
|
|
|
if (bsno!=""&&bsno!=null)
|
|
|
{
|
|
|
var result = new DBResult();
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
string sql = "delete from op_ctn where bsno = '" + bsno + "' ";
|
|
|
db.ExecuteNonQuery(CommandType.Text, sql);
|
|
|
}
|
|
|
|
|
|
getCNTRTOTAL(bsno, "op_seae");
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
#endregion
|
|
|
|
|
|
#region 批量修改
|
|
|
public static DBResult Modify ( List<MsOpSeae> bodyList, MsOpSeae modifydata,string companyid )
|
|
|
{
|
|
|
var result = new DBResult();
|
|
|
|
|
|
var head = ChMonthCloseDAL.ChMonthCloseDAL.GetData("",companyid);
|
|
|
|
|
|
string errstr = "";
|
|
|
int i = 0;
|
|
|
var ACCDATESAMEETD=MsSysParamSetDAL.GetData("PARAMNAME='ACCDATESAMEETD'").PARAMVALUE;
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
using (var conn = db.CreateConnection())
|
|
|
{
|
|
|
conn.Open();
|
|
|
var tran = conn.BeginTransaction();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
var strSql = new StringBuilder();
|
|
|
var strSqlBL = new StringBuilder();
|
|
|
strSql.Append("update op_seae set bsno=bsno ");
|
|
|
strSqlBL.Append("update op_seae_billmanage set AS_ID=AS_ID ");
|
|
|
if (modifydata.YARD != "" && modifydata.YARD != null)
|
|
|
strSql.Append(",YARD=@YARD");
|
|
|
if (modifydata.HBLNO != "" && modifydata.HBLNO != null)
|
|
|
strSql.Append(",HBLNO=@HBLNO");
|
|
|
if (modifydata.CARRIER != "" && modifydata.CARRIER != null)
|
|
|
strSql.Append(",CARRIER=@CARRIER");
|
|
|
if (modifydata.FORWARDER != "" && modifydata.FORWARDER != null)
|
|
|
strSql.Append(",FORWARDER=@FORWARDER");
|
|
|
if (modifydata.TRUCKER != "" && modifydata.TRUCKER != null)
|
|
|
strSql.Append(",TRUCKER=@TRUCKER");
|
|
|
if (modifydata.CUSTOMSER != "" && modifydata.CUSTOMSER != null)
|
|
|
strSql.Append(",CUSTOMSER=@CUSTOMSER");
|
|
|
if (modifydata.CUSTOMERNAME != "" && modifydata.CUSTOMERNAME != null)
|
|
|
strSql.Append(",CUSTOMERNAME=@CUSTOMERNAME");
|
|
|
if (modifydata.LANE != "" && modifydata.LANE != null)
|
|
|
strSql.Append(",LANE=@LANE");
|
|
|
if (modifydata.AGENTID != "" && modifydata.AGENTID != null)
|
|
|
strSql.Append(",AGENTID=@AGENTID");
|
|
|
if (modifydata.PORTLOAD != "" && modifydata.PORTLOAD != null)
|
|
|
strSql.Append(",PORTLOAD=@PORTLOAD");
|
|
|
|
|
|
if (modifydata.PORTDISCHARGE != "" && modifydata.PORTDISCHARGE != null)
|
|
|
strSql.Append(",PORTDISCHARGE=@PORTDISCHARGE");
|
|
|
if (modifydata.PORTLOADID != "" && modifydata.PORTLOADID != null)
|
|
|
strSql.Append(",PORTLOADID=@PORTLOADID");
|
|
|
if (modifydata.PORTDISCHARGEID != "" && modifydata.PORTDISCHARGEID != null)
|
|
|
strSql.Append(",PORTDISCHARGEID=@PORTDISCHARGEID");
|
|
|
if (modifydata.DESTINATION != "" && modifydata.DESTINATION != null)
|
|
|
strSql.Append(",DESTINATION=@DESTINATION");
|
|
|
if (modifydata.DESTINATIONID != "" && modifydata.DESTINATIONID != null)
|
|
|
strSql.Append(",DESTINATIONID=@DESTINATIONID");
|
|
|
if (modifydata.PLACEDELIVERY != "" && modifydata.PLACEDELIVERY != null)
|
|
|
strSql.Append(",PLACEDELIVERY=@PLACEDELIVERY");
|
|
|
if (modifydata.PLACEDELIVERYID != "" && modifydata.PLACEDELIVERYID != null)
|
|
|
strSql.Append(",PLACEDELIVERYID=@PLACEDELIVERYID");
|
|
|
|
|
|
if (modifydata.VESSEL != "" && modifydata.VESSEL != null)
|
|
|
{
|
|
|
strSql.Append(",VESSEL=@VESSEL");
|
|
|
strSqlBL.Append(",VESSEL=@VESSEL");
|
|
|
|
|
|
}
|
|
|
if (modifydata.VESSELID != "" && modifydata.VESSELID != null)
|
|
|
strSql.Append(",VESSELID=@VESSELID");
|
|
|
if (modifydata.VOYNO != "" && modifydata.VOYNO != null)
|
|
|
{
|
|
|
strSql.Append(",VOYNO=@VOYNO");
|
|
|
strSqlBL.Append(",VOYNO=@VOYNO");
|
|
|
|
|
|
}
|
|
|
if (modifydata.ETD != "" && modifydata.ETD != null)
|
|
|
{
|
|
|
strSql.Append(",ETD=@ETD");
|
|
|
strSqlBL.Append(",ETD=@ETD");
|
|
|
|
|
|
if (ACCDATESAMEETD=="1") strSql.Append(",ACCDATE=@ACCDATE");
|
|
|
|
|
|
}
|
|
|
if (modifydata.ACCDATE != "" && modifydata.ACCDATE != null)
|
|
|
strSql.Append(",ACCDATE=@ACCDATE");
|
|
|
if (modifydata.SALEDEPT != "" && modifydata.SALEDEPT != null)
|
|
|
strSql.Append(",SALEDEPT=@SALEDEPT");
|
|
|
if (modifydata.CLOSINGDATE != "" && modifydata.CLOSINGDATE != null)
|
|
|
strSql.Append(",CLOSINGDATE=@CLOSINGDATE");
|
|
|
if (modifydata.CLOSEDOCDATE != "" && modifydata.CLOSEDOCDATE != null)
|
|
|
strSql.Append(",CLOSEDOCDATE=@CLOSEDOCDATE");
|
|
|
if (modifydata.ATD != "" && modifydata.ATD != null)
|
|
|
strSql.Append(",ATD=@ATD");
|
|
|
|
|
|
if (modifydata.AGENT != "" && modifydata.AGENT != null)
|
|
|
strSql.Append(",AGENT=@AGENT");
|
|
|
if (modifydata.SHIPAGENCY != "" && modifydata.SHIPAGENCY != null)
|
|
|
strSql.Append(",SHIPAGENCY=@SHIPAGENCY");
|
|
|
if (modifydata.SALE != "" && modifydata.SALE != null)
|
|
|
strSql.Append(",SALE=@SALE");
|
|
|
if (modifydata.CUSTSERVICE != "" && modifydata.CUSTSERVICE != null)
|
|
|
strSql.Append(",CUSTSERVICE=@CUSTSERVICE");
|
|
|
if (modifydata.FRCUSTSERVICE != "" && modifydata.FRCUSTSERVICE != null)
|
|
|
strSql.Append(",FRCUSTSERVICE=@FRCUSTSERVICE");
|
|
|
if (modifydata.DOC != "" && modifydata.DOC != null)
|
|
|
strSql.Append(",DOC=@DOC");
|
|
|
if (modifydata.OP != "" && modifydata.OP != null)
|
|
|
strSql.Append(",OP=@OP");
|
|
|
if (modifydata.BSSOURCE != "" && modifydata.BSSOURCE != null)
|
|
|
strSql.Append(",BSSOURCE=@BSSOURCE");
|
|
|
if (modifydata.BSSOURCEDETAIL != "" && modifydata.BSSOURCEDETAIL != null)
|
|
|
strSql.Append(",BSSOURCEDETAIL=@BSSOURCEDETAIL");
|
|
|
if (modifydata.BLTYPE != "" && modifydata.BLTYPE != null)
|
|
|
strSql.Append(",BLTYPE=@BLTYPE");
|
|
|
if (modifydata.CONTRACTNO != "" && modifydata.CONTRACTNO != null)
|
|
|
strSql.Append(",CONTRACTNO=@CONTRACTNO");
|
|
|
if (modifydata.SERVICECONTRACTNO != "" && modifydata.SERVICECONTRACTNO != null)
|
|
|
strSql.Append(",SERVICECONTRACTNO=@SERVICECONTRACTNO");
|
|
|
if (modifydata.ORDERNO != "" && modifydata.ORDERNO != null)
|
|
|
strSql.Append(",ORDERNO=@ORDERNO");
|
|
|
if (modifydata.ISFUMIGATION) strSql.Append(",ISFUMIGATION=1");
|
|
|
if (modifydata.ISSTORAGE) strSql.Append(",ISSTORAGE=1");
|
|
|
if (modifydata.ISLAND) strSql.Append(",ISLAND=1");
|
|
|
if (modifydata.ISCUSTOMS) strSql.Append(",ISCUSTOMS=1");
|
|
|
if (modifydata.ISINSPECTION) strSql.Append(",ISINSPECTION=1");
|
|
|
if (modifydata.ISBOOKING) strSql.Append(",ISBOOKING=1");
|
|
|
if (modifydata.ISAGENT) strSql.Append(",ISAGENT=1");
|
|
|
if (modifydata.ISHBLNO) strSql.Append(",ISHBLNO=1");
|
|
|
if (modifydata.SERVICE9) strSql.Append(",SERVICE9=1");
|
|
|
if (modifydata.SERVICE10) strSql.Append(",SERVICE10=1");
|
|
|
|
|
|
|
|
|
strSql.Append(" where BSNO=@BSNO ");
|
|
|
|
|
|
strSqlBL.Append(" where BSNO=@BSNO ");
|
|
|
|
|
|
var cmdupdateBL =
|
|
|
db.GetSqlStringCommand(strSqlBL.ToString());
|
|
|
var cmdupdate =
|
|
|
db.GetSqlStringCommand(strSql.ToString());
|
|
|
|
|
|
if (bodyList != null)
|
|
|
{
|
|
|
foreach (var enumValue in bodyList)
|
|
|
{
|
|
|
var opseae = GetData("BSNO='" + enumValue.BSNO + "'");
|
|
|
|
|
|
var isPost = true;
|
|
|
if (Convert.ToDateTime(head.PERIOD + "-01") > Convert.ToDateTime(enumValue.ACCDATE + "-01"))
|
|
|
{
|
|
|
if (errstr == "")
|
|
|
errstr = enumValue.CUSTNO + "此票所在业务已月末结账";
|
|
|
else
|
|
|
errstr = errstr + "," + enumValue.CUSTNO + "此票所在业务已月末结账";
|
|
|
isPost = false;
|
|
|
}
|
|
|
if (opseae.BSSTATUS) {
|
|
|
if (errstr == "")
|
|
|
errstr = enumValue.CUSTNO + "此票所在业务已业务锁定";
|
|
|
else
|
|
|
errstr = errstr + "," + enumValue.CUSTNO + "此票所在业务已业务锁定";
|
|
|
isPost = false;
|
|
|
|
|
|
}
|
|
|
if (!string.IsNullOrEmpty(modifydata.ETD) && !string.IsNullOrEmpty(modifydata.CLOSINGDATE))
|
|
|
{
|
|
|
if (Convert.ToDateTime(modifydata.ETD + " 23:59:59") < Convert.ToDateTime(modifydata.CLOSINGDATE))
|
|
|
{
|
|
|
isPost = false;
|
|
|
errstr = errstr + "," + "截港日期不允许大于开船日期";
|
|
|
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
|
|
|
if (!string.IsNullOrEmpty(opseae.ETD) && !string.IsNullOrEmpty(modifydata.CLOSINGDATE))
|
|
|
{
|
|
|
if (Convert.ToDateTime(opseae.ETD + " 23:59:59") < Convert.ToDateTime(modifydata.CLOSINGDATE))
|
|
|
{
|
|
|
isPost = false;
|
|
|
errstr = errstr + "," + "截港日期不允许大于开船日期";
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (!string.IsNullOrEmpty(modifydata.ETD) && !string.IsNullOrEmpty(modifydata.CLOSEDOCDATE))
|
|
|
{
|
|
|
if (Convert.ToDateTime(modifydata.ETD + " 23:59:59") < Convert.ToDateTime(modifydata.CLOSEDOCDATE))
|
|
|
{
|
|
|
isPost = false;
|
|
|
errstr = errstr + "," + "截单日期不允许大于开船日期";
|
|
|
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if (!string.IsNullOrEmpty(opseae.ETD) && !string.IsNullOrEmpty(modifydata.CLOSEDOCDATE))
|
|
|
{
|
|
|
if (Convert.ToDateTime(opseae.ETD + " 23:59:59") < Convert.ToDateTime(modifydata.CLOSEDOCDATE))
|
|
|
{
|
|
|
isPost = false;
|
|
|
errstr = errstr + "," + "截单日期不允许大于开船日期";
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if (modifydata.ACCDATE != "" && modifydata.ACCDATE != null) {
|
|
|
if (Convert.ToDateTime(head.PERIOD + "-01") > Convert.ToDateTime(modifydata.ACCDATE + "-01"))
|
|
|
{
|
|
|
if (errstr == "")
|
|
|
errstr = enumValue.CUSTNO + "此票所在业务会计期间更改至已月末结账月份";
|
|
|
else
|
|
|
errstr = errstr + "," + enumValue.CUSTNO + "此票所在业务会计期间更改至已月末结账月份";
|
|
|
isPost = false;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
if (modifydata.ETD != "" && modifydata.ETD != null)
|
|
|
{
|
|
|
|
|
|
if (ACCDATESAMEETD == "1")
|
|
|
{
|
|
|
var ACCDATE = Convert.ToDateTime(modifydata.ETD).ToString("yyyy-MM");
|
|
|
if (Convert.ToDateTime(head.PERIOD + "-01") > Convert.ToDateTime(ACCDATE + "-01"))
|
|
|
{
|
|
|
if (errstr == "")
|
|
|
errstr = enumValue.CUSTNO + "此票所在业务会计期间更改至已月末结账月份";
|
|
|
else
|
|
|
errstr = errstr + "," + enumValue.CUSTNO + "此票所在业务会计期间更改至已月末结账月份";
|
|
|
isPost = false;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (modifydata.BLTYPE != "" && modifydata.BLTYPE != null) {
|
|
|
|
|
|
if (modifydata.BLTYPE != "拼箱主票" && modifydata.BLTYPE != "合票主票")
|
|
|
{
|
|
|
var ct = MsOpSeaeDAL.GetRdCount("BSNO<>'" + enumValue.BSNO + "' AND MASTERNO='" + enumValue.BSNO + "' and CORPID='" + companyid + "'");
|
|
|
if (ct != 0)
|
|
|
{
|
|
|
isPost = false;
|
|
|
errstr = "有分票信息,装运方式必须为拼箱主票和合票主票";
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
if (isPost)
|
|
|
{
|
|
|
|
|
|
|
|
|
cmdupdate.Parameters.Clear();
|
|
|
cmdupdateBL.Parameters.Clear();
|
|
|
if (modifydata.YARD != "" && modifydata.YARD != null)
|
|
|
db.AddInParameter(cmdupdate, "@YARD", DbType.String, modifydata.YARD);
|
|
|
if (modifydata.HBLNO != "" && modifydata.HBLNO != null)
|
|
|
db.AddInParameter(cmdupdate, "@HBLNO", DbType.String, modifydata.HBLNO);
|
|
|
|
|
|
if (modifydata.CARRIER != "" && modifydata.CARRIER != null)
|
|
|
db.AddInParameter(cmdupdate, "@CARRIER", DbType.String, modifydata.CARRIER);
|
|
|
if (modifydata.FORWARDER != "" && modifydata.FORWARDER != null)
|
|
|
db.AddInParameter(cmdupdate, "@FORWARDER", DbType.String, modifydata.FORWARDER);
|
|
|
|
|
|
if (modifydata.TRUCKER != "" && modifydata.TRUCKER != null)
|
|
|
db.AddInParameter(cmdupdate, "@TRUCKER", DbType.String, modifydata.TRUCKER);
|
|
|
if (modifydata.CUSTOMSER != "" && modifydata.CUSTOMSER != null)
|
|
|
db.AddInParameter(cmdupdate, "@CUSTOMSER", DbType.String, modifydata.CUSTOMSER);
|
|
|
if (modifydata.CUSTOMERNAME!= "" && modifydata.CUSTOMERNAME != null)
|
|
|
db.AddInParameter(cmdupdate, "@CUSTOMERNAME", DbType.String, modifydata.CUSTOMERNAME);
|
|
|
if (modifydata.LANE != "" && modifydata.LANE != null)
|
|
|
db.AddInParameter(cmdupdate, "@LANE", DbType.String, modifydata.LANE);
|
|
|
if (modifydata.AGENTID != "" && modifydata.AGENTID != null)
|
|
|
db.AddInParameter(cmdupdate, "@AGENTID", DbType.String, modifydata.AGENTID);
|
|
|
if (modifydata.PORTLOAD != "" && modifydata.PORTLOAD != null)
|
|
|
db.AddInParameter(cmdupdate, "@PORTLOAD", DbType.String, modifydata.PORTLOAD);
|
|
|
|
|
|
if (modifydata.PORTDISCHARGE != "" && modifydata.PORTDISCHARGE != null)
|
|
|
db.AddInParameter(cmdupdate, "@PORTDISCHARGE", DbType.String, modifydata.PORTDISCHARGE);
|
|
|
if (modifydata.PORTLOADID != "" && modifydata.PORTLOADID != null)
|
|
|
db.AddInParameter(cmdupdate, "@PORTLOADID", DbType.String, modifydata.PORTLOADID);
|
|
|
if (modifydata.PORTDISCHARGEID != "" && modifydata.PORTDISCHARGEID != null)
|
|
|
db.AddInParameter(cmdupdate, "@PORTDISCHARGEID", DbType.String, modifydata.PORTDISCHARGEID);
|
|
|
if (modifydata.DESTINATION != "" && modifydata.DESTINATION != null)
|
|
|
db.AddInParameter(cmdupdate, "@DESTINATION", DbType.String, modifydata.DESTINATION);
|
|
|
if (modifydata.DESTINATIONID != "" && modifydata.DESTINATIONID != null)
|
|
|
db.AddInParameter(cmdupdate, "@DESTINATIONID", DbType.String, modifydata.DESTINATIONID);
|
|
|
if (modifydata.PLACEDELIVERY!= "" && modifydata.PLACEDELIVERY != null)
|
|
|
db.AddInParameter(cmdupdate, "@PLACEDELIVERY", DbType.String, modifydata.PLACEDELIVERY);
|
|
|
if (modifydata.PLACEDELIVERYID != "" && modifydata.PLACEDELIVERYID != null)
|
|
|
db.AddInParameter(cmdupdate, "@PLACEDELIVERYID", DbType.String, modifydata.PLACEDELIVERYID);
|
|
|
|
|
|
if (modifydata.VESSEL != "" && modifydata.VESSEL != null)
|
|
|
{
|
|
|
db.AddInParameter(cmdupdate, "@VESSEL", DbType.String, modifydata.VESSEL);
|
|
|
db.AddInParameter(cmdupdateBL, "@VESSEL", DbType.String, modifydata.VESSEL);
|
|
|
}
|
|
|
if (modifydata.VESSELID != "" && modifydata.VESSELID != null)
|
|
|
db.AddInParameter(cmdupdate, "@VESSELID", DbType.String, modifydata.VESSELID);
|
|
|
|
|
|
if (modifydata.VOYNO != "" && modifydata.VOYNO != null)
|
|
|
{
|
|
|
db.AddInParameter(cmdupdate, "@VOYNO", DbType.String, modifydata.VOYNO);
|
|
|
db.AddInParameter(cmdupdateBL, "@VOYNO", DbType.String, modifydata.VOYNO);
|
|
|
|
|
|
}
|
|
|
if (modifydata.ETD != "" && modifydata.ETD != null)
|
|
|
{
|
|
|
db.AddInParameter(cmdupdate, "@ETD", DbType.String, modifydata.ETD);
|
|
|
db.AddInParameter(cmdupdateBL, "@ETD", DbType.String, modifydata.ETD);
|
|
|
|
|
|
if (ACCDATESAMEETD == "1")
|
|
|
{
|
|
|
var ACCDATE = Convert.ToDateTime(modifydata.ETD).ToString("yyyy-MM");
|
|
|
db.AddInParameter(cmdupdate, "@ACCDATE", DbType.String, ACCDATE);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
if (modifydata.CLOSINGDATE != "" && modifydata.CLOSINGDATE != null)
|
|
|
db.AddInParameter(cmdupdate, "@CLOSINGDATE", DbType.String, modifydata.CLOSINGDATE);
|
|
|
if (modifydata.CLOSEDOCDATE != "" && modifydata.CLOSEDOCDATE != null)
|
|
|
db.AddInParameter(cmdupdate, "@CLOSEDOCDATE", DbType.String, modifydata.CLOSEDOCDATE);
|
|
|
if (modifydata.ATD != "" && modifydata.ATD != null)
|
|
|
db.AddInParameter(cmdupdate, "@ATD", DbType.String, modifydata.ATD);
|
|
|
if (modifydata.ACCDATE != "" && modifydata.ACCDATE != null)
|
|
|
db.AddInParameter(cmdupdate, "@ACCDATE", DbType.String, modifydata.ACCDATE);
|
|
|
if (modifydata.SALEDEPT != "" && modifydata.SALEDEPT != null)
|
|
|
db.AddInParameter(cmdupdate, "@SALEDEPT", DbType.String, modifydata.SALEDEPT);
|
|
|
if (modifydata.AGENT != "" && modifydata.AGENT != null)
|
|
|
db.AddInParameter(cmdupdate, "@AGENT", DbType.String, modifydata.AGENT);
|
|
|
if (modifydata.SHIPAGENCY != "" && modifydata.SHIPAGENCY != null)
|
|
|
db.AddInParameter(cmdupdate, "@SHIPAGENCY", DbType.String, modifydata.SHIPAGENCY);
|
|
|
|
|
|
if (modifydata.SALE != "" && modifydata.SALE != null)
|
|
|
db.AddInParameter(cmdupdate, "@SALE", DbType.String, modifydata.SALE);
|
|
|
if (modifydata.CUSTSERVICE != "" && modifydata.CUSTSERVICE != null)
|
|
|
db.AddInParameter(cmdupdate, "@CUSTSERVICE", DbType.String, modifydata.CUSTSERVICE);
|
|
|
if (modifydata.FRCUSTSERVICE != "" && modifydata.FRCUSTSERVICE != null)
|
|
|
db.AddInParameter(cmdupdate, "@FRCUSTSERVICE", DbType.String, modifydata.FRCUSTSERVICE);
|
|
|
if (modifydata.DOC != "" && modifydata.DOC != null)
|
|
|
db.AddInParameter(cmdupdate, "@DOC", DbType.String, modifydata.DOC);
|
|
|
if (modifydata.OP!= "" && modifydata.OP != null)
|
|
|
db.AddInParameter(cmdupdate, "@OP", DbType.String, modifydata.OP);
|
|
|
if (modifydata.BSSOURCE != "" && modifydata.BSSOURCE != null)
|
|
|
db.AddInParameter(cmdupdate, "@BSSOURCE", DbType.String, modifydata.BSSOURCE);
|
|
|
if (modifydata.BSSOURCEDETAIL != "" && modifydata.BSSOURCEDETAIL != null)
|
|
|
db.AddInParameter(cmdupdate, "@BSSOURCEDETAIL", DbType.String, modifydata.BSSOURCEDETAIL);
|
|
|
if (modifydata.BLTYPE != "" && modifydata.BLTYPE != null)
|
|
|
db.AddInParameter(cmdupdate, "@BLTYPE", DbType.String, modifydata.BLTYPE);
|
|
|
if (modifydata.CONTRACTNO != "" && modifydata.CONTRACTNO != null)
|
|
|
db.AddInParameter(cmdupdate, "@CONTRACTNO", DbType.String, modifydata.CONTRACTNO);
|
|
|
if (modifydata.SERVICECONTRACTNO != "" && modifydata.SERVICECONTRACTNO != null)
|
|
|
db.AddInParameter(cmdupdate, "@SERVICECONTRACTNO", DbType.String, modifydata.SERVICECONTRACTNO);
|
|
|
if (modifydata.ORDERNO != "" && modifydata.ORDERNO != null)
|
|
|
db.AddInParameter(cmdupdate, "@ORDERNO", DbType.String, modifydata.ORDERNO);
|
|
|
db.AddInParameter(cmdupdate, "@BSNO", DbType.String, enumValue.BSNO);
|
|
|
db.ExecuteNonQuery(cmdupdate, tran);
|
|
|
db.AddInParameter(cmdupdateBL, "@BSNO", DbType.String, enumValue.BSNO);
|
|
|
db.ExecuteNonQuery(cmdupdateBL, tran);
|
|
|
i = i + 1;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
tran.Commit();
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
tran.Rollback();
|
|
|
|
|
|
result.Success = false;
|
|
|
result.Message = "修改出现错误,请重试或联系系统管理员";
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
result.Success = true;
|
|
|
result.Message = "修改成功" + i.ToString() + "票";
|
|
|
if (errstr != "") {
|
|
|
result.Message = result.Message + "(其中" + errstr + " 无法修改)";
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
|
|
|
public static DBResult ModifyIssue(List<MsOpSeae> bodyList, MsOpSeae modifydata, string companyid,string userid)
|
|
|
{
|
|
|
var result = new DBResult();
|
|
|
|
|
|
|
|
|
string errstr = "";
|
|
|
int i = 0;
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
using (var conn = db.CreateConnection())
|
|
|
{
|
|
|
conn.Open();
|
|
|
var tran = conn.BeginTransaction();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
var strSql = new StringBuilder();
|
|
|
strSql.Append("update op_seae set bsno=bsno ");
|
|
|
if (modifydata.ISSUETYPE != "" && modifydata.ISSUETYPE != null)
|
|
|
strSql.Append(",ISSUETYPE=@ISSUETYPE");
|
|
|
strSql.Append(" where BSNO=@BSNO ");
|
|
|
|
|
|
|
|
|
var cmdupdate =
|
|
|
db.GetSqlStringCommand(strSql.ToString());
|
|
|
|
|
|
var cmdInsertLog = db.GetSqlStringCommand("insert into sys_log(GID,NAME,LOGTYPE,LOGTIME,LOGCONTENT,CREATEUSER) values(NEWID(),@BSNO,@LOGTYPE,'" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',@LOGCONTENT,@USERID)");
|
|
|
|
|
|
if (bodyList != null)
|
|
|
{
|
|
|
foreach (var enumValue in bodyList)
|
|
|
{
|
|
|
var opseae = GetData("BSNO='" + enumValue.BSNO + "'");
|
|
|
if (opseae.BLISSUESTATUS== "提单签入"|| opseae.BLISSUESTATUS == "提单签出")
|
|
|
{
|
|
|
if (errstr == "")
|
|
|
errstr = enumValue.CUSTNO + "此票所在业务已提单签入或签出";
|
|
|
else
|
|
|
errstr = errstr + "," + enumValue.CUSTNO + "此票所在业务已提单签入或签出";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
|
|
|
|
|
|
cmdupdate.Parameters.Clear();
|
|
|
if (modifydata.ISSUETYPE != "" && modifydata.ISSUETYPE != null)
|
|
|
db.AddInParameter(cmdupdate, "@ISSUETYPE", DbType.String, modifydata.ISSUETYPE);
|
|
|
db.AddInParameter(cmdupdate, "@BSNO", DbType.String, enumValue.BSNO);
|
|
|
db.ExecuteNonQuery(cmdupdate, tran);
|
|
|
i = i + 1;
|
|
|
cmdInsertLog.Parameters.Clear();
|
|
|
db.AddInParameter(cmdInsertLog, "@BSNO", DbType.String, enumValue.BSNO);
|
|
|
db.AddInParameter(cmdInsertLog, "@LOGTYPE", DbType.String, "更改签单方式");
|
|
|
db.AddInParameter(cmdInsertLog, "@LOGCONTENT", DbType.String, "签单方式更新为"+ modifydata.ISSUETYPE);
|
|
|
db.AddInParameter(cmdInsertLog, "@USERID", DbType.String, userid);
|
|
|
db.ExecuteNonQuery(cmdInsertLog, tran);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
tran.Commit();
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
tran.Rollback();
|
|
|
|
|
|
result.Success = false;
|
|
|
result.Message = "修改出现错误,请重试或联系系统管理员";
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
result.Success = true;
|
|
|
result.Message = "修改成功" + i.ToString() + "票";
|
|
|
if (errstr != "")
|
|
|
{
|
|
|
result.Message = result.Message + "(其中" + errstr + " 无法修改)";
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region 拼箱操作
|
|
|
public static DBResult SaveFenList ( string bsno, List<MsOpSeae> bodyList, string corpid )
|
|
|
{
|
|
|
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_seae([BSNO],[MASTERNO],[ORDERTYPE],[CUSTNO],[MBLNO],[HBLNO],[BSSTATUS],[FEESTATUS],[BSDATE]
|
|
|
,[ACCDATE],[CUSTOMERNAME],[INPUTBY],[OP],[CUSTSERVICE],[SALE],[CORPID]
|
|
|
,[SALEDEPT],[CREATETIME],[VESSEL],[VOYNO],[ETD],[CLOSINGDATE],[ETA]
|
|
|
,[SHIPPERID],[SHIPPER],[CONSIGNEEID],[CONSIGNEE],[NOTIFYPARTYID],[NOTIFYPARTY],[BSSOURCE]
|
|
|
,[BSSOURCEDETAIL],[GOODSNAME],[NOBILL],[ISSUETYPE],[MARKS],[DESCRIPTION],[HSCODE]
|
|
|
,[PORTLOADID],[PORTLOAD],[PORTDISCHARGEID],[PORTDISCHARGE],[PLACEDELIVERYID],[PLACEDELIVERY]
|
|
|
,[DESTINATIONID],[DESTINATION],[BLTYPE],[AGENTID],[AGENT],[YARD]
|
|
|
,[BLFRT],[PREPARDAT],[PAYABLEAT],[SERVICE],[NOPKGS],[GROSSWEIGHT]
|
|
|
,[MEASUREMENT],[PKGS],[KINDPKGS],[CBM],[TOTALNO],[KGS],[LANE],[CARRIER],[FORWARDER]
|
|
|
,[CARGOID],[REMARK],[PLACERECEIPTID],[PlACERECEIPT],[VESSELID],[CNTR1],[CNTR2],[CNTR3],[CNTR4],[CNTR5]
|
|
|
,[CNTR6],[CNTR7],[CNTR8],[CNTR9],[CNTR10],[OTCNTR],[TEU],[CUSTOMSNUM],[INAMOUT],ISVOU,ISCONTAINERSOC)
|
|
|
VALUES
|
|
|
(@BSNO,@MASTERNO,@ORDERTYPE,@CUSTNO,@MBLNO,@HBLNO,@BSSTATUS,@FEESTATUS,@BSDATE
|
|
|
,@ACCDATE,@CUSTOMERNAME,@INPUTBY,@OP,@CUSTSERVICE,@SALE,@CORPID
|
|
|
,@SALEDEPT,@CREATETIME,@VESSEL,@VOYNO,@ETD,@CLOSINGDATE,@ETA
|
|
|
,@SHIPPERID,@SHIPPER,@CONSIGNEEID,@CONSIGNEE,@NOTIFYPARTYID,@NOTIFYPARTY,@BSSOURCE
|
|
|
,@BSSOURCEDETAIL,@GOODSNAME,@NOBILL,@ISSUETYPE,@MARKS,@DESCRIPTION,@HSCODE
|
|
|
,@PORTLOADID,@PORTLOAD,@PORTDISCHARGEID,@PORTDISCHARGE,@PLACEDELIVERYID,@PLACEDELIVERY
|
|
|
,@DESTINATIONID,@DESTINATION,@BLTYPE,@AGENTID,@AGENT,@YARD
|
|
|
,@BLFRT,@PREPARDAT,@PAYABLEAT,@SERVICE,@NOPKGS,@GROSSWEIGHT
|
|
|
,@MEASUREMENT,@PKGS,@KINDPKGS,@CBM,@TOTALNO,@KGS,@LANE,@CARRIER,@FORWARDER
|
|
|
,@CARGOID,@REMARK,@PLACERECEIPTID,@PlACERECEIPT,@VESSELID,@CNTR1,@CNTR2,@CNTR3,@CNTR4,@CNTR5
|
|
|
,@CNTR6,@CNTR7,@CNTR8,@CNTR9,@CNTR10,@OTCNTR,@TEU,@CUSTOMSNUM,@INAMOUT,@ISVOU,@ISCONTAINERSOC) ");
|
|
|
|
|
|
var cmdupdate =
|
|
|
db.GetSqlStringCommand(@"update op_seae set [MBLNO]=@MBLNO,[HBLNO]=@HBLNO,[BSSTATUS]=@BSSTATUS,[FEESTATUS]=@FEESTATUS,[BSDATE]=@BSDATE
|
|
|
,[ACCDATE]=@ACCDATE,[CUSTOMERNAME]=@CUSTOMERNAME,[INPUTBY]=@INPUTBY,[OP]=@OP,[CUSTSERVICE]=@CUSTSERVICE,[SALE]=@SALE
|
|
|
,[SALEDEPT]=@SALEDEPT,[VESSEL]=@VESSEL,[VOYNO]=@VOYNO,[ETD]=@ETD,[CLOSINGDATE]=@CLOSINGDATE,[ETA]=@ETA,[GOODSNAME]=@GOODSNAME,[HSCODE]=@HSCODE
|
|
|
,[PORTLOADID]=@PORTLOADID,[PORTLOAD]=@PORTLOAD,[PORTDISCHARGEID]=@PORTDISCHARGEID,[PORTDISCHARGE]=@PORTDISCHARGE
|
|
|
,[PLACEDELIVERYID]=@PLACEDELIVERYID,[PLACEDELIVERY]=@PLACEDELIVERY,[DESTINATIONID]=@DESTINATIONID,[DESTINATION]=@DESTINATION
|
|
|
,[AGENTID]=@AGENTID,[AGENT]=@AGENT,[YARD]=@YARD,[BLFRT]=@BLFRT,[PREPARDAT]=@PREPARDAT,[PAYABLEAT]=@PAYABLEAT,[SERVICE]=@SERVICE
|
|
|
,[MARKS]=@MARKS,[NOPKGS]=@NOPKGS,[GROSSWEIGHT]=@GROSSWEIGHT,[MEASUREMENT]=@MEASUREMENT,[PKGS]=@PKGS,[KINDPKGS]=@KINDPKGS,
|
|
|
[CBM]=@CBM,[TOTALNO]=@TOTALNO,[KGS]=@KGS,[LANE]=@LANE,[CARRIER]=@CARRIER,[FORWARDER]=@FORWARDER ,[CARGOID]=@CARGOID
|
|
|
,[REMARK]=@REMARK,[PLACERECEIPTID]=@PLACERECEIPTID,[PlACERECEIPT]=@PLACERECEIPT,[VESSELID]=@VESSELID WHERE [BSNO]=@BSNO");
|
|
|
|
|
|
if (bodyList != null)
|
|
|
{
|
|
|
foreach (var enumValue in bodyList)
|
|
|
{
|
|
|
|
|
|
|
|
|
if (enumValue.MASTERNO == "*")
|
|
|
{
|
|
|
cmdInsert.Parameters.Clear();
|
|
|
|
|
|
db.AddInParameter(cmdInsert, "@BSNO", DbType.String, enumValue.BSNO);
|
|
|
db.AddInParameter(cmdInsert, "@MASTERNO", DbType.String, bsno);
|
|
|
db.AddInParameter(cmdInsert, "@ORDERTYPE", DbType.String, "操作录入");
|
|
|
db.AddInParameter(cmdInsert, "@CUSTNO", DbType.String, enumValue.CUSTNO);
|
|
|
db.AddInParameter(cmdInsert, "@MBLNO", DbType.String, enumValue.MBLNO);
|
|
|
db.AddInParameter(cmdInsert, "@HBLNO", DbType.String, enumValue.HBLNO);
|
|
|
db.AddInParameter(cmdInsert, "@BSSTATUS", DbType.Boolean, enumValue.BSSTATUS);
|
|
|
db.AddInParameter(cmdInsert, "@FEESTATUS", DbType.Boolean, enumValue.FEESTATUS);
|
|
|
db.AddInParameter(cmdInsert, "@BSDATE", DbType.Date, DateTime.Now);
|
|
|
db.AddInParameter(cmdInsert, "@ACCDATE", DbType.String, enumValue.ACCDATE);
|
|
|
db.AddInParameter(cmdInsert, "@CUSTOMERNAME", DbType.String, enumValue.CUSTOMERNAME);
|
|
|
db.AddInParameter(cmdInsert, "@INPUTBY", DbType.String, enumValue.INPUTBY);
|
|
|
db.AddInParameter(cmdInsert, "@OP", DbType.String, enumValue.OP);
|
|
|
db.AddInParameter(cmdInsert, "@CUSTSERVICE", DbType.String, enumValue.CUSTSERVICE);
|
|
|
db.AddInParameter(cmdInsert, "@SALE", DbType.String, enumValue.SALE);
|
|
|
db.AddInParameter(cmdInsert, "@CORPID", DbType.String, corpid);
|
|
|
db.AddInParameter(cmdInsert, "@SALEDEPT", DbType.String, enumValue.SALEDEPT);
|
|
|
db.AddInParameter(cmdInsert, "@SHIPPERID", DbType.String, enumValue.SHIPPERID);
|
|
|
db.AddInParameter(cmdInsert, "@SHIPPER", DbType.String, enumValue.SHIPPER);
|
|
|
db.AddInParameter(cmdInsert, "@CONSIGNEEID", DbType.String, enumValue.CONSIGNEEID);
|
|
|
db.AddInParameter(cmdInsert, "@CONSIGNEE", DbType.String, enumValue.CONSIGNEE);
|
|
|
db.AddInParameter(cmdInsert, "@NOTIFYPARTYID", DbType.String, enumValue.NOTIFYPARTYID);
|
|
|
db.AddInParameter(cmdInsert, "@NOTIFYPARTY", DbType.String, enumValue.NOTIFYPARTY);
|
|
|
db.AddInParameter(cmdInsert, "@BSSOURCE", DbType.String, enumValue.BSSOURCE);
|
|
|
db.AddInParameter(cmdInsert, "@BSSOURCEDETAIL", DbType.String, enumValue.BSSOURCEDETAIL);
|
|
|
db.AddInParameter(cmdInsert, "@GOODSNAME", DbType.String, enumValue.GOODSNAME);
|
|
|
db.AddInParameter(cmdInsert, "@NOBILL", DbType.String, enumValue.NOBILL);
|
|
|
db.AddInParameter(cmdInsert, "@ISSUETYPE", DbType.String, enumValue.ISSUETYPE);
|
|
|
db.AddInParameter(cmdInsert, "@MARKS", DbType.String, enumValue.MARKS);
|
|
|
db.AddInParameter(cmdInsert, "@DESCRIPTION", DbType.String, enumValue.DESCRIPTION);
|
|
|
db.AddInParameter(cmdInsert, "@HSCODE", DbType.String, enumValue.HSCODE);
|
|
|
db.AddInParameter(cmdInsert, "@CREATETIME", DbType.Date, DateTime.Now);
|
|
|
db.AddInParameter(cmdInsert, "@VESSEL", DbType.String, enumValue.VESSEL);
|
|
|
db.AddInParameter(cmdInsert, "@VOYNO", DbType.String, enumValue.VOYNO);
|
|
|
db.AddInParameter(cmdInsert, "@ETD", DbType.Date, enumValue.ETD);
|
|
|
db.AddInParameter(cmdInsert, "@CLOSINGDATE", DbType.Date, enumValue.CLOSINGDATE);
|
|
|
db.AddInParameter(cmdInsert, "@ETA", DbType.Date, enumValue.ETA);
|
|
|
db.AddInParameter(cmdInsert, "@PORTLOADID", DbType.String, enumValue.PORTLOADID);
|
|
|
db.AddInParameter(cmdInsert, "@PORTLOAD", DbType.String, enumValue.PORTLOAD);
|
|
|
db.AddInParameter(cmdInsert, "@PORTDISCHARGEID", DbType.String, enumValue.PORTDISCHARGEID);
|
|
|
db.AddInParameter(cmdInsert, "@PORTDISCHARGE", DbType.String, enumValue.PORTDISCHARGE);
|
|
|
db.AddInParameter(cmdInsert, "@PLACEDELIVERYID", DbType.String, enumValue.PLACEDELIVERYID);
|
|
|
db.AddInParameter(cmdInsert, "@PLACEDELIVERY", DbType.String, enumValue.PLACEDELIVERY);
|
|
|
db.AddInParameter(cmdInsert, "@DESTINATIONID", DbType.String, enumValue.DESTINATIONID);
|
|
|
db.AddInParameter(cmdInsert, "@DESTINATION", DbType.String, enumValue.DESTINATION);
|
|
|
db.AddInParameter(cmdInsert, "@BLTYPE", DbType.String, enumValue.BLTYPE);
|
|
|
db.AddInParameter(cmdInsert, "@AGENTID", DbType.String, enumValue.AGENTID);
|
|
|
db.AddInParameter(cmdInsert, "@AGENT", DbType.String, enumValue.AGENT);
|
|
|
db.AddInParameter(cmdInsert, "@YARD", DbType.String, enumValue.YARD);
|
|
|
db.AddInParameter(cmdInsert, "@BLFRT", DbType.String, enumValue.BLFRT);
|
|
|
db.AddInParameter(cmdInsert, "@PREPARDAT", DbType.String, enumValue.PREPARDAT);
|
|
|
db.AddInParameter(cmdInsert, "@PAYABLEAT", DbType.String, enumValue.PAYABLEAT);
|
|
|
db.AddInParameter(cmdInsert, "@SERVICE", DbType.String, enumValue.SERVICE);
|
|
|
db.AddInParameter(cmdInsert, "@NOPKGS", DbType.String, enumValue.NOPKGS);
|
|
|
db.AddInParameter(cmdInsert, "@GROSSWEIGHT", DbType.String, enumValue.GROSSWEIGHT);
|
|
|
db.AddInParameter(cmdInsert, "@MEASUREMENT", DbType.String, enumValue.MEASUREMENT);
|
|
|
db.AddInParameter(cmdInsert, "@PKGS", DbType.String, enumValue.PKGS);
|
|
|
db.AddInParameter(cmdInsert, "@KINDPKGS", DbType.String, enumValue.KINDPKGS);
|
|
|
db.AddInParameter(cmdInsert, "@CBM", DbType.String, enumValue.CBM);
|
|
|
db.AddInParameter(cmdInsert, "@TOTALNO", DbType.String, enumValue.TOTALNO);
|
|
|
db.AddInParameter(cmdInsert, "@KGS", DbType.String, enumValue.KGS);
|
|
|
db.AddInParameter(cmdInsert, "@LANE", DbType.String, enumValue.LANE);
|
|
|
db.AddInParameter(cmdInsert, "@CARRIER", DbType.String, enumValue.CARRIER);
|
|
|
db.AddInParameter(cmdInsert, "@FORWARDER", DbType.String, enumValue.FORWARDER);
|
|
|
db.AddInParameter(cmdInsert, "@CARGOID", DbType.String, enumValue.CARGOID);
|
|
|
db.AddInParameter(cmdInsert, "@REMARK", DbType.String, enumValue.REMARK);
|
|
|
db.AddInParameter(cmdInsert, "@PLACERECEIPTID", DbType.String, enumValue.PLACERECEIPTID);
|
|
|
db.AddInParameter(cmdInsert, "@PlACERECEIPT", DbType.String, enumValue.PLACERECEIPT);
|
|
|
db.AddInParameter(cmdInsert, "@VESSELID", DbType.String, enumValue.VESSELID);
|
|
|
db.AddInParameter(cmdInsert, "@CNTR1", DbType.Int16, enumValue.CNTR1);
|
|
|
db.AddInParameter(cmdInsert, "@CNTR2", DbType.Int16, enumValue.CNTR2);
|
|
|
db.AddInParameter(cmdInsert, "@CNTR3", DbType.Int16, enumValue.CNTR3);
|
|
|
db.AddInParameter(cmdInsert, "@CNTR4", DbType.Int16, enumValue.CNTR4);
|
|
|
db.AddInParameter(cmdInsert, "@CNTR5", DbType.Int16, enumValue.CNTR5);
|
|
|
db.AddInParameter(cmdInsert, "@CNTR6", DbType.Int16, enumValue.CNTR6);
|
|
|
db.AddInParameter(cmdInsert, "@CNTR7", DbType.Int16, enumValue.CNTR7);
|
|
|
db.AddInParameter(cmdInsert, "@CNTR8", DbType.Int16, enumValue.CNTR8);
|
|
|
db.AddInParameter(cmdInsert, "@CNTR9", DbType.Int16, enumValue.CNTR9);
|
|
|
db.AddInParameter(cmdInsert, "@CNTR10", DbType.Int16, enumValue.CNTR10);
|
|
|
db.AddInParameter(cmdInsert, "@OTCNTR", DbType.Int16, enumValue.OTCNTR);
|
|
|
db.AddInParameter(cmdInsert, "@TEU", DbType.Int16, enumValue.TEU);
|
|
|
db.AddInParameter(cmdInsert, "@CUSTOMSNUM", DbType.Int16, enumValue.CUSTOMSNUM);
|
|
|
db.AddInParameter(cmdInsert, "@INAMOUT", DbType.Decimal, enumValue.INAMOUT);
|
|
|
db.AddInParameter(cmdInsert, "@ISVOU", DbType.Boolean, enumValue.ISVOU);
|
|
|
db.AddInParameter(cmdInsert, "@ISCONTAINERSOC", DbType.Boolean, enumValue.ISCONTAINERSOC);
|
|
|
db.ExecuteNonQuery(cmdInsert, tran);
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
cmdupdate.Parameters.Clear();
|
|
|
|
|
|
db.AddInParameter(cmdupdate, "@BSNO", DbType.String, enumValue.BSNO);
|
|
|
db.AddInParameter(cmdupdate, "@MBLNO", DbType.String, enumValue.MBLNO);
|
|
|
db.AddInParameter(cmdupdate, "@HBLNO", DbType.String, enumValue.HBLNO);
|
|
|
db.AddInParameter(cmdupdate, "@BSSTATUS", DbType.Boolean, enumValue.BSSTATUS);
|
|
|
db.AddInParameter(cmdupdate, "@FEESTATUS", DbType.Boolean, enumValue.FEESTATUS);
|
|
|
db.AddInParameter(cmdupdate, "@BSDATE", DbType.Date, DateTime.Now);
|
|
|
db.AddInParameter(cmdupdate, "@ACCDATE", DbType.String, enumValue.ACCDATE);
|
|
|
db.AddInParameter(cmdupdate, "@CUSTOMERNAME", DbType.String, enumValue.CUSTOMERNAME);
|
|
|
db.AddInParameter(cmdupdate, "@INPUTBY", DbType.String, enumValue.INPUTBY);
|
|
|
db.AddInParameter(cmdupdate, "@OP", DbType.String, enumValue.OP);
|
|
|
db.AddInParameter(cmdupdate, "@CUSTSERVICE", DbType.String, enumValue.CUSTSERVICE);
|
|
|
db.AddInParameter(cmdupdate, "@SALE", DbType.String, enumValue.SALE);
|
|
|
db.AddInParameter(cmdupdate, "@SALEDEPT", DbType.String, enumValue.SALEDEPT);
|
|
|
db.AddInParameter(cmdupdate, "@VESSEL", DbType.String, enumValue.VESSEL);
|
|
|
db.AddInParameter(cmdupdate, "@VOYNO", DbType.String, enumValue.VOYNO);
|
|
|
db.AddInParameter(cmdupdate, "@ETD", DbType.Date, enumValue.ETD);
|
|
|
db.AddInParameter(cmdupdate, "@GOODSNAME", DbType.String, enumValue.GOODSNAME);
|
|
|
db.AddInParameter(cmdupdate, "@HSCODE", DbType.String, enumValue.HSCODE);
|
|
|
db.AddInParameter(cmdupdate, "@CLOSINGDATE", DbType.Date, enumValue.CLOSINGDATE);
|
|
|
db.AddInParameter(cmdupdate, "@ETA", DbType.Date, enumValue.ETA);
|
|
|
db.AddInParameter(cmdupdate, "@PORTLOADID", DbType.String, enumValue.PORTLOADID);
|
|
|
db.AddInParameter(cmdupdate, "@PORTLOAD", DbType.String, enumValue.PORTLOAD);
|
|
|
db.AddInParameter(cmdupdate, "@PORTDISCHARGEID", DbType.String, enumValue.PORTDISCHARGEID);
|
|
|
db.AddInParameter(cmdupdate, "@PORTDISCHARGE", DbType.String, enumValue.PORTDISCHARGE);
|
|
|
db.AddInParameter(cmdupdate, "@PLACEDELIVERYID", DbType.String, enumValue.PLACEDELIVERYID);
|
|
|
db.AddInParameter(cmdupdate, "@PLACEDELIVERY", DbType.String, enumValue.PLACEDELIVERY);
|
|
|
db.AddInParameter(cmdupdate, "@DESTINATIONID", DbType.String, enumValue.DESTINATIONID);
|
|
|
db.AddInParameter(cmdupdate, "@DESTINATION", DbType.String, enumValue.DESTINATION);
|
|
|
db.AddInParameter(cmdupdate, "@AGENTID", DbType.String, enumValue.AGENTID);
|
|
|
db.AddInParameter(cmdupdate, "@AGENT", DbType.String, enumValue.AGENT);
|
|
|
db.AddInParameter(cmdupdate, "@YARD", DbType.String, enumValue.YARD);
|
|
|
db.AddInParameter(cmdupdate, "@BLFRT", DbType.String, enumValue.BLFRT);
|
|
|
db.AddInParameter(cmdupdate, "@PREPARDAT", DbType.String, enumValue.PREPARDAT);
|
|
|
db.AddInParameter(cmdupdate, "@PAYABLEAT", DbType.String, enumValue.PAYABLEAT);
|
|
|
db.AddInParameter(cmdupdate, "@SERVICE", DbType.String, enumValue.SERVICE);
|
|
|
db.AddInParameter(cmdupdate, "@MARKS", DbType.String, enumValue.MARKS);
|
|
|
db.AddInParameter(cmdupdate, "@NOPKGS", DbType.String, enumValue.NOPKGS);
|
|
|
db.AddInParameter(cmdupdate, "@GROSSWEIGHT", DbType.String, enumValue.GROSSWEIGHT);
|
|
|
db.AddInParameter(cmdupdate, "@MEASUREMENT", DbType.String, enumValue.MEASUREMENT);
|
|
|
db.AddInParameter(cmdupdate, "@PKGS", DbType.String, enumValue.PKGS);
|
|
|
db.AddInParameter(cmdupdate, "@KINDPKGS", DbType.String, enumValue.KINDPKGS);
|
|
|
db.AddInParameter(cmdupdate, "@CBM", DbType.String, enumValue.CBM);
|
|
|
db.AddInParameter(cmdupdate, "@TOTALNO", DbType.String, enumValue.TOTALNO);
|
|
|
db.AddInParameter(cmdupdate, "@KGS", DbType.String, enumValue.KGS);
|
|
|
db.AddInParameter(cmdupdate, "@LANE", DbType.String, enumValue.LANE);
|
|
|
db.AddInParameter(cmdupdate, "@CARRIER", DbType.String, enumValue.CARRIER);
|
|
|
db.AddInParameter(cmdupdate, "@FORWARDER", DbType.String, enumValue.FORWARDER);
|
|
|
db.AddInParameter(cmdupdate, "@CARGOID", DbType.String, enumValue.CARGOID);
|
|
|
db.AddInParameter(cmdupdate, "@REMARK", DbType.String, enumValue.REMARK);
|
|
|
db.AddInParameter(cmdupdate, "@PLACERECEIPTID", DbType.String, enumValue.PLACERECEIPTID);
|
|
|
db.AddInParameter(cmdupdate, "@PlACERECEIPT", DbType.String, enumValue.PLACERECEIPT);
|
|
|
db.AddInParameter(cmdupdate, "@VESSELID", DbType.String, enumValue.VESSELID);
|
|
|
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;
|
|
|
}
|
|
|
|
|
|
public static DBResult DeleteFen ( string bsno )
|
|
|
{
|
|
|
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_seae where BSNO='" + bsno + "'");
|
|
|
db.ExecuteNonQuery(cmdDelete, tran);
|
|
|
var cmdDeletectn = db.GetSqlStringCommand("delete from op_ctn_fen where BSNO='" + bsno + "'");
|
|
|
db.ExecuteNonQuery(cmdDeletectn, tran);
|
|
|
|
|
|
|
|
|
tran.Commit();
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
tran.Rollback();
|
|
|
|
|
|
result.Success = false;
|
|
|
result.Message = "删除出现错误,请重试或联系系统管理员";
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
}
|
|
|
result.Success = true;
|
|
|
result.Message = "操作成功";
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public static DBResult CancelFenAdd ( string bsno )
|
|
|
{
|
|
|
var result = new DBResult();
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
using (var conn = db.CreateConnection())
|
|
|
{
|
|
|
conn.Open();
|
|
|
var tran = conn.BeginTransaction();
|
|
|
try
|
|
|
{
|
|
|
var cmdDelete = db.GetSqlStringCommand("update op_seae set MASTERNO=BSNO where BSNO='" + bsno + "'");
|
|
|
db.ExecuteNonQuery(cmdDelete, tran);
|
|
|
|
|
|
var cmdDeletectn = db.GetSqlStringCommand("delete from op_ctn_fen where BSNO='" + bsno + "'");
|
|
|
db.ExecuteNonQuery(cmdDeletectn, tran);
|
|
|
|
|
|
tran.Commit();
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
tran.Rollback();
|
|
|
|
|
|
result.Success = false;
|
|
|
result.Message = "更新出现错误,请重试或联系系统管理员";
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
}
|
|
|
result.Success = true;
|
|
|
result.Message = "操作成功";
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public static DBResult AddFenAdd ( string bsno, List<MsOpSeae> bodyList, string ctnid )
|
|
|
{
|
|
|
var result = new DBResult();
|
|
|
|
|
|
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
using (var conn = db.CreateConnection())
|
|
|
{
|
|
|
conn.Open();
|
|
|
var tran = conn.BeginTransaction();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
|
|
|
|
|
|
var cmdupdate =
|
|
|
db.GetSqlStringCommand(@"update op_seae set MASTERNO=@MASTERNO WHERE [BSNO]=@BSNO");
|
|
|
var cmdInsert =
|
|
|
db.GetSqlStringCommand(
|
|
|
@"INSERT INTO op_ctn_fen([GID],[CTN_ID],[BSNO],[MASTERNO],[PKGS],[KGS],[CBM],[REMARK],[KINDPKGS])
|
|
|
VALUES
|
|
|
(@GID,@CTN_ID,@BSNO,@MASTERNO,@PKGS,@KGS,@CBM,@REMARK,@KINDPKGS) ");
|
|
|
|
|
|
if (bodyList != null)
|
|
|
{
|
|
|
foreach (var enumValue in bodyList)
|
|
|
{
|
|
|
|
|
|
cmdupdate.Parameters.Clear();
|
|
|
|
|
|
db.AddInParameter(cmdupdate, "@BSNO", DbType.String, enumValue.BSNO);
|
|
|
db.AddInParameter(cmdupdate, "@MASTERNO", DbType.String, bsno);
|
|
|
db.ExecuteNonQuery(cmdupdate, tran);
|
|
|
|
|
|
if (ctnid != "")
|
|
|
{
|
|
|
cmdInsert.Parameters.Clear();
|
|
|
var GID = Guid.NewGuid().ToString();
|
|
|
db.AddInParameter(cmdInsert, "@GID", DbType.String, GID);
|
|
|
db.AddInParameter(cmdInsert, "@MASTERNO", DbType.String, bsno);
|
|
|
db.AddInParameter(cmdInsert, "@CTN_ID", DbType.String, ctnid);
|
|
|
db.AddInParameter(cmdInsert, "@BSNO", DbType.String, enumValue.BSNO);
|
|
|
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, "@REMARK", DbType.String, enumValue.REMARK);
|
|
|
db.AddInParameter(cmdInsert, "@KINDPKGS", DbType.String, enumValue.KINDPKGS);
|
|
|
db.ExecuteNonQuery(cmdInsert, 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 List<MsOpSeaeDetail> GetFenCtnList ( string strCondition )
|
|
|
{
|
|
|
var strSql = new StringBuilder();
|
|
|
strSql.Append("SELECT f.GID,f.CTN_ID,f.BSNO,f.MASTERNO,f.PKGS,f.KGS,f.CBM,f.REMARK,f.KINDPKGS,c.CTNALL,c.CNTRNO,c.SEALNO from op_ctn_fen f ");
|
|
|
strSql.Append(" left join op_ctn c on (c.CTN_ID=f.CTN_ID)");
|
|
|
if (strCondition.Trim() != String.Empty)
|
|
|
{
|
|
|
strSql.Append(" where " + strCondition);
|
|
|
}
|
|
|
strSql.Append(" order by f.CTN_ID");
|
|
|
return SetFenCtnData(strSql);
|
|
|
}
|
|
|
|
|
|
private static List<MsOpSeaeDetail> SetFenCtnData ( StringBuilder strSql )
|
|
|
{
|
|
|
var bodyList = new List<MsOpSeaeDetail>();
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
|
|
|
{
|
|
|
while (reader.Read())
|
|
|
{
|
|
|
MsOpSeaeDetail data = new MsOpSeaeDetail();
|
|
|
#region Set DB data to Object
|
|
|
data.GID = Convert.ToString(reader["GID"]);//编号
|
|
|
data.CTN_ID = Convert.ToString(reader["CTN_ID"]);//编号
|
|
|
data.BSNO = Convert.ToString(reader["BSNO"]);//业务编号
|
|
|
data.MASTERNO = Convert.ToString(reader["MASTERNO"]);//业务编号
|
|
|
data.CTNALL = Convert.ToString(reader["CTNALL"]);//表现形式
|
|
|
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;
|
|
|
}
|
|
|
|
|
|
public static DBResult SaveFenCtn ( string bsno, List<MsOpSeaeDetail> bodyList )
|
|
|
{
|
|
|
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_fen([GID],[CTN_ID],[BSNO],[MASTERNO],[PKGS],[KGS],[CBM],[REMARK],[KINDPKGS])
|
|
|
VALUES
|
|
|
(@GID,@CTN_ID,@BSNO,@MASTERNO,@PKGS,@KGS,@CBM,@REMARK,@KINDPKGS) ");
|
|
|
|
|
|
var cmdupdate =
|
|
|
db.GetSqlStringCommand(@"update op_ctn_fen set [CTN_ID]=@CTN_ID,[PKGS]=@PKGS
|
|
|
,[KGS]=@KGS,[CBM]=@CBM,[REMARK]=@REMARK,[KINDPKGS]=@KINDPKGS WHERE [GID]=@GID");
|
|
|
|
|
|
if (bodyList != null)
|
|
|
{
|
|
|
foreach (var enumValue in bodyList)
|
|
|
{
|
|
|
|
|
|
|
|
|
if (enumValue.MASTERNO == "*")
|
|
|
{
|
|
|
cmdInsert.Parameters.Clear();
|
|
|
|
|
|
db.AddInParameter(cmdInsert, "@GID", DbType.String, enumValue.GID);
|
|
|
db.AddInParameter(cmdInsert, "@MASTERNO", DbType.String, bsno);
|
|
|
db.AddInParameter(cmdInsert, "@CTN_ID", DbType.String, enumValue.CTN_ID);
|
|
|
db.AddInParameter(cmdInsert, "@BSNO", DbType.String, enumValue.BSNO);
|
|
|
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, "@REMARK", DbType.String, enumValue.REMARK);
|
|
|
db.AddInParameter(cmdInsert, "@KINDPKGS", DbType.String, enumValue.KINDPKGS);
|
|
|
db.ExecuteNonQuery(cmdInsert, tran);
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
cmdupdate.Parameters.Clear();
|
|
|
db.AddInParameter(cmdInsert, "@GID", DbType.String, enumValue.GID);
|
|
|
db.AddInParameter(cmdInsert, "@CTN_ID", DbType.String, enumValue.CTN_ID);
|
|
|
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, "@REMARK", DbType.String, enumValue.REMARK);
|
|
|
db.AddInParameter(cmdInsert, "@KINDPKGS", DbType.String, enumValue.KINDPKGS);
|
|
|
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;
|
|
|
}
|
|
|
|
|
|
public static DBResult DeleteFenCtn ( string bsno )
|
|
|
{
|
|
|
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_fen where GID='" + bsno + "'");
|
|
|
db.ExecuteNonQuery(cmdDelete, tran);
|
|
|
|
|
|
|
|
|
tran.Commit();
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
tran.Rollback();
|
|
|
|
|
|
result.Success = false;
|
|
|
result.Message = "删除出现错误,请重试或联系系统管理员";
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
}
|
|
|
result.Success = true;
|
|
|
result.Message = "操作成功";
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
static public List<MsOpSeaeFenCtn> GetSeaeFenCtnList ( string strCondition )
|
|
|
{
|
|
|
var strSql = new StringBuilder();
|
|
|
strSql.Append("SELECT f.GID,f.CTN_ID,f.BSNO,f.MASTERNO,f.PKGS,f.KGS,f.CBM,f.REMARK,f.KINDPKGS,c.CTNALL,c.CNTRNO,c.SEALNO ");
|
|
|
strSql.Append(",b.MBLNO,b.HBLNO,b.GOODSNAME,b.DESCRIPTION,b.CARGOID ");
|
|
|
strSql.Append(" from op_ctn_fen f left join op_ctn c on (c.CTN_ID=f.CTN_ID)");
|
|
|
strSql.Append(" left join op_seae b on (b.BSNO=f.BSNO)");
|
|
|
if (strCondition.Trim() != String.Empty)
|
|
|
{
|
|
|
strSql.Append(" where " + strCondition);
|
|
|
}
|
|
|
strSql.Append(" order by f.CTN_ID");
|
|
|
return SetSeaeFenCtnData(strSql);
|
|
|
}
|
|
|
|
|
|
private static List<MsOpSeaeFenCtn> SetSeaeFenCtnData ( StringBuilder strSql )
|
|
|
{
|
|
|
var bodyList = new List<MsOpSeaeFenCtn>();
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
|
|
|
{
|
|
|
while (reader.Read())
|
|
|
{
|
|
|
MsOpSeaeFenCtn data = new MsOpSeaeFenCtn();
|
|
|
#region Set DB data to Object
|
|
|
data.GID = Convert.ToString(reader["GID"]);//编号
|
|
|
data.CTN_ID = Convert.ToString(reader["CTN_ID"]);//编号
|
|
|
data.BSNO = Convert.ToString(reader["BSNO"]);//业务编号
|
|
|
data.MASTERNO = Convert.ToString(reader["MASTERNO"]);//业务编号
|
|
|
data.CTNALL = Convert.ToString(reader["CTNALL"]);//表现形式
|
|
|
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"]);//包装类型
|
|
|
data.MBLNO = Convert.ToString(reader["MBLNO"]);//包装类型
|
|
|
data.HBLNO = Convert.ToString(reader["HBLNO"]);//包装类型
|
|
|
data.GOODSNAME = Convert.ToString(reader["GOODSNAME"]);//包装类型
|
|
|
data.DESCRIPTION = Convert.ToString(reader["DESCRIPTION"]);//包装类型
|
|
|
data.CARGOID = Convert.ToString(reader["CARGOID"]);//包装类型
|
|
|
|
|
|
#endregion
|
|
|
bodyList.Add(data);
|
|
|
}
|
|
|
reader.Close();
|
|
|
}
|
|
|
return bodyList;
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region 合票操作
|
|
|
|
|
|
|
|
|
static public List<MsOpSeaeDetail> GetBodyListTran(string strCondition, Database db, DbTransaction tran, string sort = null)
|
|
|
{
|
|
|
var strSql = new StringBuilder();
|
|
|
strSql.Append("SELECT [CTN_ID],[BSNO],isnull(CTNCODE,1) as [CTNCODE],[SIZE],[CTN],[CTNNUM],[TEU],[CTNALL],op_ctn.CNTRNO,[SEALNO],[PKGS],[KGS],[CBM],[REMARK],[KINDPKGS],[TAREWEIGHT],[VGMCONNCOM],[GOODSNAME],CTNSTATUS,op_ctn.MASTERNO,WEIGHTYPE,WEIGHKGS,WEIGHATTN,WEIGHTEL,WEIGHSIGN,WEIGHDATE ");
|
|
|
strSql.Append(" ,TRUCKER,TRUCKNO,TRUCKFEE,FREESTORAGEDAY,STORAGEDAY,STORAGEPRICE,STORAGEFEE, FREECTNDAY,CTNDAY,CTNPRICE,CTNFEE,");
|
|
|
strSql.Append(" f.FENPKGS,f.FENKGS,f.FENCBM,VGMADDR,VGMEMAIL from op_ctn left join V_FEN_CTN_SUM f on (f.MASTERNO=op_ctn.BSNO and f.CNTRNO=op_ctn.CNTRNO) ");
|
|
|
if (strCondition.Trim() != String.Empty)
|
|
|
{
|
|
|
strSql.Append(" where " + strCondition);
|
|
|
}
|
|
|
var sortstring = DatasetSort.Getsortstring(sort);
|
|
|
if (!string.IsNullOrEmpty(sortstring))
|
|
|
{
|
|
|
strSql.Append(" order by " + sortstring);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strSql.Append(" order by BSNO,CTNCODE,CTNALL");
|
|
|
}
|
|
|
return SetBodyDataTran(strSql, db, tran);
|
|
|
}
|
|
|
public static List<MsOpSeaeDetail> SetBodyDataTran(StringBuilder strSql, Database db, DbTransaction tran)
|
|
|
{
|
|
|
var bodyList = new List<MsOpSeaeDetail>();
|
|
|
|
|
|
using (IDataReader reader = db.ExecuteReader(tran,CommandType.Text, strSql.ToString()))
|
|
|
{
|
|
|
while (reader.Read())
|
|
|
{
|
|
|
MsOpSeaeDetail data = new MsOpSeaeDetail();
|
|
|
#region Set DB data to Object
|
|
|
data.VGMCONNCOM = Convert.ToString(reader["VGMCONNCOM"]);//vgm联系公司
|
|
|
data.CTN_ID = Convert.ToString(reader["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.CTNNUM = Convert.ToInt32(reader["CTNNUM"]);//箱量
|
|
|
data.TEU = Convert.ToInt32(reader["TEU"]);//TEU
|
|
|
data.CTNALL = Convert.ToString(reader["CTNALL"]);//表现形式
|
|
|
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"]);//包装类型
|
|
|
if (reader["TAREWEIGHT"] != DBNull.Value)
|
|
|
data.TAREWEIGHT = Convert.ToDecimal(reader["TAREWEIGHT"]);//箱皮重
|
|
|
data.GOODSNAME = Convert.ToString(reader["GOODSNAME"]);//品名
|
|
|
data.WEIGHTYPE = Convert.ToString(reader["WEIGHTYPE"]);
|
|
|
data.WEIGHKGS = Convert.ToDecimal(reader["WEIGHKGS"]);//
|
|
|
data.WEIGHATTN = Convert.ToString(reader["WEIGHATTN"]);
|
|
|
data.WEIGHTEL = Convert.ToString(reader["WEIGHTEL"]);
|
|
|
data.WEIGHSIGN = Convert.ToString(reader["WEIGHSIGN"]);
|
|
|
data.WEIGHDATE = Convert.ToString(reader["WEIGHDATE"]);
|
|
|
data.VGMADDR = Convert.ToString(reader["VGMADDR"]);
|
|
|
data.VGMEMAIL = Convert.ToString(reader["VGMEMAIL"]);
|
|
|
|
|
|
data.CTNSTATUS = Convert.ToString(reader["CTNSTATUS"]);
|
|
|
data.MASTERNO = Convert.ToString(reader["MASTERNO"]);
|
|
|
if (reader["FENPKGS"] != DBNull.Value)
|
|
|
data.FENPKGS = Convert.ToInt32(reader["FENPKGS"]);//件数
|
|
|
if (reader["FENKGS"] != DBNull.Value)
|
|
|
data.FENKGS = Convert.ToDecimal(reader["FENKGS"]);//重量(货重)
|
|
|
if (reader["FENCBM"] != DBNull.Value)
|
|
|
data.FENCBM = Convert.ToDecimal(reader["FENCBM"]);//尺码
|
|
|
data.TRUCKNO = Convert.ToString(reader["TRUCKNO"]);
|
|
|
data.TRUCKER = Convert.ToString(reader["TRUCKER"]);
|
|
|
if (reader["FREESTORAGEDAY"] != DBNull.Value)
|
|
|
data.FREESTORAGEDAY = Convert.ToString(reader["FREESTORAGEDAY"]);
|
|
|
if (reader["STORAGEDAY"] != DBNull.Value)
|
|
|
data.STORAGEDAY = Convert.ToString(reader["STORAGEDAY"]);
|
|
|
if (reader["FREECTNDAY"] != DBNull.Value)
|
|
|
data.FREECTNDAY = Convert.ToString(reader["FREECTNDAY"]);
|
|
|
if (reader["CTNDAY"] != DBNull.Value)
|
|
|
data.CTNDAY = Convert.ToString(reader["CTNDAY"]);
|
|
|
if (reader["TRUCKFEE"] != DBNull.Value)
|
|
|
data.TRUCKFEE = Convert.ToString(reader["TRUCKFEE"]);
|
|
|
if (reader["STORAGEPRICE"] != DBNull.Value)
|
|
|
data.STORAGEPRICE = Convert.ToString(reader["STORAGEPRICE"]);
|
|
|
if (reader["STORAGEFEE"] != DBNull.Value)
|
|
|
data.STORAGEFEE = Convert.ToString(reader["STORAGEFEE"]);
|
|
|
if (reader["CTNPRICE"] != DBNull.Value)
|
|
|
data.CTNPRICE = Convert.ToString(reader["CTNPRICE"]);
|
|
|
if (reader["CTNFEE"] != DBNull.Value)
|
|
|
data.CTNFEE = Convert.ToString(reader["CTNFEE"]);
|
|
|
|
|
|
#endregion
|
|
|
bodyList.Add(data);
|
|
|
}
|
|
|
reader.Close();
|
|
|
}
|
|
|
return bodyList;
|
|
|
}
|
|
|
|
|
|
|
|
|
public static DBResult HPFenAdd(string bsno, List<MsOpSeae> bodyList)
|
|
|
{
|
|
|
var result = new DBResult();
|
|
|
|
|
|
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
using (var conn = db.CreateConnection())
|
|
|
{
|
|
|
conn.Open();
|
|
|
var tran = conn.BeginTransaction();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
|
|
|
|
|
|
var cmdupdate =
|
|
|
db.GetSqlStringCommand(@"update op_seae set MASTERNO=@MASTERNO WHERE [BSNO]=@BSNO");
|
|
|
|
|
|
if (bodyList != null)
|
|
|
{
|
|
|
foreach (var enumValue in bodyList)
|
|
|
{
|
|
|
|
|
|
cmdupdate.Parameters.Clear();
|
|
|
|
|
|
db.AddInParameter(cmdupdate, "@BSNO", DbType.String, enumValue.BSNO);
|
|
|
db.AddInParameter(cmdupdate, "@MASTERNO", DbType.String, bsno);
|
|
|
db.ExecuteNonQuery(cmdupdate, tran);
|
|
|
|
|
|
var ctnlist = GetBodyListTran("BSNO='"+enumValue.BSNO+"'",db,tran);
|
|
|
|
|
|
if (ctnlist != null)
|
|
|
{
|
|
|
foreach (var enumValueCtn in ctnlist)
|
|
|
{
|
|
|
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,MASTERNO,WEIGHTYPE,WEIGHKGS,WEIGHATTN,WEIGHTEL,WEIGHSIGN,WEIGHDATE,TRUCKER,TRUCKFEE,FREESTORAGEDAY,STORAGEDAY,STORAGEPRICE,STORAGEFEE,FREECTNDAY,CTNDAY,CTNPRICE,CTNFEE,TRUCKNO,VGMCONNCOM,VGMADDR,VGMEMAIL,PCTN_ID) values (NEWID()"
|
|
|
+ ",'" + bsno + "','" + enumValueCtn.CTNCODE + "','" + enumValueCtn.SIZE + "','" + enumValueCtn.CTN + "'," + enumValueCtn.CTNNUM + "," + enumValueCtn.TEU + ",'" + enumValueCtn.CTNALL.Replace("'", "''") + "','" + enumValueCtn.CNTRNO + "','" + enumValueCtn.SEALNO + "','" + enumValueCtn.PKGS + "'," + enumValueCtn.KGS + "," + enumValueCtn.CBM + ",'" + enumValueCtn.REMARK + "','" + enumValueCtn.KINDPKGS + "'," + enumValueCtn.TAREWEIGHT + ",'','"
|
|
|
+ enumValueCtn.CTNSTATUS + "','" + enumValueCtn.MASTERNO + "','" + enumValueCtn.WEIGHTYPE + "'," + enumValueCtn.WEIGHKGS + ",'" + enumValueCtn.WEIGHATTN + "','" + enumValueCtn.WEIGHTEL + "','" + enumValueCtn.WEIGHSIGN + "','" + enumValueCtn.WEIGHDATE + "','" + enumValueCtn.TRUCKER + "'," + enumValueCtn.TRUCKFEE
|
|
|
+ "," + enumValueCtn.FREESTORAGEDAY + "," + enumValueCtn.STORAGEDAY + "," + enumValueCtn.STORAGEPRICE + "," + enumValueCtn.STORAGEFEE + "," + enumValueCtn.FREECTNDAY + "," + enumValueCtn.CTNDAY + "," + enumValueCtn.CTNPRICE + "," + enumValueCtn.CTNFEE + ",'" + enumValueCtn.TRUCKNO + "','" + enumValueCtn.VGMCONNCOM + "','" + enumValueCtn.VGMADDR + "','" + enumValueCtn.VGMEMAIL + "','"+enumValueCtn.CTN_ID+"')");
|
|
|
db.ExecuteNonQuery(cmdInsert, tran);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
tran.Commit();
|
|
|
getCNTRTOTAL2(bsno, "op_seae");
|
|
|
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
tran.Rollback();
|
|
|
|
|
|
result.Success = false;
|
|
|
result.Message = "更新出现错误,请重试或联系系统管理员";
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
result.Success = true;
|
|
|
result.Message = "更新成功" + result.Message;
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
|
|
|
public static DBResult CancelHPFen(string bsno,List<MsOpSeae> bodyList)
|
|
|
{
|
|
|
var result = new DBResult();
|
|
|
|
|
|
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
using (var conn = db.CreateConnection())
|
|
|
{
|
|
|
conn.Open();
|
|
|
var tran = conn.BeginTransaction();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
|
|
|
|
|
|
var cmdupdate =
|
|
|
db.GetSqlStringCommand(@"update op_seae set MASTERNO=BSNO WHERE [BSNO]=@BSNO");
|
|
|
|
|
|
if (bodyList != null)
|
|
|
{
|
|
|
foreach (var enumValue in bodyList)
|
|
|
{
|
|
|
|
|
|
cmdupdate.Parameters.Clear();
|
|
|
|
|
|
db.AddInParameter(cmdupdate, "@BSNO", DbType.String, enumValue.BSNO);
|
|
|
db.ExecuteNonQuery(cmdupdate, tran);
|
|
|
|
|
|
var ctnlist = GetBodyListTran("BSNO='" + enumValue.BSNO + "'", db, tran);
|
|
|
|
|
|
if (ctnlist != null)
|
|
|
{
|
|
|
foreach (var enumValueCtn in ctnlist)
|
|
|
{
|
|
|
var cmdInsert = db.GetSqlStringCommand(@"delete from op_ctn where BSNO='"+bsno+"' AND PCTN_ID='"+enumValueCtn.CTN_ID+"'");
|
|
|
db.ExecuteNonQuery(cmdInsert, tran);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
tran.Commit();
|
|
|
getCNTRTOTAL2(bsno, "op_seae");
|
|
|
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
tran.Rollback();
|
|
|
|
|
|
result.Success = false;
|
|
|
result.Message = "更新出现错误,请重试或联系系统管理员";
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
result.Success = true;
|
|
|
result.Message = "更新成功" + result.Message;
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public static DBResult CancelHPFen(string bsno)
|
|
|
{
|
|
|
var result = new DBResult();
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
using (var conn = db.CreateConnection())
|
|
|
{
|
|
|
conn.Open();
|
|
|
var tran = conn.BeginTransaction();
|
|
|
try
|
|
|
{
|
|
|
var cmdDelete = db.GetSqlStringCommand("update op_seae set MASTERNO=BSNO where BSNO='" + bsno + "'");
|
|
|
db.ExecuteNonQuery(cmdDelete, tran);
|
|
|
|
|
|
tran.Commit();
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
tran.Rollback();
|
|
|
|
|
|
result.Success = false;
|
|
|
result.Message = "更新出现错误,请重试或联系系统管理员";
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
}
|
|
|
result.Success = true;
|
|
|
result.Message = "操作成功";
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
#region 编码生成
|
|
|
public static String getCodeRule ( string strRULENAME, string strfield, string strETD, string strACCDATE, string strUserID, string strCompanyID )
|
|
|
{
|
|
|
//调用编码规则
|
|
|
if (strETD.Trim().IndexOf("0001") > -1)
|
|
|
{
|
|
|
strETD = "";
|
|
|
}
|
|
|
string strRULEYEAR = "";
|
|
|
string strRULECONTENT = "";
|
|
|
string strCODENAME = "";
|
|
|
string strDEPTNO = "";
|
|
|
string strRULENOLENGTH = "";
|
|
|
int iRULENOLENGTH = 0;
|
|
|
int inum = 0;
|
|
|
string strCONTENT = "";
|
|
|
T_ALL_DA T_ALL_DA = new T_ALL_DA();
|
|
|
//
|
|
|
DataSet ds = T_ALL_DA.GetAllSQL("select * from code_rule where RULENAME='" + strRULENAME.Trim() + "' and RULETYPE=1");
|
|
|
if (ds != null)
|
|
|
{
|
|
|
if (ds.Tables[0].Rows.Count > 0)
|
|
|
{
|
|
|
if (ds.Tables[0].Rows[0]["ISSTARTUSING"].ToString().Trim().Equals("True"))
|
|
|
{
|
|
|
if (ds.Tables[0].Rows[0]["RULEDATE"].ToString().Trim().Equals("业务日期"))
|
|
|
{
|
|
|
if (strETD.Trim() == "")
|
|
|
{
|
|
|
return "";
|
|
|
}
|
|
|
DateTime dETD = System.Convert.ToDateTime(strETD.Trim());
|
|
|
if (ds.Tables[0].Rows[0]["ISCLEAREDINEARLY"].ToString().Trim().Equals("True"))
|
|
|
{
|
|
|
if (ds.Tables[0].Rows[0]["RULEYEAR"].ToString().Trim() == "4")
|
|
|
{
|
|
|
strRULEYEAR = dETD.ToString("yyyy") + dETD.ToString("MM");
|
|
|
}
|
|
|
else if (ds.Tables[0].Rows[0]["RULEYEAR"].ToString().Trim() == "2")
|
|
|
{
|
|
|
strRULEYEAR = dETD.ToString("yy") + dETD.ToString("MM");
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if (ds.Tables[0].Rows[0]["RULEYEAR"].ToString().Trim() == "4")
|
|
|
{
|
|
|
strRULEYEAR = dETD.ToString("yyyy");
|
|
|
}
|
|
|
else if (ds.Tables[0].Rows[0]["RULEYEAR"].ToString().Trim() == "2")
|
|
|
{
|
|
|
strRULEYEAR = dETD.ToString("yy");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
else if (ds.Tables[0].Rows[0]["RULEDATE"].ToString().Trim().Equals("会计期间"))
|
|
|
{
|
|
|
if (strACCDATE.Trim() == "")
|
|
|
{
|
|
|
return "";
|
|
|
}
|
|
|
DateTime dACCDATE = System.Convert.ToDateTime(strACCDATE.Trim() + "-01");
|
|
|
if (ds.Tables[0].Rows[0]["ISCLEAREDINEARLY"].ToString().Trim().Equals("True"))
|
|
|
{
|
|
|
if (ds.Tables[0].Rows[0]["RULEYEAR"].ToString().Trim() == "4")
|
|
|
{
|
|
|
strRULEYEAR = dACCDATE.ToString("yyyy") + dACCDATE.ToString("MM");
|
|
|
}
|
|
|
else if (ds.Tables[0].Rows[0]["RULEYEAR"].ToString().Trim() == "2")
|
|
|
{
|
|
|
strRULEYEAR = dACCDATE.ToString("yy") + dACCDATE.ToString("MM");
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if (ds.Tables[0].Rows[0]["RULEYEAR"].ToString().Trim() == "4")
|
|
|
{
|
|
|
strRULEYEAR = dACCDATE.ToString("yyyy");
|
|
|
}
|
|
|
else if (ds.Tables[0].Rows[0]["RULEYEAR"].ToString().Trim() == "2")
|
|
|
{
|
|
|
strRULEYEAR = dACCDATE.ToString("yy");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
else if (ds.Tables[0].Rows[0]["RULEDATE"].ToString().Trim().Equals("自然月份"))
|
|
|
{
|
|
|
DateTime fwqdate = System.Convert.ToDateTime(T_ALL_DA.GetStrSQL("fwqdate", "select fwqdate=getdate()"));
|
|
|
if (ds.Tables[0].Rows[0]["ISCLEAREDINEARLY"].ToString().Trim().Equals("True"))
|
|
|
{
|
|
|
if (ds.Tables[0].Rows[0]["RULEYEAR"].ToString().Trim() == "4")
|
|
|
{
|
|
|
strRULEYEAR = fwqdate.ToString("yyyy") + fwqdate.ToString("MM");
|
|
|
}
|
|
|
else if (ds.Tables[0].Rows[0]["RULEYEAR"].ToString().Trim() == "2")
|
|
|
{
|
|
|
strRULEYEAR = fwqdate.ToString("yy") + fwqdate.ToString("MM");
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if (ds.Tables[0].Rows[0]["RULEYEAR"].ToString().Trim() == "4")
|
|
|
{
|
|
|
strRULEYEAR = fwqdate.ToString("yyyy");
|
|
|
}
|
|
|
else if (ds.Tables[0].Rows[0]["RULEYEAR"].ToString().Trim() == "2")
|
|
|
{
|
|
|
strRULEYEAR = fwqdate.ToString("yy");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
//
|
|
|
if (ds.Tables[0].Rows[0]["ISCOMPANY"].ToString().Trim().Equals("True"))
|
|
|
{
|
|
|
strCODENAME = T_ALL_DA.GetStrSQL("CODENAME", "select CODENAME from [company] where GID=(select top 1 COMPANYID from user_company where USERID='" + strUserID.Trim() + "')");
|
|
|
}
|
|
|
if (ds.Tables[0].Rows[0]["ISDEPT"].ToString().Trim().Equals("True"))
|
|
|
{
|
|
|
strDEPTNO = T_ALL_DA.GetStrSQL("DEPTNO", "select DEPTNO from [sys_dept] where LINKID=(select top 1 COMPANYID from user_company where USERID='" + strUserID.Trim() + "')");
|
|
|
}
|
|
|
strRULECONTENT = ds.Tables[0].Rows[0]["RULECONTENT"].ToString().Trim();
|
|
|
strRULECONTENT = strRULECONTENT.Replace("《COMPANY》", strCODENAME);
|
|
|
strRULECONTENT = strRULECONTENT.Replace("《DEPT》", strDEPTNO);
|
|
|
//
|
|
|
iRULENOLENGTH = int.Parse(ds.Tables[0].Rows[0]["RULENOLENGTH"].ToString().Trim());
|
|
|
strCONTENT = strRULECONTENT + strRULEYEAR;
|
|
|
//获取分公司的票号头字符
|
|
|
string tempBANKSHEAD = T_ALL_DA.GetStrSQL("BANKSHEAD", "SELECT TOP 1 BANKSHEAD FROM company WHERE GID='" + strCompanyID.Trim() + "'");
|
|
|
strCONTENT = tempBANKSHEAD + strCONTENT;
|
|
|
//
|
|
|
strRULENOLENGTH = T_ALL_DA.GetStrSQL(strfield, "select top 1 " + strfield + " from [op_Seae] where " + strfield + " like '" + strCONTENT.Trim() + "%' order by " + strfield + " DESC");
|
|
|
if (strRULENOLENGTH == "")
|
|
|
{
|
|
|
strRULENOLENGTH = "1";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strRULENOLENGTH = strRULENOLENGTH.Replace(strCONTENT.Trim(), "");
|
|
|
inum = int.Parse(strRULENOLENGTH.Trim());
|
|
|
inum = inum + 1;
|
|
|
strRULENOLENGTH = inum.ToString();
|
|
|
}
|
|
|
int j = iRULENOLENGTH - strRULENOLENGTH.Length;
|
|
|
for (int i = 1; i <= j; i++)
|
|
|
{
|
|
|
strRULENOLENGTH = "0" + strRULENOLENGTH;
|
|
|
}
|
|
|
//
|
|
|
strCONTENT = strCONTENT + strRULENOLENGTH;
|
|
|
return strCONTENT;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return "";
|
|
|
}
|
|
|
#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 in (select bsno from v_op_bill where parentid='" + 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;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static bool GetAmendCount(string BSNO)
|
|
|
{
|
|
|
var isfee = false;
|
|
|
var strSql = new StringBuilder();
|
|
|
strSql.Append("Select count(*) as count ");
|
|
|
strSql.Append(" from op_amend ");
|
|
|
strSql.Append(" where PARENTID='" + 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;
|
|
|
}
|
|
|
public static bool GetFenCount(string BSNO)
|
|
|
{
|
|
|
var isfee = false;
|
|
|
var strSql = new StringBuilder();
|
|
|
strSql.Append("Select count(*) as count ");
|
|
|
strSql.Append(" from op_seae ");
|
|
|
strSql.Append(" where BSNO<>'"+BSNO+"' AND MASTERNO='" + 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 委托业务费用加锁
|
|
|
/// <summary>
|
|
|
/// 委托业务费用加锁
|
|
|
/// </summary>
|
|
|
/// <param name="tempBSNO">委托业务编号</param>
|
|
|
/// <returns>值等于1表示加锁成功 值不等于1表示加锁失败</returns>
|
|
|
public static int LockFeeStatus ( string tempBSNO )
|
|
|
{
|
|
|
int iResult = 0;
|
|
|
|
|
|
using (SqlTransaction sqlTran = SqlHelper.BeginTransaction(SqlHelper.ConnectionStringLocalTransaction))
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
SqlParameter[] parms = new SqlParameter[] {
|
|
|
new SqlParameter("@BSNO",SqlDbType.VarChar,100)
|
|
|
};
|
|
|
|
|
|
parms[0].Value = tempBSNO;
|
|
|
SqlHelper.ExecuteNonQuery(sqlTran, CommandType.Text, "UPDATE op_Seae SET FEESTATUS = 1 WHERE BSNO = @BSNO", parms);
|
|
|
|
|
|
sqlTran.Commit();
|
|
|
iResult = 1;//状态为1表示更新成功
|
|
|
}
|
|
|
catch (Exception execError)
|
|
|
{
|
|
|
iResult = -1;//有异常,更新失败
|
|
|
sqlTran.Rollback();
|
|
|
iResult = -2;//更新异常,事务已回滚成功
|
|
|
throw execError;
|
|
|
}
|
|
|
finally
|
|
|
{
|
|
|
SqlHelper.CloseConnection();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return iResult;
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 委托业务费用解锁
|
|
|
/// <summary>
|
|
|
/// 委托业务费用解锁
|
|
|
/// </summary>
|
|
|
/// <param name="tempBSNO">委托业务编号</param>
|
|
|
/// <returns>值等于1表示解锁成功 值不等于1表示解锁失败</returns>
|
|
|
public static int UnLockFeeStatus ( string tempBSNO )
|
|
|
{
|
|
|
int iResult = 0;
|
|
|
|
|
|
using (SqlTransaction sqlTran = SqlHelper.BeginTransaction(SqlHelper.ConnectionStringLocalTransaction))
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
SqlParameter[] parms = new SqlParameter[] {
|
|
|
new SqlParameter("@BSNO",SqlDbType.VarChar,100)
|
|
|
};
|
|
|
|
|
|
parms[0].Value = tempBSNO;
|
|
|
SqlHelper.ExecuteNonQuery(sqlTran, CommandType.Text, "UPDATE op_Seae SET FEESTATUS =0 WHERE BSNO = @BSNO", parms);
|
|
|
|
|
|
sqlTran.Commit();
|
|
|
iResult = 1;//状态为1表示更新成功
|
|
|
}
|
|
|
catch (Exception execError)
|
|
|
{
|
|
|
iResult = -1;//有异常,更新失败
|
|
|
sqlTran.Rollback();
|
|
|
iResult = -2;//更新异常,事务已回滚成功
|
|
|
throw execError;
|
|
|
}
|
|
|
finally
|
|
|
{
|
|
|
SqlHelper.CloseConnection();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return iResult;
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 提单信息
|
|
|
|
|
|
static public List<MsOpSeaeBill> GetBillList ( string strCondition, string sort = null, bool ishp = false)
|
|
|
{
|
|
|
if (ishp)
|
|
|
{
|
|
|
if (!string.IsNullOrEmpty(strCondition))
|
|
|
{
|
|
|
strCondition = strCondition + " and ISNULL(ISHP,0)=1 ";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strCondition = " ISNULL(ISHP,0)=1 ";
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
|
|
|
if (!string.IsNullOrEmpty(strCondition))
|
|
|
{
|
|
|
strCondition = strCondition + " and ISNULL(ISHP,0)=0 ";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strCondition = " ISNULL(ISHP,0)=0 ";
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
var strSql = new StringBuilder();
|
|
|
strSql.Append("SELECT AS_ID,BSNO,CUSTNO,MBLNO,HBLNO,TEMPLATE,BILLTYPE,SHIPPERID,");
|
|
|
strSql.Append("CONSIGNEEID,NOTIFYPARTYID,NOTIFYPARTYIDSECOND,SHIPPER,CONSIGNEE,NOTIFYPARTY,AGENTID,AGENT,YARD,VESSEL,VOYNO,ETD,CLOSINGDATE,ETA,");
|
|
|
strSql.Append("PlACERECEIPT,PORTLOADID,PORTLOAD,PORTDISCHARGEID,PORTDISCHARGE,PLACEDELIVERYID,PLACEDELIVERY,DESTINATIONID,DESTINATION,");
|
|
|
strSql.Append("NOBILL,ISSUETYPE,ISSUEDATE,ISSUEPLACE,BLFRT,PREPARDAT,PAYABLEAT,[SERVICE],MARKS,CNTRSEALNO,NOPKGS,[DESCRIPTION],GOODSNAME,");
|
|
|
strSql.Append("GROSSWEIGHT,MEASUREMENT,PKGS,KINDPKGS,KGS,CBM,TOTALNO,CNTRNO,PRINTSTATUS,INPUTDATE,");
|
|
|
strSql.Append("CNTRTOTAL,INPUTBY,PLACERECEIPTID,ORDERCORP,ORDERCONTENT,REMARKS,BLISSUESTATUS ");
|
|
|
strSql.Append(",[SHIPPERCODE],SHIPPERCOUNTRY,SHIPPERTEL,[SHIPPEREMAIL],[CONSIGNEECODE],CONSIGNEECOUNTRY,CONSIGNEETEL,[CONSIGNEEEMAIL],[NOTIFYPARTYCODE],NOTIFYPARTYCOUNTRY,NOTIFYPARTYTEL,[NOTIFYPARTYEMAIL]");
|
|
|
strSql.Append(",[NOTIFYPARTYCODESECOND],NOTIFYPARTYCOUNTRYSECOND,NOTIFYPARTYTELSECOND,[NOTIFYPARTYEMAILSECOND],NOTIFYPARTYSECOND");
|
|
|
strSql.Append(",SHIPPERNAME,SHIPPERADDR1,CONSIGNEENAME,CONSIGNEEADDR1,NOTIFYPARTYNAME,NOTIFYPARTYADDR1,SCACCODE");
|
|
|
strSql.Append(",[DELIVERYTONAME],[DELIVERYTOADDR1],[DELIVERYTOADDR2],[DELIVERYTOCITY],[DELIVERYTOPOSTCODE],[DELIVERYTOCOUNTRY],[DELIVERYTOTEL],MODIFYTIME,MODIFYUSER");
|
|
|
|
|
|
strSql.Append(",(select CONTRACTNO from op_seae where BSNO = op_seae_billmanage.BSNO) CONTRACTNO");
|
|
|
strSql.Append(",(select HSCODE from op_seae where BSNO = op_seae_billmanage.BSNO) HSCODE");
|
|
|
strSql.Append(",(select CARRIER from op_seae where BSNO = op_seae_billmanage.BSNO) CARRIER");
|
|
|
strSql.Append(",(select ISCONTAINERSOC from op_seae where BSNO = op_seae_billmanage.BSNO) ISCONTAINERSOC");
|
|
|
strSql.Append(",(select CARGOID from op_seae where BSNO = op_seae_billmanage.BSNO) CARGOID");
|
|
|
strSql.Append(",(select COPYNOBILL from op_seae where BSNO = op_seae_billmanage.BSNO) COPYNOBILL");
|
|
|
|
|
|
strSql.Append(",CUSTOMERNAME,OPERATOR,OPERATORTEL,OPERATOREMAIL,ORDERNO");
|
|
|
|
|
|
strSql.Append(" from op_seae_billmanage ");
|
|
|
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 MBLNO,HBLNO desc");
|
|
|
}
|
|
|
return SetBillData(strSql);
|
|
|
}
|
|
|
|
|
|
|
|
|
static public MsOpSeaeBill GetBillData ( string condition )
|
|
|
{
|
|
|
var strSql = new StringBuilder();
|
|
|
strSql.Append("SELECT AS_ID,BSNO,CUSTNO,MBLNO,HBLNO,TEMPLATE,BILLTYPE,SHIPPERID,");
|
|
|
strSql.Append("CONSIGNEEID,NOTIFYPARTYID,NOTIFYPARTYIDSECOND,SHIPPER,CONSIGNEE,NOTIFYPARTY,AGENTID,AGENT,YARD,VESSEL,VOYNO,ETD,CLOSINGDATE,ETA,");
|
|
|
strSql.Append("PlACERECEIPT,PORTLOADID,PORTLOAD,PORTDISCHARGEID,PORTDISCHARGE,PLACEDELIVERYID,PLACEDELIVERY,DESTINATIONID,DESTINATION,");
|
|
|
strSql.Append("NOBILL,ISSUETYPE,ISSUEDATE,ISSUEPLACE,BLFRT,PREPARDAT,PAYABLEAT,[SERVICE],MARKS,CNTRSEALNO,NOPKGS,[DESCRIPTION],GOODSNAME,");
|
|
|
strSql.Append("GROSSWEIGHT,MEASUREMENT,PKGS,KINDPKGS,KGS,CBM,TOTALNO,CNTRNO,PRINTSTATUS,INPUTDATE,");
|
|
|
strSql.Append("CNTRTOTAL,INPUTBY,PLACERECEIPTID,ORDERCORP,ORDERCONTENT,REMARKS,BLISSUESTATUS");
|
|
|
strSql.Append(",[SHIPPERCODE],SHIPPERCOUNTRY,SHIPPERTEL,[SHIPPEREMAIL],[CONSIGNEECODE],CONSIGNEECOUNTRY,CONSIGNEETEL,[CONSIGNEEEMAIL],[NOTIFYPARTYCODE],NOTIFYPARTYCOUNTRY,NOTIFYPARTYTEL,[NOTIFYPARTYEMAIL]");
|
|
|
strSql.Append(",[NOTIFYPARTYCODESECOND],NOTIFYPARTYCOUNTRYSECOND,NOTIFYPARTYTELSECOND,[NOTIFYPARTYEMAILSECOND],NOTIFYPARTYSECOND");
|
|
|
strSql.Append(",SHIPPERNAME,SHIPPERADDR1,CONSIGNEENAME,CONSIGNEEADDR1,NOTIFYPARTYNAME,NOTIFYPARTYADDR1,SCACCODE");
|
|
|
strSql.Append(",[DELIVERYTONAME],[DELIVERYTOADDR1],[DELIVERYTOADDR2],[DELIVERYTOCITY],[DELIVERYTOPOSTCODE],[DELIVERYTOCOUNTRY],[DELIVERYTOTEL],MODIFYTIME,MODIFYUSER");
|
|
|
|
|
|
strSql.Append(",(select CONTRACTNO from op_seae where BSNO = op_seae_billmanage.BSNO) CONTRACTNO");
|
|
|
strSql.Append(",(select HSCODE from op_seae where BSNO = op_seae_billmanage.BSNO) HSCODE");
|
|
|
strSql.Append(",(select CARRIER from op_seae where BSNO = op_seae_billmanage.BSNO) CARRIER");
|
|
|
strSql.Append(",(select ISCONTAINERSOC from op_seae where BSNO = op_seae_billmanage.BSNO) ISCONTAINERSOC");
|
|
|
strSql.Append(",(select CARGOID from op_seae where BSNO = op_seae_billmanage.BSNO) CARGOID");
|
|
|
strSql.Append(",(select COPYNOBILL from op_seae where BSNO = op_seae_billmanage.BSNO) COPYNOBILL");
|
|
|
strSql.Append(",CUSTOMERNAME,OPERATOR,OPERATORTEL,OPERATOREMAIL,ORDERNO");
|
|
|
strSql.Append(" from op_seae_billmanage ");
|
|
|
if (!string.IsNullOrEmpty(condition))
|
|
|
{
|
|
|
strSql.Append(" where " + condition);
|
|
|
}
|
|
|
var list = SetBillData(strSql);
|
|
|
if (list.Count > 0)
|
|
|
return list[0];
|
|
|
return new MsOpSeaeBill();
|
|
|
}
|
|
|
|
|
|
private static List<MsOpSeaeBill> SetBillData ( StringBuilder strSql )
|
|
|
{
|
|
|
var headList = new List<MsOpSeaeBill>();
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
|
|
|
{
|
|
|
while (reader.Read())
|
|
|
{
|
|
|
MsOpSeaeBill data = new MsOpSeaeBill();
|
|
|
#region Set DB data to Object
|
|
|
data.AS_ID = Convert.ToString(reader["AS_ID"]);//业务编号
|
|
|
data.BSNO = Convert.ToString(reader["BSNO"]);//业务编号
|
|
|
data.MBLNO = Convert.ToString(reader["MBLNO"]);//主提单号
|
|
|
data.CUSTNO = Convert.ToString(reader["CUSTNO"]);//主提单号
|
|
|
data.HBLNO = Convert.ToString(reader["HBLNO"]);//分提单号
|
|
|
data.ORDERCORP = Convert.ToString(reader["ORDERCORP"]);// 委托对象
|
|
|
data.ORDERCONTENT = Convert.ToString(reader["ORDERCONTENT"]);// 委托内容
|
|
|
data.TEMPLATE = Convert.ToString(reader["TEMPLATE"]);// 业务状态
|
|
|
data.BILLTYPE = Convert.ToString(reader["BILLTYPE"]);// 费用状态
|
|
|
data.INPUTBY = Convert.ToString(reader["INPUTBY"]);//录入人
|
|
|
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"]);//卸货港
|
|
|
data.CNTRNO = Convert.ToString(reader["CNTRNO"]);//集装箱大写
|
|
|
data.CNTRTOTAL = Convert.ToString(reader["CNTRTOTAL"]);//集装箱全部内容
|
|
|
data.GOODSNAME = Convert.ToString(reader["GOODSNAME"]);//品名
|
|
|
if (reader["KGS"] != DBNull.Value)
|
|
|
data.KGS = Convert.ToDecimal(reader["KGS"]);//毛重
|
|
|
if (reader["PKGS"] != DBNull.Value)
|
|
|
data.PKGS = Convert.ToInt32(reader["PKGS"]);//件数
|
|
|
if (reader["CBM"] != DBNull.Value)
|
|
|
data.CBM = Convert.ToDecimal(reader["CBM"]);//立方数/尺码
|
|
|
|
|
|
data.YARD = Convert.ToString(reader["YARD"]);//场站/靠泊码头
|
|
|
|
|
|
data.KINDPKGS = Convert.ToString(reader["KINDPKGS"]);//件数包装
|
|
|
data.CNTRSEALNO = Convert.ToString(reader["CNTRSEALNO"]);//箱号封号
|
|
|
data.NOPKGS = Convert.ToString(reader["NOPKGS"]);//件数包装
|
|
|
data.GROSSWEIGHT = Convert.ToString(reader["GROSSWEIGHT"]);//货物毛重
|
|
|
data.MEASUREMENT = Convert.ToString(reader["MEASUREMENT"]);//货物尺码
|
|
|
data.DESCRIPTION = Convert.ToString(reader["DESCRIPTION"]);//货物描述
|
|
|
data.TOTALNO = Convert.ToString(reader["TOTALNO"]);//件数大写
|
|
|
data.SHIPPERID = Convert.ToString(reader["SHIPPERID"]);//发货人
|
|
|
data.CONSIGNEEID = Convert.ToString(reader["CONSIGNEEID"]);//收货人
|
|
|
data.NOTIFYPARTYID = Convert.ToString(reader["NOTIFYPARTYID"]);//通知人
|
|
|
data.NOTIFYPARTYIDSECOND = Convert.ToString(reader["NOTIFYPARTYIDSECOND"]);//第二通知人
|
|
|
//data.SHIPPER = Convert.ToString(reader["SHIPPER"]);//发货人内容
|
|
|
data.SHIPPER = Convert.ToString(reader["SHIPPER"]).Replace(@"\\\\", "\n").Replace(@"^", "\'");//发货人内容
|
|
|
//data.CONSIGNEE = Convert.ToString(reader["CONSIGNEE"]);//收货人内容
|
|
|
data.CONSIGNEE = Convert.ToString(reader["CONSIGNEE"]).Replace(@"\\\\", "\n").Replace(@"^", "\'");//收货人内容
|
|
|
//data.NOTIFYPARTY = Convert.ToString(reader["NOTIFYPARTY"]);//通知人内容
|
|
|
data.NOTIFYPARTY = Convert.ToString(reader["NOTIFYPARTY"]).Replace(@"\\\\", "\n").Replace(@"^", "\'");//通知人内容
|
|
|
data.NOTIFYPARTYSECOND = Convert.ToString(reader["NOTIFYPARTYSECOND"]);//通知人内容
|
|
|
data.AGENTID = Convert.ToString(reader["AGENTID"]);//国外代理
|
|
|
data.AGENT = Convert.ToString(reader["AGENT"]);//国外代理内容
|
|
|
data.CLOSINGDATE = Convert.ToString(reader["CLOSINGDATE"]);//截港日期
|
|
|
if (reader["ETA"] != DBNull.Value)
|
|
|
data.ETA = Convert.ToDateTime(reader["ETA"]).ToString("yyyy-MM-dd");//预抵日期
|
|
|
data.PLACERECEIPT = Convert.ToString(reader["PlACERECEIPT"]);//收货地
|
|
|
data.PLACERECEIPTID = Convert.ToString(reader["PlACERECEIPTID"]);//收货地
|
|
|
|
|
|
data.PLACEDELIVERYID = Convert.ToString(reader["PLACEDELIVERYID"]);//交货地代码
|
|
|
data.PLACEDELIVERY = Convert.ToString(reader["PLACEDELIVERY"]);//交货地
|
|
|
data.DESTINATIONID = Convert.ToString(reader["DESTINATIONID"]);//目的地代码
|
|
|
data.DESTINATION = Convert.ToString(reader["DESTINATION"]);//目的地
|
|
|
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.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"]);//唛头
|
|
|
data.REMARKS = Convert.ToString(reader["REMARKS"]);//唛头
|
|
|
data.BLISSUESTATUS = Convert.ToString(reader["BLISSUESTATUS"]);//唛头
|
|
|
data.SHIPPERCODE = Convert.ToString(reader["SHIPPERCODE"]);//发货人
|
|
|
data.SHIPPERCOUNTRY = Convert.ToString(reader["SHIPPERCOUNTRY"]);//发货人
|
|
|
data.SHIPPERTEL = Convert.ToString(reader["SHIPPERTEL"]);//发货人
|
|
|
data.SHIPPEREMAIL = Convert.ToString(reader["SHIPPEREMAIL"]);//发货人
|
|
|
data.CONSIGNEECODE = Convert.ToString(reader["CONSIGNEECODE"]);//收货人
|
|
|
data.CONSIGNEECOUNTRY = Convert.ToString(reader["CONSIGNEECOUNTRY"]);//发货人
|
|
|
data.CONSIGNEETEL = Convert.ToString(reader["CONSIGNEETEL"]);//收货人
|
|
|
data.CONSIGNEEEMAIL = Convert.ToString(reader["CONSIGNEEEMAIL"]);//收货人
|
|
|
data.NOTIFYPARTYCODE = Convert.ToString(reader["NOTIFYPARTYCODE"]);//通知人
|
|
|
data.NOTIFYPARTYCOUNTRY = Convert.ToString(reader["NOTIFYPARTYCOUNTRY"]);//发货人
|
|
|
data.NOTIFYPARTYTEL = Convert.ToString(reader["NOTIFYPARTYTEL"]);//通知人
|
|
|
data.NOTIFYPARTYEMAIL = Convert.ToString(reader["NOTIFYPARTYEMAIL"]);//通知人
|
|
|
data.NOTIFYPARTYCODESECOND = Convert.ToString(reader["NOTIFYPARTYCODESECOND"]);//通知人
|
|
|
data.NOTIFYPARTYCOUNTRYSECOND = Convert.ToString(reader["NOTIFYPARTYCOUNTRYSECOND"]);//发货人
|
|
|
data.NOTIFYPARTYTELSECOND = Convert.ToString(reader["NOTIFYPARTYTELSECOND"]);//通知人
|
|
|
data.NOTIFYPARTYEMAILSECOND = Convert.ToString(reader["NOTIFYPARTYEMAILSECOND"]);//通知人
|
|
|
|
|
|
if (reader["ISCONTAINERSOC"] != DBNull.Value)
|
|
|
data.ISCONTAINERSOC = Convert.ToBoolean(reader["ISCONTAINERSOC"]);//货主箱标志,是否自有箱
|
|
|
|
|
|
data.CONTRACTNO = Convert.ToString(reader["CONTRACTNO"]);//
|
|
|
data.HSCODE = Convert.ToString(reader["HSCODE"]);//
|
|
|
data.CARRIER = Convert.ToString(reader["CARRIER"]);//
|
|
|
data.CARGOID = Convert.ToString(reader["CARGOID"]);//
|
|
|
data.COPYNOBILL = Convert.ToString(reader["COPYNOBILL"]);//
|
|
|
data.PRINTSTATUS = Convert.ToString(reader["PRINTSTATUS"]);//
|
|
|
if (reader["INPUTDATE"] != DBNull.Value)
|
|
|
data.INPUTDATE = Convert.ToDateTime(reader["INPUTDATE"]).ToString("yyyy-MM-dd HH:mm:ss");//签单日期
|
|
|
data.SHIPPERNAME = Convert.ToString(reader["SHIPPERNAME"]);//发货人
|
|
|
data.SHIPPERADDR1 = Convert.ToString(reader["SHIPPERADDR1"]);//发货人
|
|
|
data.CONSIGNEENAME = Convert.ToString(reader["CONSIGNEENAME"]);//收货人
|
|
|
data.CONSIGNEEADDR1 = Convert.ToString(reader["CONSIGNEEADDR1"]);//收货人
|
|
|
data.NOTIFYPARTYNAME = Convert.ToString(reader["NOTIFYPARTYNAME"]);//通知人
|
|
|
data.NOTIFYPARTYADDR1 = Convert.ToString(reader["NOTIFYPARTYADDR1"]);//通知人
|
|
|
data.SCACCODE = Convert.ToString(reader["SCACCODE"]);//通知人
|
|
|
data.DELIVERYTONAME = Convert.ToString(reader["DELIVERYTONAME"]);//通知人
|
|
|
data.DELIVERYTOADDR1 = Convert.ToString(reader["DELIVERYTOADDR1"]);//通知人
|
|
|
data.DELIVERYTOADDR2 = Convert.ToString(reader["DELIVERYTOADDR2"]);//通知人
|
|
|
data.DELIVERYTOTEL = Convert.ToString(reader["DELIVERYTOTEL"]);//通知人
|
|
|
data.DELIVERYTOPOSTCODE = Convert.ToString(reader["DELIVERYTOPOSTCODE"]);//通知人
|
|
|
data.DELIVERYTOCOUNTRY = Convert.ToString(reader["DELIVERYTOCOUNTRY"]);//通知人
|
|
|
data.DELIVERYTOCITY = Convert.ToString(reader["DELIVERYTOCITY"]);//通知人
|
|
|
data.MODIFYUSER = Convert.ToString(reader["MODIFYUSER"]);
|
|
|
if (reader["MODIFYTIME"] != DBNull.Value)
|
|
|
data.MODIFYTIME = Convert.ToDateTime(reader["MODIFYTIME"]).ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
|
data.CUSTOMERNAME = Convert.ToString(reader["CUSTOMERNAME"]);
|
|
|
data.OPERATOR = Convert.ToString(reader["OPERATOR"]);
|
|
|
data.OPERATORTEL = Convert.ToString(reader["OPERATORTEL"]);
|
|
|
data.OPERATOREMAIL = Convert.ToString(reader["OPERATOREMAIL"]);
|
|
|
data.ORDERNO = Convert.ToString(reader["ORDERNO"]);
|
|
|
#endregion
|
|
|
headList.Add(data);
|
|
|
}
|
|
|
reader.Close();
|
|
|
}
|
|
|
return headList;
|
|
|
}
|
|
|
|
|
|
|
|
|
public static DBResult CreateHp(List<MsOpSeaeBill> bodyList, string userid, string username)
|
|
|
{
|
|
|
var bsno = "";
|
|
|
var result = new DBResult();
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
using (var conn = db.CreateConnection())
|
|
|
{
|
|
|
conn.Open();
|
|
|
var tran = conn.BeginTransaction();
|
|
|
try
|
|
|
{
|
|
|
|
|
|
if (bodyList != null)
|
|
|
{
|
|
|
|
|
|
var headData = new MsOpSeaeBill();
|
|
|
headData.INPUTBY = username;
|
|
|
var AS_ID = Guid.NewGuid().ToString();
|
|
|
headData.AS_ID = AS_ID;
|
|
|
headData.DbOperationType = DbOperationType.DbotIns;
|
|
|
headData.INPUTDATE = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
|
//var cmddelete = db.GetSqlStringCommand(@"delete from op_ctn where BSNO='" + bsno + "'");
|
|
|
//db.ExecuteNonQuery(cmddelete, tran);
|
|
|
foreach (var enumValue in bodyList)
|
|
|
{
|
|
|
headData.BSNO = enumValue.BSNO;
|
|
|
|
|
|
bsno = enumValue.BSNO;
|
|
|
|
|
|
headData.MBLNO = enumValue.MBLNO;
|
|
|
headData.VESSEL = enumValue.VESSEL;
|
|
|
headData.VOYNO = enumValue.VOYNO;
|
|
|
headData.HBLNO = enumValue.HBLNO;
|
|
|
headData.ETD = enumValue.ETA;
|
|
|
headData.ETA = enumValue.ETA;
|
|
|
headData.ISHP = true;
|
|
|
headData.PKGS = Convert.ToInt32(enumValue.PKGS);
|
|
|
headData.KGS = Convert.ToDecimal(enumValue.KGS);
|
|
|
headData.CBM = Convert.ToDecimal(enumValue.CBM);
|
|
|
headData.PORTLOAD = enumValue.PORTLOAD;
|
|
|
headData.PORTDISCHARGE = enumValue.PORTDISCHARGE;
|
|
|
headData.PORTLOADID = enumValue.PORTLOADID;
|
|
|
headData.PORTDISCHARGEID = enumValue.PORTDISCHARGEID;
|
|
|
headData.PLACERECEIPT = enumValue.PLACERECEIPT;
|
|
|
headData.PLACEDELIVERY = enumValue.PLACEDELIVERY;
|
|
|
headData.DESTINATION = enumValue.DESTINATION;
|
|
|
headData.SHIPPERID = enumValue.SHIPPERID;
|
|
|
headData.SHIPPER = enumValue.SHIPPER;
|
|
|
headData.CONSIGNEEID = enumValue.CONSIGNEEID;
|
|
|
headData.CONSIGNEE = enumValue.CONSIGNEE;
|
|
|
headData.NOTIFYPARTYID = enumValue.NOTIFYPARTYID;
|
|
|
headData.NOTIFYPARTY = enumValue.NOTIFYPARTY;
|
|
|
headData.MARKS = headData.MARKS+" "+enumValue.MARKS;
|
|
|
headData.DESCRIPTION = headData.DESCRIPTION+" "+ enumValue.DESCRIPTION;
|
|
|
headData.GROSSWEIGHT = enumValue.GROSSWEIGHT;
|
|
|
headData.MEASUREMENT = enumValue.MEASUREMENT;
|
|
|
headData.KINDPKGS = enumValue.KINDPKGS;
|
|
|
headData.NOPKGS = enumValue.NOPKGS;
|
|
|
headData.TOTALNO ="";
|
|
|
headData.BLFRT = enumValue.BLFRT;
|
|
|
headData.CNTRTOTAL = enumValue.CNTRTOTAL;
|
|
|
headData.CNTRNO = enumValue.CNTRNO;
|
|
|
headData.ISSUETYPE = enumValue.ISSUETYPE;
|
|
|
headData.ISSUEPLACE = enumValue.ISSUEPLACE;
|
|
|
headData.ISSUEDATE = enumValue.ISSUEDATE;
|
|
|
headData.AGENT = enumValue.AGENT;
|
|
|
if (headData.ETA == "") headData.ETA = null;
|
|
|
if (headData.ETD == "") headData.ETD = null;
|
|
|
headData.PAYABLEAT = enumValue.PAYABLEAT;
|
|
|
headData.PREPARDAT = enumValue.PREPARDAT;
|
|
|
headData.SERVICE = enumValue.SERVICE;
|
|
|
headData.PRINTSTATUS = "未打印";
|
|
|
headData.CARRIER = enumValue.CARRIER;
|
|
|
headData.NOBILL = enumValue.NOBILL;
|
|
|
|
|
|
var ctnlist = GetBodyList("BSNO='" + enumValue.AS_ID + "'");
|
|
|
|
|
|
if (ctnlist != null)
|
|
|
{
|
|
|
foreach (var enumValueCtn in ctnlist)
|
|
|
{
|
|
|
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,MASTERNO,WEIGHTYPE,WEIGHKGS,WEIGHATTN,WEIGHTEL,WEIGHSIGN,WEIGHDATE,TRUCKER,TRUCKFEE,FREESTORAGEDAY,STORAGEDAY,STORAGEPRICE,STORAGEFEE,FREECTNDAY,CTNDAY,CTNPRICE,CTNFEE,TRUCKNO,VGMCONNCOM,VGMADDR,VGMEMAIL,PCTN_ID) values (NEWID()"
|
|
|
+ ",'" + AS_ID + "','" + enumValueCtn.CTNCODE + "','" + enumValueCtn.SIZE + "','" + enumValueCtn.CTN + "'," + enumValueCtn.CTNNUM + "," + enumValueCtn.TEU + ",'" + enumValueCtn.CTNALL.Replace("'", "''") + "','" + enumValueCtn.CNTRNO + "','" + enumValueCtn.SEALNO + "','" + enumValueCtn.PKGS + "'," + enumValueCtn.KGS + "," + enumValueCtn.CBM + ",'" + enumValueCtn.REMARK + "','" + enumValueCtn.KINDPKGS + "'," + enumValueCtn.TAREWEIGHT + ",'','"
|
|
|
+ enumValueCtn.CTNSTATUS + "','" + enumValueCtn.MASTERNO + "','" + enumValueCtn.WEIGHTYPE + "'," + enumValueCtn.WEIGHKGS + ",'" + enumValueCtn.WEIGHATTN + "','" + enumValueCtn.WEIGHTEL + "','" + enumValueCtn.WEIGHSIGN + "','" + enumValueCtn.WEIGHDATE + "','" + enumValueCtn.TRUCKER + "'," + enumValueCtn.TRUCKFEE
|
|
|
+ "," + enumValueCtn.FREESTORAGEDAY + "," + enumValueCtn.STORAGEDAY + "," + enumValueCtn.STORAGEPRICE + "," + enumValueCtn.STORAGEFEE + "," + enumValueCtn.FREECTNDAY + "," + enumValueCtn.CTNDAY + "," + enumValueCtn.CTNPRICE + "," + enumValueCtn.CTNFEE + ",'" + enumValueCtn.TRUCKNO + "','" + enumValueCtn.VGMCONNCOM + "','" + enumValueCtn.VGMADDR + "','" + enumValueCtn.VGMEMAIL + "','" + enumValueCtn.CTN_ID + "')");
|
|
|
db.ExecuteNonQuery(cmdInsert, tran);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
var modb = new ModelObjectDB();
|
|
|
result = modb.Save(headData);
|
|
|
}
|
|
|
//
|
|
|
tran.Commit();
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
tran.Rollback();
|
|
|
result.Success = false;
|
|
|
result.Message = "保存出现错误,请重试或联系系统管理员";
|
|
|
return result;
|
|
|
}
|
|
|
}
|
|
|
getCNTRTOTALAllBill(bsno);
|
|
|
result.Success = true;
|
|
|
result.Message = "保存成功" + result.Message;
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region 退舱或推航次申请
|
|
|
|
|
|
public static DBResult SubmitTuiShen(String USERID, List<MsOpSeae> billList, string tuioptype,string reason)
|
|
|
{
|
|
|
var result = new DBResult();
|
|
|
var WorkFlowName = "OpTuiShenAudit";
|
|
|
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
using (DbConnection conn = db.CreateConnection())
|
|
|
{
|
|
|
conn.Open();
|
|
|
|
|
|
var tran = conn.BeginTransaction();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
|
|
|
foreach (var billno in billList)
|
|
|
{
|
|
|
|
|
|
|
|
|
Resultmb WorkResult = WorkFlowDAL.WorkFlowStart(WorkFlowName, billno.BSNO, USERID, billno.MBLNO, billno.BSNO, "MsOpSeae/TuiAudit");
|
|
|
if (WorkResult.Success == true)
|
|
|
{
|
|
|
var _Comm = "";
|
|
|
var _TUISHEN = "";
|
|
|
|
|
|
if (tuioptype == "V")
|
|
|
{
|
|
|
if (WorkResult.islast == true)
|
|
|
{
|
|
|
_Comm = "update OP_SEAE set ISTUI='1' where BSNO=@BSNO";
|
|
|
var cmdInsert = db.GetSqlStringCommand(@"insert into op_tuishen (GID,BSNO,CREATEUSER,CREATETIME,REASON,TUITYPE,AUDITSTATUS) values (NEWID(),'" + billno.BSNO + "','" + USERID + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" + reason + "','推航次','审核通过')");
|
|
|
db.ExecuteNonQuery(cmdInsert, tran);
|
|
|
var cmdDelete = db.GetSqlStringCommand("insert into op_status(ST_ID,BSNO,STATUS,ISCOMP,COMPTIME,INPUTTIME,STTYPE) values(NEWID(),'" + billno.BSNO + "','推航次',1,'" + DateTime.Now.ToString() + "','" + DateTime.Now.ToString() + "','1')");
|
|
|
db.ExecuteNonQuery(cmdDelete, tran);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
_Comm = "update OP_SEAE set ISTUI='2' where BSNO=@BSNO";
|
|
|
var cmdInsert = db.GetSqlStringCommand(@"insert into op_tuishen (GID,BSNO,CREATEUSER,CREATETIME,REASON,TUITYPE,AUDITSTATUS) values (NEWID(),'" + billno.BSNO + "','" + USERID + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" + reason + "','推航次','提交审核')");
|
|
|
db.ExecuteNonQuery(cmdInsert, tran);
|
|
|
var cmdDelete = db.GetSqlStringCommand("insert into op_status(ST_ID,BSNO,STATUS,ISCOMP,COMPTIME,INPUTTIME,STTYPE) values(NEWID(),'" + billno.BSNO + "','申请推航次',1,'" + DateTime.Now.ToString() + "','" + DateTime.Now.ToString() + "','1')");
|
|
|
db.ExecuteNonQuery(cmdDelete, tran);
|
|
|
|
|
|
}
|
|
|
var cmdupdate = db.GetSqlStringCommand(_Comm);
|
|
|
cmdupdate.Parameters.Clear();
|
|
|
db.AddInParameter(cmdupdate, "@BSNO", DbType.String, billno.BSNO);
|
|
|
db.ExecuteNonQuery(cmdupdate, tran);
|
|
|
}
|
|
|
else {
|
|
|
|
|
|
if (WorkResult.islast == true)
|
|
|
{
|
|
|
_Comm = "update OP_SEAE set ISCANCEL='1' where BSNO=@BSNO";
|
|
|
var cmdInsert = db.GetSqlStringCommand(@"insert into op_tuishen (GID,BSNO,CREATEUSER,CREATETIME,REASON,TUITYPE,AUDITSTATUS) values (NEWID(),'" + billno.BSNO + "','" + USERID + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" + reason + "','退舱','审核通过')");
|
|
|
db.ExecuteNonQuery(cmdInsert, tran);
|
|
|
var cmdDelete = db.GetSqlStringCommand("insert into op_status(ST_ID,BSNO,STATUS,ISCOMP,COMPTIME,INPUTTIME,STTYPE) values(NEWID(),'" + billno.BSNO + "','退舱',1,'" + DateTime.Now.ToString() + "','" + DateTime.Now.ToString() + "','1')");
|
|
|
db.ExecuteNonQuery(cmdDelete, tran);
|
|
|
var cmdUpdateOrder = db.GetSqlStringCommand("update crm_seaeorder set ORSTATUS=4 where bsno='" + billno.BSNO + "'");
|
|
|
db.ExecuteNonQuery(cmdUpdateOrder, tran);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
_Comm = "update OP_SEAE set ISCANCEL='2' where BSNO=@BSNO";
|
|
|
var cmdInsert = db.GetSqlStringCommand(@"insert into op_tuishen (GID,BSNO,CREATEUSER,CREATETIME,REASON,TUITYPE,AUDITSTATUS) values (NEWID(),'" + billno.BSNO + "','" + USERID + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" + reason + "','退舱','提交审核')");
|
|
|
db.ExecuteNonQuery(cmdInsert, tran);
|
|
|
var cmdDelete = db.GetSqlStringCommand("insert into op_status(ST_ID,BSNO,STATUS,ISCOMP,COMPTIME,INPUTTIME,STTYPE) values(NEWID(),'" + billno.BSNO + "','申请退舱',1,'" + DateTime.Now.ToString() + "','" + DateTime.Now.ToString() + "','1')");
|
|
|
db.ExecuteNonQuery(cmdDelete, tran);
|
|
|
}
|
|
|
var cmdupdate = db.GetSqlStringCommand(_Comm);
|
|
|
cmdupdate.Parameters.Clear();
|
|
|
db.AddInParameter(cmdupdate, "@BSNO", DbType.String, billno.BSNO);
|
|
|
db.ExecuteNonQuery(cmdupdate, tran);
|
|
|
|
|
|
}
|
|
|
|
|
|
result.Success = true;
|
|
|
result.Message = "已提交!";
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
|
|
|
result.Success = false;
|
|
|
result.Message = "提交审核错误!";
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
tran.Commit();
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
tran.Rollback();
|
|
|
|
|
|
result.Success = false;
|
|
|
result.Message = "提交审核错误,请重试或联系系统管理员";
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public static DBResult SubmitTuiShenBack(String USERID, List<MsOpSeae> billList)
|
|
|
{
|
|
|
var result = new DBResult();
|
|
|
var WorkFlowName = "OpTuiShenAudit";
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
using (var conn = db.CreateConnection())
|
|
|
{
|
|
|
conn.Open();
|
|
|
var tran = conn.BeginTransaction();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
|
|
|
foreach (var billno in billList)
|
|
|
{
|
|
|
Resultmb WorkResult = WorkFlowDAL.WorkFlowReset(WorkFlowName, billno.BSNO, USERID);
|
|
|
if (WorkResult.Success == true)
|
|
|
{
|
|
|
var cmdupdate = db.GetSqlStringCommand("update OP_SEAE set ISCANCEL='0',ISTUI='0' where BSNO=@BSNO");
|
|
|
|
|
|
|
|
|
cmdupdate.Parameters.Clear();
|
|
|
db.AddInParameter(cmdupdate, "@BSNO", DbType.String, billno.BSNO);
|
|
|
db.ExecuteNonQuery(cmdupdate, tran);
|
|
|
|
|
|
var cmdInsert = db.GetSqlStringCommand(@"DELETE FROM op_tuishen where BSNO='" + billno.BSNO + "' AND AUDITSTATUS<>'审核通过'");
|
|
|
db.ExecuteNonQuery(cmdInsert, tran);
|
|
|
|
|
|
var cmdDelete = db.GetSqlStringCommand("insert into op_status(ST_ID,BSNO,STATUS,ISCOMP,COMPTIME,INPUTTIME,STTYPE) values(NEWID(),'" + billno.BSNO + "','撤销申请退舱',1,'" + DateTime.Now.ToString() + "','" + DateTime.Now.ToString() + "','1')");
|
|
|
db.ExecuteNonQuery(cmdDelete, tran);
|
|
|
|
|
|
result = new DBResult();
|
|
|
result.Success = true;
|
|
|
result.Message = "撤销提交成功";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
|
|
|
result = new DBResult();
|
|
|
result.Success = false;
|
|
|
result.Message = "已部分审核此业务,不允许撤回提交!";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
tran.Commit();
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
tran.Rollback();
|
|
|
|
|
|
result.Success = false;
|
|
|
result.Message = "撤销提交错误,请重试或联系系统管理员";
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static DBResult AuditTuiList(List<MsOpSeae> boday, String USERID)
|
|
|
{
|
|
|
var result = new DBResult();
|
|
|
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
using (var conn = db.CreateConnection())
|
|
|
{
|
|
|
conn.Open();
|
|
|
var tran = conn.BeginTransaction();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
|
|
|
|
|
|
if (boday != null)
|
|
|
{
|
|
|
|
|
|
|
|
|
foreach (var enumValue in boday)
|
|
|
{
|
|
|
|
|
|
if (enumValue.ISTUI =="2" || enumValue.ISCANCEL =="2")
|
|
|
{
|
|
|
var _Comm = "";
|
|
|
Resultmb WorkResult = WorkFlowDAL.InsertWorkFlowDo("OpTuiShenAudit", enumValue.BSNO, USERID, tran,enumValue.MBLNO);
|
|
|
if (WorkResult.Success == true && WorkResult.islast == true)
|
|
|
{
|
|
|
if (enumValue.ISTUI == "2")
|
|
|
{
|
|
|
_Comm = "update OP_SEAE set ISTUI='1' where BSNO=@BSNO";
|
|
|
var cmdInsert = db.GetSqlStringCommand(@"update op_tuishen set AUDITSTATUS='审核通过',AUDITBY='" + USERID + "',AUDITTIME='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "' where BSNO='" + enumValue.BSNO + "' and TUITYPE='推航次' and AUDITSTATUS<>'审核通过'");
|
|
|
db.ExecuteNonQuery(cmdInsert, tran);
|
|
|
var cmdDelete = db.GetSqlStringCommand("insert into op_status(ST_ID,BSNO,STATUS,ISCOMP,COMPTIME,INPUTTIME,STTYPE) values(NEWID(),'" + enumValue.BSNO + "','推航次',1,'" + DateTime.Now.ToString() + "','" + DateTime.Now.ToString() + "','1')");
|
|
|
db.ExecuteNonQuery(cmdDelete, tran);
|
|
|
|
|
|
}
|
|
|
else if (enumValue.ISCANCEL == "2")
|
|
|
{
|
|
|
|
|
|
_Comm = "update OP_SEAE set ISCANCEL='1' where BSNO=@BSNO";
|
|
|
var cmdInsert = db.GetSqlStringCommand(@"update op_tuishen set AUDITSTATUS='审核通过',AUDITBY='" + USERID + "',AUDITTIME='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "' where BSNO='" + enumValue.BSNO + "' and TUITYPE='退舱' and AUDITSTATUS<>'审核通过'");
|
|
|
db.ExecuteNonQuery(cmdInsert, tran);
|
|
|
var cmdDelete = db.GetSqlStringCommand("insert into op_status(ST_ID,BSNO,STATUS,ISCOMP,COMPTIME,INPUTTIME,STTYPE) values(NEWID(),'" + enumValue.BSNO + "','退舱',1,'" + DateTime.Now.ToString() + "','" + DateTime.Now.ToString() + "','1')");
|
|
|
db.ExecuteNonQuery(cmdDelete, tran);
|
|
|
var cmdUpdateOrder = db.GetSqlStringCommand("update crm_seaeorder set ORSTATUS=4 where bsno='" + enumValue.BSNO + "'");
|
|
|
db.ExecuteNonQuery(cmdUpdateOrder, tran);
|
|
|
|
|
|
}
|
|
|
var cmdupdate = db.GetSqlStringCommand(_Comm);
|
|
|
cmdupdate.Parameters.Clear();
|
|
|
db.AddInParameter(cmdupdate, "@BSNO", DbType.String, enumValue.BSNO);
|
|
|
db.ExecuteNonQuery(cmdupdate, tran);
|
|
|
|
|
|
result.Success = true;
|
|
|
result.Message = "审核通过!";
|
|
|
|
|
|
}
|
|
|
else {
|
|
|
result.Success = WorkResult.Success;
|
|
|
result.Message = WorkResult.Message;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
tran.Commit();
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
tran.Rollback();
|
|
|
|
|
|
result.Success = false;
|
|
|
result.Message = "审核出现错误,请重试或联系系统管理员";
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public static DBResult AuditTuiBackList(List<MsOpSeae> boday, String USERID)
|
|
|
{
|
|
|
var result = new DBResult();
|
|
|
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
using (var conn = db.CreateConnection())
|
|
|
{
|
|
|
conn.Open();
|
|
|
var tran = conn.BeginTransaction();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
|
|
|
|
|
|
if (boday != null)
|
|
|
{
|
|
|
|
|
|
|
|
|
foreach (var enumValue in boday)
|
|
|
{
|
|
|
var _Comm = "";
|
|
|
if (enumValue.ISTUI == "2" || enumValue.ISCANCEL == "2")
|
|
|
{
|
|
|
Resultmb WorkResult = WorkFlowDAL.DeleteWorkFlowDo("OpTuiShenAudit", enumValue.BSNO, USERID, "reason", enumValue.MBLNO, enumValue.BSNO, "驳回提交URL");
|
|
|
if (WorkResult.Success == true)
|
|
|
{
|
|
|
if (enumValue.ISTUI == "2")
|
|
|
{
|
|
|
_Comm = "update OP_SEAE set ISTUI='4' where BSNO=@BSNO";
|
|
|
var cmdInsert = db.GetSqlStringCommand(@"update op_tuishen set AUDITSTATUS='驳回申请',AUDITBY='" + USERID + "',AUDITTIME='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "' where BSNO='" + enumValue.BSNO + "' and TUITYPE='推航次' and AUDITSTATUS<>'审核通过'");
|
|
|
db.ExecuteNonQuery(cmdInsert, tran);
|
|
|
var cmdDelete = db.GetSqlStringCommand("insert into op_status(ST_ID,BSNO,STATUS,ISCOMP,COMPTIME,INPUTTIME,STTYPE) values(NEWID(),'" + enumValue.BSNO + "','驳回推航次',1,'" + DateTime.Now.ToString() + "','" + DateTime.Now.ToString() + "','1')");
|
|
|
db.ExecuteNonQuery(cmdDelete, tran);
|
|
|
|
|
|
}
|
|
|
else if (enumValue.ISCANCEL == "2")
|
|
|
{
|
|
|
|
|
|
_Comm = "update OP_SEAE set ISCANCEL='4' where BSNO=@BSNO";
|
|
|
var cmdInsert = db.GetSqlStringCommand(@"update op_tuishen set AUDITSTATUS='驳回申请',AUDITBY='" + USERID + "',AUDITTIME='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "' where BSNO='" + enumValue.BSNO + "' and TUITYPE='退舱' and AUDITSTATUS<>'审核通过'");
|
|
|
db.ExecuteNonQuery(cmdInsert, tran);
|
|
|
var cmdDelete = db.GetSqlStringCommand("insert into op_status(ST_ID,BSNO,STATUS,ISCOMP,COMPTIME,INPUTTIME,STTYPE) values(NEWID(),'" + enumValue.BSNO + "','驳回退舱',1,'" + DateTime.Now.ToString() + "','" + DateTime.Now.ToString() + "','1')");
|
|
|
db.ExecuteNonQuery(cmdDelete, tran);
|
|
|
|
|
|
|
|
|
}
|
|
|
var cmdupdate = db.GetSqlStringCommand(_Comm);
|
|
|
cmdupdate.Parameters.Clear();
|
|
|
db.AddInParameter(cmdupdate, "@BSNO", DbType.String, enumValue.BSNO);
|
|
|
db.ExecuteNonQuery(cmdupdate, tran);
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
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;
|
|
|
}
|
|
|
|
|
|
static public MsOpTuiShen GetTuiShenData(string condition)
|
|
|
{
|
|
|
var strSql = new StringBuilder();
|
|
|
strSql.Append("SELECT GID,BSNO,CREATEUSER,CREATETIME,REASON,REMARKS,AUDITSTATUS,AUDITBY,AUDITTIME,AUDITRESULT ");
|
|
|
strSql.Append(",(select ShowName from [user] where GID=CREATEUSER) as CREATEUSERREF");
|
|
|
strSql.Append(",(select ShowName from [user] where GID=AUDITBY) as AUDITBYREF");
|
|
|
strSql.Append(" from op_tuishen ");
|
|
|
|
|
|
if (!string.IsNullOrEmpty(condition))
|
|
|
{
|
|
|
strSql.Append(" where " + condition);
|
|
|
}
|
|
|
var list = SetTuiShenData(strSql);
|
|
|
if (list.Count > 0)
|
|
|
return list[0];
|
|
|
return new MsOpTuiShen();
|
|
|
}
|
|
|
private static List<MsOpTuiShen> SetTuiShenData(StringBuilder strSql)
|
|
|
{
|
|
|
var bodyList = new List<MsOpTuiShen>();
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
|
|
|
{
|
|
|
|
|
|
while (reader.Read())
|
|
|
{
|
|
|
MsOpTuiShen data = new MsOpTuiShen();
|
|
|
#region Set DB data to Object
|
|
|
data.GID = Convert.ToString(reader["GID"]);
|
|
|
data.BSNO = Convert.ToString(reader["BSNO"]);
|
|
|
data.REASON = Convert.ToString(reader["REASON"]);
|
|
|
data.REMARKS = Convert.ToString(reader["REMARKS"]);
|
|
|
if (reader["CREATETIME"] != DBNull.Value)
|
|
|
data.CREATETIME = Convert.ToString(reader["CREATETIME"]);
|
|
|
data.CREATEUSER = Convert.ToString(reader["CREATEUSER"]);
|
|
|
data.CREATEUSERREF = Convert.ToString(reader["CREATEUSERREF"]);
|
|
|
data.AUDITSTATUS = Convert.ToString(reader["AUDITSTATUS"]);
|
|
|
data.AUDITBY = Convert.ToString(reader["AUDITBY"]);
|
|
|
data.AUDITBYREF = Convert.ToString(reader["AUDITBYREF"]);
|
|
|
if (reader["AUDITTIME"] != DBNull.Value)
|
|
|
data.AUDITTIME = Convert.ToDateTime(reader["AUDITTIME"]).ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
data.AUDITRESULT = Convert.ToString(reader["AUDITRESULT"]);
|
|
|
#endregion
|
|
|
|
|
|
bodyList.Add(data);
|
|
|
}
|
|
|
reader.Close();
|
|
|
}
|
|
|
|
|
|
return bodyList;
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
#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 ");
|
|
|
strSql.Append(" where [NAME]='modOrderManagement' 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 = " (B.INPUTBY='" + username + "' OR B.OP='" + username + "' OR B.SALE='" + username + "' OR B.CUSTSERVICE='" + username + "' OR B.DOC='" + username + "' OR B.FRCUSTSERVICE='" + username + "')";
|
|
|
|
|
|
}
|
|
|
else if (visiblerange == "2")
|
|
|
{
|
|
|
if (tb == "index")
|
|
|
{
|
|
|
var rangeDa = new RangeDA();
|
|
|
var deptid = rangeDa.GetDEPTGID(userid);
|
|
|
str = " (B.OP in (select showname from vw_user where deptgid='" + deptid + "') OR B.SALE in (select showname from vw_user where deptgid='" + deptid + "') OR B.CUSTSERVICE in (select showname from vw_user where deptgid='" + deptid + "') "
|
|
|
+ " OR B.DOC in (select showname from vw_user where deptgid='" + deptid + "') OR B.FRCUSTSERVICE in (select showname from vw_user where deptgid='" + deptid + "') OR B.INPUTBY in (select showname from vw_user where deptgid='" + deptid + "'))";
|
|
|
|
|
|
|
|
|
|
|
|
//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 = " (B.OP='" + Convert.ToString(reader["SHOWNAME"]) + "' OR B.SALE='" + Convert.ToString(reader["SHOWNAME"]) + "' OR B.CUSTSERVICE='" + Convert.ToString(reader["SHOWNAME"]) + "' OR B.DOC='" + Convert.ToString(reader["SHOWNAME"]) + "' OR B.FRCUSTSERVICE='" + Convert.ToString(reader["SHOWNAME"]) + "'";
|
|
|
// }
|
|
|
// else
|
|
|
// {
|
|
|
// str = str + " or B.OP='" + Convert.ToString(reader["SHOWNAME"]) + "' OR B.SALE='" + Convert.ToString(reader["SHOWNAME"]) + "' OR B.CUSTSERVICE='" + Convert.ToString(reader["SHOWNAME"]) + "' OR B.DOC='" + Convert.ToString(reader["SHOWNAME"]) + "' OR B.FRCUSTSERVICE='" + Convert.ToString(reader["SHOWNAME"]) + "'";
|
|
|
// };
|
|
|
// }
|
|
|
// str = str + ")";
|
|
|
// reader.Close();
|
|
|
//}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
str = " (UPPER(B.Corpid)='" + companyid + "' or B.SALECORPID='" + companyid + "') ";
|
|
|
}
|
|
|
|
|
|
}
|
|
|
else if (visiblerange == "5")
|
|
|
{
|
|
|
if (tb == "index")
|
|
|
{
|
|
|
var userstr = new StringBuilder();
|
|
|
userstr.Append(" 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 = " (B.Corpid='" + Convert.ToString(reader["COMPANYID"]) + "' or B.SALECORPID='" + Convert.ToString(reader["COMPANYID"]) + "' ";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
str = str + " or B.Corpid='" + Convert.ToString(reader["COMPANYID"]) + "' or B.SALECORPID='" + Convert.ToString(reader["COMPANYID"]) + "'";
|
|
|
};
|
|
|
}
|
|
|
str = str + ")";
|
|
|
reader.Close();
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
str = " (UPPER(B.Corpid)='" + companyid + "' or B.SALECORPID='" + companyid + "') ";
|
|
|
}
|
|
|
|
|
|
}
|
|
|
else if (visiblerange == "6")
|
|
|
{
|
|
|
if (tb == "index")
|
|
|
{
|
|
|
//var opstr = "";
|
|
|
//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()))
|
|
|
//{
|
|
|
|
|
|
// while (reader.Read())
|
|
|
// {
|
|
|
|
|
|
|
|
|
// if (opstr == "")
|
|
|
// {
|
|
|
// opstr = " ('" + Convert.ToString(reader["SHOWNAME"]) + "'";
|
|
|
// }
|
|
|
// else
|
|
|
// {
|
|
|
// opstr = opstr + ",'" + Convert.ToString(reader["SHOWNAME"]) + "'";
|
|
|
// };
|
|
|
// }
|
|
|
|
|
|
// if (opstr != "") opstr = opstr + ")";
|
|
|
// reader.Close();
|
|
|
//}
|
|
|
//if (opstr == "") opstr = "('" + username + "')";
|
|
|
//str = " (B.OP in " + opstr + " or B.SALE in " + opstr + " or B.CUSTSERVICE IN " + opstr + " or B.DOC IN " + opstr + " or B.FRCUSTSERVICE IN " + opstr + " or B.INPUTBY IN " + opstr + ")";
|
|
|
|
|
|
str = " EXISTS (select 1 from user_authority_range_op P left join [user] u on (u.GID=P.OPID) where (B.OP=U.SHOWNAME OR B.SALE=U.SHOWNAME OR B.CUSTSERVICE=U.SHOWNAME OR B.DOC=U.SHOWNAME OR B.FRCUSTSERVICE=U.SHOWNAME OR B.INPUTBY=U.SHOWNAME) AND P.userid='" + userid + "' and P.AUTHORITYID='" + AUTHORITYID + "' and P.VISIBLERANGE=1) ";
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
str = " (UPPER(B.Corpid)='" + companyid + "' or B.SALECORPID='" + companyid + "') ";
|
|
|
}
|
|
|
|
|
|
}
|
|
|
else if (visiblerange == "1")
|
|
|
{
|
|
|
str = " (UPPER(B.Corpid)='" + companyid + "' or B.SALECORPID='" + companyid + "') ";
|
|
|
}
|
|
|
VSSQL = VSSQL.Trim();
|
|
|
if (!string.IsNullOrEmpty(VSSQL)) {
|
|
|
|
|
|
if (!string.IsNullOrEmpty(str))
|
|
|
{
|
|
|
str = str + " and (" + VSSQL + ") ";
|
|
|
}
|
|
|
else {
|
|
|
str =" (" + VSSQL + ") ";
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return str;
|
|
|
}
|
|
|
|
|
|
public static string GetSaleRangDAStr(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 ");
|
|
|
strSql.Append(" where [NAME]='modSeaeSaleList' and USERID='" + userid + "' and ISDELETE=0");
|
|
|
string AUTHORITYID = "";
|
|
|
string visiblerange = "4";
|
|
|
string operaterange = "4";
|
|
|
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 = " B.SALE='" + username + "' ";
|
|
|
}
|
|
|
else if (visiblerange == "3")
|
|
|
{
|
|
|
|
|
|
str = " B.SALE='" + username + "' ";
|
|
|
|
|
|
}
|
|
|
else if (visiblerange == "2")
|
|
|
{
|
|
|
if (tb == "index")
|
|
|
{
|
|
|
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 = " (B.SALE='" + Convert.ToString(reader["SHOWNAME"]) + "'";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
str = str + " OR B.SALE='" + Convert.ToString(reader["SHOWNAME"]) + "'";
|
|
|
};
|
|
|
}
|
|
|
str = str + ")";
|
|
|
reader.Close();
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
str = " (UPPER(B.Corpid)='" + companyid + "' or B.SALECORPID='" + companyid + "') ";
|
|
|
}
|
|
|
|
|
|
}
|
|
|
else if (visiblerange == "5")
|
|
|
{
|
|
|
if (tb == "index")
|
|
|
{
|
|
|
var userstr = new StringBuilder();
|
|
|
userstr.Append(" 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 = " (B.Corpid='" + Convert.ToString(reader["COMPANYID"]) + "' or B.SALECORPID='" + Convert.ToString(reader["COMPANYID"]) + "' ";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
str = str + " or B.Corpid='" + Convert.ToString(reader["COMPANYID"]) + "' or B.SALECORPID='" + Convert.ToString(reader["COMPANYID"]) + "'";
|
|
|
};
|
|
|
}
|
|
|
str = str + ")";
|
|
|
reader.Close();
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
str = " (UPPER(B.Corpid)='" + companyid + "' or B.SALECORPID='" + companyid + "') ";
|
|
|
}
|
|
|
|
|
|
}
|
|
|
else if (visiblerange == "6")
|
|
|
{
|
|
|
if (tb == "index")
|
|
|
{
|
|
|
var opstr = "";
|
|
|
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()))
|
|
|
{
|
|
|
|
|
|
while (reader.Read())
|
|
|
{
|
|
|
|
|
|
|
|
|
if (opstr == "")
|
|
|
{
|
|
|
opstr = " ('" + Convert.ToString(reader["SHOWNAME"]) + "'";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
opstr = opstr + ",'" + Convert.ToString(reader["SHOWNAME"]) + "'";
|
|
|
};
|
|
|
}
|
|
|
|
|
|
if (opstr != "") opstr = opstr + ")";
|
|
|
reader.Close();
|
|
|
}
|
|
|
if (opstr == "") opstr = "('" + username + "')";
|
|
|
str = " (B.SALE in " + opstr + ")";
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
str = " (UPPER(B.Corpid)='" + companyid + "' or B.SALECORPID='" + companyid + "') " ;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
else if (visiblerange == "1")
|
|
|
{
|
|
|
str = " (UPPER(B.Corpid)='" + companyid + "' or B.SALECORPID='" + companyid + "') ";
|
|
|
}
|
|
|
|
|
|
VSSQL = VSSQL.Trim();
|
|
|
if (!string.IsNullOrEmpty(VSSQL))
|
|
|
{
|
|
|
|
|
|
if (!string.IsNullOrEmpty(str))
|
|
|
{
|
|
|
str = str + " and (" + VSSQL + ") ";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
str = " (" + VSSQL + ") ";
|
|
|
}
|
|
|
|
|
|
}
|
|
|
return str;
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 收发通信息
|
|
|
static public List<OpSeaeShipper> GetShipperList(string strCondition,string userid="",string ISENABLECUSTRANGE="0")
|
|
|
{
|
|
|
var strSql = new StringBuilder();
|
|
|
strSql.Append("SELECT ");
|
|
|
strSql.Append("shipperID,codename,SHORTNAME,shipperdetail,shippertype");
|
|
|
strSql.Append(",LOADADDRESS,DELIVERADDRESS,ISPUBLIC,CodeAndName,ATTN,TEL,EMAIL,COUNTRY,CORPID ");
|
|
|
strSql.Append(" from v_info_shipper ");
|
|
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(strCondition))
|
|
|
{
|
|
|
strSql.Append(" where " + strCondition);
|
|
|
}
|
|
|
//else {
|
|
|
// if (ISENABLECUSTRANGE == "1")
|
|
|
// {
|
|
|
// strSql.Append(" where (SHORTNAME in (SELECT SHORTNAME from info_client_range where USERID='" + userid + "' ) or SHORTNAME not in (SELECT SHORTNAME from info_client_range )) ");
|
|
|
// }
|
|
|
//}
|
|
|
|
|
|
if (userid != null && ISENABLECUSTRANGE == "1") {
|
|
|
if (!string.IsNullOrEmpty(strCondition))
|
|
|
{
|
|
|
strSql.Append(" and ");
|
|
|
}
|
|
|
else { strSql.Append(" where "); }
|
|
|
|
|
|
|
|
|
//strSql.Append(" (SHORTNAME in (SELECT SHORTNAME from info_client_range where USERID='" + userid + "' ) or SHORTNAME not in (SELECT SHORTNAME from info_client_range )) ");
|
|
|
strSql.Append(" (exists (select 1 from info_client_range where info_client_range.SHORTNAME=v_info_shipper.SHORTNAME and USERID='" + userid + "') or not exists(select 1 from info_client_range where info_client_range.SHORTNAME = v_info_shipper.SHORTNAME )) ");
|
|
|
}
|
|
|
|
|
|
strSql.Append(" ORDER BY SHIPPERMODE ");
|
|
|
|
|
|
return SetShipperRefData(strSql);
|
|
|
}
|
|
|
|
|
|
private static List<OpSeaeShipper> SetShipperRefData(StringBuilder strSql)
|
|
|
{
|
|
|
var headList = new List<OpSeaeShipper>();
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
|
|
|
{
|
|
|
while (reader.Read())
|
|
|
{
|
|
|
OpSeaeShipper data = new OpSeaeShipper();
|
|
|
#region Set DB data to Object
|
|
|
data.SHIPPERID = Convert.ToString(reader["shipperID"]);
|
|
|
data.CODENAME = Convert.ToString(reader["codename"]);
|
|
|
data.SHORTNAME = Convert.ToString(reader["SHORTNAME"]);
|
|
|
data.CodeAndName = Convert.ToString(reader["CodeAndName"]);
|
|
|
data.SHIPPERDETAIL = Convert.ToString(reader["shipperdetail"]);
|
|
|
data.SHIPPERTYPE = Convert.ToInt16(reader["shippertype"]);
|
|
|
data.LOADADDRESS = Convert.ToString(reader["LOADADDRESS"]);
|
|
|
data.DELIVERADDRESS = Convert.ToString(reader["DELIVERADDRESS"]);
|
|
|
data.ATTN = Convert.ToString(reader["ATTN"]);
|
|
|
data.TEL = Convert.ToString(reader["TEL"]);
|
|
|
data.EMAIL = Convert.ToString(reader["EMAIL"]);
|
|
|
data.COUNTRY = Convert.ToString(reader["COUNTRY"]);
|
|
|
data.CORPID = Convert.ToString(reader["CORPID"]);
|
|
|
data.ISPUBLIC = Convert.ToBoolean(reader["ISPUBLIC"]);
|
|
|
|
|
|
#endregion
|
|
|
headList.Add(data);
|
|
|
}
|
|
|
reader.Close();
|
|
|
}
|
|
|
|
|
|
OpSeaeShipper data2 = new OpSeaeShipper();
|
|
|
#region Set DB data to Object
|
|
|
data2.SHIPPERID ="";
|
|
|
data2.CODENAME ="";
|
|
|
data2.SHORTNAME ="";
|
|
|
data2.CodeAndName ="";
|
|
|
data2.SHIPPERDETAIL ="";
|
|
|
data2.SHIPPERTYPE =1;
|
|
|
data2.LOADADDRESS ="";
|
|
|
data2.DELIVERADDRESS ="";
|
|
|
data2.ISPUBLIC =true;
|
|
|
|
|
|
#endregion
|
|
|
headList.Add(data2);
|
|
|
|
|
|
return headList;
|
|
|
}
|
|
|
|
|
|
public static string GetShipperDetailByShipperid(string shipperid) {
|
|
|
var result = "";
|
|
|
|
|
|
var shipperlist = GetShipperList(" shipperid='" + shipperid + "'");
|
|
|
|
|
|
if (shipperlist != null && shipperlist.Count > 0) {
|
|
|
result = shipperlist[0].SHIPPERDETAIL;
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region EF状态
|
|
|
static public DBResult GetEFSTATUS ( string mblnohead, string mblother )
|
|
|
{
|
|
|
var result = new DBResult();
|
|
|
result.Success = true;
|
|
|
try
|
|
|
{
|
|
|
|
|
|
HttpHelper http = new HttpHelper();
|
|
|
HttpItem item = new HttpItem()
|
|
|
{
|
|
|
URL = "http://www.wangbaby19.com/home/Review?MawbPrefix=" + mblnohead + "&MawbSerial=" + mblother,//URL这里都是测试 必需项
|
|
|
Encoding = null,//编码格式(utf-8,gb2312,gbk) 可选项 默认类会自动识别
|
|
|
Host = "www.wangbaby19.com",
|
|
|
UserAgent = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)",
|
|
|
Accept = "text/html, application/xhtml+xml, */*",// 可选项有默认值
|
|
|
ContentType = "text/html",
|
|
|
Method = "get",//URL 可选项 默认为Get
|
|
|
};
|
|
|
HttpResult resulthtml = http.GetHtml(item);
|
|
|
|
|
|
var datahtml = resulthtml.Html;
|
|
|
//datahtml = datahtml.Replace("css/StyleSheet.css", "http://www.sd.sinotrans.com/sdweb/HomePage/CntrYardQuery/css/StyleSheet.css");
|
|
|
//datahtml = datahtml.Replace("../../App_Themes/HomePage/HomePage.css", "http://www.sd.sinotrans.com/sdweb/App_Themes/HomePage/HomePage.css");
|
|
|
datahtml = datahtml.Remove(0, datahtml.IndexOf("<div id=\"body\""));
|
|
|
|
|
|
//datahtml = datahtml.Replace("/Home/ContainerEvent/?", "http://www.wangbaby19.com/Home/ContainerEvent/?");
|
|
|
|
|
|
datahtml = "\r\n\r\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\">\r\n<head>\r\n <title>主单货物状态及跟踪</title>\r\n\r\n\r\n <script src=\"http://www.wangbaby19.com/Scripts/jquery-1.9.1.min.js\" "
|
|
|
+ "type=\"text/javascript\"></script>\r\n <script src=\"http://www.wangbaby19.com/Scripts/jquery-ui1.9.1.min.js\" type=\"text/javascript\">"
|
|
|
+ "</script>\r\n <script src=\"http://www.wangbaby19.com/Scripts/jquery.higo_plugins_ad.js\" type=\"text/javascript\"></script>\r\n\r\n "
|
|
|
+ "<script src=\"http://www.wangbaby19.com/Scripts/bootstrap.min.js\" type=\"text/javascript\"></script>\r\n\r\n\r\n "
|
|
|
+ "<link href=\"http://www.wangbaby19.com/Content/bootstrap/css/bootstrap.min.css\" rel=\"stylesheet\" type=\"text/css\" /><link href=\"http://www.wangbaby19.com/Content/themes/base/jquery.ui.all.css\" rel=\"stylesheet\" type=\"text/css\" /><link href=\"http://www.wangbaby19.com/Content/ContainerStatusCollect.css\" rel=\"stylesheet\" type=\"text/css\" />\r\n\r\n <script src=\"http://www.wangbaby19.com/Scripts/wb.js\" type=\"text/javascript\"></script>\r\n\r\n\r\n<title>\r\n\r\n</title></head>\r\n<body>" + datahtml;
|
|
|
|
|
|
|
|
|
result.Data = datahtml;
|
|
|
|
|
|
}
|
|
|
catch
|
|
|
{
|
|
|
result.Success = false;
|
|
|
result.Message = "提取数据过程中发生错误,请联系系统管理员!";
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 引入EXCEL
|
|
|
static public MsOpSeaeDetail FindCtnData(string cntrno, List<MsOpSeaeDetail> ctnlist)
|
|
|
{
|
|
|
MsOpSeaeDetail head = null;
|
|
|
foreach (var ctndata in ctnlist)
|
|
|
{
|
|
|
if (ctndata.CNTRNO == cntrno) head = ctndata;
|
|
|
}
|
|
|
|
|
|
return head;
|
|
|
}
|
|
|
|
|
|
static public DBResult InsertCtnData(string bsno,List<MsOpSeaeDetail> ctnlist,bool isexcel=false)
|
|
|
{
|
|
|
var result = new DBResult();
|
|
|
result.Success = true;
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
using (DbConnection connection = db.CreateConnection())
|
|
|
{
|
|
|
connection.Open();
|
|
|
DbTransaction idbTran = connection.BeginTransaction();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
var bodyList = new List<MsOpSeaeDetail>();
|
|
|
|
|
|
var cmdDelete = db.GetSqlStringCommand(@"delete from op_ctn where BSNO='"+bsno+"'");
|
|
|
db.ExecuteNonQuery(cmdDelete, idbTran);
|
|
|
foreach (var ctndata in ctnlist)
|
|
|
{
|
|
|
var nowctndata = FindCtnData(ctndata.CNTRNO, bodyList);
|
|
|
if (nowctndata == null)
|
|
|
{
|
|
|
var CTNID = Guid.NewGuid().ToString();
|
|
|
|
|
|
int SIZE = int.Parse(ctndata.CTNALL.ToString().Trim().Substring(0, 2));
|
|
|
string CTN = ctndata.CTNALL.ToString().Trim().Substring(2);
|
|
|
int TEU = 1;
|
|
|
int iTEU = int.Parse(ctndata.CTNALL.ToString().Trim().Substring(0, 1));
|
|
|
if (iTEU == 4)
|
|
|
{
|
|
|
TEU = TEU * 2;
|
|
|
}
|
|
|
|
|
|
var CTNCODE = "";
|
|
|
#region 托单数据生成
|
|
|
|
|
|
|
|
|
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,WEIGHTYPE,WEIGHKGS,WEIGHATTN,WEIGHTEL,WEIGHSIGN) values ('"
|
|
|
+ CTNID + "','" + bsno + "','" + CTNCODE + "','" + SIZE + "','" + CTN + "',1," + TEU + ",'" + ctndata.CTNALL.Replace("'", "''") + "','" + ctndata.CNTRNO + "','" + ctndata.SEALNO + "',"+ctndata.PKGS+","+ctndata.KGS+","+ctndata.CBM+",'" + ctndata.REMARK + "','"+ctndata.KINDPKGS+"',0,'','',0,'','','')");
|
|
|
db.ExecuteNonQuery(cmdInsert, idbTran);
|
|
|
ctndata.CTN_ID = CTNID;
|
|
|
bodyList.Add(ctndata);
|
|
|
nowctndata = ctndata;
|
|
|
}
|
|
|
else {
|
|
|
var cmdInsert = db.GetSqlStringCommand(@"update op_ctn set PKGS=PKGS+" + ctndata.PKGS + ",KGS=KGS+"+ctndata.KGS+",CBM=CBM+"+ctndata.CBM+" where CTN_ID='"+nowctndata.CTN_ID+"'");
|
|
|
db.ExecuteNonQuery(cmdInsert, idbTran);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
if (ctndata.CTNFEE != "") {
|
|
|
|
|
|
var cmdInsertdetail = db.GetSqlStringCommand(@"insert into op_ctn_detail (GID,CTN_ID,PKGS,KGS,CBM,KINDPKGS,HSCODE,DESCRIPTION,MARKS) values ('"
|
|
|
+ Guid.NewGuid().ToString() + "','" + nowctndata.CTN_ID + "'," + ctndata.PKGS + "," + ctndata.KGS + "," + ctndata.CBM + ",'"+ctndata.KINDPKGS+"','" + ctndata.CTNFEE + "','" + ctndata.GOODSNAME + "','" + ctndata.WEIGHSIGN + "')");
|
|
|
db.ExecuteNonQuery(cmdInsertdetail, idbTran);
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
}
|
|
|
|
|
|
idbTran.Commit();
|
|
|
|
|
|
|
|
|
|
|
|
result.Success = true;
|
|
|
}
|
|
|
catch (Exception exception)
|
|
|
{
|
|
|
idbTran.Rollback();
|
|
|
result.Success = false;
|
|
|
result.Message= exception.Message;
|
|
|
}
|
|
|
}
|
|
|
return result;
|
|
|
|
|
|
}
|
|
|
|
|
|
static public DBResult InsertMSCCtn(string bsno, List<MsOpSeaeDetail> ctnlist)
|
|
|
{
|
|
|
var result = new DBResult();
|
|
|
result.Success = true;
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
using (DbConnection connection = db.CreateConnection())
|
|
|
{
|
|
|
connection.Open();
|
|
|
DbTransaction idbTran = connection.BeginTransaction();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
var bodyList = new List<MsOpSeaeDetail>();
|
|
|
|
|
|
var cmdDelete = db.GetSqlStringCommand(@"delete from op_ctn where BSNO='" + bsno + "'");
|
|
|
db.ExecuteNonQuery(cmdDelete, idbTran);
|
|
|
foreach (var ctndata in ctnlist)
|
|
|
{
|
|
|
var CTNID = Guid.NewGuid().ToString();
|
|
|
|
|
|
int SIZE = int.Parse(ctndata.CTNALL.ToString().Trim().Substring(0, 2));
|
|
|
string CTN = ctndata.CTNALL.ToString().Trim().Substring(2);
|
|
|
if (ctndata.CTNALL.IndexOf("'")>0) CTN = ctndata.CTNALL.ToString().Trim().Substring(3);
|
|
|
|
|
|
int TEU = 1;
|
|
|
int iTEU = int.Parse(ctndata.CTNALL.ToString().Trim().Substring(0, 1));
|
|
|
if (iTEU == 4)
|
|
|
{
|
|
|
TEU = TEU * 2;
|
|
|
}
|
|
|
TEU =TEU*ctndata.CTNNUM;
|
|
|
|
|
|
var CTNCODE = "";
|
|
|
#region 托单数据生成
|
|
|
|
|
|
|
|
|
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,WEIGHTYPE,WEIGHKGS,WEIGHATTN,WEIGHTEL,WEIGHSIGN) values ('"
|
|
|
+ CTNID + "','" + bsno + "','" + CTNCODE + "','" + SIZE + "','" + CTN + "',"+ctndata.CTNNUM+"," + TEU + ",'" + ctndata.CTNALL.Replace("'", "''") + "','" + ctndata.CNTRNO + "','" + ctndata.SEALNO + "'," + ctndata.PKGS + "," + ctndata.KGS + "," + ctndata.CBM + ",'" + ctndata.REMARK + "','',0,'','',0,'','','')");
|
|
|
db.ExecuteNonQuery(cmdInsert, idbTran);
|
|
|
ctndata.CTN_ID = CTNID;
|
|
|
bodyList.Add(ctndata);
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
}
|
|
|
|
|
|
idbTran.Commit();
|
|
|
|
|
|
|
|
|
|
|
|
result.Success = true;
|
|
|
}
|
|
|
catch (Exception exception)
|
|
|
{
|
|
|
idbTran.Rollback();
|
|
|
result.Success = false;
|
|
|
result.Message = exception.Message;
|
|
|
}
|
|
|
}
|
|
|
return result;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static bool ImportBsList(DataTable table,string username,string companyid,MsOpSeae opseae, out string msg)
|
|
|
{
|
|
|
var isSucess = false;
|
|
|
msg = "";
|
|
|
if (table == null) throw new ArgumentNullException("table");
|
|
|
|
|
|
var billNoList = new List<string>();
|
|
|
var i = 1;
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
using (DbConnection connection = db.CreateConnection())
|
|
|
{
|
|
|
connection.Open();
|
|
|
DbTransaction idbTran = connection.BeginTransaction();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
var billnoset = MsSysBillNoSet.MsSysBillNoSetDAL.GetData("OPLBNAME='海运出口' AND RULEBLNO='委托编号' ",companyid);
|
|
|
foreach (DataRow row in table.Rows)
|
|
|
{
|
|
|
var GP20 = Convert.ToString(row["20GP"]);
|
|
|
if (GP20.Length > 10) GP20 = "0";
|
|
|
var TK20 = Convert.ToString(row["20TK"]);
|
|
|
if (TK20.Length > 10) TK20 = "0";
|
|
|
var DG20 = Convert.ToString(row["20DG"]);
|
|
|
if (DG20.Length > 10) DG20 = "0";
|
|
|
var RF20 = Convert.ToString(row["20RF"]);
|
|
|
if (RF20.Length > 10) RF20 = "0";
|
|
|
var GP40 = Convert.ToString(row["40GP"]);
|
|
|
if (GP40.Length > 10) GP40 = "0";
|
|
|
var HQ40 = Convert.ToString(row["40HQ"]);
|
|
|
if (HQ40.Length > 10) HQ40 = "0";
|
|
|
var RH40 = Convert.ToString(row["40RH"]);
|
|
|
if (RH40.Length > 10) RH40 = "0";
|
|
|
var MBLNO = Convert.ToString(row["提单号"]);
|
|
|
var ct = GetRdCount(" MBLNO='" + MBLNO + "' and CORPID='" + companyid + "'");
|
|
|
if (MBLNO != "" && ct==0)
|
|
|
{
|
|
|
var head = new MsOpSeae();
|
|
|
head.OP =username;
|
|
|
var period = ChMonthCloseDAL.ChMonthCloseDAL.GetData("",companyid);
|
|
|
if (Convert.ToDateTime(period.FDAY) > DateTime.Now)
|
|
|
{
|
|
|
head.ACCDATE = period.PERIOD;
|
|
|
}
|
|
|
head.INPUTBY = username;
|
|
|
head.MASTERNO = head.BSNO;
|
|
|
head.ETD = opseae.ETD;
|
|
|
head.ETD2 = opseae.ETD2;
|
|
|
head.VESSEL = opseae.VESSEL;
|
|
|
head.VOYNO = opseae.VOYNO;
|
|
|
head.CUSTOMERNAME = opseae.CUSTOMERNAME;
|
|
|
head.CARRIER = opseae.CARRIER;
|
|
|
head.FORWARDER = opseae.FORWARDER;
|
|
|
head.LANE = opseae.LANE;
|
|
|
head.PORTLOAD = opseae.PORTLOAD;
|
|
|
head.PORTLOADID = opseae.PORTLOADID;
|
|
|
|
|
|
head.PORTDISCHARGE = opseae.PORTDISCHARGE;
|
|
|
head.PORTDISCHARGEID = opseae.PORTDISCHARGEID;
|
|
|
head.AGENTID = opseae.AGENTID;
|
|
|
head.CORPID = companyid;
|
|
|
head.CREATETIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
head.BSSTATUS = false;
|
|
|
head.FEESTATUS = false;
|
|
|
head.DbOperationType = DbOperationType.DbotIns;
|
|
|
var BSNO = head.BSNO;
|
|
|
head.CUSTNO =MsSysBillNoSet.MsSysBillNoSetDAL.GetBillNo(billnoset, head.ETD.ToString().Trim(), head.ACCDATE.ToString().Trim(), "", head.OP, head.SALECORPID);
|
|
|
if (head.ETA == "") head.ETA = null;
|
|
|
if (head.ETD == "") head.ETD = null;
|
|
|
if (head.ETD2 == "") head.ETD2 = null;
|
|
|
if (head.STLDATE == "") head.STLDATE = null;
|
|
|
if (head.ATD == "") head.ATD = null;
|
|
|
if (head.DELIVERYDATE == "") head.DELIVERYDATE = null;
|
|
|
|
|
|
if (head.ISSUEDATE == "" || (Convert.ToDateTime(head.ISSUEDATE) < Convert.ToDateTime("2010-01-01"))) head.ISSUEDATE = null;
|
|
|
if (head.CLOSINGDATE == "") head.CLOSINGDATE = null;
|
|
|
if (head.CLOSEDOCDATE == "") head.CLOSEDOCDATE = null;
|
|
|
if (head.INSPECTIONDATE == "") head.INSPECTIONDATE = null;
|
|
|
if (head.CUSTOMDATE == "") head.CUSTOMDATE = null;
|
|
|
if (head.CLEARCUSTOMDATE == "") head.CLEARCUSTOMDATE = null;
|
|
|
head.MBLNO = MBLNO;
|
|
|
var modb = new ModelObjectDB();
|
|
|
DBResult result = modb.Save(head);
|
|
|
var cntrstr = "";
|
|
|
var teuall = 0;
|
|
|
if (result.Success&&GP20.Trim() != "" && GP20.Trim() != "0")
|
|
|
{
|
|
|
var CTNID = Guid.NewGuid().ToString();
|
|
|
int SIZE =20;
|
|
|
string CTN ="GP";
|
|
|
int TEU = Convert.ToInt32(GP20.Trim()); ;
|
|
|
int iTEU = Convert.ToInt32(GP20.Trim());
|
|
|
teuall = teuall + iTEU;
|
|
|
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,WEIGHTYPE,WEIGHKGS,WEIGHATTN,WEIGHTEL,WEIGHSIGN) values ('"
|
|
|
+ CTNID + "','" + BSNO + "','','" + SIZE + "','" + CTN + "',"+TEU+"," + iTEU + ",'20GP','','',0,0,0,'','',0,'','',0,'','','')");
|
|
|
db.ExecuteNonQuery(cmdInsert, idbTran);
|
|
|
cntrstr = cntrstr + " " + "20GP*" + GP20.Trim();
|
|
|
}
|
|
|
if (result.Success && TK20.Trim() != "" && TK20.Trim() != "0")
|
|
|
{
|
|
|
var CTNID = Guid.NewGuid().ToString();
|
|
|
int SIZE = 20;
|
|
|
string CTN = "TK";
|
|
|
int TEU = Convert.ToInt32(TK20.Trim()); ;
|
|
|
int iTEU = Convert.ToInt32(TK20.Trim());
|
|
|
teuall = teuall + iTEU;
|
|
|
|
|
|
cntrstr = cntrstr + " " + "20TK*" + TK20.Trim();
|
|
|
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,WEIGHTYPE,WEIGHKGS,WEIGHATTN,WEIGHTEL,WEIGHSIGN) values ('"
|
|
|
+ CTNID + "','" + BSNO + "','','" + SIZE + "','" + CTN + "'," + TEU + "," + iTEU + ",'20TK','','',0,0,0,'','',0,'','',0,'','','')");
|
|
|
db.ExecuteNonQuery(cmdInsert, idbTran);
|
|
|
|
|
|
}
|
|
|
if (result.Success && DG20.Trim() != "" && DG20.Trim() != "0")
|
|
|
{
|
|
|
var CTNID = Guid.NewGuid().ToString();
|
|
|
int SIZE = 20;
|
|
|
string CTN = "DG";
|
|
|
int TEU = Convert.ToInt32(DG20.Trim()); ;
|
|
|
int iTEU = Convert.ToInt32(DG20.Trim());
|
|
|
teuall = teuall + iTEU;
|
|
|
|
|
|
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,WEIGHTYPE,WEIGHKGS,WEIGHATTN,WEIGHTEL,WEIGHSIGN) values ('"
|
|
|
+ CTNID + "','" + BSNO + "','','" + SIZE + "','" + CTN + "'," + TEU + "," + iTEU + ",'20DG','','',0,0,0,'','',0,'','',0,'','','')");
|
|
|
db.ExecuteNonQuery(cmdInsert, idbTran);
|
|
|
cntrstr = cntrstr + " " + "20DG*" + DG20.Trim();
|
|
|
|
|
|
|
|
|
}
|
|
|
if (result.Success && RF20.Trim() != "" && RF20.Trim() != "0")
|
|
|
{
|
|
|
var CTNID = Guid.NewGuid().ToString();
|
|
|
int SIZE = 20;
|
|
|
string CTN = "RF";
|
|
|
int TEU = Convert.ToInt32(RF20.Trim()); ;
|
|
|
int iTEU = Convert.ToInt32(RF20.Trim());
|
|
|
teuall = teuall + iTEU;
|
|
|
|
|
|
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,WEIGHTYPE,WEIGHKGS,WEIGHATTN,WEIGHTEL,WEIGHSIGN) values ('"
|
|
|
+ CTNID + "','" + BSNO + "','','" + SIZE + "','" + CTN + "'," + TEU + "," + iTEU + ",'20RF','','',0,0,0,'','',0,'','',0,'','','')");
|
|
|
db.ExecuteNonQuery(cmdInsert, idbTran);
|
|
|
cntrstr = cntrstr + " " + "20RF*" + RF20.Trim();
|
|
|
|
|
|
|
|
|
}
|
|
|
if (result.Success && GP40.Trim() != "" && GP40.Trim() != "0")
|
|
|
{
|
|
|
var CTNID = Guid.NewGuid().ToString();
|
|
|
int SIZE = 40;
|
|
|
string CTN = "GP";
|
|
|
int TEU = Convert.ToInt32(GP40.Trim()); ;
|
|
|
int iTEU = Convert.ToInt32(GP40.Trim()) * 2;
|
|
|
teuall = teuall + iTEU;
|
|
|
|
|
|
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,WEIGHTYPE,WEIGHKGS,WEIGHATTN,WEIGHTEL,WEIGHSIGN) values ('"
|
|
|
+ CTNID + "','" + BSNO + "','','" + SIZE + "','" + CTN + "'," + TEU + "," + iTEU + ",'40GP','','',0,0,0,'','',0,'','',0,'','','')");
|
|
|
db.ExecuteNonQuery(cmdInsert, idbTran);
|
|
|
cntrstr = cntrstr + " " + "40GP*" + GP40.Trim();
|
|
|
|
|
|
|
|
|
}
|
|
|
if (result.Success && HQ40.Trim() != "" && HQ40.Trim() != "0")
|
|
|
{
|
|
|
var CTNID = Guid.NewGuid().ToString();
|
|
|
int SIZE = 40;
|
|
|
string CTN = "HQ";
|
|
|
int TEU = Convert.ToInt32(HQ40.Trim()); ;
|
|
|
int iTEU = Convert.ToInt32(HQ40.Trim()) * 2;
|
|
|
teuall = teuall + iTEU;
|
|
|
|
|
|
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,WEIGHTYPE,WEIGHKGS,WEIGHATTN,WEIGHTEL,WEIGHSIGN) values ('"
|
|
|
+ CTNID + "','" + BSNO + "','','" + SIZE + "','" + CTN + "'," + TEU + "," + iTEU + ",'40HQ','','',0,0,0,'','',0,'','',0,'','','')");
|
|
|
db.ExecuteNonQuery(cmdInsert, idbTran);
|
|
|
cntrstr = cntrstr + " " + "40HQ*" + HQ40.Trim();
|
|
|
|
|
|
|
|
|
}
|
|
|
if (result.Success && RH40.Trim() != "" && RH40.Trim() != "0")
|
|
|
{
|
|
|
var CTNID = Guid.NewGuid().ToString();
|
|
|
int SIZE = 40;
|
|
|
string CTN = "RH";
|
|
|
int TEU = Convert.ToInt32(RH40.Trim()); ;
|
|
|
int iTEU = Convert.ToInt32(RH40.Trim()) * 2;
|
|
|
teuall = teuall + iTEU;
|
|
|
|
|
|
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,WEIGHTYPE,WEIGHKGS,WEIGHATTN,WEIGHTEL,WEIGHSIGN) values ('"
|
|
|
+ CTNID + "','" + BSNO + "','','" + SIZE + "','" + CTN + "'," + TEU + "," + iTEU + ",'40RH','','',0,0,0,'','',0,'','',0,'','','')");
|
|
|
db.ExecuteNonQuery(cmdInsert, idbTran);
|
|
|
cntrstr = cntrstr + " " + "40RH*" + RH40.Trim();
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
var cmdUpdate = db.GetSqlStringCommand(@"update op_seae set CNTRTOTAL='" + cntrstr + "',TEU="+teuall+" WHERE BSNO='" + BSNO + "' ");
|
|
|
db.ExecuteNonQuery(cmdUpdate, idbTran);
|
|
|
|
|
|
}
|
|
|
|
|
|
i++;
|
|
|
|
|
|
}
|
|
|
|
|
|
idbTran.Commit();
|
|
|
|
|
|
|
|
|
|
|
|
isSucess = true;
|
|
|
}
|
|
|
catch (Exception exception)
|
|
|
{
|
|
|
idbTran.Rollback();
|
|
|
isSucess = false;
|
|
|
msg = exception.Message;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return isSucess;
|
|
|
}
|
|
|
|
|
|
public static bool ImportCtnData ( string bsno, HttpRequestBase request, DataTable table, out string msg, out List<MsOpSeaeDetail> headList )
|
|
|
{
|
|
|
var isSucess = false;
|
|
|
msg = "";
|
|
|
headList = new List<MsOpSeaeDetail>();
|
|
|
if (table == null) throw new ArgumentNullException("table");
|
|
|
|
|
|
var billNoList = new List<string>();
|
|
|
var i = 1;
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
using (DbConnection connection = db.CreateConnection())
|
|
|
{
|
|
|
connection.Open();
|
|
|
DbTransaction idbTran = connection.BeginTransaction();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
|
|
|
foreach (DataRow row in table.Rows)
|
|
|
{
|
|
|
var CNTRNO = Convert.ToString(row["箱号"]);
|
|
|
var SEALNO = Convert.ToString(row["铅封号"]);
|
|
|
var CTNALL = Convert.ToString(row["尺寸类型"]);
|
|
|
var PKGS = Convert.ToString(row["件数"]);
|
|
|
var KGS = Convert.ToString(row["重量"]);
|
|
|
var KINGPKGS = Convert.ToString(row["包装单位"]);
|
|
|
var CBM = Convert.ToString(row["尺码"]);
|
|
|
var TAREWEIGHT = "0";
|
|
|
try
|
|
|
{
|
|
|
TAREWEIGHT = Convert.ToString(row["皮重"]);
|
|
|
}
|
|
|
catch {
|
|
|
|
|
|
}
|
|
|
|
|
|
//if (i.ToString().Length == 1) CTNCODE = "0" + i.ToString();
|
|
|
//else CTNCODE = i.ToString();
|
|
|
|
|
|
if (CTNALL != "")
|
|
|
{
|
|
|
int SIZE = int.Parse(CTNALL.ToString().Trim().Substring(0, 2));
|
|
|
string CTN = CTNALL.ToString().Trim().Substring(2);
|
|
|
int TEU = 1;
|
|
|
int iTEU = int.Parse(CTNALL.ToString().Trim().Substring(0, 1));
|
|
|
if (iTEU == 4)
|
|
|
{
|
|
|
TEU = TEU * 2;
|
|
|
}
|
|
|
|
|
|
var CTNCODE = "";
|
|
|
#region 托单数据生成
|
|
|
CTNCODE = i.ToString();
|
|
|
if (CTNCODE.Length == 1) CTNCODE = "0" + CTNCODE;
|
|
|
|
|
|
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,WEIGHTYPE,WEIGHKGS,WEIGHATTN,WEIGHTEL,WEIGHSIGN) values ('"
|
|
|
+ Guid.NewGuid().ToString() + "','" + bsno + "','" + CTNCODE + "','" + SIZE + "','" + CTN + "',1," + TEU + ",'" + CTNALL.Replace("'", "''") + "','" + CNTRNO + "','" + SEALNO + "','" + PKGS + "'," + KGS + "," + CBM + ",'','" + KINGPKGS + "',"+ TAREWEIGHT + ",'','',0,'','','')");
|
|
|
db.ExecuteNonQuery(cmdInsert, idbTran);
|
|
|
|
|
|
#endregion
|
|
|
}
|
|
|
|
|
|
i++;
|
|
|
|
|
|
}
|
|
|
|
|
|
idbTran.Commit();
|
|
|
|
|
|
|
|
|
|
|
|
isSucess = true;
|
|
|
}
|
|
|
catch (Exception exception)
|
|
|
{
|
|
|
idbTran.Rollback();
|
|
|
isSucess = false;
|
|
|
msg = exception.Message;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return isSucess;
|
|
|
}
|
|
|
|
|
|
public static bool ImportCtnDetail ( string CTN_ID, HttpRequestBase request, DataTable table, out string msg, out List<MsOpCtnDetail> headList )
|
|
|
{
|
|
|
var isSucess = false;
|
|
|
msg = "";
|
|
|
headList = new List<MsOpCtnDetail>();
|
|
|
if (table == null) throw new ArgumentNullException("table");
|
|
|
|
|
|
var billNoList = new List<string>();
|
|
|
var i = 1;
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
using (DbConnection connection = db.CreateConnection())
|
|
|
{
|
|
|
connection.Open();
|
|
|
DbTransaction idbTran = connection.BeginTransaction();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
|
|
|
foreach (DataRow row in table.Rows)
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
var PKGS = Convert.ToString(row["件数"]);
|
|
|
var KGS = Convert.ToString(row["重量"]);
|
|
|
var KINGPKGS = Convert.ToString(row["包装"]);
|
|
|
var CBM = Convert.ToString(row["尺码"]);
|
|
|
var HSCODE = Convert.ToString(row["HS编码"]);
|
|
|
var GOODNAME = Convert.ToString(row["货物描述"]);
|
|
|
|
|
|
|
|
|
|
|
|
if (PKGS != "")
|
|
|
{
|
|
|
#region 托单数据生成
|
|
|
|
|
|
|
|
|
var cmdInsert = db.GetSqlStringCommand(@"insert into op_ctn_detail (GID,CTN_ID,PKGS,KGS,CBM,KINDPKGS,HSCODE,DESCRIPTION) values ('"
|
|
|
+ Guid.NewGuid().ToString() + "','" + CTN_ID + "'," + PKGS + "," + KGS + "," + CBM + ",'" + KINGPKGS + "','" + HSCODE + "','" + GOODNAME + "')");
|
|
|
db.ExecuteNonQuery(cmdInsert, idbTran);
|
|
|
|
|
|
#endregion
|
|
|
}
|
|
|
|
|
|
i++;
|
|
|
|
|
|
}
|
|
|
|
|
|
idbTran.Commit();
|
|
|
|
|
|
|
|
|
|
|
|
isSucess = true;
|
|
|
}
|
|
|
catch (Exception exception)
|
|
|
{
|
|
|
idbTran.Rollback();
|
|
|
isSucess = false;
|
|
|
msg = exception.Message;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return isSucess;
|
|
|
}
|
|
|
|
|
|
public static bool ImportCtnAndDetailData(string bsno, HttpRequestBase request, DataTable table, out string msg, out List<MsOpSeaeDetail> headList)
|
|
|
{
|
|
|
var isSucess = false;
|
|
|
msg = "";
|
|
|
headList = new List<MsOpSeaeDetail>();
|
|
|
if (table == null) throw new ArgumentNullException("table");
|
|
|
|
|
|
var billNoList = new List<string>();
|
|
|
var i = 1;
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
using (DbConnection connection = db.CreateConnection())
|
|
|
{
|
|
|
connection.Open();
|
|
|
DbTransaction idbTran = connection.BeginTransaction();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
|
|
|
foreach (DataRow row in table.Rows)
|
|
|
{
|
|
|
|
|
|
var CNTRNO = Convert.ToString(row["箱号"]);
|
|
|
if (CNTRNO != "")
|
|
|
{
|
|
|
MsOpSeaeDetail data = new MsOpSeaeDetail();
|
|
|
data.CNTRNO = Convert.ToString(row["箱号"]);
|
|
|
data.SEALNO = Convert.ToString(row["封号"]);
|
|
|
data.CTNALL = Convert.ToString(row["箱型"]);
|
|
|
data.PKGS = Convert.ToInt32(row["件数"]);
|
|
|
data.KGS = Convert.ToDecimal(row["重量"]);
|
|
|
data.GOODSNAME = Convert.ToString(row["品名"]).Replace("'", "''");
|
|
|
data.CBM = Convert.ToDecimal(row["尺码"]);
|
|
|
data.CTNFEE = Convert.ToString(row["商品编码"]);
|
|
|
headList.Add(data);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
idbTran.Commit();
|
|
|
|
|
|
if (headList.Count>0)
|
|
|
InsertCtnData(bsno, headList);
|
|
|
|
|
|
isSucess = true;
|
|
|
}
|
|
|
catch (Exception exception)
|
|
|
{
|
|
|
idbTran.Rollback();
|
|
|
isSucess = false;
|
|
|
msg = exception.Message;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return isSucess;
|
|
|
}
|
|
|
|
|
|
|
|
|
public static bool ImportCtnAndDetailData2(string bsno, HttpRequestBase request, DataTable table, out string msg, out List<MsOpSeaeDetail> headList)
|
|
|
{
|
|
|
var isSucess = false;
|
|
|
msg = "";
|
|
|
headList = new List<MsOpSeaeDetail>();
|
|
|
if (table == null) throw new ArgumentNullException("table");
|
|
|
|
|
|
var billNoList = new List<string>();
|
|
|
var i = 1;
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
using (DbConnection connection = db.CreateConnection())
|
|
|
{
|
|
|
connection.Open();
|
|
|
DbTransaction idbTran = connection.BeginTransaction();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
|
|
|
var cntrno = "";
|
|
|
var sealno = "";
|
|
|
var cntrtype = "";
|
|
|
var ctnall = "";
|
|
|
var KINDPKGS = "";
|
|
|
var MARKS = "";
|
|
|
var first = true;
|
|
|
foreach (DataRow row in table.Rows)
|
|
|
{
|
|
|
|
|
|
|
|
|
if (first)
|
|
|
{
|
|
|
MARKS = Convert.ToString(row[1]);
|
|
|
KINDPKGS = Convert.ToString(row[2]);
|
|
|
first = false;
|
|
|
}
|
|
|
var HSCODE = Convert.ToString(row[6]);
|
|
|
if (HSCODE.Length == 6)
|
|
|
{
|
|
|
MsOpSeaeDetail data = new MsOpSeaeDetail();
|
|
|
data.CNTRNO = Convert.ToString(row[9]);
|
|
|
data.SEALNO = Convert.ToString(row[10]);
|
|
|
if (data.CNTRNO != ""&&data.CNTRNO.Length<20)
|
|
|
{
|
|
|
cntrno = data.CNTRNO;
|
|
|
sealno = data.SEALNO;
|
|
|
cntrtype = Convert.ToString(row[11]);
|
|
|
data.CTNALL = cntrtype.Substring(cntrtype.IndexOf("*") + 1, 4);
|
|
|
ctnall = data.CTNALL;
|
|
|
}
|
|
|
else {
|
|
|
data.CNTRNO = cntrno;
|
|
|
data.SEALNO = sealno;
|
|
|
data.CTNALL = ctnall;
|
|
|
}
|
|
|
|
|
|
data.PKGS = Convert.ToInt32(row[3]);
|
|
|
data.KGS = Convert.ToDecimal(row[4]);
|
|
|
data.KINDPKGS = KINDPKGS;
|
|
|
data.GOODSNAME = Convert.ToString(row[7]).Replace("'", "''");
|
|
|
data.CBM = Convert.ToDecimal(row[5]);
|
|
|
data.CTNFEE = Convert.ToString(row[6]);
|
|
|
data.WEIGHSIGN = MARKS;
|
|
|
headList.Add(data);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
idbTran.Commit();
|
|
|
|
|
|
if (headList.Count > 0)
|
|
|
InsertCtnData(bsno, headList);
|
|
|
|
|
|
isSucess = true;
|
|
|
}
|
|
|
catch (Exception exception)
|
|
|
{
|
|
|
idbTran.Rollback();
|
|
|
isSucess = false;
|
|
|
msg = exception.Message;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return isSucess;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static bool ImportMNData ( string bsno, HttpRequestBase request, DataTable table, out string msg, out List<MsOpSeaeDetail> headList )
|
|
|
{
|
|
|
var isSucess = false;
|
|
|
msg = "";
|
|
|
headList = new List<MsOpSeaeDetail>();
|
|
|
if (table == null) throw new ArgumentNullException("table");
|
|
|
var head = GetData("BSNO='" + bsno + "'");
|
|
|
var billNoList = new List<string>();
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
using (DbConnection connection = db.CreateConnection())
|
|
|
{
|
|
|
connection.Open();
|
|
|
DbTransaction idbTran = connection.BeginTransaction();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
|
|
|
foreach (DataRow row in table.Rows)
|
|
|
{
|
|
|
|
|
|
|
|
|
var MBLNO = Convert.ToString(row["分单号"]);
|
|
|
var CNTRNO = Convert.ToString(row["箱号"]);
|
|
|
var SEALNO = Convert.ToString(row["铅封号"]);
|
|
|
var PKGS = Convert.ToString(row["件"]);
|
|
|
var KGS = Convert.ToString(row["重"]);
|
|
|
var KINGPKGS = Convert.ToString(row["包装"]);
|
|
|
var CBM = Convert.ToString(row["尺"]);
|
|
|
var DESCRIPTION = Convert.ToString(row["品名"]);
|
|
|
if (DESCRIPTION == "")
|
|
|
DESCRIPTION = head.DESCRIPTION.Replace("'", "''");
|
|
|
|
|
|
if (MBLNO != "")
|
|
|
{
|
|
|
#region 托单数据生成
|
|
|
|
|
|
|
|
|
var cmdInsert = db.GetSqlStringCommand(@"insert into op_manifest (GID,BSNO,MBLNO,CNTRNO,SEALNO,PKGS,KGS,CBM,KINDPKGS,REMARK,DESCRIPTION) values ('"
|
|
|
+ Guid.NewGuid().ToString() + "','" + bsno + "','" + MBLNO + "','" + CNTRNO + "','" + SEALNO + "','" + PKGS + "'," + KGS + "," + CBM + ",'" + KINGPKGS + "','','" + DESCRIPTION + "')");
|
|
|
db.ExecuteNonQuery(cmdInsert, idbTran);
|
|
|
|
|
|
#endregion
|
|
|
}
|
|
|
}
|
|
|
|
|
|
idbTran.Commit();
|
|
|
|
|
|
|
|
|
|
|
|
isSucess = true;
|
|
|
}
|
|
|
catch (Exception exception)
|
|
|
{
|
|
|
idbTran.Rollback();
|
|
|
isSucess = false;
|
|
|
msg = exception.Message;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return isSucess;
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
//
|
|
|
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
/// <param name="bsno"></param>
|
|
|
/// <param name="statusvalue">0:未提交 1:整票提交 2:CZF确认 </param>
|
|
|
/// <returns></returns>
|
|
|
public static bool PiLiangZhengPiaoTiJiao ( string bsno,int statusvalue,string userid,string username,string comid,out string msg)
|
|
|
{
|
|
|
var BLAUDITISSEFT = MsSysParamSetDAL.GetData("PARAMNAME='BLAUDITISSEFT'");
|
|
|
var FEEMANGERMUSTBE = MsSysParamSetDAL.GetData("PARAMNAME='FEEMANGERMUSTBE'");
|
|
|
string message = "";
|
|
|
string blmessage = "";
|
|
|
string custmessage = "";
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
int rst = 0;
|
|
|
string[] bsnos = bsno.Split(',');
|
|
|
foreach (var item in bsnos)
|
|
|
{
|
|
|
string mblno = "";
|
|
|
var SUBMITBILLFEEISNOTZERO = MsSysParamSetDAL.GetData("PARAMNAME='SUBMITBILLFEEISNOTZERO'");
|
|
|
if (SUBMITBILLFEEISNOTZERO.PARAMVALUE == "1")
|
|
|
{
|
|
|
|
|
|
bool check0 = CheckHasZeroFeeWithBsno(item, FEEMANGERMUSTBE.PARAMVALUE, out mblno);
|
|
|
if (check0)
|
|
|
{
|
|
|
message += mblno + ",";
|
|
|
continue;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
bool check1 = CheckHasNoCustWithBsno(item, out mblno);
|
|
|
if (check1)
|
|
|
{
|
|
|
custmessage += mblno + ",";
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
|
|
|
if (BLAUDITISSEFT.PARAMVALUE == "1")
|
|
|
{
|
|
|
bool checkRst = CheckHasNoAuditFeeWithBsno(item, out mblno);
|
|
|
if (checkRst)
|
|
|
{
|
|
|
blmessage += mblno + ",";
|
|
|
continue;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (BLAUDITISSEFT.PARAMVALUE != "1")
|
|
|
{
|
|
|
|
|
|
string sqlLb = "select oplb from v_op_bs where bsno = " + item + "";
|
|
|
string oplb = db.ExecuteScalar(CommandType.Text, sqlLb).ToString();
|
|
|
if (oplb == "" || oplb == null)
|
|
|
{
|
|
|
continue;
|
|
|
}
|
|
|
if (oplb != "op_seae" && oplb != "op_seai" && oplb != "op_airi" && oplb != "op_aire" && oplb != "op_other" && oplb != "op_apply")
|
|
|
{
|
|
|
continue;
|
|
|
}
|
|
|
//费用提交
|
|
|
string condition = "BsNo=" + item;
|
|
|
string oplb2 = oplb;
|
|
|
switch (oplb)
|
|
|
{
|
|
|
case "op_seae":
|
|
|
oplb2 = "op_Seae";
|
|
|
break;
|
|
|
case "op_seai":
|
|
|
oplb2 = "op_Seai";
|
|
|
break;
|
|
|
case "op_airi":
|
|
|
oplb2 = "op_Airi";
|
|
|
break;
|
|
|
case "op_aire":
|
|
|
oplb2 = "op_Aire";
|
|
|
break;
|
|
|
case "op_appy":
|
|
|
oplb2 = "op_Apply";
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
DBResult result = new DBResult();
|
|
|
if (statusvalue != 0)
|
|
|
{
|
|
|
// var dataList = DSWeb.MvcShipping.DAL.MsChFeeDAL.MsChFeeDAL.GetDataList(condition, 1, oplb2, userid, username, comid);
|
|
|
var dataList = DSWeb.MvcShipping.DAL.MsChFeeDAL.MsChFeeDAL.GetAllDataList(condition);
|
|
|
|
|
|
dataList = dataList.FindAll(t => t.FeeStatus == 1 || t.FeeStatus == 6 || t.FeeStatus == 7);
|
|
|
result = DSWeb.MvcShipping.DAL.Chfee_AuditDAL.Chfee_AuditDAL.SubmitAuditNew(oplb2, userid, dataList, true, "", "", comid);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
var dataList = DSWeb.MvcShipping.DAL.MsChFeeDAL.MsChFeeDAL.GetAllDataList(condition);
|
|
|
|
|
|
dataList = dataList.FindAll(t => t.FeeStatus == 2);
|
|
|
var GidStr = "";
|
|
|
foreach (var bill in dataList)
|
|
|
{
|
|
|
if (GidStr == "") GidStr = bill.GId;
|
|
|
else GidStr = GidStr + "," + bill.GId;
|
|
|
}
|
|
|
|
|
|
result = DSWeb.MvcShipping.DAL.Chfee_AuditDAL.Chfee_AuditDAL.CancelAudit(oplb2, userid, GidStr, "");
|
|
|
|
|
|
}
|
|
|
|
|
|
if (result.Success)
|
|
|
{
|
|
|
|
|
|
//海运出口
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
sb.Append("update " + oplb);
|
|
|
sb.Append(" set BillFeeStatus = " + statusvalue);
|
|
|
sb.Append(" where bsno = " + item + "");
|
|
|
rst += db.ExecuteNonQuery(CommandType.Text, sb.ToString());
|
|
|
|
|
|
//根据参数判断是否执行【锁定】操作
|
|
|
if (statusvalue != 0)
|
|
|
{
|
|
|
var SUBMITFEEBLFEELOCK = MsSysParamSetDAL.GetData("PARAMNAME='SUBMITFEEBLFEELOCK'");
|
|
|
var SUBMITFEEBLBSLOCK = MsSysParamSetDAL.GetData("PARAMNAME='SUBMITFEEBLBSLOCK'");
|
|
|
if (SUBMITFEEBLFEELOCK.PARAMVALUE == "1" || SUBMITFEEBLBSLOCK.PARAMVALUE == "1")
|
|
|
{
|
|
|
if (SUBMITFEEBLFEELOCK.PARAMVALUE == "1" && SUBMITFEEBLBSLOCK.PARAMVALUE == "1")
|
|
|
{
|
|
|
string blUpSQL = "UPDATE " + oplb + " SET FEESTATUS=1,BSSTATUS=1 WHERE BSNO=" + item + "";
|
|
|
db.ExecuteNonQuery(CommandType.Text, blUpSQL);
|
|
|
}
|
|
|
else if (SUBMITFEEBLBSLOCK.PARAMVALUE == "1")
|
|
|
{
|
|
|
string blUpSQL = "UPDATE " + oplb + " SET BSSTATUS=1 WHERE BSNO=" + item + "";
|
|
|
db.ExecuteNonQuery(CommandType.Text, blUpSQL);
|
|
|
}
|
|
|
if (SUBMITFEEBLFEELOCK.PARAMVALUE == "1")
|
|
|
{
|
|
|
string blUpSQL = "UPDATE " + oplb + " SET FEESTATUS=1 WHERE BSNO=" + item + "";
|
|
|
db.ExecuteNonQuery(CommandType.Text, blUpSQL);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
var billlist = DSWeb.MvcShipping.DAL.Chfee_AuditDAL.Chfee_AuditDAL.GetBillDataList("MASTERNO=" + item + "",userid,username, comid, null, true);
|
|
|
if (statusvalue != 0)
|
|
|
{
|
|
|
DBResult resultbl = DSWeb.MvcShipping.DAL.Chfee_AuditDAL.Chfee_AuditDAL.SubmitAuditBL(userid, username,billlist, true, "", "", comid);
|
|
|
if (resultbl.Success)
|
|
|
{
|
|
|
rst = rst + 1;
|
|
|
foreach (var bill in billlist) {
|
|
|
var SUBMITFEEBLFEELOCK = MsSysParamSetDAL.GetData("PARAMNAME='SUBMITFEEBLFEELOCK'");
|
|
|
var SUBMITFEEBLBSLOCK = MsSysParamSetDAL.GetData("PARAMNAME='SUBMITFEEBLBSLOCK'");
|
|
|
if (SUBMITFEEBLFEELOCK.PARAMVALUE == "1" || SUBMITFEEBLBSLOCK.PARAMVALUE == "1")
|
|
|
{
|
|
|
if (SUBMITFEEBLFEELOCK.PARAMVALUE == "1" && SUBMITFEEBLBSLOCK.PARAMVALUE == "1")
|
|
|
{
|
|
|
string blUpSQL = "UPDATE " + bill.OPLB + " SET FEESTATUS=1,BSSTATUS=1 WHERE BSNO='" + bill.BSNO + "'";
|
|
|
db.ExecuteNonQuery(CommandType.Text, blUpSQL);
|
|
|
}
|
|
|
else if (SUBMITFEEBLBSLOCK.PARAMVALUE == "1")
|
|
|
{
|
|
|
string blUpSQL = "UPDATE " + bill.OPLB + " SET BSSTATUS=1 WHERE BSNO='" + bill.BSNO + "'";
|
|
|
db.ExecuteNonQuery(CommandType.Text, blUpSQL);
|
|
|
}
|
|
|
if (SUBMITFEEBLFEELOCK.PARAMVALUE == "1")
|
|
|
{
|
|
|
string blUpSQL = "UPDATE " + bill.OPLB + " SET FEESTATUS=1 WHERE BSNO='" + bill.BSNO + "'";
|
|
|
db.ExecuteNonQuery(CommandType.Text, blUpSQL);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
}
|
|
|
else {
|
|
|
DBResult resultbl = DSWeb.MvcShipping.DAL.Chfee_AuditDAL.Chfee_AuditDAL.CancelAuditBL(userid, billlist);
|
|
|
if (resultbl.Success) rst = rst + 1;
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
}
|
|
|
if (message.Length>0)
|
|
|
{
|
|
|
message= message.Substring(0,message.Length-1);
|
|
|
if (FEEMANGERMUSTBE.PARAMVALUE=="1")
|
|
|
message += "存在金额为0的费用或责任人为空的费用,未进行提交操作。";
|
|
|
else
|
|
|
message += "存在金额为0或申请修改、申请删除的费用,未进行提交操作。";
|
|
|
}
|
|
|
if (blmessage.Length > 0)
|
|
|
{
|
|
|
blmessage = blmessage.Substring(0, blmessage.Length - 1);
|
|
|
blmessage += "存在客户名称为空或【已提交单票未审核】费用";
|
|
|
}
|
|
|
if (custmessage.Length > 0)
|
|
|
{
|
|
|
custmessage = custmessage.Substring(0, custmessage.Length - 1);
|
|
|
custmessage += "存在客户名称为空费用";
|
|
|
}
|
|
|
msg = message+ blmessage+ custmessage;
|
|
|
return rst > 0;
|
|
|
}
|
|
|
|
|
|
public static bool CheckMBLNONeedConfirmIsExist (string mblno,string bsno) {
|
|
|
string sql = "select count(*) from op_seae where mblno = '"+mblno+"' and bsno<>'"+bsno+"'";
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
bool rtn = false;
|
|
|
int rst = Convert.ToInt32(db.ExecuteScalar(CommandType.Text, sql));
|
|
|
|
|
|
var SeaeMblrepeat = MsSysParamSetDAL.GetData("PARAMNAME='SeaeMblrepeat'");
|
|
|
|
|
|
//海运出口主提单号允许重复=1 并且 主题单号已存在,则为true
|
|
|
if (SeaeMblrepeat.PARAMVALUE == "1" && rst>0)
|
|
|
{
|
|
|
rtn = true;
|
|
|
}
|
|
|
return rtn;
|
|
|
}
|
|
|
|
|
|
public static bool CheckHasZeroFeeWithBsno(string bsno,string mustmanage,out string mblno) {
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
int rst = 0;
|
|
|
string sql = "select count(*) from ch_fee where bsno = " + bsno + " and (amount = 0 OR FEESTATUS=3 OR FEESTATUS=4) ";
|
|
|
if (mustmanage=="1") sql = "select count(*) from ch_fee where bsno = " + bsno + " and (amount = 0 OR FEESTATUS=3 OR FEESTATUS=4 or isnull(MANAGER,'')='')";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rst = Convert.ToInt32( db.ExecuteScalar(CommandType.Text,sql));
|
|
|
|
|
|
string sql2 = "select mblno from v_op_bs where bsno = "+bsno+"";
|
|
|
var blno = db.ExecuteScalar(CommandType.Text, sql2);
|
|
|
if (blno==DBNull.Value||blno==null)
|
|
|
{
|
|
|
mblno = "";
|
|
|
return rst > 0;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
mblno = blno.ToString();
|
|
|
return rst > 0;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
public static bool CheckHasNoCustWithBsno(string bsno, out string mblno)
|
|
|
{
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
int rst = 0;
|
|
|
string sql = "select count(*) from ch_fee where bsno = " + bsno + " and CUSTOMERNAME='' ";
|
|
|
|
|
|
rst = Convert.ToInt32(db.ExecuteScalar(CommandType.Text, sql));
|
|
|
|
|
|
string sql2 = "select mblno from v_op_bs where bsno = " + bsno + "";
|
|
|
var blno = db.ExecuteScalar(CommandType.Text, sql2);
|
|
|
if (blno == DBNull.Value || blno == null)
|
|
|
{
|
|
|
mblno = "";
|
|
|
return rst > 0;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
mblno = blno.ToString();
|
|
|
return rst > 0;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
public static bool CheckHasNoAuditFeeWithBsno(string bsno, out string mblno)
|
|
|
{
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
int rst = 0;
|
|
|
string sql = "select count(*) from ch_fee where bsno = " + bsno + " and (CUSTOMERNAME='' OR FEESTATUS=2 or FEESTATUS=3 or FEESTATUS=4)";
|
|
|
rst = Convert.ToInt32(db.ExecuteScalar(CommandType.Text, sql));
|
|
|
|
|
|
string sql2 = "select mblno from v_op_bs where bsno = " + bsno + "";
|
|
|
var blno = db.ExecuteScalar(CommandType.Text, sql2);
|
|
|
if (blno == DBNull.Value || blno == null)
|
|
|
{
|
|
|
mblno = "";
|
|
|
return rst > 0;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
mblno = blno.ToString();
|
|
|
return rst > 0;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
}
|