diff --git a/B3ClientService.Web/Pages/B3ClientService/BaseInfos/Goods_/GoodsEdit.cs b/B3ClientService.Web/Pages/B3ClientService/BaseInfos/Goods_/GoodsEdit.cs index 0062f62..1cca119 100644 --- a/B3ClientService.Web/Pages/B3ClientService/BaseInfos/Goods_/GoodsEdit.cs +++ b/B3ClientService.Web/Pages/B3ClientService/BaseInfos/Goods_/GoodsEdit.cs @@ -18,6 +18,7 @@ namespace BWP.Web.Pages.B3ClientService.BaseInfos.Goods_ config.Add("Code"); config.Add("Spec"); config.Add("MainUnit"); + config.Add("SecondUnit"); config.Add("Remark"); layoutManager.Config = config; parent.Controls.Add(layoutManager.CreateLayout()); diff --git a/B3ClientService.Web/Pages/B3ClientService/Reports/CarcassInOutStoreAnalyse_/CarcassDetailDialog.cs b/B3ClientService.Web/Pages/B3ClientService/Reports/CarcassInOutStoreAnalyse_/CarcassDetailDialog.cs index 7cb3db2..cb450a0 100644 --- a/B3ClientService.Web/Pages/B3ClientService/Reports/CarcassInOutStoreAnalyse_/CarcassDetailDialog.cs +++ b/B3ClientService.Web/Pages/B3ClientService/Reports/CarcassInOutStoreAnalyse_/CarcassDetailDialog.cs @@ -37,7 +37,7 @@ namespace BWP.Web.Pages.B3ClientService.Reports.CarcassInOutStoreAnalyse_ DateTime startTime { get { return DateTime.Parse(Request.QueryString["Start"]); } } - DateTime endTime { get { return DateTime.Parse(Request.QueryString["End"]) + new TimeSpan(23, 59, 59); } } + DateTime endTime { get { return DateTime.Parse(Request.QueryString["End"]); } } protected override void InitForm(System.Web.UI.HtmlControls.HtmlForm form) { diff --git a/B3ClientService.Web/Pages/B3ClientService/Reports/CarcassInOutStoreAnalyse_/CarcassInOutStoreAnalyse.cs b/B3ClientService.Web/Pages/B3ClientService/Reports/CarcassInOutStoreAnalyse_/CarcassInOutStoreAnalyse.cs index 8f1861d..8925fd6 100644 --- a/B3ClientService.Web/Pages/B3ClientService/Reports/CarcassInOutStoreAnalyse_/CarcassInOutStoreAnalyse.cs +++ b/B3ClientService.Web/Pages/B3ClientService/Reports/CarcassInOutStoreAnalyse_/CarcassInOutStoreAnalyse.cs @@ -72,8 +72,8 @@ namespace BWP.Web.Pages.B3ClientService.Reports.CarcassInOutStoreAnalyse_ string BuildUrl(string goodsID) { var url = "~/B3ClientService/Reports/CarcassInOutStoreAnalyse_/CarcassDetailDialog.aspx"; - url = AspUtil.AddParamToUrl(url, "Start", HttpUtility.UrlEncode(startTime.ToString("yyyy/MM/dd"))); - url = AspUtil.AddParamToUrl(url, "End", HttpUtility.UrlEncode(endTime.ToString("yyyy/MM/dd"))); + url = AspUtil.AddParamToUrl(url, "Start", HttpUtility.UrlEncode(startTime.ToString("yyyy/MM/dd HH:mm:ss"))); + url = AspUtil.AddParamToUrl(url, "End", HttpUtility.UrlEncode(endTime.ToString("yyyy/MM/dd HH:mm:ss"))); url = AspUtil.AddParamToUrl(url, "Goods_ID", goodsID); return url; } @@ -86,8 +86,8 @@ namespace BWP.Web.Pages.B3ClientService.Reports.CarcassInOutStoreAnalyse_ cell.Style.Add("cursor", "pointer"); } - DFDateInput startInput; - DFDateInput endInput; + DFDateTimeInput startInput; + DFDateTimeInput endInput; DateTime startTime; DateTime endTime; private void AddQueryControl(Panel queryPanel) @@ -95,9 +95,9 @@ namespace BWP.Web.Pages.B3ClientService.Reports.CarcassInOutStoreAnalyse_ var hPanel = queryPanel.EAdd(new Panel()); hPanel.Style.Add("float", "right"); hPanel.EAdd(new SimpleLabel("期间")); - startInput = hPanel.EAdd(new DFDateInput() { Date = DateTime.Today }); + startInput = hPanel.EAdd(new DFDateTimeInput() { Date = DateTime.Today, DefaultTime = DateInputDefaultTime.minValue }); hPanel.EAdd(new LiteralControl("-")); - endInput = hPanel.EAdd(new DFDateInput() { Date = DateTime.Today, DefaultTime = DateInputDefaultTime.maxValue }); + endInput = hPanel.EAdd(new DFDateTimeInput() { Date = DateTime.Today + new TimeSpan(23, 59, 59), DefaultTime = DateInputDefaultTime.maxValue }); hPanel.EAdd(new TSButton("开始查询", delegate { StartQuery(); })); hPanel.EAdd(new RedirectTSButton("清除条件")); } diff --git a/B3ClientService/B3ClientService.csproj b/B3ClientService/B3ClientService.csproj index 7043a21..8581944 100644 --- a/B3ClientService/B3ClientService.csproj +++ b/B3ClientService/B3ClientService.csproj @@ -169,6 +169,7 @@ + diff --git a/B3ClientService/BO/BaseInfo/Goods.cs b/B3ClientService/BO/BaseInfo/Goods.cs index 1de3486..d3385ac 100644 --- a/B3ClientService/BO/BaseInfo/Goods.cs +++ b/B3ClientService/BO/BaseInfo/Goods.cs @@ -24,5 +24,9 @@ namespace BWP.B3ClientService.BO [LogicName("主单位")] [DFNotEmpty] public string MainUnit { get; set; } + + [LogicName("辅单位")] + [DFNotEmpty] + public string SecondUnit { get; set; } } } diff --git a/B3ClientService/Rpcs/InterfaceRpc/GoodsRpc.cs b/B3ClientService/Rpcs/InterfaceRpc/GoodsRpc.cs index 1104e77..36fe5b6 100644 --- a/B3ClientService/Rpcs/InterfaceRpc/GoodsRpc.cs +++ b/B3ClientService/Rpcs/InterfaceRpc/GoodsRpc.cs @@ -1,8 +1,15 @@ -using Forks.EnterpriseServices.JsonRpc; +using BWP.B3ClientService.BL; +using BWP.B3ClientService.BO; +using Forks.EnterpriseServices.BusinessInterfaces; +using Forks.EnterpriseServices.DomainObjects2; +using Forks.EnterpriseServices.DomainObjects2.DQuery; +using Forks.EnterpriseServices.JsonRpc; +using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; using System.Text; +using TSingSoft.WebPluginFramework; namespace BWP.B3ClientService.Rpcs.InterfaceRpc { @@ -10,5 +17,135 @@ namespace BWP.B3ClientService.Rpcs.InterfaceRpc public static class GoodsRpc { + [Rpc(RpcFlags.SkipAuth)] + public static int BatchImport(string json) + { + var list = JsonConvert.DeserializeObject>(json); + using (new WpfSpecialUserScope(InternalUser)) + { + using (var session = Dmo.NewSession()) + { + var bl = BIFactory.Create(session); + foreach (var item in list) + UpdateOrInsert(bl, session, item); + session.Commit(); + } + } + return 1; + } + + static Goods GetGoods(string Code, IDmoSession session) + { + var query = new DmoQuery(typeof(Goods)); + query.Where.Conditions.Add(DQCondition.EQ("Code", Code)); + return (Goods)session.ExecuteScalar(query); + } + + [Rpc(RpcFlags.SkipAuth)] + public static int Stop(string code) + { + using (new WpfSpecialUserScope(InternalUser)) + { + using (var session = Dmo.NewSession()) + { + var bl = BIFactory.Create(session); + var goods = GetGoods(code, session); + if (goods != null) + bl.Stop(goods); + session.Commit(); + } + } + return 1; + } + + [Rpc(RpcFlags.SkipAuth)] + public static int Start(string code) + { + using (new WpfSpecialUserScope(InternalUser)) + { + using (var session = Dmo.NewSession()) + { + var bl = BIFactory.Create(session); + var goods = GetGoods(code, session); + if (goods != null) + bl.Start(goods); + session.Commit(); + } + } + return 1; + } + + [Rpc(RpcFlags.SkipAuth)] + public static int Delete(string code) + { + using (new WpfSpecialUserScope(InternalUser)) + { + using (var session = Dmo.NewSession()) + { + var bl = BIFactory.Create(session); + var goods = GetGoods(code, session); + if (goods != null) + { + try + { + bl.Delete(goods); + } + catch { } + } + session.Commit(); + } + } + return 1; + } + + [Rpc(RpcFlags.SkipAuth)] + public static int UpdateOrInsert(string json) + { + var item = JsonConvert.DeserializeObject(json); + using (new WpfSpecialUserScope(InternalUser)) + { + using (var session = Dmo.NewSession()) + { + var bl = BIFactory.Create(session); + UpdateOrInsert(bl, session, item); + session.Commit(); + } + } + return 1; + } + + static void UpdateOrInsert(IGoodsBL bl, IDmoSession session, Goods serverGoods) + { + var goods = GetGoods(serverGoods.Code, session); + if (goods == null) + { + goods = new Goods(); + bl.InitNewDmo(goods); + goods.Code = serverGoods.Code; + } + goods.Name = serverGoods.Name; + goods.MainUnit = serverGoods.MainUnit; + goods.SecondUnit = serverGoods.SecondUnit; + goods.Spec = serverGoods.Spec; + goods.Remark = serverGoods.Remark; + if (goods.ID == 0) + bl.Insert(goods); + else + bl.Update(goods); + } + + static WpfUser user; + static WpfUser InternalUser + { + get + { + if (user == null) + { + user = BIFactory.Create().Get(WpfUser.InternalAccountName); + user.UserTag = WpfUser.InternalUserTag; + } + return user; + } + } } }