Example #1
0
        /// <summary>
        /// 调用OA接口服务
        /// </summary>
        /// <returns></returns>
        public string OAService(string jsson)
        {
            //参数1:准入码,参数2:json
            string  OACode = PubFunction.GetOACode();
            string  result = string.Empty;
            string  IsTest = PubFunction.IsOATest();
            ILogger logger = LoggerManager.GetLogger(typeof(CacheManager));

            if (IsTest == "是")//测试环境
            {
                OAWorkflowService4Test.WorkflowServiceToOtherSystemPortTypeClient service = new OAWorkflowService4Test.WorkflowServiceToOtherSystemPortTypeClient();
                try
                {
                    result = service.createWorkflow(OACode, jsson);
                    logger.Error("调用OA审批内网测试接口成功,返回的结果为:" + result);
                }
                catch (Exception ex)
                {
                    logger.Error("调用OA审批内网测试接口出错,错误信息为:" + ex.Message);
                    throw new Exception("调用OA审批内网测试接口出错,错误信息为:" + ex.Message);
                }
            }
            else//生产环境
            {
                OAWorkflowService.WorkflowServiceToOtherSystemPortTypeClient service = new OAWorkflowService.WorkflowServiceToOtherSystemPortTypeClient();
                try
                {
                    result = service.createWorkflow(OACode, jsson);
                    logger.Error("调用OA审批接口成功,返回的结果为:" + result);
                }
                catch (Exception ex)
                {
                    logger.Error("调用OA审批接口出错,错误信息为:" + ex.Message);
                    throw new Exception("调用OA审批接口出错,错误信息为:" + ex.Message);
                }
            }


            //将OA接口返回结果转成对象
            string     OAFlowID = "";
            ResultInfo OAResult = JsonHelper.JsonDeserialize <ResultInfo>(result);

            if (OAResult.type == "1")
            {
                logger.Error("OA接口返回错误,错误信息为:" + OAResult.backmsg);
                throw new Exception("OA接口返回错误,错误信息为:" + OAResult.backmsg);
            }
            else
            {
                //检查结果集
                foreach (ResultList rList in OAResult.resultlist)
                {
                    if (rList.status == "1")
                    {
                        throw new Exception("OA接口返回错误,错误信息为:" + rList.msg);
                        throw new Exception("OA接口返回错误,错误信息为:" + OAResult.backmsg);
                    }
                    OAFlowID = rList.requestid;
                }
            }
            return(OAFlowID);
        }
