private void DoSelect()
        {
            if (op != "c" && op != "cs")
            {
                ent = ReceiveDocument.Find(id);
                sql = @"select * from FileItem where PatIndex('%'+Id+'%','{0}')>0 order by CreateTime desc";
                sql = string.Format(sql, ent.MainFile);
                PageState.Add("DataList", DataHelper.QueryDictList(sql));
                sql = @"select * from FileItem where PatIndex('%'+Id+'%','{0}')>0 order by CreateTime desc";
                sql = string.Format(sql, ent.Attachment);
                PageState.Add("DataList2", DataHelper.QueryDictList(sql));
                sql = @"select * from Task where PatIndex('%{0}%',EFormName)>0  and Status='4' and Ext1 is null order by FinishTime asc";
                sql = string.Format(sql, id);
                IList <EasyDictionary> taskDics = DataHelper.QueryDictList(sql);
                PageState.Add("Opinion", taskDics);
            }
            else
            {
                ent             = new ReceiveDocument();
                ent.ReceiveDate = System.DateTime.Now.Date;
            }
            SetFormData(ent);
            string taskId = RequestData.Get <string>("TaskId");

            if (!string.IsNullOrEmpty(taskId))
            {
                Task tEnt = Task.Find(taskId);
                if (tEnt.Status != 4 && !string.IsNullOrEmpty(tEnt.Description))
                {
                    PageState.Add("UnSubmitOpinion", tEnt.Description);
                }
            }
            PageState.Add("ReceiveType", SysEnumeration.GetEnumDict("ReceiveType"));
            PageState.Add("SecrecyDegree", SysEnumeration.GetEnumDict("SecrecyDegree"));
            sql = "select * from BJKY_IntegratedManage..BringUnit";
            PageState.Add("ImportanceDegree", SysEnumeration.GetEnumDict("ImportanceDegree"));
        }
Пример #2
0
        private void DoSelect()
        {
            if (string.IsNullOrEmpty(id))
            {
                var obj = new
                {
                    LaunchUserName = UserInfo.Name,
                    LaunchUserId   = UserInfo.UserID
                };
                SetFormData(obj);
            }
            else
            {
                ent = ExamineStage.Find(id);
                SetFormData(ent);
            }
            sql = @"select Id,GroupName from BJKY_Examine..PersonConfig 
                  where (ClerkIds like '%{0}%' or SecondLeaderIds like '%{0}%' or FirstLeaderIds like '%{0}%') and (GroupType='职能服务部门' or GroupType='经营目标单位')";
            sql = string.Format(sql, UserInfo.UserID);
            EasyDictionary dic1 = DataHelper.QueryDict(sql, "Id", "GroupName");

            PageState.Add("enumDept", dic1);
            PageState.Add("EnumYear", SysEnumeration.GetEnumDict("Year"));
        }
Пример #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string db = ConfigurationManager.AppSettings["ExamineDB"];

            op      = RequestData.Get <string>("op");
            id      = RequestData.Get <string>("id");
            paid    = RequestData.Get <string>("paid");
            PAState = RequestData.Get <string>("PAState");
            type    = RequestData.Get <string>("type");

            SaleOrder      ent     = null;
            IList <string> strList = RequestData.GetList <string>("data");

            switch (this.RequestAction)
            {
            case RequestActionEnum.Update:
                ent = this.GetMergedData <SaleOrder>();
                if (PAState == "Yes")
                {
                    ent.PAState  = "待审核";
                    ent.PANumber = DataHelper.QueryValue("select " + db + ".dbo.fun_getPriceAppNumber()") + "";
                }
                else
                {
                    ent.PAState  = "";
                    ent.PANumber = "";
                }

                ent.DoUpdate();

                //处理OrdersPart表
                //删除
                OrdersPart.DeleteAll("OId='" + ent.Id + "'");
                //添加
                InsertProPart(ent, strList);

                //创建价格申请单
                if (PAState == "Yes")
                {
                    CreatePriceApply(ent);
                }

                #region  除出库单表并更新销售单状态

                if (RequestData.Get <string>("del") == "yes")
                {
                    DeliveryOrder[] dorders = DeliveryOrder.FindAllByProperty("PId", ent.Id);
                    foreach (DeliveryOrder dorder in dorders)
                    {
                        DelieryOrderPart.DeleteAll("DId='" + dorder.Id + "'");
                        DeliveryOrder.DeleteAll("Id='" + dorder.Id + "'");
                    }

                    //更新出库单状态
                    OrdersPart[] ops = OrdersPart.FindAllByProperty("OId", ent.Id);
                    foreach (OrdersPart opt in ops)
                    {
                        if (opt != null)
                        {
                            opt.OutCount = 0;
                            opt.DoSave();
                        }
                    }

                    //更新order的json
                    string jsons = "";
                    ops = OrdersPart.FindAllByProperty("OId", ent.Id);
                    foreach (OrdersPart opt in ops)
                    {
                        jsons += "{";
                        jsons += "Id:'" + opt.PId + "',";
                        jsons += "Isbn:'" + opt.Isbn + "',";
                        jsons += "Code:'" + opt.PCode + "',";
                        jsons += "Name:'" + opt.PName + "',";
                        jsons += "Unit:'" + opt.Unit + "',";
                        jsons += "MinSalePrice:'" + opt.MinSalePrice + "',";
                        jsons += "Price:'" + opt.SalePrice + "',";
                        jsons += "Amount:'" + opt.Amount + "',";
                        jsons += "Count:'" + opt.Count + "',";
                        jsons += "OutCount:'" + opt.OutCount + "',";
                        jsons += "Remark:'" + opt.Remark + "'";
                        jsons += "},";
                    }

                    string count = DataHelper.QueryValue("select count(1) from " + db + "..OrdersPart where OId='" + ent.Id + "' and OutCount=[Count]") + "";
                    if (count == "0")
                    {
                        ent.DeliveryState = "";
                    }
                    else
                    {
                        ent.DeliveryState = "部分生成出库单";
                    }

                    ent.Child = "[" + jsons.Substring(0, jsons.Length - 1) + "]";
                    ent.DoUpdate();
                }
                #endregion

                this.SetMessage("修改成功!");
                break;

            case RequestActionEnum.Insert:
            case RequestActionEnum.Create:
                ent = this.GetPostedData <SaleOrder>();
                if (PAState == "Yes")
                {
                    ent.PAState  = "待审核";
                    ent.PANumber = DataHelper.QueryValue("select " + db + ".dbo.fun_getPriceAppNumber()") + "";
                }
                ent.PId = paid;

                //自动生成流水号
                ent.Number = DataHelper.QueryValue("select " + db + ".dbo.fun_getOrderNumber()") + "";

                ent.DoCreate();

                //处理OrdersPart表
                //添加

                InsertProPart(ent, strList);

                //创建价格申请单
                if (PAState == "Yes")
                {
                    CreatePriceApply(ent);
                }

                this.SetMessage("新建成功!");
                break;

            case RequestActionEnum.Delete:
                ent = this.GetTargetData <SaleOrder>();
                ent.DoDelete();
                this.SetMessage("删除成功!");
                return;

            default:
                if (RequestActionString == "submitfinish")
                {
                    SaleOrder pc = SaleOrder.Find(this.RequestData.Get <string>("id"));
                    pc.State         = "End";
                    pc.DeliveryState = "已生成出库单";
                    pc.ApprovalState = this.RequestData.Get <string>("ApprovalState");
                    pc.Save();

                    //自动生成发货单
                    if (pc.ApprovalState == "同意")
                    {
                        DeliveryOrder dor = new DeliveryOrder
                        {
                            Child         = pc.Child,
                            CId           = pc.Id,
                            WarehouseId   = pc.WarehouseId,
                            WarehouseName = pc.WarehouseName,
                            CName         = pc.CName,
                            CreateId      = UserInfo.UserID,
                            CreateName    = UserInfo.Name,
                            CreateTime    = DateTime.Now,
                            ExpectedTime  = pc.ExpectedTime,
                            Number        = DateTime.Now.ToString("yyyyMMddHHmmss")
                        };
                        dor.DoCreate();
                    }
                }
                else if (RequestActionString == "inputexcel")
                {
                    string path  = @"D:\RW\Files\AppFiles\Portal\Default\" + RequestData.Get <string>("path");
                    string strcn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + path + ";Extended Properties='Excel 8.0;HDR=Yes;IMEX=1';";    //连接字符串

                    #region 遍历整个excel
                    //DataSet ds = GetDataFromExcel(path);

                    ////遍历DataSet取数据

                    ////清除无效行
                    //ds.Tables[0].Rows.RemoveAt(0);
                    //ds.Tables[0].Rows.RemoveAt(0);
                    //ds.Tables[0].Rows.RemoveAt(0);
                    //PageState.Add("error", "Tables:" + ds.Tables.Count + " Table[0]:" + ds.Tables[0].Select("F4 <> ''").Length + "数量" + ds.Tables[0].Rows[0][3]);

                    //return;
                    #endregion

                    #region old
                    try
                    {
                        string           sql  = "select * from [Sheet1$]";
                        OleDbDataAdapter oldr = new OleDbDataAdapter(sql, strcn);    //读取数据,并填充到DATASET里
                        DataTable        dt   = new DataTable();
                        oldr.Fill(dt);

                        if (dt.Rows.Count > 0)
                        {
                            string strjson = RequestData.Get <string>("json").Replace("[]", "");
                            if (strjson.Length > 0)
                            {
                                strjson = strjson.Substring(1, strjson.Length - 2) + ",";
                            }
                            DataRow row = null;
                            for (int i = 0; i < dt.Rows.Count; i++)
                            {
                                row = dt.Rows[i];

                                strjson += "{";
                                strjson += "Id:'" + row["Id"] + "',";
                                strjson += "Isbn:'" + row["Isbn"] + "',";
                                strjson += "Code:'" + row["Code"] + "',";
                                strjson += "Name:'" + row["Name"] + "',";
                                strjson += "Unit:'" + row["Unit"] + "',";
                                strjson += "MinSalePrice:'" + row["MinSalePrice"] + "',";
                                strjson += "Price:'" + row["MinSalePrice"] + "',";
                                strjson += "Amount:'" + row["Amount"] + "',";
                                strjson += "Count:'" + row["Count"] + "',";
                                strjson += "Remark:'" + row["Remark"] + "'";
                                strjson += "},";
                            }
                            if (strjson != "")
                            {
                                strjson = "[" + strjson.Substring(0, strjson.Length - 1) + "]";
                                PageState.Add("result", strjson);
                            }
                        }
                        return;
                    }
                    catch (Exception ex)
                    {
                        PageState.Add("error", ex.Message);
                        return;
                    }
                    #endregion
                }
                else if (RequestActionString == "updateAmount")
                {
                    SaleOrder o          = SaleOrder.TryFind(id);
                    string    TotalMoney = RequestData.Get <string>("TotalMoney");
                    o.DiscountAmount = RequestData.Get <decimal>("DiscountAmount");
                    o.TotalMoney     = Convert.ToDecimal(TotalMoney);
                    o.DoUpdate();
                }
                break;
            }

            if (RequestActionString == "getSalesman")
            {
                string   cid      = RequestData.Get <string>("CId");
                Customer customer = Customer.Find(cid);
                if (customer != null)
                {
                    PageState.Add("Code", customer.Code);
                    PageState.Add("SaleUser", customer.MagUser);
                    PageState.Add("SaleUserId", customer.MagId);
                }
            }
            else if (op == "c" && !string.IsNullOrEmpty(paid))
            {
                if (!string.IsNullOrEmpty(paid))
                {
                    PriceApply paent = PriceApply.TryFind(paid);
                    if (paent != null)
                    {
                        paent.Reason        = "";
                        paent.ApprovalState = "";
                        paent.ExpectedTime  = null;
                        paent.Id            = "";
                        paent.Number        = "";
                        paent.Remark        = "";
                        paent.State         = "";
                        this.SetFormData(paent);
                    }
                }
            }
            else if (op != "c" && op != "cs")
            {
                if (!String.IsNullOrEmpty(id))
                {
                    ent = SaleOrder.Find(id);
                }

                this.SetFormData(ent);
                this.PageState.Add("State", ent.State);

                //查询子商品
                string sql = "select Id, PId, PCode as Code, PName as Name, Isbn, Count, Unit, MinSalePrice, SalePrice as Price, Amount,CustomerOrderNo, Remark, OutCount,BillingCount from " + db + "..OrdersPart where OId='" + id + "'";
                PageState.Add("DetailList", DataHelper.QueryDictList(sql));
            }

            this.PageState.Add("FlowEnum", SysEnumeration.GetEnumDictList("WorkFlow.Simple"));

            PageState.Add("InvoiceType", SysEnumeration.GetEnumDict("InvoiceType"));
            PageState.Add("DeliveryMode", SysEnumeration.GetEnumDict("DeliveryMode"));
            PageState.Add("PayType", SysEnumeration.GetEnumDict("PayType"));
            PageState.Add("CalculateManner", SysEnumeration.GetEnumDict("CalculateManner"));
        }
