예제 #1
0
 protected void grdPicklistItems_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName.Equals("Edit"))
     {
         int rowIndex = Convert.ToInt32(e.CommandArgument);
         if (DialogService != null)
         {
             DialogService.SetSpecs(245, 600, "AddEditPickListItem");
             DialogService.DialogParameters.Clear();
             DialogService.DialogParameters.Add("MODE", "EDIT");
             DialogService.DialogParameters.Add("PickListId", grdPicklistItems.DataKeys[rowIndex].Values[1].ToString());
             DialogService.DialogParameters.Add("PickListItemId", grdPicklistItems.DataKeys[rowIndex].Values[0].ToString());
             DialogService.ShowDialog();
         }
         return;
     }
     if (e.CommandName.Equals("Delete"))
     {
         int rowIndex = Convert.ToInt32(e.CommandArgument);
         PickList.DeletePickListItem(grdPicklistItems.DataKeys[rowIndex].Values[1].ToString(), grdPicklistItems.DataKeys[rowIndex].Values[0].ToString());
         IPickListService pls = ApplicationContext.Current.Services.Get <IPickListService>();
         if (pls != null)
         {
             pls.ClearPickListCache();
         }
         IPanelRefreshService refresher = PageWorkItem.Services.Get <IPanelRefreshService>();
         refresher.RefreshAll();
     }
 }
        public void ConfirmPick(string username, int pickListNumber, string sku, int quantityPicked, char pickStatusCode)
        {
            PickList pickList = (from list in DB.GetTable <PickList>()
                                 where list.PickListNumber == pickListNumber
                                 select list).FirstOrDefault();

            if (pickList == null)
            {
                throw new NullReferenceException(string.Format("Pick list {0} could not be found.", pickListNumber));
            }
            PickItem result = (from item in DB.GetTable <PickItem>()
                               where item.PickListId == pickList.PickListId &&
                               item.Sku == sku
                               select item).FirstOrDefault();

            if (result == null)
            {
                throw new Exception(string.Format("Item with skew {0} on list {1} does not exist.",
                                                  sku,
                                                  pickListNumber));
            }
            string usernameLower = username.ToLower();
            User   user          = GetUser(username, true);

            result.QuantityPicked   = quantityPicked;
            result.PickedByUserId   = user.UserId;
            result.PickedByUserName = user.Username;
            result.PickStatusCode   = pickStatusCode;
            DB.SubmitChanges();
            if (PickListCompleted(pickList.PickListId))
            {
                pickList.Picked = true;
                DB.SubmitChanges();
            }
        }
예제 #3
0
        private void BtnVoucherNoSearch_Click(object sender, EventArgs e)
        {
            if (_SearchKey.Length > 1)
            {
                _SearchKey = "";
            }

            PickList frmPickList = new PickList("PurchaseIndent", _SearchKey);

            if (PickList.dt.Rows.Count > 0)
            {
                frmPickList.ShowDialog();
                if (frmPickList.SelectedList.Count > 0 && _Tag != "NEW")
                {
                    _VoucherNo = frmPickList.SelectedList[0]["VoucherNo"].ToString().Trim();
                    DataSet ds = _objPurchaseIndent.GetDataPurchaseIndentVoucher(_VoucherNo);
                    ClearFld();
                    SetData(ds);
                }
                frmPickList.Dispose();
            }
            else
            {
                MessageBox.Show("No List Available in Purchase Indent !", "Mr. Solution", MessageBoxButtons.OK, MessageBoxIcon.Information);
                TxtVoucherNo.Focus();
                return;
            }
            TxtVoucherNo.Focus();
        }
예제 #4
0
        private void AddNewItem()
        {
            if (_activeItem == null)
            {
                return;
            }

            // Get the picklist so we add to it's items
            PickList picklist = _activeItem.Tag as PickList;

            // Add a NULL item to the end of the list which we then edit to create the new item
            PickItem nullPickItem = new PickItem();

            nullPickItem.Name     = "New PickItem";
            nullPickItem.ParentID = picklist.PicklistID;
            //added for fixing Bug No 859 Sojan E John, KTSInfotech

            FormAddPickItem form = new FormAddPickItem(nullPickItem, _activeItem);

            if (form.ShowDialog() == DialogResult.OK)
            {
                RefreshTab();
            }

            //UltraListViewItem lvi = new UltraListViewItem(nullPickItem, null);
            //lvi.Tag = nullPickItem;
            //ulvPickItems.Items.Add(lvi);

            //// Begin to edit the item
            //EditItem(lvi);
        }
