Esempio n. 1
0
        protected void Button2_Click(object sender, EventArgs e)
        {
            if (Grid1.GetModifiedData().Count == 0)
            {
                //labResult.Text = "";
                //ShowNotify("表格数据没有变化!");
                Alert.ShowInTop("表格内没有数据!");
                return;
            }

            // 复制原始表格的结构
            DataTable newTable = GetSourceData().Clone();
            DataRow   newRow;

            int    rowIndex   = 0;
            JArray mergedData = Grid1.GetMergedData();

            foreach (JObject mergedRow in mergedData)
            {
                JObject values = mergedRow.Value <JObject>("values");
                newRow    = newTable.NewRow();
                newRow[0] = rowIndex;
                newRow[1] = values.Value <string>("设备编号");
                string ss = values.Value <string>("设备编号");
                if (ss == "" || ss == null)
                {
                    Alert.ShowInTop("请填写完整数据");
                    return;
                }

                newRow[2] = values.Value <string>("重点设备");
                newRow[3] = values.Value <string>("设备名称");
            }
        }
Esempio n. 2
0
        /// <summary>
        ///     OutputSummaryData
        /// </summary>
        private void OutputSummaryData()
        {
            decimal sumFQty        = 0.00M;
            decimal sumFAmount     = 0.00M;
            decimal sumFRecycleQty = 0.00M;
            decimal sumFBottleQty  = 0.00M;


            foreach (JObject mergedRow in Grid1.GetMergedData())
            {
                JObject values = mergedRow.Value <JObject>("values");

                sumFQty        += values.Value <decimal>("FQty");
                sumFAmount     += values.Value <decimal>("FAmount");
                sumFRecycleQty += values.Value <decimal>("FRecycleQty");
                sumFBottleQty  += values.Value <decimal>("FBottleQty");
            }

            JObject summary = new JObject();

            summary.Add("FQty", sumFQty);
            summary.Add("FAmount", sumFAmount);
            summary.Add("FRecycleQty", sumFRecycleQty);
            summary.Add("FBottleQty", sumFBottleQty);

            Grid1.SummaryData = summary;
        }
Esempio n. 3
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <returns></returns>
        public override string Save()
        {
            string result = "";
            JArray upJson = Grid1.GetMergedData();

            //result = COMPONENT00Check(upJson);
            //效验数据
            if (upJson.Count < 1)
            {
                return("数据表为空,保存失败");
            }
            result = CheckOrderDop00(upJson);
            if (!String.IsNullOrEmpty(result))
            {
                return(result);
            }
            //保存数据
            result = OrderDep00Save(upJson);
            if (!String.IsNullOrEmpty(result))
            {
                return(result);
            }
            result = OrderDep02Save();
            LoadData();
            LoadData2("");
            LoadOrderDep01("");
            return(result);
        }
Esempio n. 4
0
        public void BtnDelete_Click(object sender, EventArgs e)
        {
            int id = ConvertHelper.Cint(GridViewHelper.GetSelectedKey(Grid1, true));

            string[] eCell = Grid1.SelectedCell;

            JArray    upJson = Grid1.GetMergedData();
            DataTable da     = new DataTable();

            for (int i = 0; i < upJson.Count; i++)
            {
                if (upJson[i]["status"].ToString() != "newadded" && upJson[i]["id"].ToString() == eCell[0].ToString())
                {
                    int _id = ConvertHelper.Cint(upJson[i]["values"]["Id"].ToString());
                    Grid1.DeleteSelectedRows();
                    ORDER_DEP00Bll.GetInstence().DeleteOrderDep00(_id);
                    hidORDDEP_ID.Text = "";
                    break;
                }
                else if (upJson[i]["status"].ToString() == "newadded" && upJson[i]["id"].ToString() == eCell[0].ToString())
                {
                    Grid1.DeleteSelectedRows();
                    hidORDDEP_ID.Text = "";
                    break;
                }
            }
            LoadData2("");
            LoadDepData();
        }