Example #2
0
        public void Notify(params object[] args)
        {
            if (args == null || args.Length == 0 || !(args[0] is UFSoft.UBF.Business.EntityEvent))
            {
                return;
            }

            //将入口参数列表中第一个参数,转成EntityEvent,并取EntityKey存入key
            UFSoft.UBF.Business.BusinessEntity.EntityKey key = ((UFSoft.UBF.Business.EntityEvent)args[0]).EntityKey;
            //key的有效性判断
            if (key == null)
            {
                return;
            }
            //转成所需实体,同时判断有效性
            //UFIDA.U9.InvDoc.TransferIn.TransferIn transferIn = (UFIDA.U9.InvDoc.TransferIn.TransferIn)key.GetEntity();
            UFIDA.U9.SM.Ship.Ship entity = (UFIDA.U9.SM.Ship.Ship)key.GetEntity();
            if (entity == null)
            {
                return;
            }
            else
            {
                try
                {
                    if (entity.SysState == UFSoft.UBF.PL.Engine.ObjectState.Updated)                                                                                                //更新操作
                    {
                        if (entity.OriginalData.Status == ShipStateEnum.Creates && entity.Status == ShipStateEnum.Approving && entity.DocType.DescFlexField.PrivateDescSeg1 == "1") //提交操作
                        {
                            ILogger log = LoggerManager.GetLogger(typeof(CacheManager));
                            //传送给OA的Json对象
                            Dictionary <string, object> dicResult = new Dictionary <string, object>();
                            //U9用户信息
                            User user = User.Finder.FindByID(Context.LoginUserID);
                            //表单信息
                            Dictionary <string, object>         dicMain  = new Dictionary <string, object>();
                            List <Dictionary <string, object> > liDt     = new List <Dictionary <string, object> >();
                            Dictionary <string, object>         dicValue = new Dictionary <string, object>();
                            #region OA信息
                            BaseInfo baseInfo;
                            if (entity.DescFlexField.PrivateDescSeg7 == "是")
                            {
                                baseInfo = Auctus.Common.Utils.GenerateOABaseInfo(user.Code, PubFunction.GetOAInfoByCode("12"), entity.ID.ToString(), 1, entity.DescFlexField.PrivateDescSeg8, 1, "出货单:" + entity.DocNo);
                            }
                            else
                            {
                                baseInfo = Auctus.Common.Utils.GenerateOABaseInfo(user.Code, PubFunction.GetOAInfoByCode("12"), entity.ID.ToString(), 1, "", 1, "出货单:" + entity.DocNo);
                                //设置OA上下文
                                if (!string.IsNullOrEmpty(entity.DescFlexField.PrivateDescSeg7))
                                {
                                    dicValue = new Dictionary <string, object>();
                                    dicValue.Add("value", entity.DescFlexField.PrivateDescSeg7);
                                    dicMain.Add("gllc", dicValue);
                                }
                            }

                            dicMain = Auctus.Common.Utils.GenerateOAUserInfo(dicMain, user.Code, DateTime.Now.ToString("yyyy-MM-dd"));

                            #endregion
                            #region 表单信息
                            dicValue.Add("value", entity.DocNo);
                            dicMain.Add("dh", dicValue);
                            dicValue = new Dictionary <string, object>();
                            dicValue.Add("value", entity.Org.ID);
                            dicMain.Add("u9zz", dicValue);
                            dicValue = new Dictionary <string, object>();
                            dicValue.Add("value", entity.DocType.Code);
                            dicMain.Add("djlx", dicValue);
                            dicValue = new Dictionary <string, object>();
                            dicValue.Add("value", entity.OrderBy.Name);
                            dicMain.Add("kh", dicValue);
                            dicValue = new Dictionary <string, object>();
                            dicValue.Add("value", entity.TC.Name);
                            dicMain.Add("bz", dicValue);
                            dicValue = new Dictionary <string, object>();
                            dicValue.Add("value", entity.DescFlexField.PubDescSeg3);
                            dicMain.Add("khddh", dicValue);
                            dicValue = new Dictionary <string, object>();
                            dicValue.Add("value", entity.IsPriceIncludeTax ? "1" : "0");
                            dicMain.Add("jghs", dicValue);
                            dicValue = new Dictionary <string, object>();
                            dicValue.Add("value", entity.DescFlexField.PrivateDescSeg1);
                            dicMain.Add("cph", dicValue);
                            dicValue = new Dictionary <string, object>();
                            dicValue.Add("value", entity.ShipConfirmDate.ToString("yyyy-MM-dd"));
                            dicMain.Add("chqrr", dicValue);
                            dicValue = new Dictionary <string, object>();
                            dicValue.Add("value", entity.DescFlexField.PrivateDescSeg2);
                            dicMain.Add("sj", dicValue);
                            dicValue = new Dictionary <string, object>();
                            dicValue.Add("value", entity.DescFlexField.PrivateDescSeg4);
                            dicMain.Add("xh", dicValue);
                            dicValue = new Dictionary <string, object>();
                            dicValue.Add("value", entity.DescFlexField.PrivateDescSeg3);
                            dicMain.Add("sjdh", dicValue);
                            dicValue = new Dictionary <string, object>();
                            dicValue.Add("value", entity.DescFlexField.PrivateDescSeg5);
                            dicMain.Add("kddh", dicValue);
                            dicValue = new Dictionary <string, object>();
                            dicValue.Add("value", entity.ID);
                            dicMain.Add("fpkid", dicValue);

                            foreach (ShipLine item in entity.ShipLines)
                            {
                                Dictionary <string, object> dicDt = new Dictionary <string, object>();

                                dicValue = new Dictionary <string, object>();
                                dicValue.Add("value", item.ID);
                                dicDt.Add("xid", dicValue);
                                dicValue = new Dictionary <string, object>();
                                dicValue.Add("value", item.DonationType.Value + 1);
                                dicDt.Add("mflx", dicValue);
                                dicValue = new Dictionary <string, object>();
                                dicValue.Add("value", item.DocLineNo);
                                dicDt.Add("xh", dicValue);
                                dicValue = new Dictionary <string, object>();
                                dicValue.Add("value", item.ItemInfo.ItemID.ID);
                                dicDt.Add("lpid", dicValue);
                                dicValue = new Dictionary <string, object>();
                                dicValue.Add("value", item.ItemInfo.ItemID.Code);
                                dicDt.Add("lh", dicValue);
                                dicValue = new Dictionary <string, object>();
                                dicValue.Add("value", item.ItemInfo.ItemID.Name);
                                dicDt.Add("pm", dicValue);
                                dicValue = new Dictionary <string, object>();
                                dicValue.Add("value", item.ItemInfo.ItemID.SPECS);
                                dicDt.Add("gg", dicValue);
                                dicValue = new Dictionary <string, object>();
                                dicValue.Add("value", Convert.ToInt32(item.QtyPriceAmount));
                                dicDt.Add("jhcsl", dicValue);
                                dicValue = new Dictionary <string, object>();
                                dicValue.Add("value", Convert.ToInt32(item.QtyPriceAmount));
                                dicDt.Add("sl", dicValue);
                                if (item.LotInfo != null)
                                {
                                    if (item.LotInfo.LotMaster != null)
                                    {
                                        dicValue = new Dictionary <string, object>();
                                        dicValue.Add("value", item.LotInfo.LotMaster.ID);
                                        dicDt.Add("phid", dicValue);
                                    }
                                    dicValue = new Dictionary <string, object>();
                                    dicValue.Add("value", item.LotInfo.LotCode);
                                    dicDt.Add("ph", dicValue);
                                }
                                dicValue = new Dictionary <string, object>();
                                dicValue.Add("value", item.DescFlexField.PubDescSeg3);
                                dicDt.Add("khddh", dicValue);
                                dicValue = new Dictionary <string, object>();
                                dicValue.Add("value", item.CustomerItemCode);
                                dicDt.Add("khlh", dicValue);
                                dicValue = new Dictionary <string, object>();
                                dicValue.Add("value", item.DescFlexField.PubDescSeg2);
                                dicDt.Add("khwlbm", dicValue);
                                dicValue = new Dictionary <string, object>();
                                dicValue.Add("value", item.FinallyPriceTC);
                                dicDt.Add("zzj", dicValue);
                                dicValue = new Dictionary <string, object>();
                                dicValue.Add("value", item.TotalMoneyTC);
                                dicDt.Add("je", dicValue);
                                dicValue = new Dictionary <string, object>();
                                dicValue.Add("value", item.TaxRate);
                                dicDt.Add("sli", dicValue);
                                dicValue = new Dictionary <string, object>();
                                dicValue.Add("value", item.SrcDocNo);
                                dicDt.Add("xsddh", dicValue);
                                if (item.WH != null)
                                {
                                    dicValue = new Dictionary <string, object>();
                                    dicValue.Add("value", item.WH.ID);
                                    dicDt.Add("whid", dicValue);
                                    dicValue = new Dictionary <string, object>();
                                    bool IsExistsLotID = false;
                                    if (item.LotInfo != null)
                                    {
                                        if (item.LotInfo.LotMaster != null)
                                        {
                                            IsExistsLotID = true;
                                        }
                                    }
                                    //构建存储地点、料品ID、批号组合的唯一索引
                                    string uid = item.WH.ID.ToString() + item.ItemInfo.ItemID.ID.ToString();
                                    if (IsExistsLotID)
                                    {
                                        uid += item.LotInfo.LotMaster.ID.ToString();
                                    }
                                    else
                                    {
                                        uid += "0";
                                    }

                                    dicValue.Add("value", uid);
                                    dicDt.Add("ccdd", dicValue);
                                }
                                liDt.Add(dicDt);
                            }
                            #endregion

                            dicResult.Add("base", baseInfo);
                            dicResult.Add("main", dicMain);
                            dicResult.Add("dt1", liDt);
                            List <Dictionary <string, object> > li = new List <Dictionary <string, object> >();
                            li.Add(dicResult);
                            string json = "";
                            json = JsonHelper.GetJsonJS(li);
                            log.Error("出货单JSON数据为:" + json);
                            PubFunction pubFun = new PubFunction();
                            //调用OA接口
                            string OAFlowID = pubFun.OAService(json);
                            //更新返回的流程ID
                            string UpSQL = "";
                            if (entity.DescFlexField.PrivateDescSeg7 == "是")
                            {
                                UpSQL = string.Format(@"UPDATE dbo.SM_Ship SET DescFlexField_PrivateDescSeg8='{0}',DescFlexField_PrivateDescSeg7='' WHERE ID = {1}", OAFlowID, entity.ID.ToString());
                            }
                            else
                            {
                                UpSQL = string.Format(@"UPDATE dbo.SM_Ship SET DescFlexField_PrivateDescSeg8='{0}' WHERE ID = {1}", OAFlowID, entity.ID.ToString());
                            }
                            DataAccessor.RunSQL(DatabaseManager.GetCurrentConnection(), UpSQL, null);
                        }
                    }
                }
                catch (Exception ex)
                {
                    throw new Exception(ex.Message);
                }
            }
        }
