Merge branch 'master' of http://115.159.85.185:8098/r/ZhongRui/ALDbanyunxiangmu
| | |
| | | const editFormOptions = ref([ |
| | | [ |
| | | { |
| | | title: "åæ®ç±»å", |
| | | required: true, |
| | | field: "orderType", |
| | | type: "select", |
| | | dataKey: "outOrderType", |
| | | data: [], |
| | | }, |
| | | { |
| | | field: "orderNo", |
| | | title: "åæ®ç¼å·", |
| | | type: "string", |
| | |
| | | readonly: true, |
| | | }, |
| | | { |
| | | title: "ä»åº", |
| | | field: "warehouseId", |
| | | type: "select", |
| | | dataKey: "warehouses", |
| | | data: [], |
| | | required: true, |
| | | title: "ååº", |
| | | field: "factoryArea", |
| | | type: "string", |
| | | }, |
| | | ], |
| | | [ |
| | | { |
| | | title: "夿³¨", |
| | | field: "remark", |
| | | type: "textarea", |
| | | }, |
| | | { |
| | | title: "ä¸å¡ç±»å", |
| | | field: "businessType", |
| | | type: "select", |
| | | dataKey: "businessType", |
| | | data: [], |
| | | require: true, |
| | | }, |
| | | { |
| | | title: "æ¯å¦åæ¹", |
| | | field: "isBatch", |
| | | type: "select", |
| | | dataKey: "enable", |
| | | data: [], |
| | | require: true, |
| | | }, |
| | | { |
| | | title: "æä½è
", |
| | | field: "operator", |
| | | type: "string", |
| | | }, |
| | | ], |
| | | ]); |
| | |
| | | type: "string", |
| | | width: 160, |
| | | align: "left", |
| | | // link: true, |
| | | link: true, |
| | | }, |
| | | { |
| | | field: "upperOrderNo", |
| | |
| | | ]); |
| | | const detail = ref({ |
| | | cnName: "åºåºæç»å", |
| | | table: "OnboundOrderDetail", |
| | | table: "Details", |
| | | columns: [ |
| | | { |
| | | field: "id", |
| | |
| | | required: true, |
| | | }, |
| | | { |
| | | field: "rowNo", |
| | | field: "lineNo", |
| | | title: "è¡å·", |
| | | type: "string", |
| | | width: 90, |
| | | align: "left", |
| | | edit: { type: "number" }, |
| | | required: true, |
| | | }, |
| | | { |
| | | field: "rowNo", |
| | | title: "è¡å·2", |
| | | type: "int", |
| | | width: 90, |
| | | align: "left", |
| | | edit: { type: "number" }, |
| | | }, |
| | | { |
| | | field: "lockQuantity", |
| | |
| | | type: "string", |
| | | width: 180, |
| | | align: "left", |
| | | edit: { type: "select" }, |
| | | bind: { key: "orderDetailStatusEnum", data: [] }, |
| | | required: true, |
| | | }, |
| | | { |
| | | field: "creater", |
| | |
| | | using SqlSugar.Extensions; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Dynamic; |
| | | using System.Linq; |
| | | using System.Reflection; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Common.AllocateEnum; |
| | |
| | | using WIDESEA_Core.CodeConfigEnum; |
| | | using WIDESEA_Core.DB; |
| | | using WIDESEA_Core.Enums; |
| | | using WIDESEA_Core.Helper; |
| | | using WIDESEA_Core.Seed; |
| | | using WIDESEA_IAllocateService; |
| | | using WIDESEA_IInboundService; |
| | |
| | | public readonly IRepository<Dt_AllocateOrder> _allocateOrderRepository; |
| | | public readonly IRepository<Dt_AllocateOrderDetail> _allocateOrderDetailRepository; |
| | | |
| | | public readonly IRepository<Dt_InboundOrderDetail> _inboundOrderDetailRepository; |
| | | |
| | | private readonly ILogger<AllocateService> _logger; |
| | | public AllocateService(IRepository<Dt_AllocateOrder> BaseDal, |
| | | IUnitOfWorkManage unitOfWorkManage, |
| | |
| | | IOutboundService outboundService, |
| | | IRepository<Dt_AllocateOrder> allocateOrderRepository, |
| | | IRepository<Dt_AllocateOrderDetail> allocateOrderDetailRepository, |
| | | IRepository<Dt_InboundOrderDetail> inboundOrderDetailRepository, |
| | | ILogger<AllocateService> logger) : base(BaseDal) |
| | | { |
| | | _unitOfWorkManage = unitOfWorkManage; |
| | |
| | | _allocateOrderRepository = allocateOrderRepository; |
| | | _allocateOrderDetailRepository = allocateOrderDetailRepository; |
| | | _logger = logger; |
| | | _inboundOrderDetailRepository = inboundOrderDetailRepository; |
| | | } |
| | | |
| | | public IRepository<Dt_AllocateOrder> Repository => BaseDal; |
| | |
| | | { |
| | | if (businessType == BusinessTypeEnum.å¤é¨ä»åºè°æºä») |
| | | { |
| | | allocateOrder.OrderType = InOrderTypeEnum.AllocatInbound.ObjToInt(); |
| | | allocateOrder.OrderType = (int)InOrderTypeEnum.AllocatInbound; |
| | | var inboundOrders = ConvertToInboundOrders(allocateOrder); |
| | | await _inboundService.InbounOrderService.ReceiveInboundOrder(inboundOrders, 1); |
| | | } |
| | |
| | | { |
| | | if (businessType == BusinessTypeEnum.æºä»è°å¤é¨ä»åº) |
| | | { |
| | | allocateOrder.OrderType = InOrderTypeEnum.AllocatOutbound.ObjToInt(); |
| | | allocateOrder.OrderType = (int)InOrderTypeEnum.AllocatOutbound; |
| | | } |
| | | else if (businessType == BusinessTypeEnum.æºä»è°æºä») |
| | | { |
| | | allocateOrder.OrderType = InOrderTypeEnum.InternalAllocat.ObjToInt(); |
| | | allocateOrder.OrderType = (int)InOrderTypeEnum.InternalAllocat; |
| | | } |
| | | |
| | | var outboundOrders = ConvertToOutboundOrders(allocateOrder); |
| | |
| | | return code; |
| | | } |
| | | } |
| | | |
| | | public override PageGridData<Dt_InboundOrderDetail> GetDetailPage(PageDataOptions options) |
| | | { |
| | | string wheres = ValidatePageOptions(options); |
| | | //è·åæåºå段 |
| | | Dictionary<string, SqlSugar.OrderByType> orderbyDic = GetPageDataSort(options, TProperties); |
| | | List<OrderByModel> orderByModels = new List<OrderByModel>(); |
| | | foreach (var item in orderbyDic) |
| | | { |
| | | OrderByModel orderByModel = new() |
| | | { |
| | | FieldName = item.Key, |
| | | OrderByType = item.Value |
| | | }; |
| | | orderByModels.Add(orderByModel); |
| | | } |
| | | |
| | | |
| | | int totalCount = 0; |
| | | List<SearchParameters> searchParametersList = new List<SearchParameters>(); |
| | | if (!string.IsNullOrEmpty(options.Wheres)) |
| | | { |
| | | try |
| | | { |
| | | searchParametersList = options.Wheres.DeserializeObject<List<SearchParameters>>(); |
| | | options.Filter = searchParametersList; |
| | | } |
| | | catch { } |
| | | } |
| | | //var data = BaseDal.Db.Queryable<Dt_AllocateOrderDetail>() |
| | | // .WhereIF(!wheres.IsNullOrEmpty(), wheres) |
| | | // .OrderBy(orderByModels) |
| | | // .ToPageList(options.Page, options.Rows, ref totalCount); |
| | | //Dt_AllocateOrder allocateOrder = _allocateOrderRepository.QueryFirst(x => x.Id == (int)options.Value); |
| | | //Dt_InboundOrder _InboundOrder = SqlSugarHelper.DbWMS.Queryable<Dt_InboundOrder>().Where(x => x.UpperOrderNo == allocateOrder.UpperOrderNo).First(); |
| | | //var details = _inboundOrderDetailRepository.QueryData(x => x.OrderId == _InboundOrder.Id ); |
| | | //foreach (var item in data) |
| | | //{ |
| | | // var detail = details.Where(x => x.MaterielCode == item.MaterielCode).FirstOrDefault(); |
| | | // if (detail != null) |
| | | // { |
| | | // item.OrderQuantity = detail.OrderQuantity; |
| | | // item.ReceiptQuantity = detail.ReceiptQuantity; |
| | | // item.OverInQuantity = detail.OverInQuantity; |
| | | // item.OrderDetailStatus = detail.OrderDetailStatus; |
| | | // } |
| | | //} |
| | | //return new PageGridData<Dt_AllocateOrderDetail>(totalCount, data); |
| | | |
| | | Dt_AllocateOrder allocateOrder = _allocateOrderRepository.QueryFirst(x => x.Id == (int)options.Value); |
| | | Dt_InboundOrder _InboundOrder = SqlSugarHelper.DbWMS.Queryable<Dt_InboundOrder>().Where(x => x.UpperOrderNo == allocateOrder.UpperOrderNo).First(); |
| | | |
| | | var data = BaseDal.Db.Queryable<Dt_InboundOrderDetail>() |
| | | .WhereIF(!wheres.IsNullOrEmpty(), wheres) |
| | | .WhereIF(!_InboundOrder.IsNullOrEmpty(), x => x.OrderId == _InboundOrder.Id) |
| | | .OrderBy(orderByModels) |
| | | .ToPageList(options.Page, options.Rows, ref totalCount); |
| | | |
| | | |
| | | return new PageGridData<Dt_InboundOrderDetail>(totalCount, data); |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | protected string ValidatePageOptions(PageDataOptions options) |
| | | { |
| | | options = options ?? new PageDataOptions(); |
| | | string where = ""; |
| | | List<SearchParameters> searchParametersList = new List<SearchParameters>(); |
| | | if (options.Filter != null && options.Filter.Count > 0) |
| | | { |
| | | searchParametersList.AddRange(options.Filter); |
| | | } |
| | | else if (!string.IsNullOrEmpty(options.Wheres)) |
| | | { |
| | | try |
| | | { |
| | | searchParametersList = options.Wheres.DeserializeObject<List<SearchParameters>>(); |
| | | options.Filter = searchParametersList; |
| | | } |
| | | catch { } |
| | | } |
| | | QueryRelativeList?.Invoke(searchParametersList); |
| | | |
| | | for (int i = 0; i < searchParametersList.Count; i++) |
| | | { |
| | | if (string.IsNullOrEmpty(searchParametersList[i].Value)) |
| | | { |
| | | continue; |
| | | } |
| | | |
| | | PropertyInfo property = TProperties.Where(c => c.Name.ToUpper() == searchParametersList[i].Name.ToUpper()).FirstOrDefault(); |
| | | |
| | | if (property == null) continue; |
| | | |
| | | (bool, string, object) result = property.ValidationVal(searchParametersList[i].Value); |
| | | if (!result.Item1) |
| | | { |
| | | continue; |
| | | } |
| | | |
| | | LinqExpressionType expressionType = searchParametersList[i].DisplayType.GetLinqCondition(); |
| | | if (expressionType == LinqExpressionType.Equal) |
| | | { |
| | | if (string.IsNullOrEmpty(where)) |
| | | { |
| | | // é对å符串类åçåæ®µä½¿ç¨æ¨¡ç³æ¥è¯¢ |
| | | //where += $"{searchParametersList[i].Name} like '%{searchParametersList[i].Value}%'"; |
| | | if (searchParametersList[i].Value.ToLower() == "true" || searchParametersList[i].Value.ToLower() == "false") |
| | | { |
| | | where += $" {searchParametersList[i].Name} = '{searchParametersList[i].Value.ToLower()}'"; |
| | | } |
| | | else |
| | | { |
| | | where += $"[{searchParametersList[i].Name}] like '%{searchParametersList[i].Value}%'"; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | // é对å¸å°ç±»ååæ®µè¿è¡ç²¾ç¡®æ¥è¯¢ |
| | | if (searchParametersList[i].Value.ToLower() == "true" || searchParametersList[i].Value.ToLower() == "false") |
| | | { |
| | | where += $" and {searchParametersList[i].Name} = '{searchParametersList[i].Value.ToLower()}'"; |
| | | } |
| | | else |
| | | { |
| | | where += $" and [{searchParametersList[i].Name}] like '%{searchParametersList[i].Value}%'"; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (searchParametersList[i].DisplayType.GetLinqCondition() == LinqExpressionType.ThanOrEqual) |
| | | { |
| | | if (string.IsNullOrEmpty(where)) |
| | | where += $"{searchParametersList[i].Name} >= '{searchParametersList[i].Value}'"; |
| | | else |
| | | where += $" and {searchParametersList[i].Name} {searchParametersList[i].DisplayType.GetLinqCondition()} '{searchParametersList[i].Value}'"; |
| | | } |
| | | else if (searchParametersList[i].DisplayType.GetLinqCondition() == LinqExpressionType.LessThanOrEqual) |
| | | { |
| | | if (string.IsNullOrEmpty(where)) |
| | | where += $"{searchParametersList[i].Name} <= '{searchParametersList[i].Value}'"; |
| | | else |
| | | where += $" and {searchParametersList[i].Name} <= '{searchParametersList[i].Value}'"; |
| | | } |
| | | else |
| | | { |
| | | if (string.IsNullOrEmpty(where)) |
| | | where += $"{searchParametersList[i].Name} {searchParametersList[i].DisplayType} '{searchParametersList[i].Value}'"; |
| | | else |
| | | where += $" and {searchParametersList[i].Name} {searchParametersList[i].DisplayType} '{searchParametersList[i].Value}'"; |
| | | } |
| | | } |
| | | } |
| | | return where; |
| | | } |
| | | |
| | | protected Expression<Func<TEntity, bool>> GetWhereExpression(string propertyName, object propertyValue, ParameterExpression parameter, LinqExpressionType expressionType) |
| | | { |
| | | Type? proType = typeof(TEntity).GetProperty(propertyName)?.PropertyType; |
| | |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Core.Const; |
| | | using WIDESEA_Core.Helper; |
| | | using WIDESEA_Core.Seed; |
| | | using WIDESEA_Core.Tenants; |
| | | |
| | | namespace WIDESEA_Core.DB |
| | |
| | | { |
| | | Connection = AppSettings.Get(MainDb.ConnectionString).DecryptDES(AppSecret.DB), |
| | | ConnId = MainDb.CurrentDbConnId, |
| | | DbType = DataBaseType.SqlServer |
| | | DbType = DBContext.DbType, |
| | | }; |
| | | listdatabaseSlaveDB.Add(mainDb); |
| | | for (int i = 0; i < list.Count; i++) |
| | |
| | | { |
| | | Connection = data.ConnectionString, |
| | | ConnId = data.TenantId + "", |
| | | DbType = (DataBaseType)data.DbType, |
| | | DbType = data.DbType, |
| | | }; |
| | | mutiDBOperate.Connection = mutiDBOperate.Connection.DecryptDES(AppSecret.DB); |
| | | listdatabaseSlaveDB.Add(mutiDBOperate); |
| | |
| | | /// <summary> |
| | | /// æ°æ®åºç±»å |
| | | /// </summary> |
| | | public DataBaseType DbType { get; set; } |
| | | public DbType DbType { get; set; } |
| | | } |
| | | } |
| | |
| | | { |
| | | var memoryCache = o.GetRequiredService<IMemoryCache>(); |
| | | |
| | | // è¿æ¥å符串 |
| | | var listConfig = new List<ConnectionConfig> |
| | | { |
| | | new ConnectionConfig |
| | |
| | | ConfigId = MainDb.CurrentDbConnId, |
| | | ConnectionString = DBContext.GetMainConnectionDb().Connection, |
| | | IsAutoCloseConnection = true, |
| | | DbType = MainDb.DbType, |
| | | //DbType = MainDb.DbType, |
| | | DbType = DBContext.GetMainConnectionDb().DbType, |
| | | |
| | | AopEvents = new AopEvents |
| | | { |
| | | OnLogExecuting = (sql, p) => |
| | |
| | | Parallel.For(0, 1, e => |
| | | { |
| | | MiniProfiler.Current.CustomTiming("SQLï¼", GetParas(p) + "ãSQLè¯å¥ãï¼" + sql); |
| | | |
| | | |
| | | }); |
| | | if(AppSettings.GetValue("PrintSql").ObjToBool()) |
| | | { |
| | |
| | | using SqlSugar; |
| | | using Microsoft.Extensions.Logging; |
| | | using SqlSugar; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | |
| | | /// </summary> |
| | | public static MutiDBOperate GetMainConnectionDb() |
| | | { |
| | | MutiDBOperate mainDb = new MutiDBOperate() |
| | | string dbType = AppSettings.GetValue("DBType"); |
| | | if(Enum.TryParse(typeof(DbType),dbType,out object? result) && result != null) |
| | | { |
| | | Connection = AppSettings.Get(MainDb.ConnectionString).DecryptDES(AppSecret.DB), |
| | | ConnId = MainDb.CurrentDbConnId, |
| | | DbType = DataBaseType.SqlServer |
| | | }; |
| | | DbType dataBaseType = (DbType)result; |
| | | MutiDBOperate mainDb = new MutiDBOperate() |
| | | { |
| | | Connection = AppSettings.Get(MainDb.ConnectionString).DecryptDES(AppSecret.DB), |
| | | ConnId = MainDb.CurrentDbConnId, |
| | | DbType = dataBaseType |
| | | }; |
| | | return mainDb; |
| | | } |
| | | else |
| | | { |
| | | throw new Exception("æ°æ®åºè¿æ¥é
ç½®é误"); |
| | | } |
| | | |
| | | return mainDb; |
| | | //MutiDBOperate mainDb = new MutiDBOperate() |
| | | //{ |
| | | // Connection = AppSettings.Get(MainDb.ConnectionString).DecryptDES(AppSecret.DB), |
| | | // ConnId = MainDb.CurrentDbConnId, |
| | | // DbType = DataBaseType.SqlServer |
| | | //}; |
| | | |
| | | //return mainDb; |
| | | } |
| | | /// <summary> |
| | | /// è¿æ¥å符串 |
| | |
| | | using AutoMapper; |
| | | using SqlSugar; |
| | | using System.Dynamic; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Common.CommonEnum; |
| | | using WIDESEA_Common.OrderEnum; |
| | |
| | | /// åæ®ç¼å· |
| | | /// </summary> |
| | | [CodeRule(RuleCodeEnum.OutboundOrderRule)] |
| | | [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "åæ®ç¼å·", IsOnlyIgnoreUpdate = true)] |
| | | [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "åæ®ç¼å·")] |
| | | public string OrderNo { get; set; } |
| | | |
| | | /// <summary> |
| | |
| | | /// è¡å· |
| | | /// é»è®¤å¼: |
| | | ///</summary> |
| | | [SugarColumn(ColumnName = "lineNo", ColumnDescription = "è¡å·")] |
| | | [SugarColumn(ColumnName = "lineNo", ColumnDescription = "è¡å·", DefaultValue= "0")] |
| | | public string? lineNo { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æªææ°é |
| | | /// é»è®¤å¼: |
| | | ///</summary> |
| | | [SugarColumn(ColumnName = "MoveQty", ColumnDescription = "æªææ°é")] |
| | | [SugarColumn(ColumnName = "MoveQty", ColumnDescription = "æªææ°é",IsNullable = true)] |
| | | public decimal MoveQty { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä¾åºåç¼å· |
| | | /// é»è®¤å¼: |
| | | ///</summary> |
| | | [SugarColumn(ColumnName = "supplyCode", ColumnDescription = "ä¾åºåç¼å·")] |
| | | [SugarColumn(ColumnName = "supplyCode", ColumnDescription = "ä¾åºåç¼å·", IsNullable = true)] |
| | | public string? SupplyCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ°é |
| | | /// é»è®¤å¼: |
| | | ///</summary> |
| | | [SugarColumn(ColumnName = "barcodeQty", ColumnDescription = "æ°é")] |
| | | [SugarColumn(ColumnName = "barcodeQty", ColumnDescription = "æ°é", DefaultValue = "0", IsNullable = true)] |
| | | public decimal BarcodeQty { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åä½ |
| | | /// é»è®¤å¼: |
| | | ///</summary> |
| | | [SugarColumn(ColumnName = "barcodeUnit", ColumnDescription = "åä½")] |
| | | [SugarColumn(ColumnName = "barcodeUnit", ColumnDescription = "åä½", IsNullable = true )] |
| | | public string BarcodeUnit { get; set; } = null!; |
| | | |
| | | |
| | |
| | | /// |
| | | /// é»è®¤å¼: |
| | | ///</summary> |
| | | [SugarColumn(ColumnName = "barcodemoveQty", ColumnDescription = "æ°é")] |
| | | [SugarColumn(ColumnName = "barcodemoveQty", ColumnDescription = "æ°é" , DefaultValue = "0", IsNullable = true)] |
| | | public decimal BarcodeMoveQty { get; set; } |
| | | /// <summary> |
| | | /// ä»åº |
| | | /// é»è®¤å¼: |
| | | ///</summary> |
| | | [SugarColumn(ColumnName = "warehouseCode", ColumnDescription = "ä»åº")] |
| | | [SugarColumn(ColumnName = "warehouseCode", ColumnDescription = "ä»åº", IsNullable = true)] |
| | | public string? WarehouseCode { get; set; } |
| | | |
| | | /// <summary> |
| | |
| | | [SugarColumn(IsIgnore = true)] |
| | | public decimal NeedOutQuantity => OrderQuantity - MoveQty; |
| | | |
| | | [SugarColumn(IsNullable = true, ColumnDescription = "")] |
| | | public decimal PickedQty { get; set; } |
| | | |
| | | [SugarColumn(IsNullable = true, ColumnDescription = "")] |
| | | public string documentsNO { get; set; } |
| | | |
| | | [SugarColumn(IsNullable = true, ColumnDescription = "")] |
| | | public decimal AllocatedQuantity { get; set; } |
| | | |
| | | [SugarColumn(IsNullable = true, ColumnDescription = "")] |
| | | public int BatchAllocateStatus { get; set; } |
| | | |
| | | /// <summary> |
| | | /// èæåºå
¥åºæ°é |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, ColumnDescription = "èæåºå
¥åºæ°é")] |
| | | public decimal NoStockOutQty { get; set; } |
| | | |
| | | } |
| | |
| | | business_type = outboundOrder.BusinessType, |
| | | factoryArea = outboundOrder.FactoryArea, |
| | | operationType = 1, |
| | | Operator = outboundOrder.Operator, |
| | | Operator = App.User.UserName, |
| | | orderNo = outboundOrder.UpperOrderNo, |
| | | documentsNO = outboundOrder.OrderNo, |
| | | status = outboundOrder.OrderStatus, |