private void ProcessBatchCode(string batchCode, IWBPosInput target, bool onlyParse, Action <CompleteContext> completedHandler) { var batch = GetBatch(); if (batch == null) { ShowError("Для принимаемой позиции не удалось определить алгоритм распознования batch-кода."); return; } if (string.IsNullOrEmpty(batch.WorkflowCode)) { ShowError(string.Format("Для принимаемой позиции найден алгоритм ({0}), но в нём не указана реализация.", batch.GetKey())); return; } var bpContext = new BpContext(); bpContext.Set("BatchCode", batchCode); bpContext.Set("Target", target); bpContext.Set("OnlyParse", onlyParse); bpContext.Set <string>("ParseResult", null); var executionContext = new ExecutionContext(batch.WorkflowCode, new Dictionary <string, object> { { BpContext.BpContextArgumentName, bpContext } }); var engine = IoC.Instance.Resolve <IProcessExecutorEngine>(WorkflowProcessExecutorConstants.Workflow); engine.Run(context: executionContext, completedHandler: completedHandler); }
public AcceptanceItemInfo(IWBPosInput iwbPosInput) { if (iwbPosInput == null) { return; } try { SuspendNotifications(); Copy(iwbPosInput, this); if (iwbPosInput.PlaceCode != null) { Place = new EntityReference(iwbPosInput.PlaceCode, wmsMLC.Business.Objects.Place.EntityType, new[] { new EntityReferenceFieldValue("PlaceCode", iwbPosInput.PlaceCode), // пока нет виртуалки на имя места - не можем построить нормальный EntityReference. Подставляем пока PlaceCode new EntityReferenceFieldValue("PlaceName", iwbPosInput.PlaceCode) }); } AcceptChanges(); } finally { ResumeNotifications(); } }
private MessageBoxResult AskBlocking(IWBPosInput item, DateTime planDate, string defaultBlock = null) { var field = IWBPosInput.IWBPosBlockingPropertyName; // формируем поля дозапроса var values = new List <ValueDataField> { new ValueDataField { Name = "desc", FieldName = "desc", SourceName = "desc", FieldType = typeof(string), LabelPosition = "Top", IsEnabled = false, Value = ExpDateMessage(planDate, item) + " Укажите блокировку?" }, new ValueDataField { Name = field, FieldName = field, SourceName = field, Caption = "Блокировка", FieldType = typeof(string), LabelPosition = "Top", LookupCode = "_PRODUCTBLOCKING_PRODUCT", Value = string.IsNullOrEmpty(item.IWBPosBlocking) ? defaultBlock : item.IWBPosBlocking } }; var model = new ExpandoObjectViewModelBase { Fields = new ObservableCollection <ValueDataField>(values), PanelCaption = "Блокировка по сроку годности" }; bool?dr; while (true) { dr = _viewService.ShowDialogWindow(model, true, buttons: MessageBoxButton.YesNoCancel, width: "30%"); if (dr != true) { break; } var blockingCode = model[field] as string; if (string.IsNullOrEmpty(blockingCode)) { _viewService.ShowDialog("Ошибка", "Поле 'Блокировка' не может быть пустым", MessageBoxButton.OK, MessageBoxImage.Warning, MessageBoxResult.OK); } else { item.IWBPosBlocking = blockingCode; return(MessageBoxResult.Yes); } } return(dr == false ? MessageBoxResult.No : MessageBoxResult.Cancel); }
public void ValidateCollectionTest() { var item = new IWBPosInput(); item.Validate(); item.QLFDetailL = new WMSBusinessCollection <IWBPosQLFDetailDesc>(); item.QLFCODE_R = IWBPosInput.QlfTypeDefect; item.QLFDetailL.Add(new IWBPosQLFDetailDesc()); item.QLFDetailL.Add(new IWBPosQLFDetailDesc()); item.Validator.Errors.Should().NotBeNull(); item.Validator.Errors.Should().HaveCount(1); item.QLFCODE_R = ""; item.Validator.Errors.Should().BeEmpty(); }
private void CalculateSkuIndex(IWBPosInput obj, decimal skuIndex1, decimal skuIndex2) { obj.IwbPosCountDouble = (double)skuIndex1; obj.ProductCountSkuDouble = obj.ProductCountSkuDouble * (double)skuIndex2; obj.IwbPosCountDouble = DeltaSku(obj.IwbPosCountDouble); obj.ProductCountSkuDouble = DeltaSku(obj.ProductCountSkuDouble); obj.IWBPosCount = obj.IwbPosCountDouble; obj.ProductCountSKU = obj.ProductCountSkuDouble; obj.RemainCount = obj.IwbPosCountDouble - obj.ProductCountSkuDouble > 0 ? DeltaSku(obj.IwbPosCountDouble - obj.ProductCountSkuDouble) : 0; // запоминаем актуальное значение, для перевода в другую SKU obj.RequiredSKUCount = (decimal)DeltaSku(obj.RemainCount.Value); }
public IwbPosInputErrorInfo(IWBPosInput iwbPosInput) { if (iwbPosInput == null) { return; } try { SuspendNotifications(); Copy(iwbPosInput, this); AcceptChanges(); } finally { ResumeNotifications(); } }
private static string GetSkipMessage(IWBPosInput item) { return(string.Format("По позиции с кодом '{0}' ед.уч. '{1}' товар не принят:", item.GetKey(), item.SKUNAME)); }
private static string ExpDateMessage(DateTime planDate, IWBPosInput item) { return(string.Format( "Позиция '{0}' ед.уч. '{1}' имеет срок годности '{2:dd.MM.yyyy}' меньший минимально допустимого {3:dd.MM.yyyy}.", item.GetKey(), item.SKUNAME, item.IWBPosExpiryDate.Value, planDate)); }
private MessageBoxResult AskQualifi(IWBPosInput item, DateTime planDate, string defaultQlf = null) { const string field = IWBPosInput.QLFCodePropertyName; // формируем поля дозапроса var values = new List <ValueDataField> { new ValueDataField { Name = "desc", FieldName = "desc", SourceName = "desc", FieldType = typeof(string), LabelPosition = "Top", IsEnabled = false, Value = ExpDateMessage(planDate, item) + " Укажите квалификацию?" }, new ValueDataField { Name = field, FieldName = field, SourceName = field, Caption = "Квалификация", FieldType = typeof(string), LabelPosition = "Top", LookupFilterExt = string.Format( " exists(select * from wmsqlf2mandant ql2mn where ql2mn.qlfcode_r = qlfcode and ql2mn.partnerid_r = {0})", _partnerId), LookupCode = "QLF_QLFCODE", Value = String.IsNullOrEmpty(item.QLFCODE_R) || item.QLFCODE_R == "QLFNORMAL" ? defaultQlf ?? "QLFNORMAL" : item.QLFCODE_R } }; var model = new ExpandoObjectViewModelBase { Fields = new ObservableCollection <ValueDataField>(values), PanelCaption = "Квалификация по сроку годности" }; bool?dr; while (true) { dr = _viewService.ShowDialogWindow(model, true, buttons: MessageBoxButton.YesNoCancel, width: "30%"); if (dr != true) { break; } var qlfCode = model[field] as string; if (string.IsNullOrEmpty(qlfCode)) { _viewService.ShowDialog("Ошибка", "Поле 'Квалификация' не может быть пустым", MessageBoxButton.OK, MessageBoxImage.Warning, MessageBoxResult.OK); } else { item.QLFCODE_R = qlfCode; return(MessageBoxResult.Yes); } } return(dr == false ? MessageBoxResult.No : MessageBoxResult.Cancel); }
private void SkipItem(IWBPosInput item, string message) { _messageBuilder.AppendLine(GetSkipMessage(item)); _messageBuilder.AppendLine(message); _failedItems.Enqueue(item); }
private bool ProccesCvps(ICollection <IWBPosInput> itemsToProcess, CustomParamValue canAskCpvConfirm, IWBPosInput item, DateTime expDate, CustomParamValue defaultValueCpv, string cpvType, Func <IWBPosInput, DateTime, string, MessageBoxResult> procBlQlf) { var exceptionMessage = string.Empty; var extMessage = string.Empty; var manageFlage = string.Empty; var defCpvVal = defaultValueCpv == null ? string.Empty : defaultValueCpv.CPVValue; switch (cpvType) { case "BLOCK": exceptionMessage = "Должно быть указано не менее одного параметра: 'Блокировка' или 'Разрешить выбор на DCL' в менеджере приемки. Пожалуйста, свяжитесь со службой поддержки"; extMessage = "Пользователь отказался вводить блокировку"; manageFlage = "EXPDATEACCEPTWITHBLOCKING_OK"; break; case "QLF": exceptionMessage = "Должно быть указано не менее одного параметра: 'Квалификация' или 'Разрешить выбор на DCL' в менеджере приемки. Пожалуйста, свяжитесь со службой поддержки"; extMessage = "Пользователь отказался вводить квалификацию"; manageFlage = "EXPDATEACCEPTWITHQUALIFI_OK"; break; } var funcRes = MessageBoxResult.No; if (canAskCpvConfirm != null && canAskCpvConfirm.CPVValue == "1") { funcRes = procBlQlf(item, expDate, defCpvVal); } else if (defaultValueCpv != null && (canAskCpvConfirm == null || (canAskCpvConfirm.CPVValue == "0"))) { switch (cpvType) { case "BLOCK": item.IWBPosBlocking = string.IsNullOrEmpty(item.IWBPosBlocking) ? defaultValueCpv.CPVValue : item.IWBPosBlocking; break; case "QLF": item.QLFCODE_R = string.IsNullOrEmpty(item.QLFCODE_R) || item.QLFCODE_R == "QLFNORMAL" ? defaultValueCpv.CPVValue ?? "QLFNORMAL" : item.QLFCODE_R; break; } funcRes = MessageBoxResult.Yes; } else if (defaultValueCpv == null && (canAskCpvConfirm == null || canAskCpvConfirm.CPVValue == "0")) { throw new OperationException( exceptionMessage); } switch (funcRes) { case MessageBoxResult.Yes: item.ManageFlag += (!string.IsNullOrEmpty(item.ManageFlag) ? "," : string.Empty) + manageFlage; break; case MessageBoxResult.No: SkipItem(item, ExpDateMessage(expDate, item) + extMessage); itemsToProcess.Remove(item); break; default: SkipItem(item, ExpDateMessage(expDate, item) + extMessage + " Прерываем выполнение"); return(false); } return(true); }