Exemple #1
0
        private void button_2_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("发送当前验收单数据到服务器?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) != DialogResult.Yes)
            {
                return;
            }
            DataSet ds;
            string  msg;

            ShowWait("正读取验收单...请稍候...");
            if (!JhBillDAL.GetSendJhBill(out ds, out msg))
            {
                HideWait();
                MessageBox.Show("提取验收单失败:" + msg);
                return;
            }
            string ywType = PubGlobal.JhBillInfo.IsCgJh?PubGlobal.JHYW_TYPE_CGJH:PubGlobal.JHYW_TYPE_NO_CGJH;

            if (!Comm.Comm.RecvJhBill(ds, ywType, PubGlobal.JhBillInfo.PreRefBillNo + PubGlobal.JhBillInfo.RefBillNo, PubGlobal.JhBillInfo.CkCode, PubGlobal.OrgCode, PubGlobal.User.UserCode, PubGlobal.User.Password, out msg))
            {
                HideWait();
                MessageBox.Show("发送验收单失败:" + msg);
                return;
            }
            HideWait();
            MessageBox.Show("发送验收单成功");
            if (!JhBillDAL.RemoveJhBill(out msg))
            {
                MessageBox.Show("删除验收单失败");
            }
            jhBill.Clear();
            PubGlobal.JhBillInfo = null;
            dBJhBillBindingSource.ResetBindings(true);
            button_4_Click(null, null);
        }
Exemple #2
0
        private void FrmJhBillSend_Load(object sender, EventArgs e)
        {
            ShowWait("正在读取验收明细...\r\n 请稍候...");
            string msg;

            if (!JhBillDAL.GetJhBillInfo(out PubGlobal.JhBillInfo, out msg))
            {
                MessageBox.Show("读取验收单数据失败:" + msg);
                this.DialogResult = DialogResult.Cancel;
                HideWait();
                return;
            }
            if (!JhBillDAL.ListBill(out jhBill, out msg))
            {
                MessageBox.Show("查询验收单明细失败:" + msg);
                this.DialogResult = DialogResult.Cancel;
                HideWait();
                return;
            }
            else
            {
                tbLrUser.Text    = PubGlobal.JhBillInfo.LrUser;
                tbCheckUser.Text = PubGlobal.User.USERNAME;
                dBJhBillBindingSource.DataSource = jhBill;
            }
            HideWait();
        }
Exemple #3
0
        private void button_1_Click(object sender, EventArgs e)
        {
            if (PubGlobal.JhBillModel == null)
            {
                MessageBox.Show("错误:该商品未列入采购单。");
                return;
            }

            PubGlobal.JhBillModel.SsPackCount = decimal.Parse(tbSsPackCount.Text);
            PubGlobal.JhBillModel.SsSGLCount  = decimal.Parse(tbSsSglCount.Text);
            PubGlobal.JhBillModel.ScDate      = cbHasProductDate.Checked?dpProductDate.Value.ToString("yyyy-MM-dd"):string.Empty;
            PubGlobal.JhBillModel.SsCount     = PubGlobal.JhBillModel.PackQty * PubGlobal.JhBillModel.SsPackCount
                                                + PubGlobal.JhBillModel.SsSGLCount;
            PubGlobal.JhBillModel.Checked = "Y";
            string msg;

            if (!JhBillDAL.SaveBill(PubGlobal.JhBillModel, out msg))
            {
                MessageBox.Show("保存验收明细错误:" + msg);
                return;
            }
            PubGlobal.JhBillModel = null;
            PubGlobal.Cur_TRFQueryPlu.Clear();
            PubGlobal.Cur_TRFQueryPlu = null;
            ReFlush();
        }