Пример #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                Aim.Portal.Web.WebPortalService.CheckLogon();
            }
            catch
            {
                Response.Write("<script> window.parent.location.href = '/Login.aspx';</script>");
                Response.End();
            }
            string action = Request["action"];

            json = Request["json"];
            switch (action)
            {
            case "select":
                Select();
                break;

            case "delete":
                Delete();
                break;

            case "update":
                Ent = JsonHelper.GetObject <SysEnumeration>(json);
                SysEnumeration originalEnt = SysEnumeration.Find(Ent.EnumerationID);
                EasyDictionary dic         = JsonHelper.GetObject <EasyDictionary>(json);
                originalEnt       = DataHelper.MergeData <SysEnumeration>(originalEnt, Ent, dic.Keys);
                originalEnt.Value = originalEnt.Name;
                originalEnt.DoUpdate();
                break;

            case "create":
                Ent = JsonHelper.GetObject <SysEnumeration>(json);
                SysEnumeration EntParent = SysEnumeration.Find(Ent.ParentID);
                Ent.Value  = Ent.Name;
                Ent.IsLeaf = true;
                if (string.IsNullOrEmpty(EntParent.Path))
                {
                    Ent.Path = EntParent.EnumerationID;
                }
                else
                {
                    Ent.Path = EntParent.Path + "." + EntParent.EnumerationID;
                }
                Ent.PathLevel   = EntParent.PathLevel + 1;
                Ent.CreaterID   = WebPortalService.CurrentUserInfo.UserID;
                Ent.CreaterName = WebPortalService.CurrentUserInfo.Name;
                Ent.DoCreate();
                //------------------------
                if (Convert.ToInt32(EntParent.IsLeaf) == 1)
                {
                    EntParent.IsLeaf = false;
                    EntParent.Update();
                }
                break;

            case "loadform":
                string EnumerationID = Request["EnumerationID"];
                json = JsonHelper.GetJsonString(SysEnumeration.Find(EnumerationID));
                Response.Write("{success:true,data:" + json + "}");
                Response.End();
                break;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                Aim.Portal.Web.WebPortalService.CheckLogon();
            }
            catch
            {
                Response.Write("<script> window.parent.location.href = '/Login.aspx';</script>");
                Response.End();
            }
            string     action    = Request["action"];
            string     groupid   = Request["groupid"];
            string     projectId = Request["projectid"];
            FileFolder ffEnt     = null;
            Project    pEnt      = null;

            switch (action)
            {
            case "upload":
                //如果是项目文档  上传项目编号文件夹 如果是部门文档上传到DEFAULT文件夹
                if (!string.IsNullOrEmpty(projectId))
                {
                    pEnt = Project.Find(projectId);
                    IList <FileFolder> ffEnts = FileFolder.FindAllByProperty(FileFolder.Prop_FolderKey, pEnt.ProjectCode);
                    if (ffEnts.Count == 0)
                    {
                        ffEnt            = new FileFolder();
                        ffEnt.Name       = pEnt.ProjectCode;
                        ffEnt.FolderKey  = pEnt.ProjectCode;
                        ffEnt.Path       = pEnt.ProjectCode;
                        ffEnt.ParentId   = "1";
                        ffEnt.CreateTime = DateTime.Now;
                        ffEnt.ModuleId   = "1";
                        ffEnt.DoCreate();
                        ffEnt.FullId = "1." + ffEnt.Id;
                        ffEnt.DoUpdate();
                    }
                    else
                    {
                        ffEnt = ffEnts[0];
                    }
                    if (!Directory.Exists(@"D:\RW\Files\AppFiles\Portal\" + pEnt.ProjectCode))
                    {
                        Directory.CreateDirectory(@"D:\RW\Files\AppFiles\Portal\" + pEnt.ProjectCode);
                    }
                }
                else
                {
                    ffEnt = FileFolder.Find("1");    //如果是非项目文档,上传到默认文件夹
                }
                string   formdata = Request["formdata"];
                JObject  json     = Aim.JsonHelper.GetObject <JObject>(formdata);
                FileItem fiEnt    = new FileItem();
                fiEnt.GroupId      = groupid;
                fiEnt.ProjectId    = projectId;
                fiEnt.FirstTypeId  = json.Value <string>("FirstTypeId");
                fiEnt.SecondTypeId = json.Value <string>("SecondTypeId");
                HttpPostedFile postedFile = Request.Files["projectfile"];    //获取上传信息对象
                string         fileName   = Path.GetFileName(postedFile.FileName);
                fiEnt.Name        = fileName;
                fiEnt.FolderId    = ffEnt.Id;
                fiEnt.CreatorId   = Aim.Portal.Web.WebPortalService.CurrentUserInfo.UserID;
                fiEnt.CreatorName = Aim.Portal.Web.WebPortalService.CurrentUserInfo.Name;
                fiEnt.CreateTime  = DateTime.Now;
                fiEnt.DoCreate();
                // string filename = postedFile.FileName;//获取上传的文件路径
                // string tempPath = System.Configuration.ConfigurationManager.AppSettings["NewsFolderPath"];//获取保存文件夹路径,我是设置在webconfig中了。
                // string savepath = Server.MapPath(@"D:\RW\Files\AppFiles\Portal\" + pEnt.ProjectCode + "\\");//获取保存路径
                // string sExtension = filename.Substring(filename.LastIndexOf('.'));//获取拓展名
                //if (!Directory.Exists(savepath))
                //Directory.CreateDirectory(savepath);
                //string sNewFileName = DateTime.Now.ToString("yyyyMMddhhmmsfff"); + fiEnt.Id + "_"" + seEnt.IsLeaf + "
                postedFile.SaveAs(@"D:\RW\Files\AppFiles\Portal\" + ffEnt.Path + @"/" + fiEnt.Id + "_" + fileName);    //保存
                Response.Write("{success:true}");
                Response.End();
                break;

            case "loadfiletype":
                string id = Request["id"];
                if (string.IsNullOrEmpty(id))
                {
                    id = "cf38bd7a-79d1-46fb-bf06-640b30f61654";
                }
                IList <SysEnumeration> seEnts = SysEnumeration.FindAllByProperty("SortIndex", SysEnumeration.Prop_ParentID, id);
                int    i      = 0;
                string result = "[";
                foreach (SysEnumeration seEnt in seEnts)
                {
                    if (i != seEnts.Count - 1)
                    {
                        result += "{'id':'" + seEnt.EnumerationID + "','text':'" + seEnt.Name + "','leaf':" + (seEnt.IsLeaf.Value ? "true" : "false") + ",'parentid':'" + seEnt.ParentID + "'},";
                    }
                    else
                    {
                        result += "{'id':'" + seEnt.EnumerationID + "','text':'" + seEnt.Name + "','leaf':" + (seEnt.IsLeaf.Value ? "true" : "false") + ",'parentid':'" + seEnt.ParentID + "'}";
                    }
                    i++;
                }
                result += "]";
                Response.Write(result);
                Response.End();
                break;

            case "getprojectname":
                string temp = "{";
                if (!string.IsNullOrEmpty(projectId))
                {
                    pEnt  = Project.Find(projectId);
                    temp += "ProjectName:'" + pEnt.ProjectName + "'";
                }
                if (!string.IsNullOrEmpty(groupid))
                {
                    SysGroup sgEnt = SysGroup.Find(groupid);
                    temp += (temp.Length > 1 ? ",GroupName:'" : "GroupName:'") + sgEnt.Name + "'";
                }
                Response.Write(temp + "}");
                Response.End();
                break;
            }
        }
Пример #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            op     = RequestData.Get <string>("op");
            typeId = RequestData.Get <string>("TypeId", String.Empty);
            switch (RequestActionString)
            {
            case "batchdelete":
                IList <object> idList = RequestData.GetList <object>("IdList");
                if (idList != null && idList.Count > 0)
                {
                    NewsRule.BatchRemoveByPrimaryKeys(idList);
                    foreach (object obj in idList)
                    {
                        ImgNewDetail.DeleteAll(" PId='" + obj + "' ");
                        VideoNewDetail.DeleteAll(" PId='" + obj + "' ");

                        string delsql = "delete WorkflowInstance where RelateId='" + obj + "' delete Task where EFormName like '%" + obj + "%'";
                        DataHelper.ExecSql(delsql);
                    }
                    ImgNews.DoBatchDelete(idList.ToArray());
                    VideoNews.DoBatchDelete(idList.ToArray());
                }
                break;

            case "submitnews":
                object news     = null;
                string NewsType = RequestData.Get <string>("NewsType");
                if (NewsType == "视频")
                {
                    ne       = VideoNews.Find(this.RequestData["Id"].ToString());
                    ne.State = this.RequestData["state"].ToString();
                    ne.Save();
                    news = ne;
                }
                else if (NewsType == "图片")
                {
                    imgnew       = ImgNews.Find(this.RequestData["Id"].ToString());
                    imgnew.State = this.RequestData["state"].ToString();
                    imgnew.Save();
                    news = imgnew;
                }
                else
                {
                    ent       = News.Find(this.RequestData["Id"].ToString());
                    ent.State = this.RequestData["state"].ToString();
                    ent.Save();
                    news = ent;
                }

                if (this.RequestData["state"].ToString() == "1")
                {
                    PageState.Add("message", "提交成功");
                }
                else
                {
                    string nid = "";
                    if (news is News)
                    {
                        ent          = news as News;
                        ent.WFState  = "";
                        ent.WFResult = "";
                        ent.Update();
                        nid = ent.Id;
                    }
                    else if (news is ImgNews)
                    {
                        ImgNews imgent = news as ImgNews;
                        imgent.WFState  = "";
                        imgent.WFResult = "";
                        imgent.Update();
                        nid = imgent.Id;
                    }
                    else if (news is VideoNews)
                    {
                        VideoNews videoent = news as VideoNews;
                        videoent.WFState  = "";
                        videoent.WFResult = "";
                        videoent.Update();
                        nid = videoent.Id;
                    }

                    string delsql = "delete WorkflowInstance where RelateId='" + nid + "' delete Task where EFormName like '%" + nid + "%'";
                    DataHelper.ExecSql(delsql);
                    PageState.Add("message", "收回成功");
                }
                break;

            case "submit":
                StartFlow(RequestData.Get <string>("id"));
                break;

            case "autoexecute":
                Task[] tasks = Task.FindAllByProperties(Task.Prop_WorkflowInstanceID, this.RequestData.Get <string>("FlowId"));
                if (tasks.Length == 0)
                {
                    System.Threading.Thread.Sleep(1000);
                    tasks = Task.FindAllByProperties(Task.Prop_WorkflowInstanceID, this.RequestData.Get <string>("FlowId"));
                }
                if (tasks.Length > 0)
                {
                    this.PageState.Add("TaskId", tasks[0].ID);
                    string AuditUserId   = RequestData.Get <string>("AuditUserId");
                    string AuditUserName = RequestData.Get <string>("AuditUserName");

                    if (!string.IsNullOrEmpty(AuditUserId))
                    {
                        Aim.WorkFlow.WorkFlow.AutoExecute(tasks[0], new string[] { AuditUserId, AuditUserName });
                    }
                    else
                    {
                        PageState.Add("error", "自动提交申请人失败,请手动提交");
                    }
                }
                else
                {
                    PageState.Add("error", "自动提交申请人失败,请手动提交");
                }
                break;

            case "CancelFlow":
                string id  = RequestData.Get <string>("id");
                string NId = "";
                ent = News.TryFind(id);
                if (ent != null)
                {
                    NId = ent.Id;
                }
                else
                {
                    imgnew = ImgNews.TryFind(id);
                    if (imgnew != null)
                    {
                        NId = imgnew.Id;
                    }
                }
                if (DataHelper.QueryDataTable("Select Id from Task where EFormName like '%" + NId + "%' and OwnerId='" + this.UserInfo.UserID + "' and Status=0 ").Rows.Count == 0)
                {
                    PageState.Add("error", "单据未打回给您或未启动流程,不能作废!");
                }
                else
                {
                    if (ent != null)
                    {
                        ent.WFState  = "";
                        ent.WFResult = "已撤销";
                        ent.Update();
                    }
                    else if (imgnew != null)
                    {
                        imgnew.WFState  = "";
                        imgnew.WFResult = "已撤销";
                        imgnew.Update();
                    }
                    string delsql = "delete WorkflowInstance where RelateId='" + NId + "' delete Task where EFormName like '%" + NId + "%'";
                    DataHelper.ExecSql(delsql);
                }
                break;

            default:
                PageState.Add("WorkFlowState", SysEnumeration.GetEnumDict("WorkFlowState"));
                if (op == "r")
                {
                    string path = DataHelper.QueryValue("select g.Path from SysGroup g inner join sysusergroup ug on ug.GroupId=g.GroupId where UserId='" + UserInfo.UserID + "'") + "";
                    string sql  = @"select n.Id, n.TypeId, n.BelongDeptId, n.Title, n.KeyWord, n.Content, n.ContentType, n.AuthorName, n.PostUserId, n.PostUserName, n.PostDeptId, n.PostDeptName, n.ReceiveDeptId, n.ReceiveDeptName, n.ReceiveUserId, n.ReceiveUserName, n.PostTime, n.ExpireTime, n.SaveTime, n.Pictures, n.Attachments, n.MHT, n.State, n.ImportantGrade, n.ReadCount, n.HomePagePopup, n.LinkPortalImage, n.Class, n.PopupIds, n.Grade, n.AuthorId, n.CreateTime, n.CreateId, n.CreateName, n.Type, n.ReleaseState, n.PId, n.SubmitState, n.NewType, n.ReadState, n.RemindDays, n.RdoType, n.FileType, n.MhtFile from News n 
                                    inner join NewsType nt on nt.Id=n.TypeId
                                    where TypeId='{2}' 
                                    and State='2' and isnull(ExpireTime,'2099-01-01')>=getdate()
                                    and (charindex('{0}',n.ReceiveUserId)>0 or charindex('{0}',n.AuthorId)>0 or charindex('{0}',nt.AllowQueryId)>0 or 
                                    exists (select Id from Competence c where c.Ext1=n.Id and charindex(PId,'{1}')>0)
                                    or exists (select Id from Competence c where c.Ext1=nt.Id and charindex(PId,'{1}')>0)) {3}";
                    //合并老系统的新闻和公告
                    if (typeId == "fa67b910-a692-4df7-83a2-50711ba4bfa5" || typeId == "eb9db227-6adc-4dd1-8783-467aadc2d11b")
                    {
                        if (typeId == "fa67b910-a692-4df7-83a2-50711ba4bfa5")
                        {
                            sql += @" union all select [Id],'fa67b910-a692-4df7-83a2-50711ba4bfa5' [CatalogId],[BelongDeptId],[Title],[KeyWord],[Content],[ContentType]
                                 ,[AuthorName],[PostUserId],[PostUserName],[PostDeptId],[PostDeptName]
                                 ,[ReceiveDeptId],[ReceiveDeptName],[ReceiveUserId],[ReceiveUserName]
                                 ,[PostTime],[ExpireTime],[SaveTime],[Pictures],[Attachments],[MHT]
                                 ,2,[ImportantGrade],[ReadCount],[HomePagePopup],[LinkPortalImage],
                                 '' s,[PopupIds],[Grade],'' authorid,null createtime,null createid,null t,class,null a,null b,null c,null d,null e,null f,null g,null h,null i from BJKY_BeOfficeAuto..PublicInformation WHERE CatalogId = 'OPIC0020' and state=1 {3}";
                        }
                        else
                        {
                            sql += @" union all select [Id],'eb9db227-6adc-4dd1-8783-467aadc2d11b' [CatalogId],[BelongDeptId],[Title],[KeyWord],[Content],[ContentType]
                              ,[AuthorName],[PostUserId],[PostUserName],[PostDeptId],[PostDeptName]
                              ,[ReceiveDeptId],[ReceiveDeptName],[ReceiveUserId],[ReceiveUserName]
                              ,[PostTime],[ExpireTime],[SaveTime],[Pictures],[Attachments],[MHT]
                              ,2,[ImportantGrade],[ReadCount],[HomePagePopup],[LinkPortalImage],
                              '' s,[PopupIds],[Grade],'' authorid,null createtime,null createid,null t,class,null a,null b,null c,null d,null e,null f,null g,null h,null i from BJKY_BeOfficeAuto..PublicInformation WHERE CatalogId = 'OPIC0021' and state=1 {3}";
                        }
                    }
                    string where = "";
                    foreach (CommonSearchCriterionItem item in SearchCriterion.Searches.Searches)
                    {
                        if (item.Value + "" != "")
                        {
                            where += " and " + item.PropertyName + " like '%" + item.Value + "%' ";
                        }
                    }
                    sql = string.Format(sql, UserInfo.UserID, path, typeId, where);
                    PageState.Add("SysUserList", GetPageData(sql, SearchCriterion));
                }
                else
                {
                    string where = " and isnull(ExpireTime,'2099-01-01')>=getdate() ";
                    if (RequestData.Get <string>("Expire") == "true")
                    {
                        where = " and isnull(ExpireTime,'2099-01-01')<getdate() ";
                    }
                    foreach (CommonSearchCriterionItem item in SearchCriterion.Searches.Searches)
                    {
                        if (item.Value + "" != "")
                        {
                            where += " and " + item.PropertyName + " like '%" + item.Value + "%' ";
                        }
                    }
                    if (!string.IsNullOrEmpty(typeId))
                    {
                        SearchCriterion.SetSearch("TypeId", typeId);
                        News[] ents = NewsRule.FindAll(SearchCriterion, Expression.Sql(" AuthorId = '" + UserInfo.UserID + "' " + where)).OrderByDescending(o => o.SaveTime).ToArray();
                        this.PageState.Add("SysUserList", ents);
                    }    //图片新闻、视频新闻 不需要过滤(不同的页面)
                    else
                    {
                        string sql = @"select * from (select Id, TypeId, Title, AuthorId, AuthorName, PostDeptId,ReadCount, PostDeptName, PostTime, ExpireTime, SaveTime, [State],'普通' as NewsType, AuditUserId, AuditUserName, WFState, WFResult,
                            (select top 1 ApprovalNodeName from task where [Status]='0' and EFormName like '%'+News.Id+'%') as WFCurrentNode from News
                             union all 
                            select Id, TypeId, Title, CreateId,CreateName, PostDeptId,Ext1, PostDeptName, PostTime, ExpireTime, CreateTime, [State],'图片', AuditUserId, AuditUserName, WFState, WFResult,
                            (select top 1 ApprovalNodeName from task where [Status]='0' and EFormName like '%'+ImgNews.Id+'%') as WFCurrentNode from ImgNews
                            union all 
                            select Id, TypeId, Title, CreateId,CreateName, PostDeptId,Ext1, PostDeptName, PostTime, ExpireTime, CreateTime, [State],'视频', AuditUserId, AuditUserName, WFState, WFResult,
                           (select top 1 ApprovalNodeName from task where [Status]='0' and EFormName like '%'+VideoNews.Id+'%') as WFCurrentNode from VideoNews) t ";
                        this.PageState.Add("SysUserList", GetPageData(sql + " where AuthorId = '" + UserInfo.UserID + "' " + where, SearchCriterion));
                    }
                }
                break;
            }
            if (!IsAsyncRequest)
            {
                NewsType[] types = NewsType.FindAll();
                Dictionary <string, string> dt = new Dictionary <string, string>();
                foreach (NewsType type in types)
                {
                    dt.Add(type.Id, type.TypeName);
                }
                PageState.Add("EnumType", dt);
            }
        }
Пример #7
0
 //学历枚举
 private void GetEduEnum()
 {
     this.PageState.Add("MajorEnum", SysEnumeration.GetEnumDict("EduMajor"));
 }
Пример #8
0
        string type  = String.Empty; // 对象类型

        #endregion

        #region ASP.NET 事件

        protected void Page_Load(object sender, EventArgs e)
        {
            string db = ConfigurationManager.AppSettings["ExamineDB"];

            op    = RequestData.Get <string>("op");
            id    = RequestData.Get <string>("id");
            paids = RequestData.Get <string>("paids");
            type  = RequestData.Get <string>("type");

            DeliveryOrder  ent     = null;
            IList <string> strList = RequestData.GetList <string>("data");

            PageState.Add("Id", "");

            switch (this.RequestAction)
            {
            case RequestActionEnum.Insert:
            case RequestActionEnum.Create:
                ent     = this.GetPostedData <DeliveryOrder>();
                ent.PId = paids;

                //自动生成流水号
                ent.Number = DataHelper.QueryValue("select " + db + ".dbo.fun_getDeliveryNumber()") + "";

                ent.DoCreate();

                //更新销售单状态(放到保存的地方)
                if (!string.IsNullOrEmpty(paids))
                {
                    GetDeliveryState(strList, paids);
                }

                //添加出库商品信息
                InsertPart(strList, ent.Id);

                PageState["Id"] = ent.Id;
                this.SetMessage("新建成功!");
                break;

            default:
                break;
            }

            if (RequestActionString == "getSalesman")
            {
                string   cid      = RequestData.Get <string>("CId");
                Customer customer = Customer.Find(cid);
                if (customer != null)
                {
                    PageState.Add("result", customer.MagUser);
                    PageState.Add("MagId", customer.MagId);
                    PageState.Add("Address", customer.Address);
                    // PageState.Add("Tel", customer.Tel);
                    PageState.Add("Code", customer.Code);
                }
            }
            else if (RequestActionString == "checkdata")
            {
                string productIds  = RequestData.Get <string>("productIds");
                string WarehouseId = RequestData.Get <string>("WarehouseId");
                if (!string.IsNullOrEmpty(productIds))
                {
                    int count = DataHelper.QueryValue <int>("select count(1) from " + db + "..StockInfo where WarehouseId='" + WarehouseId + "' and ProductId in ('" + productIds.Replace(",", "','") + "')");
                    if (count != productIds.Split(',').Length)
                    {
                        PageState.Add("error", "所选商品在指定仓库里没有找到,请重新选择");
                    }
                }
            }
            //销售订单生成销售出库单
            else if (op == "c" && !string.IsNullOrEmpty(paids))
            {
                string[]    oids = paids.Split(',');
                SaleOrder[] ents = SaleOrder.FindAllByPrimaryKeys(oids);

                if (ents.Length > 0)
                {
                    ents[0].Id     = "";
                    ents[0].Number = "自动生成";
                    //ents[0].Remark = "";
                    ents[0].State = "";
                    ents[0].Child = "[]";
                    this.SetFormData(ents[0]);
                }
            }
            else if (op != "c" && op != "cs")
            {
                if (!String.IsNullOrEmpty(id))
                {
                    ent = DeliveryOrder.Find(id);
                }

                this.SetFormData(ent);
                this.PageState.Add("State", ent.State);
            }
            PageState.Add("DeliveryMode", SysEnumeration.GetEnumDict("DeliveryMode"));
        }
Пример #9
0
        string type = String.Empty; // 对象类型

        #endregion

        #region ASP.NET 事件

        protected void Page_Load(object sender, EventArgs e)
        {
            op   = RequestData.Get <string>("op");
            id   = RequestData.Get <string>("id");
            type = RequestData.Get <string>("type");

            SysEnumeration ent = null;

            switch (this.RequestAction)
            {
            case RequestActionEnum.Update:
                ent = this.GetMergedData <SysEnumeration>();
                ent.Update();
                this.SetMessage("修改成功!");
                break;

            case RequestActionEnum.Create:
                ent = this.GetPostedData <SysEnumeration>();

                ent.CreaterID   = UserInfo.UserID;
                ent.CreaterName = UserInfo.Name;

                if (String.IsNullOrEmpty(id))
                {
                    ent.CreateAsRoot();
                }
                else
                {
                    ent.CreateAsSibling(id);
                }

                this.SetMessage("新建成功!");
                break;

            default:
                if (RequestActionString == "createsub")
                {
                    ent             = this.GetPostedData <SysEnumeration>();
                    ent.CreaterID   = UserInfo.UserID;
                    ent.CreaterName = UserInfo.Name;

                    ent.CreateAsChild(id);

                    this.SetMessage("新建成功!");
                }
                break;
            }

            if (op != "c" && op != "cs")
            {
                if (!String.IsNullOrEmpty(id))
                {
                    ent = SysEnumeration.Find(id);
                }

                this.SetFormData(ent);
            }
            else
            {
                PageState.Add("CreaterName", UserInfo.Name);
                PageState.Add("CreatedDate", DateTime.Now);
            }
        }
Пример #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                Aim.Portal.Web.WebPortalService.CheckLogon();
            }
            catch
            {
                Response.Write("<script> window.parent.location.href = '/Login.aspx';</script>");
                Response.End();
            }
            action   = Request["action"];
            EnumID   = Request["id"];
            ParentID = Request["ParentID"];
            switch (action)
            {
            case "select":
                if (!string.IsNullOrEmpty(EnumID))
                {
                    IList <SysEnumeration> seEnts = SysEnumeration.FindAllByProperty(SysEnumeration.Prop_SortIndex, SysEnumeration.Prop_ParentID, EnumID);
                    string result   = "[";
                    int    i        = 0;
                    string checkstr = "";
                    foreach (SysEnumeration seEnt in seEnts)
                    {
                        checkstr = seEnt.IsLeaf.Value == true ? "checked:false," : "";
                        if (i != seEnts.Count - 1)
                        {
                            result += "{id:'" + seEnt.EnumerationID + "',Name:'" + seEnt.Name + "'," + checkstr + "Value:'" + seEnt.Value + "',ParentID:'" + seEnt.ParentID + "',leaf:" + (seEnt.IsLeaf.Value ? "true" : "false") + "},";
                        }
                        else
                        {
                            result += "{id:'" + seEnt.EnumerationID + "',Name:'" + seEnt.Name + "'," + checkstr + "Value:'" + seEnt.Value + "',ParentID:'" + seEnt.ParentID + "',leaf:" + (seEnt.IsLeaf.Value ? "true" : "false") + "}";
                        }
                        i++; checkstr = "";
                    }
                    result += "]";
                    Response.Write(result);
                    Response.End();
                }
                break;

            case "delete":
                SysEnumeration ent_sysenumeration = SysEnumeration.Find(EnumID);
                SysEnumeration ent_parent         = SysEnumeration.Find(ent_sysenumeration.ParentID);
                ent_sysenumeration.DoDelete();
                IList <SysEnumeration> ents_sysenumeration = SysEnumeration.FindAllByProperty(SysEnumeration.Prop_ParentID, ent_parent.EnumerationID);
                if (ents_sysenumeration.Count == 0)
                {
                    ent_parent.IsLeaf = true;
                    ent_parent.DoUpdate();
                }
                break;

            case "inigrid":
                string     typeids = Request["typeids"];
                DataTable  dt      = new DataTable();
                DataColumn dc      = new DataColumn("Id");
                dt.Columns.Add(dc);
                dc = new DataColumn("ProjectName");
                dt.Columns.Add(dc);
                sql = "select EnumerationID Id,Name,PatIndex('%'+EnumerationID+'%','" + typeids + "') as SortIndex from SysEnumeration where '" + typeids + "' like  '%'+EnumerationID+'%' order by SortIndex asc";
                DataTable dt_enum = DataHelper.QueryDataTable(sql);
                foreach (DataRow dr_enum in dt_enum.Rows)
                {
                    dc = new DataColumn(dr_enum["Id"].ToString() + dr_enum["Name"]);
                    dt.Columns.Add(dc);
                }
                string where = "";
                if (!string.IsNullOrEmpty(Request["belongdept"]))
                {
                    where += " and BelongDeptId='" + Request["belongdept"] + "'";
                }
                sql = "select Id,ProjectName from NCRL_SP..Project where BelongCmp='JL' " + where + " order by CreateTime desc";
                IList <EasyDictionary> dics = DataHelper.QueryDictList(sql);
                foreach (EasyDictionary dic in dics)
                {
                    DataRow dr = dt.NewRow();
                    dr["Id"]          = dic.Get <string>("Id");
                    dr["ProjectName"] = dic.Get <string>("ProjectName");
                    foreach (DataRow dr_enum in dt_enum.Rows)
                    {
                        IList <FileItem> fiEnts = FileItem.FindAllByProperties(FileItem.Prop_ProjectId, dic.Get <string>("Id"), FileItem.Prop_SecondTypeId, dr_enum["Id"]);
                        if (fiEnts.Count > 0)
                        {
                            dr[dr_enum["Id"].ToString() + dr_enum["Name"]] = "√";
                        }
                    }
                    dt.Rows.Add(dr);
                }
                Response.Write("{success:true,rows:" + JsonHelper.GetJsonStringFromDataTable(dt) + "}");
                Response.End();
                break;

            case "loadgroup":
                sql = "select GroupId id,replace(Name,'江西瑞林建设监理有限公司','') as name from SysGroup where ParentId='228' order by id asc";
                dt  = DataHelper.QueryDataTable(sql);
                Response.Write("{rows:" + JsonHelper.GetJsonStringFromDataTable(dt) + "}");
                Response.End();
                break;
            }
        }
