예제 #1
0
        static void Main(string[] args)
        {
            IDdOper ddOper = DdOperator.GetDdApi();

            ddOper.CorpId     = "ding99dd341fc99a25eb";
            ddOper.CorpSecret = "szdxoAP2Wp2knwzsDcsDYvd_qLAjvx0YANa1RH4hOU-O8VxENo5hYE5glb_CsQg0";
            ddOper.AgentID    = "132907517";

            ApproveOper ao = new ApproveOper(ddOper);
            var         re = ao.GetApprove("7b8ec3ef-f5c3-4ec8-8482-4e7210f7db50");

            re.FormComponentValues.ForEach(p =>
            {
                if (p.Name == "评分")
                {
                    int Rating = 3;
                    if (p.Value != null)
                    {
                        if (p.Value.IndexOf('1') > 0)
                        {
                            Rating = 1;
                        }
                        else if (p.Value.IndexOf('2') > 0)
                        {
                            Rating = 2;
                        }
                        else if (p.Value.IndexOf('3') > 0)
                        {
                            Rating = 3;
                        }
                        else if (p.Value.IndexOf('4') > 0)
                        {
                            Rating = 4;
                        }
                        else if (p.Value.IndexOf('5') > 0)
                        {
                            Rating = 5;
                        }
                    }
                    ;
                    int i = Rating;
                }

                if (p.Name == "样衣图片")
                {
                    var list    = JsonHelper.JsonToList <string>(p.Value);
                    var url     = list[0];
                    string name = url.Substring(url.LastIndexOf('/') + 1);

                    var f = HttpHelper.DownloadData(list[0]);


                    File.WriteAllBytes("d:\\p1.jpg", f);
                    Console.Write("down finsh");
                }
            });
            Console.Write("ok");
        }
예제 #2
0
        public void AgreeFinsh(string pid)
        {
            ApproveOper ao = new ApproveOper(_oper);
            var         re = ao.GetApprove(pid);
            var         po = sdc.ProofOrders.SingleOrDefault(p => p.DdFinshApprovalCode == pid);

            if (po != null)
            {
                re.FormComponentValues.ForEach(p =>
                {
                    if (p.Name == "评分")
                    {
                        int Rating = 3;
                        if (p.Value != null)
                        {
                            if (p.Value.IndexOf('1') > 0)
                            {
                                Rating = 1;
                            }
                            else if (p.Value.IndexOf('2') > 0)
                            {
                                Rating = 2;
                            }
                            else if (p.Value.IndexOf('3') > 0)
                            {
                                Rating = 3;
                            }
                            else if (p.Value.IndexOf('4') > 0)
                            {
                                Rating = 4;
                            }
                            else if (p.Value.IndexOf('5') > 0)
                            {
                                Rating = 5;
                            }
                        }
                        ;
                        po.Rating = Rating;
                        po.ProofTasks.ForEach(pt => pt.Rating = Rating);
                    }

                    if (p.Name == "样衣图片")
                    {
                        var picList = JsonHelper.JsonToList <string>(p.Value);
                        picList.ForEach(f =>
                        {
                            var fdata       = HttpHelper.DownloadData(f);
                            string name     = f.Substring(f.LastIndexOf('/') + 1);
                            string fullname = po.ProofStyle.ProofStyleId + "_" + name;
                            File.WriteAllBytes(SysPath + PicPath + fullname, fdata);
                            ProofFile pf = new ProofFile
                            {
                                FullName     = fullname,
                                DisplayName  = name,
                                Url          = PicPath + fullname,
                                FileType     = SG.Interface.Sys.FileType.Pic,
                                ProofStyleId = po.ProofStyle.ProofStyleId,
                            };
                            pf.SetCreateUser("钉钉审批");
                            po.ProofStyle.ProofFiles.Add(pf);
                        });
                    }
                });
                po.ProofStatus = ProofStatus.完成;
                sdc.SaveChanges();
            }
        }