Exemplo n.º 1
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string jobID = context.Request.Form["jobID"];

            DataAccess.TranHelper.BeginTran();
            Entity.FlowInfo flow = new Entity.FlowInfo();
            flow.Guid       = Guid.NewGuid().ToString();
            flow.JobID      = jobID;
            flow.FlowID     = 4;
            flow.SubmitDate = DateTime.Now;
            flow.SubmitUser = PageBase.CommonObject.LoginUserInfo.companyId;
            flow.Content    = PageBase.CommonObject.LoginCompanyInfo.FULL_NAME + "完成国税.质检.工商部门审批";
            flow.IsDelete   = false;
            flow.Remark     = "";
            new DataAccess.FlowInfo().Add(flow);
            Entity.HandleList handle = new DataAccess.HandleList().DataRowToModel(new DataAccess.HandleList().GetList("OpeartionID=5 and JobID='" + jobID + "'").Tables[0].Rows[0]);
            handle.IsChecked     = true;
            handle.Status        = "已处理";
            handle.OpeartionUser = PageBase.CommonObject.LoginUserInfo.companyId;
            handle.OpeartionTime = DateTime.Now;
            handle.Remark        = PageBase.CommonObject.LoginCompanyInfo.FULL_NAME + "完成国税.质检.工商部门审批";
            new DataAccess.HandleList().Update(handle);
            try
            {
                DataAccess.TranHelper.CommitTran();
                context.Response.Write("");
            }
            catch (Exception ex)
            {
                context.Response.Write("数据提交出错!" + ex.ToString());
            }
        }
Exemplo n.º 2
0
        public void ChangeFlow(Entity.JobInfo job)
        {
            DataTable handle = new HandleList().GetList("JobID='" + job.JobID + "'").Tables[0];

            Entity.FlowInfo flowNow = new FlowInfo().DataRowToModel(new FlowInfo().GetList("JobID='" + job.JobID + "' and IsDelete=0 order by SubmitDate desc").Tables[0].Rows[0]);
            DataAccess.TranHelper.BeginTran();
            bool IsChange = false;

            switch (flowNow.FlowID)
            {
            case 2:
                #region 当流程处于2(工单已受理)时
                //是否重制卡
                if (handle.Select("OpeartionID=17 and IsChecked=1").Length > 0)
                {
                    //将流程从2修改为9
                    Entity.FlowInfo flow = new Entity.FlowInfo();
                    flow.Guid       = Guid.NewGuid().ToString();
                    flow.JobID      = job.JobID;
                    flow.FlowID     = 9;
                    flow.SubmitDate = DateTime.Now;
                    flow.SubmitUser = handle.Select("OpeartionID=17 and IsChecked=1")[0]["OpeartionUser"].ToString();
                    flow.Content    = handle.Select("OpeartionID=17 and IsChecked=1")[0]["Remark"].ToString();
                    flow.IsDelete   = false;
                    new FlowInfo().Add(flow);
                    IsChange = true;
                }
                #endregion
                break;
            }
            try
            {
                DataAccess.TranHelper.CommitTran();
                if (IsChange)
                {
                    DataAccess.CardCenterHelper.SendMessage(job.JobID);
                }
            }
            catch (Exception ex)
            {
                throw new Exception("流程提交失败!" + ex.ToString());
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 退单
        /// </summary>
        /// <param name="context"></param>
        private static void Cancel(HttpContext context)
        {
            string jobid  = context.Request["jobid"];
            string reason = context.Request["reason"];

            Entity.FlowInfo flow = new Entity.FlowInfo();
            flow.Guid       = Guid.NewGuid().ToString();
            flow.JobID      = jobid;
            flow.FlowID     = 18;
            flow.SubmitDate = DateTime.Now;
            flow.SubmitUser = PageBase.CommonObject.ManagerUserInfo.guid;
            flow.Content    = reason;
            flow.IsDelete   = false;
            DataAccess.TranHelper.BeginTran();
            new DataAccess.FlowInfo().Add(flow);
            if (jobid.Substring(0, 2) == "SL")
            {
                DataTable dtSale = new DataAccess.SaleList().GetList(string.Format("JobID='{0}' and IsDelete=0", jobid)).Tables[0];
                foreach (DataRow drSale in dtSale.Rows)
                {
                    Entity.SaleList        mSale      = new DataAccess.SaleList().DataRowToModel(drSale);
                    Entity.Stock_Commodity mCommodity = new DataAccess.Stock_Commodity().GetEntity(mSale.ProductType);
                    mCommodity.StockDesplay += mSale.Num;
                    new DataAccess.Stock_Commodity().Update(mCommodity);
                }
            }
            try
            {
                DataAccess.TranHelper.CommitTran();
                context.Response.Write("失效成功");
            }
            catch (Exception ex)
            {
                context.Response.Write("失效失败" + ex.Message);
            }
        }
Exemplo n.º 4
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, "")));
            }
        }