예제 #5
0
    public void InitPageParameter(PickList pickList)
    {
        this.PickBy     = pickList.PickBy;
        this.PickListNo = pickList.PickListNo;
        IList <PickListResult> pickListResultList = new List <PickListResult>();

        foreach (PickListDetail pickListDetail in pickList.PickListDetails)
        {
            IList <PickListResult> plResultList = ThePickListResultMgr.GetPickListResult(pickListDetail);
            if (plResultList != null && plResultList.Count > 0)
            {
                foreach (PickListResult pickListResult in plResultList)
                {
                    pickListResult.Qty             = pickListResult.Qty;
                    pickListResult.ItemCode        = pickListResult.PickListDetail.Item.Code;
                    pickListResult.ItemDescription = pickListResult.PickListDetail.Item.Description;
                    pickListResult.LocationCode    = pickListResult.LocationLotDetail.Location.Code;
                    pickListResult.UomCode         = pickListResult.PickListDetail.Uom.Code;
                    pickListResult.UnitCount       = pickListResult.PickListDetail.UnitCount;
                    pickListResult.PickListNo      = pickListResult.PickListDetail.PickList.PickListNo;
                    pickListResult.HuId            = pickListResult.LocationLotDetail.Hu.HuId;
                    pickListResult.Status          = pickListResult.PickListDetail.PickList.Status;
                    pickListResult.OrderNo         = pickListResult.PickListDetail.OrderLocationTransaction.OrderDetail.OrderHead.OrderNo;
                    pickListResult.StorageBinCode  = pickListResult.PickListDetail.StorageBin.Code;
                    pickListResult.LotNo           = pickListResult.PickListDetail.LotNo;

                    pickListResultList.Add(pickListResult);
                }
            }
        }
        InitPageParameter(pickListResultList);
    }
 private void RefreshActivity(int days)
 {
     chartActivity.Series["Requested"].DataSource = Order.GetWishListSummary(days);
     chartActivity.Series["Cancelled"].DataSource = Order.GetOrdersForReport(OrderStatus.Constant.CANCELED, days);
     chartActivity.Series["Issued"].DataSource    = IssueDoc.GetIssueSummary(days);
     chartActivity.Series["Picklist"].DataSource  = PickList.GetPickListSummary(days);
 }
    private void SaveItem()
    {
        if ((string.IsNullOrEmpty(hdPickListItemId.Value)) && (hdMode.Value == "ADD"))
        {
            int      order = System.Convert.ToInt32(txtOrder.Text);
            PickList pl    = PickList.AddNewPickListItem(hdPickListId.Value, txtItemText.Text, txtCode.Text, order, "");
            if (chkIsDefaultItem.Checked)
            {
                PickList.SetAsDefaultItem(hdPickListId.Value, pl.ItemId);
            }
        }
        else
        {
            PickList pl = PickList.GetPickListItemById(hdPickListId.Value, hdPickListItemId.Value);

            pl.Shorttext = txtCode.Text;
            pl.Text      = txtItemText.Text;
            int orderValue = System.Convert.ToInt32(txtOrder.Text);
            pl.Id = orderValue;
            PickList.SavePickListItem(pl);

            if ((chkIsDefaultItem.Checked) && (string.IsNullOrEmpty(hdIsDefault.Value)))
            {
                PickList.SetAsDefaultItem(hdPickListId.Value, pl.ItemId);
            }
            if ((!chkIsDefaultItem.Checked) && (!string.IsNullOrEmpty(hdIsDefault.Value)))
            {
                PickList.SetAsDefaultItem(hdPickListId.Value, "");
            }
        }
        PLS.ClearPickListCache();
        IPanelRefreshService refresher = PageWorkItem.Services.Get <IPanelRefreshService>();

        refresher.RefreshAll();
    }
예제 #8
0
        void AddItem()
        {
            var db = new SQLiteConnection(dbPath);

            db.CreateTable <PickList>();
            var picks = db.Query <PickList>("Select * from PickList where ItemCode = " + scanValue);

            if (picks.Count == 0)
            {
                var maxPK = db.Table <PickList>().OrderByDescending(s => s.Id).FirstOrDefault();

                var newItem = new PickList();
                newItem.Id       = (maxPK == null ? 1 : maxPK.Id + 1);
                newItem.ItemCode = scanValue;
                newItem.Qty      = 1;
                db.Insert(newItem);
            }
            else
            {
                var edititem = picks.FirstOrDefault();
                edititem.Qty += 1;
                db.Update(edititem);
                OnPropertyChanged("PickList");
            }
            GetItems();
        }
예제 #9
0
        public void TestNormalizePickListFieldwithAllFieldsinPicklist()
        {
            FieldList fieldList          = GetFields();
            string    normalizedPickList = PickList.NormalizePickListField(fieldList, PickList.AllFields);

            Assert.AreEqual(normalizedPickList, "All");
        }
예제 #10
0
        public void TestNormalizePickListFieldwithInexpensiveinPicklist()
        {
            FieldList fieldList          = GetFields();
            string    normalizedPickList = PickList.NormalizePickListField(fieldList, PickList.Inexpensive);

            Assert.AreEqual(normalizedPickList, "Inexpensive");
        }
예제 #11
0
        public void TestNormalizePickListFieldwithEmptyPicklistvalue()
        {
            FieldList fieldList          = GetFields();
            string    normalizedPickList = PickList.NormalizePickListField(fieldList, "");

            Assert.AreEqual(normalizedPickList, "atlas.Asset.Field1");
        }
예제 #12
0
        public void TestNormalizePickListFieldwithEntityFieldNamePicklist()
        {
            FieldList fieldList          = GetFields();
            string    normalizedPickList = PickList.NormalizePickListField(fieldList, "Asset.Field1");

            Assert.AreEqual(normalizedPickList, "atlas.Asset.Field1");
        }
예제 #13
0
        public void TestNormalizePickListwithInexpensiveinPicklist()
        {
            FieldList fieldList          = GetFields();
            string    normalizedPickList = PickList.NormalizePickList("Field1+Field2+" + PickList.Inexpensive, fieldList);

            Assert.AreEqual(normalizedPickList, "atlas.Asset.Field1+atlas.Asset.Field2+atlas.Asset.Field5");
        }
예제 #14
0
        public void TestNormalizePickListwithFQPicklist()
        {
            FieldList fieldList          = GetFields();
            string    normalizedPickList = PickList.NormalizePickList("atlas.Asset.Field1+atlas.Asset.Field2", fieldList);

            Assert.AreEqual(normalizedPickList, "atlas.Asset.Field1+atlas.Asset.Field2");
        }
예제 #15
0
        public void TestNormalizePickListwithEmptyPicklistvalue()
        {
            FieldList fieldList          = GetFields();
            string    normalizedPickList = PickList.NormalizePickList("", fieldList);

            Assert.AreEqual(normalizedPickList, "atlas.Asset.Field1+atlas.Asset.Field2+atlas.Asset.Field3+atlas.Asset.Field4+atlas.Asset.Field5");
        }
