Browse Source

加存货导入接口支持。

master
yibo 7 years ago
parent
commit
0191e643cc
6 changed files with 151 additions and 8 deletions
  1. +1
    -0
      B3ClientService.Web/Pages/B3ClientService/BaseInfos/Goods_/GoodsEdit.cs
  2. +1
    -1
      B3ClientService.Web/Pages/B3ClientService/Reports/CarcassInOutStoreAnalyse_/CarcassDetailDialog.cs
  3. +6
    -6
      B3ClientService.Web/Pages/B3ClientService/Reports/CarcassInOutStoreAnalyse_/CarcassInOutStoreAnalyse.cs
  4. +1
    -0
      B3ClientService/B3ClientService.csproj
  5. +4
    -0
      B3ClientService/BO/BaseInfo/Goods.cs
  6. +138
    -1
      B3ClientService/Rpcs/InterfaceRpc/GoodsRpc.cs

+ 1
- 0
B3ClientService.Web/Pages/B3ClientService/BaseInfos/Goods_/GoodsEdit.cs View File

@ -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());


+ 1
- 1
B3ClientService.Web/Pages/B3ClientService/Reports/CarcassInOutStoreAnalyse_/CarcassDetailDialog.cs View File

@ -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)
{


+ 6
- 6
B3ClientService.Web/Pages/B3ClientService/Reports/CarcassInOutStoreAnalyse_/CarcassInOutStoreAnalyse.cs View File

@ -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("清除条件"));
}


+ 1
- 0
B3ClientService/B3ClientService.csproj View File

@ -169,6 +169,7 @@
<Compile Include="Rpcs\BillRpc\SegmentationWeightRecord_\SegmentationWeightRecordDto.cs" />
<Compile Include="Rpcs\BillRpc\SegmentationWeightRecord_\SegmentationWeightRecordRpc.cs" />
<Compile Include="Rpcs\BillRpc\TrunksIousOutInStoreRecord_\TrunksIousOutInStoreRecordRpc.cs" />
<Compile Include="Rpcs\InterfaceRpc\GoodsRpc.cs" />
<Compile Include="Rpcs\RpcBO\Bill\ClientGoodsSetDto.cs" />
<Compile Include="Rpcs\RpcBO\Bill\GradeAndWeight\DataConfirmList.cs" />
<Compile Include="Rpcs\RpcBO\Bill\GradeAndWeight\GradeAndWeight.cs" />


+ 4
- 0
B3ClientService/BO/BaseInfo/Goods.cs View File

@ -24,5 +24,9 @@ namespace BWP.B3ClientService.BO
[LogicName("主单位")]
[DFNotEmpty]
public string MainUnit { get; set; }
[LogicName("辅单位")]
[DFNotEmpty]
public string SecondUnit { get; set; }
}
}

+ 138
- 1
B3ClientService/Rpcs/InterfaceRpc/GoodsRpc.cs View File

@ -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<List<Goods>>(json);
using (new WpfSpecialUserScope(InternalUser))
{
using (var session = Dmo.NewSession())
{
var bl = BIFactory.Create<IGoodsBL>(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<IGoodsBL>(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<IGoodsBL>(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<IGoodsBL>(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<Goods>(json);
using (new WpfSpecialUserScope(InternalUser))
{
using (var session = Dmo.NewSession())
{
var bl = BIFactory.Create<IGoodsBL>(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<IUserBL>().Get(WpfUser.InternalAccountName);
user.UserTag = WpfUser.InternalUserTag;
}
return user;
}
}
}
}

Loading…
Cancel
Save