Exemplo n.º 5
0
        public void ProcessRequest(HttpContext context)
        {
            try
            {
                context.Response.ContentType = "text/plain";
                string jobID  = context.Request.Form["hjobID"];
                string saleID = string.Empty;

                Entity.JobInfo job  = new Entity.JobInfo();
                Entity.JobInfo sJob = new Entity.JobInfo();
                DateTime       time = DateTime.Now;
                DataAccess.TranHelper.BeginTran();
                if (string.IsNullOrEmpty(jobID))
                {
                    DataAccess.RunProcedure procedure = new DataAccess.RunProcedure();

                    //JobInfo数据
                    job.JobID          = context.Request.Form["jobSelect"] + "-" + DataAccess.CardCenterHelper.GetCardNo();
                    job.JobType        = context.Request.Form["jobSelect"];
                    job.EnterpriseName = context.Request.Form["companyName"];
                    job.AgentPhone     = context.Request.Form["txtPhone"];
                    job.CreateTime     = time;
                    job.CreateUser     = context.Request.Form["customCode"];
                    job.IsDelete       = false;
                    job.Remark         = context.Request.Form["txtRemark"];
                    job.CustomsCode    = context.Request.Form["customCode"].Length == 10 ? context.Request.Form["customCode"] : null;
                    job.IsOnline       = false;
                    job.ExpressFlat    = false;
                    if (job.JobType == "SL")
                    {
                        job.Fee     = new DataAccess.Stock_Commodity().GetEntity(context.Request.Form["saleSelect"]).SellingPrice *int.Parse(context.Request.Form["txtNum"]);
                        job.FeeFlat = "待缴费";
                    }
                    else
                    {
                        job.Fee     = 0;
                        job.FeeFlat = "无须缴费";
                    }
                    new DataAccess.JobInfo().Add(job);

                    if (job.JobType == "NA" || job.JobType == "RI" || job.JobType == "RM")
                    {
                        sJob.JobID          = "SL-" + DataAccess.CardCenterHelper.GetCardNo();
                        sJob.JobType        = "SL";
                        sJob.EnterpriseName = job.EnterpriseName;
                        sJob.AgentPhone     = job.AgentPhone;
                        sJob.CreateTime     = job.CreateTime;
                        sJob.CreateUser     = job.CreateUser;
                        sJob.IsDelete       = false;
                        sJob.Remark         = job.Remark;
                        sJob.CustomsCode    = job.CustomsCode;
                        sJob.IsOnline       = false;
                        sJob.Fee            = new DataAccess.Stock_Commodity().GetEntity(context.Request.Form["saleSelect"]).SellingPrice *int.Parse(context.Request.Form["txtNum"]);
                        sJob.FeeFlat        = "待缴费";
                        sJob.ExpressFlat    = false;
                        new DataAccess.JobInfo().Add(sJob);

                        Entity.SaleBinding saleBind = new Entity.SaleBinding();
                        saleBind.Guid   = Guid.NewGuid().ToString();
                        saleBind.JobID  = job.JobID;
                        saleBind.SaleID = sJob.JobID;
                        new DataAccess.SaleBinding().Add(saleBind);
                        saleID = saleBind.SaleID;
                    }

                    //FlowInfo数据
                    Entity.FlowInfo flow = new Entity.FlowInfo();
                    flow.Guid       = Guid.NewGuid().ToString();
                    flow.JobID      = job.JobID;
                    flow.FlowID     = int.Parse(new DataAccess.Flow().GetList(string.Format("FlowOrder=2 and JobType='{0}'", job.JobType)).Tables[0].Rows[0]["FlowStatus"].ToString());
                    flow.SubmitDate = time;
                    flow.SubmitUser = PageBase.CommonObject.ManagerUserInfo.guid;
                    flow.Content    = "现场交单.";
                    flow.IsDelete   = false;
                    flow.Remark     = string.Empty;
                    new DataAccess.FlowInfo().Add(flow);

                    if (job.JobType == "NA" || job.JobType == "RI" || job.JobType == "RM")
                    {
                        Entity.FlowInfo sFlow = new Entity.FlowInfo();
                        sFlow.Guid       = Guid.NewGuid().ToString();
                        sFlow.JobID      = sJob.JobID;
                        sFlow.FlowID     = int.Parse(new DataAccess.Flow().GetList("FlowOrder=2 and JobType='SL'").Tables[0].Rows[0]["FlowStatus"].ToString());
                        sFlow.SubmitDate = flow.SubmitDate;
                        sFlow.SubmitUser = flow.SubmitUser;
                        sFlow.Content    = flow.Content;
                        sFlow.IsDelete   = false;
                        sFlow.Remark     = string.Empty;
                        new DataAccess.FlowInfo().Add(sFlow);
                    }

                    //绑定文件袋
                    if (!string.IsNullOrEmpty(context.Request.Form["hBar"]))
                    {
                        new DataAccess.JobBar().BindFile(context.Request.Form["hBar"], job.JobID);
                        if (job.JobType == "NA" || job.JobType == "RI" || job.JobType == "RM")
                        {
                            new DataAccess.JobBar().BindFile(context.Request.Form["hBar"], sJob.JobID);
                        }
                    }
                }
                else
                {
                    job = new DataAccess.JobInfo().GetModel(jobID);
                    if (job.JobType == "SL")
                    {
                        job.Fee += new DataAccess.Stock_Commodity().GetEntity(context.Request.Form["saleSelect"]).SellingPrice *int.Parse(context.Request.Form["txtNum"]);
                        new DataAccess.JobInfo().Update(job);
                    }
                    else if (job.JobType == "NA" || job.JobType == "RI" || job.JobType == "RM")
                    {
                        saleID    = new DataAccess.SaleBinding().GetList(string.Format("JobID='{0}'", jobID)).Tables[0].Rows[0]["SaleID"].ToString();
                        sJob      = new DataAccess.JobInfo().GetModel(saleID);
                        sJob.Fee += new DataAccess.Stock_Commodity().GetEntity(context.Request.Form["saleSelect"]).SellingPrice *int.Parse(context.Request.Form["txtNum"]);
                        new DataAccess.JobInfo().Update(sJob);
                    }
                }


                //工单项信息
                int random = new Random().Next(1, 9999);
                switch (job.JobType)
                {
                case "MD":
                    for (int i = 0; i < int.Parse(context.Request.Form["txtNum"]); i++)
                    {
                        Entity.ModifyList md = new Entity.ModifyList();
                        md.JobType      = context.Request.Form["businessSelect"];
                        md.ListID       = md.JobType + "-" + time.ToString("yyyyMMddhhmmssfff") + (random + i).ToString().PadLeft(4, '0');
                        md.JobID        = job.JobID;
                        md.CardType     = new DataAccess.Para_JobType().GetModel(md.JobType).CardType;
                        md.IsChangeName = false;
                        md.IsDelete     = false;
                        md.Remark       = "现场交单.";
                        new DataAccess.ModifyList().Add(md);
                    }
                    break;

                case "NA":
                    for (int i = 0; i < int.Parse(context.Request.Form["txtNum"]); i++)
                    {
                        Entity.NewlyAddedList na = new Entity.NewlyAddedList();
                        na.JobType  = context.Request.Form["businessSelect"];
                        na.ListID   = na.JobType + "-" + time.ToString("yyyyMMddhhmmssfff") + (random + i).ToString().PadLeft(4, '0');
                        na.JobID    = job.JobID;
                        na.CardType = new DataAccess.Para_JobType().GetModel(na.JobType).CardType;
                        na.CardholderIdentificationType = 1;
                        na.IsDelete = false;
                        na.Remark   = "现场交单.";
                        new DataAccess.NewlyAddedList().Add(na);
                    }
                    Entity.SaleList naSl = new Entity.SaleList();
                    if (new DataAccess.SaleList().GetList(string.Format("JobID='{0}' and ProductType='{1}' and IsDelete=0", saleID, context.Request.Form["saleSelect"])).Tables[0].Rows.Count == 0)
                    {
                        naSl.JobType     = "SL001";
                        naSl.ListID      = naSl.JobType + "-" + time.ToString("yyyyMMddhhmmssfff") + random.ToString().PadLeft(4, '0');
                        naSl.JobID       = saleID;
                        naSl.ProductType = context.Request.Form["saleSelect"];
                        naSl.Num         = int.Parse(context.Request.Form["txtNum"]);
                        naSl.IsDelete    = false;
                        naSl.Remark      = "现场交单.";
                        new DataAccess.SaleList().Add(naSl);
                    }
                    else
                    {
                        naSl      = new DataAccess.SaleList().GetModel(new DataAccess.SaleList().GetList(string.Format("JobID='{0}' and ProductType='{1}' and IsDelete=0", saleID, context.Request.Form["saleSelect"])).Tables[0].Rows[0]["ListID"].ToString());
                        naSl.Num += int.Parse(context.Request.Form["txtNum"]);
                        new DataAccess.SaleList().Update(naSl);
                    }
                    break;

                case "RI":
                    for (int i = 0; i < int.Parse(context.Request.Form["txtNum"]); i++)
                    {
                        Entity.ReIssueList ri = new Entity.ReIssueList();
                        ri.JobType  = context.Request.Form["businessSelect"];
                        ri.ListID   = ri.JobType + "-" + time.ToString("yyyyMMddhhmmssfff") + (random + i).ToString().PadLeft(4, '0');
                        ri.JobID    = job.JobID;
                        ri.CardType = new DataAccess.Para_JobType().GetModel(ri.JobType).CardType;
                        ri.IsDelete = false;
                        ri.Remark   = "现场交单.";
                        new DataAccess.ReIssueList().Add(ri);
                    }
                    Entity.SaleList riSl = new Entity.SaleList();
                    if (new DataAccess.SaleList().GetList(string.Format("JobID='{0}' and ProductType='{1}' and IsDelete=0", saleID, context.Request.Form["saleSelect"])).Tables[0].Rows.Count == 0)
                    {
                        riSl.JobType     = "SL001";
                        riSl.ListID      = riSl.JobType + "-" + time.ToString("yyyyMMddhhmmssfff") + random.ToString().PadLeft(4, '0');
                        riSl.JobID       = saleID;
                        riSl.ProductType = context.Request.Form["saleSelect"];
                        riSl.Num         = int.Parse(context.Request.Form["txtNum"]);
                        riSl.IsDelete    = false;
                        riSl.Remark      = "现场交单.";
                        new DataAccess.SaleList().Add(riSl);
                    }
                    else
                    {
                        riSl      = new DataAccess.SaleList().GetModel(new DataAccess.SaleList().GetList(string.Format("JobID='{0}' and ProductType='{1}' and IsDelete=0", saleID, context.Request.Form["saleSelect"])).Tables[0].Rows[0]["ListID"].ToString());
                        riSl.Num += int.Parse(context.Request.Form["txtNum"]);
                        new DataAccess.SaleList().Update(riSl);
                    }
                    break;

                case "RM":
                    for (int i = 0; i < int.Parse(context.Request.Form["txtNum"]); i++)
                    {
                        Entity.ReMakeList rm = new Entity.ReMakeList();
                        rm.JobType  = context.Request.Form["businessSelect"];
                        rm.ListID   = rm.JobType + "-" + time.ToString("yyyyMMddhhmmssfff") + (random + i).ToString().PadLeft(4, '0');
                        rm.JobID    = job.JobID;
                        rm.CardType = new DataAccess.Para_JobType().GetModel(rm.JobType).CardType;
                        rm.IsDelete = false;
                        rm.Remark   = "现场交单.";
                        new DataAccess.ReMakeList().Add(rm);
                    }
                    Entity.SaleList rmSl = new Entity.SaleList();
                    if (new DataAccess.SaleList().GetList(string.Format("JobID='{0}' and ProductType='{1}' and IsDelete=0", saleID, context.Request.Form["saleSelect"])).Tables[0].Rows.Count == 0)
                    {
                        rmSl.JobType     = "SL001";
                        rmSl.ListID      = rmSl.JobType + "-" + time.ToString("yyyyMMddhhmmssfff") + random.ToString().PadLeft(4, '0');
                        rmSl.JobID       = saleID;
                        rmSl.ProductType = context.Request.Form["saleSelect"];
                        rmSl.Num         = int.Parse(context.Request.Form["txtNum"]);
                        rmSl.IsDelete    = false;
                        rmSl.Remark      = "现场交单.";
                        new DataAccess.SaleList().Add(rmSl);
                    }
                    else
                    {
                        rmSl      = new DataAccess.SaleList().GetModel(new DataAccess.SaleList().GetList(string.Format("JobID='{0}' and ProductType='{1}' and IsDelete=0", saleID, context.Request.Form["saleSelect"])).Tables[0].Rows[0]["ListID"].ToString());
                        rmSl.Num += int.Parse(context.Request.Form["txtNum"]);
                        new DataAccess.SaleList().Update(rmSl);
                    }
                    break;

                case "SL":
                    Entity.SaleList sl = new Entity.SaleList();
                    if (new DataAccess.SaleList().GetList(string.Format("JobID='{0}' and ProductType='{1}' and IsDelete=0", saleID, context.Request.Form["saleSelect"])).Tables[0].Rows.Count == 0)
                    {
                        sl.JobType     = "SL001";
                        sl.ListID      = sl.JobType + "-" + time.ToString("yyyyMMddhhmmssfff") + random.ToString().PadLeft(4, '0');
                        sl.JobID       = job.JobID;
                        sl.ProductType = context.Request.Form["saleSelect"];
                        sl.Num         = int.Parse(context.Request.Form["txtNum"]);
                        sl.IsDelete    = false;
                        sl.Remark      = "现场交单.";
                        sl.ManagerFlag = 0;
                        sl.ManagerUser = PageBase.CommonObject.ManagerUserInfo.guid;
                        sl.ManagerTime = DateTime.Now;
                        new DataAccess.SaleList().Add(sl);
                    }
                    else
                    {
                        sl      = new DataAccess.SaleList().GetModel(new DataAccess.SaleList().GetList(string.Format("JobID='{0}' and ProductType='{1}' and IsDelete=0", saleID, context.Request.Form["saleSelect"])).Tables[0].Rows[0]["ListID"].ToString());
                        sl.Num += int.Parse(context.Request.Form["txtNum"]);
                        new DataAccess.SaleList().Update(sl);
                    }
                    break;

                case "UU":
                    for (int i = 0; i < int.Parse(context.Request.Form["txtNum"]); i++)
                    {
                        Entity.UpdateUnlockList uu = new Entity.UpdateUnlockList();
                        uu.JobType  = context.Request.Form["businessSelect"];
                        uu.ListID   = uu.JobType + "-" + time.ToString("yyyyMMddhhmmssfff") + (random + i).ToString().PadLeft(4, '0');
                        uu.JobID    = job.JobID;
                        uu.CardType = new DataAccess.Para_JobType().GetModel(uu.JobType).CardType;
                        uu.IsDelete = false;
                        uu.Remark   = "现场交单.";
                        new DataAccess.UpdateUnlockList().Add(uu);
                    }
                    break;
                }
                try
                {
                    if (job.JobType != "UU" && job.JobType != "MD")
                    {
                        //减少显示库存
                        Entity.Stock_Commodity mCommodity = new DataAccess.Stock_Commodity().GetEntity(context.Request.Form["saleSelect"]);
                        mCommodity.StockDesplay -= int.Parse(context.Request.Form["txtNum"]);
                        if (mCommodity.StockDesplay < 0)
                        {
                            throw new Exception(string.Format("{0}{1}({2})库存不足,请更换库存充足的安全产品厂商或稍后再试!", mCommodity.AdditionalAttributes, mCommodity.CommodityName, mCommodity.CommodityType));
                        }
                        else
                        {
                            new DataAccess.Stock_Commodity().Update(mCommodity);
                        }
                    }
                    DataAccess.TranHelper.CommitTran();
                    DataAccess.TranHelper.BeginTran();
                    //处理列表信息
                    switch (job.JobType)
                    {
                    case "MD":
                        new DataAccess.MDDataAccess().InsertHandleList(job);
                        break;

                    case "NA":
                        new DataAccess.NADataAccess().InsertHandleList(job);
                        new DataAccess.SLDataAccess().InsertHandleList(sJob);
                        break;

                    case "RI":
                        new DataAccess.RIDataAccess().InsertHandleList(job);
                        new DataAccess.SLDataAccess().InsertHandleList(sJob);
                        break;

                    case "RM":
                        new DataAccess.RMDataAccess().InsertHandleList(job);
                        new DataAccess.SLDataAccess().InsertHandleList(sJob);
                        break;

                    case "SL":
                        new DataAccess.SLDataAccess().InsertHandleList(job);
                        break;

                    case "UU":
                        new DataAccess.UUDataAccess().InsertHandleList(job);
                        break;
                    }
                    DataAccess.TranHelper.CommitTran();
                    context.Response.Write(JsonConvert.SerializeObject(new Data("", job.JobID)));
                }
                catch (Exception ex)
                {
                    context.Response.Write(JsonConvert.SerializeObject(new Data(ex.Message, "")));
                }
            }
            catch (Exception ex)
            {
                context.Response.Write(JsonConvert.SerializeObject(new Data(ex.Message, "")));
            }
        }