예제 #16
0
        /// <summary>
        /// Retrieve the picklist items.
        /// This will be cached the first time.
        /// </summary>
        /// <param name="attr"></param>
        /// <param name="items"></param>
        private void GetPicklistItems(out PickListAttributes attr, out List <PicklistItemDisplay> items)
        {
            attr  = (PickListAttributes)Page.Cache["pkl" + (PickListName) + "$Attr"];
            items = (List <PicklistItemDisplay>)Page.Cache["pkl" + (PickListName) + "$Items"];
            if (attr != null && items != null)
            {
                return;
            }
            String pklId = null;

            if (pklId == null)
            {
                pklId = PickList.PickListIdFromName(PickListName);
            }
            if (String.IsNullOrEmpty(pklId))
            {
                //throw new InvalidOperationException("Picklist name " + ListName + " is not valid.");
                ReadOnly = true;
                return;
            }
            attr = PickList.GetPickListAttributes(pklId);
            IEnumerable <PickList> pklItems = PickList.GetPickListItems(pklId);

            items = (from pkl in pklItems
                     where pkl.UserId.Trim() == "ADMIN"
                     select new PicklistItemDisplay(pkl, DisplayMode, StorageMode))
                    .ToList();
            if (attr.AlphaSorted)
            {
                items.Sort(ComparePicklistItems);
            }
            //items = items.OrderBy(v => v.Text).ToList();
        }
예제 #17
0
    private void LoadView()
    {
        PickList pl = PickList.GetPickListById(_pickListView.Id.ToString());


        PickList defItem = PickList.GetDefaultItem(_pickListView.Id.ToString());

        if (defItem != null)
        {
            txtDefaultValue.Text = defItem.Text;
        }
        else
        {
            txtDefaultValue.Text = string.Empty;
        }
        PickListAttributes att = PickList.GetAttributes(pl.Shorttext);

        SetAttributes(att);
        pklTest.PickListName    = pl.Text;// _pickListView.PickListName;
        pklTest.PickListValue   = string.Empty;
        pklTest.AllowMultiples  = att.AllowMultiples;
        pklTest.AlphaSort       = att.AlphaSorted;
        pklTest.CanEditText     = !att.NoneEditable;
        pklTest.MustExistInList = att.ValueMustExist;

        if (pl.Id.Value == 1)
        {
            chkIsManaged.Checked = true;
        }
        else
        {
            chkIsManaged.Checked = false;
        }
        pklTest.Required = false; //We can test required during test. or we then could not save the picklist because of validation.
    }
예제 #18
0
        private IEnumerable <PlanetTraitType> randomTraits(Random rng, PlanetType bodyType, double size)
        {
            var targetCount = rng.Next(this.planetTraitGroups[bodyType].Length + 1);
            var options     = new PickList <PlanetTraitType[]>(rng, this.planetTraitGroups[bodyType]);

            while (options.Count() > targetCount)
            {
                options.Take();
            }

            var vars = new Var("size", size).
                       And("asteroid", bodyType == PlanetType.Asteriod).
                       And("rock", bodyType == PlanetType.Rock).
                       And("gasGiant", bodyType == PlanetType.GasGiant).
                       Init(this.planetTraits.Keys, false);

            foreach (var group in this.planetTraitGroups[bodyType].Where(x => options.InnerList.Contains(x)))
            {
                var applicableTraits = new PickList <PlanetTraitType>(rng, group.
                                                                      Where(x => !this.traitConditions.ContainsKey(x.IdCode) || this.traitConditions[x.IdCode].Evaluate(vars.Get) >= 0)
                                                                      );
                if (applicableTraits.Count() > 0)
                {
                    var trait = applicableTraits.Pick();

                    yield return(trait);

                    vars.Set(trait.IdCode, 1);
                }
            }
        }
예제 #19
0
        public void StartPickList(string pickListNo, User user)
        {
            PickList pickList = this.CheckAndLoadPickList(pickListNo);

            PickListHelper.CheckAuthrize(pickList, user);

            if (pickList.Status != BusinessConstants.CODE_MASTER_STATUS_VALUE_SUBMIT)
            {
                throw new BusinessErrorException("Order.Error.PickUp.StatusErrorWhenStart", pickList.Status, pickList.PickListNo);
            }

            #region 检查MaxOnlineQty
            Flow flow = this.flowMgr.LoadFlow(pickList.Flow);
            if (flow != null && flow.MaxOnlineQty > 0 &&
                this.GetInPorcessPickListCount(pickList.Flow, user) >= flow.MaxOnlineQty)
            {
                throw new BusinessErrorException("Order.Error.PickUp.ExcceedMaxOnlineQty");
            }
            #endregion

            DateTime dateTimeNow = DateTime.Now;
            pickList.Status         = BusinessConstants.CODE_MASTER_STATUS_VALUE_INPROCESS;
            pickList.StartDate      = dateTimeNow;
            pickList.StartUser      = user;
            pickList.LastModifyDate = dateTimeNow;
            pickList.LastModifyUser = user;

            this.UpdatePickList(pickList);
        }
예제 #20
0
        public void PickList(Resolver resolver)
        {
            PickList pickList = pickListMgr.CheckAndLoadPickList(resolver.Code);

            pickList.PickListDetails = new List <PickListDetail>();
            if (resolver.Transformers != null)
            {
                foreach (Transformer transformer in resolver.Transformers)
                {
                    PickListDetail pickListDetail = pickListDetailMgr.LoadPickListDetail(transformer.Id, true);
                    if (transformer != null)
                    {
                        foreach (TransformerDetail transformerDetail in transformer.TransformerDetails)
                        {
                            if (transformerDetail != null && transformerDetail.HuId != null && transformerDetail.HuId != string.Empty &&
                                transformerDetail.CurrentQty != 0)
                            {
                                PickListResult pickListResult = new PickListResult();
                                //pickListResult.LocationLotDetail = locationLotDetailMgr.LoadLocationLotDetail(transformerDetail.LocationLotDetId);
                                pickListResult.LocationLotDetail = locationLotDetailMgr.CheckLoadHuLocationLotDetail(transformerDetail.HuId);
                                pickListResult.PickListDetail    = pickListDetail;
                                pickListResult.Qty = transformerDetail.CurrentQty * pickListDetail.OrderLocationTransaction.UnitQty;
                                pickListDetail.AddPickListResult(pickListResult);
                            }
                        }
                    }
                    pickList.AddPickListDetail(pickListDetail);
                }
            }
            pickListMgr.DoPick(pickList, resolver.UserCode);
            resolver.Result       = languageMgr.TranslateMessage("MasterData.PickList.Pick.Successfully", resolver.UserCode, resolver.Code);
            resolver.Transformers = null;
            resolver.Command      = BusinessConstants.CS_BIND_VALUE_TRANSFORMER;
        }
