提单接口修改

usertest
cjy 5 months ago
parent b5374547ae
commit 94908fb98c

@ -510,7 +510,10 @@ public static class MultiLanguageConst
public const string ShippingBillNotExist = "ShippingBill_Not_Exist";
[Description("舱单箱信息不存在")]
public const string ShippingBillCtnNotExist = "ShippingBill_Ctn_Not_Exist";
[Description("提单信息不存在")]
public const string ShippingBillManageNotExist = "ShippingBillManage_Not_Exist";
[Description("表单设置不存在")]
public const string FormSetNotExist = "FormSet_Not_Exist";

@ -0,0 +1,85 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DS.WMS.Core.Op.Dtos
{
/// <summary>
/// 海运出库提单箱信息-请求实体
/// </summary>
public class SeaExportBillManageCtnReq
{
/// <summary>
/// 主键Id
/// </summary>
public long Id { get; set; }
/// <summary>
/// 业务Id
/// </summary>
public long Pid { get; set; }
/// <summary>
/// 尺寸
/// </summary>
public string Size { get; set; }
/// <summary>
/// 箱型
/// </summary>
public string Ctn { get; set; }
/// <summary>
/// 箱量
/// </summary>
public int? CtnNum { get; set; }
/// <summary>
/// 箱型Id
/// </summary>
public long CtnId { get; set; }
/// <summary>
/// 表现形式
/// </summary>
public string CtnAll { get; set; }
/// <summary>
/// 箱号
/// </summary>
public string CntrNo { get; set; }
/// <summary>
/// 封号
/// </summary>
public string SealNo { get; set; }
/// <summary>
/// 件数
/// </summary>
public int? PKGS { get; set; }
/// <summary>
/// 毛重
/// </summary>
public decimal? KGS { get; set; }
/// <summary>
/// 尺码
/// </summary>
public decimal? CBM { get; set; }
/// <summary>
/// 箱皮重
/// </summary>
public decimal? TareWeight { get; set; }
/// <summary>
/// 包装Code
/// </summary>
public string KindPkgs { get; set; }
/// <summary>
/// 包装 t_code_package
/// </summary>
public string KindPkgsName { get; set; }
/// <summary>
/// 备注
/// </summary>
public string Note { get; set; }
}
}

@ -0,0 +1,86 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DS.WMS.Core.Op.Dtos
{
/// <summary>
/// 海运出库提单箱信息
/// </summary>
public class SeaExportBillManageCtnRes
{
/// <summary>
/// 主键Id
/// </summary>
public long Id { get; set; }
/// <summary>
/// 业务Id
/// </summary>
public long Pid { get; set; }
/// <summary>
/// 尺寸
/// </summary>
public string Size { get; set; }
/// <summary>
/// 箱型
/// </summary>
public string Ctn { get; set; }
/// <summary>
/// 箱量
/// </summary>
public int? CtnNum { get; set; }
/// <summary>
/// 箱型Id
/// </summary>
public long CtnId { get; set; }
/// <summary>
/// 表现形式
/// </summary>
public string CtnAll { get; set; }
/// <summary>
/// 箱号
/// </summary>
public string CntrNo { get; set; }
/// <summary>
/// 封号
/// </summary>
public string SealNo { get; set; }
/// <summary>
/// 件数
/// </summary>
public int? PKGS { get; set; }
/// <summary>
/// 毛重
/// </summary>
public decimal? KGS { get; set; }
/// <summary>
/// 尺码
/// </summary>
public decimal? CBM { get; set; }
/// <summary>
/// 箱皮重
/// </summary>
public decimal? TareWeight { get; set; }
/// <summary>
/// 包装Code
/// </summary>
public string KindPkgs { get; set; }
/// <summary>
/// 包装 t_code_package
/// </summary>
public string KindPkgsName { get; set; }
/// <summary>
/// 备注
/// </summary>
public string Note { get; set; }
}
}

@ -17,7 +17,10 @@ namespace DS.WMS.Core.Op.Dtos
/// </summary>
public long Id { get; set; }
/// <summary>
/// 箱信息
/// </summary>
public List<SeaExportBillManageCtnReq> CtnInfo { get; set; }
/// <summary>
/// 业务Id
/// </summary>