Exemplo n.º 6
0
        static void Main(string[] args)
        {
            DataTable dt = new DataAccess.RunProcedure().CloseList();

            foreach (DataRow dr in dt.Rows)
            {
                try
                {
                    Dictionary <string, string> result = new Dictionary <string, string>();
                    try
                    {
                        result = DataAccess.PayHelper.IPaySearch(dr["JobID"].ToString());
                    }
                    catch (Exception ex)
                    {
                        new DataAccess.Sys_Log().AddLog(string.Format("Function:CloseJob.Main;Param:{0};ErrorMsg:查询接口失败.{1}", dr["JobID"].ToString(), ex.ToString()));
                    }
                    bool IsSuccess = false;
                    if (result["status"] != null)
                    {
                        if (result["status"].Equals("Success"))
                        {
                            IsSuccess = true;
                        }
                    }
                    if (!IsSuccess)
                    {
                        //关闭工单
                        Entity.FlowInfo flow = new Entity.FlowInfo();
                        flow.Guid       = Guid.NewGuid().ToString();
                        flow.JobID      = dr["JobID"].ToString();
                        flow.FlowID     = 18;
                        flow.SubmitDate = DateTime.Now;
                        flow.SubmitUser = "******";
                        flow.Content    = "超时未支付,系统自动关闭工单。";
                        flow.IsDelete   = false;
                        try
                        {
                            if (!new DataAccess.FlowInfo().AddEx(flow))
                            {
                                new DataAccess.Sys_Log().AddLog(string.Format("Function:CloseJob.Main;Param:{0};ErrorMsg:关闭工单失败.入库失败", flow.JobID));
                            }
                        }
                        catch (Exception ex)
                        {
                            new DataAccess.Sys_Log().AddLog(string.Format("Function:CloseJob.Main;Param:{0};ErrorMsg:关闭工单失败.{1}", flow.JobID, ex.ToString()));
                        }
                        //恢复库存
                        DataTable dtSale = new DataAccess.SaleList().GetList(string.Format("JobID='{0}' and IsDelete=0", flow.JobID)).Tables[0];
                        foreach (DataRow drSale in dtSale.Rows)
                        {
                            Entity.SaleList        mSale      = new DataAccess.SaleList().DataRowToModel(drSale);
                            Entity.Stock_Commodity mCommodity = new DataAccess.Stock_Commodity().GetEntity(mSale.ProductType);
                            mCommodity.StockDesplay += mSale.Num;
                            try
                            {
                                if (!new DataAccess.Stock_Commodity().UpdateEx(mCommodity))
                                {
                                    new DataAccess.Sys_Log().AddLog(string.Format("Function:CloseJob.Main;Param:{0};ErrorMsg:恢复库存失败.入库失败", flow.JobID));
                                }
                            }
                            catch (Exception ex)
                            {
                                new DataAccess.Sys_Log().AddLog(string.Format("Function:CloseJob.Main;Param:{0};ErrorMsg:恢复库存失败.{1}", flow.JobID, ex.ToString()));
                            }
                        }
                    }
                    else
                    {
                        Entity.JobInfo    job    = new DataAccess.JobInfo().GetModel(dr["JobID"].ToString());
                        Entity.HandleList handle = new DataAccess.HandleList().GetFeeData(dr["JobID"].ToString());
                        if (job != null && handle != null)
                        {
                            //更新工单缴费信息
                            job.FeeFlat          = "已缴费";
                            handle.IsChecked     = true;
                            handle.Status        = "已处理";
                            handle.OpeartionUser = job.CustomsCode;
                            handle.OpeartionTime = DateTime.ParseExact(result["lastUpdated"], "yyyyMMddHHmmss", null).AddHours(8);
                            handle.Remark        = "网上支付";
                            try
                            {
                                if (!new DataAccess.JobInfo().UpdateEx(job) && new DataAccess.HandleList().UpdateEx(handle))
                                {
                                    new DataAccess.Sys_Log().AddLog(string.Format("Function:CloseJob.Main;Param:{0};ErrorMsg:更新工单失败.入库失败", job.JobID));
                                }
                            }
                            catch (Exception ex)
                            {
                                new DataAccess.Sys_Log().AddLog(string.Format("Function:CloseJob.Main;Param:{0};ErrorMsg:更新工单失败.{1}", job.JobID, ex.ToString()));
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    new DataAccess.Sys_Log().AddLog(string.Format("Function:CloseJob.Main;Param:{0};ErrorMsg:未知错误.{1}", dr["JobID"].ToString(), ex.ToString()));
                }
            }
        }
Exemplo n.º 7
0
        public void ChangeFlow(Entity.JobInfo job)
        {
            DataTable handle = new HandleList().GetList("JobID='" + job.JobID + "'").Tables[0];

            Entity.FlowInfo flowNow = new FlowInfo().DataRowToModel(new FlowInfo().GetList("JobID='" + job.JobID + "' and IsDelete=0 order by SubmitDate desc").Tables[0].Rows[0]);
            DataAccess.TranHelper.BeginTran();
            bool IsChange = false;

            switch (flowNow.FlowID)
            {
            case 7:
                #region 当流程处于7(工单已受理)时
                //是否资料已经确认
                if (handle.Select("OpeartionID=11 and IsChecked=1").Length > 0)
                {
                    bool isChange = new ModifyList().GetList("IsDelete=0 and IsChangeName=1 and JobID='" + job.JobID + "'").Tables[0].Rows.Count > 0 ? true : false;
                    //是否变更法人名或企业名
                    if (isChange)
                    {
                        //将流程从7修改成8
                        Entity.FlowInfo flowSP = new Entity.FlowInfo();
                        flowSP.Guid       = Guid.NewGuid().ToString();
                        flowSP.JobID      = job.JobID;
                        flowSP.FlowID     = 8;
                        flowSP.SubmitDate = DateTime.Now;
                        flowSP.SubmitUser = handle.Select("OpeartionID=11 and IsChecked=1")[0]["OpeartionUser"].ToString();
                        flowSP.Content    = handle.Select("OpeartionID=11 and IsChecked=1")[0]["Remark"].ToString();
                        flowSP.IsDelete   = false;
                        new FlowInfo().Add(flowSP);
                        IsChange = true;
                        if ((bool)job.ExpressFlat)
                        {
                            //是否资料确认、收卡、制卡、快递
                            if (handle.Select("OpeartionID=11 and IsChecked=1").Length > 0 && handle.Select("FunctionID='A07' and IsChecked=1").Length > 0 && handle.Select("OpeartionID=14 and IsChecked=1").Length > 0 && handle.Select("OpeartionID=10 and IsChecked=1").Length > 0)
                            {
                                //将流程从8修改为6
                                Entity.FlowInfo flow = new Entity.FlowInfo();
                                flow.Guid       = Guid.NewGuid().ToString();
                                flow.JobID      = job.JobID;
                                flow.FlowID     = 6;
                                flow.SubmitDate = DateTime.Now;
                                flow.SubmitUser = handle.Select("OpeartionID=10 and IsChecked=1")[0]["OpeartionUser"].ToString();
                                flow.Content    = handle.Select("OpeartionID=10 and IsChecked=1")[0]["Remark"].ToString();
                                flow.IsDelete   = false;
                                new FlowInfo().Add(flow);
                                IsChange = true;
                            }
                        }
                        else
                        {
                            //是否资料确认、收卡、制卡
                            if (handle.Select("OpeartionID=11 and IsChecked=1").Length > 0 && handle.Select("FunctionID='A07' and IsChecked=1").Length > 0 && handle.Select("OpeartionID=14 and IsChecked=1").Length > 0)
                            {
                                if (handle.Select("OpeartionID=9 and IsChecked=1").Length > 0)
                                {
                                    //将流程从8修改为5
                                    Entity.FlowInfo flow = new Entity.FlowInfo();
                                    flow.Guid       = Guid.NewGuid().ToString();
                                    flow.JobID      = job.JobID;
                                    flow.FlowID     = 5;
                                    flow.SubmitDate = DateTime.Now;
                                    flow.SubmitUser = handle.Select("OpeartionID=9 and IsChecked=1")[0]["OpeartionUser"].ToString();
                                    flow.Content    = handle.Select("OpeartionID=9 and IsChecked=1")[0]["Remark"].ToString();
                                    flow.IsDelete   = false;
                                    new FlowInfo().Add(flow);
                                    IsChange = true;
                                }
                                else
                                {
                                    //将流程从8修改为11
                                    Entity.FlowInfo flow = new Entity.FlowInfo();
                                    flow.Guid       = Guid.NewGuid().ToString();
                                    flow.JobID      = job.JobID;
                                    flow.FlowID     = 11;
                                    flow.SubmitDate = DateTime.Now;
                                    flow.SubmitUser = handle.Select("", "OpeartionTime desc")[0]["OpeartionUser"].ToString();
                                    flow.IsDelete   = false;
                                    new FlowInfo().Add(flow);
                                    IsChange = true;
                                }
                            }
                        }
                    }
                    else
                    {
                        //将流程从7修改成9
                        Entity.FlowInfo flow = new Entity.FlowInfo();
                        flow.Guid       = Guid.NewGuid().ToString();
                        flow.JobID      = job.JobID;
                        flow.FlowID     = 9;
                        flow.SubmitDate = DateTime.Now;
                        flow.SubmitUser = handle.Select("OpeartionID=11 and IsChecked=1")[0]["OpeartionUser"].ToString();
                        flow.Content    = handle.Select("OpeartionID=11 and IsChecked=1")[0]["Remark"].ToString();
                        flow.IsDelete   = false;
                        new FlowInfo().Add(flow);
                        IsChange = true;
                    }
                }
                #endregion
                break;

            case 8:
                #region 当流程处于8(资料已去确认)时
                //是否快递领取
                if ((bool)job.ExpressFlat)
                {
                    //是否资料确认、收卡、制卡、快递
                    if (handle.Select("OpeartionID=11 and IsChecked=1").Length > 0 && handle.Select("FunctionID='A07' and IsChecked=1").Length > 0 && handle.Select("OpeartionID=14 and IsChecked=1").Length > 0 && handle.Select("OpeartionID=10 and IsChecked=1").Length > 0)
                    {
                        //将流程从8修改为6
                        Entity.FlowInfo flow = new Entity.FlowInfo();
                        flow.Guid       = Guid.NewGuid().ToString();
                        flow.JobID      = job.JobID;
                        flow.FlowID     = 6;
                        flow.SubmitDate = DateTime.Now;
                        flow.SubmitUser = handle.Select("OpeartionID=10 and IsChecked=1")[0]["OpeartionUser"].ToString();
                        flow.Content    = handle.Select("OpeartionID=10 and IsChecked=1")[0]["Remark"].ToString();
                        flow.IsDelete   = false;
                        new FlowInfo().Add(flow);
                        IsChange = true;
                    }
                }
                else
                {
                    //是否资料确认、收卡、制卡
                    if (handle.Select("OpeartionID=11 and IsChecked=1").Length > 0 && handle.Select("FunctionID='A07' and IsChecked=1").Length > 0 && handle.Select("OpeartionID=14 and IsChecked=1").Length > 0)
                    {
                        if (handle.Select("OpeartionID=9 and IsChecked=1").Length > 0)
                        {
                            //将流程从8修改为5
                            Entity.FlowInfo flow = new Entity.FlowInfo();
                            flow.Guid       = Guid.NewGuid().ToString();
                            flow.JobID      = job.JobID;
                            flow.FlowID     = 5;
                            flow.SubmitDate = DateTime.Now;
                            flow.SubmitUser = handle.Select("OpeartionID=9 and IsChecked=1")[0]["OpeartionUser"].ToString();
                            flow.Content    = handle.Select("OpeartionID=9 and IsChecked=1")[0]["Remark"].ToString();
                            flow.IsDelete   = false;
                            new FlowInfo().Add(flow);
                            IsChange = true;
                        }
                        else
                        {
                            //将流程从8修改为11
                            Entity.FlowInfo flow = new Entity.FlowInfo();
                            flow.Guid       = Guid.NewGuid().ToString();
                            flow.JobID      = job.JobID;
                            flow.FlowID     = 11;
                            flow.SubmitDate = DateTime.Now;
                            flow.SubmitUser = handle.Select("", "OpeartionTime desc")[0]["OpeartionUser"].ToString();
                            flow.IsDelete   = false;
                            new FlowInfo().Add(flow);
                            IsChange = true;
                        }
                    }
                }
                #endregion
                break;

            case 11:
                #region 当流程处于11(等待现场领取)时
                //是否已现场领取
                if (handle.Select("OpeartionID=9 and IsChecked=1").Length > 0)
                {
                    //将流程从11修改为5
                    Entity.FlowInfo flow = new Entity.FlowInfo();
                    flow.Guid       = Guid.NewGuid().ToString();
                    flow.JobID      = job.JobID;
                    flow.FlowID     = 5;
                    flow.SubmitDate = DateTime.Now;
                    flow.SubmitUser = handle.Select("OpeartionID=9 and IsChecked=1")[0]["OpeartionUser"].ToString();
                    flow.Content    = handle.Select("OpeartionID=9 and IsChecked=1")[0]["Remark"].ToString();
                    flow.IsDelete   = false;
                    new FlowInfo().Add(flow);
                    IsChange = true;
                }
                #endregion
                break;
            }
            try
            {
                DataAccess.TranHelper.CommitTran();
                if (IsChange)
                {
                    DataAccess.CardCenterHelper.SendMessage(job.JobID);
                }
            }
            catch (Exception ex)
            {
                throw new Exception("流程提交失败!" + ex.ToString());
            }
        }
Exemplo n.º 8
0
        public void InsertHeadData(Entity.JobInfo job, List <Entity.FileList> fileList, Entity.FlowInfo flow)
        {
            DataAccess.JobInfo daJob = new JobInfo();
            if (daJob.Exists(job.JobID))
            {
                daJob.Update(job);
            }
            else
            {
                daJob.Add(job);
            }

            DataAccess.FileList daFile = new FileList();
            foreach (Entity.FileList file in fileList)
            {
                if (daFile.GetList("FileType='" + file.FileType + "' and JobID='" + file.JobID + "' and ListID='" + file.ListID + "'").Tables[0].Rows.Count == 0)
                {
                    daFile.Add(file);
                }
                else
                {
                    daFile.Update(file);
                }
            }

            new DataAccess.FlowInfo().Add(flow);
        }
Exemplo n.º 9
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, "SaleList");
                    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) ? "SL-" + CardCenter.DataAccess.CardCenterHelper.GetCardNo() : jobID;
                    job.JobType           = "SL";
                    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       = context.Request.Form["expressflat"] == "快递" ? true : false;
                    job.Remark            = string.Empty;
                    DataTable feeDt = procedure.JobFeeDetal(job.JobID, "SaleList").Tables[0];
                    job.Fee = decimal.Parse(feeDt.Rows[0]["Fee"].ToString());
                    if (job.Fee == 0)
                    {
                        job.FeeFlat = "无须缴费";
                    }
                    else
                    {
                        job.FeeFlat = "待缴费";
                    }
                    job.CustomsCode     = CommonObject.LoginUserInfo.companyId;
                    job.IsOnline        = true;
                    job.InvoiceName     = context.Request.Form["txtInvoiceName"];
                    job.InvoicePhone    = context.Request.Form["txtInvoicePhone"];
                    job.InvoiceAddress  = context.Request.Form["txtInvoiceAddress"];
                    job.InvoicePostCode = context.Request.Form["txtInvoicePostCode"];
                    job.InvoiceEmail    = context.Request.Form["txtInvoiceEmail"];
                    job.InvoiceCode     = context.Request.Form["txtInvoiceCode"];

                    //FileList数据
                    List <Entity.FileList> fileList = new List <Entity.FileList>();
                    DataSet ds      = procedure.SelectFileTypeByJobType("SL");
                    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.SaleList().GetList("JobID='" + job.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(job.JobID, "SaleList");
                        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='SL' 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;

                    //SaleBinding数据
                    Entity.SaleBinding     mBinding   = new Entity.SaleBinding();
                    DataAccess.SaleBinding dalBinding = new DataAccess.SaleBinding();
                    DataTable dtBindList = dalBinding.GetList("SaleID='" + job.JobID + "'").Tables[0];
                    if (dtBindList.Rows.Count > 0)
                    {
                        mBinding       = dalBinding.GetEntity(dtBindList.Rows[0][0].ToString());
                        mBinding.JobID = context.Request.Form["hJobList"];
                        dalBinding.Update(mBinding);
                    }
                    else
                    {
                        mBinding.Guid   = Guid.NewGuid().ToString();
                        mBinding.SaleID = job.JobID;
                        mBinding.JobID  = context.Request.Form["hJobList"];
                        dalBinding.Add(mBinding);
                    }

                    //提交数据到后台存储过程事务
                    DataAccess.TranHelper.BeginTran();
                    DataAccess.SLDataAccess sl = new DataAccess.SLDataAccess();
                    sl.InsertHeadData(job, fileList, flow);
                    if (context.Request.Form["hSaveType"] == "complete")
                    {
                        sl.InsertHandleList(job);
                        //减少显示库存
                        ds = new DataAccess.RunProcedure().JobView(jobID, "SaleList");
                        foreach (DataRow dr in ds.Tables[1].Rows)
                        {
                            Entity.Stock_Commodity commodityEntity = new DataAccess.Stock_Commodity().GetEntity(dr["ProductType"].ToString());
                            commodityEntity.StockDesplay -= int.Parse(dr["Num"].ToString());
                            if (commodityEntity.StockDesplay < 0)
                            {
                                context.Response.Write(JsonConvert.SerializeObject(new Data(string.Format("\n{0}{1}({2})库存不足,请更换库存充足的安全产品厂商或稍后再试!", commodityEntity.AdditionalAttributes, commodityEntity.CommodityName, commodityEntity.CommodityType), "")));
                                return;
                            }
                            else
                            {
                                new DataAccess.Stock_Commodity().Update(commodityEntity);
                            }
                        }
                    }
                    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, "")));
            }
        }
