public DataTable getReceis(receiSearch rs)
        {
            string locations = "";
            string whereStr  = "";

            if (rs.location.Count > 0)
            {
                for (int i = 0; i < rs.location.Count; i++)
                {
                    locations = locations + rs.location[i] + "','";
                }
            }
            if (locations.Length > 0)
            {
                locations = locations.Substring(0, locations.Length - 2);
            }

            // 厂区
            if (rs.org.Length > 0)
            {
                whereStr = whereStr + "  AND  org = '" + rs.org + "'";
            }
            // 仓库
            if (rs.subinv.Length > 0)
            {
                whereStr = whereStr + "  AND  subinv = '" + rs.subinv + "'";
            }
            // 线别
            if (locations.Length > 0)
            {
                whereStr = whereStr + "  AND  line in ( '" + locations + ")";
            }


            // 款式
            if (rs.style.Length > 0)
            {
                whereStr = whereStr + "  AND  style = '" + rs.style + "'";
            }
            //颜色
            if (rs.color.Length > 0)
            {
                whereStr = whereStr + "  AND  color = '" + rs.color + "'";
            }
            //PO
            if (rs.poNumber.Length > 0)
            {
                whereStr = whereStr + "  AND  PO = '" + rs.poNumber + "'";
            }
            // 送货单 号
            if (rs.ReceiNumber.Length > 0)
            {
                whereStr = whereStr + "  AND  receiNumber = '" + rs.ReceiNumber + "'";
            }
            if (rs.receiDate)
            {
                whereStr = whereStr + "  AND   DATE_FORMAT(receiInDate, '%Y-%m-%d')   BETWEEN '" + rs.starTime + "'  and '" + rs.stopTime + @"'";
            }


            //  whereStr = whereStr.Substring(0, whereStr.Length - 1);

            string sqlstr = @"
                            SELECT
	                            org,
	                            subinv,
	                            line,
	                            style,
	                            color,
	                            size,
	                            SUM( qtyCount ) qtyCount
	                             
                            FROM
	                            receis 
                            WHERE isFull = 0 " + whereStr + @"
                            GROUP BY
	                            org,
	                            subinv,
	                            line,
	                            style,
	                            color,
	                            size"    ;

            DataTable dt = new DataTable();

            if (MiddleWare == "1")
            {
                dt = MyCatfsg_SqlHelper.ExcuteTable(sqlstr);
            }
            else
            {
                dt = Mysqlfsg_SqlHelper.ExcuteTable(sqlstr);
            }
            return(dt);
        }
Exemple #2
0
 public DataTable getReceis(receiSearch rsp)
 {
     return(rs.getReceis(rsp));
 }
Exemple #3
0
        private void butSearch_Click(object sender, EventArgs e)
        {
            List <string> locations = new List <string>();

            for (int i = 0; i < this.cklbLocation.Items.Count; i++)
            {
                if (this.cklbLocation.GetItemChecked(i))
                {
                    locations.Add(this.cklbLocation.Items[i].ToString());
                }
            }
            receiSearch rs = new receiSearch();

            if (this.cbOrg.SelectedIndex < 0)
            {
                MessageBox.Show("请选择厂区");
                return;
            }
            rs.org = this.cbOrg.SelectedItem.ToString().Trim();

            if (this.cbSubinv.SelectedIndex < 0)
            {
                MessageBox.Show("请选择仓库");
                return;
            }
            rs.subinv = this.cbSubinv.SelectedItem.ToString();


            rs.location = locations;
            rs.style    = this.txtStyle.Text.Trim();
            rs.color    = this.txtColor.Text.Trim();
            if (chbReceiDate.Checked)
            {
                rs.receiDate = true;
            }
            else
            {
                rs.receiDate = false;
            }

            rs.starTime    = this.dtpStartDate.Value.ToString("yyyy-MM-dd");
            rs.stopTime    = this.dtpStopDate.Value.ToString("yyyy-MM-dd");
            rs.poNumber    = this.txtPO.Text.Trim();
            rs.ReceiNumber = this.txtReceiNumber.Text.Trim();
            this.splitContainer1.Panel1Collapsed  = false;
            this.splitContainer1.SplitterDistance = 300;


            DataTable dt = rm.getReceis(rs);

            this.dgvSearchDate.DataSource = null;
            this.dgvSearchDate.DataSource = dt;
            this.dgvSearchDate.AlternatingRowsDefaultCellStyle.BackColor = System.Drawing.ColorTranslator.FromHtml("#D3D3D3");
            this.dgvSearchDate.ReadOnly = true;
            chang_SearchDateHeaderText();

            /*
             * for (int i = 0; i < 6; i++)
             * {
             * this.dgvSearchDate.Columns[i].HeaderCell.Style.ForeColor = System.Drawing.Color.Red;
             * this.dgvSearchDate.Columns[i].ReadOnly = true;
             * }
             *
             * for (int i = 6; i < 11; i++)
             * {
             * this.dgvSearchDate.Columns[i].ReadOnly = false;
             * }
             * this.dgvSearchDate.Columns[11].ReadOnly = true;
             * this.dgvSearchDate.Columns[12].ReadOnly = true;
             */
        }