Пример #11
0
        string type = String.Empty; // 对象类型

        #endregion

        #region ASP.NET 事件

        protected void Page_Load(object sender, EventArgs e)
        {
            string db = ConfigurationManager.AppSettings["ExamineDB"];

            op   = RequestData.Get <string>("op");
            id   = RequestData.Get <string>("id");
            type = RequestData.Get <string>("type");
            string Dids = Request.QueryString["Dids"];

            Logistic ent = null;

            switch (this.RequestAction)
            {
            case RequestActionEnum.Update:
                ent = this.GetMergedData <Logistic>();
                ent.DoUpdate();
                this.SetMessage("修改成功!");
                break;

            case RequestActionEnum.Insert:
            case RequestActionEnum.Create:
                ent            = this.GetPostedData <Logistic>();
                ent.DeliveryId = Dids;
                ent.DoCreate();

                //修改物流状态
                Aim.Data.DataHelper.ExecSql("update " + db + "..DeliveryOrder set LogisticState='已填写' where Id in ('" + Dids.Replace(",", "','") + "')");

                this.SetMessage("新建成功!");
                break;

            case RequestActionEnum.Delete:
                ent = this.GetTargetData <Logistic>();
                ent.DoDelete();
                this.SetMessage("删除成功!");
                return;

            default:
                if (RequestActionString == "getchild")
                {
                    string number  = RequestData.Get <string>("number");
                    string strjson = RequestData.Get <string>("child").Replace("[]", "");
                    if (strjson.Length > 0)
                    {
                        strjson = strjson.Substring(1, strjson.Length - 2);
                    }
                    if (number != "")
                    {
                        DeliveryOrder order = DeliveryOrder.FindAllByProperty("Number", number).FirstOrDefault <DeliveryOrder>();
                        if (order != null)
                        {
                            if (strjson.Length != 0 && order.Child.Substring(1, order.Child.Length - 2) != "")
                            {
                                strjson += ",";
                            }
                            strjson += order.Child.Substring(1, order.Child.Length - 2);
                        }
                    }
                    if (strjson != "")
                    {
                        strjson = "[" + strjson + "]";
                        PageState.Add("result", strjson);
                    }
                }
                break;
            }

            if (op == "c" && !string.IsNullOrEmpty(Dids))
            {
                string[]        didarry = Dids.Split(',');
                DeliveryOrder[] dorders = DeliveryOrder.FindAllByPrimaryKeys(didarry);
                if (dorders.Length > 0)
                {
                    dorders[0].Id     = "";
                    dorders[0].Number = "";
                    dorders[0].Remark = "";
                    dorders[0].State  = "";

                    //string json = "";
                    //foreach (DeliveryOrder order in dorders)
                    //{
                    //    if (order != null && !string.IsNullOrEmpty(order.Child))
                    //    {
                    //        json += order.Child.Substring(1, order.Child.Length - 2) + ",";
                    //    }
                    //}
                    //dorders[0].Child = "[" + json.Substring(0, json.Length - 1) + "]";

                    this.SetFormData(dorders[0]);

                    IList <EasyDictionary> dicts = DataHelper.QueryDictList("select Id,PCode as Code,PName as [Name],Unit,[Count] as OutCount,Remark from " + db + "..DelieryOrderPart where DId in ('" + Dids.Replace(",", "','") + "')");
                    PageState.Add("DetailList", dicts);
                }
            }
            else if (op != "c" && op != "cs")
            {
                if (!String.IsNullOrEmpty(id))
                {
                    ent = Logistic.Find(id);
                }

                this.SetFormData(ent);
            }

            PageState.Add("EDNames", SysEnumeration.GetEnumDict("EDNames"));
            PageState.Add("EDPayType", SysEnumeration.GetEnumDict("EDPayType"));
        }