Esempio n. 5
0
        /// <summary>
        /// Grid1点击事件
        /// </summary>
        /// <param name="e"></param>
        public override void SingleClick(GridRowClickEventArgs e)
        {
            int o = e.RowIndex;

            string[] eCell = Grid1.SelectedCell;
            //string aa = Grid1.SelectedRowID;
            //int cc = Grid1.SelectedRowIndex;
            JArray upJson  = Grid1.GetMergedData();
            JArray upJson2 = Grid2.GetMergedData();

            //(Grid1.FindColumn("ORDDEP_NAME").FindControl("tbxORDDEP_ID") as TextBox).Enabled = true;
            if (o >= 0)
            {
                int dataIndex = 0;
                ///通过点击得行数,找到数据
                for (int i = 0; i < upJson.Count; i++)
                {
                    if (upJson[i]["id"].ToString() == eCell[0].ToString())
                    {
                        dataIndex = i;
                        break;
                    }
                }
                hidORDDEP_ID.Text = upJson[dataIndex]["values"]["ORDDEP_ID"].ToString();
                if (upJson.Count > 0 && upJson2.Count > 0)
                {
                    if (upJson[dataIndex]["values"]["ORDDEP_ID"].ToString() != upJson2[0]["values"]["ORDDEP_ID1"].ToString())
                    {
                        string result = OrderDep02Save();
                        if (!String.IsNullOrEmpty(result))
                        {
                            FineUI.Alert.ShowInParent("订货类别保存失败:" + result, FineUI.MessageBoxIcon.Information);
                        }
                        int _Id   = ConvertHelper.Cint(Grid1.DataKeys[dataIndex][0].ToString());
                        var model = new ORDER_DEP00(x => x.Id == _Id);
                        LoadData2(model.ORDDEP_ID);
                        LoadOrderDep01(model.ORDDEP_ID);
                    }
                }
                else
                {
                    int _Id   = ConvertHelper.Cint(Grid1.DataKeys[o][0].ToString());
                    var model = new ORDER_DEP00(x => x.Id == _Id);
                    LoadData2(model.ORDDEP_ID);
                    LoadOrderDep01(model.ORDDEP_ID);
                    //LoadData2(model.COM_ID);
                    //hidCOM_ID.Text = model.COM_ID;
                }
            }
            else
            {
                hidORDDEP_ID.Text = "";
                LoadData2("");
                LoadOrderDep01("");
            }
        }
Esempio n. 6
0
        /// <summary>下拉列表改变事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void ddlShop_SelectedIndexChanged(object sender, EventArgs e)
        {
            JArray mergedData    = Grid1.GetMergedData();
            int    gridrowsCount = mergedData.Count;

            HiddenLastShop_Id.Text = HiddenShop_Id.Text;
            HiddenShop_Id.Text     = ddlShop.SelectedValue;


            if (gridrowsCount > 0)
            {
                Window1.Hidden = false;

                //string confirmStr = Confirm.GetShowReference("是否清空数据继续下单?", String.Empty, MessageBoxIcon.Question, ddlShop.GetPostBackEventReference(), ddlShop.GetPostBackEventReference("Cancel"));
                //PageContext.RegisterStartupScript(confirmStr);
            }
        }
        protected void ddlORDER_DEP_SelectedIndexChanged(object sender, EventArgs e)
        {
            JArray mergedData    = Grid1.GetMergedData();
            int    gridrowsCount = mergedData.Count;

            if (gridrowsCount > 0)
            {
                Window1.Hidden = false;
            }

            string SHOP_ID         = OnlineUsersBll.GetInstence().GetUserOnlineInfo("SHOP_ID").ToString();
            string ORDER_DEP_VALUE = ddlORDER_DEP.SelectedValue;

            if (SHOP_ID != "0")
            {
                PRODUCT00Bll.GetInstence().BandDropDownListShowProductName_1(this, DropDownList1, SHOP_ID);  // (System.Web.UI.WebControls.DropDownList)
            }
        }
