using System;
using System.Collections.Generic;
using DSWeb.Areas.MvcShipping.DAL.MsOpCtnRentBuy;
using HcUtility.Comm;
using HcUtility.Core;
using Newtonsoft.Json;
namespace DSWeb.MvcShipping.Models.MsOpSeaeEdi
{
[JsonObject]
public class MsOpSeaeEdiCtn : ModelObjectBillBody
{
#region 读写属性
private string _ChengZhongZhongLiang;
private string _ChengZhongFangShi;
private string _ChengZhongShiJian;
private string _ZhongKongBiaoShi;
private string _PIZHONG;
///
/// 重空标识
///
[ModelDB]
public string ZhongKongBiaoShi
{
get { return _ZhongKongBiaoShi; }
set { _ZhongKongBiaoShi = value; }
}
private string _ctn_id = "";
///
/// 编号
///
[ModelDB(MDBType = ModelDBOprationType.All, IsPrimary = true)]
public string CTN_ID
{
get { return _ctn_id; }
set { _ctn_id = value; }
}
private string _MFNO = "";
///
/// 业务编号
///
[ModelDB(MDBType = ModelDBOprationType.Insert)]
public string MFNO
{
get { return _MFNO; }
set { _MFNO = value; }
}
private string _ctncode = "";
///
/// 箱型代码
///
[ModelDB]
public string CTNCODE
{
get { return _ctncode; }
set { _ctncode = value; }
}
private string _size = "";
///
/// 尺寸
///
[ModelDB]
public string SIZE
{
get { return _size; }
set { _size = value; }
}
private string _ctn = "";
///
/// 箱型
///
[ModelDB]
public string CTN
{
get { return _ctn; }
set { _ctn = value; }
}
private int _ctnnum = 0;
///
/// 箱量
///
[ModelDB]
public int CTNNUM
{
get { return _ctnnum; }
set { _ctnnum = value; }
}
private int _teu = 0;
///
/// TEU
///
[ModelDB]
public int TEU
{
get { return _teu; }
set { _teu = value; }
}
private string _ctnall = "";
///
/// 表现形式
///
[ModelDB]
public string CTNALL
{
get { return _ctnall; }
set { _ctnall = value; }
}
private string _cntrno = "";
///
/// 箱号
///
[ModelDB]
public string CNTRNO
{
get { return _cntrno; }
set { _cntrno = value; }
}
private string _sealno = "";
///
/// 封号
///
[ModelDB]
public string SEALNO
{
get { return _sealno; }
set { _sealno = value; }
}
private int _pkgs = 0;
///
/// 件数
///
[ModelDB]
public int PKGS
{
get { return _pkgs; }
set { _pkgs = value; }
}
private decimal _kgs = 0;
///
/// 重量
///
[ModelDB]
public decimal KGS
{
get { return _kgs; }
set { _kgs = value; }
}
private decimal _cbm = 0;
///
/// 尺码
///
[ModelDB]
public decimal CBM
{
get { return _cbm; }
set { _cbm = value; }
}
private string _remark = "";
///
/// 备注
///
[ModelDB]
public string REMARK
{
get { return _remark; }
set { _remark = value; }
}
private string _kindpkgs = "";
///
/// KINDPKGS
///
[ModelDB]
public string KINDPKGS
{
get { return _kindpkgs; }
set { _kindpkgs = value; }
}
private string _DESCRIPTION = "";
[ModelDB]
public string DESCRIPTION
{
get { return _DESCRIPTION; }
set { _DESCRIPTION = value; }
}
private string _MARKS = "";
[ModelDB]
public string MARKS
{
get { return _MARKS; }
set { _MARKS = value; }
}
private string _PO = "";
[ModelDB]
public string PO
{
get { return _PO; }
set { _PO = value; }
}
private string _SKU = "";
[ModelDB]
public string SKU
{
get { return _SKU; }
set { _SKU = value; }
}
private string _SKUDESCRIP = "";
[ModelDB]
public string SKUDESCRIP
{
get { return _SKUDESCRIP; }
set { _SKUDESCRIP = value; }
}
private string _DUNNO = "";
[ModelDB]
public string DUNNO
{
get { return _DUNNO; }
set { _DUNNO = value; }
}
private string _HTS = "";
[ModelDB]
public string HTS
{
get { return _HTS; }
set { _HTS = value; }
}
private string _CTOFORIGIN = "";
[ModelDB]
public string CTOFORIGIN
{
get { return _CTOFORIGIN; }
set { _CTOFORIGIN = value; }
}
private string _CTNOWNER = "";
[ModelDB]
public string CTNOWNER
{
get { return _CTNOWNER; }
set { _CTNOWNER = value; }
}
private decimal _GOODVALUE =0;
[ModelDB]
public decimal GOODVALUE
{
get { return _GOODVALUE; }
set { _GOODVALUE = value; }
}
private string _ShiFengRen = "";
///
/// 施封人
///
[ModelDB]
public string ShiFengRen
{
get { return _ShiFengRen; }
set { _ShiFengRen = value; }
}
private string _APICTNID = "";
[ModelDB]
public string APICTNID
{
get { return _APICTNID; }
set { _APICTNID = value; }
}
[ModelDB]
public string ChengZhongZhongLiang { get => _ChengZhongZhongLiang; set => _ChengZhongZhongLiang = value; }
[ModelDB]
public string ChengZhongFangShi { get => _ChengZhongFangShi; set => _ChengZhongFangShi = value; }
[ModelDB]
public string ChengZhongShiJian { get => _ChengZhongShiJian; set => _ChengZhongShiJian = value; }
[ModelDB]
public string PIZHONG { get => _PIZHONG; set => _PIZHONG = value; }
#endregion
[ModelDB]
public DateTime? VGMCLOSETIME { get; set; }
[ModelDB]
public string HSCODE { get; set; }
public MsOpSeaeEdiCtn()
{
TableName = "op_seae_edi_ctn";
setFieldLengthLimit();
}
public static List FieldLength = new List();
protected static void setFieldLengthLimit()
{
FieldLength.Clear();
FieldLength.Add(new FieldLengthLimit("集装箱尺寸", "SIZE", 2));
FieldLength.Add(new FieldLengthLimit("集装箱箱型", "CTN", 5));
FieldLength.Add(new FieldLengthLimit("表现形式", "CTNALL", 8));
FieldLength.Add(new FieldLengthLimit("箱号", "CNTRNO", 11));
FieldLength.Add(new FieldLengthLimit("封号", "SEALNO", 20));
FieldLength.Add(new FieldLengthLimit("件数", "PKGS", 6));
FieldLength.Add(new FieldLengthLimit("包装", "KINDPKGS", 20));
FieldLength.Add(new FieldLengthLimit("重量", "KGS", 9));
FieldLength.Add(new FieldLengthLimit("尺码", "CBM", 5));
}
override public FieldLengthLimit GetFieldLength(string propertyname)
{
try
{
var f = FieldLength.Find(o => o.FieldName == propertyname);
return f;
}
catch
{
return new FieldLengthLimit();
}
}
public DBResult CheckLength()
{
var result = new DBResult(true, "");
foreach (var f in FieldLength)
{
var istoolong = isTooLong(f.FieldName);
if (istoolong.Success)
{
result.SetErrorInfo(istoolong.Message);
}
}
return result;
}
public static DBResult CheckCtn_CanSave(List CtnList)
{
var result = new DBResult(true, "");
if (CtnList == null || CtnList.Count == 0) return result;
foreach (var ctn in CtnList)
{
var ctnchecksave = ctn.CheckLength();
if (!ctnchecksave.Success) result.SetErrorInfo(ctnchecksave.Message);
var templist = CtnList.FindAll(o => o.CNTRNO == ctn.CNTRNO);
if (!op_ctn_outin.isCntrNO(ctn.CNTRNO)) {
result.SetErrorInfo("箱号" + ctn.CNTRNO + "不符合规范");
}
if (templist.Count > 1)
{
result.SetErrorInfo("箱号" + ctn.CNTRNO + "重复");
}
}
return result;
}
public static DBResult CheckCtn_CanSend(List CtnList)
{
var result = CheckCtn_CanSave(CtnList);
foreach (var ctn in CtnList)
{
//然后判断一些为空的情况
if (string.IsNullOrWhiteSpace(ctn.SIZE))
{
result.SetErrorInfo("集装箱尺寸 必填");
}
if (string.IsNullOrWhiteSpace(ctn.CTN))
{
result.SetErrorInfo("集装箱箱型 必填");
}
//if (string.IsNullOrWhiteSpace(ctn.CTNALL))
//{
// result.SetErrorInfo("表现形式 必填");
//}
if (string.IsNullOrWhiteSpace(ctn.CNTRNO))
{
result.SetErrorInfo("箱号 必填");
}
if (string.IsNullOrWhiteSpace(ctn.SEALNO))
{
result.SetErrorInfo("封号 必填");
}
//if (isNull(PKGS))
//{
// result.SetErrorInfo("件数 必填");
//}
if (string.IsNullOrWhiteSpace(ctn.KINDPKGS))
{
result.SetErrorInfo("包装 必填");
}
//if (isNull(KGS))
//{
// result.SetErrorInfo("表现形式 必填");
//}
//if (isNull(CBM))
//{
// result.SetErrorInfo("表现形式 必填");
//}
}
return result;
}
}
[JsonObject]
public class MsOpSeaeEdiCtnDetail : ModelObjectBillBody
{
#region 读写属性
private string _GID = "";
///
/// 编号
///
[ModelDB(MDBType = ModelDBOprationType.All, IsPrimary = true)]
public string GID
{
get { return _GID; }
set { _GID = value; }
}
private string _ctn_id = "";
///
/// 编号
///
[ModelDB(MDBType = ModelDBOprationType.Insert)]
public string CTN_ID
{
get { return _ctn_id; }
set { _ctn_id = value; }
}
private string _MFNO = "";
///
/// 业务编号
///
[ModelDB(MDBType = ModelDBOprationType.Insert)]
public string MFNO
{
get { return _MFNO; }
set { _MFNO = value; }
}
private string _cntrno = "";
public string CNTRNO
{
get { return _cntrno; }
set { _cntrno = value; }
}
private int _pkgs = 0;
///
/// 件数
///
[ModelDB]
public int PKGS
{
get { return _pkgs; }
set { _pkgs = value; }
}
private decimal _kgs = 0;
///
/// 重量
///
[ModelDB]
public decimal KGS
{
get { return _kgs; }
set { _kgs = value; }
}
private decimal _cbm = 0;
///
/// 尺码
///
[ModelDB]
public decimal CBM
{
get { return _cbm; }
set { _cbm = value; }
}
private string _kindpkgs = "";
///
/// KINDPKGS
///
[ModelDB]
public string KINDPKGS
{
get { return _kindpkgs; }
set { _kindpkgs = value; }
}
private string _DUNNO = "";
[ModelDB]
public string DUNNO
{
get { return _DUNNO; }
set { _DUNNO = value; }
}
private string _HTS = "";
[ModelDB]
public string HTS
{
get { return _HTS; }
set { _HTS = value; }
}
private decimal _GOODVALUE = 0;
[ModelDB]
public decimal GOODVALUE
{
get { return _GOODVALUE; }
set { _GOODVALUE = value; }
}
#endregion
public MsOpSeaeEdiCtnDetail()
{
TableName = "op_seae_edi_ctndetail";
}
}
[JsonObject]
public class MsOpSeaeShipper : ModelObjectBillHead
{
#region 读写属性
private string _GID = "";
public string GID
{
get { return _GID; }
set { _GID = value; }
}
private string _shippername = "";
///
/// 发货人
///
public string SHIPPERNAME
{
get { return _shippername; }
set { _shippername = value; }
}
private string _shipperaddr1 = "";
///
/// 发货人
///
public string SHIPPERADDR1
{
get { return _shipperaddr1; }
set { _shipperaddr1 = value; }
}
private string _shipperaddr2 = "";
///
/// 发货人
///
public string SHIPPERADDR2
{
get { return _shipperaddr2; }
set { _shipperaddr2 = value; }
}
private string _shipperaddr3 = "";
///
/// 发货人
///
public string SHIPPERADDR3
{
get { return _shipperaddr3; }
set { _shipperaddr3 = value; }
}
private string _shippercity = "";
///
/// 发货人
///
public string SHIPPERCITY
{
get { return _shippercity; }
set { _shippercity = value; }
}
private string _shipperprovice = "";
public string SHIPPERPROVINCE
{
get { return _shipperprovice; }
set { _shipperprovice = value; }
}
private string _shipperpostcode = "";
public string SHIPPERPOSTCODE
{
get { return _shipperpostcode; }
set { _shipperpostcode = value; }
}
private string _shippercountry = "";
public string SHIPPERCOUNTRY
{
get { return _shippercountry; }
set { _shippercountry = value; }
}
private string _shipperattn = "";
public string SHIPPERATTN
{
get { return _shipperattn; }
set { _shipperattn = value; }
}
private string _shippertel = "";
public string SHIPPERTEL
{
get { return _shippertel; }
set { _shippertel = value; }
}
#endregion
}
#region 参照部分
public class MsOpSeaiDetailRefMsOpSeai
{
public string BSNO { get; set; }
}
#endregion
}