public HozestERP.BusinessLogic.ManageProject.XMDelivery ToInsertDelivery(XMOrderInfo Info, XMSpareAddress SpareAddress, int type) { HozestERP.BusinessLogic.ManageProject.XMDelivery info = new HozestERP.BusinessLogic.ManageProject.XMDelivery(); info.DeliveryTypeId = 480; //正常 info.DeliveryNumber = DateTime.Now.ToString("yyyyMMddHHmmssfff"); //发货单号; info.OrderCode = Info.OrderCode; if (type == 1 || type == 3) { info.FullName = Info.FullName; info.Mobile = Info.Mobile; info.Tel = Info.Tel; info.Province = Info.Province; info.City = Info.City; info.County = Info.County; info.DeliveryAddress = Info.DeliveryAddress; } else if (type == 2 || type == 4) { info.FullName = SpareAddress.FullName; info.Mobile = SpareAddress.Mobile; info.Tel = SpareAddress.Tel; info.Province = SpareAddress.Province; info.City = SpareAddress.City; info.County = SpareAddress.County; info.DeliveryAddress = SpareAddress.DeliveryAddress; } info.OrderRemarks = Info.CustomerServiceRemark; info.Shipper = 0; info.Price = 0; info.PrintBatch = 0; info.PrintQuantity = 0; info.IsDelivery = false; info.IsEnabled = false; info.CreateDate = DateTime.Now; info.CreateId = HozestERPContext.Current.User.CustomerID; info.UpdateDate = DateTime.Now; info.UpdateId = HozestERPContext.Current.User.CustomerID; //base.XMDeliveryService.InsertXMDelivery(info); return(info); }
protected void btnSave_Click(object sender, EventArgs e) { string area = ""; DateTime date = DateTime.Now; string AppointDeliveryTime = this.txtAppointDeliveryTime.Value.Trim(); string FullName = this.txtFullName.Text.Trim(); string Mobile = this.txtMobile.Text.Trim(); string Tel = this.txtTel.Text.Trim(); string DeliveryAddress = this.txtDeliveryAddress.Text.Trim(); if (FullName == "" || Mobile == "" || DeliveryAddress == "" || this.ddlProvince.SelectedItem.Text == "" || this.ddlCity.SelectedItem == null || this.ddlCounty.SelectedItem == null) { base.ShowMessage("数据不能为空!"); return; } var Exist = base.XMSpareAddressService.GetXMSpareAddressByParm(Id, TypeID); if (Exist != null) { if (DateTime.TryParse(AppointDeliveryTime, out date)) { Exist.AppointDeliveryTime = DateTime.Parse(AppointDeliveryTime); } Exist.FullName = FullName; Exist.Mobile = Mobile; Exist.Tel = Tel; if (this.ddlProvince.SelectedValue != "-1") { var info = base.AreaCodeService.GetAreaByNumberID(this.ddlProvince.SelectedValue); Exist.Province = this.ddlProvince.SelectedItem.Text.Trim(); if (this.ddlCity.SelectedValue != "-2" && this.ddlCity.SelectedValue != "-3" && this.ddlCity.SelectedValue != "-4") { Exist.Province += info.CityType; } area += Exist.Province; } if (this.ddlCity.SelectedValue == "-2" || this.ddlCity.SelectedValue == "-3" || this.ddlCity.SelectedValue == "-4") { Exist.City = Exist.Province; if (this.ddlCity.SelectedValue == "-3" || this.ddlCity.SelectedValue == "-4") { Exist.City += "市"; } area += Exist.City; } else if (this.ddlCity.SelectedValue != "-1" && this.ddlCity.SelectedValue != "-2" && this.ddlCity.SelectedValue != "-3" && this.ddlCity.SelectedValue != "-4" && this.ddlCity.SelectedValue != "") { var info = base.AreaCodeService.GetAreaByNumberID(this.ddlCity.SelectedValue); Exist.City = this.ddlCity.SelectedItem.Text.Trim() + info.CityType; area += Exist.City; } if (this.ddlCounty.SelectedValue != "-1" && this.ddlCounty.SelectedValue != "") { var info = base.AreaCodeService.GetAreaByNumberID(this.ddlCounty.SelectedValue); Exist.County = this.ddlCounty.SelectedItem.Text.Trim() + info.CityType; area += Exist.County; } Exist.DeliveryAddress = area + DeliveryAddress; Exist.UpdateID = HozestERPContext.Current.User.CustomerID; Exist.UpdateDate = DateTime.Now; base.XMSpareAddressService.UpdateXMSpareAddress(Exist); } else { XMSpareAddress Info = new XMSpareAddress(); Info.OtherID = Id; Info.TypeID = TypeID; if (DateTime.TryParse(AppointDeliveryTime, out date)) { Info.AppointDeliveryTime = DateTime.Parse(AppointDeliveryTime); } Info.FullName = FullName; Info.Mobile = Mobile; Info.Tel = Tel; if (this.ddlProvince.SelectedValue != "-1") { var info = base.AreaCodeService.GetAreaByNumberID(this.ddlProvince.SelectedValue); Info.Province = this.ddlProvince.SelectedItem.Text.Trim(); if (this.ddlCity.SelectedValue != "-2" && this.ddlCity.SelectedValue != "-3" && this.ddlCity.SelectedValue != "-4") { Info.Province += info.CityType; } area += Info.Province; } if (this.ddlCity.SelectedValue == "-2" || this.ddlCity.SelectedValue == "-3" || this.ddlCity.SelectedValue == "-4") { Info.City = Info.Province; if (this.ddlCity.SelectedValue == "-3" || this.ddlCity.SelectedValue == "-4") { Info.City += "市"; } area += Info.City; } else if (this.ddlCity.SelectedValue != "-1" && this.ddlCity.SelectedValue != "-2" && this.ddlCity.SelectedValue != "-3" && this.ddlCity.SelectedValue != "-4" && this.ddlCity.SelectedValue != "") { var info = base.AreaCodeService.GetAreaByNumberID(this.ddlCity.SelectedValue); Info.City = this.ddlCity.SelectedItem.Text.Trim() + info.CityType; area += Info.City; } if (this.ddlCounty.SelectedValue != "-1" && this.ddlCounty.SelectedValue != "") { var info = base.AreaCodeService.GetAreaByNumberID(this.ddlCounty.SelectedValue); Info.County = this.ddlCounty.SelectedItem.Text.Trim() + info.CityType; area += Info.County; } Info.DeliveryAddress = area + DeliveryAddress; Info.IsEnable = false; Info.CreateID = HozestERPContext.Current.User.CustomerID; Info.CreateDate = DateTime.Now; Info.UpdateID = HozestERPContext.Current.User.CustomerID; Info.UpdateDate = DateTime.Now; base.XMSpareAddressService.InsertXMSpareAddress(Info); } base.ShowMessage("保存成功!"); }
public bool GetPlanBillResult(List <XMOrderInfoProductDetails> list, XMOrderInfo Info, XMSpareAddress SpareAddress, int WarehouseID, int type) { ManufacturersCodeRecord = ""; bool complete = true; HozestERP.BusinessLogic.ManageProject.XMDelivery delivery = ToInsertDelivery(Info, SpareAddress, type); delivery.XM_Delivery_Details = new List <XMDeliveryDetails>(); foreach (var info in list) { var exist1 = base.XMInventoryInfoService.GetXMInventoryInfoByParm(info.TManufacturersCode, WarehouseID);//库存管理中的数据 if (type == 1 || type == 2) { var exist = base.XMXLMInventoryService.GetXMXLMInventoryListByParm(WarehouseID, info.TManufacturersCode, ""); if ((canXMLProject && exist.Count > 0 && exist[0].Inventory >= info.ProductNum) || (!canXMLProject && exist1 != null && exist1.StockNumber >= info.ProductNum)) { if (delivery.Shipper == 0) { var product = base.XMProductDetailsService.GetXMProductListByTManufacturersCode(info.TManufacturersCode); if (product != null && product.Count > 0) { delivery.Shipper = product[0].Shipper; } } if (delivery.OrderRemarks == Info.CustomerServiceRemark && !string.IsNullOrEmpty(info.SpareRemarks)) { delivery.OrderRemarks = info.SpareRemarks; } delivery.XM_Delivery_Details.Add(GetDeliveryDetails(info, Info.OrderCode, WarehouseID)); //减喜临门当日库存 if (canXMLProject) { InventoryList.Add((int)exist[0].Inventory - (int)info.ProductNum); XLMInventoryList.Add(exist[0]); } else { InventoryList.Add((int)exist1.StockNumber - (int)info.ProductNum); XMInventoryInfoList.Add(exist1); } } else { complete = false; ManufacturersCodeRecord += "产品编码:" + info.TManufacturersCode + ","; } } if (type == 3 || type == 4) //乳胶枕,U型枕,无备用地址 { var exist = base.XMXLMInventoryService.GetXMXLMInventoryListByParm(693, info.TManufacturersCode, ""); //南方仓库 if ((canXMLProject && exist.Count > 0 && exist[0].Inventory >= info.ProductNum) || (!canXMLProject && exist1 != null && exist1.StockNumber >= info.ProductNum)) { if (delivery.Shipper == 0) { var product = base.XMProductDetailsService.GetXMProductListByTManufacturersCode(info.TManufacturersCode); if (product != null && product.Count > 0) { delivery.Shipper = product[0].Shipper; } } if (delivery.OrderRemarks == Info.CustomerServiceRemark && !string.IsNullOrEmpty(info.SpareRemarks)) { delivery.OrderRemarks = info.SpareRemarks; } delivery.XM_Delivery_Details.Add(GetDeliveryDetails(info, Info.OrderCode, 693)); //减喜临门当日库存 if (canXMLProject) { InventoryList.Add((int)exist[0].Inventory - (int)info.ProductNum); XLMInventoryList.Add(exist[0]); } else { InventoryList.Add((int)exist1.StockNumber - (int)info.ProductNum); XMInventoryInfoList.Add(exist1); } } else { complete = false; ManufacturersCodeRecord += "产品编码:" + info.TManufacturersCode + ","; } } } if (complete == true && delivery.XM_Delivery_Details != null && delivery.XM_Delivery_Details.Count > 0) { DeliveryList.Add(delivery); } return(complete); }