Esempio n. 8
0
        private void OutputSummaryData()
        {
            decimal chineseTotal = 0;
            decimal mathTotal    = 0;

            foreach (JObject mergedRow in Grid1.GetMergedData())
            {
                JObject values = mergedRow.Value <JObject>("values");

                chineseTotal += values.Value <decimal>("FQty");
                mathTotal    += values.Value <decimal>("FAmount");
            }

            JObject summary = new JObject();

            summary.Add("FQty", chineseTotal);
            summary.Add("FAmount", mathTotal);

            Grid1.SummaryData = summary;
        }
        protected void Button2_Click(object sender, EventArgs e)
        {
            if (Grid1.GetModifiedData().Count == 0)
            {
                Alert.Show("表格数据没有变化!");
                return;
            }

            // 复制原始表格的结构
            DataTable newTable = GetSourceData().Clone();
            DataRow   newRow;

            JArray mergedData = Grid1.GetMergedData();

            foreach (JObject mergedRow in mergedData)
            {
                string  status   = mergedRow.Value <string>("status");
                int     rowIndex = mergedRow.Value <int>("index");
                JObject values   = mergedRow.Value <JObject>("values");

                newRow    = newTable.NewRow();
                newRow[0] = rowIndex; // 将行标识符设置为行索引号
                newRow[1] = values.Value <string>("Name");
                newRow[2] = values.Value <int>("EntranceYear");
                newRow[3] = values.Value <bool>("AtSchool");
                newRow[4] = values.Value <string>("Major");
                newRow[5] = values.Value <int>("Gender");
                newRow[6] = values.Value <string>("EntranceDate");
                newTable.Rows.Add(newRow);
            }

            // 更新数据源
            Session[KEY_FOR_DATASOURCE_SESSION] = newTable;


            labResult.Text = String.Format("用户修改的数据:<pre>{0}</pre>", Grid1.GetModifiedData().ToString(Newtonsoft.Json.Formatting.Indented));

            BindGrid();

            Alert.Show("数据保存成功!(表格数据已重新绑定)");
        }
Esempio n. 10
0
        /// <summary>
        ///     OutputSummaryData
        /// </summary>
        private void OutputSummaryData()
        {
            decimal sumFQty    = 0.00M;
            decimal sumFAmount = 0.00M;

            foreach (JObject mergedRow in Grid1.GetMergedData())
            {
                JObject values = mergedRow.Value <JObject>("values");

                sumFQty    += values.Value <decimal>("FQty");
                sumFAmount += values.Value <decimal>("FAmount");
            }

            JObject summary = new JObject();

            summary.Add("FQty", sumFQty);
            summary.Add("FAmount", sumFAmount);

            Grid1.SummaryData = summary;

            txtFCostPrice.Text = sumFAmount.ToString("####.##");
        }
Esempio n. 11
0
        /// <summary>
        ///     OutputSummaryData
        /// </summary>
        private void OutputSummaryData()
        {
            decimal sumFBottleQty       = 0.00M;
            decimal sumFDepositSecurity = 0.00M;
            decimal sumFPaymentRentals  = 0.00M;

            foreach (JObject mergedRow in Grid1.GetMergedData())
            {
                JObject values = mergedRow.Value <JObject>("values");

                sumFBottleQty       += values.Value <decimal>("FBottleQty");
                sumFDepositSecurity += values.Value <decimal>("FDepositSecurity");
                sumFPaymentRentals  += values.Value <decimal>("FPaymentRentals");
            }

            JObject summary = new JObject();

            summary.Add("FBottleQty", sumFBottleQty);
            summary.Add("FDepositSecurity", sumFDepositSecurity);
            summary.Add("FPaymentRentals", sumFPaymentRentals);
            Grid1.SummaryData = summary;
        }
Esempio n. 12
0
        /// <summary>
        /// 检查并保存其他HSE管理活动集合
        /// </summary>
        private void jerqueSaveMonthPlanList()
        {
            costManageItems.Clear();
            JArray mergedData = Grid1.GetMergedData();

            foreach (JObject mergedRow in mergedData)
            {
                string  status = mergedRow.Value <string>("status");
                JObject values = mergedRow.Value <JObject>("values");
                int     i      = mergedRow.Value <int>("index");
                Model.CostGoods_CostManageItem costManageItem = new Model.CostGoods_CostManageItem
                {
                    CostManageItemId  = this.Grid1.Rows[i].DataKeys[0].ToString(),
                    InvestCostProject = values.Value <string>("InvestCostProject").ToString(),
                    UseReason         = values.Value <string>("UseReason").ToString(),
                    Counts            = Funs.GetNewIntOrZero(values.Value <string>("Counts").ToString()),
                    PriceMoney        = Funs.GetNewDecimalOrZero(values.Value <string>("PriceMoney").ToString()),
                    AuditCounts       = !string.IsNullOrEmpty(values.Value <string>("AuditCounts").ToString()) ? Funs.GetNewInt(values.Value <string>("AuditCounts").ToString()) : null,
                    AuditPriceMoney   = !string.IsNullOrEmpty(values.Value <string>("AuditPriceMoney").ToString()) ? Funs.GetNewDecimal(values.Value <string>("AuditPriceMoney").ToString()) : null
                };
                costManageItems.Add(costManageItem);
            }
        }
