Exemple #1
0
        public void UpdatePositionIm(PositionIm positionIm, OrderPositionData opd, DbTransaction dbTran)
        {
            if (NeedReCreatePositionIm(positionIm, opd.FormatData.Id))
            {
                DeletePositionIm(positionIm, dbTran);
                CreatePositionIm(positionIm.OrderPosition.Order.BusinessUnitId, opd.OrderId, opd.OrderPositionId, opd, dbTran);
                return;
            }

            if (_stringProcessor.CanUpdateString(positionIm))
            {
                positionIm = _repository.SetPositionIm(positionIm, newTaskFile: false, newMaketFile: false, isActual: true, dbTran);
                _stringProcessor.UpdateFullString(positionIm.OrderPositionId, opd.StringData, dbTran);
            }

            if (_moduleMaketProcessor.CanUpdateModule(positionIm))
            {
                positionIm = _repository.SetPositionIm(positionIm, newTaskFile: true, newMaketFile: false, isActual: true, dbTran);

                // Обновляем графические материалы позиции ИМ-а
                var taskFileDate = (DateTime)positionIm.TaskFileDate;
                var bytes        = Base64ToBytesConverter.Convert(opd.ModuleData.Base64String);

                _moduleMaketProcessor.CreateSampleImage(positionIm.OrderPositionId, bytes, "ImgTask", taskFileDate);
                _moduleMaketProcessor.UpdateModuleGraphics(positionIm.OrderPositionId, bytes, opd.ModuleData.Name);
            }
        }