コード例 #1
0
ファイル: CostumeInfoText.cs プロジェクト: jollitycn/JGNet
        private void SkinTxt_TextChanged(object sender, EventArgs e)
        {
            if (this.Text.Contains("costumeInfoText") || this.SkinTxt.Text.Contains("costumeInfoText"))
            {
                this.Text = ""; this.SkinTxt.Text = ""; return;
            }
            if (this.Text != "costumeInfoText1" && this.SkinTxt.Text != "costumeInfoText1")
            {
                if (String.IsNullOrEmpty(this.Text))
                {
                    this.CostumeSelected?.Invoke(null, false);
                }
                else
                {
                    string costumeID = this.Text.Trim();

                    //条形码,先根据条形码获取款号
                    //List<BarCode> barCodes = CommonGlobalCache.BarCodeList?.FindAll(t => t.BarCodeValue.ToUpper().Equals(costumeID.ToUpper()));

                    ////,条形码为一条,找到这个款号
                    //if (barCodes != null && barCodes.Count == 1)
                    //{
                    //    costumeID = barCodes[0].CostumeID;
                    //    isBarCode = true;
                    //}
                    //BarCode4Costume costume = CommonGlobalUtil.GetBarCode(costumeID);
                    //if (costume != null)
                    //{
                    //    costumeID = costume.CostumeID;
                    //    SkinTxt.Text = costume.BarCode;
                    //    isBarCode = true;
                    //}

                    List <Costume> resultList = CommonGlobalCache.CostumeList.FindAll(t => t.ID.ToUpper().Equals(costumeID.ToUpper()));

                    if (filterValid)
                    {
                        resultList = resultList.FindAll(t => t.IsValid);
                    }

                    if (resultList == null || resultList.Count == 0)
                    {
                        this.CostumeSelected?.Invoke(null, false);

                        return;
                    }
                    if (resultList.Count == 1)
                    {
                        resultList[0].BrandName    = CommonGlobalCache.GetBrandName(resultList[0].BrandID);
                        resultList[0].SupplierName = CommonGlobalCache.GetSupplierName(resultList[0].SupplierID);
                        CostumeSelected?.Invoke(resultList[0], false);
                    }
                }
            }
        }
コード例 #2
0
        private void SkinTxt_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
        {
            if (e.KeyCode != Keys.Enter)
            {
                return;
            }
            try
            {
                isBarCode = false;
                string costumeID = this.SkinTxt.Text.Trim();
                if (string.IsNullOrEmpty(costumeID))
                {
                    if (this.CostumeSelected != null)
                    {
                        this.CostumeSelected(null);
                    }
                    return;
                }
                if (CommonGlobalUtil.EngineUnconnectioned(this))
                {
                    return;
                }
                //条形码,先根据条形码获取款号
                //List<BarCode> barCodes = CommonGlobalCache.BarCodeList?.FindAll(t => t.BarCodeValue.ToUpper().Equals(costumeID.ToUpper()));

                ////,条形码为一条,找到这个款号
                //if (barCodes != null && barCodes.Count == 1)
                //{
                //    costumeID = barCodes[0].CostumeID;
                //    this.SkinTxt.Text = barCodes[0].BarCodeValue;
                //    isBarCode = true;
                //}
                if (costumeID.Length == 15)
                {
                    BarCode4Costume costume = CommonGlobalUtil.GetBarCode(costumeID);
                    if (costume != null)
                    {
                        costumeID    = costume.CostumeID;
                        SkinTxt.Text = costume.BarCode;
                        isBarCode    = true;
                    }
                }



                List <Costume> resultList = CommonGlobalCache.CostumeList.FindAll(t => t.ID.ToUpper().Contains(costumeID.ToUpper()) && t.IsValid == true);
                //  List<CostumeItem> resultList = GlobalCache.ServerProxy.GetPfCustomerStores("", costumeID);
                if (resultList == null || resultList.Count == 0)
                {
                    this.CostumeSelected?.Invoke(null);
                    //this.SkinTxt.Text = "";

                    return;
                }
                if (resultList.Count == 1)
                {
                    List <CostumeItem> OneresultList = GlobalCache.ServerProxy.GetPfCustomerStores(CustomerID, costumeID, true);
                    if (OneresultList.Count == 0)
                    {
                        CostumeItem createItem = new CostumeItem();

                        createItem.Costume          = resultList[0];
                        createItem.CostumeStoreList = SetupStores(resultList[0]);
                        OneresultList.Add(createItem);
                    }
                    OneresultList[0].Costume.BrandName    = CommonGlobalCache.GetBrandName(OneresultList[0].Costume.BrandID);
                    OneresultList[0].Costume.SupplierName = CommonGlobalCache.GetSupplierName(OneresultList[0].Costume.SupplierID);
                    if (OneresultList[0].CostumeStoreList != null)
                    {
                        foreach (var item in OneresultList[0].CostumeStoreList)
                        {
                            item.CostumeName = OneresultList[0].Costume.Name;
                            item.BrandName   = OneresultList[0].Costume.BrandName;
                            item.Price       = OneresultList[0].Costume.Price;
                        }
                    }


                    if (!isBarCode)
                    {
                        this.SkinTxt.Text = OneresultList[0].Costume.ID;
                    }
                    if (this.CostumeSelected != null)
                    {
                        this.CostumeSelected(OneresultList[0]);
                    }
                }
                else
                {
                    PfCostumeFromShopForm costumeForm = new PfCostumeFromShopForm(resultList, costumeID, CustomerID, filterValid);
                    //   costumeForm.Hide();
                    // costumeForm.CostumeSelected += CostumeForm_CostumeSelected;
                    if (costumeForm.ShowDialog() == DialogResult.OK)
                    {
                        if (costumeForm.Result == null)
                        {
                            return;
                        }
                        this.SkinTxt.Text = costumeForm.Result.Costume.ID;
                        CostumeSelected?.Invoke(costumeForm.Result);
                    }
                }
            }
            catch (Exception ee)
            {
                ShowError(ee);
            }
            finally
            {
                UnLockPage();
            }
        }
