コード例 #1
0
ファイル: FrmStockDtl.cs プロジェクト: windygu/SGWMS
        public void LoadAreaList(string sWHId)
        {
            string  sErr = "";
            string  sSql = "select * from TWC_WArea where bUsed=1 and cWHId='" + sWHId + "'";
            DataSet dstt = null;

            Cursor.Current = Cursors.WaitCursor;
            try
            {
                dstt = DBFuns.GetDataBySql(AppInformation.SvrSocket, false, sSql, "data", 0, 0, "", out sErr);
            }
            catch (Exception err)
            {
                Cursor.Current = Cursors.Default;
                MessageBox.Show(err.Message);
                return;
            }
            Cursor.Current = Cursors.Default;
            if (sErr.Trim() != "" && sErr.Trim() != "0")
            {
                MessageBox.Show(sErr);
                return;
            }
            if (dstt != null)
            {
                DataTable tbX = dstt.Tables["data"];
                cmb_cAreaId.DisplayMember = "cAreaName";
                cmb_cAreaId.ValueMember   = "cAreaId";
                cmb_cAreaId.DataSource    = tbX;
                cmb_cAreaId.SelectedIndex = -1;
            }
        }
コード例 #2
0
ファイル: FrmStockDtl.cs プロジェクト: windygu/SGWMS
        private void BindCType1Data()
        {
            /*select CTYPEID,CTYPENAME from TPC_MATERIALTYPE*/
            string  sErr = "";
            string  sSql = string.Format("select CTYPEID,CTYPENAME from TPC_MATERIALTYPE");
            DataSet dstt = null;

            try
            {
                dstt = DBFuns.GetDataBySql(AppInformation.SvrSocket, false, sSql, "data", 0, 0, "", out sErr);
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
                return;
            }
            if (sErr.Trim() != "" && sErr.Trim() != "0")
            {
                MessageBox.Show(sErr);
                return;
            }
            if (dstt != null)
            {
                DataTable tbX = dstt.Tables["data"];
                cmb_cTypeId1.DisplayMember = "CTYPENAME";
                cmb_cTypeId1.ValueMember   = "CTYPEID";
                cmb_cTypeId1.DataSource    = tbX;
                cmb_cTypeId1.SelectedIndex = -1;
            }
        }
コード例 #3
0
ファイル: frmOutStoreByAuto.cs プロジェクト: windygu/SGWMS
        private void OpenDataList()
        {
            string        sErr    = "";
            StringBuilder builder = new StringBuilder(this.sSql);

            if (base.UserInformation.UType != UserType.utSupervisor)
            {
                builder.Append(" and isnull(b.cChecker,'') in (select cName from TPB_User where cDeptId='" + base.UserInformation.DeptId + "')");
            }
            if (this.txt_BillNo.Text.Trim() != "")
            {
                builder.Append(" and b.cBNo like '%" + this.txt_BillNo.Text.Trim() + "%'");
            }
            if (this.txt_MatName.Text.Trim() != "")
            {
                builder.Append(" and ( dtl.cMNo like '%" + this.txt_MatName.Text.Trim() + "%' or isnull(mat.cName,'') like '%" + this.txt_MatName.Text.Trim() + "%' or isnull(mat.cWBJM,'') like '%" + this.txt_MatName.Text.Trim() + "%' ");
                builder.Append(" or isnull(mat.cPYJM,'') like '%" + this.txt_MatName.Text.Trim() + "%' or isnull(mat.cSpec,'') like '%" + this.txt_MatName.Text.Trim() + "%'");
                builder.Append(")");
            }
            DataSet set = DBFuns.GetDataBySql(base.AppInformation.SvrSocket, false, builder.ToString(), "tbBillDtl", 0, 0, "", out sErr);

            if (((set != null) && (sErr.Trim() != "")) && (sErr.Trim() != "0"))
            {
                MessageBox.Show(sErr);
            }
            else
            {
                this.grd_Data.DataSource = set.Tables["tbBillDtl"];
                this.lbl_DataCount.Text  = set.Tables["tbBillDtl"].Rows.Count.ToString();
            }
        }
