Ejemplo n.º 1
0
        private void LoadBaseItem()
        {
            string  sErr = "";
            string  sSql = "select cTypeId,cTypeName from TPC_MaterialType where cTypeMode = 0 ";
            DataSet set  = null;

            set = DBFuns.GetDataBySql(base.AppInformation.SvrSocket, false, sSql, "MatType", 0, 0, "", out sErr);
            if ((sErr.Trim() != "0") && (sErr.Trim() != ""))
            {
                MessageBox.Show(sErr);
            }
            if (set != null)
            {
                DataTable table = set.Tables["MatType"];
                this.cmb_cTypeId1.DisplayMember = "cTypeName";
                this.cmb_cTypeId1.ValueMember   = "cTypeId";
                this.cmb_cTypeId1.DataSource    = table;
                table.Clear();
            }
            set.Clear();
            sSql = "select cTypeId,cTypeName from TPC_MaterialType where cTypeMode = 1 ";
            set  = DBFuns.GetDataBySql(base.AppInformation.SvrSocket, false, sSql, "ACNTType", 0, 0, "", out sErr);
            if ((sErr.Trim() != "0") && (sErr.Trim() != ""))
            {
                MessageBox.Show(sErr);
            }
            if (set != null)
            {
                set.Tables["ACNTType"].Clear();
            }
            set.Clear();
        }
Ejemplo n.º 2
0
        private void btn_Qry_Click(object sender, EventArgs e)
        {
            string  sErr = "";
            string  sSql = GetSql();
            DataSet dsX  = null;

            Cursor.Current = Cursors.WaitCursor;
            try
            {
                dsX            = DBFuns.GetDataBySql(AppInformation.SvrSocket, false, sSql, "IOStoreDtl", 0, 0, "", out sErr);
                Cursor.Current = Cursors.Default;
            }
            catch (Exception err)
            {
                Cursor.Current = Cursors.Default;
                MessageBox.Show(err.Message);
                return;
            }
            if (sErr.Trim() != "" && sErr.Trim() != "0")
            {
                MessageBox.Show(sErr);
                return;
            }
            if (dsX != null)
            {
                DataTable tbX = dsX.Tables["IOStoreDtl"];
                bds_Data.DataSource = tbX.Copy();
                dsX.Clear();
            }
        }
Ejemplo n.º 3
0
        private void btn_Qry_Click(object sender, EventArgs e)
        {
            string  sErr = "";
            string  sql  = this.GetSql();
            DataSet set  = null;

            Cursor.Current = Cursors.WaitCursor;
            try
            {
                set            = DBFuns.GetDataBySql(base.AppInformation.SvrSocket, false, sql, "IOStoreDtl", 0, 0, "", out sErr);
                Cursor.Current = Cursors.Default;
            }
            catch (Exception exception)
            {
                Cursor.Current = Cursors.Default;
                MessageBox.Show(exception.Message);
                return;
            }
            if ((sErr.Trim() != "") && (sErr.Trim() != "0"))
            {
                MessageBox.Show(sErr);
            }
            else if (set != null)
            {
                this.bds_Data.DataSource = set.Tables["IOStoreDtl"].Copy();
                set.Clear();
            }
        }
Ejemplo n.º 4
0
        private void btn_Qry_Click(object sender, EventArgs e)
        {
            string        sErr    = "";
            StringBuilder builder = new StringBuilder("");

            builder.Append("select  mat.cMNo,mat.cName,mat.cSpec,mat.cMatStyle,mat.cMatQCLevel,mat.cMatOther,mat.cRemark,");
            builder.Append("mat.fQtyBox,mat.fSafeQtyDn,mat.fSafeQtyUp,mat.fWeight,mat.cUnit,mat.cTypeId1,mat.cTypeId2,isnull(mat.cABC,'C') cABC,");
            builder.Append("mt.cTypeName cType1,atp.cTypeName cType2,sum(isnull(st.fQty,0)) fQty,mat.nKeepDay,isnull(st.cDtlSupplier,' ') cSupplier,isnull(st.cDtlCSId,' ') cCSId,isnull(mat.nMatClass,0) nMatClass,isnull(isnull(st.cDtlRemark,st.cStoreRemark),' ') cDtlRemark ");
            builder.Append("\tfrom TPC_Material mat ");
            builder.Append("  left join V_MaterialMatType mt on mat.cTypeId1=mt.cTypeId ");
            builder.Append("  left join V_MaterialAcntType atp on mat.cTypeId2=atp.cTypeId ");
            builder.Append("  left join V_StoreItemList st on mat.cMNo=st.cMNo ");
            builder.Append(" where 1=1 ");
            builder.Append(this.GetCondition());
            builder.Append("  group by mat.cMNo,mat.cName,mat.cSpec,mat.cMatStyle,mat.cMatQCLevel,mat.cMatOther,mat.cRemark, ");
            builder.Append("  mat.fQtyBox,mat.fSafeQtyDn,mat.fSafeQtyUp,mat.fWeight,mat.cUnit,mat.cTypeId1,mat.cTypeId2,mt.cTypeName,");
            builder.Append(" atp.cTypeName,mat.cABC,mat.nKeepDay,isnull(st.cDtlSupplier,' '),isnull(st.cDtlCSId,' ') ,isnull(mat.nMatClass,0),isnull(isnull(st.cDtlRemark,st.cStoreRemark),' ')");
            DataSet set = null;

            Cursor.Current = Cursors.WaitCursor;
            try
            {
                set            = DBFuns.GetDataBySql(base.AppInformation.SvrSocket, false, builder.ToString(), "TPC_Material", 0, 0, "", out sErr);
                Cursor.Current = Cursors.Default;
            }
            catch (Exception exception)
            {
                Cursor.Current = Cursors.Default;
                MessageBox.Show(exception.Message);
                return;
            }
            if ((sErr.Trim() != "") && (sErr.Trim() != "0"))
            {
                MessageBox.Show(sErr);
            }
            else
            {
                DataTable table = set.Tables["TPC_Material"];
                this.bds_Data.DataSource = table;
            }
        }