コード例 #3
0
        public void Search()
        {
            try
            {
                isBarCode = false;
                string costumeID = this.Text.Trim();
                if (string.IsNullOrEmpty(costumeID))
                {
                    if (this.CostumeSelected != null)
                    {
                        curItem = null;
                        this.CostumeSelected(curItem, true);
                    }
                    return;
                }
                if (CommonGlobalUtil.EngineUnconnectioned(this))
                {
                    return;
                }
                //条形码,先根据条形码获取款号
                //List<BarCode> barCodes = CommonGlobalCache.BarCodeList?.FindAll(t => t.BarCodeValue.ToUpper().Equals(costumeID.ToUpper()));

                ////,条形码为一条,找到这个款号
                //if (barCodes != null && barCodes.Count == 1)
                //{
                //    costumeID = barCodes[0].CostumeID;
                //    this.Text = barCodes[0].BarCodeValue;
                //    isBarCode = true;
                //}
                if (costumeID.Length == 15)
                {
                    BarCode4Costume costume = CommonGlobalUtil.GetBarCode(costumeID);
                    if (costume != null)
                    {
                        costumeID    = costume.CostumeID;
                        SkinTxt.Text = costume.BarCode;
                        isBarCode    = true;
                    }
                }

                List <Costume> resultList = CommonGlobalCache.CostumeList.FindAll(t => (t.ID.ToUpper().Contains(costumeID.ToUpper())));
                if (filterValid)
                {
                    resultList = resultList.FindAll(t => t.IsValid);
                }

                /*  CostumeItem t = new CostumeItem();
                 *
                 * List<CostumeItem> resultList = CommonGlobalCache.ServerProxy.GetCostumeStoreList(new CostumeStoreListPara()
                 * {
                 *    CostumeID = costumeID,
                 *    ShopID = this.ShopID,
                 *    IsOnlyShowValid = filterValid
                 * });
                 *
                 *
                 * //有供应商则过滤供应商
                 * if (SupplierID != null && resultList != null)
                 * {
                 *    resultList = resultList.FindAll(i => i.Costume.SupplierID == SupplierID);
                 * }*/
                if (resultList == null || resultList.Count == 0)
                {
                    if (this.CostumeSelected != null)
                    {
                        curItem = null;
                        this.CostumeSelected(curItem, true);
                    }
                    this.Text = "";
                    return;
                }
                if (resultList.Count == 1)
                {
                    if (!isBarCode)
                    {
                        this.Text = resultList[0].ID;
                    }
                    if (this.CostumeSelected != null)
                    {
                        Costume curCostume = resultList[0];
                        curItem = null; //根据条件获取库存信息

                        List <CostumeItem> selectResultItem = CommonGlobalCache.ServerProxy.GetCostumeStoreList(new CostumeStoreListPara()
                        {
                            CostumeID       = resultList[0].ID,
                            ShopID          = this.ShopID,
                            IsOnlyShowValid = filterValid,
                            IsAccurateQuery = true,
                        });

                        if (SupplierID != null && resultList != null)
                        {
                            selectResultItem = selectResultItem.FindAll(i => i.Costume.SupplierID == SupplierID);
                        }
                        if (selectResultItem.Count > 0)
                        {
                            this.CostumeSelected(selectResultItem[0], true);
                        }
                        else
                        {
                            this.Text = "";
                        }
                    }
                }
                else
                {
                    CostumeFromShopForm costumeForm = new CostumeFromShopForm(resultList, costumeID, ShopID, FilterValid, SupplierID);

                    if (costumeForm.ShowDialog() == DialogResult.OK)
                    {
                        if (costumeForm.Result == null)
                        {
                            return;
                        }
                        this.Text = costumeForm.Result.Costume.ID;
                        curItem   = costumeForm.Result;
                        CostumeSelected?.Invoke(curItem, true);
                    }
                }
            }
            catch (Exception ee)
            {
                ShowError(ee);
            }
            finally
            {
                UnLockPage();
            }
        }