예제 #21
0
        public static bool CheckAuthrize(PickList pickList, User user)
        {
            bool partyFromAuthrized = false;

            //bool partyToAuthrized = false;

            foreach (Permission permission in user.Permissions)
            {
                if (permission.Code == pickList.PartyFrom.Code)
                {
                    partyFromAuthrized = true;
                    break;
                }

                //if (permission.Code == pickList.PartyTo.Code)
                //{
                //    partyToAuthrized = true;
                //}

                //if (partyFromAuthrized && partyToAuthrized)
                //{
                //    break;
                //}
            }

            //if (!(partyFromAuthrized && partyToAuthrized))
            if (!partyFromAuthrized)
            {
                //没有该订单的操作权限
                throw new BusinessErrorException("Order.Error.PickUp.NoPermission", pickList.PickListNo);
            }

            return(true);
        }
예제 #22
0
        private PickList[] GeneratePickLists()
        {
            var pickLists = new List <PickList>();

            for (var i = 0; i < _options.NumPickLists; i++)
            {
                var numItems  = _pickListItemCountRandom.Next();
                var itemTypes = GetRandomItems(_availableItems, numItems);

                var items = itemTypes.Select(x => {
                    return(new PickListItem
                    {
                        ID = x,
                        Quantity = _pickListQuantityRandom.Next()
                    });
                });

                var pickList = new PickList
                {
                    ID    = $"pickList_{i}",
                    Items = items.ToList()
                };

                pickLists.Add(pickList);
            }

            return(pickLists.ToArray());
        }
예제 #23
0
        /// <summary>
        /// Create a label and input control for a Boolean field
        /// </summary>
        protected void CreatePicklistField(UserDataField dataField, out Label label, out Control control)
        {
            // Do we already have the picklists read?  If not then do so now
            _listPickLists.Populate();

            // Create the label;
            label = new Label {
                Text = dataField.Name, AutoSize = true, Size = new Size(labelWidth, 13)
            };

            // Create a combobox with values taken from the picklist
            ComboBox combo = new ComboBox();

            control             = combo;
            combo.DropDownStyle = ComboBoxStyle.DropDownList;

            // Get the picklist which is in use and add the pickitems to the combo
            PickList picklist = _listPickLists.FindPickList(dataField.Picklist);

            if (picklist != null)
            {
                int maxWidth = 0;
                foreach (PickItem pickitem in picklist)
                {
                    if ((pickitem.Name.Length * 7) > maxWidth)
                    {
                        maxWidth = pickitem.Name.Length * 7;
                    }
                    combo.Items.Add(pickitem);
                }

                combo.Width = maxWidth + 25;
            }
        }
예제 #24
0
        public async Task <IEnumerable <PickList> > GetStoresAsync()
        {
            DBConnection dBConnection = new DBConnection();
            var          result       = dBConnection.GetQueryResult("Select id, store_name From store_name ", null);

            stores = new List <PickList>();

            if (result != null)
            {
                DataTable dataTable = new DataTable();
                dataTable = ((DataSet)result).Tables[0];
                for (int i = 0; i < dataTable.Rows.Count; i++)
                {
                    PickList store = new PickList()
                    {
                        Id   = Convert.ToInt32(dataTable.Rows[i]["id"]),
                        Name = Convert.ToString(dataTable.Rows[i]["store_name"])
                    };

                    stores.Add(store);
                }
                ;
            }
            return(await Task.FromResult(stores.OrderBy(s => s.Name)));
        }
    public void InitPageParameter(PickList pickList)
    {
        this.PickBy = pickList.PickBy;
        this.PickListNo = pickList.PickListNo;
        IList<PickListResult> pickListResultList = new List<PickListResult>();
        foreach (PickListDetail pickListDetail in pickList.PickListDetails)
        {
            IList<PickListResult> plResultList = ThePickListResultMgr.GetPickListResult(pickListDetail);
            if (plResultList != null && plResultList.Count > 0)
            {
                foreach (PickListResult pickListResult in plResultList)
                {
                    pickListResult.Qty = pickListResult.Qty;
                    pickListResult.ItemCode = pickListResult.PickListDetail.Item.Code;
                    pickListResult.ItemDescription = pickListResult.PickListDetail.Item.Description;
                    pickListResult.LocationCode = pickListResult.LocationLotDetail.Location.Code;
                    pickListResult.UomCode = pickListResult.PickListDetail.Uom.Code;
                    pickListResult.UnitCount = pickListResult.PickListDetail.UnitCount;
                    pickListResult.PickListNo = pickListResult.PickListDetail.PickList.PickListNo;
                    pickListResult.HuId = pickListResult.LocationLotDetail.Hu.HuId;
                    pickListResult.Status = pickListResult.PickListDetail.PickList.Status;
                    pickListResult.OrderNo = pickListResult.PickListDetail.OrderLocationTransaction.OrderDetail.OrderHead.OrderNo;
                    pickListResult.StorageBinCode = pickListResult.PickListDetail.StorageBin.Code;
                    pickListResult.LotNo = pickListResult.PickListDetail.LotNo;

                    pickListResultList.Add(pickListResult);
                }
            }
        }
        InitPageParameter(pickListResultList);
    }
예제 #26
0
        /// <summary>
        /// Format the given picklist item according to the specified mode.
        /// </summary>
        /// <param name="item"></param>
        /// <param name="picklistMode"></param>
        /// <returns></returns>
        private string FormatText(PickList item, PicklistStorageMode picklistMode)
        {
            String txt = "";

            if ((picklistMode & PicklistStorageMode.Code) != 0)
            {
                if (txt != "")
                {
                    txt += " - ";
                }
                txt += item.Shorttext;
            }
            if ((picklistMode & PicklistStorageMode.Id) != 0)
            {
                if (txt != "")
                {
                    txt += " - ";
                }
                txt += item.ItemId;
            }
            if ((picklistMode & PicklistStorageMode.Text) != 0)
            {
                if (txt != "")
                {
                    txt += " - ";
                }
                txt += item.Text;
            }
            return(txt);
        }