Example #3
0
        public void Notify(params object[] args)
        {
            if (args == null || args.Length == 0 || !(args[0] is UFSoft.UBF.Business.EntityEvent))
            {
                return;
            }

            //将入口参数列表中第一个参数,转成EntityEvent,并取EntityKey存入key
            UFSoft.UBF.Business.BusinessEntity.EntityKey key = ((UFSoft.UBF.Business.EntityEvent)args[0]).EntityKey;
            //key的有效性判断
            if (key == null)
            {
                return;
            }
            //转成所需实体,同时判断有效性
            //UFIDA.U9.InvDoc.TransferIn.TransferIn transferIn = (UFIDA.U9.InvDoc.TransferIn.TransferIn)key.GetEntity();
            UFIDA.U9.MO.Complete.CompleteRpt entity = (UFIDA.U9.MO.Complete.CompleteRpt)key.GetEntity();
            if (entity == null)
            {
                return;
            }
            else
            {
                if (entity.Org.Code == "300")
                {
                    try
                    {
                        //校验mes是否完工足够的数量
                        string        DocNo       = entity.DocNo;
                        string        result      = "";
                        string        content     = HttpMethod.PostMethod("http://192.168.30.8:9090/MXQHService/common.asmx/DoBefore", GenPara("ExecPlan", "CompleteRpt", "GetQty", "{WorkOrder:'" + entity.MO.DocNo + "'}"));
                        MesReturnData r           = Newtonsoft.Json.JsonConvert.DeserializeObject <MesReturnData>(content);
                        int           CompleteQty = 0;
                        if (r.data.Count == 0)
                        {
                            CompleteQty = 0;
                        }
                        else
                        {
                            CompleteQty = r.data[0].CompleteQty;
                        }
                        DataParamList dp = new DataParamList();
                        dp.Add(DataParamFactory.Create("DocNo", entity.MO.DocNo, ParameterDirection.Input, DbType.String, 50));
                        dp.Add(DataParamFactory.Create("CompleteQty", CompleteQty, ParameterDirection.Input, DbType.Int32, 64));
                        dp.Add(DataParamFactory.CreateOutput("Result", DbType.String));
                        DataAccessor.RunSP("sp_Auctus_BE_MOCompleteQtyAU", dp);
                        result = dp["Result"].Value.ToString();
                        if (result != "1")
                        {
                            throw new Exception(result);
                        }

                        //流程触发到OA
                        if (entity.DocState == UFIDA.U9.MO.Enums.CompleteRptStateEnum.Approving && entity.OriginalData.DocState == UFIDA.U9.MO.Enums.CompleteRptStateEnum.Opened && entity.DocType.DescFlexField.PrivateDescSeg1 == "1")
                        {
                            Dictionary <string, object> dicResult = new Dictionary <string, object>();
                            Dictionary <string, object> dicMain   = new Dictionary <string, object>();
                            User user = User.Finder.FindByID(Context.LoginUserID);//U9用户信息
                            #region OA信息
                            BaseInfo baseInfo;
                            if (entity.DescFlexField.PrivateDescSeg3 == "是")//驳回后提交
                            {
                                baseInfo = Auctus.Common.Utils.GenerateOABaseInfo(user.Code, PubFunction.GetOAInfoByCode("10"), entity.ID.ToString(), 1, entity.DescFlexField.PrivateDescSeg2, 1, "完工报告:" + entity.DocNo);
                            }
                            else//非驳回提交
                            {
                                baseInfo = Auctus.Common.Utils.GenerateOABaseInfo(user.Code, PubFunction.GetOAInfoByCode("10"), entity.ID.ToString(), 1, "", 1, "完工报告:" + entity.DocNo);
                            }
                            #endregion
                            dicMain = GenerateMainInfo(entity, user.Code);
                            dicResult.Add("base", baseInfo);
                            dicResult.Add("main", dicMain);
                            List <Dictionary <string, object> > li = new List <Dictionary <string, object> >();
                            li.Add(dicResult);
                            string json = JsonHelper.GetJsonJS(li);
                            Utils.LogError("完工报告JSON");
                            Utils.LogError(json);
                            PubFunction pubFun   = new PubFunction();
                            string      OAFlowID = pubFun.OAService(json);
                            //更新扩展字段:OA流程ID和是否驳回
                            string sql = string.Format("update MO_CompleteRpt set DescFlexField_PrivateDescSeg3='否',DescFlexField_PrivateDescSeg2='{0}' where ID={1}", OAFlowID, entity.ID);
                            DataAccessor.RunSQL(DatabaseManager.GetCurrentConnection(), sql, null);//更新sql
                        }
                    }
                    catch (Exception ex)
                    {
                        throw new Exception(ex.Message);
                    }
                }
            }
        }
