diff --git a/BWP.B3_YunKen.Web/BWP.B3_YunKen.Web.csproj b/BWP.B3_YunKen.Web/BWP.B3_YunKen.Web.csproj index 99524d8..8863859 100644 --- a/BWP.B3_YunKen.Web/BWP.B3_YunKen.Web.csproj +++ b/BWP.B3_YunKen.Web/BWP.B3_YunKen.Web.csproj @@ -121,7 +121,9 @@ ASPXCodeBehind - + + ASPXCodeBehind + ASPXCodeBehind diff --git a/BWP.B3_YunKen.Web/Pages/B3YunKen/B3YunKenSaleOutStoreToCustomerAccept.cs b/BWP.B3_YunKen.Web/Pages/B3YunKen/B3YunKenSaleOutStoreToCustomerAccept.cs index 7495fce..6523c74 100644 --- a/BWP.B3_YunKen.Web/Pages/B3YunKen/B3YunKenSaleOutStoreToCustomerAccept.cs +++ b/BWP.B3_YunKen.Web/Pages/B3YunKen/B3YunKenSaleOutStoreToCustomerAccept.cs @@ -212,10 +212,13 @@ namespace BWP.Web.Pages.B3YunKen { var deliverAddressInput = hPanel2.Add(new DFTextBox() { Width=300}); hPanel2.Add(buildButton); buildButton.Click += delegate { - var ids = _grid.GetSelectedItems().Select(row => (long)row["ID"]); - if (!ids.Any()) + var items = _grid.GetSelectedItems().Select(row => new Tuple((long)row["ID"],(bool)row["IsSplitCreatedCustomerAccept"])); + if (!items.Any()) throw new ApplicationException("请选择单据!"); - BIFactory.Create().CreateCustomerAccept(ids, dateInput.Value, loadTimeInput.Value, orderTimeInput.Value, deliverAddressInput.Text); + var resultList = items.Where(x => x.Item2); + if (resultList.Count() > 0) + throw new ApplicationException("出库单No."+string.Join("、",resultList.Select(x=>x.Item1))+"已经拆分过,不得勾选"); + BIFactory.Create().CreateCustomerAccept(items.Select(x=>x.Item1), dateInput.Value, loadTimeInput.Value, orderTimeInput.Value, deliverAddressInput.Text); AspUtil.Alert(this, BIFactory.GetLastMessage()); _grid.DataBind(); }; @@ -240,6 +243,7 @@ namespace BWP.Web.Pages.B3YunKen { _grid.Columns.EAdd(new DFBrowseGridColumn("已验收数量")).SumMode = SumMode.Sum; _grid.Columns.EAdd(new DFBrowseGridColumn("Remark")); _grid.ValueColumns.Add("ID"); + _grid.ValueColumns.Add("IsSplitCreatedCustomerAccept"); _grid.SingleSelection += GridSingleSelection; } @@ -327,6 +331,7 @@ namespace BWP.Web.Pages.B3YunKen { query.Columns.Add(DQSelectColumn.Field("CustomerAcceptID")); } query.Columns.Add(DQSelectColumn.Field("ID",bill)); + query.Columns.Add(DQSelectColumn.Field("IsSplitCreatedCustomerAccept", bill)); query.Where.Conditions.Add(DQCondition.EQ("BillState", 单据状态.已审核)); query.Where.Conditions.Add(DQCondition.EQ("Domain_ID", DomainContext.Current.ID)); return query; diff --git a/BWP.B3_YunKen.Web/Pages/B3YunKen/ProductTask_/SaleOrderToProductNoticePage.cs b/BWP.B3_YunKen.Web/Pages/B3YunKen/ProductTask_/SaleOrderToProductNoticePage.cs index f29b151..7f1f21a 100644 --- a/BWP.B3_YunKen.Web/Pages/B3YunKen/ProductTask_/SaleOrderToProductNoticePage.cs +++ b/BWP.B3_YunKen.Web/Pages/B3YunKen/ProductTask_/SaleOrderToProductNoticePage.cs @@ -120,6 +120,14 @@ namespace BWP.Web.Pages.B3YunKen.ProductTask_ var remark = (string)row["Remark"]; var brandItem = Convert.ToInt64(row["BrandItem_ID"]); var unitNum = (Money?)row["本次生产数量"]; + if(unitNum!=null){ + var num = (Money?)row["Number"]; + if (unitNum > num) { + var id = (long)row["ID"]; + var goodsName = (string)row["Goods_Name"]; + throw new ApplicationException("销售订单NO."+id+"的["+goodsName+"]生产数量不能大于订单数量’"); + } + } var secondNumber = (Money?)row["本次生产辅数量"]; var dmoid = (long?)row["DmoID"]; var dmotypeid = (short?)row["DmoTypeID"]; @@ -254,6 +262,7 @@ namespace BWP.Web.Pages.B3YunKen.ProductTask_ grid.ValueColumns.Add("BrandItem_ID"); grid.ValueColumns.Add("DmoID"); grid.ValueColumns.Add("DmoTypeID"); + grid.ValueColumns.Add("ID"); } public void CreateQueryPanel(TitlePanel panel) diff --git a/BWP.B3_YunKen/BLActions/CusAcceptUpdateAcceptInfoBLAction.cs b/BWP.B3_YunKen/BLActions/CusAcceptUpdateAcceptInfoBLAction.cs new file mode 100644 index 0000000..a64bddb --- /dev/null +++ b/BWP.B3_YunKen/BLActions/CusAcceptUpdateAcceptInfoBLAction.cs @@ -0,0 +1,61 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using BWP.B3Sale.BL; +using BWP.B3Sale.BO; +using Forks.EnterpriseServices.BusinessInterfaces; +using Forks.EnterpriseServices.DomainObjects2; +using Forks.EnterpriseServices.DomainObjects2.DQuery; +using Forks.EnterpriseServices.SqlDoms; +using TSingSoft.WebPluginFramework.BIPlugins.BLEvents; + +namespace BWP.B3_YunKen.BLActions +{ + public class CusAcceptUpdateAcceptInfoBLAction : IBLMethodAction + { + public string Description + { + get { return "【客户验收单】删除或者作废时更新验收数量"; } + } + + public void Execute(Forks.EnterpriseServices.BusinessInterfaces.IDmoContext context, object dmo, object parameter) + { + var customer = dmo as CustomerAccept; + if (customer == null) + return; + var details = customer.Details.Where(x => x.BillType == DmoTypeIDAttribute.GetID(typeof(SaleOutStore)) && x.SourceBillDetailID != null && x.BillID != null); + var dom = new DmoQuery(typeof(SaleOutStore_DetailToCustomerAcceptNumber)); + dom.Where.Conditions.Add(DQCondition.InList(DQExpression.Field("SaleOutStore_Detail_ID"), details.Select(x=> DQExpression.Value(x.SourceBillDetailID)).ToArray())); + var acceptNumberList = context.Session.ExecuteList(dom).Cast(); + foreach (var detail in details) { + var accDetail = acceptNumberList.FirstOrDefault(x => x.SaleOutStore_Detail_ID == detail.SourceBillDetailID.Value); + bool isNew = false; + if (accDetail == null) { + accDetail = new SaleOutStore_DetailToCustomerAcceptNumber(); + accDetail.SaleOutStore_Detail_ID = detail.SourceBillDetailID.Value; + accDetail.SaleOutStore_ID = detail.BillID.Value; + isNew = true; + } + accDetail.AlreadyAcceptNumber = (accDetail.AlreadyAcceptNumber ?? 0) - (detail.AcceptNum ?? 0); + accDetail.AlreadyAcceptUnitNum = (accDetail.AlreadyAcceptUnitNum ?? 0) - (detail.AcceptNum ?? 0); + accDetail.AlreadyAcceptSecondNumber = (accDetail.AlreadyAcceptSecondNumber ?? 0) - (detail.AcceptSecondNumber ?? 0); + if (isNew) + context.Session.Insert(accDetail); + else { + context.Session.Update(accDetail); + } + } + } + + public IList Features + { + get { return new List(); } + } + + public string Name + { + get { return "B3_YunKen.【客户验收单】删除或者作废时更新验收数量"; } + } + } +} diff --git a/BWP.B3_YunKen/BLActions/CustomerWithDealerBLAction.cs b/BWP.B3_YunKen/BLActions/CustomerWithDealerBLAction.cs deleted file mode 100644 index 549df7e..0000000 --- a/BWP.B3_YunKen/BLActions/CustomerWithDealerBLAction.cs +++ /dev/null @@ -1,46 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using BWP.B3Frameworks.Utils; -using BWP.B3Sale.BL; -using BWP.B3Sale.BO; -using Forks.EnterpriseServices.BusinessInterfaces; -using Forks.EnterpriseServices.DomainObjects2; -using Forks.EnterpriseServices.DomainObjects2.DQuery; -using TSingSoft.WebPluginFramework.BIPlugins.BLEvents; - -namespace BWP.B3_YunKen.BLActions -{ - public class CustomerWithDealerBLAction : IBLMethodAction - { - public string Description - { - get { return @"1、【客户档案】保存增加业务逻辑:若该客户同时为经销商档案,则{是否经销商}选择为否,不能保存,提示:该客户是经销商客户是否经销商不能选择为否(客户名称查询【经销商】档案基本属性的‘经销商’) -2、【客户档案】增加保存逻辑:若该客户在【经销商】档案的明细表已存在,则{是否经销商}选择为是,不能保存,提示:该客户所属于**经销商,请先维护经销商档案"; } - } - - public void Execute(Forks.EnterpriseServices.BusinessInterfaces.IDmoContext context, object dmo, object parameter) - { - var customer = dmo as Customer; - if (customer != null) { - var id = InnerBLUtil.GetDmoProperty(context.Session, "ID", new Tuple("Customer_ID", customer.ID)); - if (id != null && !customer.IsDealers) - throw new ApplicationException("该客户是经销商客户是否经销商不能选择为否(客户名称查询【经销商】档案基本属性的‘经销商’)"); - var dealerID = InnerBLUtil.GetDmoProperty(context.Session, "Dealer_ID", new Tuple("Customer_ID", customer.ID)); - if (dealerID != null && customer.IsDealers) - throw new ApplicationException("该客户属于【经销商】档案No." + dealerID + ",请先维护经销商档案"); - } - } - - public IList Features - { - get { return new List(); } - } - - public string Name - { - get { return "B3_YunKen.【客户】档案与【经销商】档案逻辑控制"; } - } - } -} diff --git a/BWP.B3_YunKen/BWP.B3_YunKen.csproj b/BWP.B3_YunKen/BWP.B3_YunKen.csproj index 4a1aa0a..3467c76 100644 --- a/BWP.B3_YunKen/BWP.B3_YunKen.csproj +++ b/BWP.B3_YunKen/BWP.B3_YunKen.csproj @@ -63,8 +63,8 @@ + - @@ -75,6 +75,7 @@ + diff --git a/BWP.B3_YunKen/TypeIoc/CheckDealerInfoTypeIOC.cs b/BWP.B3_YunKen/TypeIoc/CheckDealerInfoTypeIOC.cs new file mode 100644 index 0000000..e306b43 --- /dev/null +++ b/BWP.B3_YunKen/TypeIoc/CheckDealerInfoTypeIOC.cs @@ -0,0 +1,27 @@ +using BWP.B3Sale.BL; +using System; +using BWP.B3Sale.BO; +using Forks.EnterpriseServices.BusinessInterfaces; +using BWP.B3Frameworks; +using Forks.EnterpriseServices.DomainObjects2.DQuery; +using Forks.EnterpriseServices.DomainObjects2; +using BWP.B3Frameworks.Utils; + +namespace BWP.B3_YunKen.TypeIocs +{ + [TypeIOC(typeof(CustomerBL), typeof(CustomerBL.ICheckDealerInfo))] + public class CheckDealerInfoTypeIOC : CustomerBL.ICheckDealerInfo + { + public void Invoke(Customer customer,IDmoSession session) + { + if (customer != null) { + var id = InnerBLUtil.GetDmoProperty(session, "ID", new Tuple("Customer_ID", customer.ID)); + if (id != null && !customer.IsDealers) + throw new ApplicationException("该客户是经销商客户是否经销商不能选择为否(客户名称查询【经销商】档案基本属性的‘经销商’)"); + var dealerID = InnerBLUtil.GetDmoProperty(session, "Dealer_ID", new Tuple("Customer_ID", customer.ID)); + if (dealerID != null && customer.IsDealers) + throw new ApplicationException("该客户属于【经销商】档案No." + dealerID + ",请先维护经销商档案"); + } + } + } +} \ No newline at end of file