public void Notify(params object[] args) { if (args == null || args.Length == 0 || !(args[0] is UFSoft.UBF.Business.EntityEvent)) { return; } BusinessEntity.EntityKey key = ((UFSoft.UBF.Business.EntityEvent)args[0]).EntityKey; if (key == null) { return; } SO so = key.GetEntity() as UFIDA.U9.SM.SO.SO; if (so == null) { return; } //if (UFIDA.U9.Base.Context.LoginOrg.Code != "J002") return;//组织必须等于贸易中心 if (!UFIDA.U9.Cust.GS.FT.PlugInBE.PubHelper.PubHelperExtend.IsTradeCenterOrg()) { return; //组织必须等于贸易中心 } using (ISession session = Session.Open()) { UFIDA.U9.Cust.GS.FT.PlugInBE.PubHelper.PubSoDeleteExtend.DeleteSOFee(so);//删除费用 session.Commit(); } }
public void Notify(params object[] args) { if (args == null || args.Length == 0 || !(args[0] is UFSoft.UBF.Business.EntityEvent)) { return; } if (args == null || args.Length == 0 || !(args[0] is UFSoft.UBF.Business.EntityEvent)) { return; } BusinessEntity.EntityKey key = ((UFSoft.UBF.Business.EntityEvent)args[0]).EntityKey; if (key == null) { return; } UFIDA.U9.CBO.SCM.Item.ItemMaster holder = key.GetEntity() as UFIDA.U9.CBO.SCM.Item.ItemMaster; if (holder == null) { return; } ItemSubTable itemSub = ItemSubTable.Finder.Find("ItemMaster=" + holder.ID + ""); if (itemSub != null) { using (ISession session = Session.Open()) { itemSub.Remove(); session.Commit(); } } }
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 void Notify(params object[] args) { if (args == null || args.Length == 0 || !(args[0] is UFSoft.UBF.Business.EntityEvent)) { return; } BusinessEntity.EntityKey key = ((UFSoft.UBF.Business.EntityEvent)args[0]).EntityKey; if (key == null) { return; } UFIDA.U9.SM.SO.SOLine soLine = key.GetEntity() as UFIDA.U9.SM.SO.SOLine;//销售订单实体 if (soLine == null) { return; } //if (UFIDA.U9.Base.Context.LoginOrg.Code != "J002") return;//组织必须等于贸易中心 if (!UFIDA.U9.Cust.GS.FT.PlugInBE.PubHelper.PubHelperExtend.IsTradeCenterOrg()) { return; //组织必须等于贸易中心 } UFIDA.U9.Cust.GS.FT.PlugInBE.PubHelper.PubSoDeleteExtend.IsSoOrderSale(soLine); using (ISession session = Session.Open()) { UFIDA.U9.Cust.GS.FT.PlugInBE.PubHelper.PubSoDeleteExtend.DeleteBrokerage(soLine); //删除佣金 UFIDA.U9.Cust.GS.FT.PlugInBE.PubHelper.PubSoDeleteExtend.DeleteSOBom(soLine); //删除BOM UFIDA.U9.Cust.GS.FT.PlugInBE.PubHelper.PubSoDeleteExtend.DeleteSODiscount(soLine); //删除折扣 UFIDA.U9.Cust.GS.FT.PlugInBE.PubHelper.PubSoDeleteExtend.DeleteSOAssessType(soLine); //删除评估任务 session.Commit(); } }
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)) { MiscRcvTrans entity = key.GetEntity() as MiscRcvTrans; if (entity == null) { return; } // 回运单号有值,则DMS传进来的 if (entity.DescFlexField != null && entity.DescFlexField.PrivateDescSeg3.IsNotNullOrWhiteSpace() ) { foreach (MiscRcvTransL line in entity.MiscRcvTransLs) { if (line != null) { if (line.IsZeroCost && line.Price_Sources.IsNull() ) { line.Price_Sources = "零成本"; } } } } } } }
public void Notify(params object[] args) { if (args == null || args.Length == 0 || !(args[0] is UFSoft.UBF.Business.EntityEvent)) { return; } BusinessEntity.EntityKey key = ((UFSoft.UBF.Business.EntityEvent)args[0]).EntityKey; if (key == null) { return; } SO so = key.GetEntity() as UFIDA.U9.SM.SO.SO;//销售订单实体 if (so == null) { return; } //if (UFIDA.U9.Base.Context.LoginOrg.Code != "J002") return;//组织必须等于贸易中心 if (!PubHelperExtend.IsTradeCenterOrg()) { return; //组织必须等于贸易中心 } if (string.IsNullOrEmpty(so.DescFlexField.PrivateDescSeg14)) { throw new Exception("接单组织不能为空!"); } #region 根据接单组织改变记账期间、币种、法人组织 UFIDA.U9.Base.Organization.Organization org = UFIDA.U9.Base.Organization.Organization.Finder.Find("Code='" + so.DescFlexField.PrivateDescSeg14 + "'");//组织机构 if (org == null) { throw new Exception("无效的接单组织!"); } so.LegacyOrg = org;// 法人组织 foreach (SOLine line in so.SOLines) { foreach (SOShipline subLine in line.SOShiplines) { subLine.ShiperOrg = org; Session.Current.InList(subLine); } } UFIDA.U9.Base.SOB.SetofBooks setofBooks = UFIDA.U9.Base.SOB.SetofBooks.Finder.Find("SOBType=0 and Org.Code='" + so.DescFlexField.PrivateDescSeg14 + "'");//主账簿 if (setofBooks == null) { throw new Exception("接单组织:" + org.Name + "未设置主账簿!"); } UFIDA.U9.Base.SOB.SOBAccountingPeriod sob = UFIDA.U9.CBO.SCM.Util.BusinessHelper.GetNotClosedSOBAccountingPeriodBySOB(setofBooks, org.Key, so.BusinessDate, false); if (sob != null) { //记账期间赋值 so.KeepAccountPeriod = sob; so.FC = setofBooks.FunctionalCurrency; } #endregion }
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 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)) { CompleteRpt entity = key.GetEntity() as CompleteRpt; if (entity == null) { return; } // 新增时,设置来源采集点单据ID if (entity.SysState == UFSoft.UBF.PL.Engine.ObjectState.Inserted) { if (entity.DescFlexField != null && entity.DescFlexField.PubDescSeg12.IsNotNullOrWhiteSpace() ) { string strVin = entity.DescFlexField.PubDescSeg12; CJDHead.EntityList lstCJD = CJDHead.Finder.FindAll("Org=@Org and Dtzyplan.VIN = @Vin" , new OqlParam(Context.LoginOrg.ID) , new OqlParam(strVin) ); if (lstCJD != null && lstCJD.Count > 0 ) { StringBuilder sbIDs = new StringBuilder(); foreach (CJDHead cjdHead in lstCJD) { if (cjdHead != null && cjdHead.ID > 0 ) { sbIDs.Append(cjdHead.ID).Append(","); } } entity.DescFlexField.PrivateDescSeg23 = sbIDs.GetStringRemoveLastSplit(); } } } } } }
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)) { SupplySource supplierItem = key.GetEntity() as SupplySource; //if (Context.LoginOrg.Code == "10") if (PubHelper.IsOrg_SupplierItem2DMS()) { bool flag = PubHelper.IsUsedDMSAPI(); if (flag) { if (SupplySourceInserted.IsUpdateDMS(supplierItem)) { //if (IsKeyChanged(supplierItem)) { PI06ImplService service = new PI06ImplService(); // service.Url = PubHelper.GetAddress(service.Url); System.Collections.Generic.List <partBaseDto> lines = GetUpdateDMSDTO(supplierItem); if (lines != null && lines.Count > 0 ) { try { partBaseDto d = service.Do(lines.ToArray()); if (d != null && d.flag == 0) { throw new BusinessException(d.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)) { SO so = key.GetEntity() as SO; if (PubHelper.SaleOrg2DMS.Contains(Context.LoginOrg.Code)) { bool flag = PubHelper.IsUsedDMSAPI(); if (flag) { if (!string.IsNullOrEmpty(so.DescFlexField.PubDescSeg5)) { try { System.Collections.Generic.List <orderInfoDto> list = new System.Collections.Generic.List <orderInfoDto>(); SI02ImplService service = new SI02ImplService(); // service.Url = PubHelper.GetAddress(service.Url); //list.Add(new orderInfoDto //{ // // 等待上线0,上线1,下线滞留2,下线调试3,最终检验4,总装入库5,调试检验6,车辆整改7 // docStatus = "2", // dmsSaleNo = so.DescFlexField.PubDescSeg5 //}); orderInfoDto orderDTO = new orderInfoDto(); // 0新增,1修改,2删除,3排产 orderDTO.docStatus = "2"; orderDTO.dmsSaleNo = so.DescFlexField.PubDescSeg5; list.Add(orderDTO); service.Do(list.ToArray()); } 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)) { MO mo = key.GetEntity() as MO; bool flag = PubHelper.IsUsedDMSAPI(); if (flag) { if (mo.MODocType != null && mo.MODocType.Code == "MO02" && mo.OriginalData.DocState == MOStateEnum.Approved && mo.DocState == MOStateEnum.Released) { try { SI09ImplService service = new SI09ImplService(); // service.Url = PubHelper.GetAddress(service.Url); //vehicleChangeInfoDto d = service.Do(new vehicleChangeInfoDto //{ // vin = mo.DescFlexField.PubDescSeg12, // docStatus = 5 //}); vehicleChangeInfoDto vehicleDTO = new vehicleChangeInfoDto(); //单台作业计划状态; 等待上线0,上线1,下线滞留2,下线调试3,最终检验4,总装入库5,调试检验6, 车辆整改7 vehicleDTO.docStatus = 5; vehicleDTO.vin = mo.DescFlexField.PubDescSeg12; vehicleChangeInfoDto d = service.Do(vehicleDTO); if (d != null && d.flag == 0) { throw new BusinessException(d.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)) { 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 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)) { Ship entity = key.GetEntity() as Ship; // DMS配件订单赋值价表 if (entity != null && entity.DescFlexField != null && entity.DescFlexField.PrivateDescSeg1.IsNotNullOrWhiteSpace() ) { partOrderInfoDto dmsOrderDTO = new partOrderInfoDto(); //// 订单号 //dmsOrderDTO.dmsSaleNo = entity.DescFlexField.PubDescSeg5; // 出货单号 dmsOrderDTO.dmsSaleNo = entity.DescFlexField.PrivateDescSeg1; //dmsOrderDTO.isDel = true.ToString(); dmsOrderDTO.isDel = "1"; PI09ImplService proxy = new PI09ImplService(); try { partOrderInfoDto result = proxy.Do(dmsOrderDTO); if (result != null && result.flag == 0) { throw new BusinessException(result.errMsg); } } catch (System.Exception e) { throw new BusinessException("调用DMS接口错误:" + e.Message); } } } } }
private void Do_Notify(object[] args) { #region 从事件参数中取得当前业务实体 if (args == null || args.Length == 0 || !(args[0] is UFSoft.UBF.Business.EntityEvent)) { return; } BusinessEntity.EntityKey key = ((UFSoft.UBF.Business.EntityEvent)args[0]).EntityKey; if (key == null) { return; } UFIDA.U9.Base.Currency.ExchangeRate holder = key.GetEntity() as UFIDA.U9.Base.Currency.ExchangeRate; if (holder == null) { return; } #endregion }
public void Notify(params object[] args) { #region 从事件参数中取得当前业务实体 //判断入口参数的有效性 if (args == null || args.Length == 0 || !(args[0] is EntityEvent)) { return; } //将入口参数的第一个参数转化为EntityEvent,并取EntityKey存入key BusinessEntity.EntityKey key = ((EntityEvent)args[0]).EntityKey; if (key == null) { return; } //转成所需实体,同时判断有效性 SO so = key.GetEntity() as SO; #region so.EfficiencyOrgKey = null; #endregion #endregion }
private void Do_Notify(object[] args) { #region 从事件参数中取得当前业务实体 if (args == null || args.Length == 0 || !(args[0] is UFSoft.UBF.Business.EntityEvent)) { return; } BusinessEntity.EntityKey key = ((UFSoft.UBF.Business.EntityEvent)args[0]).EntityKey; if (key == null) { return; } UFIDA.U9.CBO.MFG.BOM.BOMMaster holder = key.GetEntity() as UFIDA.U9.CBO.MFG.BOM.BOMMaster; if (holder == null) { return; } #endregion }
public void Notify(params object[] args) { if (args == null || args.Length == 0 || !(args[0] is UFSoft.UBF.Business.EntityEvent)) { return; } BusinessEntity.EntityKey key = ((UFSoft.UBF.Business.EntityEvent)args[0]).EntityKey; if (key == null) { return; } UFIDA.U9.SM.SO.SO so = key.GetEntity() as UFIDA.U9.SM.SO.SO;//销售订单实体 if (so == null) { return; } //if (UFIDA.U9.Base.Context.LoginOrg.Code != "J002") return;//组织必须等于贸易中心 if (!UFIDA.U9.Cust.GS.FT.PlugInBE.PubHelper.PubHelperExtend.IsTradeCenterOrg()) { return; //组织必须等于贸易中心 } }
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)) { Receivement entity = key.GetEntity() as Receivement; if (entity != null ) { DateTime docDate = entity.BusinessDate; string oldSuptCode = string.Empty; string newSuptCode = string.Empty; if (entity.SysState != UFSoft.UBF.PL.Engine.ObjectState.Inserted && entity.OriginalData != null && entity.OriginalData.Supplier != null ) { oldSuptCode = entity.OriginalData.Supplier.Code; } if (entity.Supplier != null) { newSuptCode = entity.Supplier.Code; } foreach (RcvLine docline in entity.RcvLines) { string oldItemCode = string.Empty; string newItemCode = string.Empty; if (docline.SysState != UFSoft.UBF.PL.Engine.ObjectState.Inserted && docline.OriginalData != null && docline.OriginalData.ItemInfo != null ) { oldItemCode = docline.OriginalData.ItemInfo.ItemCode; } if (docline.ItemInfo != null) { newItemCode = docline.ItemInfo.ItemCode; } if (newSuptCode.IsNotNullOrWhiteSpace() && newItemCode.IsNotNullOrWhiteSpace() // 新旧不一致,才重取 && (oldSuptCode != newSuptCode || oldItemCode != newItemCode ) ) { /* * 货源表 1 * * 标准采购:9 * 标准收货:2 * 到货:2 * 质检单:6 */ POLine srcPOLine = null; if (docline.SrcPO != null && docline.SrcPO.SrcDocLine != null && docline.SrcPO.SrcDocLine.EntityID > 0 ) { srcPOLine = POLine.Finder.FindByID(docline.SrcPO.SrcDocLine.EntityID); } if (srcPOLine != null) { docline.DescFlexSegments.PrivateDescSeg2 = srcPOLine.DescFlexSegments.PrivateDescSeg9; } else { SupplySource suptSource = PurchaseOrder_BeforeDefaultValue.GetSupplySource(docDate, newSuptCode, newItemCode); if (suptSource != null) { docline.DescFlexSegments.PrivateDescSeg2 = suptSource.DescFlexField.PrivateDescSeg1; } } } } } } } }
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)) { CompleteRpt entity = key.GetEntity() as CompleteRpt; bool flag = PubHelper.IsUsedDMSAPI(); if (flag) { // 制造组织(成都)的才做完工报告 if (Context.LoginOrg.Code == PubHelper.Const_OrgCode_Chengdu) { if (entity.ProjectKey != null) { Project project = Project.Finder.Find("Code='" + entity.Project.Code.ToString() + "' and org=" + entity.Project.MasterOrg.ID.ToString(), new OqlParam[0]); if (project != null) { SOLine soline = SOLine.Finder.Find(string.Format("Project={0}", project.ID.ToString()), new OqlParam[0]); if (soline != null && !string.IsNullOrEmpty(soline.SO.DescFlexField.PubDescSeg5)) { if (((entity.MOKey != null && entity.MO.MODocType.Code != "MO02") || entity.PLSKey != null ) // 物料一样,说明是整车完工 && soline.ItemInfo.ItemID.Code == entity.Item.Code ) { // 审核,更新成 最终检验; // 关闭,更新成 总装入库; if (entity.DocState == CompleteRptStateEnum.Approved && entity.OriginalData.DocState == CompleteRptStateEnum.Approving) { vehicleInfoDto resultdto = null; try { SI03ImplService service = new SI03ImplService(); // service.Url = PubHelper.GetAddress(service.Url); vehicleInfoDto dto = new vehicleInfoDto(); if (entity.ProjectKey != null) { dto.dmsSaleNo = entity.Project.Code; } dto.vin = entity.DescFlexField.PubDescSeg12; dto.erpMaterialCode = entity.Item.Code; // 等待上线0,上线1,下线滞留2,下线调试3,最终检验4,总装入库5,调试检验6,车辆整改7 dto.nodeStatus = "4"; dto.oldVin = string.Empty; // VIN短码 dto.flowingCode = ((entity.DescFlexField.PubDescSeg12.Length >= 8) ? entity.DescFlexField.PubDescSeg12.Substring(entity.DescFlexField.PubDescSeg12.Length - 8, 8) : entity.DescFlexField.PubDescSeg12); // 发动机号 dto.engineNo = entity.DescFlexField.PrivateDescSeg5; resultdto = service.Do(dto); //if (resultdto != null && resultdto.flag == 0) //{ // throw new BusinessException(resultdto.errMsg); //} } catch (System.Exception e) { throw new BusinessException("调用DMS接口异常:" + e.Message); } if (resultdto != null && resultdto.flag == 0) { if (resultdto.errMsg.IsNull()) { throw new BusinessException("调用DMS接口错误,错误标记(flag)为0,但是无错误消息返回!"); } else { throw new BusinessException("调用DMS接口执行失败:" + resultdto.errMsg); } } } else if (entity.DocState == CompleteRptStateEnum.Received && (entity.OriginalData.DocState == CompleteRptStateEnum.Approved || entity.OriginalData.DocState == CompleteRptStateEnum.QualityChecked || entity.OriginalData.DocState == CompleteRptStateEnum.Approving ) ) { // 2017-07-27 wf 只传最终检验状态,后续不传给DMS;DMS自己系统中会有相关操作;DMS这个接口,强制更新成状态4,无论传入状态是什么; //vehicleInfoDto resultdto = null; //try //{ // SI03ImplService service = new SI03ImplService(); // // service.Url = PubHelper.GetAddress(service.Url); // vehicleInfoDto dto = new vehicleInfoDto(); // if (entity.ProjectKey != null) // { // dto.dmsSaleNo = entity.Project.Code; // } // dto.vin = entity.DescFlexField.PubDescSeg12; // dto.erpMaterialCode = entity.Item.Code; // // 等待上线0,上线1,下线滞留2,下线调试3,最终检验4,总装入库5,调试检验6,车辆整改7 // dto.nodeStatus = "5"; // dto.oldVin = string.Empty; // // VIN短码 // dto.flowingCode = ((entity.DescFlexField.PubDescSeg12.Length >= 8) ? entity.DescFlexField.PubDescSeg12.Substring(entity.DescFlexField.PubDescSeg12.Length - 8, 8) : entity.DescFlexField.PubDescSeg12); // // 发动机号 // dto.engineNo = entity.DescFlexField.PrivateDescSeg5; // resultdto = service.Do(dto); //} //catch (System.Exception e) //{ // throw new BusinessException("调用DMS接口异常:" + e.Message); //} //if (resultdto != null && resultdto.flag == 0) //{ // if (resultdto.errMsg.IsNull()) // { // throw new BusinessException("调用DMS接口错误,错误标记(flag)为0,但是无错误消息返回!"); // } // else // { // throw new BusinessException("调用DMS接口执行失败:" + resultdto.errMsg); // } //} } // 关闭后,不会改VIN码,而且现在好像不用私有段21了,用的是公共段12 //else if ((entity.DocState == CompleteRptStateEnum.Approved // || entity.DocState == CompleteRptStateEnum.Received // || entity.DocState == CompleteRptStateEnum.QualityChecked // ) // && entity.DescFlexField.PrivateDescSeg21 != entity.OriginalData.DescFlexField.PrivateDescSeg21 // ) ////// 新增是不是要写??? ////if (rpt.DocState == CompleteRptStateEnum.Opened //// || rpt.DocState == CompleteRptStateEnum.Approving //// ) //{ // try // { // SI03ImplService service = new SI03ImplService(); // // service.Url = PubHelper.GetAddress(service.Url); // vehicleInfoDto dto = new vehicleInfoDto(); // if (entity.ProjectKey != null) // { // dto.dmsSaleNo = entity.Project.Code; // } // dto.vin = entity.DescFlexField.PubDescSeg12; // dto.erpMaterialCode = entity.Item.Code; // // 等待上线0,上线1,下线滞留2,下线调试3,最终检验4,总装入库5,调试检验6,车辆整改7 // dto.nodeStatus = "4"; // dto.oldVin = entity.DescFlexField.PrivateDescSeg21; // // VIN短码 // dto.flowingCode = ((entity.DescFlexField.PrivateDescSeg21.Length >= 8) ? entity.DescFlexField.PrivateDescSeg21.Substring(entity.DescFlexField.PrivateDescSeg21.Length - 8, 8) : entity.DescFlexField.PrivateDescSeg21); // // 发动机号 // dto.engineNo = entity.DescFlexField.PrivateDescSeg5; // vehicleInfoDto resultdto = service.Do(dto); // if (resultdto != null && resultdto.flag == 0) // { // throw new BusinessException(resultdto.errMsg); // } // } // catch (System.Exception e) // { // throw new BusinessException("调用DMS接口异常:" + e.Message); // } //} } else { if (entity.MOKey != null && entity.MO.MODocType.Code == "MO02") { System.DateTime arg_42B_0 = entity.ActualRcvTime; if (entity.DocState == CompleteRptStateEnum.Approved && entity.OriginalData.DocState == CompleteRptStateEnum.Approving) { vehicleChangeInfoDto resultdto = null; try { SI09ImplService service2 = new SI09ImplService(); service2.Url = PubHelper.GetAddress(service2.Url); //vehicleChangeInfoDto d = service2.receive(new vehicleChangeInfoDto //{ // vin = rpt.DescFlexField.PubDescSeg12, // docStatus = 7 //}); vehicleChangeInfoDto dto = new vehicleChangeInfoDto(); // 等待上线0,上线1,下线滞留2,下线调试3,最终检验4,总装入库5,调试检验6,车辆整改7 dto.vin = entity.DescFlexField.PubDescSeg12; dto.docStatus = 7; resultdto = service2.Do(dto); //if (resultdto != null && resultdto.flag == 0) //{ // throw new BusinessException(resultdto.errMsg); //} } catch (System.Exception e) { throw new BusinessException("调用DMS接口异常:" + e.Message); } if (resultdto != null && resultdto.flag == 0) { if (resultdto.errMsg.IsNull()) { throw new BusinessException("调用DMS接口错误,错误标记(flag)为0,但是无错误消息返回!"); } else { throw new BusinessException("调用DMS接口执行失败:" + resultdto.errMsg); } } } else if (entity.DocState == CompleteRptStateEnum.Received && (entity.OriginalData.DocState == CompleteRptStateEnum.Approved || entity.OriginalData.DocState == CompleteRptStateEnum.QualityChecked || entity.OriginalData.DocState == CompleteRptStateEnum.Approving ) ) { vehicleChangeInfoDto resultdto = null; try { SI09ImplService service2 = new SI09ImplService(); service2.Url = PubHelper.GetAddress(service2.Url); //vehicleChangeInfoDto d = service2.receive(new vehicleChangeInfoDto //{ // vin = rpt.DescFlexField.PubDescSeg12, // docStatus = 7 //}); vehicleChangeInfoDto dto = new vehicleChangeInfoDto(); // 等待上线0,上线1,下线滞留2,下线调试3,最终检验4,总装入库5,调试检验6,车辆整改7 dto.vin = entity.DescFlexField.PubDescSeg12; dto.docStatus = 5; resultdto = service2.Do(dto); //if (resultdto != null && resultdto.flag == 0) //{ // throw new BusinessException(resultdto.errMsg); //} } catch (System.Exception e) { throw new BusinessException("调用DMS接口异常:" + e.Message); } if (resultdto != null && resultdto.flag == 0) { if (resultdto.errMsg.IsNull()) { throw new BusinessException("调用DMS接口错误,错误标记(flag)为0,但是无错误消息返回!"); } else { throw new BusinessException("调用DMS接口执行失败:" + resultdto.errMsg); } } } } } } } } //return; // MES推送DMS接口 /* // 生产线采集点 * EntityName DisplayName DefaultTableName AssemblyName ViewName UIClassName UIAssemblyName IsMainView UID FilterOriginalOPath URI Container[装配assemblyID] ClassName * COM.DaYun.MES.CJDBE.CarTestCQRecord 车辆调试过程检验质量问题记录 dayun_cartestcqrecord COM.DaYun.MES.DaYunCJDBE CJDHead_CarTestCQRecord DaYunCJDUIModel.DaYunCJDUIMainFromWebPart COM.DaYun.MES.UI.DaYunCJDUI.WebPart 0 CAB27503-D7D5-4E05-84FB-A084202EE8C3 mes.cjd 66be41ba-d206-4bae-8f52-379345be90ee DaYunCJDUIModel.DaYunCJDUIMainFromWebPart * COM.DaYun.MES.CJDBE.CarTestQRecord 车辆调试过程质量问题记录 dayun_cartestqrecord COM.DaYun.MES.DaYunCJDBE CJDHead_CarTestQRecord DaYunCJDUIModel.DaYunCJDUIMainFromWebPart COM.DaYun.MES.UI.DaYunCJDUI.WebPart 0 CAB27503-D7D5-4E05-84FB-A084202EE8C3 mes.cjd 66be41ba-d206-4bae-8f52-379345be90ee DaYunCJDUIModel.DaYunCJDUIMainFromWebPart * COM.DaYun.MES.CJDBE.CJDHead 生产采集点 dayun_cjd COM.DaYun.MES.DaYunCJDBE CJDHead DaYunCJDUIModel.DaYunCJDUIMainFromWebPart COM.DaYun.MES.UI.DaYunCJDUI.WebPart 1 CAB27503-D7D5-4E05-84FB-A084202EE8C3 mes.cjd 66be41ba-d206-4bae-8f52-379345be90ee DaYunCJDUIModel.DaYunCJDUIMainFromWebPart * COM.DaYun.MES.CJDBE.CarAssemblyQRecord 车辆装配过程质量问题记录 dayun_carassemblyqrecord COM.DaYun.MES.DaYunCJDBE CJDHead_CarAssemblyQRecord DaYunCJDUIModel.DaYunCJDUIMainFromWebPart COM.DaYun.MES.UI.DaYunCJDUI.WebPart 0 CAB27503-D7D5-4E05-84FB-A084202EE8C3 mes.cjd 66be41ba-d206-4bae-8f52-379345be90ee DaYunCJDUIModel.DaYunCJDUIMainFromWebPart * COM.DaYun.MES.CJDBE.CarCQRecord 车辆最终检测质量问题记录 dayun_carcqrecord COM.DaYun.MES.DaYunCJDBE CJDHead_CarCQRecord DaYunCJDUIModel.DaYunCJDUIMainFromWebPart COM.DaYun.MES.UI.DaYunCJDUI.WebPart 0 CAB27503-D7D5-4E05-84FB-A084202EE8C3 mes.cjd 66be41ba-d206-4bae-8f52-379345be90ee DaYunCJDUIModel.DaYunCJDUIMainFromWebPart * COM.DaYun.MES.CJDBE.CJDLine 关重件绑定 danyun_cjdline COM.DaYun.MES.DaYunCJDBE CJDHead_CJDLine DaYunCJDUIModel.DaYunCJDUIMainFromWebPart COM.DaYun.MES.UI.DaYunCJDUI.WebPart 0 CAB27503-D7D5-4E05-84FB-A084202EE8C3 mes.cjd 66be41ba-d206-4bae-8f52-379345be90ee DaYunCJDUIModel.DaYunCJDUIMainFromWebPart * COM.DaYun.MES.CJDBE.CarAssemblyCQRecord 车辆装配过程检验质量问题记录 dayun_carassemblycqrecord COM.DaYun.MES.DaYunCJDBE CJDHead_CarAssemblyCQRecord DaYunCJDUIModel.DaYunCJDUIMainFromWebPart COM.DaYun.MES.UI.DaYunCJDUI.WebPart 0 CAB27503-D7D5-4E05-84FB-A084202EE8C3 mes.cjd 66be41ba-d206-4bae-8f52-379345be90ee DaYunCJDUIModel.DaYunCJDUIMainFromWebPart */ /* // CJDHead_CarTestCQRecord DaYunCJDUIModel.DaYunCJDUIMainFromWebPart COM.DaYun.MES.UI.DaYunCJDUI.WebPart * OnPush56 * private void OnPush56_Click_Extend(object sender, EventArgs e) * { * this.OnPush56_Click_DefaultImpl(sender, e); * this.Push(); * this.SaveClick0_Click_Extend(sender, e); * } * private void Push() * { * if (this.Model.CJDHead.FocusedRecord != null && this.Model.CJDHead.FocusedRecord.Dtzyplan_PlanStatus.HasValue) * { * switch (this.Model.CJDHead.FocusedRecord.Dtzyplan_PlanStatus.Value) * { * case 1: * this.Model.CJDHead.FocusedRecord.Status = new int?(3); * break; * case 3: * this.Model.CJDHead.FocusedRecord.Status = new int?(6); * break; * case 4: * this.Model.CJDHead.FocusedRecord.Status = new int?(5); * break; * case 6: * this.Model.CJDHead.FocusedRecord.Status = new int?(4); * break; * } * } * } */ if (entity.DocType != null // 底盘完工报告(单据类型 = 总装完工报告) && entity.DocType.Code == Const_MesDocTypeCode // VIN码有值 && entity.DescFlexField.PubDescSeg12.IsNotNullOrWhiteSpace() ) { // 审核 if (entity.DocState == CompleteRptStateEnum.Approved && entity.OriginalData.DocState == CompleteRptStateEnum.Approving) { CJDHead cjdHead = GetCJDHead(entity); if (cjdHead != null && cjdHead.CJDLine != null && cjdHead.CJDLine.Count > 0 ) { mesDataTmpDto resultdto = null; try { SI01ImplService service = new SI01ImplService(); List <mesDataTmpDto> lstMesDTO = new List <mesDataTmpDto>(); string strVin = entity.DescFlexField.PubDescSeg12; foreach (CJDLine cjdLine in cjdHead.CJDLine) { if (cjdLine.ItemMaster != null) { // service.Url = PubHelper.GetAddress(service.Url); mesDataTmpDto dto = new mesDataTmpDto(); // vin底盘号 ,bomdm 配件图号, gysdm供应商代码 pjtm 配件条码 pch 批次号, dto.vin = strVin; // bomdm 配件图号 dto.bomdm = GetItemCode(cjdLine); // gysdm供应商代码 if (cjdLine.Supplyer != null) { dto.gysdm = cjdLine.Supplyer.Code; } // pjtm 配件条码 dto.pjtm = cjdLine.SN; // pch 批次号 采集点没有(从SN条码解析出来) // *110377*f0701006*j2914n1h-010* // *供应商*批次号*料号* dto.pch = GetLotCode(cjdLine); lstMesDTO.Add(dto); } } if (lstMesDTO.Count > 0) { resultdto = service.Do(lstMesDTO.ToArray()); } } catch (System.Exception e) { throw new BusinessException("调用DMS接口SI01[MES接口]异常:" + e.Message); } if (resultdto != null && resultdto.flag == 0) { throw new BusinessException("调用DMS接口SI01[MES接口]执行失败:" + resultdto.errMsg); } } } } } } } } }
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)) { SupplySource supplierItem = key.GetEntity() as SupplySource; //if (Context.LoginOrg.Code == "10") if (PubHelper.IsOrg_SupplierItem2DMS()) { bool flag = PubHelper.IsUsedDMSAPI(); if (flag) { if (IsUpdateDMS(supplierItem) ) { try { PI06ImplService service = new PI06ImplService(); // service.Url = PubHelper.GetAddress(service.Url); partBaseDto linedto = new partBaseDto(); System.Collections.Generic.List <partBaseDto> lines = new System.Collections.Generic.List <partBaseDto>(); if (supplierItem.SupplierInfo != null && supplierItem.SupplierInfo.SupplierKey != null) { linedto.suptCode = supplierItem.SupplierInfo.Supplier.Code; } if (supplierItem.ItemInfo != null && supplierItem.ItemInfo.ItemIDKey != null) { linedto.partCode = supplierItem.ItemInfo.ItemID.Code; linedto.partName = supplierItem.ItemInfo.ItemID.Name; } if (supplierItem.ItemInfo.ItemID.InventoryUOM != null) { linedto.unit = supplierItem.ItemInfo.ItemID.InventoryUOM.Name; } if (supplierItem.ItemInfo.ItemID.PurchaseInfo != null) { linedto.miniPack = ((supplierItem.ItemInfo.ItemID.PurchaseInfo.MinRcvQty > 0) ? System.Convert.ToInt32(supplierItem.ItemInfo.ItemID.PurchaseInfo.MinRcvQty) : 1); } linedto.isFlag = "2"; //SalePriceLine line = SalePriceLine.Finder.Find(string.Format("SalePriceList.Org={0} and ItemInfo.ItemID={1} and Active=1 and '{2}' between FromDate and ToDate", Context.LoginOrg.ID.ToString(), supplierItem.ItemInfo.ItemID.ID.ToString(), System.DateTime.Now.ToString()), new OqlParam[0]); SalePriceLine line = PubHelper.GetSalePriceList(supplierItem); if (line != null) { linedto.salePrice = float.Parse(line.Price.ToString("G0")); linedto.unitPrace = linedto.salePrice; } else { linedto.salePrice = 0f; linedto.unitPrace = 0f; } linedto.isDanger = "0"; linedto.isReturn = "1"; linedto.isSale = "1"; linedto.isEffective = supplierItem.Effective.IsEffective.ToString(); linedto.actionType = 1; lines.Add(linedto); partBaseDto d = service.Do(lines.ToArray()); if (d != null && d.flag == 0) { throw new BusinessException(d.errMsg); } } catch (System.Exception e) { throw new BusinessException("调用DMS接口错误:" + e.Message); } } } } } } }
public void Notify(params object[] args) { #region 从事件参数中取得当前业务实体 //从事件参数中取得当前业务实体 if (args == null || args.Length == 0 || !(args[0] is UFSoft.UBF.Business.EntityEvent)) { return; } BusinessEntity.EntityKey key = ((UFSoft.UBF.Business.EntityEvent)args[0]).EntityKey; if (key == null) { return; } Contact cc = new Contact(); PurchaseOrder po = key.GetEntity() as PurchaseOrder; if (po == null) { return; } poid = po.ID.ToString(); #region OA接口 string oaProfileValue = Common.GetProfileValue(Common.iProfileCode, Context.LoginOrg.ID); if (oaProfileValue.ToLower() != "true") { return; } string docTypeCode = po.DocumentType.Code.ToString(); if (docTypeCode == "PO31" || docTypeCode == "PO32" || docTypeCode == "PO33" || docTypeCode == "PO34" || docTypeCode == "PO35" || docTypeCode == "PO36") { if (po.OriginalData.Status == PODOCStatusEnum.Approving && po.Status == PODOCStatusEnum.Approving) { logger.Error("不能修改::"); if (po.DescFlexField.PrivateDescSeg29 == "") { if (Context.LoginUser.ToString() != "administrator" && Context.LoginUser.ToString() != "admin" && Context.LoginUser.ToString() != "系统管理员") { throw new Exception("OA流程单据不允许手动修改!"); } } } if (po.OriginalData.Status == PODOCStatusEnum.Approving && po.Status == PODOCStatusEnum.Approved) { logger.Error("不能审核::"); if (po.DescFlexField.PrivateDescSeg29 == "") { if (Context.LoginUser.ToString() != "administrator" && Context.LoginUser.ToString() != "admin" && Context.LoginUser.ToString() != "系统管理员") { throw new Exception("OA流程单据:" + po.DocNo + "不允许手工审核!"); } } } } string svURL = Common.GetProfileValue(Common.iProfileCode, Context.LoginOrg.ID); string orgCode = Context.LoginOrg.Code; string orgName = Context.LoginOrg.Name; string docNo = po.DocNo; string operatorsName = po.PurOper != null ? po.PurOper.Name : string.Empty; string title = operatorsName + docNo; decimal totalMoney = 0; string docTypeName = po.DocumentType.Name.ToString(); if (po.ID != 0) { } Int64 ID = po.ID; string OperatorsCode = po.PurOper != null?po.PurOper.Code.ToString() : string.Empty; string BusinessDate = po.BusinessDate.ToString("yyyy-MM-dd"); string Settlement = po.DescFlexField.PrivateDescSeg7.ToString(); //decimal TotalMoney = po.TotalMnyAC; string ProjectUse = po.DescFlexField.PubDescSeg26.ToString(); string TradeLocation = po.DescFlexField.PrivateDescSeg5.ToString(); string Supplier = po.Supplier != null ? po.Supplier.Supplier.Name : string.Empty; string supplierContact = po.Supplier.Supplier.DescFlexField.PrivateDescSeg3; string supplierPhone = po.Supplier.Supplier.DescFlexField.PrivateDescSeg4; string supplierEmail = po.Supplier.Supplier.DescFlexField.PrivateDescSeg11;//正式库和测试库不一样 khname = po.Supplier != null ? po.Supplier.Supplier.Name : string.Empty; scdocno = po.DocNo; //string supplierPhone = ""; //if (cc.DefaultPhoneNum != null) { supplierPhone = cc.DefaultPhoneNum; } //string supplierContact = ""; //if (supplierPhone != null) { supplierContact = cc.PersonName.DisplayName + supplierPhone; } //组织编码 OrgCode //组织名称 OrgName //Title 标题 bt //DocTypeName 单据类型 djlx //ID 单据ID djid //DocNo 单号 cgdh //OperatorsCode 申请人编码 zdrbm //OperatorsName 申请人 zdrmc //BusinessDate 日期 cjsj //Settlement 结算方式及期限 jsfs //TotalMoney 合同总金额(小写) htzjexx // 合同总金额(大写) //ProjectUse 项目用途 xmyt //TradeLocation 交货地点 jhdd //Supplier 供应商 gys //SupplierContact 供应商联系人+供应商电话 gyslxr Hashtable ht = new Hashtable(); ht.Add("zzbm", orgCode); //组织编码 ht.Add("zzmc", orgName); //组织名称 ht.Add("cgdh", docNo); ht.Add("zdrmc", operatorsName); ht.Add("bt", title); ht.Add("djlx", docTypeName); ht.Add("djlxbm", docTypeCode); ht.Add("djid", ID); ht.Add("zdrbm", OperatorsCode); ht.Add("cjsj", BusinessDate); ht.Add("jsfs", Settlement); ht.Add("xmyt", ProjectUse); ht.Add("jhdd", TradeLocation); ht.Add("gys", Supplier); if (Supplier == "中航锂电科技有限公司" || Supplier == "中航锂电(洛阳)有限公司" || Supplier == "中航锂电技术研究院有限公司") { ht.Add("nbqsdw", Supplier); } ht.Add("gyslxr", supplierContact + supplierPhone); ht.Add("gysyx", supplierEmail); List <Hashtable> htDetailList = new List <Hashtable>(); StringBuilder sqlBuilder = new StringBuilder(); foreach (POLine line in po.POLines) { //行号 DocLineNo //料号 ItemCode //品名 ItemName //数量 PurQtyTU //单位 UomName //单价 FinallyPriceTC //金额 TotalMnyTC //交货时间 DeliveryDate Int64 id = line.ID; int docLineNo = line.DocLineNo; //料号 string itemCode = line.ItemInfo.ItemCode; //品名 string itemName = line.ItemInfo.ItemName; string uomName = line.TradeUOM.Name; string deliveryDate = line.POShiplines[0].DeliveryDate.ToString("yyyy-MM-dd");//交期 decimal purQtyTU = line.SupplierConfirmQtyPU; decimal finallyPriceTC = line.FinallyPriceTC; decimal totalMnyTC = line.TotalMnyTC; totalMoney += totalMnyTC; //sqlBuilder.Append("INSERT INTO Cust_PO()"); //sqlBuilder.Append("VALUES(''); "); //lh //pm //sl //dw //dj //je //jhrq Hashtable htDetail = new Hashtable(); htDetail.Add("xid", id); htDetail.Add("xh", docLineNo); htDetail.Add("lh", itemCode); //料号 htDetail.Add("pm", itemName); //品名 htDetail.Add("dw", uomName); htDetail.Add("jhrq", deliveryDate); htDetail.Add("sl", purQtyTU); htDetail.Add("dj", finallyPriceTC); htDetail.Add("je", totalMnyTC); htDetailList.Add(htDetail); } ht.Add("htzjexx", totalMoney); //if (sqlBuilder.Length > 0) //{ // //DAOHelper.ExecuteSql(sqlBuilder.ToString()); // //DataAccessor.RunSQL(DatabaseManager.GetConnection(), sqlBuilder.ToString(), null); //} string userid = Context.LoginUserID; User uscc = User.Finder.FindByID(userid); //string uid = cc.UuID; int userID = 0; if (po.OriginalData.Status == PODOCStatusEnum.Opened && po.Status == PODOCStatusEnum.Approving) { string fileurl = ""; #region 获取当前单据的附件信息 //通过单据找到对应的附件 string entityFullName = po.GetType().FullName; string opath = "EntityFullName='" + entityFullName + "' and EntityID=" + po.ID; UFIDA.U9.Base.Attachment.Attachment.EntityList attachmentList = UFIDA.U9.Base.Attachment.Attachment.Finder.FindAll(opath, null); if (attachmentList != null && attachmentList.Count > 0) { logger.Error("准备执行上传附件操作……"); foreach (UFIDA.U9.Base.Attachment.Attachment attachment in attachmentList) { //附件ID long attachmentID = attachment.AttachmentID; //根据附件ID查文件信息 //UFIDA.U9.CS.Collaboration.Library.FileInfo fileInfo = UFIDA.U9.CS.Collaboration.Library.FileInfo.Finder.FindByID(attachmentID); //文件内容存储ID string fileHandler = attachment.FileHandler; //根据文件内容存储ID找文件信息 UFIDA.U9.CS.Common.FileStorage.Storage storage = new UFIDA.U9.CS.Common.FileStorage.Storage(); //获取文件 UFIDA.U9.CS.Common.FileDBService.FileInfo file = storage.GetFile(fileHandler); //获取文件流 Stream stream = storage.GetFileContent(fileHandler); stream.Position = 0; //文件流转换成字节 byte[] infbytes = new Byte[(int)stream.Length]; stream.Read(infbytes, 0, infbytes.Length); stream.Seek(0, SeekOrigin.Begin); //UploadFile("d:/0304.txt"); string strRet = Convert.ToBase64String(infbytes); //string localpath = @"D:\0304.txt"; //string userName = "******"; //string password="******"; ////C:\Users\Administrator\Desktop ////logger.Error("上传文件失败,失败原因;" + fileInfo.FullPath); //System.Net.NetworkCredential Credentials = new System.Net.NetworkCredential(userName, password); //FtpHelper.UploadFileToFTPServer(localpath, "ftp://10.20.1.54", Credentials); //<a href= "ftp://*****:*****@192.168.10.7:21/fdc/fdc_pr/FDC000000000JRA9JU2A/1231.txt\" target=\"_blank\">1231.txt</ a> string filen = ""; fileurl += "/" + file.FileName + ","; //fileurl += "<a href='" + ftpurl + "" + filen + "' target=\"_blank\">" + filen + "</a>"; FtpUploader fileload = new FtpUploader(); fileload.UploadString(strRet, "ftp://10.20.1.54/", file.FileName, stream); stream.Dispose(); } } #endregion #region OA创建流程 //域账号 DomainName //userID = Convert.ToInt32(uscc.UuID); userID = Convert.ToInt32(uscc.ShortName); string requestName = "采购订单" + docNo + "审批"; string workflowId = po.DocType.DescFlexField.PrivateDescSeg1;//237测试 if (string.IsNullOrEmpty(workflowId)) { return; } logger.Error("准备打印模板上传……"); if (docTypeCode == "PO31" || docTypeCode == "PO32" || docTypeCode == "PO33" || docTypeCode == "PO34" || docTypeCode == "PO36") { ShipUpdown(); UploadFile(dyfileurl); fjurl = "/" + fjname + ","; } else if (docTypeCode == "PO35") { fjurl = ""; } logger.Error("附件文件名1::" + fileurl); fileurl = fileurl.Replace(" filename=", ""); logger.Error("附件文件名2::" + fjurl); ht.Add("fj", fjurl); ht.Add("zccllj", fileurl); fjurl = ""; fileurl = ""; khname = ""; scdocno = ""; string workflowRequestInfo = Common.CreateXmlString(requestName, userID, workflowId, ht, htDetailList); logger.Error("发送采购单Xml:" + workflowRequestInfo); logger.Error("OA用户ID::" + userID); logger.Error("测试采购订单:" + po.OriginalData.Status + "---" + PODOCStatusEnum.Opened + "---" + po.Status + "---" + PODOCStatusEnum.Approved); if (docTypeCode == "PO31" || docTypeCode == "PO32" || docTypeCode == "PO33" || docTypeCode == "PO34" || docTypeCode == "PO35" || docTypeCode == "PO36") { //调用OA服务 WebReference.WorkflowServiceXml client = new WebReference.WorkflowServiceXml(); client.Url = Common.GetProfileValue(Common.sProfileCode, Context.LoginOrg.ID);//无效URL client.Url = client.Url.Substring(0, client.Url.Length - 5); string rtnMsg = string.Empty; logger.Error("测试采购订单:" + po.OriginalData.Status + "---" + PODOCStatusEnum.Opened + "---" + po.Status + "---" + PODOCStatusEnum.Approved); try { rtnMsg = client.doCreateWorkflowRequest(workflowRequestInfo, userID); //po.DescFlexField.PrivateDescSeg19 = rtnMsg; using (ISession session = Session.Open()) { string sql = "update PM_PurchaseOrder set DescFlexField_PrivateDescSeg19='" + rtnMsg + "' where id=" + po.ID; DataAccessor.RunSQL(DataAccessor.GetConn(), sql, null); session.Commit(); } logger.Error("测试Xml:" + rtnMsg); } catch (Exception ex) { throw new Exception("调用OA服务出现错误:" + ex.Message); } } } //请购单提交状态点击保存 OA执行更新操作 //else if (pr.OriginalData.Status == PRStatusEnum.Approving && pr.Status == PRStatusEnum.Approving) //{ // rtnMsg = client.submitWorkflowRequest(workflowRequestInfo, int.Parse(oaRquestID), userID, "submit", ""); //} //if (rtnMsg.StartsWith("Error", StringComparison.OrdinalIgnoreCase)) //{ // logger.Error("请购单OA系统错误:" + rtnMsg); // throw new Exception("【请购单】OA系统错误—>" + rtnMsg); //} //pr.DescFlexField.PrivateDescSeg29 = "True"; #endregion #endregion }
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 UFSoft.UBF.Business.EntityEvent)) { return; } BusinessEntity.EntityKey key = ((UFSoft.UBF.Business.EntityEvent)args[0]).EntityKey; if (key == null) { return; } UFIDA.U9.SM.SO.SO so = key.GetEntity() as UFIDA.U9.SM.SO.SO;//销售订单实体 if (so == null) { return; } //if (UFIDA.U9.Base.Context.LoginOrg.Code != "J002") return;//组织必须等于贸易中心 if (!UFIDA.U9.Cust.GS.FT.PlugInBE.PubHelper.PubHelperExtend.IsTradeCenterOrg()) { return; //组织必须等于贸易中心 } List <UFIDA.U9.SM.SO.SOLine> sssessTypeList = new List <SM.SO.SOLine>(); //需要创建大货评估的订单行 List <UFIDA.U9.SM.SO.SOLine> adjustPriceList = new List <UFIDA.U9.SM.SO.SOLine>(); //需要创建的调价单集合 List <long> specilPriceList = new List <long>(); ////需要创建的特价申请单集合 UFIDA.U9.CBO.SCM.ProjectTask.Project project = null; foreach (UFIDA.U9.SM.SO.SOLine soLine in so.SOLines) { #region 校验 //提交时校验 if (so.OriginalData.Status == UFIDA.U9.SM.SO.SODocStatusEnum.Open && so.Status == UFIDA.U9.SM.SO.SODocStatusEnum.Approving) { } //审核时校验 if (so.OriginalData.Status == UFIDA.U9.SM.SO.SODocStatusEnum.Approving && so.Status == UFIDA.U9.SM.SO.SODocStatusEnum.Approved) { if (!soLine.DescFlexField.PrivateDescSeg6.ToUpper().Contains("TRUE")) { throw new Exception("第" + soLine.DocLineNo.ToString() + "行还未生成佣金!"); } } //弃审时校验 if (so.OriginalData.Status == UFIDA.U9.SM.SO.SODocStatusEnum.Approved && so.Status == UFIDA.U9.SM.SO.SODocStatusEnum.Open) { } #endregion if (project == null) { project = PubHelperExtend.GetProject(so);//创建或者查找已存在的项目号 } if (soLine.Project == null) { soLine.Project = project;//如果项目号为空,给项目号赋值 } #region 判断是否需要创建大货评估 bool isAssess = CreateSOAssessTypeExtend.CheckAssessType(soLine); if (isAssess) { sssessTypeList.Add(soLine); } #endregion #region 判断是否需要创建特价申请单 if (string.IsNullOrEmpty(soLine.DescFlexField.PrivateDescSeg5)) { throw new Exception("外销价不能为空!"); } decimal ePrice = decimal.Parse(soLine.DescFlexField.PrivateDescSeg5); if (ePrice <= 0) { throw new Exception("外销价必须大于0!"); } if (ePrice < soLine.OrderPriceTC && soLine.DescFlexField.PrivateDescSeg1.ToUpper().Contains("TRUE") == false) { throw new Exception("当特价未勾选时,外销价必须大于等于定价!"); } if (ePrice > soLine.OrderPriceTC && soLine.DescFlexField.PrivateDescSeg1.ToUpper().Contains("TRUE") == true) { throw new Exception("当特价勾选时,外销价不能高于定价!"); } if (ePrice < soLine.OrderPriceTC && soLine.DescFlexField.PrivateDescSeg1.ToUpper().Contains("TRUE") == true) { specilPriceList.Add(soLine.ID); } #endregion #region 判断是否已做成本预测 //销售订单如果修改或者变更外销价,如果是将价格改低,则需要检查销售订单是否已做订单成本预测, //如果已做,则必须先手工删除该订单的成本预测后才允许进行修改或者变更 if (soLine.OriginalData.DescFlexField.PrivateDescSeg5 != "" && ePrice < decimal.Parse(soLine.OriginalData.DescFlexField.PrivateDescSeg5)) { UFIDA.U9.Cust.GS.FT.CostForecastBE.CostForecast costForecast = UFIDA.U9.Cust.GS.FT.CostForecastBE.CostForecast.Finder.Find("SOLine= " + soLine.ID + ""); if (costForecast != null) { throw new Exception("销售订单" + so.DocNo + "行" + soLine.DocLineNo + "已做成本预测,请删除成本预测结果"); } } //如果销售订单已做成本预测,订单发生更改,则预测状态变为M if (soLine.DescFlexField.PrivateDescSeg18 == "Y") { soLine.DescFlexField.PrivateDescSeg18 = "M"; } #endregion #region 判断是否需要创建调价单 if (soLine.SO.Status == UFIDA.U9.SM.SO.SODocStatusEnum.Approved && ePrice > soLine.OrderPriceTC && soLine.PriceListID > 0L) { adjustPriceList.Add(soLine); } #endregion } //非审核的情况下 if (so.Status != UFIDA.U9.SM.SO.SODocStatusEnum.Approved) { CreateSOFeeExtend.CreateSOFee(so);//创建费用项目 if (sssessTypeList.Count > 0) { CreateSOAssessTypeExtend.CreateAssessType(sssessTypeList);//创建评估类型子表-大货评估 } } #region 提交、审核、弃审 //提交 if (so.OriginalData.Status == UFIDA.U9.SM.SO.SODocStatusEnum.Open && so.Status == UFIDA.U9.SM.SO.SODocStatusEnum.Approving) { //创建特价申请单 if (specilPriceList.Count > 0) { PubHelperExtend.CreateSoOrderSale(specilPriceList); } } //审核 if (so.OriginalData.Status == UFIDA.U9.SM.SO.SODocStatusEnum.Approving && so.Status == UFIDA.U9.SM.SO.SODocStatusEnum.Approved) { //校验特价申请单是否已审核 SOValidateExtend.ValidateSOSalePriceForApproved(so.ID); //创建调价单 if (adjustPriceList.Count > 0) { PubHelperExtend.CreateAdjustPrice(adjustPriceList); } //销售订单类型为标准订单、预告订单/客户备库、巨星自备、汇总订单时,并且业务类型是普通订单,审核时产生供应计划 if ((so.DocType.Code == "SO1" || so.DocType.Code == "SO2" || so.DocType.Code == "SO3" || so.DocType.Code == "SO4") && so.DescFlexField.PrivateDescSeg2 == "03") { PubHelperExtend.CreateSupplyPlan(so);//创建供应计划 } } //弃审 if (so.OriginalData.Status == UFIDA.U9.SM.SO.SODocStatusEnum.Approved && so.Status == UFIDA.U9.SM.SO.SODocStatusEnum.Open) { SOValidateExtend.ValidateSOSupply(so.DocNo); SOValidateExtend.ValidateSOPrice(so.ID); } #endregion }
public void Notify(params object[] args) { if (args == null || args.Length == 0 || !(args[0] is UFSoft.UBF.Business.EntityEvent)) { return; } BusinessEntity.EntityKey key = ((UFSoft.UBF.Business.EntityEvent)args[0]).EntityKey; if (key == null) { return; } SO so = key.GetEntity() as UFIDA.U9.SM.SO.SO;//销售订单实体 if (so == null) { return; } //if (UFIDA.U9.Base.Context.LoginOrg.Code != "J002") return;//组织必须等于贸易中心 if (!UFIDA.U9.Cust.GS.FT.PlugInBE.PubHelper.PubHelperExtend.IsTradeCenterOrg()) { return; //组织必须等于贸易中心 } #region 变量定义 List <SOLine> adjustPriceList = new List <SOLine>(); //需要创建的调价单集合 List <SOLine> specilPriceList = new List <SOLine>(); ////需要创建的特价申请单集合 List <long> SoLineKey = new List <long>(); //销售订单行Key集合【需要创建销售订单特价单来源key】 List <IDCodeNameDTOData> ListIDCodeName = new List <IDCodeNameDTOData>(); //价表集合 List <SM.SO.SOLine> ListSOLine = new List <SOLine>(); List <int> Soline_RowNo = new List <int>(); //没有生成佣金的销售订单行行号 List <SupplierModeDTOData> SupplierModeList = new List <SupplierModeDTOData>(); List <long> SoLineAllKey = new List <long>(); //当前销售订单的销售订单行的KEY #endregion #region 单头校验 任何操作都需要进行校验的内容 #endregion #region 单行校验 foreach (SOLine line in so.SOLines) { SoLineAllKey.Add(line.ID); #region 当销售订单行包装方式=外厂包装的时候,随单BOM有且只能有一个是 if (!string.IsNullOrEmpty(line.DescFlexField.PubDescSeg18) && Convert.ToInt32(line.DescFlexField.PubDescSeg18) == 02) { //包装方式为 外厂包装 SupplierModeDTOData dto = new SupplierModeDTOData(); dto.SoLineListID = Convert.ToInt64(line.ID); dto.PackMode = string.IsNullOrEmpty(line.DescFlexField.PubDescSeg18) ? 0 : Convert.ToInt32(line.DescFlexField.PubDescSeg18);//包装工厂 SupplierModeList.Add(dto); } #endregion #region 保存,修改校验 //当销售订单已产生订单佣金、随单BOM,则料品不允许进行修改 if (line.OriginalData.ItemInfo.ItemCode != line.ItemInfo.ItemCode) //料品不一致 { OrderBomHead Bom = OrderBomHead.Finder.Find("OrderLine=@OrderLine", new OqlParam(line.ID)); //是否生成BOM bool IsBoll = string.IsNullOrEmpty(line.DescFlexField.PrivateDescSeg6) ? false : Convert.ToBoolean(line.DescFlexField.PrivateDescSeg6); //是否生成佣金 if (IsBoll == true || Bom != null) { throw new Exception("当前销售订单已产生订单佣金/随单BOM,料品不允许进行修改!"); } } #endregion #region 是否生成佣金 bool b = string.IsNullOrEmpty(line.DescFlexField.PrivateDescSeg6 + "") ? false : Convert.ToBoolean(line.DescFlexField.PrivateDescSeg6); if (!b) { Soline_RowNo.Add(line.DocLineNo);//销售订单行行号 } #endregion #region 创建特价申请单校验 //判断条件 外销价改低[弹性域]与定价比较;勾选特价[弹性域];是否有成本预测;调价原因不为空 if (!string.IsNullOrEmpty(line.DescFlexField.PrivateDescSeg1) && Convert.ToBoolean(line.DescFlexField.PrivateDescSeg1)) //是否特价 { if (!string.IsNullOrEmpty(line.DescFlexField.PrivateDescSeg5) && Convert.ToDecimal(line.DescFlexField.PrivateDescSeg5) < line.OrderPriceTC && !string.IsNullOrEmpty(line.DescFlexField.PrivateDescSeg2)) //比较外销价 并且调价原因不为空 { CostForecast.EntityList Cosst = CostForecast.Finder.FindAll("SOLine=@SOLine", new OqlParam(line.Key.ID)); if (Cosst == null && Cosst.Count == 0)//没用做成本预测 { SoLineKey.Add(line.ID); } } } #endregion #region 创建销售价格调整单校验 if (!string.IsNullOrEmpty(line.DescFlexField.PrivateDescSeg5)) { //外销价>定价&&特价不勾选 if (Convert.ToDecimal(line.DescFlexField.PrivateDescSeg5) > Convert.ToDecimal(line["OrderPriceTC"]) && !Convert.ToBoolean(line.DescFlexField.PrivateDescSeg1)) { IDCodeNameDTOData PriceDto = new IDCodeNameDTOData(); PriceDto.ID = Convert.ToInt64(line.PriceListID);//价表 PriceDto.Code = line.PriceListCode; PriceDto.Name = line.PriceListName; ListIDCodeName.Add(PriceDto);//价表 ListSOLine.Add(line); } } #endregion } #endregion #region 的操作调用不同的方法 #region 提交操作 if (so.OriginalData.Status == UFIDA.U9.SM.SO.SODocStatusEnum.Open && so.Status == UFIDA.U9.SM.SO.SODocStatusEnum.Approving) { if (SoLineKey != null && SoLineKey.Count > 0) { PubSoSubmitExtend.CreateSoOrderSale(SoLineKey);//调用创建特价申请单方法 } if (SoLineAllKey != null && SoLineAllKey.Count > 0) { PubSoSubmitExtend.CreateAssessType(so.TC.ID, SoLineAllKey); //创建评估类型 PubSoSubmitExtend.SetSolineProject(so); //反写销售订单行项目号 } PubSoSubmitExtend.CreateFee(so); //创建销售订单费用 } #endregion #region 审核操作 if (so.OriginalData.Status == UFIDA.U9.SM.SO.SODocStatusEnum.Approving && so.Status == UFIDA.U9.SM.SO.SODocStatusEnum.Approved) { if (SupplierModeList != null && SupplierModeList.Count > 0) { //当销售订单行包装工厂为外厂包装时,随单BOM的“提供受托加工”有且只能勾选一条: GetSupplierModeProxy proxy = new GetSupplierModeProxy(); proxy.SupplierModeDTO = SupplierModeList; string StrMeg = proxy.Do(); if (!string.IsNullOrEmpty(StrMeg)) { throw new Exception(StrMeg); } } //判断是否生成佣金,如则不允许审核, if (Soline_RowNo != null && Soline_RowNo.Count > 0) { throw new Exception("销售订单行" + Soline_RowNo[0] + "没有生成佣金,不可以审批"); } //如果评估类型中有一行大货评估,必须要有一行新品评估类型 if (SoLineAllKey != null && SoLineAllKey.Count > 0) { PubSoApprovedExtend.Is_NewGood(SoLineAllKey); } if (so.DescFlexField.PrivateDescSeg2 != "04")//业务类型不等于自备库存 { if (ListIDCodeName.Count > 0 && ListSOLine.Count > 0) { PubSoApprovedExtend.CreateSalePriceAdjustment(ListIDCodeName, ListSOLine);//创建销售价格调整单,提交,审核 } } //销售订单类型为标准订单、预告订单/客户备库、巨星自备、汇总订单时,并且业务类型是普通订单,审核时产生供应计划 if ((so.DocType.Code == "SO1" || so.DocType.Code == "SO2" || so.DocType.Code == "SO3" || so.DocType.Code == "SO4") && so.DescFlexField.PrivateDescSeg2 == "03") { PubSoApprovedExtend.CreateSupplyPlan(so);//创建供应计划 } } #endregion #region 弃审操作 if (so.OriginalData.Status == UFIDA.U9.SM.SO.SODocStatusEnum.Approved && so.Status == UFIDA.U9.SM.SO.SODocStatusEnum.Open) { //PubSoUnAppovedExtend.UnAppoved(so);//销售订单弃审操作逻辑校验 } #endregion #endregion }
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)) { TransferOut Transferout = key.GetEntity() as TransferOut; bool flag = PubHelper.IsUsedDMSAPI(); if (flag) { if (PubHelper.SaleOrg2DMS.Contains(Context.LoginOrg.Code)) { if (Transferout.Status == Status.Approved && Transferout.OriginalData.Status == Status.Approving) { try { string errormessage = string.Empty; foreach (TransOutLine line in Transferout.TransOutLines) { if (!string.IsNullOrEmpty(line.DescFlexSegments.PubDescSeg12)) { SI09ImplService service = new SI09ImplService(); // service.Url = PubHelper.GetAddress(service.Url); vehicleChangeInfoDto d = service.Do(new vehicleChangeInfoDto { vin = line.DescFlexSegments.PubDescSeg12, docStatus = 5 }); if (d != null && d.flag == 0) { errormessage += string.Format("Vin:{0},错误信息:{1} ", line.DescFlexSegments.PubDescSeg12, d.errMsg); } } } if (!string.IsNullOrEmpty(errormessage)) { throw new BusinessException(errormessage); } } catch (System.Exception e) { throw new BusinessException("调用DMS接口错误:" + e.Message); } } } if (Context.LoginOrg.Code == "10") { if (Transferout.Status == Status.Approved && Transferout.OriginalData.Status == Status.Approving) { try { string errormessage = string.Empty; foreach (TransOutLine line in Transferout.TransOutLines) { if (!string.IsNullOrEmpty(line.DescFlexSegments.PubDescSeg12)) { if (line.TransOutOrg.Code == "10" && line.TransOutSubLines[0].TransInOrg.Code == "20") { SI09ImplService service = new SI09ImplService(); // service.Url = PubHelper.GetAddress(service.Url); vehicleChangeInfoDto d = service.Do(new vehicleChangeInfoDto { vin = line.DescFlexSegments.PubDescSeg12, docStatus = 7 }); if (d != null && d.flag == 0) { errormessage += string.Format("Vin:{0},错误信息:{1} ", line.DescFlexSegments.PubDescSeg12, d.errMsg); } } } } if (!string.IsNullOrEmpty(errormessage)) { throw new BusinessException(errormessage); } } 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)) { SingleWorkPlan Singleworkplan = key.GetEntity() as SingleWorkPlan; if (Context.LoginOrg.Code == "10") { bool flag = PubHelper.IsUsedDMSAPI(); if (flag) { string dmssaleno = string.Empty; if (Singleworkplan.SrcDoc != null && Singleworkplan.SrcDoc.PLSKey != null && Singleworkplan.SrcDoc.PLS.ProjectKey != null) { SOLine soline = SOLine.Finder.Find(string.Format("SO.Org={0} and Project={1}", Context.LoginOrg.ID.ToString(), Singleworkplan.SrcDoc.PLS.ProjectKey.ID.ToString()), new OqlParam[0]); if (soline != null) { dmssaleno = soline.SO.DescFlexField.PubDescSeg5; } } if (!string.IsNullOrEmpty(dmssaleno)) { if (Singleworkplan.OriginalData.PlanStatus != Singleworkplan.PlanStatus && (Singleworkplan.PlanStatus == SingleWorkPlanStatusEnum.Online || Singleworkplan.PlanStatus == SingleWorkPlanStatusEnum.Wait)) { try { SI03ImplService service = new SI03ImplService(); // service.Url = PubHelper.GetAddress(service.Url); vehicleInfoDto dto = new vehicleInfoDto(); if (Singleworkplan.SrcDoc != null && Singleworkplan.SrcDoc.PLSKey != null && Singleworkplan.SrcDoc.PLS.ProjectKey != null) { SOLine soline = SOLine.Finder.Find(string.Format("SO.Org={0} and Project={1}", Context.LoginOrg.ID.ToString(), Singleworkplan.SrcDoc.PLS.ProjectKey.ID.ToString()), new OqlParam[0]); if (soline != null) { dto.dmsSaleNo = soline.SO.DescFlexField.PubDescSeg5; } } dto.commissionNo = Singleworkplan.WorkCode; dto.vin = Singleworkplan.VINFinal; if (Singleworkplan.ItemMasterKey != null) { dto.erpMaterialCode = Singleworkplan.ItemMaster.Code; } dto.flowingCode = Singleworkplan.VIN; dto.oldVin = string.Empty; dto.nodeStatus = Singleworkplan.PlanStatus.Value.ToString(); vehicleInfoDto resultdto = service.Do(dto); if (resultdto != null && resultdto.flag == 0) { throw new BusinessException(resultdto.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)) { TransLine transline = key.GetEntity() as TransLine; if (PubHelper.SaleOrg2DMS.Contains(Context.LoginOrg.Code)) { bool flag = PubHelper.IsUsedDMSAPI(); if (flag) { Supplier supt; //if (transline.Wh != null && transline.Wh.Code.StartsWith("SHBJ")) if (TransLineInserted.IsUpdateDMS(transline, out supt)) { //if (transline.DocLine != null && transline.DocLine.EntityType != "UFIDA.U9.InvDoc.PrdEndCheck.PrdEndChkBill" && transline.DocLine.EntityType != "UFIDA.U9.SM.Ship.ShipLine") { //string ismiscship = string.Empty; //if (transline.DocLine.EntityType == "UFIDA.U9.InvDoc.MiscShip.MiscShipmentL" && transline.DocLine.EntityID > 0) //{ // MiscShipmentL misshipline = MiscShipmentL.Finder.FindByID(transline.DocLine.EntityID); // if (misshipline != null) // { // ismiscship = misshipline.MiscShip.DescFlexField.PubDescSeg5; // } //} //if (string.IsNullOrEmpty(ismiscship)) { try { //PI07ImplService service = new PI07ImplService(); //DMSAsync_PI07.PI07Client service = new DMSAsync_PI07.PI07Client(); //DMSAsync_PI07.PI07Client service = PubExtend.GetPI07Async(); // 异步总会有返回结果丢失,改为同步了 PI07ImplService service = new PI07ImplService(); // service.Url = PubHelper.GetAddress(service.Url); //System.Collections.Generic.List<DMSAsync_PI07.stockDTO> list = new System.Collections.Generic.List<DMSAsync_PI07.stockDTO>(); //DMSAsync_PI07.stockDTO dto = new DMSAsync_PI07.stockDTO(); System.Collections.Generic.List <stockDTO> list = new System.Collections.Generic.List <stockDTO>(); stockDTO dto = new stockDTO(); dto.itemMaster = transline.ItemInfo.ItemID.Code; //if (transline.SupplierInfo != null && transline.SupplierInfo.Supplier != null) //{ // dto.supplier = transline.SupplierInfo.Supplier.Code; //} dto.supplier = supt != null ? supt.Code : string.Empty; //else if (transline.DocLine.EntityType == "UFIDA.U9.PM.Rcv.RcvLine") //{ // RcvLine rcvline = RcvLine.Finder.FindByID(transline.DocLine.EntityID); // if (rcvline != null && rcvline.Receivement.ReceivementType == ReceivementTypeEnum.SaleReturn && rcvline.SrcDocType == RcvSrcDocTypeEnum.RMA && rcvline.SrcDoc != null && rcvline.SrcDoc.SrcDocLine != null && rcvline.SrcDoc.SrcDocLine.EntityID > 0) // { // RMALine rmaline = RMALine.Finder.FindByID(rcvline.SrcDoc.SrcDocLine.EntityID); // if (rmaline != null && rmaline.SrcDocType == RMASrcDocTypeEnum.Ship && rmaline.SrcDocLine != null && rmaline.SrcDocLine.ID > 0) // { // ShipLine shipline = ShipLine.Finder.FindByID(rmaline.SrcDocLine.ID); // if (shipline != null && shipline.Supplier != null && shipline.Supplier.Supplier != null) // { // dto.supplier = shipline.Supplier.Supplier.Code; // } // } // } //} //dto.number = System.Convert.ToInt32(transline.StoreUOMQty); dto.number = transline.StoreUOMQty.GetInt(); if (transline.LotInfo != null) { dto.lot = transline.LotInfo.LotCode; } // DMS仓库编码按照U9的建立,因为出库时还要传回来仓库编码; //dto.WH = "SHBJ"; if (transline.Wh != null) { dto.WH = transline.Wh.Code; } //if (transline.Direction == TransDirectionEnum.Rcv) //{ // dto.actionType = 1; //} //else //{ // dto.actionType = 0; //} // actionType 0,入库;1,出库;2,盘点(库存全部更新) // Direction 异动方向 0,入/收;1,出/发 // 删除时,是反着的 dto.actionType = transline.Direction.Value == 0 ? 1 : 0; list.Add(dto); //DMSAsync_PI07.stockDTO[] dtolist = service.Do(list.ToArray()); stockDTO[] dtolist = service.Do(list.ToArray()); // 改为异步调用了 //if (dtolist != null && dtolist.Length > 0 && dtolist[0].flag == 0) //{ // throw new BusinessException(dtolist[0].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)) { SalePriceList SalepriceList = key.GetEntity() as SalePriceList; if (PubHelper.IsOrg_SalePriceList2DMS(SalepriceList)) { bool flag = PubHelper.IsUsedDMSAPI(); if (flag) { // 电动车配件价表 if (IsUpdateDMS(SalepriceList)) { PI06ImplService service = new PI06ImplService(); // service.Url = PubHelper.GetAddress(service.Url); System.Collections.Generic.List <partBaseDto> lines = new System.Collections.Generic.List <partBaseDto>(); foreach (SalePriceLine line in SalepriceList.SalePriceLines) { if (line.Active && System.DateTime.Now >= line.FromDate && (System.DateTime.Now < line.ToDate || line.ToDate.ToString() == "9999.12.31")) { //SupplierItem.EntityList supitemlist = SupplierItem.Finder.FindAll(string.Format("Org={0} and ItemInfo.ItemID={1} and Effective.IsEffective=1 and '{2}' between Effective.EffectiveDate and Effective.DisableDate", Context.LoginOrg.ID.ToString(), line.ItemInfo.ItemID.ID.ToString(), System.DateTime.Now.ToString()), new OqlParam[0]); //SupplySource.EntityList supitemlist = SupplySource.Finder.FindAll(string.Format("Org={0} and ItemInfo.ItemID={1} and Effective.IsEffective=1 and '{2}' between Effective.EffectiveDate and Effective.DisableDate", Context.LoginOrg.ID.ToString(), line.ItemInfo.ItemID.ID.ToString(), System.DateTime.Now.ToString()), new OqlParam[0]); SupplySource.EntityList supitemlist = SupplySource.Finder.FindAll("ItemInfo.ItemCode=@ItemCode and Effective.IsEffective=1 and @Now between Effective.EffectiveDate and Effective.DisableDate" , new OqlParam(line.ItemInfo.ItemCode) , new OqlParam(System.DateTime.Today) ); if (supitemlist != null && supitemlist.Count > 0) { foreach (SupplySource i in supitemlist) { partBaseDto linedto = new partBaseDto(); linedto.suptCode = i.SupplierInfo.Supplier.Code; linedto.partCode = line.ItemInfo.ItemID.Code; linedto.partName = line.ItemInfo.ItemID.Name; if (line.ItemInfo.ItemID.InventoryUOM != null) { linedto.unit = line.ItemInfo.ItemID.InventoryUOM.Name; } if (line.ItemInfo.ItemID.PurchaseInfo != null) { linedto.miniPack = ((line.ItemInfo.ItemID.PurchaseInfo.MinRcvQty > 0) ? System.Convert.ToInt32(line.ItemInfo.ItemID.PurchaseInfo.MinRcvQty) : 1); } linedto.salePrice = float.Parse(line.Price.ToString()); linedto.unitPrace = linedto.salePrice; linedto.isDanger = "0"; linedto.isReturn = "1"; linedto.isSale = "1"; linedto.isFlag = "1"; linedto.isEffective = line.Active.ToString(); linedto.actionType = 2; lines.Add(linedto); } } else { partBaseDto linedto = new partBaseDto(); linedto.partCode = line.ItemInfo.ItemID.Code; linedto.partName = line.ItemInfo.ItemID.Name; if (line.ItemInfo.ItemID.InventoryUOM != null) { linedto.unit = line.ItemInfo.ItemID.InventoryUOM.Name; } if (line.ItemInfo.ItemID.PurchaseInfo != null) { linedto.miniPack = ((line.ItemInfo.ItemID.PurchaseInfo.MinRcvQty > 0) ? System.Convert.ToInt32(line.ItemInfo.ItemID.PurchaseInfo.MinRcvQty) : 1); } linedto.salePrice = float.Parse(line.Price.ToString()); linedto.unitPrace = linedto.salePrice; linedto.isDanger = "0"; linedto.isReturn = "1"; linedto.isSale = "1"; linedto.isFlag = "1"; linedto.isEffective = line.Active.ToString(); linedto.actionType = 2; lines.Add(linedto); } } } try { if (lines.Count > 0) { partBaseDto d = service.Do(lines.ToArray()); if (d != null && d.flag == 0) { throw new BusinessException(d.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)) { SalePriceList SalepriceList = key.GetEntity() as SalePriceList; // 不处理删除了,只处理生效就好了 return; if (PubHelper.IsOrg_SalePriceList2DMS(SalepriceList)) { bool flag = PubHelper.IsUsedDMSAPI(); if (flag) { // 电动车配件价表 //if (PubHelper.PriceList2DMS.Contains(SalepriceList.Code)) if (SalePriceListInserted.IsUpdateDMS(SalepriceList)) { PI06ImplService service = new PI06ImplService(); // service.Url = PubHelper.GetAddress(service.Url); System.Collections.Generic.List <partBaseDto> lines = new System.Collections.Generic.List <partBaseDto>(); using (System.Collections.Generic.IEnumerator <IPersistableObject> enumerator = SalepriceList.SalePriceLines.DelLists.GetEnumerator()) { while (enumerator.MoveNext()) { SalePriceLine line = (SalePriceLine)enumerator.Current; partBaseDto linedto = new partBaseDto(); linedto.partCode = line.ItemInfo.ItemID.Code; linedto.partName = line.ItemInfo.ItemID.Name; if (line.ItemInfo.ItemID.InventoryUOM != null) { linedto.unit = line.ItemInfo.ItemID.InventoryUOM.Name; } if (line.ItemInfo.ItemID.PurchaseInfo != null) { linedto.miniPack = ((line.ItemInfo.ItemID.PurchaseInfo.MinRcvQty > 0) ? System.Convert.ToInt32(line.ItemInfo.ItemID.PurchaseInfo.MinRcvQty) : 1); } linedto.salePrice = float.Parse(line.Price.ToString()); linedto.unitPrace = linedto.salePrice; linedto.isDanger = "0"; linedto.isReturn = "1"; linedto.isSale = "1"; linedto.isFlag = "1"; linedto.isEffective = line.Active.ToString(); linedto.actionType = 3; lines.Add(linedto); } } try { if (lines.Count > 0) { partBaseDto t = service.Do(lines.ToArray()); if (t != null && t.flag == 0) { throw new BusinessException(t.errMsg); } } } catch (System.Exception e) { throw new BusinessException("调用DMS接口错误:" + e.Message); } } } } } } }