Exemplo n.º 10
0
        public void ChangeFlow(Entity.JobInfo job)
        {
            DataTable handle = new HandleList().GetList("JobID='" + job.JobID + "'").Tables[0];

            Entity.FlowInfo flowNow = new FlowInfo().DataRowToModel(new FlowInfo().GetList("JobID='" + job.JobID + "' and IsDelete=0 order by SubmitDate desc").Tables[0].Rows[0]);
            DataAccess.TranHelper.BeginTran();
            bool IsChange = false;

            switch (flowNow.FlowID)
            {
            case 2:
                #region 当前流程处于2(工单已受理,请缴费)时
                bool haveFR = new NewlyAddedList().GetList("IsDelete=0 and JobType='NA001' and JobID='" + job.JobID + "'").Tables[0].Rows.Count > 0 ? true : false;
                bool haveQT = new NewlyAddedList().GetList("IsDelete=0 and JobType<>'NA001' and JobID='" + job.JobID + "'").Tables[0].Rows.Count > 0 ? true : false;
                //是否有法人卡
                if (haveFR)
                {
                    bool IsGZ = true;
                    if (job.IsOnline)
                    {
                        string shtyxydm = new NewlyAddedListFR().GetList("ListID='" + new NewlyAddedList().GetList("IsDelete=0 and JobType='NA001' and JobID='" + job.JobID + "'").Tables[0].Rows[0]["ListID"] + "'").Tables[0].Rows[0]["SHTYXYDM_QS"].ToString().Substring(2, 4);
                        if (shtyxydm != "4401" && shtyxydm != "4400")
                        {
                            IsGZ = false;
                        }
                    }
                    //是否非广州市属企业
                    if (!IsGZ)
                    {
                        //是否已录入前三数据
                        if (handle.Select("OpeartionID=3 and IsChecked=1").Length > 0)
                        {
                            //将流程从2修改为3
                            Entity.FlowInfo flow = new Entity.FlowInfo();
                            flow.Guid       = Guid.NewGuid().ToString();
                            flow.JobID      = job.JobID;
                            flow.FlowID     = 3;
                            flow.SubmitDate = DateTime.Now;
                            flow.SubmitUser = handle.Select("OpeartionID=3 and IsChecked=1")[0]["OpeartionUser"].ToString();
                            flow.Content    = handle.Select("OpeartionID=3 and IsChecked=1")[0]["Remark"].ToString();
                            flow.IsDelete   = false;
                            new FlowInfo().Add(flow);
                            IsChange = true;
                        }
                    }
                    else
                    {
                        //是否有操作员卡
                        if (haveQT)
                        {
                            //是否录入前三、后三、制法人卡、制操作员卡
                            if (handle.Select("OpeartionID=3 and IsChecked=1").Length > 0 && handle.Select("OpeartionID=4 and IsChecked=1").Length > 0 && handle.Select("OpeartionID=6 and IsChecked=1").Length > 0 && handle.Select("OpeartionID=7 and IsChecked=1").Length > 0)
                            {
                                //将流程从2修改为9
                                Entity.FlowInfo flow = new Entity.FlowInfo();
                                flow.Guid       = Guid.NewGuid().ToString();
                                flow.JobID      = job.JobID;
                                flow.FlowID     = 9;
                                flow.SubmitDate = DateTime.Now;
                                flow.SubmitUser = handle.Select("OpeartionID=6 and IsChecked=1")[0]["OpeartionUser"].ToString();
                                flow.Content    = handle.Select("OpeartionID=6 and IsChecked=1")[0]["Remark"].ToString();
                                flow.IsDelete   = false;
                                new FlowInfo().Add(flow);
                                IsChange = true;
                            }
                        }
                        else
                        {
                            //是否录入前三、后三、制法人卡
                            if (handle.Select("OpeartionID=3 and IsChecked=1").Length > 0 && handle.Select("OpeartionID=4 and IsChecked=1").Length > 0 && handle.Select("OpeartionID=6 and IsChecked=1").Length > 0)
                            {
                                //将流程从2修改为9
                                Entity.FlowInfo flow = new Entity.FlowInfo();
                                flow.Guid       = Guid.NewGuid().ToString();
                                flow.JobID      = job.JobID;
                                flow.FlowID     = 9;
                                flow.SubmitDate = DateTime.Now;
                                flow.SubmitUser = handle.Select("OpeartionID=6 and IsChecked=1")[0]["OpeartionUser"].ToString();
                                flow.Content    = handle.Select("OpeartionID=6 and IsChecked=1")[0]["Remark"].ToString();
                                flow.IsDelete   = false;
                                new FlowInfo().Add(flow);
                                IsChange = true;
                            }
                        }
                    }
                }
                else
                {
                    //是否录入制操作员卡
                    if (handle.Select("OpeartionID=7 and IsChecked=1").Length > 0)
                    {
                        //将流程从2修改为9
                        Entity.FlowInfo flow = new Entity.FlowInfo();
                        flow.Guid       = Guid.NewGuid().ToString();
                        flow.JobID      = job.JobID;
                        flow.FlowID     = 9;
                        flow.SubmitDate = DateTime.Now;
                        flow.SubmitUser = handle.Select("OpeartionID=7 and IsChecked=1")[0]["OpeartionUser"].ToString();
                        flow.Content    = handle.Select("OpeartionID=7 and IsChecked=1")[0]["Remark"].ToString();
                        flow.IsDelete   = false;
                        new FlowInfo().Add(flow);
                        IsChange = true;
                    }
                }
                #endregion
                break;

            case 3:
                #region 当前流程处于3(等待审批确认)时
                //是否审批确认
                if (handle.Select("OpeartionID=5 and IsChecked=1").Length > 0)
                {
                    //将流程从3修改为4
                    Entity.FlowInfo flowSP = new Entity.FlowInfo();
                    flowSP.Guid       = Guid.NewGuid().ToString();
                    flowSP.JobID      = job.JobID;
                    flowSP.FlowID     = 4;
                    flowSP.SubmitDate = DateTime.Now;
                    flowSP.SubmitUser = handle.Select("OpeartionID=5 and IsChecked=1")[0]["OpeartionUser"].ToString();
                    flowSP.Content    = handle.Select("OpeartionID=5 and IsChecked=1")[0]["Remark"].ToString();
                    flowSP.IsDelete   = false;
                    new FlowInfo().Add(flowSP);
                    IsChange = true;
                    bool QT = new NewlyAddedList().GetList("IsDelete=0 and JobType<>'NA001' and JobID='" + job.JobID + "'").Tables[0].Rows.Count > 0 ? true : false;
                    //是否有操作员卡
                    if (QT)
                    {
                        //是否录入前三、后三、制法人卡、制操作员卡
                        if (handle.Select("OpeartionID=3 and IsChecked=1").Length > 0 && handle.Select("OpeartionID=4 and IsChecked=1").Length > 0 && handle.Select("OpeartionID=6 and IsChecked=1").Length > 0 && handle.Select("OpeartionID=7 and IsChecked=1").Length > 0)
                        {
                            //将流程从2修改为9
                            Entity.FlowInfo flow = new Entity.FlowInfo();
                            flow.Guid       = Guid.NewGuid().ToString();
                            flow.JobID      = job.JobID;
                            flow.FlowID     = 9;
                            flow.SubmitDate = DateTime.Now;
                            flow.SubmitUser = handle.Select("OpeartionID=6 and IsChecked=1")[0]["OpeartionUser"].ToString();
                            flow.Content    = handle.Select("OpeartionID=6 and IsChecked=1")[0]["Remark"].ToString();
                            flow.IsDelete   = false;
                            new FlowInfo().Add(flow);
                            IsChange = true;
                        }
                    }
                    else
                    {
                        //是否录入前三、后三、制法人卡
                        if (handle.Select("OpeartionID=3 and IsChecked=1").Length > 0 && handle.Select("OpeartionID=4 and IsChecked=1").Length > 0 && handle.Select("OpeartionID=6 and IsChecked=1").Length > 0)
                        {
                            //将流程从2修改为9
                            Entity.FlowInfo flow = new Entity.FlowInfo();
                            flow.Guid       = Guid.NewGuid().ToString();
                            flow.JobID      = job.JobID;
                            flow.FlowID     = 9;
                            flow.SubmitDate = DateTime.Now;
                            flow.SubmitUser = handle.Select("OpeartionID=6 and IsChecked=1")[0]["OpeartionUser"].ToString();
                            flow.Content    = handle.Select("OpeartionID=6 and IsChecked=1")[0]["Remark"].ToString();
                            flow.IsDelete   = false;
                            new FlowInfo().Add(flow);
                            IsChange = true;
                        }
                    }
                }
                #endregion
                break;

            case 4:
                #region 当前流程处于4(审批确认,工单处理中)时
                //是否审批确认
                if (handle.Select("OpeartionID=5 and IsChecked=1").Length > 0)
                {
                    bool QT = new NewlyAddedList().GetList("IsDelete=0 and JobType<>'NA001' and JobID='" + job.JobID + "'").Tables[0].Rows.Count > 0 ? true : false;
                    //是否有操作员卡
                    if (QT)
                    {
                        //是否录入前三、后三、制法人卡、制操作员卡
                        if (handle.Select("OpeartionID=3 and IsChecked=1").Length > 0 && handle.Select("OpeartionID=4 and IsChecked=1").Length > 0 && handle.Select("OpeartionID=6 and IsChecked=1").Length > 0 && handle.Select("OpeartionID=7 and IsChecked=1").Length > 0)
                        {
                            //将流程从2修改为9
                            Entity.FlowInfo flow = new Entity.FlowInfo();
                            flow.Guid       = Guid.NewGuid().ToString();
                            flow.JobID      = job.JobID;
                            flow.FlowID     = 9;
                            flow.SubmitDate = DateTime.Now;
                            flow.SubmitUser = handle.Select("OpeartionID=6 and IsChecked=1")[0]["OpeartionUser"].ToString();
                            flow.Content    = handle.Select("OpeartionID=6 and IsChecked=1")[0]["Remark"].ToString();
                            flow.IsDelete   = false;
                            new FlowInfo().Add(flow);
                            IsChange = true;
                        }
                    }
                    else
                    {
                        //是否录入前三、后三、制法人卡
                        if (handle.Select("OpeartionID=3 and IsChecked=1").Length > 0 && handle.Select("OpeartionID=4 and IsChecked=1").Length > 0 && handle.Select("OpeartionID=6 and IsChecked=1").Length > 0)
                        {
                            //将流程从2修改为9
                            Entity.FlowInfo flow = new Entity.FlowInfo();
                            flow.Guid       = Guid.NewGuid().ToString();
                            flow.JobID      = job.JobID;
                            flow.FlowID     = 9;
                            flow.SubmitDate = DateTime.Now;
                            flow.SubmitUser = handle.Select("OpeartionID=6 and IsChecked=1")[0]["OpeartionUser"].ToString();
                            flow.Content    = handle.Select("OpeartionID=6 and IsChecked=1")[0]["Remark"].ToString();
                            flow.IsDelete   = false;
                            new FlowInfo().Add(flow);
                            IsChange = true;
                        }
                    }
                }
                else
                {
                    //将流程从4修改为3
                    Entity.FlowInfo flow = new Entity.FlowInfo();
                    flow.Guid       = Guid.NewGuid().ToString();
                    flow.JobID      = job.JobID;
                    flow.FlowID     = 3;
                    flow.SubmitDate = DateTime.Now;
                    flow.SubmitUser = handle.Select("OpeartionID=5 and IsChecked=0")[0]["OpeartionUser"].ToString();
                    flow.Content    = handle.Select("OpeartionID=5 and IsChecked=0")[0]["Remark"].ToString();
                    flow.IsDelete   = false;
                    new FlowInfo().Add(flow);
                    IsChange = true;
                }
                #endregion
                break;
            }
            try
            {
                DataAccess.TranHelper.CommitTran();
                if (IsChange)
                {
                    DataAccess.CardCenterHelper.SendMessage(job.JobID);
                }
            }
            catch (Exception ex)
            {
                throw new Exception("流程提交失败!" + ex.ToString());
            }
        }
