YL
2022-01-21 29ce1d4f722df360f36a5d00149bcd180526fb82
WarM/²Ö¿â¹ÜÀí/Gy_BarCodeBill_ChaiMa.cs
@@ -61,7 +61,24 @@
            oSumGrid_Pay.NoCol = HSnoCol2;
        }
       #region çª—体处理方法
        #region çª—体处理方法
        //初始化页签1数据
        private void intoDate()
        {
            try
            {
                DataSet Ds;
                SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
                Ds = oCn.RunProcReturn("select * from h_v_Gy_BarCodeBill_ChaiMa", "h_v_Gy_BarCodeBill_ChaiMa");
                grdMain.DataSource = Ds.Tables[0].DefaultView;
            }
            catch (Exception ex )
            {
                MessageBox.Show(ex.Message.ToString());
            }
        }
        //初始化页签1
        private void initGrid()
@@ -82,10 +99,8 @@
            ////隐藏列
            grdMain.Columns[HTagCol].Visible = false;
            grdMain.Columns[HInterID].Visible = false;
            //设置可编辑列
            string sAllowCol = HNum.ToString();
            //设置合计列
            string sTotalCol = HTagCol.ToString() + "0";
            intoDate();
            //格式化网格
            //DBUtility.Xt_BaseBillFun.initGridLast(sAllowCol, sTotalCol, oSumGrid_Mater);
        }
@@ -134,26 +149,26 @@
            Sub_ClearBill();
        }
        //数据验证
        private bool Sub_AllowSave()
        {
            for (int i = 0; i <= grdMain_Pay.RowCount - 1; i++)
            {
                if (ClsPub.isLong(grdMain_Pay.Rows[i].Cells[HSnoCol2].Value) != 0)
                {
                    if (ClsPub.isStrNull(grdMain_Pay.Rows[i].Cells[HNum2].Value) ==null)
                    {
                        MessageBox.Show("请将表格拆分数量填写完整", "提示");
                        return false;
                    }
                }
                else
                {
                    return false;
                }
            }
            return true;
        }
        ////数据验证
        //private bool Sub_AllowSave()
        //{
        //    for (int i = 0; i <= grdMain_Pay.RowCount - 1; i++)
        //    {
        //        if (ClsPub.isLong(grdMain_Pay.Rows[i].Cells[HSnoCol2].Value) != 0)
        //        {
        //            if (ClsPub.isStrNull(grdMain_Pay.Rows[i].Cells[HNum2].Value) ==null)
        //            {
        //                MessageBox.Show("请将表格拆分数量填写完整", "提示");
        //                return false;
        //            }
        //        }
        //        else
        //        {
        //            return true;
        //        }
        //    }
        //    return true;
        //}
        
        //生成按钮
        private void xz_Click(object sender, EventArgs e)
@@ -170,13 +185,13 @@
                //判断会计期是否合理
                string HBillNo = txtHBillNo.Text;
                DataSet Ds;
                double sum = 0.00000000;
                SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
                Ds = oCn.RunProcReturn("select top 1* from h_v_Gy_BarCodeBill_ChaiMa where æ¡ç ç¼–号='" + HBillNo + "'", "h_v_Gy_BarCodeBill_ChaiMa");
                Ds = oCn.RunProcReturn("select top 1* from Gy_BarCodeBill where HBarCode='" + HBillNo + "'", "h_v_Gy_BarCodeBill_ChaiMa");
                for (i = 0; i <= grdMain_Pay.RowCount - 1; i++)
                {
                    if (ClsPub.isLong(grdMain_Pay.Rows[i].Cells[HSnoCol2].Value) != 0)
                    {
                        Model.ClsGy_BarCodeEdit_Model model = new Model.ClsGy_BarCodeEdit_Model();
                        //固定赋值========================================
                        model.HEntryID = i + 1;
@@ -198,7 +213,6 @@
                        model.HSourceBillNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HSourceBillNo"].ToString());
                        model.HSourceBillType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HSourceBillType"].ToString());
                        model.HUseFlag = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HUseFlag"].ToString());
                        model.HStopflag = DBUtility.ClsPub.isBool(Ds.Tables[0].Rows[0]["HStopflag"].ToString());
                        model.HInitQty = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HInitQty"].ToString());
                        model.HSourceID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HInitQty"].ToString());
                        model.HCusID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCusID"].ToString());
@@ -211,33 +225,40 @@
                        model.HMakeDate = DateTime.Now;
                        model.HMaker = ClsPub.CurUserName;
                        if (model.HPieceQty <= 0 || model.HPieceQty.ToString() == "")
                        if (model.HQty <= 0 || model.HQty.ToString() == "")
                        {
                            MessageBox.Show("第" + ClsPub.isStrNull(i + 1) + "行,拆分数量必须大于0!");
                            MessageBox.Show("页2第" + ClsPub.isStrNull(i + 1) + "行,拆分数量必须大于0!");
                            return false;
                        }
                        sum += model.HQty;
                        BillNew.DetailColl_Mater.Add(model);
                    }
                    else
                    {
                        break;
                    }
                }
                //保存
                bResult = BillNew.AddBill(ref ClsPub.sExeReturnInfo);
                //提示
                if (bResult == true)
                if (sum > DBUtility.ClsPub.isDoule(grdMain.Rows[0].Cells[HQty].Value))
                {
                    MessageBox.Show("单据存盘完毕!单据号:" + this.txtHBillNo.Text.Trim(), "提示");
                    return true;
                     MessageBox.Show("页2拆分数量之和必须小于条码数量!");
                    return false;
                }
                else
                {
                    MessageBox.Show("保存失败!原因:" + ClsPub.sExeReturnInfo, "提示");
                    return false;
                    //保存
                    bResult = BillNew.AddBill(ref ClsPub.sExeReturnInfo, HBillNo);
                    //提示
                    if (bResult == true)
                    {
                        MessageBox.Show("单据存盘完毕!单据号:" + this.txtHBillNo.Text.Trim(), "提示");
                        return true;
                    }
                    else
                    {
                        MessageBox.Show("保存失败!原因:" + ClsPub.sExeReturnInfo, "提示");
                        return false;
                    }
                }
            //}
            //else
            //{
            //    return false;
            //}
        }
        //确定按钮
        private void button1_Click(object sender, EventArgs e)