@ -0,0 +1,95 @@
using DS.Module.Core.Data;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DS.WMS.Core.Op.Entity
{
/// <summary>
/// 海运出口提单箱信息
/// </summary>
[SqlSugar.SugarTable("op_sea_export_billmanage_ctn", "海运出口提单箱信息")]
public class SeaExportBillManageCtn : BaseModel<long>
{
/// <summary>
/// 业务Id
/// </summary>
[SugarColumn(ColumnDescription = "业务Id", IsNullable = false)]
public long Pid { get; set; }
/// <summary>
/// 尺寸
/// </summary>
[SugarColumn(ColumnDescription = "尺寸", IsNullable = true, Length = 3)]
public string Size { get; set; }
/// <summary>
/// 箱型
/// </summary>
[SugarColumn(ColumnDescription = "箱型", IsNullable = true, Length = 10)]
public string Ctn { get; set; }
/// <summary>
/// 箱量
/// </summary>
[SugarColumn(ColumnDescription = "箱量", IsNullable = true, DefaultValue = "0")]
public int? CtnNum { get; set; }
/// <summary>
/// 箱型Id
/// </summary>
[SugarColumn(ColumnDescription = "箱型Id")]
public long CtnId { get; set; }
/// <summary>
/// 表现形式
/// </summary>
[SugarColumn(ColumnDescription = "表现形式", IsNullable = true, Length = 10)]
public string CtnAll { get; set; }
/// <summary>
/// 箱号
/// </summary>
[SugarColumn(ColumnDescription = "箱号", IsNullable = true, Length = 30)]
public string CntrNo { get; set; }
/// <summary>
/// 封号
/// </summary>
[SugarColumn(ColumnDescription = "封号", IsNullable = true, Length = 20)]
public string SealNo { get; set; }
/// <summary>
/// 件数
/// </summary>
[SugarColumn(ColumnDescription = "件数", IsNullable = true)]
public int? PKGS { get; set; }
/// <summary>
/// 毛重
/// </summary>
[SugarColumn(ColumnDescription = "毛重", IsNullable = true, Length = 18, DecimalDigits = 3, DefaultValue = "0")]
public decimal? KGS { get; set; }
/// <summary>
/// 尺码
/// </summary>
[SugarColumn(ColumnDescription = "尺码", IsNullable = true, Length = 18, DecimalDigits = 3, DefaultValue = "0")]
public decimal? CBM { get; set; }
/// <summary>
/// 箱皮重
/// </summary>
[SugarColumn(ColumnDescription = "箱皮重", IsNullable = true, Length = 18, DecimalDigits = 3, DefaultValue = "0")]
public decimal? TareWeight { get; set; }
/// <summary>
/// 包装Code
/// </summary>
[SugarColumn(ColumnDescription = "包装Code", IsNullable = true, Length = 20)]
public string KindPkgs { get; set; }
/// <summary>
/// 包装 t_code_package
/// </summary>
[SugarColumn(ColumnDescription = "包装", IsNullable = true, Length = 20)]
public string KindPkgsName { get; set; }
}
}

@ -1,4 +1,5 @@
using DS.Module.Core;
using DS.Module.Core.Data;
using DS.WMS.Core.Info.Dtos;
using DS.WMS.Core.Op.Dtos;
using System;
@ -35,5 +36,25 @@ namespace DS.WMS.Core.Op.Interface
/// <param name="id"></param>
/// <returns></returns>
DataResult<SeaExportBillManageRes> GetSeaExportBillManageInfo(string id);
/// <summary>
/// 提单箱信息列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public DataResult<List<SeaExportBillManageCtnRes>> GetBillManageCtnList(PageRequest request);
/// <summary>
/// 批量删除提单
/// </summary>
/// <param name="req">主表Ids</param>
/// <returns></returns>
public DataResult BatchDelBillManage(IdModel req);
/// <summary>
/// 批量删除提单箱信息
/// </summary>
/// <param name="req">主表Id及箱信息Ids</param>
/// <returns></returns>
public DataResult BatchDelBillManageCtn(IdModel req);
}
}

