public ABi_PO(YB_PO_Report_Swap po) { if (po.Lifnr.Length >= 6) po.Lifnr = po.Lifnr.Substring(po.Lifnr.Length-6,6); ABi_Vendor abi_wendor = new ABi_Vendor(po.Lifnr);//去abi_vendor找,如果没找到,等待下一轮处理 if (string.IsNullOrEmpty(abi_wendor.VendorCode) == false) { this.aBi_Vendor_ID = abi_wendor.ABi_Vendor_ID; } else { utils.WriteLog(String.Format("YB_PO_Report_Swap编号:{0} 未找到供应商编号: {1}", po.Ebeln, po.Lifnr)); return; } //根据Code在ABi表中找 ABi_Company abi_company=new ABi_Company(po.Bukrs); CompanyCode = po.Bukrs; if (abi_company.ABi_Company_ID == 0)//如果没找到,插入一条 { YB_CompanyCode yb = new YB_CompanyCode(po.Bukrs); abi_company.CompanyCode = yb.Companycode; abi_company.CompanyName = yb.Name; abi_company.SaveABi_Company();//插入一条 abi_company = new ABi_Company(po.Bukrs); this.aBi_Company_ID = abi_company.ABi_Company_ID; } else//如果找到直接赋值 { this.aBi_Company_ID = abi_company.ABi_Company_ID; } //查找bai_plant_id ABi_Plant abi_plant = new ABi_Plant(po.Werks); //如果在abi_plant查不到 则在abi_plant里面加一条数据 if (abi_plant.ABi_Plant_ID == 0) { YB_Plant_Masterdata yb_plant = new YB_Plant_Masterdata(po.Werks); if (yb_plant.IsNULL() == false) { abi_plant = new ABi_Plant(); abi_plant.PlantCode = yb_plant.Plant; abi_plant.PlantName = yb_plant.Plant_name; abi_plant.SaveABi_Plant(); this.aBi_Plant_ID = new ABi_Plant(po.Werks).ABi_Plant_ID; } else { new ABi_Plant(po.Werks).SaveABi_Plant(); this.aBi_Plant_ID = new ABi_Plant(po.Werks).ABi_Plant_ID; } } else this.aBi_Plant_ID = abi_plant.ABi_Plant_ID; this.pONumber = po.Ebeln; this.pOItemNumber = po.Ebelp; this.pOCreator = po.Name_text; this.pOCreateDate = po.Aedat; this.paymentTerm = po.Zterm; this.meterialNumber = String.IsNullOrEmpty(po.Matnr) ? "" : long.Parse(po.Matnr).ToString(); this.meterialName = po.Txz01; this.taxCode = po.Mwskz; this.isReturn = (!String.IsNullOrEmpty(po.retpo) && po.retpo == "X") ? 1 : 0 ;//退的订单,PO数据库中无该字段 this.quantity = (isReturn == 0) ? po.Menge : -po.Menge; this.quantityUnit = po.Meins; this.netPrice = po.Netpr; this.pirceUnit = po.Peinh; this.currency = po.Waers; this.amount = (isReturn == 0) ? po.Netwr : -po.Netwr; this.deliveryDate = po.Eindt; this.purchaseGroup = po.Ekgrp; this.dateCreated =DateTime.Now; this.dateModified=DateTime.Now; switch (po.Loekz) { case "001": this.deletion = "0"; break; case "002": this.deletion = "0"; break; case "003": this.deletion = "1"; break; } //this.movieType= this.deliverCompleted = po.Elikz; this.POStatus = po.bsart; }
public ABi_GR(YB_GR_Report_Swap po) { ABi_PO abi_po = new ABi_PO(po.Ebeln, po.Ebelp); if (abi_po.IsNULL() == false) { this.aBi_PO_ID = abi_po.ABi_PO_ID; } else { utils.WriteErrorLog("YB_PO_Report_Swap编号:" + po.Ebeln + "订单不存在" + po.Ebelp); return; } if (!String.IsNullOrEmpty(po.werks)) { var plant = new ABi_Plant(po.werks); if (plant.ABi_Plant_ID > 0) { this.ABi_Plant_ID = plant.ABi_Plant_ID; } else { plant.SaveABi_Plant(); plant = new ABi_Plant(po.werks); if (plant.ABi_Plant_ID > 0) { this.ABi_Plant_ID = plant.ABi_Plant_ID; } } } else return; this.aBi_Company_ID = abi_po.ABi_Company_ID; this.aBi_Vendor_ID = abi_po.ABi_Vendor_ID; this.gRNumber = po.Belnr; this.gRItemNumber = po.Buzei; this.gRYear=Convert.ToDateTime(po.Gjahr+"-01-01 00:00:00"); try { this.gRDate = Convert.ToDateTime(po.Budat); } catch { this.gRDate = DateTime.Now ; } this.quantity = po.Menge;//收获数量老数据库中是double类型 this.quantityUnit = po.Meins; if (abi_po.IsNULL() == false)//统一计量单位 { this.quantity = this.GetQuantityUnit(this.quantity, this.quantityUnit, abi_po); if (this.quantity != -65535)//如果是有效的就统一 { this.quantityUnit = abi_po.QuantityUnit; } else { this.quantity = po.Menge; this.quantityUnit = po.Meins; } } this.gRAmount = po.Dmbtr - po.Bnbtr; this.currency = po.Waers; try { this.refGRYear = Convert.ToDateTime(po.Gjahr+"-01-01 00:00:00"); } catch { } this.refGRNumber = po.Lfbnr; this.refGRItemNumber = po.Lfpos; this.dateCreated=DateTime.Now; this.dateModified=DateTime.Now; this.moveType = po.Bwart; if (this.moveType == "161" && (String.IsNullOrEmpty(refGRNumber) || String.IsNullOrEmpty(refGRItemNumber))) { refGRNumber = GRNumber; RefGRItemNumber = GRItemNumber; } if (this.moveType == "102" || this.moveType == "106" || this.moveType == "122" || this.moveType == "161") { this.quantity = this.quantity * -1;//收获数量老数据库中是double类型 this.GRAmount *= -1; } }