Esempio n. 13
0
        protected void SelectContentBtn_Click(object sender, EventArgs e)
        {
            OffSession();
            if (盘点名称.SelectedText == "" || 盘点名称.SelectedText == null)
            {
                Alert alert = new Alert();
                alert.Message        = "请选择盘点名称";
                alert.Title          = "提示信息";
                alert.MessageBoxIcon = MessageBoxIcon.Warning;
                alert.Show();
                return;
            }
            DataTable newTable = GetSourceData().Clone();
            DataRow   newRow;
            JArray    mergedData = Grid1.GetMergedData();

            if (mergedData.Count == 0)
            {
                Alert alert = new Alert();
                alert.Message        = "请选择数据";
                alert.Title          = "提示信息";
                alert.MessageBoxIcon = MessageBoxIcon.Warning;
                alert.Show();
                return;
            }
            List <Model录入盘点信息> listpd = new List <Model录入盘点信息>();

            foreach (JObject mergedRow in mergedData)
            {
                JObject values = mergedRow.Value <JObject>("values");
                newRow = newTable.NewRow();
                Model录入盘点信息 model = new Model录入盘点信息();
                model.设备台账ID     = Convert.ToInt32(values.Value <string>("ID"));
                model.设备编号       = values.Value <string>("设备编号");
                model.盘点主表ID     = Convert.ToInt32(盘点名称.SelectedValue);
                model.二级部门ID     = Convert.ToInt32(values.Value <string>("二级部门ID"));
                model.级部门ID      = Convert.ToInt32(values.Value <string>("三级部门ID"));
                model.二级部门名称     = values.Value <string>("二级部门名称");
                model.级部门名称      = values.Value <string>("三级部门名称");
                model.操作人        = username;
                model.操作日期       = DateTime.Now.ToShortDateString();
                model.盘点类型       = 盘点类型.Text;
                model.帐物是否相符     = values.Value <string>("帐物是否相符");
                model.盘盈或盘亏简要原因  = values.Value <string>("盘盈或盘亏简要原因");
                model.闲置或待报废简要原因 = values.Value <string>("闲置或待报废简要原因");
                model.盘点类型       = 盘点类型.SelectedText;
                listpd.Add(model);
            }
            int yisn = bll.插入已盘点设备表(listpd);

            if (yisn > 0)
            {
                int    ID   = 0;
                string name = 级单位.SelectedText;
                if (name == "全部")
                {
                    int 用户二级部门ID = Convert.ToInt32(Session["二级部门ID"]);
                    Grid1.RecordCount = bll.查询盘点设备总数("全部", 用户二级部门ID);
                    DataTable table = GetSourceData();
                    Grid1.DataSource = bll.测试查询转向架台账数据("全部", 用户二级部门ID, Grid1.PageIndex, Grid1.PageSize - 1, username);
                    Grid1.DataBind();
                }
                else
                {
                    ID = Convert.ToInt32(级单位.SelectedValue);
                    Grid1.RecordCount = bll.查询盘点设备总数(name, ID);
                    DataTable table = GetSourceData();
                    Grid1.DataSource = bll.测试查询转向架台账数据("部门", ID, Grid1.PageIndex, Grid1.PageSize - 1, username);
                    Grid1.DataBind();
                }
            }
        }