Exemple #4
0
        private void FrmJhBillInit_Load(object sender, EventArgs e)
        {
            string msg;

            ReadCgBillSuccess   = JhBillDAL.GetJhBillInfo(out PubGlobal.JhBillInfo, out msg);
            rbIsCgJh.Enabled    = !ReadCgBillSuccess;
            rbIsNotCgJh.Enabled = !ReadCgBillSuccess;
            tbRefBillNo.Enabled = !ReadCgBillSuccess;
            tbCkCode.Enabled    = !ReadCgBillSuccess;
            if (!ReadCgBillSuccess)
            {//读取单据失败。新建单据
                rbIsCgJh.Checked    = true;
                tbPreRefBillNo.Text = PubGlobal.YwTypeRes[PubGlobal.CGYW_TYPE_CODE].ToString();
                tbCkCode.Text       = string.Empty;
                tbRefBillNo.Text    = string.Empty;
                tbRefBillNo.Focus();
                tbRefBillNo.SelectAll();
            }
            else
            {
                //读取单据成功,显示单据
                rbIsCgJh.Checked    = PubGlobal.JhBillInfo.IsCgJh;
                rbIsNotCgJh.Checked = !rbIsCgJh.Checked;
                tbRefBillNo.Text    = PubGlobal.JhBillInfo.RefBillNo;
                tbPreRefBillNo.Text = PubGlobal.JhBillInfo.PreRefBillNo;
                tbCkCode.Text       = PubGlobal.JhBillInfo.CkCode;
                button_3.Focus();
            }
        }
Exemple #5
0
        private void FrmJhBillMx_Load(object sender, EventArgs e)
        {
            ShowWait("正在读取验收单信息\r\n请稍候...");
            string msg;

            if (!JhBillDAL.ListBill(out jhBill, out msg))
            {
                MessageBox.Show("读取验收单错误:" + msg);
                HideWait();
                return;
            }
            HideWait();
            dBJhBillBindingSource.DataSource = jhBill;
        }
Exemple #6
0
        private void cbxPackSpec_SelectedValueChanged(object sender, EventArgs e)
        {
            string  msg;
            TPacket packet = (TPacket)cbxPackSpec.SelectedItem;

            if (PubGlobal.JhBillInfo.IsCgJh)
            {
                //数据库读取Model
                if (!JhBillDAL.GetBill(PubGlobal.Cur_TRFQueryPlu[0].PLUCODE, packet, out PubGlobal.JhBillModel, out msg))
                {
                    MessageBox.Show(msg);
                }
            }
            else
            {
                //数据库读取Model
                if (!JhBillDAL.GetBill(PubGlobal.Cur_TRFQueryPlu[0].PLUCODE, packet, out PubGlobal.JhBillModel, out msg))
                {
                    //新建Model
                    if (!NewModel())
                    {
                        MessageBox.Show("新建单据明细失败");
                        return;
                    }
                }
            }
            //tbCgPackCount.Text = jhBillModel.CgPackCount.ToString();
            //tbCgSglCount.Text = jhBillModel.CgSGLCount.ToString();
            tbCgPackCount.Text = PubGlobal.JhBillModel == null ? "0" : PubGlobal.JhBillModel.CgPackCount.ToString();
            tbCgSglCount.Text  = PubGlobal.JhBillModel == null ? "0" : PubGlobal.JhBillModel.CgSGLCount.ToString();
            tbSsPackCount.Text = PubGlobal.JhBillModel == null ? "0" : PubGlobal.JhBillModel.SsPackCount.ToString();
            tbSsSglCount.Text  = PubGlobal.JhBillModel == null ? "0" : PubGlobal.JhBillModel.SsSGLCount.ToString();
            if (string.IsNullOrEmpty(PubGlobal.JhBillModel.ScDate))
            {
                cbHasProductDate.Checked = false;
            }
            else
            {
                cbHasProductDate.Checked = true;
                dpProductDate.Value      = DateTime.Parse(PubGlobal.JhBillModel.ScDate);
            }
        }
Exemple #7
0
        /// <summary>
        /// 查询获取订单
        /// </summary>
        /// <param name="CgBillNo">订单号</param>
        /// <param name="OrgCode">组织代码</param>
        /// <param name="UserCode">用户编码</param>
        /// <param name="PassWord">密码</param>
        /// <returns></returns>
        public static bool QueryCgBill(string CgBillNo, string OrgCode, string UserCode, string PassWord, out string msg)
        {
            List <TRFQueryCgBill> cgBill = new List <TRFQueryCgBill>();

            if (!RecvMessageObj(QueryCgBillClass.QueryCgBill(CgBillNo, OrgCode, UserCode, PassWord), ref cgBill, out msg))
            {
                msg = "接收采购单失败:" + msg;
                return(false);
            }
            else
            {
                //接收成功,将数据存入本地数据库
                if (!JhBillDAL.AddBill(cgBill, out msg))//清空验收单表
                {
                    msg = "保存采购单表失败:" + msg;
                    return(false);
                }
                return(true);
            }
        }