예제 #27
0
        /// <summary>
        /// Add a uPicklist and/or PickItem to the database
        ///
        /// </summary>
        /// <param name="lvi"></param>
        private void AddPicklist(UltraListViewItem lvi)
        {
            // Recover the data fields
            string listName = lvi.Text;
            string itemName = lvi.SubItems[0].Text;

            // Does the Picklist exist?
            PickList pickList = _listPickLists.FindPickList(listName);

            if (pickList == null)
            {
                pickList      = new PickList();
                pickList.Name = listName;
                pickList.Add();
                _listPickLists.Add(pickList);
            }

            // Does the pickitem already exist within the Picklist?
            PickItem pickItem = pickList.FindPickItem(itemName);

            if (pickItem == null)
            {
                pickItem          = new PickItem();
                pickItem.Name     = itemName;
                pickItem.ParentID = pickList.PicklistID;
                pickItem.Add();
            }
        }
    private void SaveItem()
    {
        _pickListView        = getPickListHeader(null);
        _isPickListLocalized = !string.IsNullOrWhiteSpace(_pickListView.DefaultLanguage);
        if (string.IsNullOrEmpty(txtItemText.Text))
        {
            throw new ValidationException(GetLocalResourceObject("error_InvalidItemName").ToString());
        }
        if (_isPickListLocalized && string.IsNullOrEmpty(txtCode.Text))
        {
            throw new ValidationException(GetLocalResourceObject("error_InvalidItemCode").ToString());
        }
        var keyChanged = false;

        if (_pickListItemView == null && !string.IsNullOrEmpty(hdPickListItemId.Value) && !string.IsNullOrEmpty(hdPickListId.Value))
        {
            _pickListItemView = EntityFactory.GetByCompositeId(typeof(IPickListItemView), new[] { "PickListItemId", "PickListId" }, new object[] { hdPickListItemId.Value, hdPickListId.Value }) as IPickListItemView;
        }
        if (_pickListItemView != null)
        {
            keyChanged = !string.Equals(_pickListItemView.Code, txtCode.Text) || !string.Equals(_pickListItemView.LanguageCode, cboLanguage.SelectedValue);
        }
        PickListHelper.DialogTypes dtMode = PickListHelper.StringToDialogTypes(hdMode.Value);
        if (keyChanged || (string.IsNullOrEmpty(hdPickListItemId.Value) && dtMode == PickListHelper.DialogTypes.Add) || dtMode == PickListHelper.DialogTypes.Localize)
        {
            var      order = Convert.ToInt32(txtOrder.Text);
            PickList pl    = PickList.AddNewPickListItem(hdPickListId.Value, txtItemText.Text, txtCode.Text, txtFilter.Text, cboLanguage.SelectedValue, order, string.Empty);
            if (chkIsDefaultItem.Checked)
            {
                PickList.SetAsDefaultItemCode(hdPickListId.Value, pl.ItemId);
            }
        }
        else
        {
            PickList pl = PickList.GetPickListItemById(hdPickListId.Value, hdPickListItemId.Value);
            pl.Shorttext = txtCode.Text;
            pl.Text      = txtItemText.Text;
            var orderValue = Convert.ToInt32(txtOrder.Text);
            pl.Id           = orderValue;
            pl.Filter       = txtFilter.Text;
            pl.LanguageCode = cboLanguage.SelectedValue;
            PickList.SavePickListItem(pl);

            if (chkIsDefaultItem.Checked && string.IsNullOrEmpty(hdIsDefault.Value))
            {
                PickList.SetAsDefaultItemCode(hdPickListId.Value, pl.ItemId);
            }
            if (!chkIsDefaultItem.Checked && !string.IsNullOrEmpty(hdIsDefault.Value))
            {
                PickList.SetAsDefaultItemCode(hdPickListId.Value, string.Empty);
            }
        }
        var picklistService = ApplicationContext.Current.Services.Get <IPickListService>(true);

        picklistService.ClearPickListCache();
        var refresher = PageWorkItem.Services.Get <IPanelRefreshService>();

        refresher.RefreshAll();
    }
예제 #29
0
    protected void btnDelete_ClickAction(object sender, EventArgs e)
    {
        _pickListView = (IPickListView)BindingSource.Current;
        PickList pl = PickList.GetPickListById(_pickListView.Id.ToString());

        PickList.DeletePickList(pl);
        Response.Redirect("PickListView.aspx");
    }
예제 #30
0
        protected override void GetDetail(Resolver resolver)
        {
            PickList pickList = pickListMgr.LoadPickList(resolver.Input, true, true);

            resolver.Transformers = TransformerHelper.ConvertPickListDetailsToTransformers(pickList.PickListDetails);
            resolver.Result       = languageMgr.TranslateMessage("Common.Business.PickList", resolver.UserCode) + ":" + resolver.Code;
            resolver.Command      = BusinessConstants.CS_BIND_VALUE_TRANSFORMER;
        }
