Exemplo n.º 1
0
        public void ProcessRequest(HttpContext context)
        {
            try
            {
                context.Response.ContentType = "text/plain";
                string jobID  = context.Request.Form["hJobID"];
                string listID = context.Request.Form["hListID"];//工单
                DataAccess.RunProcedure run = new DataAccess.RunProcedure();
                DataSet view = run.JobView(jobID, "ReIssueList");
                if (view.Tables[3].Rows[0]["StatusName"].Equals("未提交."))
                {
                    Entity.ReIssueList     ri = new Entity.ReIssueList();
                    DataAccess.ReIssueList da = new DataAccess.ReIssueList();
                    DateTime time             = DateTime.Now;

                    //工单项
                    if (string.IsNullOrEmpty(listID))
                    {
                        ri.JobType  = "RI00" + context.Request.Form["cardType"];
                        ri.ListID   = ri.JobType + "-" + time.ToString("yyyyMMddhhmmssfff") + (new Random().Next(1, 10000)).ToString().PadLeft(4, '0');
                        ri.JobID    = jobID;
                        ri.CardType = Enum.Parse(typeof(Entity.Enum.CardType), context.Request.Form["CardType"]).ToString();
                    }
                    else
                    {
                        ri = da.GetModel(listID);
                    }
                    ri.CardholderName = context.Request.Form["holdName"];
                    ri.IsDelete       = false;
                    ri.Remark         = "";

                    //提交数据到后台存储过程事务
                    DataAccess.TranHelper.BeginTran();
                    new DataAccess.RIDataAccess().InsertListData(ri);
                    try
                    {
                        DataAccess.TranHelper.CommitTran();
                        context.Response.Write("");
                    }
                    catch (Exception ex)
                    {
                        context.Response.Write("\n数据提交出错!" + ex.Message);
                    }
                }
                else
                {
                    context.Response.Write("该工单状态为已提交,无法继续修改工单信息!");
                }
            }
            catch (Exception ex)
            {
                context.Response.Write("\n" + ex.Message);
            }
        }
        private void DataInit()
        {
            listID        = ZWL.ObjectOperation.QueryStringHelper.GetQuery("listID");
            jobID         = ZWL.ObjectOperation.QueryStringHelper.GetQuery("jobID");
            hJobID.Value  = jobID;
            hListID.Value = listID;

            if (!string.IsNullOrEmpty(listID))
            {
                Entity.ReIssueList ri = new DataAccess.ReIssueList().GetModel(listID);
                cardType.Value = Convert.ToInt32((Entity.Enum.CardType)Enum.Parse(typeof(Entity.Enum.CardType), ri.CardType)).ToString();
                holdName.Value = ri.CardholderName;
            }
        }