Пример #12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            id   = RequestData.Get <string>("id", String.Empty);
            ids  = RequestData.GetList <string>("ids");
            pids = RequestData.GetList <string>("pids");
            year = RequestData.Get <string>("Year", String.Empty);

            A_TaskWBS ent = null;

            switch (this.RequestAction)
            {
            case RequestActionEnum.Update:
                ent          = this.GetMergedData <A_TaskWBS>();
                ent.ParentID = String.IsNullOrEmpty(ent.ParentID) ? null : ent.ParentID;
                ent.Update();
                this.SetMessage("更新成功!");
                break;

            default:
                if (RequestActionString == "batchdelete")
                {
                    IList <object> idList = RequestData.GetList <object>("IdList");
                    if (idList != null && idList.Count > 0)
                    {
                        A_TaskWBS.DoBatchDelete(idList.ToArray());
                    }
                }
                else if (RequestActionString == "paste")
                {
                    DoPaste();
                }
                else if (RequestActionString == "submittask")
                {
                    ent                = A_TaskWBS.Find(this.RequestData.Get <string>("Id"));
                    ent.State          = "1";
                    ent.SubmitDate     = DateTime.Now;
                    ent.SubmitUserId   = this.UserInfo.UserID;
                    ent.SubmitUserName = this.UserInfo.Name;
                    ent.Save();
                }
                else if (RequestActionString == "backtask")
                {
                    ent       = A_TaskWBS.Find(this.RequestData.Get <string>("Id"));
                    ent.State = "0";
                    ent.Save();
                }
                else
                {
                    DoSelect();
                    this.PageState.Add("BudgetType", SysEnumeration.GetEnumDict("BudgetType"));
                    this.PageState.Add("Years", SysEnumeration.GetEnumDict("Year"));
                    this.PageState.Add("AimType", SysEnumeration.GetEnumDict("AimType"));
                }
                if (this.RequestData.Get <string>("ChartSearch") == "T")
                {
                    string    sql      = "select Name TaskType,0 CountFinish,0 CountNormal from dbo.SysEnumeration where ParentId='5cf5990a-a68d-40b7-8ae5-558b1732cc92'";
                    DataTable dt       = DataHelper.QueryDataTable(sql);
                    string    sqlAll   = "";
                    string    deptName = this.RequestData.Get <string>("DeptName");
                    string    Year     = this.RequestData.Get <string>("Year");
                    DataTable newDt    = new DataTable();
                    foreach (DataColumn col in dt.Columns)
                    {
                        newDt.Columns.Add(col.ColumnName, col.DataType);
                    }
                    foreach (DataRow row in dt.Rows)
                    {
                        DataRow newrow = newDt.NewRow();
                        newrow.ItemArray = row.ItemArray;
                        newDt.Rows.Add(newrow);
                        string rootId = DataHelper.QueryValue <string>("select isnull(Id,'') from " + db + "..A_TaskWBS where (DeptName='" + deptName + "' or DutyName='" + deptName + "') and Year='" + year + "' and TaskType='" + row["TaskType"].ToString() + "'");
                        newrow["CountFinish"] = DataHelper.QueryValue("select isnull(count(*),0) from " + db + "..A_TaskWBS where (DeptName='" + deptName + "' or DutyName='" + deptName + "') and Year='" + year + "' and Path like '%" + rootId + "%' and State='2'");
                        newrow["CountNormal"] = DataHelper.QueryValue("select isnull(count(*),0) from " + db + "..A_TaskWBS where (DeptName='" + deptName + "' or DutyName='" + deptName + "') and Year='" + year + "' and Path like '%" + rootId + "%' and State<>'2'");
                    }
                    this.PageState.Add("ChartData", DataHelper.DataTableToDictList(newDt));
                }

                break;
            }
        }