예제 #31
0
        public StarPositions Generate(Random rng, int playerCount)
        {
            int size         = sizeOptions[sizeParameter.Value].Size;
            var allPositions = new PickList <Tuple <int, int> >(rng,
                                                                Methods.Range(0, size * size, 1).
                                                                Select(i => new Tuple <int, int>(i % size, i / size)).ToList()
                                                                );

            var emptyPositions = new HashSet <Tuple <int, int> >();

            while (emptyPositions.Count < emptyPositionsRatio * size * size)
            {
                emptyPositions.Add(allPositions.Take());
            }

            var    positions    = new List <Vector2D>();
            double displacement = displacementParameter.Value;

            for (double y = 0; y < size; y++)
            {
                for (double x = 0; x < size; x++)
                {
                    if (!emptyPositions.Contains(new Tuple <int, int>((int)x, (int)y)))
                    {
                        positions.Add(new Vector2D(
                                          (x + displacementParameter.Value * (2 * rng.NextDouble() - 1) - size / 2.0) * starDistance,
                                          (y + displacementParameter.Value * (2 * rng.NextDouble() - 1) - size / 2.0) * starDistance
                                          ));
                    }
                }
            }

            var    homeSystems = new List <int>();
            double phi         = 0.5 * rng.NextDouble() * Math.PI;
            double deltaPhi    = Math.PI * 2.0 / playerCount;
            double radius      = starDistance * homeSystemDistance * size / 2.0;

            for (double player = 0; player < playerCount; player++)
            {
                var desiredPoint = new Vector2D(
                    radius * Math.Cos(phi + player * deltaPhi),
                    radius * Math.Sin(phi + player * deltaPhi)
                    );
                desiredPoint *= radius / Math.Max(Math.Abs(desiredPoint.X), Math.Abs(desiredPoint.Y));

                int candidate = 0;
                for (int i = 1; i < positions.Count; i++)
                {
                    if ((desiredPoint - positions[candidate]).Magnitude() > (desiredPoint - positions[i]).Magnitude())
                    {
                        candidate = i;
                    }
                }
                homeSystems.Add(candidate);
            }

            return(new StarPositions(positions, homeSystems));
        }
        public PickListDetail CreatePicklistDetailWithOrder(ReceiveDoc receiveDoc, ReceivePallet receivePallet, Order order, PickList picklist, decimal pack)
        {
            double? cost = null;
            OrderService orderService = new OrderService();
            orderService.CreateOrderDetail(receiveDoc, order, pack);
            if (!receiveDoc.IsColumnNull("Cost"))
                cost = receiveDoc.Cost;
            PickListDetail pickListDetail = PickListDetail.GeneratePickListDetail(pack, cost, receiveDoc.ID, receiveDoc.ManufacturerId, receivePallet.ID,
                receiveDoc.QtyPerPack, receiveDoc.StoreID, receiveDoc.UnitID, receiveDoc.ItemID, picklist.ID, receivePallet.PalletID, receiveDoc.IsColumnNull("ExpDate")?"":receiveDoc.ExpDate.ToString(),  receiveDoc.IsColumnNull("BatchNo")?"":receiveDoc.BatchNo);
            ReceivePallet.ReserveQty(pack, receivePallet.ID);

            return pickListDetail;
        }
    public void InitPageParameter(PickList pickList)
    {
        this.PickBy = pickList.PickBy;
        this.PickListNo = pickList.PickListNo;

        this.GV_List.DataSource = pickList.PickListDetails;
        this.GV_List.DataBind();
        if (pickList.Status == BusinessConstants.CODE_MASTER_STATUS_VALUE_INPROCESS)
        {
            this.ltlHuScan.Visible = true;
            this.tbHuScan.Visible = true;
            this.btnScanHu.Visible = true;
        }
        else
        {
            this.ltlHuScan.Visible = false;
            this.tbHuScan.Visible = false;
            this.btnScanHu.Visible = false;

        }
        UpdateView();
    }