コード例 #4
0
        private void LoadBaseItem()
        {
            #region
            string sBClass = "";
            if (_IsInBill)
            {
                sBClass = "1";
            }
            else
            {
                sBClass = "2";
            }
            string sSql = "select cBTypeId,cBType,nBClass from tpb_billtype where nBClass=" + sBClass +
                          "  and bUsed=1  order by nSort,cBTypeId";
            #endregion
            DataSet dsX  = null;
            string  sErr = "";
            #region 单据类型
            dsX = DBFuns.GetDataBySql(AppInformation.SvrSocket, false, sSql, "btype", 0, 0, "", out sErr);
            if (sErr.Trim() != "0" && sErr.Trim() != "")
            {
                MessageBox.Show(sErr);
                return;
            }
            DataTable tbBType = dsX.Tables["btype"].Copy();
            if (tbBType != null)
            {
                cmb_BillType.DisplayMember = "cBType";
                cmb_BillType.ValueMember   = "cBTypeId";
                cmb_BillType.DataSource    = tbBType;
                return;
            }
            #endregion

            #region 供货部门
            if (_IsInBill)
            {
                sSql = "select cCSId,cCSNameJ from TPB_CuSupplier where nType=0 and bUsed=1";
            }
            else
            {
                sSql = "select cCSId,cCSNameJ from TPB_CuSupplier where nType=1 and bUsed=1";
            }
            dsX = DBFuns.GetDataBySql(AppInformation.SvrSocket, false, sSql, "TPB_CuSupplier", 0, 0, "", out sErr);
            if (sErr.Trim() != "0" && sErr.Trim() != "")
            {
                MessageBox.Show(sErr);
                return;
            }
            DataTable tbCuSupplier = dsX.Tables["TPB_CuSupplier"].Copy();
            if (tbCuSupplier != null)
            {
                cmb_Dept.DisplayMember = "cCSNameJ";
                cmb_Dept.ValueMember   = "cCSNameJ";
                cmb_Dept.DataSource    = tbCuSupplier;
                return;
            }
            #endregion
        }
コード例 #5
0
        private void LoadOptNoList(string sWHId, string sOptGroup, int nRow)
        {
            int num = 0;

            if (nRow > 0)
            {
                num = nRow;
            }
            num = (num + 1) / 2;
            string sSql = "select nOptNo from TECS_HSInfo where 1=1 ";

            if (sWHId.Trim() != "")
            {
                sSql = sSql + " and cWHId='" + sWHId.Trim() + "'";
            }
            if (sOptGroup.Trim() != "")
            {
                sSql = sSql + " and cGroupName='" + sOptGroup.Trim() + "'";
            }
            if (num > 0)
            {
                sSql = sSql + " and nLine=" + num.ToString();
            }
            string  sErr = "";
            DataSet set  = null;

            set = DBFuns.GetDataBySql(base.AppInformation.SvrSocket, false, sSql, "OptNo", 0, 0, "", out sErr);
            if ((sErr.Trim() != "") && (sErr.Trim() != "0"))
            {
                MessageBox.Show(sErr);
            }
            else if (set != null)
            {
                DataTable table = set.Tables["OptNo"];
                if (table != null)
                {
                    this.cmb_Port.DisplayMember = "nOptNo";
                    this.cmb_Port.ValueMember   = "nOptNo";
                    this.cmb_Port.DataSource    = table;
                    if (this.cmb_Port.Items.Count > 0)
                    {
                        this.cmb_Port.SelectedIndex = 0;
                    }
                }
            }
        }