Example #4
0
        public void Notify(params object[] args)
        {
            if (args == null || args.Length == 0 || !(args[0] is UFSoft.UBF.Business.EntityEvent))
            {
                return;
            }

            //将入口参数列表中第一个参数,转成EntityEvent,并取EntityKey存入key
            UFSoft.UBF.Business.BusinessEntity.EntityKey key = ((UFSoft.UBF.Business.EntityEvent)args[0]).EntityKey;
            //key的有效性判断
            if (key == null)
            {
                return;
            }
            //转成所需实体,同时判断有效性
            //UFIDA.U9.InvDoc.TransferIn.TransferIn transferIn = (UFIDA.U9.InvDoc.TransferIn.TransferIn)key.GetEntity();
            UFIDA.U9.MO.MO.MO entity = (UFIDA.U9.MO.MO.MO)key.GetEntity();
            if (entity == null)
            {
                return;
            }
            else
            {
                try
                {
                    if (entity.SysState == UFSoft.UBF.PL.Engine.ObjectState.Updated)//更新操作
                    {
                        ILogger log = LoggerManager.GetLogger(typeof(CacheManager));
                        //提交操作
                        if (entity.OriginalData.DocState == MOStateEnum.Opened && entity.DocState == MOStateEnum.Approving && entity.DocType.DescFlexField.PrivateDescSeg1 == "1")
                        {
                            Dictionary <string, object> dicResult = new Dictionary <string, object>();
                            //获取工单相关信息
                            DataSet ds  = new DataSet();
                            string  sql = string.Format("select * from v_Cust_MOInfo where DocNo='{0}' and rn=1", entity.DocNo);
                            DataAccessor.RunSQL(DatabaseManager.GetCurrentConnection(), sql, null, out ds);
                            //表单信息
                            Dictionary <string, object> dicMain  = new Dictionary <string, object>();
                            Dictionary <string, object> dicValue = new Dictionary <string, object>();
                            User user = User.Finder.FindByID(Context.LoginUserID);//U9用户信息
                            #region OA信息
                            BaseInfo baseInfo;
                            if (entity.DescFlexField.PrivateDescSeg8 == "是")
                            {
                                baseInfo = Auctus.Common.Utils.GenerateOABaseInfo(user.Code, PubFunction.GetOAInfoByCode("06"), entity.ID.ToString(), 1, entity.DescFlexField.PrivateDescSeg7, 1, "生产订单审批-订单号:" + entity.DocNo);
                            }
                            else
                            {
                                baseInfo = Auctus.Common.Utils.GenerateOABaseInfo(user.Code, PubFunction.GetOAInfoByCode("06"), entity.ID.ToString(), 1, "", 1, "生产订单审批-订单号:" + entity.DocNo);
                                //设置OA上下文
                                if (!string.IsNullOrEmpty(entity.DescFlexField.PrivateDescSeg7))
                                {
                                    dicValue = new Dictionary <string, object>();
                                    dicValue.Add("value", entity.DescFlexField.PrivateDescSeg7);
                                    dicMain.Add("gllc", dicValue);
                                }
                            }

                            dicMain = Auctus.Common.Utils.GenerateOAUserInfo(dicMain, user.Code, DateTime.Now.ToString("yyyy-MM-dd"));

                            #endregion
                            #region 工单信息
                            //dicValue = new Dictionary<string, object>();
                            //dicValue.Add("value", entity.CreatedBy);
                            //dicMain.Add("CreateBy", dicValue);
                            dicValue = new Dictionary <string, object>();
                            dicValue.Add("value", entity.DocType.Code);
                            dicMain.Add("DocType", dicValue);
                            dicValue = new Dictionary <string, object>();
                            dicValue.Add("value", entity.DocNo);
                            dicMain.Add("DocNo", dicValue);
                            dicValue = new Dictionary <string, object>();
                            dicValue.Add("value", entity.Department.Name);
                            dicMain.Add("Dept", dicValue);
                            dicValue = new Dictionary <string, object>();
                            dicValue.Add("value", entity.ItemMaster.Code);
                            dicMain.Add("Code", dicValue);
                            dicValue = new Dictionary <string, object>();
                            dicValue.Add("value", entity.ItemMaster.Name);
                            dicMain.Add("Name", dicValue);
                            dicValue = new Dictionary <string, object>();
                            dicValue.Add("value", entity.ItemMaster.SPECS);
                            dicMain.Add("Specs", dicValue);
                            dicValue = new Dictionary <string, object>();
                            dicValue.Add("value", Convert.ToInt32(entity.ProductQty));
                            dicMain.Add("ProductQty", dicValue);
                            dicValue = new Dictionary <string, object>();
                            dicValue.Add("value", entity.StartDate.ToString("yyyy-MM-dd"));
                            dicMain.Add("StartDate", dicValue);
                            dicValue = new Dictionary <string, object>();
                            dicValue.Add("value", entity.CompleteDate.ToString("yyyy-MM-dd"));
                            dicMain.Add("CompleteDate", dicValue);
                            dicValue = new Dictionary <string, object>();
                            dicValue.Add("value", entity.SCVWh.Name);
                            dicMain.Add("Wh", dicValue);
                            dicValue = new Dictionary <string, object>();
                            dicValue.Add("value", entity.ID.ToString());
                            dicMain.Add("u9id", dicValue);
                            dicValue = new Dictionary <string, object>();
                            dicValue.Add("value", entity.Org.ID.ToString());
                            dicMain.Add("u9zz", dicValue);

                            if (ds.Tables.Count == 0)
                            {
                                throw new Exception("工单" + entity.DocNo + "信息在视图中找不到,请检查v_Cust_MOInfo视图!");
                            }
                            foreach (DataRow dr in ds.Tables[0].Rows)
                            {
                                dicValue = new Dictionary <string, object>();
                                dicValue.Add("value", dr["OriginalLineName"]);
                                dicMain.Add("Line", dicValue);
                                dicValue = new Dictionary <string, object>();
                                if (dr["SODocNo"] == DBNull.Value)
                                {
                                    dicMain.Add("DemandCode", null);
                                }
                                else
                                {
                                    dicValue.Add("value", dr["SODocNo"]);
                                    dicMain.Add("DemandCode", dicValue);
                                }

                                if (dr["SODeliveryDate"] == DBNull.Value)
                                {
                                    dicMain.Add("SODeliverDate", null);
                                }
                                else
                                {
                                    dicValue = new Dictionary <string, object>();
                                    if (string.IsNullOrEmpty(dr["SODeliveryDate"].ToString()))
                                    {
                                        dicMain.Add("SODeliverDate", null);
                                    }
                                    else
                                    {
                                        DateTime d = new DateTime();
                                        if (DateTime.TryParse(dr["SODeliveryDate"].ToString(), out d))
                                        {
                                            dicValue.Add("value", d.ToString("yyyy-MM-dd"));
                                            dicMain.Add("SODeliverDate", dicValue);
                                        }
                                        else
                                        {
                                            throw new Exception("销售交期:" + dr["SODeliveryDate"].ToString() + "不是正确的日期格式!");
                                        }
                                    }
                                }
                                dicValue = new Dictionary <string, object>();
                                if (dr["SODocNo"] == DBNull.Value)
                                {
                                    dicValue.Add("value", dr["SO"]);
                                    dicMain.Add("SODocNo", dicValue);
                                }
                                else
                                {
                                    dicValue.Add("value", dr["SODocNo"]);
                                    dicMain.Add("SODocNo", dicValue);
                                }
                                dicValue = new Dictionary <string, object>();
                                dicValue.Add("value", dr["MRPName"].ToString());
                                dicMain.Add("MRP", dicValue);
                            }
                            #endregion
                            dicResult.Add("base", baseInfo);
                            dicResult.Add("main", dicMain);
                            List <Dictionary <string, object> > li = new List <Dictionary <string, object> >();
                            li.Add(dicResult);
                            string json = "";
                            json = JsonHelper.GetJsonJS(li);
                            log.Error("工单JSON数据为:" + json);
                            PubFunction pubFun = new PubFunction();
                            //调用OA接口
                            string OAFlowID = pubFun.OAService(json);
                            //更新返回的流程ID
                            string UpSQL = "";
                            if (entity.DescFlexField.PrivateDescSeg8 == "是")
                            {
                                UpSQL = string.Format(@"UPDATE dbo.MO_MO SET DescFlexField_PrivateDescSeg7='{0}',DescFlexField_PrivateDescSeg8='' WHERE ID = {1}", OAFlowID, entity.ID.ToString());
                            }
                            else
                            {
                                UpSQL = string.Format(@"UPDATE dbo.MO_MO SET DescFlexField_PrivateDescSeg7='{0}' WHERE ID = {1}", OAFlowID, entity.ID.ToString());
                            }
                            DataAccessor.RunSQL(DatabaseManager.GetCurrentConnection(), UpSQL, null);
                        }
                    }
                }
                catch (Exception ex)
                {
                    throw new Exception(ex.Message);
                }
            }
        }