예제 #34
0
 /// <summary>
 /// Format the given picklist item according to the specified mode.
 /// </summary>
 /// <param name="item"></param>
 /// <param name="picklistMode"></param>
 /// <returns></returns>
 private string FormatText(PickList item, PicklistStorageMode picklistMode)
 {
     String txt = "";
     if ((picklistMode & PicklistStorageMode.Code) != 0)
     {
         if (txt != "")
             txt += " - ";
         txt += item.Shorttext;
     }
     if ((picklistMode & PicklistStorageMode.Id) != 0)
     {
         if (txt != "")
             txt += " - ";
         txt += item.ItemId;
     }
     if ((picklistMode & PicklistStorageMode.Text) != 0)
     {
         if (txt != "")
             txt += " - ";
         txt += item.Text;
     }
     return txt;
 }
        public Issue CreateSTVLog(int? stvLogID, bool convertDNtoSTV, PickList pickList, Order order, int? supplierId, int activityId, bool hasInsurance, int userId)
        {
            int paymentTypeID = order.PaymentTypeID;
            Issue stvLog = new Issue();
            stvLog.AddNew();
            stvLog.PrintedDate = DateTimeHelper.ServerDateTime;
            stvLog.RefNo = order.RefNo;
            stvLog.PickListID = pickList.ID;
            if(supplierId != null)
            {
                stvLog.SupplierID = supplierId.Value;
            }
            stvLog.UserID = userId;
            stvLog.StoreID = activityId;
             stvLog.IsDeliveryNote = (paymentTypeID == PaymentType.Constants.DELIVERY_NOTE);
            stvLog.HasInsurance = hasInsurance;
            stvLog.FiscalYearID = FiscalYear.Current.ID;

            var activity = new Activity();
            activity.LoadByPrimaryKey(activityId);
            stvLog.AccountID = activity.AccountID;

            if (paymentTypeID == PaymentType.Constants.DELIVERY_NOTE)
            {
                stvLog.DocumentTypeID = DocumentType.documentTypes.DeliveryNote.DocumentTypeID;
            }
            else if (paymentTypeID == PaymentType.Constants.CASH)
            {
                stvLog.DocumentTypeID = DocumentType.documentTypes.Cash.DocumentTypeID;
            }
            else if (paymentTypeID == PaymentType.Constants.CREDIT)
            {
                stvLog.DocumentTypeID = DocumentType.documentTypes.Credit.DocumentTypeID;
            }
            else if (paymentTypeID == PaymentType.Constants.STV)
            {
                stvLog.DocumentTypeID = DocumentType.documentTypes.STV.DocumentTypeID;
            }
            else if(paymentTypeID == PaymentType.Constants.ERROR_CORRECTION)
            {
                stvLog.DocumentTypeID = DocumentType.documentTypes.ErrorCorrection.DocumentTypeID;
            }
            else if(paymentTypeID == PaymentType.Constants.INVENTORY)
            {
                stvLog.DocumentTypeID = DocumentType.documentTypes.EndingBalance.DocumentTypeID;
            }
            else if (paymentTypeID == PaymentType.Constants.DISPOSAL) // This should probably have a disposal document type, but for now, STV
            {
                stvLog.DocumentTypeID = DocumentType.documentTypes.STV.DocumentTypeID;
            }
            stvLog.IDPrinted = DocumentType.GetNextSequenceNo(stvLog.DocumentTypeID, stvLog.AccountID, stvLog.FiscalYearID);

            if (!order.IsColumnNull("RequestedBy"))
            {
                stvLog.ReceivingUnitID = order.RequestedBy;
            }
            if (stvLogID.HasValue)
            {
                stvLog.IsReprintOf = stvLogID.Value;
                //this means the STV is from replaced
                Issue s = new Issue();
                s.LoadByPrimaryKey(stvLogID.Value);

                stvLog.IsDeliveryNote = false;
                if (!s.IsColumnNull("IsDeliveryNote") && s.IsDeliveryNote && !convertDNtoSTV)
                {
                    stvLog.IsDeliveryNote = true;
                }
            }
            stvLog.Save();
            return stvLog;
        }
        /// <summary>
        /// Saves the whole transaction for
        /// </summary>
        /// <param name="orderID">The order ID.</param>
        /// <param name="dvOutstandingPickList">The dv outstanding pick list.</param>
        /// <param name="remark">The remark.</param>
        /// <param name="issuedBy">The issued by.</param>
        /// <param name="etCurrentDate">The et current date.</param>
        /// <returns></returns>
        /// <exception cref="System.Exception"></exception>
        public static Order SaveIssueTransaction(int orderID, ref DataView dvOutstandingPickList, string remark, string issuedBy, DateTime etCurrentDate)
        {
            // Add the IssueDocID field
            dvOutstandingPickList.Table.Columns.Add("IssueDocID");
            PickList plst = new PickList();
            IssueDoc issDoc = new IssueDoc();
            ReceiveDoc recDoc = new ReceiveDoc();
            BLL.Order ord = new BLL.Order();
            ord.LoadByPrimaryKey(orderID);
            plst.LoadByOrderID(ord.ID);

            foreach (DataRowView drv in dvOutstandingPickList)
            {
                // Pseudo:
                // for each row in the picklist
                // undate the issue document
                // subtract the issued quantity from the receive doc
                // subtract the issued quantity from recieve pallet
                // subtract the issued the reserved quantity irregardless of the quantity issued.

                //Saving the new Issue issue
                if (Convert.ToDecimal(drv["BUPICKED"]) == 0)
                {
                    continue;

                }

                if (Convert.ToDecimal(drv["SKUPicked"]) != Convert.ToDecimal(drv["SKUTOPICK"]))
                {
                    drv["Cost"] = Convert.ToDecimal(drv["SKUPicked"]) * Convert.ToDecimal(drv["UnitPrice"]);
                }

                // Select the receive doc that is associated with this issue.
                recDoc.LoadByPrimaryKey(Convert.ToInt32(drv["ReceiveDocID"]));

                issDoc.AddNew();
                issDoc.StoreId = Convert.ToInt32(drv["StoreID"]);
                issDoc.RefNo = ord.RefNo;
                if (!ord.IsColumnNull("RequestedBy"))
                    issDoc.ReceivingUnitID = ord.RequestedBy;
                // TOFIX:
                // TODO:
                // Lord have mercy kind of hack to avoid the feb date problem
                // this needs to be fixed for pagume also
                issDoc.Date = etCurrentDate;
                issDoc.EurDate = DateTimeHelper.ServerDateTime;
                issDoc.RecievDocID = Convert.ToInt32(drv["ReceiveDocID"]);
                issDoc.IsApproved = true;
                issDoc.IsTransfer = false;
                issDoc.Remark = remark;
                issDoc.ItemID = Convert.ToInt32(drv["ItemID"]);
                issDoc.Quantity = Convert.ToDecimal(drv["BUPICKED"]);
                issDoc.NoOfPack = Convert.ToDecimal(drv["SKUPICKED"]);
                issDoc.QtyPerPack = Convert.ToInt32(drv["SKUBU"]);
                issDoc.BatchNo = drv["BatchNumber"].ToString();
                issDoc.UnitID = recDoc.UnitID;
                issDoc.ManufacturerID = recDoc.ManufacturerId;
                if (drv["Cost"] != DBNull.Value)
                {
                    issDoc.Cost = Convert.ToDouble(drv["Cost"]);

                    issDoc.SellingPrice = Convert.ToDecimal(drv["UnitPrice"]);
                    if (!recDoc.IsColumnNull("Cost"))
                    {
                        issDoc.UnitCost = Convert.ToDecimal(recDoc.Cost);
                    }
                }
                issDoc.OrderID = orderID;
                issDoc.IssuedBy = issuedBy;
                // TODO: is this the right place where we need to pick the physical store ID from?
                // check it against the receipt pallet physical store.
                if (!recDoc.IsColumnNull("PhysicalStoreID"))
                {
                    issDoc.PhysicalStoreID = recDoc.PhysicalStoreID;
                }
                if (!recDoc.IsColumnNull("InventoryPeriodID"))
                {
                    //Todo: Remove for Inventory
                    issDoc.InventoryPeriodID = recDoc.InventoryPeriodID;
                }
                if (!recDoc.IsColumnNull("Margin"))
                {
                    issDoc.Margin = (decimal)recDoc.Margin;
                }
                //Replaced by
                issDoc.PLDetailID = Convert.ToInt32(drv["PLDetailID"]);
                BLL.Balance bal = new Balance();
                BLL.ReceiveDoc rd = new ReceiveDoc();
                rd.LoadByPrimaryKey(issDoc.RecievDocID);
                decimal currentBalance = bal.GetSoh(issDoc.ItemID, rd.UnitID, issDoc.StoreId, issDoc.Date.Month, issDoc.Date.Year);
                if (currentBalance < issDoc.NoOfPack)
                {
                    throw new Exception(string.Format("The item {0} is not available in {1} Qty.", drv["FullItemName"].ToString(), issDoc.NoOfPack));
                }

                // This is a field that is not applicable on the hub edition
                // It is about the dispensing unit quantity and there is no such thing as Dispensing unit
                // in the hub edition
                issDoc.DUSOH = 0;
                issDoc.RecomendedQty = 0;// ((recQty > 0) ? Convert.ToInt64(recQty) : 0);
                // End DU
                issDoc.DispatchConfirmed = false;
                issDoc.Save();
                drv["IssueDocID"] = issDoc.ID;
                // updating the receiving doc

                //long prevQuantityLeft = recDoc.QuantityLeft;

                recDoc.QuantityLeft = recDoc.QuantityLeft - issDoc.Quantity;

                if (recDoc.QuantityLeft < 0)
                {
                    //Possibly the wrong ReceiveDoc Entry chosen
                    BLL.Item itm = new Item();
                    itm.LoadByPrimaryKey(recDoc.ItemID);
                    throw new Exception(string.Format("Quantity problem detected for the item {0}", itm.FullItemName));
                }
                //long
                recDoc.Out = (recDoc.QuantityLeft == 0) ? true : false;
                recDoc.Save();

                ReceivePallet rp = new ReceivePallet();
                int id = Convert.ToInt32(drv["ReceivePalletID"]);
                rp.LoadByPrimaryKey(id);
                if (rp.IsColumnNull("Balance"))
                {
                    rp.Balance = rp.ReceivedQuantity;
                }
                rp.Balance -= issDoc.Quantity;

                if (rp.Balance < 0)
                {
                    BLL.Item itm = new Item();
                    itm.LoadByPrimaryKey(recDoc.ItemID);
                    throw new Exception(string.Format("Quantity problem detected for the item {0}", itm.FullItemName));
                }

                decimal totReservedQty = Convert.ToDecimal(drv["QuantityInBU"]);

                if (rp.IsColumnNull("ReservedStock"))
                    rp.ReservedStock = 0;

                rp.ReservedStock -= totReservedQty;
                if (rp.ReservedStock < 0) //If there has been a quantity problem somewhere
                    rp.ReservedStock = 0;
                rp.Save();
            }
            plst.IsConfirmed = true;
            ord.ChangeStatus(OrderStatus.Constant.ISSUED, CurrentContext.UserId);
            plst.Save();
            ord.Save();
            return ord;
        }
 public PickListDetail GeneratePickListDetail(ReceiveDoc rd, ReceivePallet rp, Order o, PickList pl)
 {
     PickListService pickListService = new PickListService ();
     return pickListService.CreatePicklistDetailWithOrder(rd, rp, o, pl);
 }
        private void HandleTransferForSingleWearehouse(int wearehouse, DataView dataView, int newItemId, int newUnitId, int newManufacturerId,
                                                        decimal ConversionFactor, string Remark, DateTime convertedEthDate,
                                                        User user, bool changeExpiryDate, DateTime? ExpiryDate,
                                                        bool changeBatchNo, string batchNo, int activityId, Issue stvLog, Order order, PickList picklist)
        {
            int  receiptTypeID = ReceiptType.CONSTANTS.ERROR_CORRECTION;

            ReceiveService receiveService = new ReceiveService();

            Receipt receipt = receiveService.CreateFakeReceiptWithInvoicePO(order.OrderTypeID, activityId,GeneralInfo.Current.SupplierID,
                                                                            Remark,
                                                                            stvLog.IDPrinted,
                                                                            receiptTypeID,
                                                                            user.ID, BLL.Settings.IsVaccine ? ReceiptConfirmationStatus.Constants.GRV_PRINTED : ReceiptConfirmationStatus.Constants.GRNF_PRINTED, wearehouse);

            //Loop throw the Dataview and Create Detail Transaction
            foreach (DataRowView dataRowView in dataView)
            {
                int receivePalletID = Convert.ToInt32(dataRowView["receivePalletId"]);
                decimal pack = Convert.ToDecimal(dataRowView["PickedQty"]);
                decimal convertedPack = Convert.ToDecimal(pack*Convert.ToDecimal(ConversionFactor));

                if (pack != 0)
                {
                    CreateDetailTransactionsForErrorCorrection(order, picklist, stvLog, receivePalletID, receipt.ID,
                                                               user, convertedEthDate, newItemId, newUnitId,
                                                               newManufacturerId, pack, convertedPack,
                                                               ReceiptConfirmationStatus.Constants.GRNF_PRINTED,
                                                               changeExpiryDate, ExpiryDate, changeBatchNo, batchNo);
                }
            }

            ErrorCorrection.Log(stvLog, receipt, ConversionFactor);
        }
        private Issue HandleTransferBeforeReceipt(User user, int activityId,out Order order,out PickList picklist)
        {
            int orderType = OrderType.CONSTANTS.ERROR_CORRECTION_TRANSFER;
            int paymentType = PaymentType.Constants.ERROR_CORRECTION;
            int orderStatus = OrderStatus.Constant.ISSUED;

            order = Order.GenerateOrder(null, orderType,
                                        orderStatus, activityId,
                                        paymentType, user.FullName,GeneralInfo.Current.InstitutionID, user.ID, 0);

            picklist = PickList.GeneratePickList(order.ID);

            var issueService = new IssueService();
            return issueService.CreateSTVLog(null, false, picklist, order, null, activityId, false, user.ID);
        }
예제 #40
0
 /// <summary>
 /// Create a picklist item from a SalesLogix picklist object.
 /// Value and Text will be extracted from the picklist item based on display mode and storage mode.
 /// </summary>
 /// <param name="pkl"></param>
 /// <param name="displayMode"></param>
 /// <param name="storageMode"></param>
 public PicklistItemDisplay(PickList pkl, PicklistStorageMode displayMode, PicklistStorageMode storageMode)
 {
     Value = FormatText(pkl, storageMode);
     Text = FormatText(pkl, displayMode);
 }