Пример #13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string db = ConfigurationManager.AppSettings["ExamineDB"];

            op   = RequestData.Get <string>("op");
            id   = RequestData.Get <string>("id");
            type = RequestData.Get <string>("type");
            DeliveryOrder  ent     = null;
            IList <string> strList = RequestData.GetList <string>("data");

            switch (this.RequestAction)
            {
            case RequestActionEnum.Update:
                ent = this.GetMergedData <DeliveryOrder>();
                if (type == "xg")
                {
                    ent.DoUpdate();
                }
                else if (type == "ck")
                {
                    UpdateStockInfo(strList, ent);      //更新库存及唯一编号
                    if (ent.DeliveryType == "换货出库")
                    {
                        ChangeProduct dorder = ChangeProduct.TryFind(ent.PId);
                        if (dorder != null)
                        {
                            if ((dorder.State + "").Contains("已入库"))
                            {
                                dorder.State = "已完成";
                            }
                            else
                            {
                                dorder.State += ",仓库已出库:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm");
                            }
                            dorder.DoSave();
                        }
                    }
                    //更新子商品信息(先删除,再添加)
                    DelieryOrderPart.DeleteAll("DId='" + ent.Id + "'");     //删除DeliveryOrderPart
                    //添加出库商品信息并更新出库单状态
                    ent.State = InsertPart(strList, ent.Id);
                    ent.DoUpdate();
                    if (ent.DeliveryType == "调拨出库")    //add by phg 20120519 跟出库单的状态保持一致
                    {
                        WarehouseExchange weEnt = WarehouseExchange.Find(ent.PId);
                        weEnt.OutWarehouseState = ent.State;
                        weEnt.DoUpdate();
                    }
                    //更新SaleOrder表出库状态
                    DataHelper.ExecSql("update " + db + "..SaleOrders set DeState=" + db + ".dbo.fun_getDeliveryState(Id) where id='" + ent.PId + "'");
                }
                break;

            default:
                break;
            }
            if (RequestActionString == "getSalesman")
            {
                string   cid      = RequestData.Get <string>("CId");
                Customer customer = Customer.Find(cid);
                if (customer != null)
                {
                    PageState.Add("MagUser", customer.MagUser);
                    PageState.Add("MagId", customer.MagId);
                    PageState.Add("Address", customer.Address);
                    // PageState.Add("Tel", customer.Tel);
                    PageState.Add("Code", customer.Code);
                }
            }
            //根据压缩机唯一Id获取压缩机条码
            else if (RequestActionString == "getprobyguid")
            {
                //string isbn = DataHelper.QueryValue("select ModelNo from " + db + "..Compressor where SeriesNo='" + RequestData.Get<string>("isbn") + "'") + "";

                string isbn = DataHelper.QueryValue("select ModelNo from " + db + "..v_Compressor where SeriesNo='" + RequestData.Get <string>("Guid") + "' and ([State] is null or [State]<>'已出库')") + "";
                PageState.Add("isbn", isbn);
            }
            //获取压缩机整版的数量及GUIDS
            else if (RequestActionString == "getprobyboxnum")
            {
                string boxnum = RequestData.Get <string>("boxnum");
                string isbn   = DataHelper.QueryValue("select ModelNo from " + db + "..v_Compressor where SkinNo='" + boxnum + "' and ([State] is null or [State]<>'已出库')") + "";
                string count  = DataHelper.QueryValue("select count(1) from " + db + "..v_Compressor where SkinNo='" + boxnum + "' and ([State] is null or [State]<>'已出库')") + "";
                string guids  = DataHelper.QueryValue("select " + db + ".dbo.fun_getGuids('" + boxnum + "')") + "";

                PageState.Add("isbn", isbn);
                PageState.Add("count", count);
                PageState.Add("guids", guids);
            }
            //获取配件箱子所包含的配件数量
            else if (RequestActionString == "getPJbyboxnum")
            {
                string boxnum = RequestData.Get <string>("boxnum");
                sql = "select * from SHHG_AimExamine..Products where FirstSkinIsbn='" + boxnum + "' and FirstSkinCapacity is not null";
                IList <EasyDictionary> dics = DataHelper.QueryDictList(sql);
                if (dics.Count > 0)
                {
                    PageState.Add("isbn", dics[0].Get <string>("Isbn"));
                    PageState.Add("count", dics[0].Get <int>("FirstSkinCapacity"));
                }
                sql  = "select * from SHHG_AimExamine..Products where SecondSkinIsbn='" + boxnum + "' and SecondSkinCapacity is not null";
                dics = DataHelper.QueryDictList(sql);
                if (dics.Count > 0)
                {
                    PageState.Add("isbn", dics[0].Get <string>("Isbn"));
                    PageState.Add("count", dics[0].Get <int>("SecondSkinCapacity"));
                }
            }
            else if (RequestActionString == "getguids")
            {
                string guids = DataHelper.QueryValue("select " + db + ".dbo.fun_getGuids('" + RequestData.Get <string>("SkinNo") + "'," + RequestData.Get <string>("Count") + ")") + "";
                PageState.Add("guids", guids);
            }
            else if (op != "c" && op != "cs")
            {
                if (!String.IsNullOrEmpty(id))
                {
                    ent = DeliveryOrder.Find(id);
                }
                SetFormData(ent);
                PageState.Add("State", ent.State);
                //查询子商品
                sql = "select p.Id, PId, PCode as Code, ProductId, PName as Name, c.ProductType, p.Isbn, Guids, Count,Count-(isnull(OutCount,0)) as dck, isnull(OutCount,0) as OutCount, p.Unit, p.Remark, FirstSkinIsbn,Count*(c.Weight) as TotalWeight," + db + ".dbo.fun_getProQuantity(ProductId) as StockQuan," + db + ".dbo.fun_getProQuantityByWarehouseId(ProductId,'" + ent.WarehouseId + "') as BenStockQuan from " + db + "..DelieryOrderPart p "
                      + " left join " + db + "..Products c on c.Id=p.ProductId  where DId='" + id + "'";
                PageState.Add("DetailList", DataHelper.QueryDictList(sql));
            }
            PageState.Add("DeliveryMode", SysEnumeration.GetEnumDict("DeliveryMode"));
        }
