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 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)) { 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)) { 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; // 不处理删除了,只处理生效就好了 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); } } } } } } }
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)) { 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); } } } } } } } } } } }
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; // 删除不作处理,审核、弃审才处理 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)) { SalePriceList SalepriceList = key.GetEntity() as SalePriceList; 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>(); foreach (SalePriceLine line in SalepriceList.SalePriceLines) { //if (line.SysState != 8) if (line.SysState != UFSoft.UBF.PL.Engine.ObjectState.Deleted) { //if (line.SysState != 2) if (line.SysState != UFSoft.UBF.PL.Engine.ObjectState.Inserted) { if (line.OriginalData.Price != line.Price) { 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("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("G0")); 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); } } } } else 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); } } } } // 不处理删除了,只处理生效就好了 using (System.Collections.Generic.IEnumerator <IPersistableObject> enumerator3 = SalepriceList.SalePriceLines.DelLists.GetEnumerator()) { while (enumerator3.MoveNext()) { //SalePriceLine line = (SalePriceLine)enumerator3.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); } } partBaseDto t = null; try { if (lines.Count > 0) { t = service.Do(lines.ToArray()); } } catch (System.Exception e) { throw new BusinessException("调用DMS接口异常:" + e.Message); } if (t != null && t.flag == 0) { throw new BusinessException("DMS接口返回错误:" + t.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)) { dicAccountDTO = new Dictionary <long, accountReturnDto>(); ARBillHead ARbillhead = key.GetEntity() as ARBillHead; //if (voucher.Org.Code == "20") if (PubHelper.IsOrg_Finance2DMS()) { bool flag = PubHelper.IsUsedDMSAPI(); if (flag) { //if (ARbillhead.OriginalData.DocStatus == BillStatusEnum.Approving && ARbillhead.DocStatus == BillStatusEnum.Approved) int approveStatus = GetOperaTionType(ARbillhead); if (approveStatus > -1) { //SI05ImplService service = new SI05ImplService(); // service.Url = PubHelper.GetAddress(service.Url); bool flag2 = false; //accountReturnDto dto = new accountReturnDto(); foreach (ARBillLine line in ARbillhead.ARBillLines) { if (line.SrcDocType == ARBillSrcDocTypeEnum.ShipmentBill && line.SrcBillLineID > 0) { ShipLine shipline = ShipLine.Finder.FindByID(line.SrcBillLineID); if (PubHelper.IsUpdateDMS(shipline)) { accountReturnDto dto = GetAccountDTO(shipline); if (dto != null) { dto.dealerCode = ARbillhead.AccrueCust.Customer.Code; //if (ARbillhead.AccrueCust.Customer.CustomerCategoryKey != null) //{ // dto.customerType = ARbillhead.AccrueCust.Customer.CustomerCategory.Code; //} if (Context.LoginOrg.Code == PubHelper.Const_OrgCode_Electric) { // 电动车只有服务站 dto.customerType = "101006"; } else { if (ARbillhead.AccrueCust.Customer.CustomerCategoryKey != null) { dto.customerType = ARbillhead.AccrueCust.Customer.CustomerCategory.Code; } } dto.DMSShipNo = shipline.Ship.DescFlexField.PrivateDescSeg1; dto.dmsSaleNo = shipline.DescFlexField.PubDescSeg5; dto.earnestMoney = shipline.DescFlexField.PubDescSeg13; dto.vin = line.DescFlexField.PubDescSeg12; dto.deposit = shipline.DescFlexField.PubDescSeg21; dto.shipMoney = shipline.DescFlexField.PubDescSeg14; dto.UNineCreateUser = ARbillhead.CreatedBy; dto.amount += double.Parse((line.AROCMoney.NonTax + line.AROCMoney.GoodsTax).ToString()); // 0是发运扣款、1是退回退款 //dto.operaTionType = "0"; dto.operaTionType = approveStatus.ToString(); flag2 = true; } } } else if (line.SrcDocType == ARBillSrcDocTypeEnum.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) { dto.dealerCode = srcline.RMA.Customer.Customer.Code; dto.DMSShipNo = shipline != null ? shipline.Ship.DescFlexField.PrivateDescSeg1 : 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; dto.UNineCreateUser = ARbillhead.CreatedBy; //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.AROCMoney.NonTax + line.AROCMoney.GoodsTax).ToString()); // 0是发运扣款、1是退回退款 //dto.operaTionType = "1"; // 退货,取反 dto.operaTionType = (approveStatus == 1 ? 0 : (approveStatus == 0 ? 1 : -1)).ToString(); flag2 = true; } } } } } if (dicAccountDTO != null && dicAccountDTO.Count > 0 ) { foreach (accountReturnDto dto in dicAccountDTO.Values) { if (dto != null && dto.amount != 0.0 ) { dto.amount = System.Math.Round(dto.amount, 2); // 有DMS单号 if (dto.DMSShipNo.IsNotNullOrWhiteSpace()) { try { if (flag2) { 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; if (!(key == null)) { PrdEndChkBill prdendChkBill = key.GetEntity() as PrdEndChkBill; if (PubHelper.SaleOrg2DMS.Contains(Context.LoginOrg.Code)) { bool flag = PubHelper.IsUsedDMSAPI(); if (flag) { if (prdendChkBill.OriginalData.State == CheckStatus.Approving && prdendChkBill.State == CheckStatus.Approved && prdendChkBill.ItemInfo.ItemID.StockCategory.Code == "26") { 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 = prdendChkBill.ItemInfo.ItemID.Code; if (prdendChkBill.Supplier != null && prdendChkBill.Supplier.Supplier != null) { dto.supplier = prdendChkBill.Supplier.Supplier.Code; } dto.number = ((prdendChkBill.AdjQtySU == 0) ? 0 : System.Convert.ToInt32(prdendChkBill.AdjQtySU)); if (prdendChkBill.Lot != null) { dto.lot = prdendChkBill.Lot.LotCode; } if (prdendChkBill.Wh != null) { dto.WH = prdendChkBill.Wh.Code; } dto.actionType = 2; list.Add(dto); //DMSAsync_PI07.stockDTO[] t = service.Do(list.ToArray()); stockDTO[] t = service.Do(list.ToArray()); // 改为异步调用了 //if (t != null && t.Length > 0 && t[0].flag == 0) //{ // throw new BusinessException(t[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)) { 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)) { 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)) { TransferIn transferin = key.GetEntity() as TransferIn; if (PubHelper.SaleOrg2DMS.Contains(Context.LoginOrg.Code)) { bool flag = PubHelper.IsUsedDMSAPI(); if (flag) { if (transferin.DocType.Code == "MoveWH") { if (transferin.Status == TransInStatus.Approved && transferin.OriginalData.Status == TransInStatus.Approving) { SI11ImplService service = new SI11ImplService(); // service.Url = PubHelper.GetAddress(service.Url); System.Collections.Generic.List <vehicleMoveInfoDto> list = new System.Collections.Generic.List <vehicleMoveInfoDto>(); foreach (TransInLine line in transferin.TransInLines) { foreach (TransInSubLine subline in line.TransInSubLines) { vehicleMoveInfoDto dto = new vehicleMoveInfoDto(); dto.flowCode = ((subline.TransInLine.DescFlexSegments.PubDescSeg12.Length >= 8) ? subline.TransInLine.DescFlexSegments.PubDescSeg12.Substring(subline.TransInLine.DescFlexSegments.PubDescSeg12.Length - 8, 8) : subline.TransInLine.DescFlexSegments.PubDescSeg12); if (subline.TransInLine.TransInWhKey != null) { dto.toWarehose = subline.TransInLine.TransInWh.Code; } if (subline.TransOutWhKey != null) { dto.fromWarehose = subline.TransOutWh.Code; } list.Add(dto); } } try { vehicleMoveInfoDto dto2 = service.Do(list.ToArray()); if (dto2 != null && dto2.flag == 0) { throw new BusinessException(dto2.errMsg); } } catch (System.Exception e) { throw new BusinessException("调用DMS接口错误:" + e.Message); } } else if (transferin.Status == TransInStatus.Opening && transferin.OriginalData.Status == TransInStatus.Approved) { SI11ImplService service = new SI11ImplService(); // service.Url = PubHelper.GetAddress(service.Url); System.Collections.Generic.List <vehicleMoveInfoDto> list = new System.Collections.Generic.List <vehicleMoveInfoDto>(); foreach (TransInLine line in transferin.TransInLines) { foreach (TransInSubLine subline in line.TransInSubLines) { vehicleMoveInfoDto dto = new vehicleMoveInfoDto(); dto.flowCode = ((subline.TransInLine.DescFlexSegments.PubDescSeg12.Length >= 8) ? subline.TransInLine.DescFlexSegments.PubDescSeg12.Substring(subline.TransInLine.DescFlexSegments.PubDescSeg12.Length - 8, 8) : subline.TransInLine.DescFlexSegments.PubDescSeg12); if (subline.TransInLine.TransInWhKey != null) { dto.fromWarehose = subline.TransInLine.TransInWh.Code; } if (subline.TransOutWhKey != null) { dto.toWarehose = subline.TransOutWh.Code; } list.Add(dto); } } try { vehicleMoveInfoDto dto2 = service.Do(list.ToArray()); if (dto2 != null && dto2.flag == 0) { throw new BusinessException(dto2.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)) { 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) { if (args != null && args.Length != 0 && args[0] is EntityEvent) { BusinessEntity.EntityKey key = ((EntityEvent)args[0]).EntityKey; if (!(key == null)) { SalePriceAdjustment SalepriceAdjustment = key.GetEntity() as SalePriceAdjustment; if (PubHelper.IsOrg_SalePriceList2DMS(SalepriceAdjustment)) { bool flag = PubHelper.IsUsedDMSAPI(); if (flag) { PI06ImplService service = new PI06ImplService(); // service.Url = PubHelper.GetAddress(service.Url); System.Collections.Generic.List <partBaseDto> lines = new System.Collections.Generic.List <partBaseDto>(); foreach (SalePriceAdjustLine line in SalepriceAdjustment.SalePriceAdjustLines) { partBaseDto linedto = new partBaseDto(); linedto.suptCode = string.Empty; if (line.ItemInfo != null && line.ItemInfo.ItemIDKey != null) { 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.NewPrice.ToString()); linedto.unitPrace = linedto.salePrice; linedto.isDanger = "0"; linedto.isReturn = "1"; linedto.isSale = "1"; linedto.isFlag = "1"; linedto.isEffective = line.Lapse.ToString(); linedto.actionType = 1; 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)) { 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)) { CompleteRptRcvLine entity = key.GetEntity() as CompleteRptRcvLine; CompleteRpt rpt = entity.CompleteRpt; // 改为在完工报告单上判断,审核、最终检验,关闭、总装入库; return; if (entity == null || rpt == null ) { return; } bool flag = PubHelper.IsUsedDMSAPI(); if (flag) { // 制造组织(成都)的才做完工报告 if (Context.LoginOrg.Code == PubHelper.Const_OrgCode_Chengdu) { if (rpt.ProjectKey != null) { Project project = Project.Finder.Find("Code='" + rpt.Project.Code.ToString() + "' and org=" + rpt.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 (((rpt.MOKey != null && rpt.MO.MODocType.Code != "MO02") || rpt.PLSKey != null ) // 物料一样,说明是整车完工 && soline.ItemInfo.ItemID.Code == rpt.Item.Code ) { //CompleteRpt rpt = entity.CompleteRpt; if (rpt.DocState == CompleteRptStateEnum.Received && rpt.OriginalData.DocState == CompleteRptStateEnum.Approved) { try { SI03ImplService service = new SI03ImplService(); // service.Url = PubHelper.GetAddress(service.Url); vehicleInfoDto dto = new vehicleInfoDto(); if (rpt.ProjectKey != null) { dto.dmsSaleNo = rpt.Project.Code; } dto.vin = rpt.DescFlexField.PubDescSeg12; dto.erpMaterialCode = rpt.Item.Code; // 等待上线0,上线1,下线滞留2,下线调试3,最终检验4,总装入库5,调试检验6,车辆整改7 dto.nodeStatus = "5"; dto.oldVin = string.Empty; dto.flowingCode = ((rpt.DescFlexField.PubDescSeg12.Length >= 8) ? rpt.DescFlexField.PubDescSeg12.Substring(rpt.DescFlexField.PubDescSeg12.Length - 8, 8) : rpt.DescFlexField.PubDescSeg12); 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); } } } } } } } } } } }