private void simpleButton1_Click(object sender, EventArgs e)
        {
            List <String> barIds = new List <string>();

            foreach (BarCodeInfoDto barCodeInfo in this.barCodeInfoDtos)
            {
                barIds.Add(barCodeInfo.Id);
            }
            if (barIds.Count == 0)
            {
                MessageBox.Show("请先扫码");
                return;
            }


            DialogResult dialogResult = MessageBox.Show("确认入库?", "入库提醒", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation);

            if (dialogResult == DialogResult.OK)
            {
                //  库存明细账
                StockBillService.generateInventoryLedge(barIds, this.shopId, this.textEdit出库单号.Text, "验货入库", false);
                //  提醒
                MessageBox.Show("出库单号" + this.textEdit出库单号.Text + "已入库完成");
                //  单号变更
                this.textEdit出库单号.Text = null;
                //  清空成衣列表
                this.barCodeInfoDtos.Clear();
                this.barCodes.Clear();
                //  TODO,不确定是否做清空门店
            }
        }
        private void textEdit扫码_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyValue == 13) //判断是回车键
            {
                if (this.barCodes.Contains(this.textEdit扫码.Text))
                {
                    //  重复扫描
                    this.textEdit扫码.Text = "";
                    return;
                }

                BarCodeInfoDto barCodeInfo;
                try
                {
                    barCodeInfo = StockBillService.getStockOutBarCodeInfo(this.textEdit扫码.Text);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("错误信息: " + ex.Message);
                    return;
                }


                //  条码记录
                this.barCodes.Add(barCodeInfo.LOG_ID);
                this.textEdit扫码.Text = "";
                //  条码信息
                this.barCodeInfoDtos.Add(barCodeInfo);
                //  刷新数据源
                this.gridControl1.DataSource = this.barCodeInfoDtos;
                //this.pivotGridControl.ForceInitialize();
                this.pivotGridControl.DataSource = this.barCodeInfoDtos;
                this.pivotGridControl.RefreshData();
            }
        }
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(this.shopId))
            {
                MessageBox.Show("请选择门店");
                return;
            }
            if (this.barCodeInfoDtos.Count == 0)
            {
                MessageBox.Show("请选择出货成衣");
                return;
            }


            DialogResult dialogResult = MessageBox.Show("确认出货?", "出货提醒", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation);

            if (dialogResult == DialogResult.OK)
            {
                //  出库
                StockBillService.generateStockOut(this.dateTimePicker1.Value, this.textEdit出库单号.Text, this.shopId, this.barCodeInfoDtos);
                //  提醒
                MessageBox.Show("出库单号" + this.textEdit出库单号.Text + "已出库完成");
                //  单号变更
                this.textEdit出库单号.Text = FunctionHelper.generateBillNo("t_godown_bill", "godown_code", "CH", "00000");
                //  清空成衣列表
                this.barCodeInfoDtos.Clear();
                this.barCodes.Clear();
                //  TODO,不确定是否做清空门店
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// 保存单据并修改库存
        /// </summary>
        public void DoSave()
        {
            //Do Verify
            if (this.cmbStorehouse.SelectedItem == null)
            {
                throw new ApplicationException("请指定仓库!");
            }
            if (this.cmbCompany.SelectedItem == null)
            {
                throw new ApplicationException("请指定管理单位!");
            }
            if (this.dgvGoodsList.Rows.Count <= 1)
            {
                throw new ApplicationException("请指定商品!");
            }

            //Contruct model
            StockBill bill = new StockBill();

            bill.BillType    = this.BillType;
            bill.Actived     = true;
            bill.Code        = DateTime.Now.ToString("yyyyMMddHHmmssddd");
            bill.Company     = (Company)this.cmbCompany.SelectedItem;
            bill.IsCancelOut = false;
            bill.IsRedBill   = false;
            bill.MakeDate    = this.dtpMakeDate.Value;
            bill.Remark      = this.txtRemark.Text.Trim();
            bill.Storehouse  = (Storehouse)this.cmbStorehouse.SelectedItem;
            bill.Maker       = this.txtMaker.Text.Trim();

            foreach (DataGridViewRow row in this.dgvGoodsList.Rows)
            {
                if (row.Tag != null)
                {
                    StockBillItem billItem = (StockBillItem)row.Tag;
                    bill.Items.Add(billItem);
                }
            }


            //Do Save
            StockBillService service = new StockBillService();

            service.MakeBill(bill);

            if (MessageBox.Show("是否打印?", "打印提示",
                                MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                PrintService.GetInstance().PrintBill(bill);
            }

            //Reset the form
            this.DoReset();
        }
Exemplo n.º 5
0
        private void DoCancelOut()
        {
            List <Bills>     selectedList     = GetSelectedBills();
            StockBillService stockBillService = new StockBillService();

            foreach (Bills bill in selectedList)
            {
                Bills b = stockBillService.FindBill(bill.ID);
                stockBillService.CancelOutBill(bill, PermissionService.GetCurrentUser().Name, DateTime.Now, "冲销的票据");
            }

            this.DoReset();
        }
Exemplo n.º 6
0
        private void DoBlankOut()
        {
            List <Bills>     selectedList     = GetSelectedBills();
            StockBillService stockBillService = new StockBillService();

            foreach (Bills bill in selectedList)
            {
                Bills b = stockBillService.FindBill(bill.ID);
                stockBillService.BlankOutBill(b, "作废的票据");
            }

            this.DoReset();
        }
Exemplo n.º 7
0
        public void DoCancelOut()
        {
            List <StockBill> selectedList = GetSelectedStockBills();
            StockBillService service      = new StockBillService();

            foreach (StockBill bill in selectedList)
            {
                StockBill b = service.FindBill(bill.ID);
                service.CancelOutBill(bill, PermissionService.GetCurrentUser().Name, DateTime.Now, "");
            }

            this.DoReset();
        }
Exemplo n.º 8
0
        public void DoBlankOut()
        {
            List <StockBill> selectedList = GetSelectedStockBills();
            StockBillService service      = new StockBillService();

            foreach (StockBill bill in selectedList)
            {
                StockBill b = service.FindBill(bill.ID);
                service.BlankOutBill(b, "");
            }

            this.DoReset();
        }
Exemplo n.º 9
0
        /// <summary>
        /// 保存单据并修改库存
        /// </summary>
        public void DoSave()
        {
            //verify
            if (cmbCompany.SelectedItem == null)
            {
                throw new ApplicationException("请指定关联单位");
            }
            if (cmbStorehouse.SelectedItem == null)
            {
                throw new ApplicationException("请指定仓库");
            }
            if (dgvDrugsList.Rows.Count <= 1)
            {
                throw new ApplicationException("请指定药品");
            }
            //Contruct Model
            Bills bill = new Bills();

            bill.BillsType   = this.BillsType;
            bill.Actived     = true;
            bill.Code        = DateTime.Now.ToString("yyyyMMddHHmmssfff");
            bill.Company     = (Company)cmbCompany.SelectedItem;
            bill.IsCancelOut = false;
            bill.IsRedBill   = false;
            bill.MakeDate    = this.dtpMakeDate.Value;
            bill.CreateDate  = DateTime.Now;
            bill.Maker       = this.txtMaker.Text.Trim();
            bill.Storehouse  = (Storehouse)this.cmbStorehouse.SelectedItem;
            bill.Remark      = this.txtRemark.Text.Trim();
            foreach (DataGridViewRow row in dgvDrugsList.Rows)
            {
                if (row.Tag != null)
                {
                    BillsItem billsItem = (BillsItem)row.Tag;
                    if (billsItem.Remark == null)
                    {
                        billsItem.Remark = "没有备注";
                    }
                    bill.Items.Add(billsItem);
                }
            }
            //Do Save
            StockBillService stockBillService = new StockBillService();

            stockBillService.MakeBill(bill);
            if (MessageBox.Show("保存成功,是否打印单据?", "打印提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                new PrintService().PrintBill(bill);
            }
            this.DoReset();
        }
        private void textEdit扫码_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyValue == 13) //判断是回车键
            {
                if (this.barCodes.Contains(this.textEdit扫码.Text))
                {
                    //  重复扫描
                    this.textEdit扫码.Text = "";
                    return;
                }

                BarCodeInfoDto barCodeInfo;
                try
                {
                    barCodeInfo = StockBillService.getStockInBarCodeInfo(this.textEdit扫码.Text);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("错误信息: " + ex.Message);
                    return;
                }

                //  订单信息更新
                if (String.IsNullOrEmpty(this.textEdit出库单号.Text))
                {
                    DataTable dataTable = StockBillService.getStockInInfo(barCodeInfo.LOG_ID);
                    this.textEdit出库单号.Text     = dataTable.Rows[0]["godown_code"].ToString();
                    this.dateTimePicker1.Value = Convert.ToDateTime(dataTable.Rows[0]["godown_date"].ToString());
                    this.textEdit门店.Text       = dataTable.Rows[0]["shop_name"].ToString();
                    this.shopId = dataTable.Rows[0]["shop_id"].ToString();
                }


                //  条码记录
                this.barCodes.Add(barCodeInfo.LOG_ID);
                this.textEdit扫码.Text = "";
                //  条码信息
                this.barCodeInfoDtos.Add(barCodeInfo);
                //  刷新数据源
                this.gridControl1.DataSource = this.barCodeInfoDtos;
                //this.pivotGridControl.ForceInitialize();
                this.pivotGridControl.DataSource = this.barCodeInfoDtos;
                this.pivotGridControl.RefreshData();
            }
        }
Exemplo n.º 11
0
        private void DoSearch()
        {
            //User billsMaker = (User)this.cmbMaker.SelectedItem;
            User             billsMaker       = PermissionService.GetCurrentUser();
            DateTime         fromDate         = new DateTime(this.dtpFrom.Value.Year, this.dtpFrom.Value.Month, this.dtpFrom.Value.Day, 0, 0, 0, 0);
            DateTime         toDate           = new DateTime(this.dtpTo.Value.Year, this.dtpTo.Value.Month, this.dtpTo.Value.Day, 23, 59, 59, 998);
            string           billsID          = txtID.Text.Trim();
            StockBillService stockBillService = new StockBillService();
            List <Bills>     billsList        = stockBillService.SearchBill(fromDate, toDate, null, null, null, null, null, billsMaker, billsID, this.BillsType);

            //fil billsList to dgvBilsList
            this.dgvBillsList.Rows.Clear();
            foreach (Bills bill in billsList)
            {
                if (!bill.Actived || bill.IsCancelOut || bill.IsRedBill)
                {
                    continue;
                }

                DataGridViewRow row = new DataGridViewRow();
                row.Tag = bill;
                DataGridViewCell cell = null;
                cell = new DataGridViewCheckBoxCell();
                row.Cells.Add(cell);

                cell       = new DataGridViewTextBoxCell();
                cell.Value = bill.ID.ToString();
                row.Cells.Add(cell);

                cell       = new DataGridViewTextBoxCell();
                cell.Value = bill.Code;
                row.Cells.Add(cell);

                cell       = new DataGridViewTextBoxCell();
                cell.Value = bill.Maker;
                row.Cells.Add(cell);

                cell       = new DataGridViewTextBoxCell();
                cell.Value = bill.MakeDate.ToString("yyyy-MM-dd HH:mm:ss");
                row.Cells.Add(cell);

                cell       = new DataGridViewTextBoxCell();
                cell.Value = bill.Company.Name;
                row.Cells.Add(cell);

                cell       = new DataGridViewTextBoxCell();
                cell.Value = bill.Storehouse.Name;
                row.Cells.Add(cell);

                cell       = new DataGridViewTextBoxCell();
                cell.Value = bill.TotalMoney;
                row.Cells.Add(cell);


                cell       = new DataGridViewTextBoxCell();
                cell.Value = bill.Remark + (bill.Actived == false ? "已作废" : "");
                row.Cells.Add(cell);

                dgvBillsList.Rows.Add(row);
            }
        }
Exemplo n.º 12
0
        private void dgvBillsList_SelectionChanged(object sender, EventArgs e)
        {
            try
            {
                dgvBillsItemList.Rows.Clear();
                if (dgvBillsList.SelectedRows.Count > 0)
                {
                    Bills            bill             = (Bills)dgvBillsList.SelectedRows[0].Tag;
                    StockBillService stockBillService = new StockBillService();
                    bill = stockBillService.FindBill(bill.ID);
                    foreach (BillsItem item in bill.Items)
                    {
                        DataGridViewRow row = new DataGridViewRow();
                        row.Tag = item;

                        DataGridViewTextBoxCell cell = null;
                        cell       = new DataGridViewTextBoxCell();
                        cell.Value = item.Drugs.Code;
                        row.Cells.Add(cell);

                        cell       = new DataGridViewTextBoxCell();
                        cell.Value = item.Drugs.Name;
                        row.Cells.Add(cell);

                        cell       = new DataGridViewTextBoxCell();
                        cell.Value = item.UnitPrice.ToString("0.00");
                        row.Cells.Add(cell);

                        cell       = new DataGridViewTextBoxCell();
                        cell.Value = item.Drugs.Category.Name;
                        row.Cells.Add(cell);

                        cell       = new DataGridViewTextBoxCell();
                        cell.Value = item.Drugs.From.Name;
                        row.Cells.Add(cell);

                        cell       = new DataGridViewTextBoxCell();
                        cell.Value = item.Drugs.Unit;
                        row.Cells.Add(cell);

                        cell       = new DataGridViewTextBoxCell();
                        cell.Value = item.Drugs.Standard;
                        row.Cells.Add(cell);

                        cell       = new DataGridViewTextBoxCell();
                        cell.Value = item.Count;
                        row.Cells.Add(cell);

                        cell       = new DataGridViewTextBoxCell();
                        cell.Value = item.Money.ToString("0.00");
                        row.Cells.Add(cell);

                        dgvBillsItemList.Rows.Add(row);
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorHandler.OnError(ex);
            }
        }
Exemplo n.º 13
0
        public void DoSearch()
        {
            string maker = this.MakerConditionVisible ?
                           txtMaker.Text.Trim() :
                           PermissionService.GetCurrentUser().Name;

            DateTime fromDate = new DateTime(dtpFrom.Value.Year, dtpFrom.Value.Month, dtpFrom.Value.Day, 0, 0, 0, 0);
            DateTime toDate   = new DateTime(dtpTo.Value.Year, dtpTo.Value.Month, dtpTo.Value.Day, 23, 59, 59, 998);

            StockBillService service = new StockBillService();
            List <StockBill> bills   = service.SearchBill(
                fromDate, toDate,
                null, maker, txtID.Text.Trim(),
                this.BillType);

            //Fill Bills into datagridview control
            this.dgvBillList.Rows.Clear();
            foreach (StockBill bill in bills)
            {
                if (!bill.Actived || bill.IsCancelOut || bill.IsRedBill)
                {
                    continue;
                }

                DataGridViewRow row = new DataGridViewRow();
                row.Tag = bill;
                DataGridViewCell cell = null;
                cell = new DataGridViewCheckBoxCell();
                row.Cells.Add(cell);

                cell       = new DataGridViewTextBoxCell();
                cell.Value = bill.ID.ToString();
                row.Cells.Add(cell);

                cell       = new DataGridViewTextBoxCell();
                cell.Value = bill.Maker;
                row.Cells.Add(cell);

                cell       = new DataGridViewTextBoxCell();
                cell.Value = bill.MakeDate.ToString("yyyy-MM-dd HH:mm:ss");
                row.Cells.Add(cell);

                cell       = new DataGridViewTextBoxCell();
                cell.Value = bill.Storehouse.Name;
                row.Cells.Add(cell);

                cell       = new DataGridViewTextBoxCell();
                cell.Value = bill.Company.Name;
                row.Cells.Add(cell);

                cell       = new DataGridViewTextBoxCell();
                cell.Value = bill.TotalMoney;
                row.Cells.Add(cell);


                cell       = new DataGridViewTextBoxCell();
                cell.Value = bill.Remark + (bill.Actived == false ? "已作废" : "");
                row.Cells.Add(cell);

                dgvBillList.Rows.Add(row);
            }
        }