Пример #14
0
        /// <summary>
        /// 选择数据
        /// </summary>
        private void DoSelect()
        {
            // 构建查询表达式
            SearchCriterion sc = new HqlSearchCriterion();

            sc.SetOrder("SortIndex");

            ICriterion crit = null;

            if (RequestActionString == "querychildren")
            {
                if (ids != null && ids.Count > 0 || pids != null && pids.Count > 0)
                {
                    if (ids != null && ids.Count > 0)
                    {
                        IEnumerable <string> distids = ids.Distinct().Where(tent => !String.IsNullOrEmpty(tent));
                        crit = Expression.In(SysEnumeration.Prop_EnumerationID, distids.ToArray());
                    }

                    if (pids != null && pids.Count > 0)
                    {
                        IEnumerable <string> dispids = pids.Distinct().Where(tent => !String.IsNullOrEmpty(tent));

                        if (crit != null)
                        {
                            crit = SearchHelper.UnionCriterions(crit, Expression.In(SysEnumeration.Prop_ParentID, dispids.ToArray()));
                        }
                        else
                        {
                            crit = Expression.In(SysEnumeration.Prop_ParentID, dispids.ToArray());
                        }
                    }
                }
            }
            else
            {
                if (!String.IsNullOrEmpty(code))
                {
                    SysEnumeration tent = SysEnumeration.FindFirstByProperties(SysEnumeration.Prop_Code, code);
                    crit = Expression.Eq(SysEnumeration.Prop_ParentID, tent.EnumerationID);
                }
                else
                {
                    crit = SearchHelper.UnionCriterions(Expression.IsNull(SysEnumeration.Prop_ParentID),
                                                        Expression.Eq(SysEnumeration.Prop_ParentID, String.Empty));
                }
            }

            if (crit != null)
            {
                ents = SysEnumerationRule.FindAll(sc, crit);
            }
            else
            {
                ents = SysEnumerationRule.FindAll(sc);
            }

            if (ents != null && ents.Length != 0)
            {
                this.PageState.Add("DtList", ents.OrderBy(v => v.SortIndex));
            }
        }
        private void DoSelect()
        {
            if (op != "c" && op != "cs")
            {
                string sql = @"select * from Task where PatIndex('%{0}%',EFormName)>0  and Status='4' order by FinishTime asc";
                sql = string.Format(sql, id);
                IList <EasyDictionary> taskDics = DataHelper.QueryDictList(sql);
                PageState.Add("Opinion", taskDics);
                string taskId = RequestData.Get <string>("TaskId");//取审批暂存时所填写的意见
                if (!string.IsNullOrEmpty(taskId))
                {
                    Task tEnt = Task.Find(taskId);
                    if (tEnt.Status != 4 && !string.IsNullOrEmpty(tEnt.Description))
                    {
                        PageState.Add("UnSubmitOpinion", tEnt.Description);
                    }
                }


                PageState.Add("AppealTypeName", SysEnumeration.GetEnumDict("EmpAppeal"));

                if (!String.IsNullOrEmpty(id))
                {
                    ent = UsrDoubleWelfare.Find(id);
                }
                this.SetFormData(ent);
            }
            if (op == "c" || op == "create")
            {
                string userid = "";
                if (UserInfo != null)
                {
                    userid = UserInfo.UserID;
                }
                else
                {
                    userid = RequestData.Get <string>("userid");
                }

                var Ent = SysUser.FindFirstByProperties("UserID", userid);


                //  string sql = "select * from UsrTravelWelfare";

                UsrDoubleWelfare[] TWEnt = UsrDoubleWelfare.FindAllByProperties(UsrDoubleWelfare.Prop_UserId, RequestData.Get <string>("userid"), UsrDoubleWelfare.Prop_NoticeId, RequestData.Get <string>("noticeid"));
                if (TWEnt.Length != 0)
                {
                    this.SetFormData(TWEnt[0]);
                }
                else
                {
                    //用来获取配置的审批人
                    string SQL = "select top 1 * from  FL_Culture..SysApproveConfig where CompanyId='{0}' and len(CoupleWelfareId)>0 ";
                    SQL = string.Format(SQL, Ent.Pk_corp);
                    DataTable Dt = DataHelper.QueryDataTable(SQL);

                    //公司与部门
                    SQL = @"select B.GroupID As CompanyId,B.Name As CompanyName,C.GroupID AS DeptId,C.Name As DeptName
                        from  sysuser As A
	                        left join sysgroup As B
	                        on A.pk_corp=B.groupID
                        left join sysgroup As C
	                        on C.GroupID=A.pk_deptdoc
                        where A.UserID='{0}'";
                    SQL = string.Format(SQL, userid);
                    DataTable Dt1 = DataHelper.QueryDataTable(SQL);

                    string CompanyName = string.Empty, CompanyId = string.Empty;
                    string DeptName = string.Empty, DeptId = string.Empty;

                    if (Dt1.Rows.Count > 0)
                    {
                        CompanyName = Dt1.Rows[0]["CompanyName"].ToString();
                        CompanyId   = Dt1.Rows[0]["CompanyId"].ToString();
                        DeptId      = Dt1.Rows[0]["DeptId"].ToString();
                        DeptName    = Dt1.Rows[0]["DeptName"].ToString();
                    }

                    if (Ent != null)
                    {
                        var Obj = new
                        {
                            UserId     = Ent.UserID,
                            UserName   = Ent.Name,
                            Sex        = Ent.Sex,
                            Age        = Ent.Wage,
                            WorkNo     = Ent.WorkNo,
                            IndutyData = Ent.Indutydate,

                            CompanyName = CompanyName,
                            CompanyId   = CompanyId,
                            DeptId      = DeptId,
                            DeptName    = DeptName,

                            ApproveName   = Dt == null ? "" : Dt.Rows.Count > 0 ? Dt.Rows[0]["CoupleWelfareName"].ToString() : "",
                            ApproveUserId = Dt == null ? "" : Dt.Rows.Count > 0 ? Dt.Rows[0]["CoupleWelfareId"].ToString() : ""
                        };
                        this.SetFormData(Obj);
                    }
                }
            }
        }
Пример #16
0
        /// <summary>
        /// 信息初始化
        /// </summary>
        private void DoSelect()
        {
            if (op != "c" && op != "cs")
            {
                if (!String.IsNullOrEmpty(id))
                {
                    ent = UsrAppealList.Find(id);
                }

                this.SetFormData(ent);
            }
            if (op == "c" || op == "create")
            {
                //var Ent = SysUser.FindFirstByProperties("UserID", UserInfo.UserID);
                string config = @"select A.*,B.GroupID as CropId,B.Name as CropName,
                                    C.GroupID as DeptId,C.Name as DeptName
                             from FL_PortalHR..SysUser As A
	                            left join FL_PortalHR..SysGroup As B
                              on  A.Pk_corp=B.GroupID
	                            left join  FL_PortalHR..SysGroup As C
                              on A.Pk_deptdoc=C.GroupID
                            where UserID='{0}'";

                config = config.Replace("FL_PortalHR", Global.AimPortalDB);

                config = string.Format(config, UserInfo.UserID);
                DataTable dt = DataHelper.QueryDataTable(config);

                string OrgPath = dt.Rows[0]["DeptName"] + "";
                OrgPath = !string.IsNullOrEmpty(OrgPath) ? "/" + OrgPath : "";

                var Obj = new
                {
                    UserId      = dt.Rows[0]["UserID"],
                    UserName    = dt.Rows[0]["Name"],
                    Sex         = dt.Rows[0]["Sex"],
                    Age         = dt.Rows[0]["Age"],
                    WorkNo      = dt.Rows[0]["WorkNo"],
                    DeptId      = dt.Rows[0]["DeptId"],
                    DeptName    = dt.Rows[0]["DeptName"],
                    CompanyId   = dt.Rows[0]["CropId"],
                    CompanyName = dt.Rows[0]["CropName"] + OrgPath   //Change 2012/10/31
                };
                this.SetFormData(Obj);

                //if (Ent != null)
                //{
                //    var Obj = new
                //    {
                //        UserId = Ent.UserID,
                //        UserName = Ent.Name,
                //        Sex = Ent.Sex,
                //        Age = Ent.Age,
                //        WorkNo = Ent.WorkNo
                //    };
                //    this.SetFormData(Obj);
                //}
            }
            if (!string.IsNullOrEmpty(id))
            {
                string sql = @"select * from Task where PatIndex('%{0}%',EFormName)>0  and Status='4' order by FinishTime asc";
                sql = string.Format(sql, id);
                IList <EasyDictionary> taskDics = DataHelper.QueryDictList(sql);
                PageState.Add("Opinion", taskDics);
                string taskId = RequestData.Get <string>("TaskId");//取审批暂存时所填写的意见
                if (!string.IsNullOrEmpty(taskId))
                {
                    Task tEnt = Task.Find(taskId);
                    if (tEnt.Status != 4 && !string.IsNullOrEmpty(tEnt.Description))
                    {
                        PageState.Add("UnSubmitOpinion", tEnt.Description);
                    }
                }
            }
            PageState.Add("AppealTypeName", SysEnumeration.GetEnumDict("EmpAppeal"));
        }
Пример #17
0
        string type = String.Empty; // 对象类型

        #endregion

        #region ASP.NET 事件

        protected void Page_Load(object sender, EventArgs e)
        {
            string db = ConfigurationManager.AppSettings["ExamineDB"];

            op   = RequestData.Get <string>("op");
            id   = RequestData.Get <string>("id");
            paid = RequestData.Get <string>("paid");
            oid  = RequestData.Get <string>("oid");
            type = RequestData.Get <string>("type");

            PriceApply ent = null;

            switch (this.RequestAction)
            {
            case RequestActionEnum.Update:
                ent               = this.GetMergedData <PriceApply>();
                ent.State         = "";
                ent.ApprovalState = "";
                ent.DoUpdate();
                this.SetMessage("修改成功!");
                break;

            case RequestActionEnum.Insert:
            case RequestActionEnum.Create:
                ent = this.GetPostedData <PriceApply>();
                if (oid != "")
                {
                    ent.OId = oid;
                }

                //自动生成流水号
                ent.Number = DataHelper.QueryValue("select " + db + ".dbo.fun_getPriceAppNumber()") + "";

                ent.DoCreate();
                this.SetMessage("新建成功!");
                break;

            case RequestActionEnum.Delete:
                ent = this.GetTargetData <PriceApply>();
                ent.DoDelete();
                this.SetMessage("删除成功!");
                return;

            default:
                if (RequestActionString == "submitfinish")
                {
                    PriceApply pc = PriceApply.Find(this.RequestData.Get <string>("id"));
                    pc.State         = "End";
                    pc.ApprovalState = this.RequestData.Get <string>("ApprovalState");
                    pc.Save();

                    //更新销售单对应的状态
                    if (!string.IsNullOrEmpty(pc.OId))
                    {
                        SaleOrder order = SaleOrder.TryFind(pc.OId);
                        if (order != null)
                        {
                            order.PAState = pc.ApprovalState;
                            order.Save();
                        }
                    }
                }
                break;
            }
            if (RequestActionString == "getSalesman")
            {
                string   cid      = RequestData.Get <string>("CId");
                Customer customer = Customer.Find(cid);
                if (customer != null)
                {
                    PageState.Add("Code", customer.Code);
                }
            }
            else if (op == "c" && !string.IsNullOrEmpty(oid))
            {
                if (!string.IsNullOrEmpty(oid))
                {
                    SaleOrder order = SaleOrder.TryFind(oid);
                    if (order != null)
                    {
                        order.Id            = "";
                        order.Reason        = "";
                        order.Number        = "";
                        order.ApprovalState = "";
                        order.Remark        = "";
                        order.State         = "";
                        this.SetFormData(order);
                    }
                }
            }
            else if (op != "c" && op != "cs")
            {
                if (!String.IsNullOrEmpty(id))
                {
                    ent       = PriceApply.Find(id);
                    ent.CCode = Customer.Find(ent.CId).Importance;//2017-08-22客户要求在价格申请单中显示客户等级,客户编号没有什么用,就用次属性代替客户等级
                }

                this.SetFormData(ent);
                this.PageState.Add("State", ent.State);
            }

            this.PageState.Add("FlowEnum", SysEnumeration.GetEnumDictList("WorkFlow.Simple"));
        }
Пример #18
0
 /// <summary>
 /// 查询
 /// </summary>
 private void DoSelect()
 {
     this.PageState.Add("P_SupplierList", SysEnumeration.GetEnumDictList(Request.QueryString["EnumKey"]));
 }
