public static supplierDto GetUpdateDMSDTO(Supplier supplier) { supplierDto dto = new supplierDto(); dto.suptCode = supplier.Code; dto.suptName = supplier.Name; dto.supShortName = supplier.ShortName; if (supplier.ContactObjectKey != null) { if (supplier.ContactObject.PersonName != null) { dto.linkMan = supplier.ContactObject.PersonName.DisplayName; } dto.phone = supplier.ContactObject.DefaultPhoneNum; dto.fax = supplier.ContactObject.DefaultFaxNum; if (supplier.ContactObject.DefaultLocation != null && supplier.ContactObject.DefaultLocation.PostalCode != null) { dto.zipCode = supplier.ContactObject.DefaultLocation.PostalCode.PostalCode; } if (supplier.ContactObject.DefaultLocation != null) { dto.address = supplier.ContactObject.DefaultLocation.Address1; } } dto.actionType = 2; // status 100201 有效 100202 无效 dto.status = (supplier.Effective != null && supplier.Effective.IsEffective) ? "100201" : "100202"; return dto; }
// 供应商同步接口 /// <summary> /// 供应商同步接口 /// </summary> /// <param name="service"></param> /// <param name="param"></param> /// <returns></returns> public static supplierDto Do(this PI08ImplService service, supplierDto[] param) { service.Url = PubHelper.GetAddress(service.Url); string entityName = "供应商同步接口"; long svID = -1; if (IsLog) { svID = ProxyLogger.CreateTransferSV(entityName //, EntitySerialization.EntitySerial(bpObj) , Newtonsoft.Json.JsonConvert.SerializeObject(param) , service.GetType().FullName,Newtonsoft.Json.JsonConvert.SerializeObject(service)); } try { var result = service.receive(param); if (svID > 0) { if (result != null ) { //string resultXml = EntitySerialization.EntitySerial(result); string resultXml = Newtonsoft.Json.JsonConvert.SerializeObject(result); ProxyLogger.UpdateTransferSV(svID, resultXml, result.flag == 1, result.errMsg, string.Empty, string.Empty); } else { ProxyLogger.UpdateTransferSV(svID, string.Empty, false, Const_ResultNullMessage, string.Empty, string.Empty); } } return result; } catch (Exception ex) { if (svID > 0) { ProxyLogger.UpdateTransferSV(svID, string.Empty, false, ex.Message, string.Empty, ex.StackTrace); } throw ex; } return null; }
public void Notify(params object[] args) { if (args != null && args.Length != 0 && args[0] is EntityEvent) { BusinessEntity.EntityKey key = ((EntityEvent)args[0]).EntityKey; if (!(key == null)) { Supplier supplier = key.GetEntity() as Supplier; if (PubHelper.IsOrg_Supplier2DMS(supplier)) { bool flag = PubHelper.IsUsedDMSAPI(); if (flag) { if ( PubHelper.IsUpdateDMS(supplier) ) { try { PI08ImplService service = new PI08ImplService(); // service.Url = PubHelper.GetAddress(service.Url); supplierDto dto = new supplierDto(); System.Collections.Generic.List<supplierDto> list = new System.Collections.Generic.List<supplierDto>(); dto.suptCode = supplier.Code; dto.suptName = supplier.Name; dto.supShortName = supplier.ShortName; if (supplier.ContactObjectKey != null) { if (supplier.ContactObject.PersonName != null) { dto.linkMan = supplier.ContactObject.PersonName.DisplayName; } dto.phone = supplier.ContactObject.DefaultPhoneNum; dto.fax = supplier.ContactObject.DefaultFaxNum; if (supplier.ContactObject.DefaultLocation != null && supplier.ContactObject.DefaultLocation.PostalCode != null) { dto.zipCode = supplier.ContactObject.DefaultLocation.PostalCode.PostalCode; } if (supplier.ContactObject.DefaultLocation != null) { dto.address = supplier.ContactObject.DefaultLocation.Address1; } } dto.actionType = 3; // status 100201 有效 100202 无效 dto.status = (supplier.Effective != null && supplier.Effective.IsEffective) ? "100201" : "100202"; list.Add(dto); supplierDto s = service.Do(list.ToArray()); if (s != null && s.flag == 0) { throw new System.ApplicationException(s.errMsg); } } catch (System.Exception e) { throw new System.ApplicationException("调用DMS接口错误:" + e.Message); } } } } } } }
/// <remarks/> public void receiveAsync(supplierDto[] arg0, object userState) { if ((this.receiveOperationCompleted == null)) { this.receiveOperationCompleted = new System.Threading.SendOrPostCallback(this.OnreceiveOperationCompleted); } this.InvokeAsync("receive", new object[] { arg0}, this.receiveOperationCompleted, userState); }
/// <remarks/> public void receiveAsync(supplierDto[] arg0) { this.receiveAsync(arg0, null); }