You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DS7/DSWeb/Areas/MvcShipping/Models/BookingConfirm/BookingConfirmModel.cs

528 lines
18 KiB
C#

using System;
using HcUtility.Core;
using Newtonsoft.Json;
using System.Collections.Generic;
using DSWeb.MvcShipping.Models.MsOpSeae;
namespace DSWeb.MvcShipping.Models.BookingConfirm
{
[JsonObject]//网上订舱业务 头表
public class BookingConfirmmb : ModelObjectBillHead
{
public override Dictionary<string, ModelDBOprationType> GetPKey()
{//用于给扩展的动态数据提供主键字段名
var d = new Dictionary<string, ModelDBOprationType>() { { "ORDNO", ModelDBOprationType.All } };
return d;
}
public Dictionary<string, string> SaveDic = new Dictionary<string, string>();
public static string getSQL()
{
return " SELECT [ORDNO],[BSNO],[BSSTATUS],[SISTATUS],(select max(optime) from OP_LOG where billno=ORDNO and JsonValue like '%\"BSSTATUS\":\"Submit\"%') [BSDATE],[MBLNO],[HBLNO],[ORDERNO],[CONTRACTNO]"
+ ",[SERVICECONTRACTNO],[SHIPPERID],[CONSIGNEEID],[NOTIFYPARTYID],[SHIPPER],[CONSIGNEE]"
+ ",[NOTIFYPARTY],[NOTIFYPARTY2],[YARD],[VESSELID],[VESSEL],[VOYNO],CONVERT(varchar(100), [ETD], 23)[ETD],[CLOSINGDATE],[CLOSEDOCDATE]"
+ ",[ETA],[PLACERECEIPTID],[PLACERECEIPT],[PORTLOADID],[PORTLOAD],[PORTDISCHARGEID],[PORTDISCHARGE]"
+ ",[PLACEDELIVERYID],[PLACEDELIVERY],[DESTINATIONID],[DESTINATION],[NOBILL],[COPYNOBILLL] COPYNOBILL,TRANSTYPE"
+ ",[ISSUETYPE],CONVERT(varchar(100), [ISSUEDATE], 23)[ISSUEDATE],[ISSUEPLACEID],[ISSUEPLACE],[BLFRT],[PREPARDAT],[PAYABLEAT]"
+ ",[SERVICE],[MARKS],[HSCODE],[DESCRIPTION],[PKGS],[KINDPKGS],[KGS],[CBM],[CNTRTOTAL],[INPUTBY]"
+ ",[CARRIER],[CARGOID],[DCLASS],[DUNNO],[DPAGE],[DLABEL],[LINKMAN],[TEMPID],[TEMPSET],[REEFERF]"
+ ",[HUMIDITY],[ISCONTAINERSOC],O.[REMARK],[EDIREMARK],[CREATETIME],[MODIFYTIME],[MODIFYUSER]"
+ ",[USERID],[CORPID],[SHIPPERNAME],[SHIPPERADDR1],[SHIPPERADDR2],[SHIPPERADDR3]"
+ ",[SHIPPERCITY],[SHIPPERPROVINCE],[SHIPPERPOSTCODE],[SHIPPERCOUNTRY],[SHIPPERATTN],[SHIPPERTEL]"
+ ",[CONSIGNEENAME],[CONSIGNEEADDR1],[CONSIGNEEADDR2],[CONSIGNEEADDR3]"
+ ",[CONSIGNEECITY],[CONSIGNEEPROVINCE],[CONSIGNEEPOSTCODE],[CONSIGNEERCOUNTRY],[CONSIGNEEATTN],[CONSIGNEETEL]"
+ ",[NOTIFYPARTYNAME],[NOTIFYPARTYADDR1],[NOTIFYPARTYADDR2],[NOTIFYPARTYADDR3],[NOTIFYPARTYCITY],[NOTIFYPARTYPROVINCE]"
+ ",[NOTIFYPARTYPOSTCODE],[NOTIFYPARTYCOUNTRY],[NOTIFYPARTYATTN],[NOTIFYPARTYTEL],[SALE_NAME]"
+ ",U.name OPERATOR,U.TEL OPERATORTEL,U.Email OPERATOREMAIL,U.INFO_CLIENT CUSTOMERNAME, '整箱' BLTYPE "
+ ",case BSSTATUS when 'create' then '未提交' when 'submit' then '提交' when 'confirm' then '订舱确认' when 'none' then '无' when 'Back' then '驳回订舱' else '' end BSSTATUSREF"
+ ",case SISTATUS when 'create' then '创建' when 'submit' then '提交' when 'confirm' then '提单确认' when 'none' then '无' when 'Reject' then '拒绝' else '' end SISTATUSREF"
+ " FROM [OP_SEAE_ORDER] O left join SYS_USER u on USERID=u.gid where BSSTATUS <>'create' ";
}
public BookingConfirmmb()
{
TableName = "OP_SEAE_ORDER";
}
public override string GetBillNoFieldName()
{
return "ORDNO";
}
public override string GetTimeMarkFieldName()
{
return "";
}
public override string GetStateFieldName()
{
return "BSSTATUS";
}
public DSWeb.MvcShipping.Models.MsOpSeae.MsOpSeae getOpSeae()
{
var MsOpSeae = new MsOpSeae.MsOpSeae();
return MsOpSeae;
}
}
[JsonObject]//押箱业务 集装箱表
public class Booking_Ctnmb : ModelObjectBillBody
{
public override Dictionary<string, ModelDBOprationType> GetPKey()
{//用于给扩展的动态数据提供主键字段名
var d = new Dictionary<string, ModelDBOprationType>() { { "CTN_ID", ModelDBOprationType.All } };
return d;
}
public Dictionary<string, string> SaveDic = new Dictionary<string, string>();
public static string getSQL()
{
return " SELECT [CTN_ID],[ORDNO],[CTNALL],[CTNNUM],[TEU],[CNTRNO],[SEALNO],[PKGS],[KINDPKGS],[KGS],[CBM],[TAREWEIGHT],[CTNSTATUS],[WEIGHTYPE],[WEIGHKGS],[WEIGHATTN],[VGMCONNCOM],[WEIGHTEL],[WEIGHDATE],[VGMADDR],[VGMEMAIL],[REMARK] ,(select bsno from OP_SEAE_ORDER where ORDNO in(select ORDNO from op_seae_si where SINO=[OP_CTN].ORDNO)) BSNO_PARENT,(select bsno from OP_SEAE_ORDER where ORDNO =[OP_CTN].ORDNO) BSNO,(select MBLNO from OP_SEAE_SI where SINO =[OP_CTN].ORDNO) SI_MBLNO FROM [OP_CTN] ";
}
public Booking_Ctnmb()
{
TableName = "OP_CTN";
}
public override string GetBillNoFieldName()
{
return "ORDNO";
}
public override string GetTimeMarkFieldName()
{
return "";
}
public override string GetStateFieldName()
{
return "";
}
}
[JsonObject]//押箱业务 集装箱多品名明细
public class Booking_CtnDetailmb : ModelObjectBillBody
{
public override Dictionary<string, ModelDBOprationType> GetPKey()
{//用于给扩展的动态数据提供主键字段名
var d = new Dictionary<string, ModelDBOprationType>() { { "GID", ModelDBOprationType.All } };
return d;
}
public Dictionary<string, string> SaveDic = new Dictionary<string, string>();
public static string getSQL()
{
return " SELECT [GID],[CTN_ID],[PKGS],[KINDPKGS],[KGS],[CBM],[HSCODE],[MARKS],[DESCRIPTION],[REMARK] FROM [OP_CTN_DETAIL] ";
}
public Booking_CtnDetailmb()
{
TableName = "OP_CTN_DETAIL";
}
public override string GetBillNoFieldName()
{
return "CTN_ID";
}
public override string GetTimeMarkFieldName()
{
return "";
}
public override string GetStateFieldName()
{
return "";
}
}
[JsonObject]//押箱业务 提单确认主表
public class Booking_OP_SEAE_SImb : ModelObjectBillHead
{
public override Dictionary<string, ModelDBOprationType> GetPKey()
{//用于给扩展的动态数据提供主键字段名
var d = new Dictionary<string, ModelDBOprationType>() { { "SINO", ModelDBOprationType.All } };
return d;
}
public Dictionary<string, string> SaveDic = new Dictionary<string, string>();
public static string getSQL()
{
return " SELECT SINO,ORDNO,BSNO,BSSTATUS,(select max(optime) from OP_LOG where billno=ORDNO and JsonValue like '%\"BSSTATUS\":\"Submit\"%') BSDATE,(select max(optime) from OP_LOG where billno=SINO and JsonValue like '%\"BSSTATUS\":\"Submit\"%')SUBMITDATE,MBLNO,HBLNO,ORDERNO,CONTRACTNO,SERVICECONTRACTNO,SHIPPERID,CONSIGNEEID,NOTIFYPARTYID,SHIPPER,CONSIGNEE,NOTIFYPARTY,NOTIFYPARTY2,YARD,VESSELID,VESSEL,VOYNO,CONVERT(varchar(100), ETD, 23)ETD,CONVERT(varchar(100), CLOSINGDATE, 20) CLOSINGDATE,CONVERT(varchar(100), CLOSEDOCDATE, 20) CLOSEDOCDATE,ETA,PLACERECEIPTID,PLACERECEIPT,PORTLOADID,PORTLOAD,PORTDISCHARGEID,PORTDISCHARGE,PLACEDELIVERYID,PLACEDELIVERY,DESTINATIONID,DESTINATION,NOBILL,COPYNOBILLL COPYNOBILL,ISSUETYPE,ISSUEDATE,ISSUEPLACEID,ISSUEPLACE,BLFRT,PREPARDAT,PAYABLEAT,SERVICE,MARKS,HSCODE,DESCRIPTION,PKGS,KINDPKGS,KGS,CBM,CNTRTOTAL,INPUTBY,CARRIER,CARGOID,DCLASS,DUNNO,DPAGE,DLABEL,LINKMAN,TEMPID,TEMPSET,REEFERF,HUMIDITY,ISCONTAINERSOC,REMARK,SIREMARK,CREATETIME,MODIFYTIME,MODIFYUSER,USERID,CORPID,SHIPPERNAME,SHIPPERADDR1,SHIPPERADDR2,SHIPPERADDR3,SHIPPERCITY,SHIPPERPROVINCE,SHIPPERPOSTCODE,SHIPPERCOUNTRY,SHIPPERATTN,SHIPPERTEL,CONSIGNEENAME,CONSIGNEEADDR1,CONSIGNEEADDR2,CONSIGNEEADDR3,CONSIGNEECITY,CONSIGNEEPROVINCE,CONSIGNEEPOSTCODE,CONSIGNEERCOUNTRY,CONSIGNEEATTN,CONSIGNEETEL,NOTIFYPARTYNAME,NOTIFYPARTYADDR1,NOTIFYPARTYADDR2,NOTIFYPARTYADDR3,NOTIFYPARTYCITY,NOTIFYPARTYPROVINCE,NOTIFYPARTYPOSTCODE,NOTIFYPARTYCOUNTRY,NOTIFYPARTYATTN,NOTIFYPARTYTEL " +
",case BSSTATUS when 'create' then '创建' when 'submit' then '提交' when 'confirm' then '提单确认' when 'none' then '无' when 'Reject' then '拒绝' else '' end BSSTATUSREF" +
",(case when (select count(*) from OP_SEAE_SI s where s.ordno=OP_SEAE_SI.ORDNO)>1 then 'true' else 'false' end )ISMULTI" +
",(select BSNO from OP_SEAE_ORDER where ORDNO = OP_SEAE_SI.ORDNO) ORDER_BSNO " +
",(select INFO_CLIENT from sys_user where GID=OP_SEAE_SI.USERID) CUSTOMERNAME " +
",(select NAME from sys_user where GID=OP_SEAE_SI.USERID) OPERATOR " +
",(select MOBILE from sys_user where GID=OP_SEAE_SI.USERID) OPERATORTEL " +
",(select EMAIL from sys_user where GID=OP_SEAE_SI.USERID) OPERATORMAIL " +
" FROM OP_SEAE_SI ";
}
public Booking_OP_SEAE_SImb()
{
TableName = "OP_SEAE_SI";
}
public override string GetBillNoFieldName()
{
return "SINO";
}
public override string GetTimeMarkFieldName()
{
return "";
}
public override string GetStateFieldName()
{
return "";
}
}
[JsonObject]
public class DiffCheckmb : ModelObjectBillHead
{
#region private Fields
private string _ISCONTRACTNO = string.Empty;
private string _ISMBLNO = string.Empty;
private string _ISHBLNO = string.Empty;
private string _ISCARRIER = string.Empty;
private string _ISVESSEL = string.Empty;
private string _ISVOYNO = string.Empty;
private string _ISSHIPPER = string.Empty;
private string _ISCONSIGNEE = string.Empty;
private string _ISNOTIFYPARTY = string.Empty;
private string _ISMARKS = string.Empty;
private string _ISDESCRIPTION = string.Empty;
private string _ISHSCODE = string.Empty;
private string _ISISCONTAINERSOC = string.Empty;
private string _ISCARGOID = string.Empty;
private string _ISCNTRTOTAL = string.Empty;
private string _ISPKGS = string.Empty;
private string _ISKINDPKGS = string.Empty;
private string _ISKGS = string.Empty;
private string _ISCBM = string.Empty;
private string _ISPORTLOADID = string.Empty;
private string _ISPORTLOAD = string.Empty;
private string _ISPLACERECEIPTID = string.Empty;
private string _ISPLACERECEIPT = string.Empty;
private string _ISPORTDISCHARGEID = string.Empty;
private string _ISPORTDISCHARGE = string.Empty;
private string _ISDESTINATIONID = string.Empty;
private string _ISDESTINATION = string.Empty;
private string _ISPLACEDELIVERYID = string.Empty;
private string _ISPLACEDELIVERY = string.Empty;
private string _ISSIREMARK = string.Empty;
private string _ISISSUETYPE = string.Empty;
private string _ISSERVICE = string.Empty;
private string _ISBLFRT = string.Empty;
private string _ISPREPARDAT = string.Empty;
private string _ISPAYABLEAT = string.Empty;
private string _ISNOBILL = string.Empty;
#endregion
#region R&W
public string ISCONTRACTNO
{
get { return _ISCONTRACTNO; }
set { _ISCONTRACTNO = value; }
}
public string ISMBLNO
{
get { return _ISMBLNO; }
set { _ISMBLNO = value; }
}
public string ISHBLNO
{
get { return _ISHBLNO; }
set { _ISHBLNO = value; }
}
public string ISCARRIER
{
get { return _ISCARRIER; }
set { _ISCARRIER = value; }
}
public string ISVESSEL
{
get { return _ISVESSEL; }
set { _ISVESSEL = value; }
}
public string ISVOYNO
{
get { return _ISVOYNO; }
set { _ISVOYNO = value; }
}
public string ISSHIPPER
{
get { return _ISSHIPPER; }
set { _ISSHIPPER = value; }
}
public string ISCONSIGNEE
{
get { return _ISCONSIGNEE; }
set { _ISCONSIGNEE = value; }
}
public string ISNOTIFYPARTY
{
get { return _ISNOTIFYPARTY; }
set { _ISNOTIFYPARTY = value; }
}
public string ISMARKS
{
get { return _ISMARKS; }
set { _ISMARKS = value; }
}
public string ISDESCRIPTION
{
get { return _ISDESCRIPTION; }
set { _ISDESCRIPTION = value; }
}
public string ISHSCODE
{
get { return _ISHSCODE; }
set { _ISHSCODE = value; }
}
public string ISISCONTAINERSOC
{
get { return _ISISCONTAINERSOC; }
set { _ISISCONTAINERSOC = value; }
}
public string ISCARGOID
{
get { return _ISCARGOID; }
set { _ISCARGOID = value; }
}
public string ISCNTRTOTAL
{
get { return _ISCNTRTOTAL; }
set { _ISCNTRTOTAL = value; }
}
public string ISPKGS
{
get { return _ISPKGS; }
set { _ISPKGS = value; }
}
public string ISKINDPKGS
{
get { return _ISKINDPKGS; }
set { _ISKINDPKGS = value; }
}
public string ISKGS
{
get { return _ISKGS; }
set { _ISKGS = value; }
}
public string ISCBM
{
get { return _ISCBM; }
set { _ISCBM = value; }
}
public string ISPORTLOADID
{
get { return _ISPORTLOAD; }
set { _ISPORTLOAD = value; }
}
public string ISPORTLOAD
{
get { return _ISPORTLOAD; }
set { _ISPORTLOAD = value; }
}
public string ISPLACERECEIPTID
{
get { return _ISPLACERECEIPT; }
set { _ISPLACERECEIPT = value; }
}
public string ISPLACERECEIPT
{
get { return _ISPLACERECEIPT; }
set { _ISPLACERECEIPT = value; }
}
public string ISPORTDISCHARGEID
{
get { return _ISPORTDISCHARGE; }
set { _ISPORTDISCHARGE = value; }
}
public string ISPORTDISCHARGE
{
get { return _ISPORTDISCHARGE; }
set { _ISPORTDISCHARGE = value; }
}
public string ISDESTINATIONID
{
get { return _ISDESTINATION; }
set { _ISDESTINATION = value; }
}
public string ISDESTINATION
{
get { return _ISDESTINATION; }
set { _ISDESTINATION = value; }
}
public string ISPLACEDELIVERYID
{
get { return _ISPLACEDELIVERY; }
set { _ISPLACEDELIVERY = value; }
}
public string ISPLACEDELIVERY
{
get { return _ISPLACEDELIVERY; }
set { _ISPLACEDELIVERY = value; }
}
public string ISSIREMARK
{
get { return _ISSIREMARK; }
set { _ISSIREMARK = value; }
}
public string ISISSUETYPE
{
get { return _ISISSUETYPE; }
set { _ISISSUETYPE = value; }
}
public string ISSERVICE
{
get { return _ISSERVICE; }
set { _ISSERVICE = value; }
}
public string ISBLFRT
{
get { return _ISBLFRT; }
set { _ISBLFRT = value; }
}
public string ISPREPARDAT
{
get { return _ISPREPARDAT; }
set { _ISPREPARDAT = value; }
}
public string ISPAYABLEAT
{
get { return _ISPAYABLEAT; }
set { _ISPAYABLEAT = value; }
}
public string ISNOBILL
{
get { return _ISNOBILL; }
set { _ISNOBILL = value; }
}
#endregion
public string ISYARD { get; set; }
public string ISETD { get; set; }
public string ISCLOSINGDATE { get; set; }
public string ISCLOSEDOCDATE { get; set; }
public string ISVESSELID { get; set; }
public string ISCOPYNOBILL { get; set; }
/// <summary>
/// 检查字段名对应的勾是否已经打上
/// </summary>
/// <param name="FieldName"></param>
/// <returns></returns>
public bool getChecked(string FieldName)
{
var _checked = GetValue("IS" + FieldName);
if (!(_checked == "true")) return false;
else return true;
}
}
/// <summary>
/// 用来存放“需要同步的列名”用的数据对象
/// </summary>
[JsonObject]
public class DiffFieldmb {
public string FieldName { get; set; }
public string FieldType { get; set; }
public DiffFieldmb(string FieldName, string FieldType) {
this.FieldName = FieldName;
this.FieldType = FieldType;
}
public DiffFieldmb()
{
}
public static Object GetValue(List<DiffFieldmb> DiffList, Dictionary<string, string> Dic, string FieldName)
{
foreach (var item in DiffList)
{
if (item.FieldName == FieldName)
{
if (item.FieldType == "string")
{
return Dic[FieldName];
}
if (item.FieldType == "decimal")
{
var _s = Dic[FieldName];
if (_s == "") _s = "0";
return Convert.ToDecimal(_s);
}
if (item.FieldType == "int")
{
var _s = Dic[FieldName];
return Convert.ToInt32(_s);
}
if (item.FieldType == "bool")
{
var _s = Dic[FieldName];
if (_s == "1"|| _s == "true") return true;
return false;
//return Convert.ToBoolean(_s);
}
break;
}
}
return null;
}
}
}