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)) { Customer customer = key.GetEntity() as Customer; if (PubHelper.IsOrg_Customer2DMS(customer)) { bool flag = PubHelper.IsUsedDMSAPI(); if (flag) { //if ((customer.CustomerCategoryKey != null && (customer.CustomerCategory.Code == "101007" || customer.CustomerCategory.Code == "101006")) // || (customer.CustomerCategory != null // && customer.CustomerCategory.DescFlexField != null // && customer.CustomerCategory.DescFlexField.PrivateDescSeg1.GetBool() // ) // ) if ( PubHelper.IsUpdateDMS(customer) ) { try { SI08ImplService service = new SI08ImplService(); // service.Url = PubHelper.GetAddress(service.Url); System.Collections.Generic.List <dealerInfoDto> list = new System.Collections.Generic.List <dealerInfoDto>(); dealerInfoDto dto = new dealerInfoDto(); dto.dealerCode = customer.Code; dto.dealerName = customer.Name; dto.dealerShortName = customer.ShortName; dto.companyCode = customer.Code; dto.companyName = customer.Name; dto.companyShortName = customer.ShortName; if (customer.CustomerCategoryKey != null) { dto.dealerType = int.Parse(customer.CustomerCategory.Code); } dto.actionType = 3; // status 100201 有效 100202 无效 dto.status = (customer.Effective != null && customer.Effective.IsEffective) ? "100201" : "100202"; list.Add(dto); dealerInfoDto d = service.Do(list.ToArray()); if (d != null && d.flag == 0) { throw new BusinessException(d.errMsg); } } catch (System.Exception e) { throw new BusinessException("调用DMS接口错误:" + e.Message); } } } } } } }
public static bool IsUpdateDMS(SupplySource supplierItem) { return(supplierItem != null && supplierItem.SupplierInfo != null && supplierItem.SupplierInfo.Supplier != null && PubHelper.IsUpdateDMS(supplierItem.SupplierInfo.Supplier) ); }
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)) { Customer customer = key.GetEntity() as Customer; if (PubHelper.IsOrg_Customer2DMS(customer)) { bool flag = PubHelper.IsUsedDMSAPI(); if (flag) { if (customer.CustomerCategoryKey == null) { throw new BusinessException("分类不可为空"); } //if ((customer.CustomerCategoryKey != null && (customer.CustomerCategory.Code == "101007" || customer.CustomerCategory.Code == "101006")) // || (customer.CustomerCategory != null // && customer.CustomerCategory.DescFlexField != null // && customer.CustomerCategory.DescFlexField.PrivateDescSeg1.GetBool() // ) // ) if ( PubHelper.IsUpdateDMS(customer) ) { try { SI08ImplService service = new SI08ImplService(); // service.Url = PubHelper.GetAddress(service.Url); System.Collections.Generic.List <dealerInfoDto> list = new System.Collections.Generic.List <dealerInfoDto>(); dealerInfoDto dto = GetUpdateDMSDTO(customer); list.Add(dto); dealerInfoDto d = service.Do(list.ToArray()); if (d != null && d.flag == 0) { throw new BusinessException(d.errMsg); } } catch (System.Exception e) { throw new BusinessException("调用DMS接口错误:" + e.Message); } } } } } } }
public static bool IsUpdateDMS(TransLine transline, out Supplier supt) { supt = null; //return transline.Wh != null && transline.Wh.Code.StartsWith("SHBJ"); if (transline.Wh != null && PubHelper.IsWarehouse2DMS(transline.Wh) //&& PubHelper.IsUpdateDMS(transline.SupplierInfo) ) { //// 批次供应商 //string suptCode = transline.LotInfo.LotMaster_EntityID.DescFlexSegments.PrivateDescSeg1; //if (suptCode.IsNotNullOrWhiteSpace()) //{ // Supplier supt = Supplier.Finder.Find("Code=@Code" // , new OqlParam(suptCode) // ); // if (PubHelper.IsUpdateDMS(supt)) // { // return true; // } //} // 刨除VMI结算 if (IsUpdateWhqoh(transline)) { // 如果不是DMS的出货单,才更新DMS; if (!IsDMSShipment(transline)) { // 如果存在货源表 bool bl = PubHelper.IsUpdateDMS(transline.LotInfo, out supt); if (bl) { SupplySource supplySource = SupplySource.Finder.Find("ItemInfo.ItemID.Code=@ItemCode and SupplierInfo.Supplier.Code=@SuptCode" , new OqlParam(transline.ItemInfo.ItemID.Code) , new OqlParam(supt.Code) ); if (supplySource != null) { return(SupplySourceInserted.IsUpdateDMS(supplySource)); } } } } } return(false); }
private static bool IsDMSShipment(TransLine transline) { if (transline.DocLine != null && transline.DocLine.EntityID > 0 && transline.DocLine.EntityType == typeof(ShipLine).FullName ) { ShipLine shipline = ShipLine.Finder.FindByID(transline.DocLine.EntityID); if (PubHelper.IsUpdateDMS(shipline)) { return(true); } } return(false); }
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); System.Collections.Generic.List <supplierDto> list = new System.Collections.Generic.List <supplierDto>(); supplierDto dto = GetUpdateDMSDTO(supplier); list.Add(dto); supplierDto s = service.Do(list.ToArray()); if (s != null && s.flag == 0) { throw new BusinessException(s.errMsg); } } catch (System.Exception e) { throw new BusinessException("调用DMS接口错误:" + e.Message); } } } } } } }
public static bool IsUpdateDMS(LotInfo lotinfo, out Supplier supt) { supt = null; if (lotinfo != null && lotinfo.LotMaster_EntityID != null ) { string suptCode = lotinfo.LotMaster_EntityID.DescFlexSegments.PrivateDescSeg1; if (suptCode.IsNotNullOrWhiteSpace()) { supt = Supplier.Finder.Find("Code=@Code" , new OqlParam(suptCode) ); if (PubHelper.IsUpdateDMS(supt)) { return(true); } } } return(false); }
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 = 1; // 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 BusinessException(s.errMsg); } } catch (System.Exception e) { throw new BusinessException("调用DMS接口错误:" + e.Message); } } } } } } }
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)) { dicAccountDTO = new Dictionary <long, accountReturnDto>(); APBillHead APbillhead = key.GetEntity() as APBillHead; //if (voucher.Org.Code == "20") if (PubHelper.IsOrg_Finance2DMS()) { if (APbillhead.OriginalData.DocStatus == BillStatusEnum.Approving && APbillhead.DocStatus == BillStatusEnum.Approved) { //SI05ImplService service = new SI05ImplService(); // service.Url = PubHelper.GetAddress(service.Url); foreach (APBillLine line in APbillhead.APBillLines) { if (line.SrcDocType == APBillSrcDocTypeEnum.RMA && line.SrcBillLineID > 0) { RMALine srcline = RMALine.Finder.FindByID(line.SrcBillLineID); if (srcline != null) { ShipLine shipline = null; if (srcline.SrcShipLine != null ) { shipline = srcline.SrcShipLine; } if ((shipline == null && srcline.RMA.DescFlexField.PubDescSeg5.IsNotNullOrWhiteSpace() ) || (shipline != null && PubHelper.IsUpdateDMS(shipline) ) ) { accountReturnDto dto = GetAccountDTO(shipline); if (dto != null) { //accountReturnDto dto = new accountReturnDto(); dto.dealerCode = srcline.RMA.Customer.Customer.Code; dto.DMSShipNo = srcline.RMA.DescFlexField.PrivateDescSeg1; dto.dmsSaleNo = srcline.RMA.DescFlexField.PubDescSeg5; dto.earnestMoney = srcline.RMA.DescFlexField.PubDescSeg13; dto.deposit = srcline.RMA.DescFlexField.PubDescSeg21; dto.shipMoney = srcline.RMA.DescFlexField.PubDescSeg14; //if (srcline.RMA.Customer.Customer.CustomerCategoryKey != null) //{ // dto.customerType = srcline.RMA.Customer.Customer.CustomerCategory.Code; //} if (Context.LoginOrg.Code == PubHelper.Const_OrgCode_Electric) { // 电动车只有服务站 dto.customerType = "101006"; } else { if (srcline.RMA.Customer.Customer.CustomerCategoryKey != null) { dto.customerType = srcline.RMA.Customer.Customer.CustomerCategory.Code; } } dto.vin = srcline.RMA.DescFlexField.PubDescSeg12; dto.amount = double.Parse((line.APOCMoney.NonTax + line.APOCMoney.GoodsTax).ToString()); dto.operaTionType = "1"; } } } } } try { if (dicAccountDTO != null && dicAccountDTO.Count > 0 ) { foreach (accountReturnDto dto in dicAccountDTO.Values) { if (dto != null && dto.amount != 0.0 ) { SI05ImplService service = new SI05ImplService(); accountReturnDto c = service.Do(dto); if (c != null && c.flag == 0) { throw new BusinessException(c.errMsg); } } } } } catch (System.Exception e) { throw new BusinessException("调用DMS接口错误:" + e.Message); } } } } } }
public void Notify(params object[] args) { if (args != null && args.Length != 0 && args[0] is EntityEvent) { BusinessEntity.EntityKey key = ((EntityEvent)args[0]).EntityKey; // 删除不作处理,审核、弃审才处理 return; if (!(key == null)) { Voucher voucher = key.GetEntity() as Voucher; //if (voucher.Org.Code == "20") if (PubHelper.IsOrg_Finance2DMS()) { bool flag = PubHelper.IsUsedDMSAPI(); if (flag) { // 不审核的,都不更新DMS,删除时肯定也不应该修改; if (voucher.VoucherStatus == VoucherStatus.Approved) { SI04ImplService service = new SI04ImplService(); // service.Url = PubHelper.GetAddress(service.Url); using (System.Collections.Generic.IEnumerator <IPersistableObject> enumerator = voucher.Entries.DelLists.GetEnumerator()) { while (enumerator.MoveNext()) { Entry entry = (Entry)enumerator.Current; if (entry.AccountKey != null && (entry.Account.Segment1.StartsWith("22410401") || entry.Account.Segment1.StartsWith("1122010303") || entry.Account.Segment1.StartsWith("1122010101") || entry.Account.Segment1.StartsWith("1122010301") || entry.Account.Segment1.StartsWith("2241030801") || entry.Account.Segment1 == "2241030803" || entry.Account.Segment1 == "1122010302" || entry.Account.Segment1 == "2241030901")) { if (entry.AccountedCr != 0) { Customer cust = Customer.Finder.Find(string.Format("Org={0} and Code='{1}'", Context.LoginOrg.ID.ToString(), entry.Account.Segment3), new OqlParam[0]); if (PubHelper.IsUpdateDMS(cust)) { try { accountInfoDto dto = new accountInfoDto(); dto.dealerCode = entry.Account.Segment3; dto.creadNo = voucher.VoucherDisplayCode; dto.invokeTime = System.DateTime.Now; dto.UNineCreateUser = voucher.CreatedBy; dto.remark = entry.Abstracts; dto.changeType = ((entry.AccountedCr > 0) ? 0 : 1); if (entry.Account.Segment1.StartsWith("22410401") || entry.Account.Segment1 == "1122010302") { dto.operaTionType = "DJ"; } else if (entry.Account.Segment1.StartsWith("1122010101")) { dto.operaTionType = "FCK"; } else if (entry.Account.Segment1 == "1122010301") { dto.operaTionType = "CBXY"; } else if (entry.Account.Segment1 == "2241030801" || entry.Account.Segment1 == "2241030803") { dto.operaTionType = "BZJ"; } else if (entry.Account.Segment1 == "12210203") { dto.operaTionType = "SBXY"; } else { dto.operaTionType = "FL"; } dto.amount = double.Parse(System.Math.Abs(entry.AccountedCr).ToString()); //Customer cust = Customer.Finder.Find(string.Format("Org={0} and Code='{1}'", Context.LoginOrg.ID.ToString(), entry.Account.Segment3), new OqlParam[0]); if (Context.LoginOrg.Code == PubHelper.Const_OrgCode_Electric) { // 电动车只有服务站 dto.customerType = "101006"; } else { if (cust != null && cust.CustomerCategoryKey != null) { dto.customerType = cust.CustomerCategory.Code; } } ILogger logger = LoggerManager.GetLogger(typeof(Voucher)); logger.Info(string.Format("删除 dealerCode={0},creadNo={1},invokeTime={2},UNineCreateUser={3},remark={4},changeType={5},operaTionType={6},amount={7},customerType={8}", new object[] { dto.dealerCode, dto.creadNo, dto.invokeTime, dto.UNineCreateUser, dto.remark, dto.changeType, dto.operaTionType, dto.amount.ToString(), dto.customerType }), new object[0]); accountInfoDto c = service.Do(dto); if (c != null && c.flag == 0) { throw new BusinessException(c.errMsg); } } catch (System.Exception e) { throw new BusinessException("调用DMS接口错误:" + e.Message); } } } } } } } } } } } }
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)) { Voucher voucher = key.GetEntity() as Voucher; //if (voucher.Org.Code == "20") if (PubHelper.IsOrg_Finance2DMS()) { bool flag = PubHelper.IsUsedDMSAPI(); if (flag) { if ((voucher.OriginalData.VoucherStatus == VoucherStatus.Approving || voucher.OriginalData.VoucherStatus == VoucherStatus.Open ) && voucher.VoucherStatus == VoucherStatus.Approved) { SI04ImplService service = new SI04ImplService(); // service.Url = PubHelper.GetAddress(service.Url); foreach (Entry entry in voucher.Entries) { //if(entry.AccountKey != null && (entry.Account.Segment1.StartsWith("22410401") || entry.Account.Segment1.StartsWith("1122010303") || entry.Account.Segment1.StartsWith("1122010101") || entry.Account.Segment1.StartsWith("1122010301") || entry.Account.Segment1.StartsWith("2241030801") || entry.Account.Segment1 == "2241030803" || entry.Account.Segment1 == "1122010302" || entry.Account.Segment1 == "2241030901")) // 这里只处理打款(回款) 业务(即,账号增加;减少 在应收应付里做) // operaTionType账户类型;现金、三包 // 现金,DJ(定金);三包,CBXY(三包信用) string dmsOperationType = GetDMSOperationType(entry); //if (IsUpdateDMS(entry)) if (dmsOperationType.IsNotNullOrWhiteSpace()) { //if (entry.AccountedCr != 0) // Cr贷、Dr借 if (entry.AccountedCr != 0 // || entry.AccountedDr != 0 ) { Customer cust = Customer.Finder.Find(string.Format("Org={0} and Code='{1}'", Context.LoginOrg.ID.ToString(), entry.Account.Segment3), new OqlParam[0]); if (PubHelper.IsUpdateDMS(cust)) { try { accountInfoDto dto = new accountInfoDto(); dto.dealerCode = entry.Account.Segment3; dto.creadNo = voucher.VoucherDisplayCode; dto.invokeTime = System.DateTime.Now; dto.UNineCreateUser = voucher.CreatedBy; dto.remark = entry.Abstracts; dto.changeType = ((entry.AccountedCr > 0) ? 1 : 0); // operaTionType账户类型;现金、三包 // 现金,DJ(定金);三包,SBXY(三包信用) //if (entry.Account.Segment1.StartsWith("22410401") || entry.Account.Segment1 == "1122010302") //{ // dto.operaTionType = "DJ"; //} //else if (entry.Account.Segment1.StartsWith("1122010101")) //{ // dto.operaTionType = "FCK"; //} //else if (entry.Account.Segment1 == "1122010301") //{ // dto.operaTionType = "CBXY"; //} //else if (entry.Account.Segment1 == "2241030801" || entry.Account.Segment1 == "2241030803") //{ // dto.operaTionType = "BZJ"; //} //else if (entry.Account.Segment1 == "12210203") //{ // dto.operaTionType = "SBXY"; //} //else //{ // dto.operaTionType = "FL"; //} dto.operaTionType = dmsOperationType; dto.amount = double.Parse(System.Math.Abs(entry.AccountedCr).ToString()); if (Context.LoginOrg.Code == PubHelper.Const_OrgCode_Electric) { // 电动车只有服务站 dto.customerType = "101006"; } else { if (cust != null && cust.CustomerCategoryKey != null) { dto.customerType = cust.CustomerCategory.Code; } } ILogger logger = LoggerManager.GetLogger(typeof(Voucher)); logger.Info(string.Format("审核 dealerCode={0},creadNo={1},invokeTime={2},UNineCreateUser={3},remark={4},changeType={5},operaTionType={6},amount={7},customerType={8}", new object[] { dto.dealerCode, dto.creadNo, dto.invokeTime, dto.UNineCreateUser, dto.remark, dto.changeType, dto.operaTionType, dto.amount.ToString(), dto.customerType }), new object[0]); accountInfoDto c = service.Do(dto); if (c != null && c.flag == 0) { throw new BusinessException(c.errMsg); } } catch (System.Exception e) { throw new BusinessException("调用DMS接口错误:" + e.Message); } } } } } } else if (voucher.OriginalData.VoucherStatus == VoucherStatus.Approved && (voucher.VoucherStatus == VoucherStatus.Approving || voucher.VoucherStatus == VoucherStatus.Open ) ) { SI04ImplService service = new SI04ImplService(); // service.Url = PubHelper.GetAddress(service.Url); foreach (Entry entry in voucher.Entries) { //if (entry.AccountKey != null && (entry.Account.Segment1.StartsWith("22410401") || entry.Account.Segment1.StartsWith("1122010303") || entry.Account.Segment1.StartsWith("1122010101") || entry.Account.Segment1.StartsWith("1122010301") || entry.Account.Segment1.StartsWith("2241030801") || entry.Account.Segment1 == "2241030803" || entry.Account.Segment1 == "1122010302" || entry.Account.Segment1 == "2241030901")) // 这里只处理打款(回款) 业务(即,账号增加;减少 在应收应付里做) // operaTionType账户类型;现金、三包 // 现金,DJ(定金);三包,CBXY(三包信用) string dmsOperationType = GetDMSOperationType(entry); //if (IsUpdateDMS(entry)) if (dmsOperationType.IsNotNullOrWhiteSpace()) { if (entry.AccountedCr != 0) { Customer cust = Customer.Finder.Find(string.Format("Org={0} and Code='{1}'", Context.LoginOrg.ID.ToString(), entry.Account.Segment3), new OqlParam[0]); if (PubHelper.IsUpdateDMS(cust)) { try { accountInfoDto dto = new accountInfoDto(); dto.dealerCode = entry.Account.Segment3; dto.creadNo = voucher.VoucherDisplayCode; dto.invokeTime = System.DateTime.Now; dto.UNineCreateUser = voucher.CreatedBy; dto.remark = entry.Abstracts; dto.changeType = ((entry.AccountedCr > 0) ? 0 : 1); //if (entry.Account.Segment1.StartsWith("22410401") || entry.Account.Segment1 == "1122010302") //{ // dto.operaTionType = "DJ"; //} //else if (entry.Account.Segment1.StartsWith("1122010101")) //{ // dto.operaTionType = "FCK"; //} //else if (entry.Account.Segment1 == "1122010301") //{ // dto.operaTionType = "CBXY"; //} //else if (entry.Account.Segment1 == "2241030801" || entry.Account.Segment1 == "2241030803") //{ // dto.operaTionType = "BZJ"; //} //else if (entry.Account.Segment1 == "12210203") //{ // dto.operaTionType = "SBXY"; //} //else //{ // dto.operaTionType = "FL"; //} dto.operaTionType = dmsOperationType; dto.amount = double.Parse(System.Math.Abs(entry.AccountedCr).ToString()); //Customer cust = Customer.Finder.Find(string.Format("Org={0} and Code='{1}'", Context.LoginOrg.ID.ToString(), entry.Account.Segment3), new OqlParam[0]); //if (cust != null && cust.CustomerCategoryKey != null) //{ // dto.customerType = cust.CustomerCategory.Code; //} if (Context.LoginOrg.Code == PubHelper.Const_OrgCode_Electric) { // 电动车只有服务站 dto.customerType = "101006"; } else { if (cust != null && cust.CustomerCategoryKey != null) { dto.customerType = cust.CustomerCategory.Code; } } ILogger logger = LoggerManager.GetLogger(typeof(Voucher)); logger.Info(string.Format("弃审 dealerCode={0},creadNo={1},invokeTime={2},UNineCreateUser={3},remark={4},changeType={5},operaTionType={6},amount={7},customerType={8}", new object[] { dto.dealerCode, dto.creadNo, dto.invokeTime, dto.UNineCreateUser, dto.remark, dto.changeType, dto.operaTionType, dto.amount.ToString(), dto.customerType }), new object[0]); accountInfoDto c = service.Do(dto); if (c != null && c.flag == 0) { throw new BusinessException(c.errMsg); } } catch (System.Exception e) { throw new BusinessException("调用DMS接口错误:" + e.Message); } } } } } } } } } } }