Пример #19
0
        SearchModeEnum tagschmode = SearchModeEnum.Like; // 扩展信息查询方式

        #endregion

        #region 构造函数

        #endregion

        #region ASP.NET 事件

        protected void Page_Load(object sender, EventArgs e)
        {
            id       = RequestData.Get <string>("id", String.Empty);
            ids      = RequestData.GetList <string>("ids");
            pids     = RequestData.GetList <string>("pids");
            code     = RequestData.Get <string>("code", String.Empty);
            showroot = RequestData.Get <string>("showroot", String.Empty);

            tag = RequestData.Get <string>("tag", String.Empty);
            string tagschmodestr = RequestData.Get <string>("tagschmode", String.Empty);

            tagschmode = ObjectHelper.GetEnum <SearchModeEnum>(tagschmodestr, SearchModeEnum.Like);

            SysEnumeration ent = null;

            switch (this.RequestAction)
            {
            case RequestActionEnum.Update:
                ent          = this.GetMergedData <SysEnumeration>();
                ent.ParentID = String.IsNullOrEmpty(ent.ParentID) ? null : ent.ParentID;
                ent.Update();
                this.SetMessage("更新成功!");
                break;

            default:
                if (RequestActionString == "batchdelete")
                {
                    IList <object> idList = RequestData.GetList <object>("IdList");
                    if (idList != null && idList.Count > 0)
                    {
                        SysEnumeration.DoBatchDelete(idList.ToArray());
                    }
                }
                else
                {
                    // 构建查询表达式
                    SearchCriterion sc = new HqlSearchCriterion();

                    // sc.SetOrder("SortIndex");
                    sc.SetOrder("CreatedDate");

                    ICriterion crit = null;

                    if (RequestActionString == "querychildren")
                    {
                        if (ids != null && ids.Count > 0 || pids != null && pids.Count > 0)
                        {
                            if (ids != null && ids.Count > 0)
                            {
                                IEnumerable <string> distids = ids.Distinct().Where(tent => !String.IsNullOrEmpty(tent));
                                crit = Expression.In(SysEnumeration.Prop_EnumerationID, distids.ToArray());
                            }

                            if (pids != null && pids.Count > 0)
                            {
                                IEnumerable <string> dispids = pids.Distinct().Where(tent => !String.IsNullOrEmpty(tent));

                                if (crit != null)
                                {
                                    crit = SearchHelper.UnionCriterions(crit, Expression.In(SysEnumeration.Prop_ParentID, dispids.ToArray()));
                                }
                                else
                                {
                                    crit = Expression.In(SysEnumeration.Prop_ParentID, dispids.ToArray());
                                }
                            }
                        }
                    }
                    else
                    {
                        ICriterion tagCirt = null;

                        if (!String.IsNullOrEmpty(tag))
                        {
                            HqlCommonSearchCriterionItem tagCritItem = new HqlCommonSearchCriterionItem(SysEnumeration.Prop_Tag, tag, tagschmode);
                            tagCirt = tagCritItem.GetCriterion();
                        }

                        if (!String.IsNullOrEmpty(code))
                        {
                            SysEnumeration tent = SysEnumeration.FindFirstByProperties(SysEnumeration.Prop_Code, code);

                            crit = SearchHelper.IntersectCriterions(
                                Expression.Eq(SysEnumeration.Prop_ParentID, tent.EnumerationID), tagCirt);

                            if (!String.IsNullOrEmpty(showroot) && showroot != "0" && showroot.ToLower() != "false")
                            {
                                crit = SearchHelper.UnionCriterions(
                                    crit, Expression.Eq(SysEnumeration.Prop_EnumerationID, tent.EnumerationID));
                            }

                            this.PageState.Add("Root", tent);
                        }
                        else
                        {
                            crit = SearchHelper.UnionCriterions(Expression.IsNull(SysEnumeration.Prop_ParentID),
                                                                Expression.Eq(SysEnumeration.Prop_ParentID, String.Empty));

                            crit = SearchHelper.IntersectCriterions(crit, tagCirt);
                        }
                    }

                    ents = SysEnumerationRule.FindAll(sc, crit);

                    this.PageState.Add("DtList", ents);
                }

                break;
            }
        }
Пример #20
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string db = ConfigurationManager.AppSettings["ExamineDB"];

            op      = RequestData.Get <string>("op");
            id      = RequestData.Get <string>("id");
            paid    = RequestData.Get <string>("paid");
            PAState = RequestData.Get <string>("PAState");
            type    = RequestData.Get <string>("type");

            SaleOrder ent = null;

            switch (this.RequestAction)
            {
            case RequestActionEnum.Update:
                ent = this.GetMergedData <SaleOrder>();
                if (PAState == "Yes")
                {
                    ent.PAState  = "待审核";
                    ent.PANumber = "HGPA" + DateTime.Now.ToString("yyyyMMddHHmmss");
                }

                ent.DoUpdate();

                //处理OrdersPart表
                //删除
                OrdersPart.DeleteAll("OId='" + ent.Id + "'");
                //添加
                strjosn = ent.Child.Substring(1, ent.Child.Length - 2);
                objarr  = strjosn.Replace("},{", "#").Split('#');
                InsertProPart(ent);

                //创建价格申请单
                if (PAState == "Yes")
                {
                    CreatePriceApply(ent);
                }

                this.SetMessage("修改成功!");
                break;

            case RequestActionEnum.Insert:
            case RequestActionEnum.Create:
                ent = this.GetPostedData <SaleOrder>();
                if (PAState == "Yes")
                {
                    ent.PAState  = "待审核";
                    ent.PANumber = DataHelper.QueryValue("select " + db + ".dbo.fun_getPriceAppNumber()") + "";
                }
                ent.PId = paid;

                //自动生成流水号
                ent.Number = DataHelper.QueryValue("select " + db + ".dbo.fun_getOrderNumber()") + "";

                ent.DoCreate();

                //处理OrdersPart表
                //添加
                strjosn = ent.Child.Substring(1, ent.Child.Length - 2);
                objarr  = strjosn.Replace("},{", "#").Split('#');
                InsertProPart(ent);

                //创建价格申请单
                if (PAState == "Yes")
                {
                    CreatePriceApply(ent);
                }

                this.SetMessage("新建成功!");
                break;

            case RequestActionEnum.Delete:
                ent = this.GetTargetData <SaleOrder>();
                ent.DoDelete();
                this.SetMessage("删除成功!");
                return;

            default:
                if (RequestActionString == "submitfinish")
                {
                    SaleOrder pc = SaleOrder.Find(this.RequestData.Get <string>("id"));
                    pc.State         = "End";
                    pc.DeliveryState = "已生成出库单";
                    pc.ApprovalState = this.RequestData.Get <string>("ApprovalState");
                    pc.Save();

                    //自动生成发货单
                    if (pc.ApprovalState == "同意")
                    {
                        DeliveryOrder dor = new DeliveryOrder
                        {
                            Child         = pc.Child,
                            CId           = pc.Id,
                            WarehouseId   = pc.WarehouseId,
                            WarehouseName = pc.WarehouseName,
                            CName         = pc.CName,
                            CreateId      = UserInfo.UserID,
                            CreateName    = UserInfo.Name,
                            CreateTime    = DateTime.Now,
                            ExpectedTime  = pc.ExpectedTime,
                            Number        = DateTime.Now.ToString("yyyyMMddHHmmss")
                        };
                        dor.DoCreate();
                    }
                }
                else if (RequestActionString == "inputexcel")
                {
                    string path  = @"D:\RW\Files\AppFiles\Portal\Default\" + RequestData.Get <string>("path");
                    string strcn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + path + ";Extended Properties='Excel 8.0;HDR=Yes;IMEX=1';";    //连接字符串

                    #region 遍历整个excel
                    //DataSet ds = GetDataFromExcel(path);

                    ////遍历DataSet取数据

                    ////清除无效行
                    //ds.Tables[0].Rows.RemoveAt(0);
                    //ds.Tables[0].Rows.RemoveAt(0);
                    //ds.Tables[0].Rows.RemoveAt(0);
                    //PageState.Add("error", "Tables:" + ds.Tables.Count + " Table[0]:" + ds.Tables[0].Select("F4 <> ''").Length + "数量" + ds.Tables[0].Rows[0][3]);

                    //return;
                    #endregion

                    #region old
                    try
                    {
                        string           sql  = "select * from [Sheet1$]";
                        OleDbDataAdapter oldr = new OleDbDataAdapter(sql, strcn);    //读取数据,并填充到DATASET里
                        DataTable        dt   = new DataTable();
                        oldr.Fill(dt);

                        if (dt.Rows.Count > 0)
                        {
                            string strjson = RequestData.Get <string>("json").Replace("[]", "");
                            if (strjson.Length > 0)
                            {
                                strjson = strjson.Substring(1, strjson.Length - 2) + ",";
                            }
                            DataRow row = null;
                            for (int i = 0; i < dt.Rows.Count; i++)
                            {
                                row = dt.Rows[i];

                                strjson += "{";
                                strjson += "Id:'" + row["Id"] + "',";
                                strjson += "Isbn:'" + row["Isbn"] + "',";
                                strjson += "Code:'" + row["Code"] + "',";
                                strjson += "Name:'" + row["Name"] + "',";
                                strjson += "Unit:'" + row["Unit"] + "',";
                                strjson += "MinSalePrice:'" + row["MinSalePrice"] + "',";
                                strjson += "Price:'" + row["MinSalePrice"] + "',";
                                strjson += "Amount:'" + row["Amount"] + "',";
                                strjson += "Count:'" + row["Count"] + "',";
                                strjson += "Remark:'" + row["Remark"] + "'";
                                strjson += "},";
                            }
                            if (strjson != "")
                            {
                                strjson = "[" + strjson.Substring(0, strjson.Length - 1) + "]";
                                PageState.Add("result", strjson);
                            }
                        }
                        return;
                    }
                    catch (Exception ex)
                    {
                        PageState.Add("error", ex.Message);
                        return;
                    }
                    #endregion
                }
                break;
            }

            if (RequestActionString == "getSalesman")
            {
                string   cid      = RequestData.Get <string>("CId");
                Customer customer = Customer.Find(cid);
                if (customer != null)
                {
                    PageState.Add("Code", customer.Code);
                }
            }
            else if (op == "c" && !string.IsNullOrEmpty(paid))
            {
                if (!string.IsNullOrEmpty(paid))
                {
                    PriceApply paent = PriceApply.TryFind(paid);
                    if (paent != null)
                    {
                        paent.Reason        = "";
                        paent.ApprovalState = "";
                        paent.ExpectedTime  = null;
                        paent.Id            = "";
                        paent.Number        = "";
                        paent.Remark        = "";
                        paent.State         = "";
                        this.SetFormData(paent);
                    }
                }
            }
            else if (op != "c" && op != "cs")
            {
                if (!String.IsNullOrEmpty(id))
                {
                    ent = SaleOrder.Find(id);
                }

                this.SetFormData(ent);
                this.PageState.Add("State", ent.State);
            }

            this.PageState.Add("FlowEnum", SysEnumeration.GetEnumDictList("WorkFlow.Simple"));

            PageState.Add("InvoiceType", SysEnumeration.GetEnumDict("InvoiceType"));
            PageState.Add("DeliveryMode", SysEnumeration.GetEnumDict("DeliveryMode"));
            PageState.Add("PayType", SysEnumeration.GetEnumDict("PayType"));
            PageState.Add("CalculateManner", SysEnumeration.GetEnumDict("CalculateManner"));
        }
