Пример #1
0
    public IList <InspectOrderDetail> PopulateInspectOrderDetailList()
    {
        IList <InspectOrderDetail> inspectOrderDetailList = new List <InspectOrderDetail>();

        for (int i = 0; i < this.GV_List.Rows.Count; i++)
        {
            GridViewRow row = this.GV_List.Rows[i];


            HiddenField        hfId = (HiddenField)row.FindControl("hfId");
            InspectOrderDetail inspectOrderDetail = TheInspectOrderDetailMgr.LoadInspectOrderDetail(int.Parse(hfId.Value));
            //if (inspectOrderDetail.LocationLotDetail.Hu == null)
            //{

            //    TextBox tbCurrentQualifiedQty = (TextBox)row.FindControl("tbCurrentQualifiedQty");
            //    decimal currentQualifiedQty = 0;
            //    if (tbCurrentQualifiedQty.Text.Trim() != string.Empty)
            //    {
            //        currentQualifiedQty = decimal.Parse(tbCurrentQualifiedQty.Text.Trim());
            //    }

            //    TextBox tbCurrentRejectedQty = (TextBox)row.FindControl("tbCurrentRejectedQty");
            //    decimal currentRejectedQty = 0;
            //    if (tbCurrentRejectedQty.Text.Trim() != string.Empty)
            //    {
            //        currentRejectedQty = decimal.Parse(tbCurrentRejectedQty.Text.Trim());
            //    }
            //    if (currentQualifiedQty != 0 || currentRejectedQty != 0)
            //    {
            //        inspectOrderDetail.CurrentQualifiedQty = currentQualifiedQty;
            //        inspectOrderDetail.CurrentRejectedQty = currentRejectedQty;
            //        inspectOrderDetailList.Add(inspectOrderDetail);
            //    }
            //}
            //else
            //{
            CheckBox checkBoxGroup = row.FindControl("CheckBoxGroup") as CheckBox;
            if (checkBoxGroup.Checked)
            {
                inspectOrderDetail.CurrentQualifiedQty = inspectOrderDetail.PendingQualifiedQty;
                inspectOrderDetail.CurrentRejectedQty  = inspectOrderDetail.PendingRejectedQty;
                inspectOrderDetailList.Add(inspectOrderDetail);
            }
            //}
        }

        return(inspectOrderDetailList);
    }
    public IList <InspectOrderDetail> PopulateInspectOrder(bool?isQualified)
    {
        IList <InspectOrderDetail> inspectOrderDetailList = new List <InspectOrderDetail>();

        if (this.IsPartQualified || !this.IsDetailHasHu)
        {
            #region 允许部分合格/按照数量
            for (int i = 0; i < this.GV_List.Rows.Count; i++)
            {
                GridViewRow row = this.GV_List.Rows[i];
                TextBox     tbCurrentQualifiedQty = (TextBox)row.FindControl("tbCurrentQualifiedQty");
                decimal     currentQualifiedQty   = 0;
                if (tbCurrentQualifiedQty.Text.Trim() != string.Empty)
                {
                    currentQualifiedQty = decimal.Parse(tbCurrentQualifiedQty.Text.Trim());
                }


                TextBox tbCurrentRejectedQty = (TextBox)row.FindControl("tbCurrentRejectedQty");
                decimal currentRejectedQty   = 0;
                if (tbCurrentRejectedQty.Text.Trim() != string.Empty)
                {
                    currentRejectedQty = decimal.Parse(tbCurrentRejectedQty.Text.Trim());
                }
                if (currentQualifiedQty != 0 || currentRejectedQty != 0)
                {
                    HiddenField        hfId = (HiddenField)row.FindControl("hfId");
                    InspectOrderDetail inspectOrderDetail = TheInspectOrderDetailMgr.LoadInspectOrderDetail(int.Parse(hfId.Value));
                    inspectOrderDetail.CurrentQualifiedQty = currentQualifiedQty;
                    inspectOrderDetail.CurrentRejectedQty  = currentRejectedQty;
                    com.Sconit.Control.DropDownList ddlDisposition = (com.Sconit.Control.DropDownList)row.FindControl("ddlDisposition");
                    if (ddlDisposition.SelectedIndex != -1 && inspectOrderDetail.CurrentRejectedQty > 0)
                    {
                        inspectOrderDetail.Disposition = ddlDisposition.SelectedValue;
                    }
                    inspectOrderDetailList.Add(inspectOrderDetail);
                }
            }
            #endregion
        }
        else
        {
            #region 全部合格/不合格
            for (int i = 0; i < this.GV_List.Rows.Count; i++)
            {
                GridViewRow row           = this.GV_List.Rows[i];
                CheckBox    checkBoxGroup = row.FindControl("CheckBoxGroup") as CheckBox;
                if (checkBoxGroup.Checked)
                {
                    HiddenField        hfId = (HiddenField)row.FindControl("hfId");
                    InspectOrderDetail inspectOrderDetail = TheInspectOrderDetailMgr.LoadInspectOrderDetail(int.Parse(hfId.Value));
                    if ((bool)isQualified)
                    {
                        inspectOrderDetail.CurrentQualifiedQty = inspectOrderDetail.InspectQty;
                    }
                    else
                    {
                        inspectOrderDetail.CurrentRejectedQty = inspectOrderDetail.InspectQty;
                    }

                    com.Sconit.Control.DropDownList ddlDisposition = (com.Sconit.Control.DropDownList)row.FindControl("ddlDisposition");
                    if (ddlDisposition.SelectedIndex != -1 && inspectOrderDetail.CurrentRejectedQty > 0)
                    {
                        inspectOrderDetail.Disposition = ddlDisposition.SelectedValue;
                    }

                    inspectOrderDetailList.Add(inspectOrderDetail);
                }
            }
            #endregion
        }

        return(inspectOrderDetailList);
    }