|
|
|
@ -92,7 +92,7 @@ namespace DSWeb.Service.Output.DS7
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
modelCangdan.BasicConsume($"{QueuePrefixCangdan}{CompanyId}", false, consumerCangdan);
|
|
|
|
|
modelCangdan.BasicConsume($"{QueuePrefixCangdan}{CompanyId}", true, consumerCangdan);
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
//报关队列(委托)
|
|
|
|
@ -176,267 +176,6 @@ namespace DSWeb.Service.Output.DS7
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//舱单数据生成到东胜7
|
|
|
|
|
public void CangdanDataToDS7(JArray jarr)
|
|
|
|
|
{
|
|
|
|
|
var opUser = dS7Data.User.AsNoTracking().First(u => u.GID == FeeInputUserId);
|
|
|
|
|
foreach (var item in jarr)
|
|
|
|
|
{
|
|
|
|
|
var obj = item as JObject;
|
|
|
|
|
|
|
|
|
|
var MBLNO = obj.GetValue("MBLNO").ToString();
|
|
|
|
|
var HBLNO = obj.GetValue("HBLNO").ToString();
|
|
|
|
|
var CARRIERID = obj.GetValue("CARRIERID").ToString();
|
|
|
|
|
var CARRIER = obj.GetValue("CARRIER").ToString();
|
|
|
|
|
var WeiTuoFaSongFang = obj.GetValue("WeiTuoFaSongFang").ToString();
|
|
|
|
|
var DESTINATION = obj.GetValue("DESTINATION").ToString();
|
|
|
|
|
var DESTINATIONID = obj.GetValue("DESTINATIONID").ToString();
|
|
|
|
|
var PORTDISCHARGE = obj.GetValue("PORTDISCHARGE").ToString();
|
|
|
|
|
var PORTDISCHARGEID = obj.GetValue("PORTDISCHARGEID").ToString();
|
|
|
|
|
var strETD = obj.GetValue("ETD").ToString();
|
|
|
|
|
var ETD = Convert.ToDateTime(strETD);
|
|
|
|
|
var CompId = obj.GetValue("CompId").ToString();
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
2021-12-23最新需求:
|
|
|
|
|
按主提单号(MBLNO)在客户东胜系统查询,如果查到对应主提单号,则在该票业务下写入舱单费,如果有分单,每一票分单,也要生成一条舱单费,分单的舱单费,需要在费用备注里写入分提单号。
|
|
|
|
|
如果主提单号在东胜系统搜不到,则创建一条新业务,并按委托方生成舱单费。
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
OpSeae opSeae = dS7Data.OpSeae.AsNoTracking().FirstOrDefault(x => x.MBLNO == MBLNO && (x.HBLNO == null || x.HBLNO == ""));
|
|
|
|
|
|
|
|
|
|
if (opSeae == null)
|
|
|
|
|
{
|
|
|
|
|
logger.Debug($"未找到委托数据:{MBLNO}");
|
|
|
|
|
|
|
|
|
|
opSeae = new OpSeae();
|
|
|
|
|
dS7Data.OpSeae.Add(opSeae);
|
|
|
|
|
opSeae.BSNO = Guid.NewGuid().ToString().Replace("-", "");
|
|
|
|
|
opSeae.MASTERNO = opSeae.BSNO;
|
|
|
|
|
opSeae.MBLNO = MBLNO;
|
|
|
|
|
opSeae.CARGOID = CARRIERID;
|
|
|
|
|
opSeae.CARRIER = CARRIER;
|
|
|
|
|
opSeae.DESTINATION = DESTINATION;
|
|
|
|
|
opSeae.DESTINATIONID = DESTINATIONID;
|
|
|
|
|
opSeae.PORTDISCHARGE = PORTDISCHARGE;
|
|
|
|
|
opSeae.PORTDISCHARGEID = PORTDISCHARGEID;
|
|
|
|
|
opSeae.OP = opUser.SHOWNAME;
|
|
|
|
|
opSeae.INPUTBY = opUser.SHOWNAME;
|
|
|
|
|
opSeae.CORPID = Corpid;
|
|
|
|
|
//opSeae.ETD = ETD;
|
|
|
|
|
opSeae.ETD = DateTime.Today; //2021-12-29,于菲:开船日期为导入日期
|
|
|
|
|
opSeae.CREATETIME = DateTime.Now;
|
|
|
|
|
opSeae.ISCANCEL = "0";
|
|
|
|
|
|
|
|
|
|
opSeae.BSDATE = DateTime.Today;
|
|
|
|
|
opSeae.BSSTATUS = false;
|
|
|
|
|
opSeae.FEESTATUS = false;
|
|
|
|
|
opSeae.ACCDATE = ETD.ToString("yyyy-MM");
|
|
|
|
|
opSeae.BLTYPE = "整箱";
|
|
|
|
|
|
|
|
|
|
var custEdi = dS7Data.CodeCustEdi.AsNoTracking().FirstOrDefault(x => x.EDINAME == "DJY_OUTPUT" && x.EDICODE == WeiTuoFaSongFang);
|
|
|
|
|
if (custEdi != null)
|
|
|
|
|
{
|
|
|
|
|
opSeae.CUSTOMERNAME = custEdi.CUST;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//生成编号
|
|
|
|
|
var billnoset = dS7Data.SysBillNoSet.AsNoTracking().FirstOrDefault(x => x.COMPANYID == Corpid && x.OPLBNAME == "海运出口" && x.RULEBLNO == "委托编号");
|
|
|
|
|
if (billnoset != null)
|
|
|
|
|
{
|
|
|
|
|
opSeae.CUSTNO = GetBillNo(billnoset, opSeae.ETD.ToString(), opSeae.ACCDATE, opname: opUser.SHOWNAME, corpid: Corpid);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
logger.Debug($"SysBillNoSet数据未找到,无法生成编号:{MBLNO}");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
logger.Debug($"委托数据已存在:{MBLNO}");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
InfoClient infoClient = null;
|
|
|
|
|
if (!string.IsNullOrEmpty(opSeae.CUSTOMERNAME))
|
|
|
|
|
{
|
|
|
|
|
infoClient = dS7Data.InfoClient.AsNoTracking().FirstOrDefault(x => x.SHORTNAME == opSeae.CUSTOMERNAME);
|
|
|
|
|
if (infoClient != null)
|
|
|
|
|
{
|
|
|
|
|
opSeae.SALE = infoClient.SALE; //揽货人赋值
|
|
|
|
|
|
|
|
|
|
//查询配置,生成应收
|
|
|
|
|
var fee = dS7Data.CustFeeTemplateDetail.AsNoTracking().FirstOrDefault(x => x.CUSTOMERNAME == infoClient.SHORTNAME && x.FEENAME == FeeShouName);
|
|
|
|
|
if (fee != null)
|
|
|
|
|
{
|
|
|
|
|
var feeShou = new ChFee();
|
|
|
|
|
feeShou.GID = Guid.NewGuid().ToString().Replace("-", "");
|
|
|
|
|
feeShou.BSNO = opSeae.BSNO;
|
|
|
|
|
feeShou.FEETYPE = 1;
|
|
|
|
|
feeShou.FEENAME = FeeShouName;
|
|
|
|
|
feeShou.CUSTOMERTYPE = "其他";
|
|
|
|
|
feeShou.CUSTOMERNAME = infoClient.SHORTNAME;
|
|
|
|
|
feeShou.UNIT = fee.UNIT;
|
|
|
|
|
feeShou.UNITPRICE = fee.UNITPRICE;
|
|
|
|
|
feeShou.QUANTITY = 1;
|
|
|
|
|
feeShou.AMOUNT = fee.UNITPRICE;
|
|
|
|
|
feeShou.EXCHANGERATE = 1;
|
|
|
|
|
feeShou.CURRENCY = "RMB";
|
|
|
|
|
feeShou.ENTEROPERATOR = FeeInputUserId;
|
|
|
|
|
feeShou.ENTERDATE = DateTime.Now;
|
|
|
|
|
feeShou.MODIFIEDUSER = FeeInputUserId;
|
|
|
|
|
feeShou.MODIFIEDTIME = DateTime.Now;
|
|
|
|
|
feeShou.LOCALCURR = feeShou.CURRENCY;
|
|
|
|
|
feeShou.FEEDESCRIPTION = feeShou.FEENAME;
|
|
|
|
|
feeShou.FEESTATUS = 0;//费用插入时状态为提交审核;2021-12-8,要求插入时状态改为录入状态:1;2021-12-9,要求状态为审核通过状态:0
|
|
|
|
|
|
|
|
|
|
//2021-12-8,下列字段不能为空,写入默认值
|
|
|
|
|
feeShou.SETTLEMENT = 0;
|
|
|
|
|
feeShou.ORDERAMOUNT = 0;
|
|
|
|
|
feeShou.ORDERINVOICE = 0;
|
|
|
|
|
feeShou.ORDERINVSETTLEMENT = 0;
|
|
|
|
|
feeShou.ORDERSETTLEMENT = 0;
|
|
|
|
|
feeShou.INVOICE = 0;
|
|
|
|
|
feeShou.TAXRATE = 0;
|
|
|
|
|
feeShou.ISADVANCEDPAY = false;
|
|
|
|
|
feeShou.ISINVOICE = false;
|
|
|
|
|
feeShou.ISCRMORDERFEE = false;
|
|
|
|
|
feeShou.TAXUNITPRICE = fee.UNITPRICE;//2021-12-29,于菲:同样赋值单价和金额
|
|
|
|
|
feeShou.NOTAXAMOUNT = fee.UNITPRICE;//2021-12-29,于菲:同样赋值单价和金额
|
|
|
|
|
|
|
|
|
|
//2021-12-9,要求下列字段不能为空,填写0或false
|
|
|
|
|
feeShou.COMMISSIONRATE = 0;
|
|
|
|
|
feeShou.AUDITSTATUS = 0;
|
|
|
|
|
feeShou.LINENUM = 0;
|
|
|
|
|
feeShou.ISDEBIT = false;
|
|
|
|
|
feeShou.ISOPEN = false;
|
|
|
|
|
feeShou.ACCTAXRATE = 0;
|
|
|
|
|
feeShou.ISVOU = false;
|
|
|
|
|
feeShou.TAX = 0;
|
|
|
|
|
feeShou.PREAMOUNT = 0;
|
|
|
|
|
feeShou.ISACC = false;
|
|
|
|
|
feeShou.CUSTDUI = false;
|
|
|
|
|
|
|
|
|
|
//2021-12-23:分单号写入备注
|
|
|
|
|
if (!string.IsNullOrEmpty(HBLNO))
|
|
|
|
|
{
|
|
|
|
|
feeShou.REMARK += $" {HBLNO} ";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dS7Data.ChFee.Add(feeShou);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//应付
|
|
|
|
|
if (string.IsNullOrEmpty(HBLNO)) //主单才插入船代费用
|
|
|
|
|
{
|
|
|
|
|
var feeFu = new ChFee();
|
|
|
|
|
feeFu.GID = Guid.NewGuid().ToString().Replace("-", "");
|
|
|
|
|
feeFu.BSNO = opSeae.BSNO;
|
|
|
|
|
feeFu.FEETYPE = 2;
|
|
|
|
|
feeFu.FEENAME = FeePayName;
|
|
|
|
|
feeFu.CUSTOMERTYPE = FeePayCustomerType;
|
|
|
|
|
feeFu.CUSTOMERNAME = FeePayCustomer;
|
|
|
|
|
feeFu.UNIT = "票";
|
|
|
|
|
feeFu.UNITPRICE = FeePayPrice;
|
|
|
|
|
feeFu.QUANTITY = 1;
|
|
|
|
|
feeFu.AMOUNT = FeePayPrice;
|
|
|
|
|
feeFu.EXCHANGERATE = 1;
|
|
|
|
|
feeFu.CURRENCY = "RMB";
|
|
|
|
|
feeFu.ENTEROPERATOR = FeeInputUserId;
|
|
|
|
|
feeFu.ENTERDATE = DateTime.Now;
|
|
|
|
|
feeFu.MODIFIEDUSER = FeeInputUserId;
|
|
|
|
|
feeFu.MODIFIEDTIME = DateTime.Now;
|
|
|
|
|
feeFu.LOCALCURR = feeFu.CURRENCY;
|
|
|
|
|
feeFu.FEEDESCRIPTION = feeFu.FEENAME;
|
|
|
|
|
feeFu.FEESTATUS = 0;//费用插入时状态为提交审核;2021-12-8,要求插入时状态改为录入状态:1;2021-12-9,要求状态为审核通过状态:0
|
|
|
|
|
|
|
|
|
|
//2021-12-8,下列字段不能为空,写入默认值
|
|
|
|
|
feeFu.SETTLEMENT = 0;
|
|
|
|
|
feeFu.ORDERAMOUNT = 0;
|
|
|
|
|
feeFu.ORDERINVOICE = 0;
|
|
|
|
|
feeFu.ORDERINVSETTLEMENT = 0;
|
|
|
|
|
feeFu.ORDERSETTLEMENT = 0;
|
|
|
|
|
feeFu.INVOICE = 0;
|
|
|
|
|
feeFu.TAXRATE = 0;
|
|
|
|
|
feeFu.ISADVANCEDPAY = false;
|
|
|
|
|
feeFu.ISINVOICE = false;
|
|
|
|
|
feeFu.ISCRMORDERFEE = false;
|
|
|
|
|
feeFu.TAXUNITPRICE = 0;
|
|
|
|
|
feeFu.NOTAXAMOUNT = 0;
|
|
|
|
|
|
|
|
|
|
//2021-12-9,要求下列字段不能为空,填写0或false
|
|
|
|
|
feeFu.COMMISSIONRATE = 0;
|
|
|
|
|
feeFu.AUDITSTATUS = 0;
|
|
|
|
|
feeFu.LINENUM = 0;
|
|
|
|
|
feeFu.ISDEBIT = false;
|
|
|
|
|
feeFu.ISOPEN = false;
|
|
|
|
|
feeFu.ACCTAXRATE = 0;
|
|
|
|
|
feeFu.ISVOU = false;
|
|
|
|
|
feeFu.TAX = 0;
|
|
|
|
|
feeFu.PREAMOUNT = 0;
|
|
|
|
|
feeFu.ISACC = false;
|
|
|
|
|
feeFu.CUSTDUI = false;
|
|
|
|
|
|
|
|
|
|
dS7Data.ChFee.Add(feeFu);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//不管主单分单都要付费给大简云
|
|
|
|
|
var feeFuDJY = new ChFee();
|
|
|
|
|
feeFuDJY.GID = Guid.NewGuid().ToString().Replace("-", "");
|
|
|
|
|
feeFuDJY.BSNO = opSeae.BSNO;
|
|
|
|
|
feeFuDJY.FEETYPE = 2;
|
|
|
|
|
feeFuDJY.FEENAME = FeePayMyshippingName;
|
|
|
|
|
feeFuDJY.CUSTOMERTYPE = "其他";
|
|
|
|
|
feeFuDJY.CUSTOMERNAME = FeePayMyshippingCustomer;
|
|
|
|
|
feeFuDJY.UNIT = "票";
|
|
|
|
|
feeFuDJY.UNITPRICE = FeePayMyshippingPrice;
|
|
|
|
|
feeFuDJY.QUANTITY = 1;
|
|
|
|
|
feeFuDJY.AMOUNT = FeePayMyshippingPrice;
|
|
|
|
|
feeFuDJY.EXCHANGERATE = 1;
|
|
|
|
|
feeFuDJY.CURRENCY = "RMB";
|
|
|
|
|
feeFuDJY.ENTEROPERATOR = FeeInputUserId;
|
|
|
|
|
feeFuDJY.ENTERDATE = DateTime.Now;
|
|
|
|
|
feeFuDJY.MODIFIEDUSER = FeeInputUserId;
|
|
|
|
|
feeFuDJY.MODIFIEDTIME = DateTime.Now;
|
|
|
|
|
feeFuDJY.LOCALCURR = feeFuDJY.CURRENCY;
|
|
|
|
|
feeFuDJY.FEEDESCRIPTION = feeFuDJY.FEENAME;
|
|
|
|
|
feeFuDJY.FEESTATUS = 0;//费用插入时状态为提交审核;2021-12-8,要求插入时状态改为录入状态:1;2021-12-9,要求状态为审核通过状态:0
|
|
|
|
|
|
|
|
|
|
//2021-12-8,下列字段不能为空,写入默认值
|
|
|
|
|
feeFuDJY.SETTLEMENT = 0;
|
|
|
|
|
feeFuDJY.ORDERAMOUNT = 0;
|
|
|
|
|
feeFuDJY.ORDERINVOICE = 0;
|
|
|
|
|
feeFuDJY.ORDERINVSETTLEMENT = 0;
|
|
|
|
|
feeFuDJY.ORDERSETTLEMENT = 0;
|
|
|
|
|
feeFuDJY.INVOICE = 0;
|
|
|
|
|
feeFuDJY.TAXRATE = 0;
|
|
|
|
|
feeFuDJY.ISADVANCEDPAY = false;
|
|
|
|
|
feeFuDJY.ISINVOICE = false;
|
|
|
|
|
feeFuDJY.ISCRMORDERFEE = false;
|
|
|
|
|
feeFuDJY.TAXUNITPRICE = 0;
|
|
|
|
|
feeFuDJY.NOTAXAMOUNT = 0;
|
|
|
|
|
|
|
|
|
|
//2021-12-9,要求下列字段不能为空,填写0或false
|
|
|
|
|
feeFuDJY.COMMISSIONRATE = 0;
|
|
|
|
|
feeFuDJY.AUDITSTATUS = 0;
|
|
|
|
|
feeFuDJY.LINENUM = 0;
|
|
|
|
|
feeFuDJY.ISDEBIT = false;
|
|
|
|
|
feeFuDJY.ISOPEN = false;
|
|
|
|
|
feeFuDJY.ACCTAXRATE = 0;
|
|
|
|
|
feeFuDJY.ISVOU = false;
|
|
|
|
|
feeFuDJY.TAX = 0;
|
|
|
|
|
feeFuDJY.PREAMOUNT = 0;
|
|
|
|
|
feeFuDJY.ISACC = false;
|
|
|
|
|
feeFuDJY.CUSTDUI = false;
|
|
|
|
|
|
|
|
|
|
dS7Data.ChFee.Add(feeFuDJY);
|
|
|
|
|
|
|
|
|
|
//dS7Data.Database.Log = (x => { logger.Debug(x); });
|
|
|
|
|
dS7Data.SaveChanges();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 舱单数据解析实体类
|
|
|
|
|
|
|
|
|
@ -485,7 +224,7 @@ namespace DSWeb.Service.Output.DS7
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
public decimal? PKGS { get; set; }
|
|
|
|
|
public int? PKGS { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
@ -674,6 +413,10 @@ namespace DSWeb.Service.Output.DS7
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string CONSIGNEECOUNTRY { get; set; }
|
|
|
|
|
|
|
|
|
|
public string CONSIGNEETEL { get; set; }
|
|
|
|
|
public string NOTIFYPARTYNAME { get; set; }
|
|
|
|
|
public string NOTIFYPARTYADDR1 { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
@ -733,7 +476,7 @@ namespace DSWeb.Service.Output.DS7
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
public decimal? PKGS { get; set; }
|
|
|
|
|
public int? PKGS { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
@ -849,14 +592,7 @@ namespace DSWeb.Service.Output.DS7
|
|
|
|
|
var ETD = Convert.ToDateTime(strETD);
|
|
|
|
|
var CompId = obj.GetValue("CompId").ToString();
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
2021-12-23最新需求:
|
|
|
|
|
按主提单号(MBLNO)在客户东胜系统查询,如果查到对应主提单号,则在该票业务下写入舱单费,如果有分单,每一票分单,也要生成一条舱单费,分单的舱单费,需要在费用备注里写入分提单号。
|
|
|
|
|
如果主提单号在东胜系统搜不到,则创建一条新业务,并按委托方生成舱单费。
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
//OpSeae opSeae = dS7Data.OpSeae.AsNoTracking().FirstOrDefault(x => x.MBLNO == MBLNO && (x.HBLNO == null || x.HBLNO == ""));
|
|
|
|
|
|
|
|
|
|
//看op_other当中有没有该业务主单 如无则增加
|
|
|
|
|
var 主单mfno = "topother" + _edi.MFNO;
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(_edi.BSNO)) 主单mfno = "topother" + _edi.BSNO;
|
|
|
|
|
|
|
|
|
@ -864,17 +600,21 @@ namespace DSWeb.Service.Output.DS7
|
|
|
|
|
|
|
|
|
|
var BSNO = "";
|
|
|
|
|
var CUSTNOHEAD = "";
|
|
|
|
|
var CUSTOMERNAME = "";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var custEdi = dS7Data.CodeCustEdi.AsNoTracking().FirstOrDefault(x => x.EDINAME == "DJY_OUTPUT" && x.EDICODE == WeiTuoFaSongFang);
|
|
|
|
|
if (custEdi != null)
|
|
|
|
|
{
|
|
|
|
|
CUSTOMERNAME = custEdi.CUST;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (op_other == null || op_other.BSNO == null || op_other.BSNO == "")
|
|
|
|
|
{
|
|
|
|
|
logger.Debug($"未找到委托数据:{MBLNO}");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var CUSTOMERNAME = "";
|
|
|
|
|
var custEdi = dS7Data.CodeCustEdi.AsNoTracking().FirstOrDefault(x => x.EDINAME == "DJY_OUTPUT" && x.EDICODE == WeiTuoFaSongFang);
|
|
|
|
|
if (custEdi != null)
|
|
|
|
|
{
|
|
|
|
|
CUSTOMERNAME = custEdi.CUST;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BSNO = 主单mfno;
|
|
|
|
|
|
|
|
|
@ -912,6 +652,7 @@ namespace DSWeb.Service.Output.DS7
|
|
|
|
|
dS7Data.op_other.Add(newrec);
|
|
|
|
|
dS7Data.SaveChanges();
|
|
|
|
|
|
|
|
|
|
op_other= dS7Data.op_other.FirstOrDefault(x => x.BSNO == 主单mfno);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
@ -948,11 +689,17 @@ namespace DSWeb.Service.Output.DS7
|
|
|
|
|
SHIPPERADDR1 = _edi.SHIPPERADDR1,
|
|
|
|
|
SHIPPERCOUNTRY = _edi.SHIPPERCOUNTRY,
|
|
|
|
|
SHIPPERTEL = _edi.SHIPPERTEL,
|
|
|
|
|
|
|
|
|
|
CONSIGNEENAME = _edi.CONSIGNEENAME,
|
|
|
|
|
CONSIGNEEADDR1 = _edi.CONSIGNEEADDR1,
|
|
|
|
|
CONSIGNEECOUNTRY = _edi.CONSIGNEECOUNTRY,
|
|
|
|
|
CONSIGNEETEL = _edi.CONSIGNEETEL,
|
|
|
|
|
|
|
|
|
|
NOTIFYPARTYNAME = _edi.NOTIFYPARTYNAME,
|
|
|
|
|
NOTIFYPARTYADDR1 = _edi.NOTIFYPARTYADDR1,
|
|
|
|
|
NOTIFYPARTYCOUNTRY = _edi.NOTIFYPARTYCOUNTRY,
|
|
|
|
|
NOTIFYPARTYTEL = _edi.NOTIFYPARTYTEL,
|
|
|
|
|
|
|
|
|
|
SHIPPER = _edi.SHIPPER,
|
|
|
|
|
CONSIGNEE = _edi.CONSIGNEE,
|
|
|
|
|
NOTIFYPARTY = _edi.NOTIFYPARTY,
|
|
|
|
@ -996,12 +743,13 @@ namespace DSWeb.Service.Output.DS7
|
|
|
|
|
ctn_id = ctn.ctn_id,
|
|
|
|
|
MFNO = _edi.MFNO,
|
|
|
|
|
CTNCODE = ctn.CTNCODE,
|
|
|
|
|
CNTRNO= ctn.CNTRNO,
|
|
|
|
|
SEALNO = ctn.SEALNO,
|
|
|
|
|
SIZE = ctn.SIZE.ToString(),
|
|
|
|
|
CTN = ctn.CTN,
|
|
|
|
|
CTNNUM = ctn.CTNNUM,
|
|
|
|
|
TEU = ctn.TEU,
|
|
|
|
|
CTNALL = ctn.CTNALL,
|
|
|
|
|
SEALNO = ctn.CTNCODE,
|
|
|
|
|
PKGS = ctn.PKGS,
|
|
|
|
|
KGS = ctn.KGS,
|
|
|
|
|
CBM = ctn.CBM,
|
|
|
|
@ -1024,18 +772,18 @@ namespace DSWeb.Service.Output.DS7
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//只要有对应的往来单位=委托发送方 主分单都产生相应的应收
|
|
|
|
|
InfoClient infoClient = null;
|
|
|
|
|
if (!string.IsNullOrEmpty(op_other.CUSTOMERNAME))
|
|
|
|
|
if (!string.IsNullOrEmpty(CUSTOMERNAME))
|
|
|
|
|
{
|
|
|
|
|
infoClient = dS7Data.InfoClient.AsNoTracking().FirstOrDefault(x => x.SHORTNAME == op_other.CUSTOMERNAME);
|
|
|
|
|
infoClient = dS7Data.InfoClient.AsNoTracking().FirstOrDefault(x => x.SHORTNAME == CUSTOMERNAME);
|
|
|
|
|
if (infoClient != null)
|
|
|
|
|
{
|
|
|
|
|
op_other.SALE = infoClient.SALE; //揽货人赋值
|
|
|
|
|
|
|
|
|
|
//查询配置,生成应收
|
|
|
|
|
var fee = dS7Data.CustFeeTemplateDetail.AsNoTracking().FirstOrDefault(x => x.CUSTOMERNAME == infoClient.SHORTNAME && x.FEENAME == FeeShouName);
|
|
|
|
|
if (fee != null)
|
|
|
|
|
if (fee != null )
|
|
|
|
|
{
|
|
|
|
|
var feeShou = new ChFee();
|
|
|
|
|
feeShou.GID = Guid.NewGuid().ToString().Replace("-", "");
|
|
|
|
@ -1085,11 +833,13 @@ namespace DSWeb.Service.Output.DS7
|
|
|
|
|
feeShou.ISACC = false;
|
|
|
|
|
feeShou.CUSTDUI = false;
|
|
|
|
|
|
|
|
|
|
feeShou.BXGID = HBLNO;
|
|
|
|
|
|
|
|
|
|
//2021-12-23:分单号写入备注
|
|
|
|
|
if (!string.IsNullOrEmpty(HBLNO))
|
|
|
|
|
{
|
|
|
|
|
feeShou.REMARK += $" {HBLNO} ";
|
|
|
|
|
}
|
|
|
|
|
//if (!string.IsNullOrEmpty(HBLNO))
|
|
|
|
|
//{
|
|
|
|
|
// feeShou.REMARK += $" {HBLNO} ";
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
dS7Data.ChFee.Add(feeShou);
|
|
|
|
|
}
|
|
|
|
@ -1098,7 +848,7 @@ namespace DSWeb.Service.Output.DS7
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//应付
|
|
|
|
|
if (string.IsNullOrEmpty(HBLNO)) //主单才插入船代费用
|
|
|
|
|
if (string.IsNullOrEmpty(HBLNO) && FeePayPrice>0) //主单才插入船代费用
|
|
|
|
|
{
|
|
|
|
|
var feeFu = new ChFee();
|
|
|
|
|
feeFu.GID = Guid.NewGuid().ToString().Replace("-", "");
|
|
|
|
@ -1148,441 +898,77 @@ namespace DSWeb.Service.Output.DS7
|
|
|
|
|
feeFu.ISACC = false;
|
|
|
|
|
feeFu.CUSTDUI = false;
|
|
|
|
|
|
|
|
|
|
dS7Data.ChFee.Add(feeFu);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//不管主单分单都要付费给大简云
|
|
|
|
|
var feeFuDJY = new ChFee();
|
|
|
|
|
feeFuDJY.GID = Guid.NewGuid().ToString().Replace("-", "");
|
|
|
|
|
feeFuDJY.BSNO = op_other.BSNO;
|
|
|
|
|
feeFuDJY.FEETYPE = 2;
|
|
|
|
|
feeFuDJY.FEENAME = FeePayMyshippingName;
|
|
|
|
|
feeFuDJY.CUSTOMERTYPE = "其他";
|
|
|
|
|
feeFuDJY.CUSTOMERNAME = FeePayMyshippingCustomer;
|
|
|
|
|
feeFuDJY.UNIT = "票";
|
|
|
|
|
feeFuDJY.UNITPRICE = FeePayMyshippingPrice;
|
|
|
|
|
feeFuDJY.QUANTITY = 1;
|
|
|
|
|
feeFuDJY.AMOUNT = FeePayMyshippingPrice;
|
|
|
|
|
feeFuDJY.EXCHANGERATE = 1;
|
|
|
|
|
feeFuDJY.CURRENCY = "RMB";
|
|
|
|
|
feeFuDJY.ENTEROPERATOR = FeeInputUserId;
|
|
|
|
|
feeFuDJY.ENTERDATE = DateTime.Now;
|
|
|
|
|
feeFuDJY.MODIFIEDUSER = FeeInputUserId;
|
|
|
|
|
feeFuDJY.MODIFIEDTIME = DateTime.Now;
|
|
|
|
|
feeFuDJY.LOCALCURR = feeFuDJY.CURRENCY;
|
|
|
|
|
feeFuDJY.FEEDESCRIPTION = feeFuDJY.FEENAME;
|
|
|
|
|
feeFuDJY.FEESTATUS = 0;//费用插入时状态为提交审核;2021-12-8,要求插入时状态改为录入状态:1;2021-12-9,要求状态为审核通过状态:0
|
|
|
|
|
|
|
|
|
|
//2021-12-8,下列字段不能为空,写入默认值
|
|
|
|
|
feeFuDJY.SETTLEMENT = 0;
|
|
|
|
|
feeFuDJY.ORDERAMOUNT = 0;
|
|
|
|
|
feeFuDJY.ORDERINVOICE = 0;
|
|
|
|
|
feeFuDJY.ORDERINVSETTLEMENT = 0;
|
|
|
|
|
feeFuDJY.ORDERSETTLEMENT = 0;
|
|
|
|
|
feeFuDJY.INVOICE = 0;
|
|
|
|
|
feeFuDJY.TAXRATE = 0;
|
|
|
|
|
feeFuDJY.ISADVANCEDPAY = false;
|
|
|
|
|
feeFuDJY.ISINVOICE = false;
|
|
|
|
|
feeFuDJY.ISCRMORDERFEE = false;
|
|
|
|
|
feeFuDJY.TAXUNITPRICE = 0;
|
|
|
|
|
feeFuDJY.NOTAXAMOUNT = 0;
|
|
|
|
|
|
|
|
|
|
//2021-12-9,要求下列字段不能为空,填写0或false
|
|
|
|
|
feeFuDJY.COMMISSIONRATE = 0;
|
|
|
|
|
feeFuDJY.AUDITSTATUS = 0;
|
|
|
|
|
feeFuDJY.LINENUM = 0;
|
|
|
|
|
feeFuDJY.ISDEBIT = false;
|
|
|
|
|
feeFuDJY.ISOPEN = false;
|
|
|
|
|
feeFuDJY.ACCTAXRATE = 0;
|
|
|
|
|
feeFuDJY.ISVOU = false;
|
|
|
|
|
feeFuDJY.TAX = 0;
|
|
|
|
|
feeFuDJY.PREAMOUNT = 0;
|
|
|
|
|
feeFuDJY.ISACC = false;
|
|
|
|
|
feeFuDJY.CUSTDUI = false;
|
|
|
|
|
|
|
|
|
|
dS7Data.ChFee.Add(feeFuDJY);
|
|
|
|
|
|
|
|
|
|
//dS7Data.Database.Log = (x => { logger.Debug(x); });
|
|
|
|
|
dS7Data.SaveChanges();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e) {
|
|
|
|
|
logger.Error($"导入舱单出错:{e}");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
feeFu.BXGID = HBLNO;
|
|
|
|
|
|
|
|
|
|
//报关数据生成到东胜7(委托模块)
|
|
|
|
|
public void BaoguanDataToDS7(JArray jarr)
|
|
|
|
|
{
|
|
|
|
|
var opUser = dS7Data.User.AsNoTracking().First(u => u.GID == FeeInputUserId);
|
|
|
|
|
foreach (var item in jarr)
|
|
|
|
|
{
|
|
|
|
|
var obj = item as JObject;
|
|
|
|
|
|
|
|
|
|
var shipOrderNo = obj.GetValue("ShipOrderNo").ToString();
|
|
|
|
|
var shipOrderNoMain = obj.GetValue("ShipOrderNoMain").ToString();
|
|
|
|
|
var ClientName = obj.GetValue("ClientName")?.ToString();
|
|
|
|
|
var ETD = DateTime.Today;
|
|
|
|
|
var CompId = obj.GetValue("CompId").ToString();
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
2021-12-23修改需求:
|
|
|
|
|
按主提单号在东胜系统查询,如果查到对应主提单号,则在该票业务下插入报关费,有几票报关单,插入几条报关费,并在费用备注里写入分提单号。
|
|
|
|
|
如果主提单号在东胜系统搜不到,则创建一条新业务,并按委托方生成报关费。
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
//区分主单、分单号
|
|
|
|
|
var orderMain = string.Empty;
|
|
|
|
|
var orderSub = string.Empty;
|
|
|
|
|
if (string.IsNullOrEmpty(shipOrderNoMain))
|
|
|
|
|
{
|
|
|
|
|
orderMain = shipOrderNo;
|
|
|
|
|
}
|
|
|
|
|
else if (shipOrderNoMain == shipOrderNo)
|
|
|
|
|
{
|
|
|
|
|
orderMain = shipOrderNo;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
orderMain = shipOrderNoMain;
|
|
|
|
|
orderSub = shipOrderNo;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
OpSeae opSeae = dS7Data.OpSeae.AsNoTracking().FirstOrDefault(x => x.MBLNO == orderMain && (x.HBLNO == null || x.HBLNO == ""));
|
|
|
|
|
|
|
|
|
|
if (opSeae == null)
|
|
|
|
|
{
|
|
|
|
|
logger.Debug($"未找到委托数据:{orderMain}");
|
|
|
|
|
|
|
|
|
|
opSeae = new OpSeae();
|
|
|
|
|
dS7Data.OpSeae.Add(opSeae);
|
|
|
|
|
opSeae.BSNO = Guid.NewGuid().ToString().Replace("-", "");
|
|
|
|
|
opSeae.MASTERNO = opSeae.BSNO;
|
|
|
|
|
opSeae.MBLNO = orderMain;
|
|
|
|
|
opSeae.OP = opUser.SHOWNAME;
|
|
|
|
|
opSeae.INPUTBY = opUser.SHOWNAME;
|
|
|
|
|
opSeae.CORPID = Corpid;
|
|
|
|
|
opSeae.ETD = ETD;
|
|
|
|
|
opSeae.CREATETIME = DateTime.Now;
|
|
|
|
|
opSeae.ISCANCEL = "0";
|
|
|
|
|
|
|
|
|
|
opSeae.BSDATE = DateTime.Today;
|
|
|
|
|
opSeae.BSSTATUS = false;
|
|
|
|
|
opSeae.FEESTATUS = false;
|
|
|
|
|
opSeae.ACCDATE = ETD.ToString("yyyy-MM");
|
|
|
|
|
opSeae.BLTYPE = "整箱";
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(ClientName))
|
|
|
|
|
{
|
|
|
|
|
var custEdi = dS7Data.CodeCustEdi.AsNoTracking().FirstOrDefault(x => x.EDINAME == "DJY_OUTPUT" && x.EDICODE == ClientName);
|
|
|
|
|
if (custEdi != null)
|
|
|
|
|
{
|
|
|
|
|
opSeae.CUSTOMERNAME = custEdi.CUST;
|
|
|
|
|
}
|
|
|
|
|
dS7Data.ChFee.Add(feeFu);
|
|
|
|
|
dS7Data.SaveChanges();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//生成编号
|
|
|
|
|
var billnoset = dS7Data.SysBillNoSet.AsNoTracking().FirstOrDefault(x => x.COMPANYID == Corpid && x.OPLBNAME == "海运出口" && x.RULEBLNO == "委托编号");
|
|
|
|
|
if (billnoset != null)
|
|
|
|
|
{
|
|
|
|
|
opSeae.CUSTNO = GetBillNo(billnoset, opSeae.ETD.ToString(), opSeae.ACCDATE, opname: opUser.SHOWNAME, corpid: Corpid);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
logger.Debug($"SysBillNoSet数据未找到,无法生成编号:{orderMain}");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
logger.Debug($"委托数据已存在:{orderMain}");
|
|
|
|
|
}
|
|
|
|
|
if (FeePayMyshippingPrice > 0) {
|
|
|
|
|
//不管主单分单都要付费给大简云
|
|
|
|
|
var feeFuDJY = new ChFee();
|
|
|
|
|
feeFuDJY.GID = Guid.NewGuid().ToString().Replace("-", "");
|
|
|
|
|
feeFuDJY.BSNO = op_other.BSNO;
|
|
|
|
|
feeFuDJY.FEETYPE = 2;
|
|
|
|
|
feeFuDJY.FEENAME = FeePayMyshippingName;
|
|
|
|
|
feeFuDJY.CUSTOMERTYPE = "其他";
|
|
|
|
|
feeFuDJY.CUSTOMERNAME = FeePayMyshippingCustomer;
|
|
|
|
|
feeFuDJY.UNIT = "票";
|
|
|
|
|
feeFuDJY.UNITPRICE = FeePayMyshippingPrice;
|
|
|
|
|
feeFuDJY.QUANTITY = 1;
|
|
|
|
|
feeFuDJY.AMOUNT = FeePayMyshippingPrice;
|
|
|
|
|
feeFuDJY.EXCHANGERATE = 1;
|
|
|
|
|
feeFuDJY.CURRENCY = "RMB";
|
|
|
|
|
feeFuDJY.ENTEROPERATOR = FeeInputUserId;
|
|
|
|
|
feeFuDJY.ENTERDATE = DateTime.Now;
|
|
|
|
|
feeFuDJY.MODIFIEDUSER = FeeInputUserId;
|
|
|
|
|
feeFuDJY.MODIFIEDTIME = DateTime.Now;
|
|
|
|
|
feeFuDJY.LOCALCURR = feeFuDJY.CURRENCY;
|
|
|
|
|
feeFuDJY.FEEDESCRIPTION = feeFuDJY.FEENAME;
|
|
|
|
|
feeFuDJY.FEESTATUS = 0;//费用插入时状态为提交审核;2021-12-8,要求插入时状态改为录入状态:1;2021-12-9,要求状态为审核通过状态:0
|
|
|
|
|
|
|
|
|
|
InfoClient infoClient = null;
|
|
|
|
|
if (!string.IsNullOrEmpty(opSeae.CUSTOMERNAME))
|
|
|
|
|
{
|
|
|
|
|
infoClient = dS7Data.InfoClient.AsNoTracking().FirstOrDefault(x => x.SHORTNAME == opSeae.CUSTOMERNAME);
|
|
|
|
|
if (infoClient != null)
|
|
|
|
|
{
|
|
|
|
|
opSeae.SALE = infoClient.SALE; //揽货人赋值
|
|
|
|
|
|
|
|
|
|
//查询配置,生成应收
|
|
|
|
|
var fee = dS7Data.CustFeeTemplateDetail.AsNoTracking().FirstOrDefault(x => x.CUSTOMERNAME == infoClient.SHORTNAME && x.FEENAME == "报关费");
|
|
|
|
|
if (fee != null)
|
|
|
|
|
{
|
|
|
|
|
var feeShou = new ChFee();
|
|
|
|
|
feeShou.GID = Guid.NewGuid().ToString().Replace("-", "");
|
|
|
|
|
feeShou.BSNO = opSeae.BSNO;
|
|
|
|
|
feeShou.FEETYPE = 1;
|
|
|
|
|
feeShou.FEENAME = "报关费";
|
|
|
|
|
feeShou.CUSTOMERTYPE = "其他";
|
|
|
|
|
feeShou.CUSTOMERNAME = infoClient.SHORTNAME;
|
|
|
|
|
feeShou.UNIT = fee.UNIT;
|
|
|
|
|
feeShou.UNITPRICE = fee.UNITPRICE;
|
|
|
|
|
feeShou.QUANTITY = 1;
|
|
|
|
|
feeShou.AMOUNT = fee.UNITPRICE;
|
|
|
|
|
feeShou.EXCHANGERATE = 1;
|
|
|
|
|
feeShou.CURRENCY = "RMB";
|
|
|
|
|
feeShou.ENTEROPERATOR = FeeInputUserId;
|
|
|
|
|
feeShou.ENTERDATE = DateTime.Now;
|
|
|
|
|
feeShou.MODIFIEDUSER = FeeInputUserId;
|
|
|
|
|
feeShou.MODIFIEDTIME = DateTime.Now;
|
|
|
|
|
feeShou.LOCALCURR = feeShou.CURRENCY;
|
|
|
|
|
feeShou.FEEDESCRIPTION = feeShou.FEENAME;
|
|
|
|
|
feeShou.FEESTATUS = 0;//费用插入时状态为提交审核;2021-12-31,要求状态为审核通过状态:0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//2021-12-31,要求下列字段不能为空,填写0或false
|
|
|
|
|
feeShou.COMMISSIONRATE = 0;
|
|
|
|
|
feeShou.AUDITSTATUS = 0;
|
|
|
|
|
feeShou.LINENUM = 0;
|
|
|
|
|
feeShou.ISDEBIT = false;
|
|
|
|
|
feeShou.ISOPEN = false;
|
|
|
|
|
feeShou.ACCTAXRATE = 0;
|
|
|
|
|
feeShou.ISVOU = false;
|
|
|
|
|
feeShou.TAX = 0;
|
|
|
|
|
feeShou.PREAMOUNT = 0;
|
|
|
|
|
feeShou.ISACC = false;
|
|
|
|
|
feeShou.CUSTDUI = false;
|
|
|
|
|
|
|
|
|
|
feeShou.SETTLEMENT = 0;
|
|
|
|
|
feeShou.ORDERAMOUNT = 0;
|
|
|
|
|
feeShou.ORDERINVOICE = 0;
|
|
|
|
|
feeShou.ORDERINVSETTLEMENT = 0;
|
|
|
|
|
feeShou.ORDERSETTLEMENT = 0;
|
|
|
|
|
feeShou.INVOICE = 0;
|
|
|
|
|
feeShou.TAXRATE = 0;
|
|
|
|
|
feeShou.ISADVANCEDPAY = false;
|
|
|
|
|
feeShou.ISINVOICE = false;
|
|
|
|
|
feeShou.ISCRMORDERFEE = false;
|
|
|
|
|
feeShou.TAXUNITPRICE = fee.UNITPRICE;//2021-12-29,于菲:同样赋值单价和金额
|
|
|
|
|
feeShou.NOTAXAMOUNT = fee.UNITPRICE;//2021-12-29,于菲:同样赋值单价和金额
|
|
|
|
|
|
|
|
|
|
//将分单号写入备注
|
|
|
|
|
if (!string.IsNullOrEmpty(orderSub))
|
|
|
|
|
{
|
|
|
|
|
feeShou.REMARK += $" {orderSub} ";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dS7Data.ChFee.Add(feeShou);
|
|
|
|
|
}
|
|
|
|
|
//2021-12-8,下列字段不能为空,写入默认值
|
|
|
|
|
feeFuDJY.SETTLEMENT = 0;
|
|
|
|
|
feeFuDJY.ORDERAMOUNT = 0;
|
|
|
|
|
feeFuDJY.ORDERINVOICE = 0;
|
|
|
|
|
feeFuDJY.ORDERINVSETTLEMENT = 0;
|
|
|
|
|
feeFuDJY.ORDERSETTLEMENT = 0;
|
|
|
|
|
feeFuDJY.INVOICE = 0;
|
|
|
|
|
feeFuDJY.TAXRATE = 0;
|
|
|
|
|
feeFuDJY.ISADVANCEDPAY = false;
|
|
|
|
|
feeFuDJY.ISINVOICE = false;
|
|
|
|
|
feeFuDJY.ISCRMORDERFEE = false;
|
|
|
|
|
feeFuDJY.TAXUNITPRICE = 0;
|
|
|
|
|
feeFuDJY.NOTAXAMOUNT = 0;
|
|
|
|
|
|
|
|
|
|
//2021-12-9,要求下列字段不能为空,填写0或false
|
|
|
|
|
feeFuDJY.COMMISSIONRATE = 0;
|
|
|
|
|
feeFuDJY.AUDITSTATUS = 0;
|
|
|
|
|
feeFuDJY.LINENUM = 0;
|
|
|
|
|
feeFuDJY.ISDEBIT = false;
|
|
|
|
|
feeFuDJY.ISOPEN = false;
|
|
|
|
|
feeFuDJY.ACCTAXRATE = 0;
|
|
|
|
|
feeFuDJY.ISVOU = false;
|
|
|
|
|
feeFuDJY.TAX = 0;
|
|
|
|
|
feeFuDJY.PREAMOUNT = 0;
|
|
|
|
|
feeFuDJY.ISACC = false;
|
|
|
|
|
feeFuDJY.CUSTDUI = false;
|
|
|
|
|
|
|
|
|
|
feeFuDJY.BXGID = HBLNO;
|
|
|
|
|
|
|
|
|
|
dS7Data.ChFee.Add(feeFuDJY);
|
|
|
|
|
|
|
|
|
|
//dS7Data.Database.Log = (x => { logger.Debug(x); });
|
|
|
|
|
dS7Data.SaveChanges();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//dS7Data.Database.Log = (x => { logger.Debug(x); });
|
|
|
|
|
dS7Data.SaveChanges();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//报关数据生成到东胜7(报关模块)
|
|
|
|
|
public void BgDataToDS7(JArray jarr)
|
|
|
|
|
{
|
|
|
|
|
var opUser = dS7Data.User.AsNoTracking().First(u => u.GID == FeeInputUserId);
|
|
|
|
|
foreach (var item in jarr)
|
|
|
|
|
{
|
|
|
|
|
var obj = item as JObject;
|
|
|
|
|
|
|
|
|
|
var customsNo = obj.GetStringValue("CustomsNo");
|
|
|
|
|
var shipOrderNo = obj.GetStringValue("ShipOrderNo");
|
|
|
|
|
var shipOrderNoMain = obj.GetStringValue("ShipOrderNoMain");
|
|
|
|
|
var ClientName = obj.GetStringValue("ClientName");
|
|
|
|
|
var ETD = DateTime.Today;
|
|
|
|
|
var CompId = obj.GetStringValue("CompId");
|
|
|
|
|
var trafName = obj.GetStringValue("TrafName");
|
|
|
|
|
|
|
|
|
|
var VoyNo = obj.GetStringValue("VoyNo");
|
|
|
|
|
var DistinatePort = obj.GetStringValue("DistinatePort");
|
|
|
|
|
var SignDate = obj.GetStringValue("SignDate");
|
|
|
|
|
var TradeCountry = obj.GetStringValue("TradeCountry");
|
|
|
|
|
var TradeName = obj.GetStringValue("TradeName");
|
|
|
|
|
var PackNo = obj.GetIntValue("PackNo");
|
|
|
|
|
var GrossWet = obj.GetDecimalValue("GrossWet");
|
|
|
|
|
var NetWt = obj.GetDecimalValue("NetWt");
|
|
|
|
|
var ContrNo = obj.GetStringValue("ContrNo");
|
|
|
|
|
var SeqNo = obj.GetStringValue("SeqNo");
|
|
|
|
|
var TrafMode = obj.GetStringValue("TrafMode");
|
|
|
|
|
|
|
|
|
|
//区分主单、分单号
|
|
|
|
|
var orderMain = string.Empty;
|
|
|
|
|
var orderSub = string.Empty;
|
|
|
|
|
if (string.IsNullOrEmpty(shipOrderNoMain))
|
|
|
|
|
{
|
|
|
|
|
orderMain = shipOrderNo;
|
|
|
|
|
}
|
|
|
|
|
else if (shipOrderNoMain == shipOrderNo)
|
|
|
|
|
{
|
|
|
|
|
orderMain = shipOrderNo;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
orderMain = shipOrderNoMain;
|
|
|
|
|
orderSub = shipOrderNo;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
OpApply opApply = dS7Data.OpApply.AsNoTracking().FirstOrDefault(x => x.MBLNO == orderMain && (x.HBLNO == null || x.HBLNO == ""));
|
|
|
|
|
|
|
|
|
|
if (opApply == null)
|
|
|
|
|
{
|
|
|
|
|
logger.Debug($"未找到报关数据:{orderMain}");
|
|
|
|
|
|
|
|
|
|
opApply = new OpApply();
|
|
|
|
|
dS7Data.OpApply.Add(opApply);
|
|
|
|
|
opApply.BSNO = Guid.NewGuid().ToString().Replace("-", "");
|
|
|
|
|
opApply.MASTERNO = opApply.BSNO;
|
|
|
|
|
opApply.MBLNO = orderMain;
|
|
|
|
|
opApply.OP = opUser.SHOWNAME;
|
|
|
|
|
opApply.INPUTBY = opUser.SHOWNAME;
|
|
|
|
|
opApply.CORPID = Corpid;
|
|
|
|
|
opApply.ETD = ETD.ToString("yyyy-MM-dd");
|
|
|
|
|
opApply.CUSTOMNO = customsNo;
|
|
|
|
|
opApply.VESSEL = trafName;
|
|
|
|
|
|
|
|
|
|
opApply.BSDATE = DateTime.Today;
|
|
|
|
|
opApply.BSSTATUS = false;
|
|
|
|
|
opApply.FEESTATUS = false;
|
|
|
|
|
opApply.ACCDATE = ETD.ToString("yyyy-MM");
|
|
|
|
|
|
|
|
|
|
opApply.VOYNO = VoyNo;
|
|
|
|
|
opApply.PORTDISCHARGE = DistinatePort;
|
|
|
|
|
opApply.CUSTOMDATE = $"{SignDate.Substring(0, 4)}-{SignDate.Substring(4, 2)}-{SignDate.Substring(6, 2)}";
|
|
|
|
|
opApply.ARCOUNTRY = TradeCountry;
|
|
|
|
|
opApply.ENTERP = TradeName;
|
|
|
|
|
opApply.PKGS = PackNo;
|
|
|
|
|
opApply.KGS = GrossWet;
|
|
|
|
|
opApply.NETWEIGHT = NetWt;
|
|
|
|
|
opApply.CONTRACTNO = ContrNo;
|
|
|
|
|
opApply.CUSCIQNO = SeqNo;
|
|
|
|
|
opApply.BSTYPE = TrafMode;
|
|
|
|
|
opApply.OPDATE = DateTime.Now.ToString("yyyy-MM-dd");
|
|
|
|
|
|
|
|
|
|
opApply.CBM = 0;
|
|
|
|
|
opApply.IsService1 = string.Empty;
|
|
|
|
|
opApply.IsService2 = string.Empty;
|
|
|
|
|
opApply.IsService3 = string.Empty;
|
|
|
|
|
opApply.IsService4 = string.Empty;
|
|
|
|
|
opApply.IsService5 = string.Empty;
|
|
|
|
|
opApply.IsService6 = string.Empty;
|
|
|
|
|
opApply.IsService7 = string.Empty;
|
|
|
|
|
opApply.IsService8 = string.Empty;
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(ClientName))
|
|
|
|
|
{
|
|
|
|
|
var custEdi = dS7Data.CodeCustEdi.AsNoTracking().FirstOrDefault(x => x.EDINAME == "DJY_OUTPUT" && x.EDICODE == ClientName);
|
|
|
|
|
if (custEdi != null)
|
|
|
|
|
{
|
|
|
|
|
opApply.CUSTOMERNAME = custEdi.CUST;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//生成编号
|
|
|
|
|
var billnoset = dS7Data.SysBillNoSet.AsNoTracking().FirstOrDefault(x => x.COMPANYID == Corpid && x.OPLBNAME == "报关业务" && x.RULEBLNO == "委托编号");
|
|
|
|
|
if (billnoset != null)
|
|
|
|
|
{
|
|
|
|
|
opApply.CUSTNO = GetBillNo(billnoset, opApply.ETD.ToString(), opApply.ACCDATE, opname: opUser.SHOWNAME, corpid: Corpid);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
logger.Debug($"SysBillNoSet数据未找到,无法生成编号:{orderMain}");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
logger.Debug($"报关数据已存在:{orderMain}");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
InfoClient infoClient = null;
|
|
|
|
|
if (!string.IsNullOrEmpty(opApply.CUSTOMERNAME))
|
|
|
|
|
{
|
|
|
|
|
infoClient = dS7Data.InfoClient.AsNoTracking().FirstOrDefault(x => x.SHORTNAME == opApply.CUSTOMERNAME);
|
|
|
|
|
if (infoClient != null)
|
|
|
|
|
{
|
|
|
|
|
opApply.SALE = infoClient.SALE; //揽货人赋值
|
|
|
|
|
|
|
|
|
|
//查询配置,生成应收
|
|
|
|
|
var fee = dS7Data.CustFeeTemplateDetail.AsNoTracking().FirstOrDefault(x => x.CUSTOMERNAME == infoClient.SHORTNAME && x.FEENAME == "报关费");
|
|
|
|
|
if (fee != null)
|
|
|
|
|
{
|
|
|
|
|
var feeShou = new ChFee();
|
|
|
|
|
feeShou.GID = Guid.NewGuid().ToString().Replace("-", "");
|
|
|
|
|
feeShou.BSNO = opApply.BSNO;
|
|
|
|
|
feeShou.FEETYPE = 1;
|
|
|
|
|
feeShou.FEENAME = "报关费";
|
|
|
|
|
feeShou.CUSTOMERTYPE = "其他";
|
|
|
|
|
feeShou.CUSTOMERNAME = infoClient.SHORTNAME;
|
|
|
|
|
feeShou.UNIT = fee.UNIT;
|
|
|
|
|
feeShou.UNITPRICE = fee.UNITPRICE;
|
|
|
|
|
feeShou.QUANTITY = 1;
|
|
|
|
|
feeShou.AMOUNT = fee.UNITPRICE;
|
|
|
|
|
feeShou.EXCHANGERATE = 1;
|
|
|
|
|
feeShou.CURRENCY = "RMB";
|
|
|
|
|
feeShou.ENTEROPERATOR = FeeInputUserId;
|
|
|
|
|
feeShou.ENTERDATE = DateTime.Now;
|
|
|
|
|
feeShou.MODIFIEDUSER = FeeInputUserId;
|
|
|
|
|
feeShou.MODIFIEDTIME = DateTime.Now;
|
|
|
|
|
feeShou.LOCALCURR = feeShou.CURRENCY;
|
|
|
|
|
feeShou.FEEDESCRIPTION = feeShou.FEENAME;
|
|
|
|
|
feeShou.FEESTATUS = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//下列字段不能为空,填写0或false
|
|
|
|
|
feeShou.COMMISSIONRATE = 0;
|
|
|
|
|
feeShou.AUDITSTATUS = 0;
|
|
|
|
|
feeShou.LINENUM = 0;
|
|
|
|
|
feeShou.ISDEBIT = false;
|
|
|
|
|
feeShou.ISOPEN = false;
|
|
|
|
|
feeShou.ACCTAXRATE = 0;
|
|
|
|
|
feeShou.ISVOU = false;
|
|
|
|
|
feeShou.TAX = 0;
|
|
|
|
|
feeShou.PREAMOUNT = 0;
|
|
|
|
|
feeShou.ISACC = false;
|
|
|
|
|
feeShou.CUSTDUI = false;
|
|
|
|
|
|
|
|
|
|
feeShou.SETTLEMENT = 0;
|
|
|
|
|
feeShou.ORDERAMOUNT = 0;
|
|
|
|
|
feeShou.ORDERINVOICE = 0;
|
|
|
|
|
feeShou.ORDERINVSETTLEMENT = 0;
|
|
|
|
|
feeShou.ORDERSETTLEMENT = 0;
|
|
|
|
|
feeShou.INVOICE = 0;
|
|
|
|
|
feeShou.TAXRATE = 0;
|
|
|
|
|
feeShou.ISADVANCEDPAY = false;
|
|
|
|
|
feeShou.ISINVOICE = false;
|
|
|
|
|
feeShou.ISCRMORDERFEE = false;
|
|
|
|
|
feeShou.TAXUNITPRICE = fee.UNITPRICE;//赋值单价和金额
|
|
|
|
|
feeShou.NOTAXAMOUNT = fee.UNITPRICE;//赋值单价和金额
|
|
|
|
|
|
|
|
|
|
//将分单号写入备注
|
|
|
|
|
if (!string.IsNullOrEmpty(orderSub))
|
|
|
|
|
{
|
|
|
|
|
feeShou.REMARK += $" {orderSub} ";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dS7Data.ChFee.Add(feeShou);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//dS7Data.Database.Log = (x => { logger.Debug(x); });
|
|
|
|
|
|
|
|
|
|
var errs = dS7Data.GetValidationErrors().ToList();
|
|
|
|
|
if (errs.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
foreach (var err in errs)
|
|
|
|
|
{
|
|
|
|
|
foreach (var ee in err.ValidationErrors)
|
|
|
|
|
{
|
|
|
|
|
logger.Error($"验证失败:{ee.PropertyName} {ee.ErrorMessage}");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
dS7Data.SaveChanges();
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e) {
|
|
|
|
|
logger.Error($"导入舱单出错:{e}");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 生成编号(从东胜7移植并修改)
|
|
|
|
|
/// </summary>
|
|
|
|
|