protected void edit_Click(object sender, DirectEventArgs e) { string data = e.ExtraParams["data"]; System.Web.Script.Serialization.JavaScriptSerializer Serializer = new System.Web.Script.Serialization.JavaScriptSerializer(); List <XMLogisticsFeeMainNew> list = Serializer.Deserialize <List <XMLogisticsFeeMainNew> >(data); if (list.Count <= 0) { Ext.Net.ExtNet.Msg.Alert("提示", "你没有选择任何记录").Show(); return; } else if (list.Count > 1) { Ext.Net.ExtNet.Msg.Alert("提示", "只允许单选").Show(); return; } data_Bind(); Window1.Show(); fromPanel1.Reset(); BusinessLogic.ManageProject.XMLogisticsFeeMain entity = XMLogisticsFeeMainService.GetXMLogisticsFeeMainByID(list[0].ID); selectID.Value = list[0].ID; cbProject.Value = entity.ProjectID; cbWarehouse.Value = entity.WareHouseID; cbProvince.Value = entity.Province; cbCity.Value = entity.City; cbArea.Value = entity.Area; cbLogistics.Value = entity.LogisticsID; numPrice.Value = entity.Fee; btnEdit.Hidden = false; btnSave.Hidden = true; }
protected void btnSave_Click(object sender, DirectEventArgs e) { int projectID = int.Parse(cbProject.Text); int WarehouseID = int.Parse(cbWarehouse.Text); string Province = cbProvince.Text; string City = cbCity.Text; string Area = cbArea.Text; int LogisticsID = int.Parse(cbLogistics.Text); decimal fee = decimal.Parse(numPrice.Text); BusinessLogic.ManageProject.XMLogisticsFeeMain entity = XMLogisticsFeeMainService.getSingle(a => a.ProjectID == projectID && a.WareHouseID == WarehouseID && a.Province == Province && a.City == City && a.Area == Area && a.LogisticsID == LogisticsID); if (entity != null) { ExtNet.Msg.Alert("提示", "已有相同记录存在").Show(); return; } BusinessLogic.ManageProject.XMLogisticsFeeMain model = new BusinessLogic.ManageProject.XMLogisticsFeeMain(); model.ProjectID = projectID; model.WareHouseID = WarehouseID; model.Province = Province; model.City = City; model.Area = Area; model.LogisticsID = LogisticsID; model.Fee = fee; model.CreateID = HozestERPContext.Current.User.CustomerID; model.CreateDate = DateTime.Now; XMLogisticsFeeMainService.InsertXMLogisticsFeeMain(model, true); }
protected void btnEdit_Click(object sender, DirectEventArgs e) { int ID = int.Parse(selectID.Text); BusinessLogic.ManageProject.XMLogisticsFeeMain entity = XMLogisticsFeeMainService.GetXMLogisticsFeeMainByID(ID); entity.ProjectID = int.Parse(cbProject.Text); entity.WareHouseID = int.Parse(cbWarehouse.Text); entity.Province = cbProvince.Text; entity.City = cbCity.Text; entity.Area = cbArea.Text; entity.LogisticsID = int.Parse(cbLogistics.Text); entity.Fee = decimal.Parse(numPrice.Text); XMLogisticsFeeMainService.UpdateXMLogisticsFeeMain(entity); }
protected void btnDeleteClick(object sender, DirectEventArgs e) { string data = e.ExtraParams["data"]; System.Web.Script.Serialization.JavaScriptSerializer Serializer = new System.Web.Script.Serialization.JavaScriptSerializer(); List <XMLogisticsFeeMainNew> list = Serializer.Deserialize <List <XMLogisticsFeeMainNew> >(data); if (list.Count <= 0) { Ext.Net.ExtNet.Msg.Alert("提示", "你没有选择任何记录").Show(); return; } foreach (var item in list) { XMLogisticsFeeMainService.DeleteXMLogisticsFeeMain(item.ID, false); } XMLogisticsFeeMainService.saveChanges(); }
protected void btnCalculate_Click(object sender, DirectEventArgs e) { string OrderID = CommonHelper.QueryString("ID"); XMOrderInfo entity_Order = XMOrderInfoService.GetXMOrderInfoByID(int.Parse(OrderID)); if (entity_Order == null) { ExtNet.Msg.Alert("提示", "订单信息不存在").Show(); return; } XMProject entity_Project = XMProjectService.GetXMProjectById(entity_Order.ProjectId); if (entity_Project == null) { ExtNet.Msg.Alert("提示", "项目信息不存在").Show(); return; } if (entity_Project.ProjectName == "曲美") { //干线费用 decimal mainMoney = 0; //支线费用 decimal branchMoney = 0; string province = entity_Order.Province; string city = entity_Order.City; string region = entity_Order.County; string[] mes = entity_Order.CustomerServiceRemark.Split(new string[] { "///" }, StringSplitOptions.RemoveEmptyEntries); if (mes.Count() <= 0) { ExtNet.Msg.Alert("提示", "解析错误").Show(); return; } string[] mes1 = mes[0].Split(new string[] { "+" }, StringSplitOptions.RemoveEmptyEntries); if (mes1.Count() <= 0) { ExtNet.Msg.Alert("提示", "解析错误").Show(); return; } //查询干线物流公司信息 List <CodeList> codeList = CodeService.GetCodeListInfoByCodeTypeIDAndCodeName(243, mes1[0]); if (codeList.Count <= 0) { ExtNet.Msg.Alert("提示", "找不到干线物流公司信息").Show(); return; } int logisticsMainID = codeList[0].CodeID; //查询干线物流单价费率 BusinessLogic.ManageProject.XMLogisticsFeeMain entityMain = XMLogisticsFeeMainService. getSingle(a => a.ProjectID == entity_Project.Id && a.WareHouseID == 758 && province.StartsWith(a.Province) && city.StartsWith(a.City) && region.StartsWith(a.Area) && a.LogisticsID == logisticsMainID); if (entityMain == null) { ExtNet.Msg.Alert("提示", "找不到对应干线单价费率").Show(); return; } //只计算干线费用 if (mes1.Count() == 1) { //对应干线单价费率 decimal main = (decimal)entityMain.Fee; List <XMOrderInfoProductDetails> list_OrderProductDetails = XMOrderInfoProductDetailsService.GetXMOrderInfoProductDetailsList(entity_Order.ID); foreach (var item in list_OrderProductDetails) { string ProductVolume = string.IsNullOrEmpty(item.ProductVolume) ? "0" : item.ProductVolume; mainMoney = mainMoney + main * decimal.Parse(ProductVolume) * (int)item.ProductNum; } } //计算干线和支线费用 else if (mes1.Count() == 2) { //对应干线单价费率 decimal main = (decimal)entityMain.Fee; //查询支线物流公司信息 List <CodeList> codeList1 = CodeService.GetCodeListInfoByCodeTypeIDAndCodeName(244, mes1[1]); if (codeList.Count <= 0) { ExtNet.Msg.Alert("提示", "找不到支线物流公司信息").Show(); return; } List <XMOrderInfoProductDetails> list_OrderProductDetails = XMOrderInfoProductDetailsService.GetXMOrderInfoProductDetailsList(entity_Order.ID); foreach (var item in list_OrderProductDetails) { //对应支线单价费率 decimal Branch = 0; XMProduct entityProduct = XMProductService.getXMProductByManufacturersCode(item.TManufacturersCode); XMProductDetails entityProductDetails = XMProductDetailsService.GetXMProductDetailsListByProductId(entityProduct.Id)[0]; //查询支线物流单价费率 int logisticsBranchID = codeList1[0].CodeID; BusinessLogic.ManageProject.XMLogisticsFeeBranch entityBranch = XMLogisticsFeeBranchService. getSingle(a => a.ProjectID == entity_Project.Id && a.LogisticsID == logisticsBranchID && a.ProductCategoryID == entityProductDetails.ProductTypeId); if (entityBranch == null) { ExtNet.Msg.Alert("提示", "找不到对应支线单价费率").Show(); return; } Branch = (decimal)entityBranch.Fee; //商品体积 string ProductVolume = string.IsNullOrEmpty(entityProduct.ProductVolume) ? "0" : entityProduct.ProductVolume; mainMoney = mainMoney + main * decimal.Parse(ProductVolume) * (int)item.ProductNum; branchMoney = branchMoney + Branch * (int)item.ProductNum; } } //事务 using (TransactionScope scope = new TransactionScope()) { List <BusinessLogic.ManageProject.XMLogisticsFeeDetail> list = XMLogisticsFeeDetailService.getList(a => a.Type != 3); foreach (var item in list) { XMLogisticsFeeDetailService.delete(item); } if (mainMoney >= 0) { XMLogisticsFeeDetailService.InsertXMLogisticsFeeDetail(new BusinessLogic.ManageProject.XMLogisticsFeeDetail() { OrderID = entity_Order.ID, Type = 1, Fee = mainMoney, CreateID = HozestERPContext.Current.User.CustomerID, CreateDate = DateTime.Now, }); } if (branchMoney >= 0) { XMLogisticsFeeDetailService.InsertXMLogisticsFeeDetail(new BusinessLogic.ManageProject.XMLogisticsFeeDetail() { OrderID = entity_Order.ID, Type = 2, Fee = branchMoney, CreateID = HozestERPContext.Current.User.CustomerID, CreateDate = DateTime.Now, }); } scope.Complete(); } } else { ExtNet.Msg.Alert("提示", "不在计算范围内").Show(); return; } }