コード例 #6
0
        private void LoadOptGroup(string sWHId)
        {
            string sSql = "select distinct cGroupName from TECS_HSInfo ";

            if (sWHId.Trim() != "")
            {
                sSql = sSql + " where cWHId='" + sWHId.Trim() + "'";
            }
            string  sErr = "";
            DataSet set  = null;

            set = DBFuns.GetDataBySql(base.AppInformation.SvrSocket, false, sSql, "OptGroup", 0, 0, "", out sErr);
            if ((sErr.Trim() != "") && (sErr.Trim() != "0"))
            {
                MessageBox.Show(sErr);
            }
            else if (set != null)
            {
                DataTable table = set.Tables["OptGroup"];
                if (table != null)
                {
                    this.cmb_OptGroup.DisplayMember = "cGroupName";
                    this.cmb_OptGroup.ValueMember   = "cGroupName";
                    this.cmb_OptGroup.DataSource    = table;
                    string sValue = "";
                    if (MyConfigure.ReadMyArributeValue(base.AppInformation.AppPath + @"\" + base.AppInformation.AppConfigFile, "config/ECS/OptGroup", "Default", out sValue, out sErr))
                    {
                        if (this.cmb_OptGroup.Items.Count > 0)
                        {
                            if (sValue.Trim() != "")
                            {
                                this.cmb_OptGroup.SelectedValue = sValue;
                            }
                            else
                            {
                                this.cmb_OptGroup.SelectedIndex = 0;
                            }
                        }
                    }
                    else if (this.cmb_OptGroup.Items.Count > 0)
                    {
                        this.cmb_OptGroup.SelectedIndex = 0;
                    }
                }
            }
        }
コード例 #7
0
        private void btn_Query_Click(object sender, EventArgs e)
        {
            if (dtp_From.Value > dtp_To.Value)
            {
                MessageBox.Show("对不起,开始时间不能大于截止时间!");
                dtp_From.Focus();
                return;
            }
            string  sDesc = "";
            string  sErr  = "";
            string  sSql  = sSqlStr + GetCondition(out sDesc);
            DataSet dsX   = null;

            try
            {
                dsX = DBFuns.GetDataBySql(AppInformation.SvrSocket, false, sSql, "ioDetail", 0, 0, "dDate", out sErr);
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
                return;
            }
            if (sErr.Trim() != "" && sErr.Trim() != "0")
            {
                MessageBox.Show(sErr);
                return;
            }
            if (dsX == null)
            {
                return;
            }
            DataTable tbX = dsX.Tables["ioDetail"];

            bds_List.DataSource = tbX;
            grd_List.DataSource = bds_List;
            lbl_Count.Text      = bds_List.Count.ToString();
        }
コード例 #8
0
ファイル: FrmStockDtl.cs プロジェクト: windygu/SGWMS
        private bool QueryStoreDtlList()
        {
            StringBuilder sCon = new StringBuilder("");
            StringBuilder sSql = new StringBuilder("");

            sSql.Append("select st.cItemId cMNo,st.cMName,st.cSpec,st.cMatStyle,st.cMatQCLevel,st.cMatOther,st.cRemark,st.cBatchNo,st.fQty,st.cUnit,");
            sSql.Append(" st.dProdDate,st.dBadDate,st.cDtlCSId,st.cDtlSupplier,st.cStoreRemark,st.cBNoIn,st.nItemIn,st.nQCStatus,st.cQCStatus, ");
            sSql.Append(" wc.nPalletId,wc.cPosId,wc.cWHId,wc.cAreaId,wa.cAreaName,st.cABC,wh.cName cWHName 	from V_StoreItemList st ");
            sSql.Append(" left join TWC_WareCell wc on st.nPalletId=isnull(wc.nPalletId,' ') ");
            sSql.Append(" left join TWC_Warehouse wh on wc.cWHId=wh.cWHId ");
            sSql.Append(" left join TWC_WArea wa on wc.cAreaId=wa.cAreaId");

            #region 条件
            #region
            if (cmb_cWHId.Text.Trim() != "" && cmb_cWHId.SelectedValue != null && cmb_cWHId.SelectedIndex > -1)
            {
                if (sCon.Length > 0)
                {
                    sCon.Append(" and isnull(wc.cWHId,' ')='" + cmb_cWHId.SelectedValue.ToString() + "'");
                }
                else
                {
                    sCon.Append(" where isnull(wc.cWHId,' ')='" + cmb_cWHId.SelectedValue.ToString() + "'");
                }
            }
            if (cmb_cAreaId.Text.Trim() != "" && cmb_cAreaId.SelectedValue != null && cmb_cAreaId.SelectedIndex > -1)
            {
                if (sCon.Length > 0)
                {
                    sCon.Append(" and isnull(wc.cAreaId,' ')='" + cmb_cAreaId.SelectedValue.ToString() + "'");
                }
                else
                {
                    sCon.Append(" where isnull(wc.cAreaId,' ')='" + cmb_cAreaId.SelectedValue.ToString() + "'");
                }
            }
            if (txtPalletId.Text.Trim() != "")
            {
                string sPalletId = txtPalletId.Text.Trim();
                if (sCon.Length > 0)
                {
                    sCon.Append(" and st.nPalletId like '%" + sPalletId + "'");
                }
                else
                {
                    sCon.Append(" where st.nPalletId like '%" + sPalletId + "'");
                }
            }
            if (this.txt_cPosId.Text.Trim() != "")
            {
                string sPosId = txt_cPosId.Text.Trim();
                if (sCon.Length > 0)
                {
                    sCon.Append(" and isnull(wc.cPosId,' ') like '%" + sPosId + "'");
                }
                else
                {
                    sCon.Append(" where isnull(wc.cPosId,' ') like '%" + sPosId + "'");
                }
            }
            #endregion
            int nX = 0;


            #region
            if (txt_cName.Text.Trim() != "")
            {
                string sX = txt_cName.Text.Trim();
                if (sCon.Length > 0)
                {
                    sCon.Append(" and ((isnull(st.cMNo,'~') like '%" + sX + "%') or (isnull(st.cMName,'~') like '%" + sX + "%') or (isnull(st.cWBJM,'~') like '%" + sX + "%')  or (isnull(st.cPYJM,'~') like '%" + sX + "%') )");
                }
                else
                {
                    sCon.Append(" where ((isnull(st.cMNo,'~') like '%" + sX + "%') or (isnull(st.cMName,'~') like '%" + sX + "%') or (isnull(st.cWBJM,'~') like '%" + sX + "%')  or (isnull(st.cPYJM,'~') like '%" + sX + "%') )");
                }
            }
            if (txt_cBatchNo.Text.Trim() != "")
            {
                string sX = txt_cBatchNo.Text.Trim();
                if (sCon.Length > 0)
                {
                    sCon.Append(" and (isnull(st.cBatchNo,'~') like '%" + sX + "%')");
                }
                else
                {
                    sCon.Append(" where (isnull(st.cBatchNo,'~') like '%" + sX + "%')");
                }
            }
            if (this.txt_cSpec.Text.Trim() != "")
            {
                string sX = txt_cSpec.Text.Trim();
                if (sCon.Length > 0)
                {
                    sCon.Append(" and (isnull(st.cSpec,'~') like '%" + sX + "%')");
                }
                else
                {
                    sCon.Append(" where (isnull(st.cSpec,'~') like '%" + sX + "%')");
                }
            }
            if (this.txt_cRemark.Text.Trim() != "")
            {
                string sX = txt_cRemark.Text.Trim();
                if (sCon.Length > 0)
                {
                    sCon.Append(" and (isnull(st.cRemark,'~') like '%" + sX + "%')");
                }
                else
                {
                    sCon.Append(" where (isnull(st.cRemark,'~') like '%" + sX + "%')");
                }
            }
            if (this.txt_cMatStyle.Text.Trim() != "")
            {
                string sX = txt_cMatStyle.Text.Trim();
                if (sCon.Length > 0)
                {
                    sCon.Append(" and (isnull(st.cMatStyle,'~') like '%" + sX + "%')");
                }
                else
                {
                    sCon.Append(" where (isnull(st.cMatStyle,'~') like '%" + sX + "%')");
                }
            }
            if (this.txt_cMatQCLevel.Text.Trim() != "")
            {
                string sX = txt_cMatQCLevel.Text.Trim();
                if (sCon.Length > 0)
                {
                    sCon.Append(" and (isnull(st.cMatQCLevel,'~') like '%" + sX + "%')");
                }
                else
                {
                    sCon.Append(" where (isnull(st.cMatQCLevel,'~') like '%" + sX + "%')");
                }
            }
            if (this.txt_cMatOther.Text.Trim() != "")
            {
                string sX = txt_cMatOther.Text.Trim();
                if (sCon.Length > 0)
                {
                    sCon.Append(" and (isnull(st.cMatOther,'~') like '%" + sX + "%')");
                }
                else
                {
                    sCon.Append(" where (isnull(st.cMatOther,'~') like '%" + sX + "%')");
                }
            }
            if (cmb_cABC.Text.Trim() != "")
            {
                string sX = cmb_cABC.Text.Trim();
                if (sCon.Length > 0)
                {
                    sCon.Append(" and (isnull(st.cABC,'~') = '" + sX + "')");
                }
                else
                {
                    sCon.Append(" where (isnull(st.cABC,'~') = '" + sX + "')");
                }
            }
            #endregion

            #region
            if (cmb_cTypeId1.Text.Trim() != "" && cmb_cTypeId1.SelectedValue != null && cmb_cTypeId1.SelectedIndex > -1)
            {
                if (sCon.Length > 0)
                {
                    sCon.Append(" and (isnull(st.cTypeId1,'~') like '%" + cmb_cTypeId1.SelectedValue.ToString() + "%')");
                }
                else
                {
                    sCon.Append(" where (isnull(st.cTypeId1,'~') like '%" + cmb_cTypeId1.SelectedValue.ToString() + "%')");
                }
            }

            if (cmb_cABC.Text.Trim() != "")
            {
                string sX = cmb_cABC.Text.Trim();
                if (sCon.Length > 0)
                {
                    sCon.Append(" and (isnull(st.cABC,'~') like '%" + sX + "%') ");
                }
                else
                {
                    sCon.Append(" where (isnull(st.cABC,'~') like '%" + sX + "%') ");
                }
            }
            if (this.txt_cSupplier.Text.Trim() != "")
            {
                string sX = txt_cSupplier.Text.Trim();
                if (sCon.Length > 0)
                {
                    sCon.Append(" and ((isnull(st.cDtlCSId,'~') like '%" + sX + "%') or (isnull(st.cDtlSupplier,'~') like '%" + sX + "%') or (isnull(st.cDtlWBJM,'~') like '%" + sX + "%') or (isnull(st.cDtlPYJM,'~') like '%" + sX + "%'))");
                }
                else
                {
                    sCon.Append(" where ((isnull(st.cDtlCSId,'~') like '%" + sX + "%') or (isnull(st.cDtlSupplier,'~') like '%" + sX + "%') or (isnull(st.cDtlWBJM,'~') like '%" + sX + "%') or (isnull(st.cDtlPYJM,'~') like '%" + sX + "%'))");
                }
            }
            if (txt_cDtlRemark.Text.Trim() != "")
            {
                string sX = txt_cDtlRemark.Text.Trim();
                if (sCon.Length > 0)
                {
                    sCon.Append(" and (isnull(st.cDtlRemark,'~') like '%" + sX + "%') ");
                }
                else
                {
                    sCon.Append(" where (isnull(st.cDtlRemark,'~') like '%" + sX + "%') ");
                }
            }
            #endregion

            #endregion

            sSql.Append(sCon.ToString());

            bool bIsOK = false;
            //if (DBDataSet.Tables["TWC_WareCell"] != null)
            //    DBDataSet.Tables["TWC_WareCell"].Clear();
            grdData.AutoGenerateColumns = false;
            string sErr = "";
            //string sql = "select * from V_WareCellStatus " + strCon;
            //string sX = BI.BSIOBillBI.BSIOBillBI.QueryCellList(AppInformation.dbtApp, AppInformation.AppConn, DBDataSet, UserInformation, strCon);
            DataSet ds = null;
            Cursor.Current = Cursors.WaitCursor;
            try
            {
                dsX.Clear();
                dsX = DBFuns.GetDataBySql(AppInformation.SvrSocket, false, sSql.ToString(), "StockDtl", 0, 0, "", out sErr);
            }
            catch (Exception err)
            {
                Cursor.Current = Cursors.Default;
                MessageBox.Show(err.Message);
                return(false);
            }
            Cursor.Current = Cursors.Default;
            bIsOK          = sErr == "";
            sSql.Remove(0, sSql.Length);
            sCon.Remove(0, sCon.Length);
            if (bIsOK == true)
            {
                grdData.Focus();
                grdData.DataSource = dsX.Tables["StockDtl"];
            }
            else
            {
                MessageBox.Show(sErr);
            }
            return(bIsOK);
        }