Ejemplo n.º 5
0
        private void LoadBaseItem()
        {
            string sErr = "";
            //物料属性分类
            string  sSql = "select cTypeId,cTypeName from TPC_MaterialType where cTypeMode = 0 ";
            DataSet dsX  = null;

            dsX = DBFuns.GetDataBySql(AppInformation.SvrSocket, false, sSql, "MatType", 0, 0, "", out sErr);
            if (sErr.Trim() != "0" && sErr.Trim() != "")
            {
                MessageBox.Show(sErr);
            }
            if (dsX != null)
            {
                DataTable tbX = dsX.Tables["MatType"];
                cmb_cTypeId1.DisplayMember = "cTypeName";
                cmb_cTypeId1.ValueMember   = "cTypeId";
                cmb_cTypeId1.DataSource    = tbX;
                tbX.Clear();
            }
            dsX.Clear();
            sSql = "select cTypeId,cTypeName from TPC_MaterialType where cTypeMode = 1 ";
            dsX  = DBFuns.GetDataBySql(AppInformation.SvrSocket, false, sSql, "ACNTType", 0, 0, "", out sErr);
            if (sErr.Trim() != "0" && sErr.Trim() != "")
            {
                MessageBox.Show(sErr);
            }
            if (dsX != null)
            {
                DataTable tbX = dsX.Tables["ACNTType"];
                //cmb_cTypeId2.DisplayMember = "cTypeName";
                //cmb_cTypeId2.ValueMember = "cTypeId";
                //cmb_cTypeId2.DataSource = tbX;
                tbX.Clear();
            }
            dsX.Clear();
        }
Ejemplo n.º 6
0
        private void btnQry_Click(object sender, EventArgs e)
        {
            if (dtpFind_B.Value > dtpFind_E.Value)
            {
                MessageBox.Show("对不起,起始时间不能大于截止时间!");
                dtpFind_B.Focus();
                return;
            }
            StringBuilder strSql = new StringBuilder("select * from V_TWB_BillMergePlt where (dCreateDate >='" + dtpFind_B.Value.ToString("yyyy-MM-dd 00:00:00") + "' and dCreateDate <='" + dtpFind_E.Value.ToString("yyyy-MM-dd 23:59:59") + "')");

            #region 条件
            if (cmbFindUser.Text.Trim() != "" && cmbFindUser.Text.Trim() != "全部" && cmbFindUser.SelectedValue != null)
            {
                strSql.Append(" and cCreator='" + cmbFindUser.SelectedValue.ToString().Trim() + "'");
            }
            if (txtFindBillNo.Text.Trim() != "")
            {
                strSql.Append(" and cBNo like '%" + txtFindBillNo.Text.Trim() + "%'");
            }
            if (this.cmbFindCheck.Text.Trim() != "" && cmbFindCheck.Text.Trim() != "全部" && cmbFindCheck.SelectedIndex >= 0 && cmbFindCheck.SelectedIndex <= 1)
            {
                strSql.Append(" and isnull(bIsChecked,0)='" + cmbFindCheck.SelectedIndex.ToString().Trim() + "'");
            }
            if (this.cmb_FinishedStatus.Text.Trim() != "" && cmb_FinishedStatus.Text.Trim() != "全部" && cmb_FinishedStatus.SelectedIndex >= 0 && cmb_FinishedStatus.SelectedIndex <= 1)
            {
                strSql.Append(" and isnull(bIsFinished,0)='" + cmb_FinishedStatus.SelectedIndex.ToString().Trim() + "'");
            }
            #endregion

            DataSet dsX  = null;
            string  sErr = "";
            Cursor.Current = Cursors.WaitCursor;
            dsX            = DBFuns.GetDataBySql(AppInformation.SvrSocket, false, strSql.ToString(), strTbNameMain, 0, 0, "dCreateDate,dCheckDate", out sErr);
            Cursor.Current = Cursors.Default;
            if (sErr.Trim() != "" && sErr.Trim() != "0")
            {
                MessageBox.Show(sErr);
                return;
            }
            if (dsX == null)
            {
                MessageBox.Show("获取数据时失败!");
                return;
            }
            DataTable tbData = null;
            if (dsX.Tables.Count > 0)
            {
                if (dsX.Tables[0].Rows[0][0].ToString() == "-1")
                {
                    MessageBox.Show(dsX.Tables[0].Rows[0][1].ToString());
                    return;
                }
                if (dsX.Tables[strTbNameMain] != null)
                {
                    tbData = dsX.Tables[strTbNameMain].Copy();
                }
                if (tbData == null)
                {
                    MessageBox.Show("获取数据时失败!");
                    return;
                }
            }
            Cursor.Current     = Cursors.WaitCursor;
            bDSIsOpenForMain   = false;
            bdsMain.DataSource = tbData;
            grdList.DataSource = bdsMain;
            bDSIsOpenForMain   = true;
            lbl_M_Count.Text   = bdsMain.Count.ToString();
            Cursor.Current     = Cursors.Default;
            bdsMain_PositionChanged(null, null);
        }