update validaton for material endpoint
This commit is contained in:
parent
4990ac7a4a
commit
6cd0f8f82f
|
|
@ -752,7 +752,8 @@ namespace OnlineSalesAutoCrop.CoreAPI.Models
|
||||||
[Description("Approved")]
|
[Description("Approved")]
|
||||||
Approved = 6,
|
Approved = 6,
|
||||||
[Description("Sent To SAP")]
|
[Description("Sent To SAP")]
|
||||||
SentToSAP = 7
|
SentToSAP = 7,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum SAPOrderStatusEnum : short
|
public enum SAPOrderStatusEnum : short
|
||||||
|
|
|
||||||
|
|
@ -70,19 +70,15 @@ public class IntegrationEmployeeRequest
|
||||||
[StringLength(40, ErrorMessage = "Region/Area description cannot exceed 40 characters.")]
|
[StringLength(40, ErrorMessage = "Region/Area description cannot exceed 40 characters.")]
|
||||||
public string RegionAreaDescription { get; set; }
|
public string RegionAreaDescription { get; set; }
|
||||||
|
|
||||||
[Required(ErrorMessage = "Area-AV/Sales unit code is required.")]
|
|
||||||
[StringLength(10, ErrorMessage = "Area-AV/Sales unit code cannot exceed 10 characters.")]
|
[StringLength(10, ErrorMessage = "Area-AV/Sales unit code cannot exceed 10 characters.")]
|
||||||
public string AreaAVSalesUnitCode { get; set; }
|
public string AreaAVSalesUnitCode { get; set; }
|
||||||
|
|
||||||
[Required(ErrorMessage = "Area-AV/Sales unit description is required.")]
|
|
||||||
[StringLength(40, ErrorMessage = "Area-AV/Sales unit description cannot exceed 40 characters.")]
|
[StringLength(40, ErrorMessage = "Area-AV/Sales unit description cannot exceed 40 characters.")]
|
||||||
public string AreaAVSalesUnitDescription { get; set; }
|
public string AreaAVSalesUnitDescription { get; set; }
|
||||||
|
|
||||||
[Required(ErrorMessage = "Territory is required.")]
|
|
||||||
[StringLength(3, ErrorMessage = "Territory cannot exceed 3 characters.")]
|
[StringLength(3, ErrorMessage = "Territory cannot exceed 3 characters.")]
|
||||||
public string Territory { get; set; }
|
public string Territory { get; set; }
|
||||||
|
|
||||||
[Required(ErrorMessage = "Territory description is required.")]
|
|
||||||
[StringLength(20, ErrorMessage = "Territory description cannot exceed 20 characters.")]
|
[StringLength(20, ErrorMessage = "Territory description cannot exceed 20 characters.")]
|
||||||
public string TerritoryDescription { get; set; }
|
public string TerritoryDescription { get; set; }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ public class IntegrationBillingDocumentItemRequest
|
||||||
public string UnitOfMeasure { get; set; } = string.Empty;
|
public string UnitOfMeasure { get; set; } = string.Empty;
|
||||||
|
|
||||||
[Required(ErrorMessage = "Billing amount is required.")]
|
[Required(ErrorMessage = "Billing amount is required.")]
|
||||||
[Range(0.01, double.MaxValue, ErrorMessage = "Billing amount must be greater than zero.")]
|
[Range(0, double.MaxValue, ErrorMessage = "Billing amount must be greater than zero.")]
|
||||||
[DataType(DataType.Currency)]
|
[DataType(DataType.Currency)]
|
||||||
public decimal BillingAmount { get; set; }
|
public decimal BillingAmount { get; set; }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,17 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
namespace OnlineSalesAutoCrop.CoreAPI.Models.Requests.Integrations;
|
namespace OnlineSalesAutoCrop.CoreAPI.Models.Requests.Integrations;
|
||||||
|
|
||||||
public class IntegrationMaterialPriceRequest
|
public class IntegrationMaterialPriceRequest
|
||||||
{
|
{
|
||||||
|
public IntegrationMaterialPriceRequest()
|
||||||
|
{
|
||||||
|
Slabs = new List<IntegrationMaterialPriceItemRequest>();
|
||||||
|
}
|
||||||
|
|
||||||
[Required(ErrorMessage = "Sales Org is required.")]
|
[Required(ErrorMessage = "Sales Org is required.")]
|
||||||
[StringLength(4, ErrorMessage = "Sales Org cannot exceed 4 characters.")]
|
[StringLength(4, ErrorMessage = "Sales Org cannot exceed 4 characters.")]
|
||||||
public string SalesOrg { get; set; }
|
public string SalesOrg { get; set; }
|
||||||
|
|
@ -38,6 +45,14 @@ public class IntegrationMaterialPriceRequest
|
||||||
[Required(ErrorMessage = "Unit Of Measure is required.")]
|
[Required(ErrorMessage = "Unit Of Measure is required.")]
|
||||||
[StringLength(3, ErrorMessage = "Unit Of Measure cannot exceed 3 characters.")]
|
[StringLength(3, ErrorMessage = "Unit Of Measure cannot exceed 3 characters.")]
|
||||||
public string UnitOfMeasure { get; set; }
|
public string UnitOfMeasure { get; set; }
|
||||||
|
public IList<IntegrationMaterialPriceItemRequest> Slabs { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class IntegrationMaterialPriceItemRequest
|
||||||
|
{
|
||||||
|
[Required(ErrorMessage = "Scale Value is required.")]
|
||||||
|
[Range(typeof(decimal), "0", "999999999999999999.99", ErrorMessage = "Scale Value must be greater than or equal to 0.")]
|
||||||
|
public decimal ScaleValue { get; set; }
|
||||||
|
|
||||||
[Required(ErrorMessage = "Valid From date is required.")]
|
[Required(ErrorMessage = "Valid From date is required.")]
|
||||||
public DateTime ValidFrom { get; set; }
|
public DateTime ValidFrom { get; set; }
|
||||||
|
|
@ -50,8 +65,7 @@ public class IntegrationMaterialPriceRequest
|
||||||
public string Status { get; set; }
|
public string Status { get; set; }
|
||||||
|
|
||||||
[Required(ErrorMessage = "Condition Value is required.")]
|
[Required(ErrorMessage = "Condition Value is required.")]
|
||||||
[Range(typeof(decimal), "0", "999999999999999999.99",
|
[Range(typeof(decimal), "0", "999999999999999999.99", ErrorMessage = "Condition Value must be greater than or equal to 0.")]
|
||||||
ErrorMessage = "Condition Value must be greater than or equal to 0.")]
|
|
||||||
public decimal ConditionValue { get; set; }
|
public decimal ConditionValue { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -56,20 +56,15 @@ public class IntegrationMaterialRequest
|
||||||
[StringLength(30, ErrorMessage = "Plant description cannot exceed 30 characters.")]
|
[StringLength(30, ErrorMessage = "Plant description cannot exceed 30 characters.")]
|
||||||
public string PlantDescription { get; set; }
|
public string PlantDescription { get; set; }
|
||||||
|
|
||||||
[Required(ErrorMessage = "Storage location code is required.")]
|
public string? StorageLocationCode { get; set; }
|
||||||
[StringLength(4, ErrorMessage = "Storage location code cannot exceed 4 characters.")]
|
public string? StorageLocationDescription { get; set; }
|
||||||
public string StorageLocationCode { get; set; }
|
|
||||||
|
|
||||||
[Required(ErrorMessage = "Storage location description is required.")]
|
|
||||||
[StringLength(16, ErrorMessage = "Storage location description cannot exceed 16 characters.")]
|
|
||||||
public string StorageLocationDescription { get; set; }
|
|
||||||
|
|
||||||
[Required(ErrorMessage = "Sales Organization code is required.")]
|
[Required(ErrorMessage = "Sales Organization code is required.")]
|
||||||
[StringLength(4, ErrorMessage = "Sales Organization code cannot exceed 4 characters.")]
|
[StringLength(4, ErrorMessage = "Sales Organization code cannot exceed 4 characters.")]
|
||||||
public string SalesOrganization { get; set; }
|
public string SalesOrganization { get; set; }
|
||||||
|
|
||||||
[Required(ErrorMessage = "Sales Organization Description is required.")]
|
[Required(ErrorMessage = "Sales Organization Description is required.")]
|
||||||
[StringLength(16, ErrorMessage = "Sales Organization Description cannot exceed 16 characters.")]
|
[StringLength( 40, MinimumLength =1, ErrorMessage = "Sales Organization Description cannot exceed 40 characters.")]
|
||||||
public string SalesOrganizationDescription { get; set; }
|
public string SalesOrganizationDescription { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ public class SaveOrderPromotionRequest
|
||||||
public class GetOrderSummaryRequest : PagedRequest
|
public class GetOrderSummaryRequest : PagedRequest
|
||||||
{
|
{
|
||||||
public string? SalesOrgCode { get; set; }
|
public string? SalesOrgCode { get; set; }
|
||||||
public string? EmployerCode { get; set; }
|
public string? EmployeeCode { get; set; }
|
||||||
public string? OrderNo { get; set; }
|
public string? OrderNo { get; set; }
|
||||||
public string? UUID { get; set; }
|
public string? UUID { get; set; }
|
||||||
public string? CustomerCode { get; set; }
|
public string? CustomerCode { get; set; }
|
||||||
|
|
|
||||||
|
|
@ -1169,6 +1169,24 @@ public class IntegrationService : IIntegrationService
|
||||||
{
|
{
|
||||||
bool response = false;
|
bool response = false;
|
||||||
|
|
||||||
|
DataTable dtSlabs = new DataTable();
|
||||||
|
dtSlabs.Columns.Add("ScaleValue", typeof(decimal));
|
||||||
|
dtSlabs.Columns.Add("ValidFrom", typeof(DateTime));
|
||||||
|
dtSlabs.Columns.Add("ValidTo", typeof(DateTime));
|
||||||
|
dtSlabs.Columns.Add("Status", typeof(bool));
|
||||||
|
dtSlabs.Columns.Add("ConditionValue", typeof(decimal));
|
||||||
|
|
||||||
|
foreach (var item in request.Slabs)
|
||||||
|
{
|
||||||
|
DataRow dr = dtSlabs.NewRow();
|
||||||
|
dr["ScaleQty"] = item.ScaleValue;
|
||||||
|
dr["ValidFrom"] = item.ValidFrom;
|
||||||
|
dr["ValidTo"] = item.ValidTo;
|
||||||
|
dr["Status"] = item.Status;
|
||||||
|
dr["ConditionValue"] = item.ConditionValue;
|
||||||
|
dtSlabs.Rows.Add(dr);
|
||||||
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
SqlParameter[] p =
|
SqlParameter[] p =
|
||||||
|
|
@ -1182,10 +1200,7 @@ public class IntegrationService : IIntegrationService
|
||||||
SqlHelperExtension.CreateInParam("@CalculationType", SqlDbType.NVarChar, request.CalculationType),
|
SqlHelperExtension.CreateInParam("@CalculationType", SqlDbType.NVarChar, request.CalculationType),
|
||||||
SqlHelperExtension.CreateInParam("@PricingUnit", SqlDbType.NVarChar, request.PricingUnit),
|
SqlHelperExtension.CreateInParam("@PricingUnit", SqlDbType.NVarChar, request.PricingUnit),
|
||||||
SqlHelperExtension.CreateInParam("@UnitOfMeasure", SqlDbType.NVarChar, request.UnitOfMeasure),
|
SqlHelperExtension.CreateInParam("@UnitOfMeasure", SqlDbType.NVarChar, request.UnitOfMeasure),
|
||||||
SqlHelperExtension.CreateInParam("@ValidFrom", SqlDbType.DateTime, request.ValidFrom),
|
SqlHelperExtension.CreateInParam("@DiscountSlabItemType",SqlDbType.Structured, dtSlabs),
|
||||||
SqlHelperExtension.CreateInParam("@ValidTo", SqlDbType.DateTime, request.ValidTo),
|
|
||||||
SqlHelperExtension.CreateInParam("@Status", SqlDbType.NVarChar, request.Status),
|
|
||||||
SqlHelperExtension.CreateInParam("@ConditionValue", SqlDbType.Decimal, request.ConditionValue)
|
|
||||||
];
|
];
|
||||||
|
|
||||||
_ = tc.ExecuteNonQuerySp(spName: "dbo.InsertIntegrationMaterialPrice", parameterValues: p);
|
_ = tc.ExecuteNonQuerySp(spName: "dbo.InsertIntegrationMaterialPrice", parameterValues: p);
|
||||||
|
|
@ -1204,6 +1219,8 @@ public class IntegrationService : IIntegrationService
|
||||||
{
|
{
|
||||||
bool returnValue = false;
|
bool returnValue = false;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
SqlParameter[] p =
|
SqlParameter[] p =
|
||||||
|
|
@ -1217,10 +1234,10 @@ public class IntegrationService : IIntegrationService
|
||||||
SqlHelperExtension.CreateInParam("@CalculationType", SqlDbType.NVarChar, request.CalculationType),
|
SqlHelperExtension.CreateInParam("@CalculationType", SqlDbType.NVarChar, request.CalculationType),
|
||||||
SqlHelperExtension.CreateInParam("@PricingUnit", SqlDbType.NVarChar, request.PricingUnit),
|
SqlHelperExtension.CreateInParam("@PricingUnit", SqlDbType.NVarChar, request.PricingUnit),
|
||||||
SqlHelperExtension.CreateInParam("@UnitOfMeasure", SqlDbType.NVarChar, request.UnitOfMeasure),
|
SqlHelperExtension.CreateInParam("@UnitOfMeasure", SqlDbType.NVarChar, request.UnitOfMeasure),
|
||||||
SqlHelperExtension.CreateInParam("@ValidFrom", SqlDbType.DateTime, request.ValidFrom),
|
//SqlHelperExtension.CreateInParam("@ValidFrom", SqlDbType.DateTime, request.ValidFrom),
|
||||||
SqlHelperExtension.CreateInParam("@ValidTo", SqlDbType.DateTime, request.ValidTo),
|
//SqlHelperExtension.CreateInParam("@ValidTo", SqlDbType.DateTime, request.ValidTo),
|
||||||
SqlHelperExtension.CreateInParam("@Status", SqlDbType.NVarChar, request.Status),
|
//SqlHelperExtension.CreateInParam("@Status", SqlDbType.NVarChar, request.Status),
|
||||||
SqlHelperExtension.CreateInParam("@ConditionValue", SqlDbType.Decimal, request.ConditionValue)
|
//SqlHelperExtension.CreateInParam("@ConditionValue", SqlDbType.Decimal, request.ConditionValue)
|
||||||
];
|
];
|
||||||
|
|
||||||
_ = tc.ExecuteNonQuerySp(spName: "dbo.UpdateIntegrationMaterialPrice", parameterValues: p);
|
_ = tc.ExecuteNonQuerySp(spName: "dbo.UpdateIntegrationMaterialPrice", parameterValues: p);
|
||||||
|
|
|
||||||
|
|
@ -164,6 +164,7 @@ public class OrderService : IOrderService
|
||||||
response.UUID = request.UUID;
|
response.UUID = request.UUID;
|
||||||
response.OrderId = orderId;
|
response.OrderId = orderId;
|
||||||
response.OrderDate = existingOrder.OrderDate;
|
response.OrderDate = existingOrder.OrderDate;
|
||||||
|
response.OrderNo = existingOrder.OrderNo;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -711,7 +712,7 @@ public class OrderService : IOrderService
|
||||||
SqlParameter[] p =
|
SqlParameter[] p =
|
||||||
[
|
[
|
||||||
SqlHelperExtension.CreateInParam(pName: "@SalesOrgCode", pType: SqlDbType.VarChar, pValue:request.SalesOrgCode) ,
|
SqlHelperExtension.CreateInParam(pName: "@SalesOrgCode", pType: SqlDbType.VarChar, pValue:request.SalesOrgCode) ,
|
||||||
SqlHelperExtension.CreateInParam(pName: "@EmployeeCode", pType: SqlDbType.VarChar, pValue:request.EmployerCode) ,
|
SqlHelperExtension.CreateInParam(pName: "@EmployeeCode", pType: SqlDbType.VarChar, pValue:request.EmployeeCode) ,
|
||||||
SqlHelperExtension.CreateInParam(pName: "@OrderNo", pType: SqlDbType.VarChar, pValue: request.OrderNo ),
|
SqlHelperExtension.CreateInParam(pName: "@OrderNo", pType: SqlDbType.VarChar, pValue: request.OrderNo ),
|
||||||
SqlHelperExtension.CreateInParam(pName: "@UUID", pType: SqlDbType.VarChar, pValue: request.UUID ),
|
SqlHelperExtension.CreateInParam(pName: "@UUID", pType: SqlDbType.VarChar, pValue: request.UUID ),
|
||||||
SqlHelperExtension.CreateInParam(pName: "@CustomerCode", pType: SqlDbType.VarChar, pValue: request.CustomerCode ),
|
SqlHelperExtension.CreateInParam(pName: "@CustomerCode", pType: SqlDbType.VarChar, pValue: request.CustomerCode ),
|
||||||
|
|
|
||||||
|
|
@ -318,7 +318,7 @@ namespace OnlineSalesAutoCrop.CoreAPI
|
||||||
config.UseSimpleAssemblyNameTypeSerializer();
|
config.UseSimpleAssemblyNameTypeSerializer();
|
||||||
config.UseRecommendedSerializerSettings();
|
config.UseRecommendedSerializerSettings();
|
||||||
|
|
||||||
config.UseSqlServerStorage(_appSettings.HangfireDb, new SqlServerStorageOptions
|
config.UseSqlServerStorage(_appSettings.HangfireDb, new SqlServerStorageOptions
|
||||||
{
|
{
|
||||||
DisableGlobalLocks = true,
|
DisableGlobalLocks = true,
|
||||||
QueuePollInterval = TimeSpan.Zero,
|
QueuePollInterval = TimeSpan.Zero,
|
||||||
|
|
@ -327,10 +327,10 @@ namespace OnlineSalesAutoCrop.CoreAPI
|
||||||
SlidingInvisibilityTimeout = TimeSpan.FromMinutes(5)
|
SlidingInvisibilityTimeout = TimeSpan.FromMinutes(5)
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
services.AddHangfireServer(options =>
|
services.AddHangfireServer(options =>
|
||||||
{
|
{
|
||||||
options.Queues = new[] { "sap_order_send", "default" }; // merge with any queues you already have
|
options.Queues = new[] { "sap_order_send", "default" }; // merge with any queues you already have
|
||||||
}); ;
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -546,11 +546,11 @@ namespace OnlineSalesAutoCrop.CoreAPI
|
||||||
|
|
||||||
RecurringJobOptions options = new() { TimeZone = TimeZoneInfo.Local, MisfireHandling = MisfireHandlingMode.Relaxed };
|
RecurringJobOptions options = new() { TimeZone = TimeZoneInfo.Local, MisfireHandling = MisfireHandlingMode.Relaxed };
|
||||||
|
|
||||||
RecurringJob.AddOrUpdate<IBackgroundJobService>(
|
RecurringJob.AddOrUpdate<IBackgroundJobService>(
|
||||||
"send-sap-orders",
|
"send-sap-orders",
|
||||||
service => service.ExecuteSendingOrderAsync(CancellationToken.None),
|
service => service.ExecuteSendingOrderAsync(CancellationToken.None),
|
||||||
"*/1 * * * *");
|
"*/1 * * * *");
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user