Exemple #8
0
        private void button_3_Click(object sender, EventArgs e)
        {
            if (!ReadCgBillSuccess)
            {
                string msg;
                if (string.IsNullOrEmpty(tbRefBillNo.Text.Trim()) && string.IsNullOrEmpty(tbCkCode.Text.Trim()))
                {
                    MessageBox.Show(lbRefBillNo.Text + "、仓库编码不能为空");
                    return;
                }
                if (rbIsCgJh.Checked)
                {
                    ShowWait("正在查询采购单\r\n...请稍候...");
                    if (!Comm.Comm.QueryCgBill(tbPreRefBillNo.Text + tbRefBillNo.Text, PubGlobal.OrgCode, PubGlobal.User.UserCode, PubGlobal.User.Password, out msg))
                    {
                        MessageBox.Show("采购单查询失败:" + msg);
                        tbRefBillNo.Focus();
                        tbRefBillNo.SelectAll();
                        HideWait();
                        return;
                    }
                    HideWait();
                }

                if (PubGlobal.JhBillInfo == null)
                {
                    PubGlobal.JhBillInfo = new Model.DBModel.DBJhBillInfo();
                }
                PubGlobal.JhBillInfo.PreRefBillNo = tbPreRefBillNo.Text;
                PubGlobal.JhBillInfo.LrUser       = PubGlobal.User.USERNAME;
                PubGlobal.JhBillInfo.RefBillNo    = tbRefBillNo.Text;
                PubGlobal.JhBillInfo.CkCode       = tbCkCode.Text;
                PubGlobal.JhBillInfo.IsCgJh       = rbIsCgJh.Checked;
                if (!JhBillDAL.SaveJhBillInfo(PubGlobal.JhBillInfo, out msg))
                {
                    MessageBox.Show("保存单据信息失败:" + msg);
                    return;
                }
            }
            this.DialogResult = DialogResult.OK;
        }