Exemplo n.º 11
0
        public void ChangeFlow(Entity.JobInfo job)
        {
            DataTable handle = new HandleList().GetList("JobID='" + job.JobID + "'").Tables[0];

            Entity.FlowInfo flowNow = new FlowInfo().DataRowToModel(new FlowInfo().GetList("JobID='" + job.JobID + "' and IsDelete=0 order by SubmitDate desc").Tables[0].Rows[0]);
            DataAccess.TranHelper.BeginTran();
            bool IsChange = false;

            switch (flowNow.FlowID)
            {
            case 2:
                #region 当流程处于2(工单已受理)时
                //是否快递领取
                if ((bool)job.ExpressFlat)
                {
                    //是否财务确认、发票、快递
                    if (handle.Select("OpeartionID=8 and IsChecked=1").Length > 0 && handle.Select("OpeartionID=18 and IsChecked=1").Length > 0 && handle.Select("OpeartionID=10 and IsChecked=1").Length > 0)
                    {
                        //将流程从2修改为6
                        Entity.FlowInfo flow = new Entity.FlowInfo();
                        flow.Guid       = Guid.NewGuid().ToString();
                        flow.JobID      = job.JobID;
                        flow.FlowID     = 6;
                        flow.SubmitDate = DateTime.Now;
                        flow.SubmitUser = handle.Select("OpeartionID=10 and IsChecked=1")[0]["OpeartionUser"].ToString();
                        flow.Content    = handle.Select("OpeartionID=10 and IsChecked=1")[0]["Remark"].ToString();
                        flow.IsDelete   = false;
                        new FlowInfo().Add(flow);
                        CommodityOutList(flow.JobID, flow.SubmitUser, flow.Content);
                        IsChange = true;
                    }
                }
                else
                {
                    //是否财务确认、发票
                    if (handle.Select("OpeartionID=8 and IsChecked=1").Length > 0 && handle.Select("OpeartionID=18 and IsChecked=1").Length > 0)
                    {
                        //是否已现场领取
                        if (handle.Select("OpeartionID=9 and IsChecked=1").Length > 0)
                        {
                            //将流程从2修改为5
                            Entity.FlowInfo flow = new Entity.FlowInfo();
                            flow.Guid       = Guid.NewGuid().ToString();
                            flow.JobID      = job.JobID;
                            flow.FlowID     = 5;
                            flow.SubmitDate = DateTime.Now;
                            flow.SubmitUser = handle.Select("OpeartionID=9 and IsChecked=1")[0]["OpeartionUser"].ToString();
                            flow.Content    = handle.Select("OpeartionID=9 and IsChecked=1")[0]["Remark"].ToString();
                            flow.IsDelete   = false;
                            new FlowInfo().Add(flow);
                            CommodityOutList(flow.JobID, flow.SubmitUser, flow.Content);
                            IsChange = true;
                        }
                        else
                        {
                            //将流程从2修改为11
                            Entity.FlowInfo flow = new Entity.FlowInfo();
                            flow.Guid       = Guid.NewGuid().ToString();
                            flow.JobID      = job.JobID;
                            flow.FlowID     = 11;
                            flow.SubmitDate = DateTime.Now;
                            flow.SubmitUser = handle.Select("", "OpeartionTime desc")[0]["OpeartionUser"].ToString();
                            flow.IsDelete   = false;
                            new FlowInfo().Add(flow);
                            IsChange = true;
                        }
                    }
                }
                #endregion
                break;

            case 11:
                #region 当流程处于11(等待现场领取)时
                //是否已现场领取
                if (handle.Select("OpeartionID=9 and IsChecked=1").Length > 0)
                {
                    //将流程从11修改为5
                    Entity.FlowInfo flow = new Entity.FlowInfo();
                    flow.Guid       = Guid.NewGuid().ToString();
                    flow.JobID      = job.JobID;
                    flow.FlowID     = 5;
                    flow.SubmitDate = DateTime.Now;
                    flow.SubmitUser = handle.Select("OpeartionID=9 and IsChecked=1")[0]["OpeartionUser"].ToString();
                    flow.Content    = handle.Select("OpeartionID=9 and IsChecked=1")[0]["Remark"].ToString();
                    flow.IsDelete   = false;
                    new FlowInfo().Add(flow);
                    CommodityOutList(flow.JobID, flow.SubmitUser, flow.Content);
                    IsChange = true;
                }
                #endregion
                break;
            }
            try
            {
                DataAccess.TranHelper.CommitTran();
                if (IsChange)
                {
                    DataAccess.CardCenterHelper.SendMessage(job.JobID);
                }
            }
            catch (Exception ex)
            {
                throw new Exception("流程提交失败!" + ex.ToString());
            }
        }