Exemplo n.º 3
0
        public void ProcessRequest(HttpContext context)
        {
            try
            {
                context.Response.ContentType = "text/plain";
                string jobID = context.Request.Form["hJobID"];
                DataAccess.RunProcedure procedure = new DataAccess.RunProcedure();
                bool flat = true;
                if (!string.IsNullOrEmpty(jobID))
                {
                    DataSet view = procedure.JobView(jobID, "ReIssueList");
                    if (!view.Tables[3].Rows[0]["StatusName"].Equals("未提交."))
                    {
                        flat = false;
                    }
                }
                if (flat)
                {
                    //JobInfo数据
                    Entity.JobInfo job  = new Entity.JobInfo();
                    DateTime       time = DateTime.Now;
                    job.JobID             = string.IsNullOrEmpty(jobID) ? "RI-" + CardCenter.DataAccess.CardCenterHelper.GetCardNo() : jobID;
                    job.JobType           = "RI";
                    job.CreateTime        = time;
                    job.CreateUser        = PageBase.CommonObject.LoginUserInfo.companyId;
                    job.IsDelete          = false;
                    job.EnterpriseName    = CommonObject.LoginCompanyInfo.FULL_NAME;
                    job.EnterpriseAddress = CommonObject.LoginCompanyInfo.ADDR_CO;
                    job.EnterpriseCode    = CommonObject.LoginCompanyInfo.COP_GB_CODE;
                    job.AgentName         = context.Request.Form["agentName"];
                    job.AgentPhone        = context.Request.Form["agentPhone"];
                    job.ConsigneeName     = context.Request.Form["consigneeName"];
                    job.ConsigneeAddress  = context.Request.Form["consigneeAddress"];
                    job.ConsigneePhone    = context.Request.Form["consigneePhone"];
                    job.ExpressFlat       = null;
                    job.Remark            = string.Empty;
                    job.Fee         = 0;
                    job.FeeFlat     = "无须缴费";
                    job.CustomsCode = CommonObject.LoginUserInfo.companyId;
                    job.IsOnline    = true;

                    //FileList数据
                    List <Entity.FileList> fileList = new List <Entity.FileList>();
                    DataSet ds      = procedure.SelectFileTypeByJobType("RI");
                    string  fileErr = string.Empty;
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        string guid     = context.Request.Form["h" + dr["FileTypeID"].ToString()];
                        string fileName = context.Request.Form["txt" + dr["FileTypeID"].ToString()];
                        if (!string.IsNullOrEmpty(guid))
                        {
                            Entity.FileList file = new Entity.FileList();
                            file.Guid     = guid;
                            file.FileType = dr["FileTypeID"].ToString();
                            file.FileName = fileName;
                            file.JobID    = job.JobID;
                            file.ListID   = string.Empty;
                            file.IsDelete = false;
                            file.Remark   = string.Empty;
                            fileList.Add(file);
                        }
                        else
                        {
                            fileErr += "\n工单随附资料【" + dr["FileTypeName"] + "】未上传!";
                        }
                    }

                    DataSet list = new DataAccess.ReIssueList().GetList("JobID='" + jobID + "' and IsDelete=0");
                    foreach (DataRow dr in list.Tables[0].Rows)
                    {
                        DataSet typeDs = procedure.SelectFileTypeByJobType(dr["JobType"].ToString());
                        foreach (DataRow typeDr in typeDs.Tables[0].Rows)
                        {
                            string guid     = context.Request.Form["h" + typeDr["FileTypeID"].ToString() + dr["ListID"].ToString()];
                            string fileName = context.Request.Form["txt" + typeDr["FileTypeID"].ToString() + dr["ListID"].ToString()];
                            if (!string.IsNullOrEmpty(guid))
                            {
                                Entity.FileList file = new Entity.FileList();
                                file.Guid     = guid;
                                file.FileType = typeDr["FileTypeID"].ToString();
                                file.FileName = fileName;
                                file.JobID    = job.JobID;
                                file.ListID   = dr["ListID"].ToString();
                                file.IsDelete = false;
                                file.Remark   = string.Empty;
                                fileList.Add(file);
                            }
                            else
                            {
                                fileErr += "\n工单项【业务类型:" + new DataAccess.Para_JobType().GetModel(dr["JobType"].ToString()).JobName + ",持卡人姓名:" + dr["CardholderName"] + "】随附资料【" + typeDr["FileTypeName"] + "】未上传!";
                            }
                        }
                    }

                    if (context.Request.Form["type"] == "complete")
                    {
                        //判断是否添加附件
                        if (fileErr != "")
                        {
                            context.Response.Write(JsonConvert.SerializeObject(new Data(fileErr, "")));
                            return;
                        }
                        //判断是否添加工单项
                        ds = procedure.JobView(jobID, "ReIssueList");
                        if (ds.Tables[1].Rows.Count == 0)
                        {
                            context.Response.Write(JsonConvert.SerializeObject(new Data("\n请添加至少一条工单项记录!", "")));
                            return;
                        }
                    }

                    //FlowInfo数据
                    Entity.FlowInfo flow = new Entity.FlowInfo();
                    flow.Guid       = Guid.NewGuid().ToString();
                    flow.JobID      = job.JobID;
                    flow.FlowID     = context.Request.Form["hSaveType"] == "add" ? 1 : int.Parse(new CardCenter.DataAccess.Flow().GetList("JobType='RI' and FlowOrder=2").Tables[0].Rows[0]["FlowStatus"].ToString());
                    flow.SubmitDate = time;
                    flow.SubmitUser = PageBase.CommonObject.LoginUserInfo.companyId;
                    flow.Content    = context.Request.Form["hSaveType"] == "add" ? PageBase.CommonObject.LoginCompanyInfo.FULL_NAME + "暂存数据." : PageBase.CommonObject.LoginCompanyInfo.FULL_NAME + "提交工单.";
                    flow.IsDelete   = false;
                    flow.Remark     = string.Empty;

                    //提交数据到后台存储过程事务
                    DataAccess.TranHelper.BeginTran();
                    DataAccess.RIDataAccess ri = new DataAccess.RIDataAccess();
                    ri.InsertHeadData(job, fileList, flow);
                    if (context.Request.Form["hSaveType"] == "complete")
                    {
                        ri.InsertHandleList(job);
                    }
                    try
                    {
                        DataAccess.TranHelper.CommitTran();
                        DataAccess.CardCenterHelper.SendMessage(job.JobID);
                        context.Response.Write(JsonConvert.SerializeObject(new Data("", job.JobID)));
                    }
                    catch (Exception ex)
                    {
                        context.Response.Write(JsonConvert.SerializeObject(new Data("\n数据提交出错!" + ex.Message, "")));
                    }
                }
                else
                {
                    context.Response.Write(JsonConvert.SerializeObject(new Data("该工单状态为已提交,无法继续修改工单信息!", "")));
                }
            }
            catch (Exception ex)
            {
                context.Response.Write(JsonConvert.SerializeObject(new Data("\n" + ex.Message, "")));
            }
        }