@ -13,6 +13,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DS.Module.Core.Data;
namespace DS.WMS.Core.Op.Method
{
@ -63,6 +64,17 @@ namespace DS.WMS.Core.Op.Method
var entity = tenantDb.Insertable(data).ExecuteReturnEntity();
if (req.CtnInfo.Count > 0)
{
foreach (var item in req.CtnInfo)
{
var ctn = item.Adapt<SeaExportBillManageCtn>();
ctn.Pid = entity.Id;
tenantDb.Insertable(ctn).ExecuteCommand();
}
}
return DataResult.Successed("添加成功!", entity.Id, MultiLanguageConst.DataCreateSuccess);
}
else
@ -71,6 +83,27 @@ namespace DS.WMS.Core.Op.Method
info = req.Adapt(info);
if (req.CtnInfo.Count > 0)
{
var ctnList = tenantDb.Queryable<SeaExportBillManageCtn>().Where(x => x.Pid == req.Id).ToList();
foreach (var item in req.CtnInfo)
{
if (item.Id == 0)
{
var ctn = item.Adapt<SeaExportBillManageCtn>();
ctn.Pid = info.Id;
tenantDb.Insertable(ctn).ExecuteCommand();
}
else
{
var ctn = ctnList.First(x => x.Id == item.Id);
ctn = item.Adapt(ctn);
tenantDb.Updateable(ctn).ExecuteCommand();
}
}
}
tenantDb.Updateable(info).IgnoreColumns(ignoreAllNullColumns: true).EnableDiffLogEvent().ExecuteCommand();
return DataResult.Successed("更新成功!", MultiLanguageConst.DataUpdateSuccess);
}
@ -89,5 +122,58 @@ namespace DS.WMS.Core.Op.Method
.First();
return DataResult<SeaExportBillManageRes>.Success(data, MultiLanguageConst.DataQuerySuccess);
}
/// <summary>
/// 提单箱信息列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public DataResult<List<SeaExportBillManageCtnRes>> GetBillManageCtnList(PageRequest request)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
//序列化查询条件
var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
var data = tenantDb.Queryable<SeaExportBillManageCtn>()
.Where(whereList)
.Select<SeaExportBillManageCtnRes>().ToQueryPage(request.PageCondition);
return data;
}
/// <summary>
/// 批量删除提单
/// </summary>
/// <param name="req">主表Ids</param>
/// <returns></returns>
public DataResult BatchDelBillManage(IdModel req)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var list = tenantDb.Queryable<SeaExportBillManage>().Where(x => req.Ids.Contains(x.Id)).ToList();
if (list.Count > 0)
{
var ctns = tenantDb.Queryable<SeaExportBillManageCtn>().Where(x => req.Ids.Contains(x.Pid)).ToList();
if (ctns.Count > 0) {
tenantDb.Deleteable(ctns).ExecuteCommand();
}
tenantDb.Deleteable(list).ExecuteCommand();
}
return DataResult.Successed("删除成功!", MultiLanguageConst.DataDelSuccess);
}
/// <summary>
/// 批量删除提单箱信息
/// </summary>
/// <param name="req">主表Id及箱信息Ids</param>
/// <returns></returns>
public DataResult BatchDelBillManageCtn(IdModel req)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var info = tenantDb.Queryable<SeaExportBillManage>().Where(x => x.Id ==long.Parse(req.Id)).First();
if (info.IsNull())
return DataResult.Failed("提单信息不存在", MultiLanguageConst.ShippingBillManageNotExist);
var list = tenantDb.Queryable<SeaExportBillManageCtn>().Where(x => x.Pid == long.Parse(req.Id) && req.Ids.Contains(x.Id)).ToList();
if (list.Count > 0)
{
tenantDb.Deleteable(list).ExecuteCommand();
}
return DataResult.Successed("删除成功!", MultiLanguageConst.DataDelSuccess);
}
}
}

@ -63,5 +63,41 @@ public class SeaExportBillManageController : ApiController
return res;
}
/// <summary>
/// 提单箱信息列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[HttpPost]
[Route("GetBillManageCtnList")]
public DataResult<List<SeaExportBillManageCtnRes>> GetBillManageCtnList([FromBody] PageRequest request)
{
var res = _invokeService.GetBillManageCtnList(request);
return res;
}
/// <summary>
/// 批量删除提单
/// </summary>
/// <param name="req">主表Ids</param>
/// <returns></returns>
[HttpPost]
[Route("BatchDelBillManage")]
public DataResult BatchDelBillManage([FromBody] IdModel req)
{
var res = _invokeService.BatchDelBillManage(req);
return res;
}
/// <summary>
/// 批量删除提单箱信息
/// </summary>
/// <param name="req">主表Id及箱信息Ids</param>
/// <returns></returns>
[HttpPost]
[Route("BatchDelBillManageCtn")]
public DataResult BatchDelBillManageCtn([FromBody] IdModel req)
{
var res = _invokeService.BatchDelBillManageCtn(req);
return res;
}
}

@ -65,7 +65,7 @@ public class SaasTest
{
var tenantDb = saasService.GetBizDbScopeById("1750335377144680448");
StaticConfig.CodeFirst_MySqlCollate = "utf8mb4_0900_ai_ci";//较高版本支持
tenantDb.CodeFirst.InitTables(typeof(SeaExportShippingBillPartCtn));
tenantDb.CodeFirst.InitTables(typeof(SeaExportBillManageCtn));
//tenantDb.CodeFirst.InitTables(typeof(CheckBillAutoDetail));
//db.CodeFirst.InitTables(typeof(OpBusinessTruckCtn));
Assert.True(true);

Loading…
Cancel
Save