Esempio n. 14
0
        /// <summary>
        /// 数据保存
        /// </summary>
        /// <returns></returns>
        public override string Save()
        {
            string result = string.Empty;
            int    id     = ConvertHelper.Cint0(hidId.Text);

            try
            {
                //判断
                if (ddlShop.SelectedValue == "0")
                {
                    return(ddlShop.Label + "不能为空!");
                }

                if (ddlOUT_SHOP.SelectedValue == "0")
                {
                    return(ddlOUT_SHOP.Label + "不能为空!");
                }

                if (ddlORDER_DEP.SelectedValue == "0")
                {
                    return(ddlORDER_DEP.Label + "不能为空!");
                }


                //订单编号
                if (txtORDER_ID.Text == "")
                {
                    Random ran = new Random();
                    txtORDER_ID.Text = ddlShop.SelectedValue + "OR" + DateTime.Now.ToString("yyyy-MM-dd").Replace("-", "") + ran.Next(1000, 9999);
                }

                string manager_LoginName = OnlineUsersBll.GetInstence().GetUserOnlineInfo("Manager_LoginName").ToString();//登录名

                txtAPP_USER.Text         = manager_LoginName;
                txtAPP_DATE.SelectedDate = DateTime.Now;

                string ORDER_ID = txtORDER_ID.Text; // GridViewHelper.GetSelectedKey(Grid2, true);

                //获取价格区域
                string shop_id    = OnlineUsersBll.GetInstence().GetUserOnlineInfo("SHOP_ID").ToString();
                var    model_SHOP = new SHOP00(x => x.SHOP_ID == shop_id);

                string prcarea_id = model_SHOP.SHOP_Price_Area;

                // 复制原始表格的结构
                DataTable newTable = GetSourceData(ORDER_ID, prcarea_id).Clone();
                DataRow   newRow;

                JArray mergedData = Grid1.GetMergedData();

                int i = 0;
                foreach (JObject mergedRow in mergedData)
                {
                    string  status   = mergedRow.Value <string>("status");
                    int     rowIndex = mergedRow.Value <int>("index");
                    JObject values   = mergedRow.Value <JObject>("values");

                    i         = i + 1;
                    newRow    = newTable.NewRow();
                    newRow[0] = rowIndex;//i;////j;// rowIndex; // 将行标识符设置为行索引号
                    newRow[1] = values.Value <string>("PROD_NAME1");
                    newRow[2] = values.Value <string>("PROD_ID");
                    newRow[3] = values.Value <string>("PROD_SPEC");
                    newRow[4] = values.Value <string>("PROD_UNIT");
                    newRow[5] = values.Value <string>("ON_QUAN");
                    newRow[6] = values.Value <string>("STD_PRICE");
                    newRow[7] = values.Value <string>("QUAN1");
                    newTable.Rows.Add(newRow);
                }

                // 更新数据源
                Session[KEY_FOR_DATASOURCE_SESSION] = newTable;

                labResult.Text = ""; // String.Format("用户修改的数据:<pre>{0}</pre>", Grid1.GetModifiedData().ToString(Newtonsoft.Json.Formatting.Indented));
                                     //   MessageBox.Show(this,String.Format("用户修改的数据:<pre>{0}</pre>", Grid1.GetModifiedData().ToString(Newtonsoft.Json.Formatting.Indented)));

                // DataTable table = GetSourceData();

                Grid1.DataSource = (DataTable)Session[KEY_FOR_DATASOURCE_SESSION];// table;
                Grid1.DataBind();

                #region 数据验证

                //判断列表
                DataTable dt = (DataTable)Session[KEY_FOR_DATASOURCE_SESSION];
                if (dt.Rows.Count <= 0 || Session[KEY_FOR_DATASOURCE_SESSION] == null)
                {
                    return("要货明细不能为空!");
                }

                #endregion

                //改变界面
                ddlStatus.SelectedValue = "1" + "";

                #region 赋值  主表

                var model = new ORDER00(x => x.ORDER_ID == ORDER_ID);

                model.SHOP_ID     = ddlShop.SelectedValue;
                model.ORDER_ID    = txtORDER_ID.Text;
                model.INPUT_DATE  = DateTime.Now; // ConvertHelper.StringToDatetime(txtINPUT_DATE.Text);
                model.ORD_USER    = txtORD_USER.Text;
                model.EXPECT_DATE = DateTime.Now; // ConvertHelper.StringToDatetime(txtEXPECT_DATE.Text);
                model.STATUS      = 1;
                model.ORD_TYPE    = ConvertHelper.Cint0(ddlORD_TYPE.SelectedValue);
                model.OUT_SHOP    = ddlOUT_SHOP.SelectedValue;
                model.EXPORTED_ID = txtEXPORTED_ID.Text;
                model.EXPORTED    = ConvertHelper.StringToByte(txtEXPORTED.Text);
                model.APP_USER    = txtAPP_USER.Text;
                model.APP_DATE    = DateTime.Now;//ConvertHelper.StringToDatetime(txtAPP_DATE.Text);
                model.Memo        = txtMemo.Text;
                model.LOCKED      = ConvertHelper.StringToByte(cbLOCKED.Checked.ToString());

                model.ORD_DEP_ID   = ddlORDER_DEP.SelectedValue;
                model.CRT_DATETIME = DateTime.Now; //ConvertHelper.StringToDatetime(txtCRT_DATETIME.Text);
                model.CRT_USER_ID  = txtCRT_USER_ID.Text;
                model.MOD_DATETIME = DateTime.Now; //ConvertHelper.StringToDatetime(txtMOD_DATETIME.Text);
                model.MOD_USER_ID  = txtMOD_USER_ID.Text;
                model.LAST_UPDATE  = DateTime.Now; //ConvertHelper.StringToDatetime(txtLAST_UPDATE.Text);
                model.Trans_STATUS = 0;

                #endregion

                //----------------------------------------------------------
                //存储到数据库
                ORDER00Bll.GetInstence().Save(this, model);

                //清空子表
                ORDER00Bll.GetInstence().Delete(model.ORDER_ID);

                #region 添加子表

                JArray mergedData1 = Grid1.GetMergedData();
                int    f           = mergedData.Count;

                int k = 0;
                foreach (JObject mergedRow in mergedData1)
                {
                    string  status   = mergedRow.Value <string>("status");
                    int     rowIndex = mergedRow.Value <int>("index");
                    JObject values   = mergedRow.Value <JObject>("values");

                    k = k + 1;

                    var model_1 = new ORDER01(x => x.SNo == k && x.ORDER_ID == txtORDER_ID.Text.Trim());

                    model_1.SNo = k;// rowIndex + 1;

                    model_1.SHOP_ID  = ddlShop.SelectedValue;
                    model_1.ORDER_ID = txtORDER_ID.Text.Trim();

                    model_1.PROD_ID      = values.Value <string>("PROD_ID");
                    model_1.QUANTITY     = 0;
                    model_1.ON_QUAN      = ConvertHelper.StringToDecimal(values.Value <string>("ON_QUAN"));
                    model_1.QUAN1        = ConvertHelper.StringToDecimal(values.Value <string>("QUAN1"));//小计
                    model_1.QUAN2        = 0;
                    model_1.COST_PRICE   = ConvertHelper.StringToDecimal(values.Value <string>("STD_PRICE"));
                    model_1.STD_UNIT     = values.Value <string>("PROD_UNIT");
                    model_1.STD_CONVERT  = 0;
                    model_1.STD_QUAN     = ConvertHelper.StringToDecimal(values.Value <string>("ON_QUAN"));
                    model_1.STD_PRICE    = ConvertHelper.StringToDecimal(values.Value <string>("STD_PRICE"));
                    model_1.Memo         = "";
                    model_1.CRT_DATETIME = DateTime.Now;
                    model_1.CRT_USER_ID  = txtCRT_USER_ID.Text;
                    model_1.MOD_DATETIME = DateTime.Now;
                    model_1.MOD_USER_ID  = txtMOD_USER_ID.Text;

                    //----------------------------------------------------------
                    //存储到数据库
                    ORDER01Bll.GetInstence().Save(this, model_1);
                }

                ///grid2

                conditionList = new List <ConditionFun.SqlqueryCondition>();
                conditionList.Add(new ConditionFun.SqlqueryCondition(ConstraintType.Where, ORDER00Table.SHOP_ID, Comparison.Equals, shop_id, false, false));

                //  ORDER00Bll.GetInstence().BindGrid(Grid2, 0, sortList);
                // bll.BindGrid(Grid2, 0, sortList);
                ORDER00Bll.GetInstence().BindGrid(Grid2, 0, 0, conditionList, sortList);

                #endregion
            }
            catch (Exception e)
            {
                result = "保存失败!";

                //出现异常,保存出错日志信息
                CommonBll.WriteLog(result, e);
            }

            return(result);
        }
