Beispiel #1
0
        /// <summary>
        /// 确定
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDm_Click(object sender, EventArgs e)
        {
            List <t_cur_saleflow> saleInfos = new List <t_cur_saleflow>();

            for (int i = 0; i < this.dgItem.Rows.Count; i++)
            {
                t_cur_saleflow saleinfo = this.dgItem.Rows[i].DataBoundItem as t_cur_saleflow;
                if (saleinfo.isSelect)
                {
                    saleInfos.Add(saleinfo);
                }
            }
            if (saleInfos.Count == 0)
            {
                if (MessageBox.Show("确定不选择促销商品?", Gattr.AppTitle, MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
                {
                    base.DialogResult = System.Windows.Forms.DialogResult.Cancel;
                }
                else
                {
                    base.DialogResult = System.Windows.Forms.DialogResult.None;
                }
            }
            else
            {
                if (SetSend != null)
                {
                    SetSend(saleInfos);
                }
                base.DialogResult = System.Windows.Forms.DialogResult.OK;
            }
        }
Beispiel #2
0
 private void GvSaleFlow_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
 {
     if (e.RowIndex >= 0)
     {
         t_cur_saleflow _saleflow = this.bindingSaleFlow[e.RowIndex] as t_cur_saleflow;
         SolidBrush     brush     = new SolidBrush(Color.FromArgb(0xff, 0xfb, 240));
         if (this.bindingSaleFlow.Position == e.RowIndex)
         {
             brush = new SolidBrush(Color.FromArgb(224, 224, 224));
         }
         e.Graphics.FillRectangle(brush, e.RowBounds);
         SolidBrush brush2 = new SolidBrush(Color.FromArgb(0x80, 0x80, 0x80));
         SolidBrush brush3 = new SolidBrush(Color.Black);
         e.Graphics.DrawRectangle(new Pen(brush2), e.RowBounds);
         Rectangle layoutRectangle = new Rectangle(e.RowBounds.X, e.RowBounds.Y + 5, (e.RowBounds.Width / 3) + 0x10, e.RowBounds.Height / 2);
         e.Graphics.DrawString(_saleflow.item_no, this.Font, brush3, layoutRectangle);
         Rectangle rectangle2 = new Rectangle(layoutRectangle.X + layoutRectangle.Width, layoutRectangle.Y, e.RowBounds.Width - layoutRectangle.Width, layoutRectangle.Height);
         e.Graphics.DrawString(_saleflow.item_name, this.Font, brush3, rectangle2);
         StringFormat format = new StringFormat
         {
             Alignment = StringAlignment.Far
         };
         Rectangle rectangle3 = new Rectangle(layoutRectangle.X, layoutRectangle.Y + layoutRectangle.Height, layoutRectangle.Width, layoutRectangle.Height);
         e.Graphics.DrawString(_saleflow.sale_qnty.ToString(Gattr.PosSaleNumPoint), this.Font, brush3, rectangle3, format);
         Rectangle rectangle4 = new Rectangle(rectangle2.X, rectangle3.Y, rectangle2.Width / 2, layoutRectangle.Height);
         e.Graphics.DrawString(_saleflow.sale_price.ToString(Gattr.PosSalePrcPoint), this.Font, brush3, rectangle4, format);
         Rectangle rectangle5 = new Rectangle(rectangle2.X + rectangle4.Width, rectangle3.Y, rectangle2.Width / 2, layoutRectangle.Height);
         e.Graphics.DrawString(_saleflow.sale_money.ToString(Gattr.PosSaleAmtPoint), this.Font, brush3, rectangle5, format);
     }
 }
Beispiel #3
0
        private void SaveData(bool istj)
        {
            string cashierNo = Gattr.OperId;

            if (this.cmbType.SelectedIndex == -1)
            {
                MessageBox.Show("请选择单据类型!", Gattr.AppTitle);
                return;
            }
            if (this.cmbType.SelectedIndex == 0 || this.cmbType.SelectedIndex == -1)
            {
                if (this.txtdBranchNO.Text.Trim().Length == 0)
                {
                    MessageBox.Show("请输入发货门店", Gattr.AppTitle);
                    return;
                }
                if (this.txtdBranchNO.Text.Trim() == Gattr.BranchNo)//发货门店和申请门店相同
                {
                    MessageBox.Show("发货门店和申请门店不能相同", Gattr.AppTitle);
                    return;
                }
                if (this.dgvItemList.Rows.Count <= 0)
                {
                    MessageBox.Show("没有要货商品信息", Gattr.AppTitle);
                    return;
                }
                DataTable detail = new DataTable();
                string[]  dcs    = new string[] { "sheet_no", "item_no", "real_qty", "other1" };
                foreach (string str in dcs)
                {
                    DataColumn dc = new DataColumn(str);
                    if (str != "real_qty")
                    {
                        dc.DataType = Type.GetType("System.String");
                    }
                    else
                    {
                        dc.DataType = Type.GetType("System.Decimal");
                    }
                    if (!detail.Columns.Contains(str))
                    {
                        detail.Columns.Add(dc);
                    }
                }
                decimal _sumAmt = 0M;
                List <t_pm_sheet_detail> _details = new List <t_pm_sheet_detail>();
                bool isok111 = true;
                foreach (DataGridViewRow dgvr in this.dgvItemList.Rows)
                {
                    t_pm_sheet_detail _detail = new t_pm_sheet_detail();
                    if (!string.IsNullOrEmpty(SheetNO))
                    {
                        _detail.sheet_no = SheetNO;
                    }
                    _detail.item_no = ExtendUtility.Instance.ParseToString(dgvr.Cells["item_no"].Value);
                    t_cur_saleflow sale = Gattr.Bll.GetItemInfo(_detail.item_no);
                    _detail.real_qty = ExtendUtility.Instance.ParseToDecimal(dgvr.Cells["real_qty"].Value);
                    if (istj)
                    {
                        if (_detail.real_qty.HasValue)
                        {
                            if (ExtendUtility.Instance.ParseToDecimal(_detail.real_qty.Value) <= 0)
                            {
                                MessageBox.Show("货号[" + _detail.item_no + "]的商品数量必须大于0", Gattr.AppTitle);
                                isok111 = false;
                                break;
                            }
                        }
                        else
                        {
                            MessageBox.Show("货号[" + _detail.item_no + "]的商品数量不能为空", Gattr.AppTitle);
                            isok111 = false;
                            break;
                        }
                        //if (this.dgvItemList.Rows[e.RowIndex].Cells["stock_qty"].Visible == true)
                        //{
                        //    decimal stock_qty = ExtendUtility.Instance.ParseToDecimal(
                        //        this.dgvItemList.Rows[e.RowIndex].Cells["stock_qty"].Value);
                        //    if (result > stock_qty)
                        //    {
                        //        MessageBox.Show("要货数量不能大于发货门店库存", Gattr.AppTitle);
                        //  isok111 = false;
                        //        this.dgvItemList.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = this.EditBackValue;
                        //    }
                        //}
                    }
                    _detail.other1 = ExtendUtility.Instance.ParseToString(dgvr.Cells["other1"].Value);
                    _details.Add(_detail);
                }
                if (isok111 == false)
                {
                    return;
                }
                bool              isok     = true;
                string            sheet_no = ExtendUtility.Instance.ParseToString(this.SheetNO);
                string            memo     = this.txtRemark.Text.Contains(this.flagBody) ? this.txtRemark.Text : (this.txtRemark.Text + this.flagBody);
                t_pm_sheet_master _master  = new t_pm_sheet_master();
                _master.trans_no    = "+";
                _master.sheet_no    = SheetNO;
                _master.trans_no    = "YH";
                _master.d_branch_no = Gattr.BranchNo;
                _master.branch_no   = txtdBranchNO.Text.Trim();
                _master.oper_id     = Gattr.OperId;
                _master.valid_date  = ExtendUtility.Instance.ParseToDateTime(ExtendUtility.Instance.ParseToDateTime(dateValid.Text.Trim()).ToString(LL.Common.GobalStaticString.DATE_FORMAT));
                _master.memo        = memo;
                if (istj)
                {
                    _master.order_status = "0";//等待提交
                }
                else
                {
                    _master.order_status = "t";
                }
                List <t_pm_sheet_master> _masters = new List <t_pm_sheet_master>();
                _masters.Add(_master);
                string master1 = JsonUtility.Instance.ObjectToJson <t_pm_sheet_master>(_masters);
                string detail1 = JsonUtility.Instance.ObjectToJson <t_pm_sheet_detail>(_details);
                Dictionary <string, object> _dic = Gfunc.GetServiceParameter();
                _dic.Add("master", master1);
                _dic.Add("detail", detail1);
                if (string.IsNullOrEmpty(this.SheetNO))//新增
                {
                    _dic.Add("add", "add");
                }
                else
                {
                    _dic.Add("add", "edit");
                    _dic.Add("sheet_no", SheetNO);
                }
                string errorMessage = string.Empty;
                string result       = PServiceProvider.Instance.InvokeMethod(Gattr.serverUrl + "/Addpsheet", _dic, ref isok, ref errorMessage);
                if (isok)
                {
                    if (result != "-10" && result != "-20")
                    {
                        if (result != "-1" && result != "0" && result != "-2" && result != "404")
                        {
                            if (string.IsNullOrEmpty(this.SheetNO))//新增
                            {
                                this.SheetNO         = result;
                                this.txtSheetNO.Text = result;
                            }
                            MessageBox.Show("保存成功", Gattr.AppTitle);
                            if (istj)
                            {
                                this.btnSave.Enabled         = false;
                                this.btnDel.Enabled          = false;
                                this.btnDelAll.Enabled       = false;
                                this.btnSelectBranch.Enabled = false;
                                this.btnApprove.Enabled      = false;
                                this.btnSelectItem.Enabled   = false;
                                this.dgvItemList.Enabled     = false;
                            }
                        }
                        else
                        {
                            string error = "";
                            switch (result)
                            {
                            case "-1":
                                error = "记录不存在";
                                break;

                            case "-2":
                                error = "保存异常";
                                break;

                            case "404":
                                error = "提交出错";
                                break;

                            default:
                                error = "保存失败";
                                break;
                            }
                            MessageBox.Show(error, Gattr.AppTitle);
                        }
                    }
                    else
                    {
                        if (result == "-10")
                        {
                            //参数错误
                            MessageBox.Show("参数错误", Gattr.AppTitle);
                        }
                        else
                        {
                            //禁止操作
                            MessageBox.Show("禁止操作", Gattr.AppTitle);
                        }
                    }
                }
                else
                {
                    MessageBox.Show(errorMessage, Gattr.AppTitle);
                }
            }
        }