Beispiel #1
0
 private bool CheckDuplicate(PfCustomerStore detail)
 {
     //判断是否存在相同款号颜色,如果有则提示是否累加,确定就累加原来的,否的话则取消
     if (curInboundDetailList.Exists(t => t.PfCustomerID == detail.PfCustomerID && t.CostumeID == detail.CostumeID && t.ColorName == detail.ColorName))
     {
         int             index       = curInboundDetailList.FindIndex(t => t.PfCustomerID == detail.PfCustomerID && t.CostumeID == detail.CostumeID && t.ColorName == detail.ColorName);
         PfCustomerStore existDetail = null;
         if (index >= 0)
         {
             existDetail = curInboundDetailList[index];
             dataGridViewPagingSumCtrl.ScrollToRowIndex(index);
             GlobalMessageBox.Show("该款号颜色已存在,第" + (index + 1) + "行,请直接修改");
             return(true);
         }
     }
     else
     {
         curInboundDetailList.Add(detail);
     }
     return(false);
 }
        private void BaseButtonSaveAccount_Click(object sender, EventArgs e)
        {
            try
            {
                if (pfCustomer == null)
                {
                    GlobalMessageBox.Show("款号不能为空!");
                    skinTextBoxID.Focus();
                    return;
                }
                else
                if (String.IsNullOrEmpty(skinTextBoxID.Text))
                {
                    GlobalMessageBox.Show("款号不能为空!");
                    skinTextBoxID.Focus();
                    return;
                }
                else
                if (skinTextBoxID.Text.Contains("#"))
                {
                    GlobalMessageBox.Show("款号不能使用“#”!");
                    skinTextBoxID.Focus();
                    return;
                }
                else
                if (String.IsNullOrEmpty(skinTextBox_Name.Text))
                {
                    GlobalMessageBox.Show("商品名称不能为空!");
                    skinTextBox_Name.Focus();
                    return;
                }

                CostumeColor color = colorComboBox1.SelectedItem as CostumeColor;
                if (String.IsNullOrEmpty(color?.Name))
                {
                    GlobalMessageBox.Show("颜色不能为空!");
                    colorComboBox1.Focus();
                    return;
                }

                PfCustomerStore detail = addValue[0];
                detail.ColorName      = ValidateUtil.CheckEmptyValue(color?.Name);
                detail.CostumeID      = skinTextBoxID.Text;
                detail.CostumeName    = skinTextBox_Name.Text;
                detail.PfCustomerID   = pfCustomer.ID;
                detail.PfCustomerName = pfCustomer.Name;
                detail.PfPrice        = this.textBoxAmount.Value;
                //Shop shop = (Shop)skinComboBoxShopID.SelectedItem;
                //detail.ShopID = shop.ID;
                //detail.ShopName = shop.Name;

                //判断是否存在相同款号颜色,如果有则提示是否累加,确定就累加原来的,否的话则取消
                if (curInboundDetailList.Exists(t => t.PfCustomerID == detail.PfCustomerID && t.CostumeID == detail.CostumeID && t.ColorName == detail.ColorName))
                {
                    PfCustomerStore existDetail = curInboundDetailList.Find(t => t.PfCustomerID == detail.PfCustomerID && t.CostumeID == detail.CostumeID && t.ColorName == detail.ColorName);
                    dataGridViewPagingSumCtrl.ScrollToRowIndex(curInboundDetailList.IndexOf(existDetail));
                    if (GlobalMessageBox.Show("库存信息已存在,是否进行累加?", "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
                    {
                        return;
                    }

                    existDetail.XS     += detail.XS;
                    existDetail.S      += detail.S;
                    existDetail.M      += detail.M;
                    existDetail.L      += detail.L;
                    existDetail.XL     += detail.XL;
                    existDetail.XL2    += detail.XL2;
                    existDetail.XL3    += detail.XL3;
                    existDetail.XL4    += detail.XL4;
                    existDetail.XL5    += detail.XL5;
                    existDetail.XL6    += detail.XL6;
                    existDetail.F      += detail.F;
                    existDetail.PfPrice = detail.PfPrice;
                }
                else
                {
                    curInboundDetailList.Add(detail);
                }

                ResetAll();
                this.BindingInboundDetailSource();
                HighlightCostume(detail);
            }
            catch (Exception ee)
            {
                GlobalUtil.ShowError(ee);
            }
        }