Exemplo n.º 12
0
 public void ProcessRequest(HttpContext context)
 {
     try
     {
         context.Response.ContentType = "text/plain";
         string jobID                = context.Request.Form["jobID"];
         string jobType              = context.Request.Form["jobType"];
         string selectFlow           = context.Request.Form["selectFlow"];
         string content              = context.Request.Form["content"];
         DataAccess.RunProcedure run = new DataAccess.RunProcedure();
         string dbName               = run.GetListDbName(jobID);
         //生成受理回执
         #region 2016.4.21业务修改为提交工单后可下载回执,本段代码取消
         //if(selectFlow == "5")
         //{
         //    FileInfo file = new FileInfo(context.Server.MapPath("../ApprovalDemo/业务受理审批回执.jpg"));
         //    string fileName =  Guid.NewGuid().ToString() + ".jpg";
         //    file.CopyTo(ZWL.GeneralHelper.GetSettingByKey("CardPrintingApprovalPath") + fileName, true);
         //    CardPrinting.Entity.JobInfo job = new CardPrinting.DataAccess.JobInfo().GetModel(jobID);
         //    job.ApprovalFile = fileName;
         //    if (!new CardPrinting.DataAccess.JobInfo().Update(job))
         //    {
         //        context.Response.Write("生成业务受理审批回执失败!");
         //        return;
         //    }
         //}
         #endregion
         if (new DataAccess.StatusType().GetModel(int.Parse(selectFlow)).StatusName.Contains("已办结"))
         {
             if (!run.CanFinish(jobID, dbName))
             {
                 context.Response.Write("请先完成工单项处理,再标记工单流程为【已办结】!");
                 return;
             }
         }
         Entity.FlowInfo entity = new Entity.FlowInfo();
         entity.Guid       = Guid.NewGuid().ToString();
         entity.JobID      = jobID;
         entity.FlowID     = int.Parse(selectFlow);
         entity.SubmitDate = DateTime.Now;
         entity.SubmitUser = PageBase.CommonObject.ManagerUserInfo.guid;
         entity.Content    = content;
         entity.IsDelete   = false;
         entity.Remark     = "";
         DataAccess.TranHelper.BeginTran();
         new DataAccess.FlowInfo().Add(entity);
         try
         {
             DataAccess.TranHelper.CommitTran();
             context.Response.Write("提交成功");
         }
         catch (Exception ex)
         {
             context.Response.Write("提交失败" + ex.Message);
         }
     }
     catch (Exception ex)
     {
         context.Response.Write(ex.Message);
     }
 }