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.
76 lines
3.2 KiB
C#
76 lines
3.2 KiB
C#
3 years ago
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.Linq;
|
||
|
using System.Threading.Tasks;
|
||
|
using djy.Paas.IService;
|
||
|
using djy.Paas.Model;
|
||
|
using Ys.Core.Common;
|
||
|
|
||
|
namespace djy.Paas.Service
|
||
|
{
|
||
|
/// <summary>
|
||
|
/// 报关货主端实现接口接口实现
|
||
|
/// </summary>
|
||
|
public class BaoguanOrderClientService:ServBase<tb_BaoguanOrderClient,BaoguanOrderClientDto>,IBaoguanOrderClientService
|
||
|
{
|
||
|
public BaoguanOrderClientService(string dbkey = DbList.djypublicedb) : base(dbkey) { }
|
||
|
/// <summary>
|
||
|
///
|
||
|
/// </summary>
|
||
|
/// <param name="Dto"></param>
|
||
|
/// <param name="apiFromDto"></param>
|
||
|
/// <returns></returns>
|
||
|
public ReturnPagedResult<BaoguanOrderClientDto> GetList(BaoguanOrderClientDto Dto, ApiFromDto apiFromDto)
|
||
|
{
|
||
|
var rs =new ReturnPagedResult<BaoguanOrderClientDto>();
|
||
|
|
||
|
var sql = DbBus.Get(DbList.djypublicedb).Select<tb_BaoguanOrderClient, tb_BaoGuanOrderList>().LeftJoin((c, o) => c.BaoguanOrderGid == o.Gid).Where((c, o) => c.Status > 0)
|
||
|
.WhereIf(Dto.CompGId != null, (c, o) => c.CompGId == Dto.CompGId)
|
||
|
.WhereIf(Dto.UserGid != null, (c, o) => c.UserGid == Dto.UserGid)
|
||
|
.WhereIf(Dto.Gidlist.Count>0,(c,o)=>Dto.Gidlist.Contains(c.Gid))
|
||
|
.WhereIf(Dto.ShipOrderNo.IsNotNull(),(c,o)=>c.ShipOrderNo==Dto.ShipOrderNo)
|
||
|
.WhereIf(Dto.ShipOrderNo.IsNotNull(), (c, o) => c.ShipOrderNo.Contains(Dto.ShipOrderNo))
|
||
|
.WhereIf(Dto.BaoguanAgent.IsNotNull(), (c, o) => c.BaoguanAgent.Contains(Dto.BaoguanAgent))
|
||
|
.WhereIf(Dto.IEFlag.IsNotNull(), (c, o) => c.IEFlag == Dto.IEFlag);
|
||
|
|
||
|
rs.Data = sql.OrderByDescending((c, o) => c.AddTime).Count(out var totalcount).Page(apiFromDto.Page,apiFromDto.Limit)
|
||
|
.ToList<BaoguanOrderClientDto>();
|
||
|
|
||
|
|
||
|
|
||
|
rs.Pageset(apiFromDto,totalcount);
|
||
|
rs.OK();
|
||
|
return rs;
|
||
|
}
|
||
|
/// <summary>
|
||
|
/// 创建客户报关单同时数据初始化到阿里报关数据回写做绑定关系
|
||
|
/// </summary>
|
||
|
/// <param name="Dto"></param>
|
||
|
/// <returns></returns>
|
||
|
public new ReturnResult<object> Add(tb_BaoguanOrderClient Dto)
|
||
|
{
|
||
|
var rs = new ReturnResult<object>();
|
||
|
Dto.Init();
|
||
|
|
||
|
var User = DbBus.Get(DbList.djyolddb).Select<djy.Model.User>().Where(w => w.GID == Dto.UserGid.ToString()).ToOne();
|
||
|
var aliorder = DbBus.Get(DbList.djypublicedb).Select<tb_BaoGuanOrderList>().Where(w => w.ShipOrderNo == Dto.ShipOrderNo).ToOne();
|
||
|
Dto.CompName = User.COMNAME;
|
||
|
if (aliorder == null)
|
||
|
{
|
||
|
//同时创建 阿里的监控订单数据
|
||
|
var order = new tb_BaoGuanOrderList();
|
||
|
order.Init();
|
||
|
order.ShipOrderNo = Dto.ShipOrderNo;
|
||
|
DbBus.Get(DbList.djypublicedb).Insert(order).ExecuteAffrows();
|
||
|
Dto.BaoguanOrderGid = order.Gid;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
Dto.BaoguanOrderGid = aliorder.Gid;
|
||
|
}
|
||
|
DbBus.Get(DbList.djypublicedb).Insert(Dto).ExecuteAffrows();
|
||
|
rs.OK();
|
||
|
return rs;
|
||
|
}
|
||
|
}
|
||
|
}
|