コード例 #4
0
        public void Search()
        {
            try
            {
                isBarCode = false;
                string costumeID = this.SkinTxt.Text.Trim();
                if (string.IsNullOrEmpty(costumeID))
                {
                    if (this.CostumeSelected != null)
                    {
                        this.CostumeSelected(null);
                    }
                    return;
                }
                if (CommonGlobalUtil.EngineUnconnectioned(this))
                {
                    return;
                }
                //条形码,先根据条形码获取款号
                //List<BarCode> barCodes = CommonGlobalCache.BarCodeList?.FindAll(t => t.BarCodeValue.ToUpper().Equals(costumeID.ToUpper()));

                ////,条形码为一条,找到这个款号
                //if (barCodes != null && barCodes.Count == 1)
                //{
                //    costumeID = barCodes[0].CostumeID;
                //    this.SkinTxt.Text = barCodes[0].BarCodeValue;
                //    isBarCode = true;
                //}

                if (costumeID.Length == 15)
                {
                    BarCode4Costume costume = CommonGlobalUtil.GetBarCode(costumeID);
                    if (costume != null)
                    {
                        costumeID    = costume.CostumeID;
                        SkinTxt.Text = costume.BarCode;
                        isBarCode    = true;
                    }
                }
                List <Costume> resultList = CommonGlobalCache.CostumeList.FindAll(t => t.SupplierID == this.SupplierID &&
                                                                                  t.ID.ToUpper().Contains(costumeID.ToUpper()));
                if (filterValid)
                {
                    resultList = resultList.FindAll(t => t.IsValid);
                }

                if (this.BrandID != -1 && resultList != null)
                {
                    resultList = resultList.FindAll(t => t.BrandID == this.BrandID);
                }

                if (resultList == null || resultList.Count == 0)
                {
                    if (this.CostumeSelected != null)
                    {
                        this.CostumeSelected(null);
                    }
                    this.SkinTxt.Text = "";
                    return;
                }
                if (resultList.Count == 1)
                {
                    resultList[0].BrandName    = CommonGlobalCache.GetBrandName(resultList[0].BrandID);
                    resultList[0].SupplierName = CommonGlobalCache.GetSupplierName(resultList[0].SupplierID);
                    if (!isBarCode)
                    {
                        this.SkinTxt.Text = resultList[0].ID;
                    }
                    if (this.CostumeSelected != null)
                    {
                        this.CostumeSelected(resultList[0]);
                    }
                }
                else
                {
                    CostumeFromSupplierForm costumeForm = new CostumeFromSupplierForm(resultList, costumeID, SupplierID, BrandID, filterValid);
                    //  costumeForm.Hide();
                    //   costumeForm.CostumeSelected += CostumeForm_CostumeSelected;
                    if (costumeForm.ShowDialog() == DialogResult.OK)
                    {
                        this.SkinTxt.Text = costumeForm.Result.ID;
                        CostumeSelected?.Invoke(costumeForm.Result);
                    }
                }
            }
            catch (Exception ee)
            {
                ShowError(ee);
            }
            finally
            {
                UnLockPage();
            }
        }