public OAReturnValue addReview(string json) { OAReturnValue retVal = null; try { string responeJson = OAservice.addReview(json); log.Info("调用结果:" + responeJson); retVal = JsonConvert.DeserializeObject <OAReturnValue>(responeJson); } catch (Exception e) { log.Info(e.Message); log.Info(e.StackTrace); retVal = new OAReturnValue() { ReturnCode = "0", ReturnMsg = "调用接口错误:" + e.Message }; } return(retVal); }
private string mesDeviceToOA(string MaintenanceOrder, string userid) { try { DM_Device_MaintenanceOrder ddm = OrderBO.GetEntity(MaintenanceOrder); OAMaintenanceValues vals = new OAMaintenanceValues() { //fd_sqr = ddm.Submitter, fd_35873fb23e50e6 = ddm.DeviceID, fd_35873fbe8d0dc6 = ddm.DeviceName, fd_35873fccfc1b2e = ddm.Specifications, //fd_35873fee7665f4 = "一般设备", //fd_358740011563be = ddm.PlatformName, //fd_35873ffb652b7c = ddm.PlatformCode, fd_3587400e452102 = ddm.Users, fd_358740337ff230 = "PM11", //ddm.RepairmanClassCode fd_35874030b96ab6 = "日常维修工单", fd_358740e0d20584 = ddm.MaintenanceTeamCode, //必填 fd_36b97eb58c03e2 = ddm.MaintenanceCrew, //维修班组中文必填 fd_35874171b5220c = "520", //ddm.PurchaseGroupCode fd_358742afa63c16 = ddm.Remark, fd_358742c8e0bdd2 = ddm.MaintenanceRequirements, //必填 fd_358742f34c3eec = ddm.MaintenanceDemand, //必填 fd_3587430a1e8e3a = ddm.Maintenancetarget, //fd_scfj = "" }; OAMaintenanceRequest Request = new OAMaintenanceRequest() { docCreator = new OADocCreator() { LoginName = userid }, docStatus = "20", docSubject = SSGlobalConfig.Now.ToString("yyyyMMdd") + "-" + userid + "-提交的维修单号" + MaintenanceOrder + "的维修申请单01", fdKeyword = new List <string>(0), fdTemplateId = "1668b0d39506f074325e68a43ecabc99", flowParam = { }, attachment = new OAAttachment() { fdFileName = "", fdPath = "" }, formValues = vals }; Siemens.Simatic.Web.OaService.CustomJsonConverter custom = new Siemens.Simatic.Web.OaService.CustomJsonConverter() { PropertyNullValueReplaceValue = "" }; string requestJSON = JsonConvert.SerializeObject(Request, custom); //需要作特殊处理 requestJSON = requestJSON.Replace("\"flowParam\":\"\"", "\"flowParam\":{}"); log.Info("发送给OA报文:" + requestJSON); OAReturnValue returnValue = addReview(requestJSON); log.Info("接收给OA消息:" + returnValue.ReturnMsg); DM_Device_MaintenanceOrder ddmo = OrderBO.GetEntity(MaintenanceOrder); if (returnValue.ReturnCode == "1") { ddmo.Attribute04 = SSGlobalConfig.Now.ToString() + "传递成功" + returnValue.ReturnMsg; OrderBO.Update(ddmo); } else { ddmo.Attribute04 = SSGlobalConfig.Now.ToString() + "传递失败" + returnValue.ReturnMsg; OrderBO.Update(ddmo); } return(returnValue.ReturnMsg); } catch (Exception ex) { return(ex.Message); } }