Exemple #9
0
 private void button_2_Click(object sender, EventArgs e)
 {
     if (dgBillMx.CurrentRowIndex >= 0)
     {
         DBJhBill      bill       = (DBJhBill)dBJhBillBindingSource.Current;
         StringBuilder strBuilder = new StringBuilder();
         strBuilder.AppendFormat("是否删除【{0}】{1}", new string[] { bill.Barcode, bill.PluName });
         if (MessageBox.Show(strBuilder.ToString(), "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
         {
             string msg;
             if (!JhBillDAL.DeleteBill(bill, out msg))
             {
                 MessageBox.Show("删除失败:" + msg);
             }
             else
             {
                 jhBill.RemoveAt(jhBill.FindIndex(a => a.ID == bill.ID));
                 dBJhBillBindingSource.ResetBindings(true);
             }
         }
     }
 }
Exemple #10
0
 private void button_4_Click(object sender, EventArgs e)
 {
     if (PubGlobal.JhBillInfo != null)
     {
         if (MessageBox.Show("采购单未发送至后台。是否要删除此采购单?", "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
         {
             if (MessageBox.Show("采购单清空后将无法恢复。确认清空采购单?", "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) != DialogResult.Yes)
             {
                 return;
             }
             string msg;
             if (!JhBillDAL.RemoveJhBill(out msg))
             {
                 MessageBox.Show("清空失败:" + msg);
                 return;
             }
             jhBill.Clear();
             dBJhBillBindingSource.Clear();
         }
     }
     jhBill            = null;
     this.DialogResult = DialogResult.OK;
 }
Exemple #11
0
        /// <summary>
        /// 查询商品信息及订单信息
        /// </summary>
        private void PluQuery(string code)
        {
            ShowWait("正在查询商品\r\n请稍候...");
            string msg;

            if (PubGlobal.JhBillInfo.IsCgJh)
            {
                //数据库中查询采购单明细
                if (!JhBillDAL.QueryPluFromBill(code, out PubGlobal.Cur_TRFQueryPlu, out msg))
                {
                    MessageBox.Show("查询商品错误:" + msg);
                }
            }
            else
            {//从服务器获取商品信息
                if (!Comm.Comm.QeryPlu(code, PubGlobal.OrgCode, PubGlobal.User.UserCode, PubGlobal.User.Password, ref PubGlobal.Cur_TRFQueryPlu, out msg))
                {
                    //MessageBox.Show("查询商品错误:" + msg);
                }
            }
            HideWait();
            ReFlush();
            cbxPackSpec.Focus();
        }
Exemple #12
0
        /// <summary>
        /// 刷新页面显示
        /// </summary>
        private void ReFlush()
        {
            string msg;

            tbCode.Text = PubGlobal.Cur_TRFQueryPlu == null ? string.Empty :
                          (string.IsNullOrEmpty(PubGlobal.Cur_TRFQueryPlu[0].BARCODE) ? PubGlobal.Cur_TRFQueryPlu[0].PLUCODE : PubGlobal.Cur_TRFQueryPlu[0].BARCODE);
            tbPluName.Text = PubGlobal.Cur_TRFQueryPlu == null ? string.Empty : PubGlobal.Cur_TRFQueryPlu[0].PLUNAME;
            tbSpec.Text    = PubGlobal.Cur_TRFQueryPlu == null ? string.Empty : PubGlobal.Cur_TRFQueryPlu[0].SPEC;
            tbUnit.Text    = PubGlobal.Cur_TRFQueryPlu == null ? string.Empty : PubGlobal.Cur_TRFQueryPlu[0].UNIT;
            if (PubGlobal.Cur_TRFQueryPlu != null)
            {
                if (PubGlobal.Cur_TRFQueryPlu[0].Packets == null || PubGlobal.Cur_TRFQueryPlu[0].Packets.Count == 0)
                {
                    cbxPackSpec.Enabled   = false;
                    tbSsPackCount.Enabled = false;
                    if (PubGlobal.JhBillInfo.IsCgJh)
                    {
                        //从本地数据库获取单据Model
                        if (!JhBillDAL.GetBill(PubGlobal.Cur_TRFQueryPlu[0].PLUID, out PubGlobal.JhBillModel, out msg))
                        {
                            MessageBox.Show("获取采购单明细失败:" + msg);
                            return;
                        }
                    }
                    else
                    {
                        //数据库读取Model
                        if (!JhBillDAL.GetBill(PubGlobal.Cur_TRFQueryPlu[0].PLUID, out PubGlobal.JhBillModel, out msg))
                        {
                            //新建Model
                            if (!NewModel())
                            {
                                MessageBox.Show("新建单据明细失败");
                                return;
                            }
                        }
                    }
                    tbCgPackCount.Text = PubGlobal.JhBillModel == null ? "0" : PubGlobal.JhBillModel.CgPackCount.ToString();
                    tbCgSglCount.Text  = PubGlobal.JhBillModel == null ? "0" : PubGlobal.JhBillModel.CgSGLCount.ToString();
                    tbSsPackCount.Text = PubGlobal.JhBillModel == null ? "0" : PubGlobal.JhBillModel.SsPackCount.ToString();
                    tbSsSglCount.Text  = PubGlobal.JhBillModel == null ? "0" : PubGlobal.JhBillModel.SsSGLCount.ToString();
                    tbSsSglCount.Focus();
                    tbSsSglCount.SelectAll();
                    BindingPackSpec();
                    return;
                }
                cbxPackSpec.Enabled    = true;
                tbSsPackCount.Enabled  = true;
                cbxPackSpec.DataSource = null;
                BindingPackSpec();
            }
            else
            {
                cbxPackSpec.Enabled = false;
                tbCgPackCount.Text  = "0";
                tbCgSglCount.Text   = "0";
                tbSsPackCount.Text  = "0";
                tbSsSglCount.Text   = "0";
            }
            tbCode.Focus();
            tbCode.SelectAll();
        }