|
|
|
@ -965,6 +965,61 @@ namespace Myshipping.Application
|
|
|
|
|
return bkOrder.Id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 接收到订舱需求审核后推送东胜
|
|
|
|
|
_ = Task.Run(() =>
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
var body = new
|
|
|
|
|
{
|
|
|
|
|
Type = recModel.Accept ? "CustOrderStatusAccept" : "CustOrderStatusReject",
|
|
|
|
|
Data = new
|
|
|
|
|
{
|
|
|
|
|
model.BSNO,
|
|
|
|
|
BSSTATUS = recModel.Accept ? "已审核" : "已驳回",
|
|
|
|
|
BookingOrderId = recModel.Accept ? (long?)model.BookingId : null,
|
|
|
|
|
COMMENT = recModel.Accept ? null: recModel.Comment
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
var json = body.ToJsonString();
|
|
|
|
|
|
|
|
|
|
var mqUrl = _cache.GetAllSysConfig().Result.FirstOrDefault(x => x.Code == "AuditBookingMqUrl")?.Value ?? throw new Exception("需配置接收订舱需求审核后推送东胜MQ连接串:[AuditBookingMqUrl]");
|
|
|
|
|
|
|
|
|
|
const string MqActionExchangeName = "amq.direct";
|
|
|
|
|
const string MqActionQueueName = "auditbooking.output.ds";
|
|
|
|
|
|
|
|
|
|
ConnectionFactory factory = new ConnectionFactory();
|
|
|
|
|
factory.Uri = new Uri(mqUrl);
|
|
|
|
|
|
|
|
|
|
using (IConnection conn = factory.CreateConnection())
|
|
|
|
|
using (IModel mqModel = conn.CreateModel())
|
|
|
|
|
{
|
|
|
|
|
mqModel.ExchangeDeclare(MqActionExchangeName, ExchangeType.Direct, true);
|
|
|
|
|
|
|
|
|
|
var queueName = $"{MqActionQueueName}.{model.TenantId}";
|
|
|
|
|
mqModel.QueueDeclare(queueName, false, false, false, null);
|
|
|
|
|
|
|
|
|
|
mqModel.QueueBind(queueName, MqActionExchangeName, queueName, null);
|
|
|
|
|
|
|
|
|
|
IBasicProperties props = mqModel.CreateBasicProperties();
|
|
|
|
|
props.DeliveryMode = 2;
|
|
|
|
|
|
|
|
|
|
byte[] messageBodyBytes = Encoding.UTF8.GetBytes(SharpZipLib.Compress(json));
|
|
|
|
|
|
|
|
|
|
mqModel.BasicPublish(MqActionExchangeName, queueName, props, messageBodyBytes);
|
|
|
|
|
|
|
|
|
|
conn.Close();
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation($"接收到订舱需求审核后推送东胜,已发送数据到消息队列【{mqUrl}】,数据内容:【{json}】");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
_logger.LogError(ex, "接收到订舱需求审核后推送东胜时发生异常");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
@ -1448,60 +1503,6 @@ namespace Myshipping.Application
|
|
|
|
|
SaveAuditLog($"{(accept ? "审核通过" : "审核驳回")},审核意见:{comment}", id);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 订舱需求审核后推送东胜
|
|
|
|
|
_ = Task.Run(() =>
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
var body = new
|
|
|
|
|
{
|
|
|
|
|
Type = accept ? "CustOrderStatusAccept" : "CustOrderStatusReject",
|
|
|
|
|
Data = new
|
|
|
|
|
{
|
|
|
|
|
model.BSNO,
|
|
|
|
|
BSSTATUS = accept ? "已审核" : "已驳回",
|
|
|
|
|
BookingOrderId = accept ? jobjRtn.GetLongValue("data") as long? : null
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
var json = body.ToJsonString();
|
|
|
|
|
|
|
|
|
|
var mqUrl = _cache.GetAllSysConfig().Result.FirstOrDefault(x => x.Code == "AuditBookingMqUrl")?.Value ?? throw new Exception("需配置订舱需求审核后推送东胜MQ连接串:[AuditBookingMqUrl]");
|
|
|
|
|
|
|
|
|
|
const string MqActionExchangeName = "amq.direct";
|
|
|
|
|
const string MqActionQueueName = "auditbooking.output.ds";
|
|
|
|
|
|
|
|
|
|
ConnectionFactory factory = new ConnectionFactory();
|
|
|
|
|
factory.Uri = new Uri(mqUrl);
|
|
|
|
|
|
|
|
|
|
using (IConnection conn = factory.CreateConnection())
|
|
|
|
|
using (IModel mqModel = conn.CreateModel())
|
|
|
|
|
{
|
|
|
|
|
mqModel.ExchangeDeclare(MqActionExchangeName, ExchangeType.Direct, true);
|
|
|
|
|
|
|
|
|
|
var queueName = $"{MqActionQueueName}.{model.BookingCompanyId}";
|
|
|
|
|
mqModel.QueueDeclare(queueName, false, false, false, null);
|
|
|
|
|
|
|
|
|
|
mqModel.QueueBind(queueName, MqActionExchangeName, queueName, null);
|
|
|
|
|
|
|
|
|
|
IBasicProperties props = mqModel.CreateBasicProperties();
|
|
|
|
|
props.DeliveryMode = 2;
|
|
|
|
|
|
|
|
|
|
byte[] messageBodyBytes = Encoding.UTF8.GetBytes(SharpZipLib.Compress(json));
|
|
|
|
|
|
|
|
|
|
mqModel.BasicPublish(MqActionExchangeName, queueName, props, messageBodyBytes);
|
|
|
|
|
|
|
|
|
|
conn.Close();
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation($"订舱需求审核后推送东胜,已发送数据到消息队列【{mqUrl}】,数据内容:【{json}】");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
_logger.LogError(ex, "订舱需求审核后推送东胜时发生异常");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//进入订舱台账
|
|
|
|
|
if (accept)
|
|
|
|
|
{
|
|
|
|
@ -1728,11 +1729,90 @@ namespace Myshipping.Application
|
|
|
|
|
[HttpPost("/BookingCustomerOrder/ReceiveCustomerOrder"), AllowAnonymous, ApiUser]
|
|
|
|
|
public async Task ReceiveCustomerOrder([FromForm] BookingCustomerApiSaveInput input, IFormFile[] files)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
#region 校验
|
|
|
|
|
/*
|
|
|
|
|
1.必填字段:船公司,开船日期,起运港,目的港,箱型箱量,服务项目,运输条款,付费方式,件数,毛重,包装,货物标识,品名,HSCODE。
|
|
|
|
|
2.条件字段1:若货物标识为冻柜,温度,通风,湿度必填。
|
|
|
|
|
3.条件字段2:若货物标识为危险品,危险品编号,危险品等级,联系人,电话,HSCODE必填。
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(input.BSNO))
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah("未提供业务ID");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(input.CARRIERID) || string.IsNullOrEmpty(input.CARRIER))
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah("船司代码和名称不能为空");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!input.ETD.HasValue)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah("开船日期不能为空");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(input.PORTLOADID) || string.IsNullOrEmpty(input.PORTLOAD))
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah("起运港代码和名称不能为空");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(input.PORTDISCHARGEID) || string.IsNullOrEmpty(input.PORTDISCHARGE))
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah("目的港代码和名称不能为空");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(input.SERVICE))
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah("运输条款不能为空");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(input.BLFRT))
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah("付费方式不能为空");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!input.PKGS.HasValue)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah("件数不能为空");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!input.KGS.HasValue)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah("重量不能为空");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(input.KINDPKGS))
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah("包装不能为空");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(input.CARGOID))
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah("货物标识不能为空");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(input.DESCRIPTION))
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah("品名不能为空");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(input.HSCODE))
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah("HSCODE不能为空");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(input.CtnList==null||input.CtnList.Count==0)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah("箱型箱量不能为空");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (input.ServiceItemList == null || input.ServiceItemList.Count == 0)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah("服务项目不能为空");
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
var custOrder = await _rep.AsQueryable().Filter(null, true).FirstAsync(x => x.TenantId == UserManager.TENANT_ID && x.BSNO == input.BSNO);
|
|
|
|
|
var ins = false;
|
|
|
|
|
if (custOrder != null)
|
|
|
|
@ -1744,6 +1824,7 @@ namespace Myshipping.Application
|
|
|
|
|
|
|
|
|
|
await CancelSubmit(new List<long>() { custOrder.Id });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
input.Id = custOrder.Id;
|
|
|
|
|
input.Adapt(custOrder);
|
|
|
|
|
}
|
|
|
|
|