Esempio n. 15
0
        /// <summary>
        ///  保存明细项
        /// </summary>
        private void SaveDetail(string type, Model.Check_CheckSpecial checkSpecial)
        {
            List <Model.Check_CheckSpecialDetail> detailLists = new List <Model.Check_CheckSpecialDetail>();
            JArray teamGroupData = Grid1.GetMergedData();

            foreach (JObject teamGroupRow in teamGroupData)
            {
                JObject values = teamGroupRow.Value <JObject>("values");
                Model.Check_CheckSpecialDetail newDetail = new Model.Check_CheckSpecialDetail
                {
                    CheckSpecialDetailId = SQLHelper.GetNewID(),
                    CheckSpecialId       = this.CheckSpecialId,
                    CheckContent         = values.Value <string>("CheckItemName"),
                    Unqualified          = values.Value <string>("Unqualified"),
                    WorkArea             = values.Value <string>("WorkArea"),
                };
                var getUnit = Funs.DB.Base_Unit.FirstOrDefault(x => x.UnitName == values.Value <string>("UnitName"));
                if (getUnit != null)
                {
                    newDetail.UnitId = getUnit.UnitId;
                }
                var getHandleStep = Funs.DB.Sys_Const.FirstOrDefault(x => x.GroupId == ConstValue.Group_HandleStep && x.ConstText == values.Value <string>("HandleStepStr"));
                if (getHandleStep != null)
                {
                    newDetail.HandleStep = getHandleStep.ConstValue;
                }
                if (values.Value <string>("CompleteStatusName") == "已整改")
                {
                    newDetail.CompleteStatus = true;
                    newDetail.CompletedDate  = DateTime.Now;
                }
                else
                {
                    newDetail.CompleteStatus = false;
                }
                var getCheckItem = Funs.DB.Technique_CheckItemSet.FirstOrDefault(x => x.SupCheckItem == this.drpSupCheckItemSet.SelectedValue && x.CheckItemName == newDetail.CheckContent);
                if (getCheckItem != null)
                {
                    newDetail.CheckItem = getCheckItem.CheckItemSetId;
                }
                Check_CheckSpecialDetailService.AddCheckSpecialDetail(newDetail);
                if (type == Const.BtnSubmit)
                {
                    if (newDetail.CompleteStatus == false)
                    {
                        detailLists.Add(newDetail);
                    }
                }
            }

            if (detailLists.Count() > 0)
            {
                ////隐患整改单
                var getDetail1 = detailLists.Where(x => x.HandleStep == "1");
                if (getDetail1.Count() > 0)
                {
                    var getUnitList = getDetail1.Select(x => x.UnitId).Distinct();
                    foreach (var unitItem in getUnitList)
                    {
                        Model.RectifyNoticesItem rectifyNotices = new Model.RectifyNoticesItem
                        {
                            ProjectId     = checkSpecial.ProjectId,
                            UnitId        = unitItem,
                            CompleteManId = this.CurrUser.UserId,
                            CheckManNames = checkSpecial.PartInPersons,
                            CheckManIds   = checkSpecial.PartInPersonIds,
                            CheckedDate   = string.Format("{0:yyyy-MM-dd HH:mm:ss}", checkSpecial.CheckTime),
                            States        = Const.State_0,
                        };
                        rectifyNotices.RectifyNoticesItemItem = new List <Model.RectifyNoticesItemItem>();
                        var getUnitDItem = getDetail1.Where(x => x.UnitId == unitItem);
                        foreach (var item in getUnitDItem)
                        {
                            Model.RectifyNoticesItemItem newRItem = new Model.RectifyNoticesItemItem();
                            if (!string.IsNullOrEmpty(item.WorkArea))
                            {
                                newRItem.WrongContent = item.WorkArea + item.Unqualified;
                            }
                            else
                            {
                                newRItem.WrongContent = item.Unqualified;
                            }
                            if (string.IsNullOrEmpty(rectifyNotices.CheckSpecialDetailId))
                            {
                                rectifyNotices.CheckSpecialDetailId = item.CheckSpecialDetailId;
                            }
                            else
                            {
                                rectifyNotices.CheckSpecialDetailId += "," + item.CheckSpecialDetailId;
                            }
                            var getAtt = Funs.DB.AttachFile.FirstOrDefault(x => x.ToKeyId == item.CheckSpecialDetailId);
                            if (getAtt != null && !string.IsNullOrEmpty(getAtt.AttachUrl))
                            {
                                newRItem.PhotoBeforeUrl = getAtt.AttachUrl;
                            }

                            rectifyNotices.RectifyNoticesItemItem.Add(newRItem);
                        }

                        APIRectifyNoticesService.SaveRectifyNotices(rectifyNotices);
                    }
                }
                ///处罚单
                var getDetail2 = detailLists.Where(x => x.HandleStep == "2");
                if (getDetail2.Count() > 0)
                {
                    var getUnitList = getDetail2.Select(x => x.UnitId).Distinct();
                    foreach (var unitItem in getUnitList)
                    {
                        Model.PunishNoticeItem punishNotice = new Model.PunishNoticeItem
                        {
                            ProjectId        = checkSpecial.ProjectId,
                            PunishNoticeDate = string.Format("{0:yyyy-MM-dd HH:mm:ss}", checkSpecial.CheckTime),
                            UnitId           = unitItem,
                            CompileManId     = this.CurrUser.UserId,
                            PunishStates     = Const.State_0,
                        };

                        var getUnitDItem = getDetail2.Where(x => x.UnitId == unitItem);
                        foreach (var item in getUnitDItem)
                        {
                            Model.RectifyNoticesItemItem newRItem = new Model.RectifyNoticesItemItem();
                            punishNotice.IncentiveReason += item.Unqualified;
                            if (string.IsNullOrEmpty(punishNotice.CheckSpecialDetailId))
                            {
                                punishNotice.CheckSpecialDetailId = item.CheckSpecialDetailId;
                            }
                            else
                            {
                                punishNotice.CheckSpecialDetailId += "," + item.CheckSpecialDetailId;
                            }
                            var getAtt = Funs.DB.AttachFile.FirstOrDefault(x => x.ToKeyId == item.CheckSpecialDetailId);
                            if (getAtt != null && !string.IsNullOrEmpty(getAtt.AttachUrl))
                            {
                                punishNotice.PunishUrl = getAtt.AttachUrl;
                            }
                        }

                        APIPunishNoticeService.SavePunishNotice(punishNotice);
                    }
                }
                ///暂停令
                var getDetail3 = detailLists.Where(x => x.HandleStep == "3");
                if (getDetail3.Count() > 0)
                {
                    var getUnitList = getDetail3.Select(x => x.UnitId).Distinct();
                    foreach (var unitItem in getUnitList)
                    {
                        Model.PauseNoticeItem pauseNotice = new Model.PauseNoticeItem
                        {
                            ProjectId   = checkSpecial.ProjectId,
                            UnitId      = unitItem,
                            PauseTime   = string.Format("{0:yyyy-MM-dd HH:mm:ss}", checkSpecial.CheckTime),
                            PauseStates = Const.State_0,
                        };

                        var getUnitDItem = getDetail3.Where(x => x.UnitId == unitItem);
                        foreach (var item in getUnitDItem)
                        {
                            Model.RectifyNoticesItemItem newRItem = new Model.RectifyNoticesItemItem();
                            pauseNotice.ThirdContent += item.Unqualified;
                            if (string.IsNullOrEmpty(pauseNotice.ProjectPlace))
                            {
                                pauseNotice.ProjectPlace = item.WorkArea;
                            }
                            else
                            {
                                if (!pauseNotice.ProjectPlace.Contains(item.WorkArea))
                                {
                                    pauseNotice.ProjectPlace += "," + item.WorkArea;
                                }
                            }
                            if (string.IsNullOrEmpty(pauseNotice.CheckSpecialDetailId))
                            {
                                pauseNotice.CheckSpecialDetailId = item.CheckSpecialDetailId;
                            }
                            else
                            {
                                pauseNotice.CheckSpecialDetailId += "," + item.CheckSpecialDetailId;
                            }
                            var getAtt = Funs.DB.AttachFile.FirstOrDefault(x => x.ToKeyId == item.CheckSpecialDetailId);
                            if (getAtt != null && !string.IsNullOrEmpty(getAtt.AttachUrl))
                            {
                                pauseNotice.PauseNoticeAttachUrl = getAtt.AttachUrl;
                            }
                        }

                        APIPauseNoticeService.SavePauseNotice(pauseNotice);
                    }
                }
            }
        }