示例#1
0
        public async Task <ApiResult <string> > UpsertPOAPLPOSku(MMS.PO.Events.MMSPOSkuEvent model)
        {
            try
            {
                string ponumber = model.PONumber;
                _logger.LogInformation("Passed in {PONumber}.", model.PONumber);

                _logger.LogDebug("Fetching existing data for {PONumber}", ponumber);
                var existing = await GetExistingPO(ponumber);

                if (existing.POAPL != null)
                {
                    //if (existing.POAPL.CheckPoStatus())//filter conditions
                    //{
                    existing.POAPL = model.MapEventtoOutput(existing.POAPL);

                    _logger.LogDebug("Going to update data for {PONumber} in elastic", ponumber);
                    var response = await _getDataService.UpdateItem <POAPLLOutput>(existing.POAPL, _poIndex);

                    _logger.LogDebug("Updated data for {PONumber} in elastic", ponumber);
                    //}
                }

                return(new ApiResult <string>());
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, "UpsertPOAPLPOSku-Failed Updating APLPO: {Reason}", ex.Message);
                return(new ApiResult <string>(new[] { ex.Message }));
            }
        }
        public async Task <ApiResult <string> > UpsertPOContempoPOSku(MMS.PO.Events.MMSPOSkuEvent model)
        {
            try
            {
                string ponumber = model.PONumber;
                _logger.LogInformation("Passed in {PONumber}.", model.PONumber);

                _logger.LogDebug("Fetching existing data for {PONumber}", ponumber);
                var existing = await GetExistingPO(ponumber);

                if (existing.poContempo != null)
                {
                    existing.poContempo = model.MapEventtoOutput(existing.poContempo);

                    if (existing.poContempo.POSkus != null && existing.poContempo.POSkus.Count > 0)
                    {
                        _logger.LogDebug("Going to update data for {PONumber} in elastic", ponumber);
                        var response = await _getDataService.UpdateItem <POContempoOutput>(existing.poContempo, _poIndex);

                        _logger.LogDebug("Updated data for {PONumber} in elastic", ponumber);
                    }
                    else
                    {
                        _logger.LogDebug("No SKUs found for {PONumber}. PO Data not updated in elastic.", ponumber);
                    }
                }
                return(new ApiResult <string>());
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, "UpsertPOContempoPOSku - Failed Updating ContempoPO: {Reason}", ex.Message);
                return(new ApiResult <string>(new[] { ex.Message }));
            }
        }
示例#3
0
        public async Task <ApiResult <string> > UpsertPOChinoPOSku(MMS.PO.Events.MMSPOSkuEvent model)
        {
            try
            {
                string ponumber = model.PONumber;
                _logger.LogInformation("Passed in {PONumber}.", model.PONumber);

                _logger.LogDebug("Fetching existing data for {PONumber}", ponumber);
                var existing = await GetExistingPO(ponumber);

                if (existing.POChino != null)
                {
                    existing.POChino = model.MapEventtoOutput(existing.POChino);
                    if (existing.POChino.POSkus != null && existing.POChino.POSkus.Count > 0)
                    {
                        existing.POChino.POSkus = existing.POChino.POSkus.FindAll(x => Convert.ToInt32(x.OrderQty) > 0);
                    }
                    _logger.LogDebug("Going to update data for {PONumber} in elastic", ponumber);

                    var response = await _getDataService.UpdateItem <POChinoOutput>(existing.POChino, _index);

                    _logger.LogDebug("Updated data for {PONumber} in elastic", ponumber);
                    //}
                }
                return(new ApiResult <string>());
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, "UpsertPOChinoPOSku-Failed Updating APLPO: {Reason}", ex.Message);
                return(new ApiResult <string>(new[] { ex.Message }));
            }
        }