diff --git a/ds-wms-service/DS.Module.Core/Constants/MultiLanguageConst.cs b/ds-wms-service/DS.Module.Core/Constants/MultiLanguageConst.cs index 90d8556c..ce791307 100644 --- a/ds-wms-service/DS.Module.Core/Constants/MultiLanguageConst.cs +++ b/ds-wms-service/DS.Module.Core/Constants/MultiLanguageConst.cs @@ -1683,6 +1683,9 @@ public static class MultiLanguageConst [Description("此业务该状态下不能生成费用")] public const string CM_CanNotMakeFee = "This Bill can not make fee in this state."; + [Description("此业务该状态下不能执行此动作")] + public const string CM_CanNotExecution = "This Bill can not do this in this state."; + [Description("箱号重复")] public const string CM_CntrnoRepeat = "Cntrno repeat."; diff --git a/ds-wms-service/DS.WMS.ContainerManagementApi/Controllers/CM_BaseInfoController.cs b/ds-wms-service/DS.WMS.ContainerManagementApi/Controllers/CM_BaseInfoController.cs index b2ac6dc5..e7b3b0da 100644 --- a/ds-wms-service/DS.WMS.ContainerManagementApi/Controllers/CM_BaseInfoController.cs +++ b/ds-wms-service/DS.WMS.ContainerManagementApi/Controllers/CM_BaseInfoController.cs @@ -92,4 +92,17 @@ public class CM_BaseInfoController : ApiController return res; } + + /// + /// 推进状态 + /// + /// + [HttpPost] + [Route("CM_PushFormStatus")] + public async Task CM_PushFormStatus([FromBody] CM_PushFormStatusReq model) + { + var res = await _invokeService.CM_PushFormStatus(model); + + return res; + } } \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.Core/ContainerManagement/Dtos/CM_BaseInfoReq.cs b/ds-wms-service/DS.WMS.Core/ContainerManagement/Dtos/CM_BaseInfoReq.cs index 1f6a4e2c..b064aa98 100644 --- a/ds-wms-service/DS.WMS.Core/ContainerManagement/Dtos/CM_BaseInfoReq.cs +++ b/ds-wms-service/DS.WMS.Core/ContainerManagement/Dtos/CM_BaseInfoReq.cs @@ -52,3 +52,37 @@ public class CM_BaseInfoReq /// public string Remark { get; set; } } + +/// +/// 箱管 推进状态 请求实体参数 +/// +public class CM_PushFormStatusReq +{ + /// + /// 主键Id + /// + public long Id { get; set; } + /// + /// 模块名称 + /// 目前需要此功能的模块:租入(退租)、租出(租出)、卖箱 + /// 传 CM_RentIn CM_RentOut CM_SellCtn + /// + public string FormName { get; set; } + + /// + /// 执行动作 1001提交审核 1000撤回 10001驳回 1100审核通过 + /// + public string Execution { get; set; } + + /// + /// 理由 :驳回时需要传输理由 + /// + public string Reason { get; set; } + + /// + /// 当前状态 前端不需要传输此参数 + /// + public string CurrentState { get; set; } + + +} diff --git a/ds-wms-service/DS.WMS.Core/ContainerManagement/Dtos/CM_Rent_DetailBase.cs b/ds-wms-service/DS.WMS.Core/ContainerManagement/Dtos/CM_Rent_DetailBase.cs index 312dfbab..2f978d38 100644 --- a/ds-wms-service/DS.WMS.Core/ContainerManagement/Dtos/CM_Rent_DetailBase.cs +++ b/ds-wms-service/DS.WMS.Core/ContainerManagement/Dtos/CM_Rent_DetailBase.cs @@ -85,7 +85,7 @@ public class CM_Rent_DetailBase /// Desc:关联放箱单号 /// public string? CtnReleaseNo { get; set; } - + public string? CtnReleaseNo_In { get; set; } /// /// Desc:租入日期 diff --git a/ds-wms-service/DS.WMS.Core/ContainerManagement/Dtos/CM_Rent_HeadBase.cs b/ds-wms-service/DS.WMS.Core/ContainerManagement/Dtos/CM_Rent_HeadBase.cs index ba570f1d..2f84930c 100644 --- a/ds-wms-service/DS.WMS.Core/ContainerManagement/Dtos/CM_Rent_HeadBase.cs +++ b/ds-wms-service/DS.WMS.Core/ContainerManagement/Dtos/CM_Rent_HeadBase.cs @@ -128,4 +128,9 @@ public class CM_Rent_HeadBase : BussinessStateRes public string DropoffRemainCtntotal { get; set; } //public List _bodyList { get; set; } + + /// + /// 关联放箱单号 + /// + public string? CtnReleaseNo { get; set; } } \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.Core/ContainerManagement/Entity/CM_RentOneWay.cs b/ds-wms-service/DS.WMS.Core/ContainerManagement/Entity/CM_RentOneWay.cs index 9c8fa767..becc02f6 100644 --- a/ds-wms-service/DS.WMS.Core/ContainerManagement/Entity/CM_RentOneWay.cs +++ b/ds-wms-service/DS.WMS.Core/ContainerManagement/Entity/CM_RentOneWay.cs @@ -174,5 +174,11 @@ public class CM_RentOneWay : BaseOrgModelV2 /// [SugarColumn(ColumnDescription = "未还箱", IsNullable = true, Length = 200)] public string DropoffRemainCtntotal { get; set; } + + /// + /// Desc:关联放箱单号 + /// + [SugarColumn(ColumnDescription = "关联放箱单号", IsNullable = true, Length = 50)] + public string CtnReleaseNo { get; set; } } diff --git a/ds-wms-service/DS.WMS.Core/ContainerManagement/Entity/CM_RentOneWay_Detail.cs b/ds-wms-service/DS.WMS.Core/ContainerManagement/Entity/CM_RentOneWay_Detail.cs index 6dd9ac54..575607b6 100644 --- a/ds-wms-service/DS.WMS.Core/ContainerManagement/Entity/CM_RentOneWay_Detail.cs +++ b/ds-wms-service/DS.WMS.Core/ContainerManagement/Entity/CM_RentOneWay_Detail.cs @@ -89,6 +89,13 @@ public class CM_RentOneWay_Detail : BaseOrgModelV2 public string CtnReleaseNo { get; set; } + /// + /// Desc:租入放箱单号 + /// + [SugarColumn(ColumnDescription = "租入放箱单号", IsNullable = true, Length = 50)] + public string CtnReleaseNo_In { get; set; } + + /// /// Desc:租入日期 /// diff --git a/ds-wms-service/DS.WMS.Core/ContainerManagement/Entity/CM_RentOneWay_In.cs b/ds-wms-service/DS.WMS.Core/ContainerManagement/Entity/CM_RentOneWay_In.cs index eb7b7cf3..98381bed 100644 --- a/ds-wms-service/DS.WMS.Core/ContainerManagement/Entity/CM_RentOneWay_In.cs +++ b/ds-wms-service/DS.WMS.Core/ContainerManagement/Entity/CM_RentOneWay_In.cs @@ -174,5 +174,11 @@ public class CM_RentOneWay_In : BaseOrgModelV2 /// [SugarColumn(ColumnDescription = "未还箱", IsNullable = true, Length = 200)] public string DropoffRemainCtntotal { get; set; } + + /// + /// Desc:关联放箱单号 + /// + [SugarColumn(ColumnDescription = "关联放箱单号", IsNullable = true, Length = 50)] + public string CtnReleaseNo { get; set; } } diff --git a/ds-wms-service/DS.WMS.Core/ContainerManagement/Interface/ICM_BaseInfoService.cs b/ds-wms-service/DS.WMS.Core/ContainerManagement/Interface/ICM_BaseInfoService.cs index b3a0080a..7edf788d 100644 --- a/ds-wms-service/DS.WMS.Core/ContainerManagement/Interface/ICM_BaseInfoService.cs +++ b/ds-wms-service/DS.WMS.Core/ContainerManagement/Interface/ICM_BaseInfoService.cs @@ -46,5 +46,12 @@ public interface ICM_BaseInfoService /// public Task CM_DealExcel(CM_DealExcelReq model); + /// + /// 推进状态 + /// + /// + /// + public Task CM_PushFormStatus(CM_PushFormStatusReq model); + } \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_BaseInfoService.cs b/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_BaseInfoService.cs index adc3d104..1b58685e 100644 --- a/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_BaseInfoService.cs +++ b/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_BaseInfoService.cs @@ -22,6 +22,10 @@ using SqlSugar; using DS.Module; using DS.Module.ExcelModule; using DS.Module.ExcelModule.Model; +using System; +using LanguageExt.Pipes; +using DS.WMS.Core.Invoice.Dtos; +using MathNet.Numerics.Distributions; namespace DS.WMS.ContainerManagement.Info.Method; @@ -32,7 +36,6 @@ public class CM_BaseInfoService : ICM_BaseInfoService private readonly IUser user; private readonly ISaasDbService saasService; private readonly IEPPlusService epplusService; - private readonly ICM_State_Change_TemplatImportService templatImportService; /// @@ -317,4 +320,147 @@ public class CM_BaseInfoService : ICM_BaseInfoService //var tenantDb = saasService.GetBizDbScopeById(user.TenantId); } -} \ No newline at end of file + + /// + /// 推进状态 + /// + /// + /// + public async Task CM_PushFormStatus(CM_PushFormStatusReq req) + { + //object Head = new object(); + var tenantDb = saasService.GetBizDbScopeById(user.TenantId); + + if (req.FormName == "CM_RentIn") { + + //序列化查询条件 + + var Head = await tenantDb.Queryable() + .FirstAsync(x => x.Id == req.Id); + + req.CurrentState = Head.BillState; + + var cando = FormPushStatusHelper(req); + + if (cando.Message == "") + { + return DataResult.Failed($"此业务该状态下不能执行此动作!", MultiLanguageConst.CM_CanNotExecution); + } + else { + Head.BillState = cando.Message; + + if (Head.BillState == "10001") Head.Remark += "驳回理由:" + req.Reason; + } + + tenantDb.Updateable(Head).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand(); + + return DataResult.Successed($"执行成功!", MultiLanguageConst.OperationSuccess); + } + + if (req.FormName == "CM_RentOut") + { + + //序列化查询条件 + + var Head = await tenantDb.Queryable() + .FirstAsync(x => x.Id == req.Id); + + req.CurrentState = Head.BillState; + + var cando = FormPushStatusHelper(req); + + if (cando.Message == "") + { + return DataResult.Failed($"此业务该状态下不能执行此动作!", MultiLanguageConst.CM_CanNotExecution); + } + else + { + Head.BillState = cando.Message; + + if (Head.BillState == "10001") Head.Remark += "驳回理由:" + req.Reason; + } + + tenantDb.Updateable(Head).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand(); + + return DataResult.Successed($"执行成功!", MultiLanguageConst.OperationSuccess); + } + + if (req.FormName == "CM_SellCtn") + { + + //序列化查询条件 + + var Head = await tenantDb.Queryable() + .FirstAsync(x => x.Id == req.Id); + + req.CurrentState = Head.BillState; + + var cando = FormPushStatusHelper(req); + + if (cando.Message == "") + { + return DataResult.Failed($"此业务该状态下不能执行此动作!", MultiLanguageConst.CM_CanNotExecution); + } + else + { + Head.BillState = cando.Message; + + if (Head.BillState == "10001") Head.Remark += "驳回理由:" + req.Reason; + } + + tenantDb.Updateable(Head).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand(); + + return DataResult.Successed($"执行成功!", MultiLanguageConst.OperationSuccess); + } + + return DataResult.Failed($"此业务该状态下不能执行此动作!", MultiLanguageConst.CM_CanNotExecution); + } + + public DataResult FormPushStatusHelper(CM_PushFormStatusReq req) + { + //执行动作 1001提交审核 1000撤回 10001驳回 1100审核通过 + //状态 "/1000"录入 10001驳回 1001审核中 1100审核通过 + if (req.FormName == "CM_RentIn" || req.FormName == "CM_RentOut"|| req.FormName == "CM_SellCtn") + { + //录入/驳回 状态允许提交1001 + if (string.IsNullOrWhiteSpace(req.CurrentState) || req.CurrentState == "1000" || req.CurrentState == "10001") { + + if (req.Execution == "1001") { + return DataResult.Successed($"1001"); + } + } + //提交审核状态 允许: 通过 驳回 撤回 + if ( req.CurrentState == "1001") + { + if (req.Execution == "1000") + { + return DataResult.Successed($"1000"); + } + if (req.Execution == "10001") + { + return DataResult.Successed($"10001"); + } + if (req.Execution == "1100") + { + return DataResult.Successed($"1100"); + } + } + + //审核通过状态允许 驳回 + if (req.CurrentState == "1100") + { + if (req.Execution == "10001") + { + return DataResult.Successed($"10001"); + } + } + } + + return DataResult.Failed($""); + } + + +} + + + diff --git a/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_RentInService.cs b/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_RentInService.cs index a43c538a..c7b0c4aa 100644 --- a/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_RentInService.cs +++ b/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_RentInService.cs @@ -125,7 +125,7 @@ public class CM_RentInService : CMServiceBase, ICM_RentInService return await Task.FromResult(DataResult.Failed(sequence.Message, MultiLanguageConst.SequenceSetNotExist)); } data.Billno = sequence.Data; - + data.BillState = "1000"; var ch = new CtnTotalHelper2>(req.BodyList); diff --git a/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_RentOneWayService.cs b/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_RentOneWayService.cs index 9c0f809d..d5e221ad 100644 --- a/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_RentOneWayService.cs +++ b/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_RentOneWayService.cs @@ -466,6 +466,13 @@ public class CM_RentOneWayService : CMServiceBase, ICM_RentOneWayService //newrec.PickupPortCode = null; //newrec.PickupDate = null; + newrec.CtnReleaseNo_In = addrec.CtnReleaseNo; + newrec.CtnReleaseNo = ""; + + //if (string.IsNullOrWhiteSpace(head.CtnReleaseNo)) { + + //} + addList.Add(newrec); } diff --git a/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_RentOneWay_InService.cs b/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_RentOneWay_InService.cs index 4b2a032e..3dc383b0 100644 --- a/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_RentOneWay_InService.cs +++ b/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_RentOneWay_InService.cs @@ -130,6 +130,11 @@ public class CM_RentOneWay_InService : CMServiceBase, ICM_RentOneWay_InService item.OldContainerOwner = data.OldContainerOwner; } + if (string.IsNullOrWhiteSpace( item.CtnReleaseNo) && !string.IsNullOrWhiteSpace(data.CtnReleaseNo)) + { + item.CtnReleaseNo = data.CtnReleaseNo; + } + var newdetail = item.Adapt(); await tenantDb.Insertable(newdetail).ExecuteCommandAsync(); } @@ -164,6 +169,10 @@ public class CM_RentOneWay_InService : CMServiceBase, ICM_RentOneWay_InService item.OldContainerOwnerId = info.OldContainerOwnerId; item.OldContainerOwner = info.OldContainerOwner; } + if (string.IsNullOrWhiteSpace(item.CtnReleaseNo) && !string.IsNullOrWhiteSpace(info.CtnReleaseNo)) + { + item.CtnReleaseNo = info.CtnReleaseNo; + } var newdetail = item.Adapt(); await tenantDb.Insertable(newdetail).ExecuteCommandAsync(); } @@ -175,6 +184,10 @@ public class CM_RentOneWay_InService : CMServiceBase, ICM_RentOneWay_InService item.OldContainerOwnerId = info.OldContainerOwnerId; item.OldContainerOwner = info.OldContainerOwner; } + if (string.IsNullOrWhiteSpace(item.CtnReleaseNo) && !string.IsNullOrWhiteSpace(info.CtnReleaseNo)) + { + item.CtnReleaseNo = info.CtnReleaseNo; + } updrec = item.Adapt(updrec); await tenantDb.Updateable(updrec).ExecuteCommandAsync(); } diff --git a/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_RentOutService.cs b/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_RentOutService.cs index eb625a02..91c4dd5c 100644 --- a/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_RentOutService.cs +++ b/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_RentOutService.cs @@ -142,6 +142,7 @@ public class CM_RentOutService : CMServiceBase, ICM_RentOutService return await Task.FromResult(DataResult.Failed(sequence.Message, MultiLanguageConst.SequenceSetNotExist)); } data.Billno = sequence.Data; + data.BillState = "1000"; //var entity = tenantDb.Insertable(data).ExecuteReturnEntity(); var entity = await tenantDb.Insertable(data).ExecuteReturnEntityAsync(); diff --git a/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_SellCtnService.cs b/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_SellCtnService.cs index 7fe00c1e..396886ed 100644 --- a/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_SellCtnService.cs +++ b/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_SellCtnService.cs @@ -146,6 +146,7 @@ public class CM_SellCtnService : CMServiceBase, ICM_SellCtnService return await Task.FromResult(DataResult.Failed(sequence.Message, MultiLanguageConst.SequenceSetNotExist)); } data.Billno = sequence.Data; + data.BillState = "1000"; //var entity = tenantDb.Insertable(data).ExecuteReturnEntity(); var entity = await tenantDb.Insertable(data).ExecuteReturnEntityAsync(); diff --git a/ds-wms-service/DS.WMS.Test/ContainerManagementTest.cs b/ds-wms-service/DS.WMS.Test/ContainerManagementTest.cs index b8d1ca37..5087f64b 100644 --- a/ds-wms-service/DS.WMS.Test/ContainerManagementTest.cs +++ b/ds-wms-service/DS.WMS.Test/ContainerManagementTest.cs @@ -106,7 +106,7 @@ public class ContainerManagementTest /// /// 初始化单表 多表 /// 注意 海运出口 SeaExport 得手动数据库更新 - /// + /// d [Fact] public void InitAllSaasTableTestByDdlucky() { @@ -128,9 +128,9 @@ public class ContainerManagementTest //tenantDb.CodeFirst.InitTables(typeof(CM_RentIn_Detail)); //tenantDb.CodeFirst.InitTables(typeof(CM_RentOut)); //tenantDb.CodeFirst.InitTables(typeof(CM_RentOut_Detail)); - //tenantDb.CodeFirst.InitTables(typeof(CM_RentOneWay)); - //tenantDb.CodeFirst.InitTables(typeof(CM_RentOneWay_Detail)); - //tenantDb.CodeFirst.InitTables(typeof(CM_RentOneWay_In)); + tenantDb.CodeFirst.InitTables(typeof(CM_RentOneWay)); + tenantDb.CodeFirst.InitTables(typeof(CM_RentOneWay_Detail)); + tenantDb.CodeFirst.InitTables(typeof(CM_RentOneWay_In)); //tenantDb.CodeFirst.InitTables(typeof(CM_BuyCtn)); //tenantDb.CodeFirst.InitTables(typeof(CM_BuyCtn_Detail)); @@ -147,7 +147,7 @@ public class ContainerManagementTest //tenantDb.CodeFirst.InitTables(typeof(CM_State_Change_Templat)); //tenantDb.CodeFirst.InitTables(typeof(CM_State_Change_TemplatDetail)); //tenantDb.CodeFirst.InitTables(typeof(CM_State_Change_TemplatImport)); - tenantDb.CodeFirst.InitTables(typeof(CM_State_Change_Temp)); + //tenantDb.CodeFirst.InitTables(typeof(CM_State_Change_Temp)); } Assert.True(true);