Пример #21
0
        string type = String.Empty; // 对象类型

        #endregion

        #region ASP.NET 事件

        protected void Page_Load(object sender, EventArgs e)
        {
            string db = ConfigurationManager.AppSettings["ExamineDB"];

            op   = RequestData.Get <string>("op");
            id   = RequestData.Get <string>("id");
            type = RequestData.Get <string>("type");

            Leave ent = null;

            switch (this.RequestAction)
            {
            case RequestActionEnum.Update:
                ent = this.GetMergedData <Leave>();
                ent.DoUpdate();
                this.SetMessage("修改成功!");
                break;

            case RequestActionEnum.Insert:
            case RequestActionEnum.Create:
                ent = this.GetPostedData <Leave>();

                //自动生成流水号
                ent.Number = DataHelper.QueryValue("select " + db + ".dbo.fun_getLeaveNumber()") + "";

                ent.DoCreate();
                this.SetMessage("新建成功!");
                break;

            case RequestActionEnum.Delete:
                ent = this.GetTargetData <Leave>();
                ent.DoDelete();
                this.SetMessage("删除成功!");
                return;

            default:
                if (RequestActionString == "save")
                {
                    DoSave();
                }
                else if (RequestActionString == "submitfinish")
                {
                    Leave pc = Leave.Find(this.RequestData.Get <string>("id"));
                    pc.State    = "End";
                    pc.AppState = this.RequestData.Get <string>("ApprovalState");
                    pc.Save();
                }
                break;
            }

            if (op != "c" && op != "cs")
            {
                if (!String.IsNullOrEmpty(id))
                {
                    ent = Leave.Find(id);
                }

                this.SetFormData(ent);
                this.PageState.Add("State", ent.State);
            }
            if (op == "c")
            {
                PageState.Add("ReleDepartment", DataHelper.QueryValue("select " + db + ".dbo.get_DeptName('" + UserInfo.UserID + "')"));
            }
            this.PageState.Add("FlowEnum", SysEnumeration.GetEnumDictList("WorkFlow.Simple"));
            PageState.Add("LeaveType", SysEnumeration.GetEnumDict("LeaveType"));
        }
        /// <summary>
        /// 生成旅游金额
        /// </summary>
        private void CreateMoney()
        {
            string          CorpId = string.Empty;
            UserContextInfo UC     = new UserContextInfo();

            CorpId = UC.GetUserCurrentCorpId(UserInfo.UserID);

            EasyDictionary LimitDate    = SysEnumeration.GetEnumDict("TravelLimitDate");
            string         limitDateStr = string.Empty;

            if ((LimitDate["LimitDate"] + "").ToUpper() == "2L") //2 月最后一天
            {
                limitDateStr = "'" + GetLastDayOfMonth(DateTime.Now.Year, 2).ToString("yyyy-MM-dd") + "'";
            }
            else
            {
                string prefix = LimitDate["LimitDate"] + "";
                limitDateStr = "'" + DateTime.Now.Year + "-" + prefix + "'";
            }

            EasyDictionary Dic   = SysEnumeration.GetEnumDict("BaseMoney");
            string         One   = Dic[">1<5"] + "";
            string         Two   = Dic[">=5<10"] + "";
            string         Three = Dic[">=10<15"] + "";
            string         Four  = Dic[">=15<20"] + "";

            EasyDictionary DicBase       = SysEnumeration.GetEnumDict("WorkYearMoney");
            string         BaseMoney_One = DicBase["<1年"] + "";
            string         BaseMoney_two = DicBase[">1年"] + "";

            string SQL = @"select A.* ,
                            case 
                                when 1<datediff(year, Indutydate,getdate())and datediff(year,Indutydate,getdate())<5 then {0}  
                                when 5<=datediff(year,Indutydate,getdate())and datediff(year,Indutydate,getdate())<10 then {1}   
                                when 10<=datediff(year,Indutydate,getdate())and datediff(year,Indutydate,getdate())<15 then {2}   
                                when 15<=datediff(year,Indutydate,getdate())and datediff(year,Indutydate,getdate())<20 then {3} 
                                else 0
                            end  As YearMoney,
                            case 
                                when  charindex('正式工',B.psnclassname)>0 and year(Indutydate)>1 then {5}
                               else {4}
                            end As BaseMoney ,C.GroupID as CorpId,C.Name As CorpName,D.GroupID As DeptId,D.Name As DeptName
                         from FL_PortalHR..sysuser  As A
                             left join HR_OA_MiddleDB..fld_rylb As B
                                on B.pk_fld_rylb=A.Pk_rylb 
                            left join FL_PortalHR..SysGroup As C
                                on C.GroupID=A.PK_Corp
                            left join FL_PortalHR..SysGroup As D
                                on D.GroupID=A.Pk_deptdoc
                         where 
                            (OutdutyDate='' or OutdutyDate is null) and A.Status=1 and A.Indutydate<>''  ##QUERY## ";

            SQL          = string.Format(SQL, One, Two, Three, Four, BaseMoney_One, BaseMoney_two);
            SQL          = SQL.Replace("FL_PortalHR", Global.AimPortalDB);
            SQL          = SQL.Replace("HR_OA_MiddleDB", Global.HR_OA_MiddleDB);
            SQL          = SQL.Replace("getdate()", limitDateStr);
            string where = string.Empty;
            CommPowerSplit PS = new CommPowerSplit();

            if (PS.IsAdmin(UserInfo.LoginName) || PS.IsHR(UserInfo.UserID, UserInfo.LoginName))
            {
            }
            else
            {
                where += " and A.Pk_corp='" + CorpId + "' ";
            }
            SQL = SQL.Replace("##QUERY##", where);

            DataTable UDt = DataHelper.QueryDataTable(SQL);

            for (int i = 0; i < UDt.Rows.Count; i++)
            {
                try
                {
                    TravelMoneyConfig TM = new TravelMoneyConfig();
                    string            YearMoney = UDt.Rows[i]["YearMoney"] + "", BaseMoney = UDt.Rows[i]["BaseMoney"] + "";
                    if (!string.IsNullOrEmpty(YearMoney))
                    {
                        decimal M = 0.0m;
                        if (decimal.TryParse(YearMoney, out M))
                        {
                            TM.Money = M;
                        }
                    }
                    else
                    {
                        TM.Money = 0;
                    }

                    //基本津贴
                    if (!string.IsNullOrEmpty(BaseMoney))
                    {
                        decimal M = 0.0m;
                        if (decimal.TryParse(BaseMoney, out M))
                        {
                            TM.BaseMoney = M;
                        }
                    }
                    else
                    {
                        TM.BaseMoney = 0;
                    }

                    TM.UserId   = UDt.Rows[i]["UserID"] + "";
                    TM.UserName = UDt.Rows[i]["Name"] + "";
                    TM.WorkNo   = UDt.Rows[i]["WorkNo"] + "";

                    DateTime DTime = new DateTime();
                    if (DateTime.TryParse(UDt.Rows[i]["Indutydate"] + "", out DTime))
                    {
                        TM.Indutydate = DTime;
                    }

                    TM.HaveUsed   = "N";
                    TM.Corp       = UDt.Rows[i]["CorpId"] + "";
                    TM.CorpName   = UDt.Rows[i]["CorpName"] + "";
                    TM.DeptId     = UDt.Rows[i]["DeptId"] + "";
                    TM.DeptName   = UDt.Rows[i]["DeptName"] + "";
                    TM.CreateTime = DateTime.Now;
                    TM.Ext1       = "C|" + CorpId + "_" + UserInfo.UserID + ""; //生成标志
                    TM.Create();
                }
                catch { }
            }
            this.PageState.Add("State", "1");
        }
Пример #23
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                Aim.Portal.Web.WebPortalService.CheckLogon();
            }
            catch
            {
                Response.Redirect("/Login.aspx");
            }
            action   = Request["action"];
            EnumID   = Request["id"];
            ParentID = Request["ParentID"];
            switch (action)
            {
            case "select":
                if (!string.IsNullOrEmpty(EnumID))
                {
                    IList <SysEnumeration> seEnts = SysEnumeration.FindAllByProperty(SysEnumeration.Prop_SortIndex, SysEnumeration.Prop_ParentID, EnumID);
                    string result = "[";
                    int    i      = 0;
                    foreach (SysEnumeration seEnt in seEnts)
                    {
                        if (i != seEnts.Count - 1)
                        {
                            result += "{id:'" + seEnt.EnumerationID + "',Name:'" + seEnt.Name + "',Code:'" + seEnt.Code + "',Value:'" + seEnt.Value + "',ParentID:'" + seEnt.ParentID + "',leaf:" + (seEnt.IsLeaf.Value ? "true" : "false") + "},";
                        }
                        else
                        {
                            result += "{id:'" + seEnt.EnumerationID + "',Name:'" + seEnt.Name + "',Code:'" + seEnt.Code + "',Value:'" + seEnt.Value + "',ParentID:'" + seEnt.ParentID + "',leaf:" + (seEnt.IsLeaf.Value ? "true" : "false") + "}";
                        }
                        i++;
                    }
                    result += "]";
                    Response.Write(result);
                    Response.End();
                }
                break;

            case "delete":
                SysEnumeration ent_sysenumeration = SysEnumeration.Find(EnumID);
                SysEnumeration ent_parent         = SysEnumeration.Find(ent_sysenumeration.ParentID);
                ent_sysenumeration.DoDelete();
                IList <SysEnumeration> ents_sysenumeration = SysEnumeration.FindAllByProperty(SysEnumeration.Prop_ParentID, ent_parent.EnumerationID);
                if (ents_sysenumeration.Count == 0)
                {
                    ent_parent.IsLeaf = true;
                    ent_parent.DoUpdate();
                }
                //sql = @"delete sysenumeration where enumerationid='" + EnumID + "'";
                //DataHelper.ExecSql(sql);
                //string sql1 = "select * from sysenumeration where ParentID ='" + ParentID + "'";
                //IList<EasyDictionary> dics = DataHelper.QueryDictList(sql1);
                //if (dics.Count() == 0)
                //{
                //    sql = "update sysenumeration set ISLEAF =1 where enumerationid='" + ParentID + "'";
                //    DataHelper.ExecSql(sql);
                //}
                //Response.Write("");
                //Response.End();
                break;
            }
        }
Пример #24
0
        string type = String.Empty; // 对象类型

        #endregion

        #region ASP.NET 事件

        protected void Page_Load(object sender, EventArgs e)
        {
            string db = ConfigurationManager.AppSettings["ExamineDB"];

            op   = RequestData.Get <string>("op");
            id   = RequestData.Get <string>("id");
            paid = RequestData.Get <string>("paid");
            type = RequestData.Get <string>("type");

            DeliveryOrder  ent     = null;
            IList <string> strList = RequestData.GetList <string>("data");

            switch (this.RequestAction)
            {
            case RequestActionEnum.Insert:
            case RequestActionEnum.Create:
                ent     = this.GetPostedData <DeliveryOrder>();
                ent.PId = paid;

                //自动生成流水号
                ent.Number = DataHelper.QueryValue("select " + db + ".dbo.fun_getDeliveryNumber()") + "";

                ent.DoCreate();

                //添加出库商品信息
                InsertPart(strList, ent.Id);

                break;

            default:
                break;
            }

            if (RequestActionString == "getSalesman")
            {
                string   cid      = RequestData.Get <string>("CId");
                Customer customer = Customer.Find(cid);
                if (customer != null)
                {
                    PageState.Add("result", customer.MagUser);
                    PageState.Add("MagId", customer.MagId);
                    PageState.Add("Address", customer.Address);
                    //PageState.Add("Tel", customer.Tel);
                    PageState.Add("Code", customer.Code);
                }
            }
            else if (RequestActionString == "checkdata")
            {
                string productIds  = RequestData.Get <string>("productIds");
                string WarehouseId = RequestData.Get <string>("WarehouseId");
                if (!string.IsNullOrEmpty(productIds))
                {
                    int count = DataHelper.QueryValue <int>("select count(1) from " + db + "..StockInfo where WarehouseId='" + WarehouseId + "' and ProductId in ('" + productIds.Replace(",", "','") + "')");
                    if (count != productIds.Split(',').Length)
                    {
                        PageState.Add("error", "所选商品在指定仓库里没有找到,请重新选择");
                    }
                }
            }
            else if (op != "c" && op != "cs")
            {
                if (!String.IsNullOrEmpty(id))
                {
                    ent = DeliveryOrder.Find(id);
                }

                this.SetFormData(ent);
                this.PageState.Add("State", ent.State);

                if (!String.IsNullOrEmpty(id))
                {
                    //查询子商品
                    string sql = "select Id, PCode as Code, PName as Name, ProductId,Isbn, Guids, Count as OutCount, Unit, Remark from " + db + "..DelieryOrderPart where DId='" + id + "'";
                    PageState.Add("DetailList", DataHelper.QueryDictList(sql));
                }
            }
            PageState.Add("DeliveryMode", SysEnumeration.GetEnumDict("DeliveryMode"));
        }