Browse Source

调整了一些东西

master
yibo 7 years ago
parent
commit
d547aa3d26
42 changed files with 1453 additions and 53 deletions
  1. +50
    -0
      B3ClientService.Web/B3ClientService.Web.csproj
  2. +122
    -0
      B3ClientService.Web/Pages/B3ClientService/BaseInfos/ClientGoodsSet_/ClientGoodsSetEdit.cs
  3. +28
    -0
      B3ClientService.Web/Pages/B3ClientService/BaseInfos/ClientGoodsSet_/ClientGoodsSetList.cs
  4. +43
    -0
      B3ClientService.Web/Pages/B3ClientService/BaseInfos/ClientGoodsSet_/ClientGoodsSetList.xml
  5. +26
    -0
      B3ClientService.Web/Pages/B3ClientService/BaseInfos/Goods_/GoodsEdit.cs
  6. +23
    -0
      B3ClientService.Web/Pages/B3ClientService/BaseInfos/Goods_/GoodsList.cs
  7. +43
    -0
      B3ClientService.Web/Pages/B3ClientService/BaseInfos/Goods_/GoodsList.xml
  8. +24
    -0
      B3ClientService.Web/Pages/B3ClientService/BaseInfos/ProductBatch_/ProductBatchEdit.cs
  9. +28
    -0
      B3ClientService.Web/Pages/B3ClientService/BaseInfos/ProductBatch_/ProductBatchList.cs
  10. +47
    -0
      B3ClientService.Web/Pages/B3ClientService/BaseInfos/ProductBatch_/ProductBatchList.xml
  11. +23
    -0
      B3ClientService.Web/Pages/B3ClientService/BaseInfos/WorkUnit_/WorkUnitEdit.cs
  12. +13
    -0
      B3ClientService.Web/Pages/B3ClientService/BaseInfos/WorkUnit_/WorkUnitList.cs
  13. +39
    -0
      B3ClientService.Web/Pages/B3ClientService/BaseInfos/WorkUnit_/WorkUnitList.xml
  14. +57
    -0
      B3ClientService.Web/Pages/B3ClientService/BaseInfos/Worker_/WorkerEdit.cs
  15. +13
    -0
      B3ClientService.Web/Pages/B3ClientService/BaseInfos/Worker_/WorkerList.cs
  16. +43
    -0
      B3ClientService.Web/Pages/B3ClientService/BaseInfos/Worker_/WorkerList.xml
  17. +40
    -0
      B3ClientService.Web/Pages/B3ClientService/Dialogs/SelectGoodsDialogs.cs
  18. +31
    -0
      B3ClientService.Web/Pages/B3ClientService/Dialogs/SelectGoodsDialogs.xml
  19. +9
    -11
      B3ClientService.Web/Utils/B3ClientServiceChoiceBoxDataProvider.cs
  20. +150
    -0
      B3ClientService.Web/WebControls/SelectNamedValueRelationBox.cs
  21. +11
    -0
      B3ClientService/B3ClientService.csproj
  22. +1
    -0
      B3ClientService/B3ClientServiceConsts.cs
  23. +20
    -0
      B3ClientService/BL/BaseInfo/ClientGoodsSetBL.cs
  24. +20
    -0
      B3ClientService/BL/BaseInfo/GoodsBL.cs
  25. +20
    -0
      B3ClientService/BL/BaseInfo/ProductBatchBL.cs
  26. +20
    -0
      B3ClientService/BL/BaseInfo/WorkUnitBL.cs
  27. +45
    -0
      B3ClientService/BL/BaseInfo/WorkerBL.cs
  28. +28
    -0
      B3ClientService/BO/BaseInfo/Goods.cs
  29. +6
    -5
      B3ClientService/BO/BaseInfo/ProductBatch.cs
  30. +7
    -5
      B3ClientService/BO/BaseInfo/WorkUnit.cs
  31. +30
    -0
      B3ClientService/BO/BaseInfo/Worker.cs
  32. +21
    -0
      B3ClientService/BO/BaseInfo/WorkerDriveRelate.cs
  33. +13
    -14
      B3ClientService/BO/ClientGoodsSet_/ClientGoodsSet.cs
  34. +15
    -14
      B3ClientService/BO/ClientGoodsSet_/ClientGoodsSet_Detail.cs
  35. +68
    -1
      B3ClientService/ConvertUtil.cs
  36. +17
    -0
      B3ClientService/InnerUtils.cs
  37. +13
    -0
      B3ClientService/NamedValueTemplate.cs
  38. +117
    -0
      B3ClientService/OfflinRpc/BaseInfoRpc.cs
  39. +59
    -0
      B3ClientService/OfflinRpc/LoginRpc.cs
  40. +2
    -2
      B3ClientService/Rpcs/BillRpc/ClientGoodsSetRpc.cs
  41. +9
    -0
      WebFolder/config/NamedValue/B3ClientService.xml
  42. +59
    -1
      WebFolder/config/plugins/B3ClientService.plugin

+ 50
- 0
B3ClientService.Web/B3ClientService.Web.csproj View File

@ -73,6 +73,39 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Pages\B3ClientService\BaseInfos\ClientGoodsSet_\ClientGoodsSetEdit.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Pages\B3ClientService\BaseInfos\ClientGoodsSet_\ClientGoodsSetList.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Pages\B3ClientService\BaseInfos\WorkUnit_\WorkUnitEdit.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Pages\B3ClientService\BaseInfos\WorkUnit_\WorkUnitList.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Pages\B3ClientService\BaseInfos\Goods_\GoodsEdit.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Pages\B3ClientService\BaseInfos\Goods_\GoodsList.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Pages\B3ClientService\BaseInfos\Worker_\WorkerEdit.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Pages\B3ClientService\BaseInfos\Worker_\WorkerList.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Pages\B3ClientService\BaseInfos\ProductBatch_\ProductBatchEdit.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Pages\B3ClientService\BaseInfos\ProductBatch_\ProductBatchList.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Pages\B3ClientService\Dialogs\SelectGoodsDialogs.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Pages\B3ClientService\Reports\CarcassLossAnalyse_\CarcassLossAnalyse.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
@ -88,6 +121,7 @@
<Compile Include="PluginClass.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Utils\B3ClientServiceChoiceBoxDataProvider.cs" />
<Compile Include="WebControls\SelectNamedValueRelationBox.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\B3ClientService\B3ClientService.csproj">
@ -95,6 +129,22 @@
<Name>B3ClientService</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Pages\B3ClientService\BaseInfos\ProductBatch_\ProductBatchList.xml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Pages\B3ClientService\BaseInfos\Worker_\WorkerList.xml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Pages\B3ClientService\BaseInfos\Goods_\GoodsList.xml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Pages\B3ClientService\BaseInfos\WorkUnit_\WorkUnitList.xml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Pages\B3ClientService\BaseInfos\ClientGoodsSet_\ClientGoodsSetList.xml" />
<EmbeddedResource Include="Pages\B3ClientService\Dialogs\SelectGoodsDialogs.xml" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.


+ 122
- 0
B3ClientService.Web/Pages/B3ClientService/BaseInfos/ClientGoodsSet_/ClientGoodsSetEdit.cs View File

@ -0,0 +1,122 @@
using BWP.B3ClientService;
using BWP.B3ClientService.BL;
using BWP.B3ClientService.BO;
using BWP.B3Frameworks.Utils;
using BWP.Web.CustomPageLayout;
using BWP.Web.Layout;
using BWP.Web.Utils;
using BWP.Web.WebControls;
using Forks.EnterpriseServices.DataForm;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI;
using System.Web.UI.WebControls;
using TSingSoft.WebControls2;
namespace BWP.Web.Pages.B3ClientService.BaseInfos.ClientGoodsSet_
{
class ClientGoodsSetEdit : BaseInfoEditPage<ClientGoodsSet, IClientGoodsSetBL>
{
private DFEditGrid _detailGrid;
protected override void BuildBasePropertiesEditor(TitlePanel titlePanel, PageLayoutSection pageLayoutSection)
{
var layoutManager = new LayoutManager("", mDFInfo, mDFContainer);
var config = new AutoLayoutConfig();
layoutManager.Config = config;
config.Add("ApplyClient");
config.Add("Name");
config.Add("Remark");
pageLayoutSection.ApplyLayout(layoutManager, config, mPageLayoutManager, mDFInfo);
titlePanel.Controls.Add(layoutManager.CreateLayout());
}
protected override void BuildBody(Control control)
{
base.BuildBody(control);
AddPayDetails(control.EAdd(new TitlePanel("存货明细", "存货明细")));
}
private void AddPayDetails(TitlePanel titlePanel)
{
var vPanel = titlePanel.EAdd(new VLayoutPanel());
if (CanSave)
{
var hPanel = vPanel.Add(new HLayoutPanel(), new VLayoutOption(HorizontalAlign.Left));
hPanel.Add(new SimpleLabel("选择存货"));
var selectGoods = new ChoiceBox(B3ClientServiceConsts.DataSources.) { Width = Unit.Pixel(130), EnableInputArgument = true, AutoPostBack = true, EnableTopItem = true, EnableMultiSelection = true };
selectGoods.SelectedValueChanged += delegate
{
_detailGrid.GetFromUI();
if (!selectGoods.IsEmpty)
{
var gids = selectGoods.GetValues().Distinct();
foreach (var g in gids)
{
var d = new ClientGoodsSet_Detail() { Goods_ID = long.Parse(g) };
DmoUtil.RefreshDependency(d, "Goods_ID");
Dmo.Details.Add(d);
}
}
selectGoods.Clear();
_detailGrid.DataBind();
};
hPanel.Add(selectGoods);
var addGoods = hPanel.Add(new DialogButton
{
Text = "选择存货",
});
addGoods.Url = "~/B3ClientService/Dialogs/SelectGoodsDialogs.aspx";
addGoods.Click += delegate
{
_detailGrid.GetFromUI();
foreach (var detail in DialogUtil.GetCachedObj<ClientGoodsSet_Detail>(this))
{
if (Dmo.Details.Any(x => x.Goods_ID == detail.Goods_ID))
continue;
Dmo.Details.Add(detail);
}
_detailGrid.DataBind();
};
};
var editor = new DFCollectionEditor<ClientGoodsSet_Detail>(() => Dmo.Details);
editor.AllowDeletionFunc = () => CanSave;
editor.CanDeleteFunc = detail => CanSave;
editor.IsEditableFunc = (field, detail) => CanSave;
_detailGrid = new DFEditGrid(editor);
_detailGrid.DFGridSetEnabled = false;
_detailGrid.Width = Unit.Percentage(100);
_detailGrid.Columns.Add(new DFEditGridColumn<DFValueLabel>("Goods_Code"));
_detailGrid.Columns.Add(new DFEditGridColumn<DFValueLabel>("Goods_Name"));
_detailGrid.Columns.Add(new DFEditGridColumn<DFValueLabel>("Goods_Spec"));
_detailGrid.Columns.Add(new DFEditGridColumn<DFTextBox>("StandardWeight"));
_detailGrid.Columns.Add(new DFEditGridColumn<DFTextBox>("StandardWeightUp"));
_detailGrid.Columns.Add(new DFEditGridColumn<DFTextBox>("StandardWeightLow"));
var section = mPageLayoutManager.AddSection("Detail", "存货明细");
titlePanel.SetPageLayoutSetting(mPageLayoutManager, section.Name);
section.ApplyLayout(_detailGrid, mPageLayoutManager, DFInfo.Get(typeof(ClientGoodsSet_Detail)));
vPanel.Add(_detailGrid);
}
public override void AppToUI()
{
base.AppToUI();
_detailGrid.DataBind();
}
public override void GetFromUI()
{
base.GetFromUI();
_detailGrid.GetFromUI();
}
}
}

+ 28
- 0
B3ClientService.Web/Pages/B3ClientService/BaseInfos/ClientGoodsSet_/ClientGoodsSetList.cs View File

@ -0,0 +1,28 @@
using BWP.B3ClientService.BL;
using BWP.B3ClientService.BO;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TSingSoft.WebControls2;
namespace BWP.Web.Pages.B3ClientService.BaseInfos.ClientGoodsSet_
{
class ClientGoodsSetList : BaseInfoListPage<ClientGoodsSet, IClientGoodsSetBL>
{
protected override void AddQueryControls(VLayoutPanel vPanel)
{
vPanel.Add(CreateDefaultBaseInfoQueryControls((panel, config) =>
{
config.AddBefore("ApplyClient", "Name");
}));
}
protected override void AddDFBrowseGridColumn(DFBrowseGrid grid, string field)
{
if (field == "Name")
AddDFBrowseGridColumn(grid, "ApplyClient");
base.AddDFBrowseGridColumn(grid, field);
}
}
}

+ 43
- 0
B3ClientService.Web/Pages/B3ClientService/BaseInfos/ClientGoodsSet_/ClientGoodsSetList.xml View File

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8" ?>
<Select xmlns="urn:XDQuery">
<Columns>
<Field name="ID"/>
</Columns>
<From>
<DmoClass class="BWP.B3ClientService.BO.ClientGoodsSet, B3ClientService"/>
</From>
<Where>
<And>
<EQ>
<Field name="ID"/>
<QBE paramName="ID"/>
</EQ>
<Or>
<Contains>
<Field name="Name"/>
<QBE paramName="Name"/>
</Contains>
<Contains>
<Field name="Spell"/>
<QBE paramName="Name"/>
</Contains>
</Or>
<EQ>
<Field name="ApplyClient"/>
<QBE paramName="ApplyClient"/>
</EQ>
<EQ>
<Field name="Stopped"/>
<QBE paramName="Stopped"/>
</EQ>
<EQ>
<Field name="IsLocked"/>
<QBE paramName="IsLocked"/>
</EQ>
<Contains>
<Field name="Remark"/>
<QBE paramName="Remark"/>
</Contains>
</And>
</Where>
</Select>

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

@ -0,0 +1,26 @@
using BWP.B3ClientService.BL;
using BWP.B3ClientService.BO;
using BWP.Web.Layout;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BWP.Web.Pages.B3ClientService.BaseInfos.Goods_
{
class GoodsEdit : BaseInfoEditPage<Goods, IGoodsBL>
{
protected override void BuildBody(System.Web.UI.Control parent)
{
var layoutManager = new LayoutManager("main", mDFInfo, mDFContainer);
var config = new AutoLayoutConfig() { Cols = 8 };
config.Add("Name");
config.Add("Code");
config.Add("Spec");
config.Add("MainUnit");
config.Add("Remark");
layoutManager.Config = config;
parent.Controls.Add(layoutManager.CreateLayout());
}
}
}

+ 23
- 0
B3ClientService.Web/Pages/B3ClientService/BaseInfos/Goods_/GoodsList.cs View File

@ -0,0 +1,23 @@
using BWP.B3ClientService.BL;
using BWP.B3ClientService.BO;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TSingSoft.WebControls2;
namespace BWP.Web.Pages.B3ClientService.BaseInfos.Goods_
{
public class GoodsList : BaseInfoListPage<Goods, IGoodsBL>
{
protected override void AddDFBrowseGridColumn(DFBrowseGrid grid, string field)
{
base.AddDFBrowseGridColumn(grid, field);
if (field == "Name")
{
AddDFBrowseGridColumn(grid, "Spec");
AddDFBrowseGridColumn(grid, "MainUnit");
}
}
}
}

+ 43
- 0
B3ClientService.Web/Pages/B3ClientService/BaseInfos/Goods_/GoodsList.xml View File

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8" ?>
<Select xmlns="urn:XDQuery">
<Columns>
<Field name="ID"/>
</Columns>
<From>
<DmoClass class="BWP.B3ClientService.BO.Goods, B3ClientService"/>
</From>
<Where>
<And>
<EQ>
<Field name="ID"/>
<QBE paramName="ID"/>
</EQ>
<Contains>
<Field name="Code"/>
<QBE paramName="Code"/>
</Contains>
<Or>
<Contains>
<Field name="Name"/>
<QBE paramName="Name"/>
</Contains>
<Contains>
<Field name="Spell"/>
<QBE paramName="Name"/>
</Contains>
</Or>
<EQ>
<Field name="Stopped"/>
<QBE paramName="Stopped"/>
</EQ>
<EQ>
<Field name="IsLocked"/>
<QBE paramName="IsLocked"/>
</EQ>
<Contains>
<Field name="Remark"/>
<QBE paramName="Remark"/>
</Contains>
</And>
</Where>
</Select>

+ 24
- 0
B3ClientService.Web/Pages/B3ClientService/BaseInfos/ProductBatch_/ProductBatchEdit.cs View File

@ -0,0 +1,24 @@
using BWP.B3ClientService.BL;
using BWP.B3ClientService.BO;
using BWP.Web.Layout;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BWP.Web.Pages.B3ClientService.BaseInfos.ProductBatch_
{
class ProductBatchEdit : BaseInfoEditPage<ProductBatch, IProductBatchBL>
{
protected override void BuildBody(System.Web.UI.Control parent)
{
var layoutManager = new LayoutManager("main", mDFInfo, mDFContainer);
var config = new AutoLayoutConfig() { Cols = 8 };
config.Add("Name");
config.Add("Date");
config.Add("Remark");
layoutManager.Config = config;
parent.Controls.Add(layoutManager.CreateLayout());
}
}
}

+ 28
- 0
B3ClientService.Web/Pages/B3ClientService/BaseInfos/ProductBatch_/ProductBatchList.cs View File

@ -0,0 +1,28 @@
using BWP.B3ClientService.BL;
using BWP.B3ClientService.BO;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TSingSoft.WebControls2;
namespace BWP.Web.Pages.B3ClientService.BaseInfos.ProductBatch_
{
public class ProductBatchList : BaseInfoListPage<ProductBatch, IProductBatchBL>
{
protected override void AddQueryControls(VLayoutPanel vPanel)
{
vPanel.Add(CreateDefaultBaseInfoQueryControls((panel, config) =>
{
config.AddAfter("Date", "Name");
}));
}
protected override void AddDFBrowseGridColumn(DFBrowseGrid grid, string field)
{
base.AddDFBrowseGridColumn(grid, field);
if (field == "Name")
AddDFBrowseGridColumn(grid, "Date");
}
}
}

+ 47
- 0
B3ClientService.Web/Pages/B3ClientService/BaseInfos/ProductBatch_/ProductBatchList.xml View File

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="utf-8" ?>
<Select xmlns="urn:XDQuery">
<Columns>
<Field name="ID"/>
</Columns>
<From>
<DmoClass class="BWP.B3ClientService.BO.ProductBatch, B3ClientService"/>
</From>
<Where>
<And>
<EQ>
<Field name="ID"/>
<QBE paramName="ID"/>
</EQ>
<Or>
<Contains>
<Field name="Name"/>
<QBE paramName="Name"/>
</Contains>
<Contains>
<Field name="Spell"/>
<QBE paramName="Name"/>
</Contains>
</Or>
<EQ>
<Field name="Stopped"/>
<QBE paramName="Stopped"/>
</EQ>
<GreaterThanOrEqual>
<Field name="Date"/>
<QBE paramName="MinDate"/>
</GreaterThanOrEqual>
<LessThanOrEqual>
<Field name="Date"/>
<QBE paramName="MaxDate"/>
</LessThanOrEqual>
<EQ>
<Field name="IsLocked"/>
<QBE paramName="IsLocked"/>
</EQ>
<Contains>
<Field name="Remark"/>
<QBE paramName="Remark"/>
</Contains>
</And>
</Where>
</Select>

+ 23
- 0
B3ClientService.Web/Pages/B3ClientService/BaseInfos/WorkUnit_/WorkUnitEdit.cs View File

@ -0,0 +1,23 @@
using BWP.B3ClientService.BL;
using BWP.B3ClientService.BO;
using BWP.Web.Layout;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BWP.Web.Pages.B3ClientService.BaseInfos.WorkUnit_
{
class WorkUnitEdit : BaseInfoEditPage<WorkUnit, IWorkUnitBL>
{
protected override void BuildBody(System.Web.UI.Control parent)
{
var layoutManager = new LayoutManager("main", mDFInfo, mDFContainer);
var config = new AutoLayoutConfig() { Cols = 8 };
config.Add("Name");
config.Add("Remark");
layoutManager.Config = config;
parent.Controls.Add(layoutManager.CreateLayout());
}
}
}

+ 13
- 0
B3ClientService.Web/Pages/B3ClientService/BaseInfos/WorkUnit_/WorkUnitList.cs View File

@ -0,0 +1,13 @@
using BWP.B3ClientService.BL;
using BWP.B3ClientService.BO;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BWP.Web.Pages.B3ClientService.BaseInfos.WorkUnit_
{
public class WorkUnitList : BaseInfoListPage<WorkUnit, IWorkUnitBL>
{
}
}

+ 39
- 0
B3ClientService.Web/Pages/B3ClientService/BaseInfos/WorkUnit_/WorkUnitList.xml View File

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8" ?>
<Select xmlns="urn:XDQuery">
<Columns>
<Field name="ID"/>
</Columns>
<From>
<DmoClass class="BWP.B3ClientService.BO.WorkUnit, B3ClientService"/>
</From>
<Where>
<And>
<EQ>
<Field name="ID"/>
<QBE paramName="ID"/>
</EQ>
<Or>
<Contains>
<Field name="Name"/>
<QBE paramName="Name"/>
</Contains>
<Contains>
<Field name="Spell"/>
<QBE paramName="Name"/>
</Contains>
</Or>
<EQ>
<Field name="Stopped"/>
<QBE paramName="Stopped"/>
</EQ>
<EQ>
<Field name="IsLocked"/>
<QBE paramName="IsLocked"/>
</EQ>
<Contains>
<Field name="Remark"/>
<QBE paramName="Remark"/>
</Contains>
</And>
</Where>
</Select>

+ 57
- 0
B3ClientService.Web/Pages/B3ClientService/BaseInfos/Worker_/WorkerEdit.cs View File

@ -0,0 +1,57 @@
using BWP.B3ClientService.BL;
using BWP.B3ClientService.BO;
using BWP.B3ClientService.NamedValueTemplate;
using BWP.Web.Layout;
using BWP.Web.Utils;
using BWP.Web.WebControls;
using Forks.EnterpriseServices.DomainObjects2;
using Forks.EnterpriseServices.DomainObjects2.DQuery;
using Forks.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TSingSoft.WebControls2;
namespace BWP.Web.Pages.B3ClientService.BaseInfos.Worker_
{
class WorkerEdit : BaseInfoEditPage<Worker, IWorkerBL>
{
protected override void BuildBody(System.Web.UI.Control parent)
{
var layoutManager = new LayoutManager("main", mDFInfo, mDFContainer);
layoutManager.Add("StrPwd", InputCreator.DFTextBox);
var driveSelect = new SelectNamedValueRelationBox<>(CanSave && !IsNew, typeof(WorkerDriveRelate), "Worker_ID", MinDmo.ID, "Drive");
layoutManager.Add("ReasonSelect", new SimpleLabel("终端"), driveSelect);
driveSelect.AddRelationAction = AddRelationAction;
driveSelect.DeleteRelationAction = DeleteRelationAction;
var config = new AutoLayoutConfig() { Cols = 8 };
config.Add("Name");
config.Add("Code");
config.Add("StrPwd");
config.Add("ReasonSelect");
config.Add("Remark");
layoutManager.Config = config;
parent.Controls.Add(layoutManager.CreateLayout());
}
void AddRelationAction(IDmoSession session, long selfKey, NamedValue<> value)
{
var rel = new WorkerDriveRelate() { Worker_ID = selfKey, Drive = value };
var query = new DQueryDom(new JoinAlias(typeof(WorkerDriveRelate)));
query.Columns.Add(DQSelectColumn.Field("Drive"));
query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("Worker_ID", selfKey), DQCondition.EQ("Drive", value)));
if (session.ExecuteScalar(query) != null)
throw new Exception("该终端已存在,无需重复加入");
session.Insert(rel);
}
void DeleteRelationAction(IDmoSession session, long selfKey, NamedValue<> value)
{
var del = new DQDeleteDom(typeof(WorkerDriveRelate));
del.Where.Conditions.Add(DQCondition.EQ("Worker_ID", selfKey));
del.Where.Conditions.Add(DQCondition.EQ("Drive", value));
session.ExecuteNonQuery(del);
}
}
}

+ 13
- 0
B3ClientService.Web/Pages/B3ClientService/BaseInfos/Worker_/WorkerList.cs View File

@ -0,0 +1,13 @@
using BWP.B3ClientService.BL;
using BWP.B3ClientService.BO;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BWP.Web.Pages.B3ClientService.BaseInfos.Worker_
{
public class WorkerList : BaseInfoListPage<Worker, IWorkerBL>
{
}
}

+ 43
- 0
B3ClientService.Web/Pages/B3ClientService/BaseInfos/Worker_/WorkerList.xml View File

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8" ?>
<Select xmlns="urn:XDQuery">
<Columns>
<Field name="ID"/>
</Columns>
<From>
<DmoClass class="BWP.B3ClientService.BO.Worker, B3ClientService"/>
</From>
<Where>
<And>
<EQ>
<Field name="ID"/>
<QBE paramName="ID"/>
</EQ>
<Contains>
<Field name="Code"/>
<QBE paramName="Code"/>
</Contains>
<Or>
<Contains>
<Field name="Name"/>
<QBE paramName="Name"/>
</Contains>
<Contains>
<Field name="Spell"/>
<QBE paramName="Name"/>
</Contains>
</Or>
<EQ>
<Field name="Stopped"/>
<QBE paramName="Stopped"/>
</EQ>
<EQ>
<Field name="IsLocked"/>
<QBE paramName="IsLocked"/>
</EQ>
<Contains>
<Field name="Remark"/>
<QBE paramName="Remark"/>
</Contains>
</And>
</Where>
</Select>

+ 40
- 0
B3ClientService.Web/Pages/B3ClientService/Dialogs/SelectGoodsDialogs.cs View File

@ -0,0 +1,40 @@
using BWP.B3ClientService.BO;
using BWP.Web.Layout;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TSingSoft.WebControls2;
namespace BWP.Web.Pages.B3ClientService.Dialogs
{
class SelectGoodsDialogs : DmoMultiSelectDialog<Goods, ClientGoodsSet_Detail>
{
protected override void CreateQuery(VLayoutPanel vPanel)
{
var panel = new LayoutManager("", mDFInfo, mQueryContainer);
var config = new AutoLayoutConfig();
panel.Config = config;
config.Add("Name");
config.Add("Code");
vPanel.Add(panel.CreateLayout());
base.CreateQuery(vPanel);
}
protected override void CreateQueryGridColumns(TSingSoft.WebControls2.DFBrowseGrid grid)
{
grid.Columns.Add(new DFBrowseGridColumn("Name"));
grid.Columns.Add(new DFBrowseGridColumn("Code"));
grid.Columns.Add(new DFBrowseGridColumn("Spec"));
grid.Columns.Add(new DFBrowseGridColumn("MainUnit"));
}
protected override void SetResultFromDFDataRow(ClientGoodsSet_Detail dmo, Forks.EnterpriseServices.DataForm.DFDataRow row)
{
dmo.Goods_ID = (long)row["ID"];
dmo.Goods_Name = (string)row["Name"];
dmo.Goods_Code = (string)row["Code"];
dmo.Goods_Spec = (string)row["Spec"];
}
}
}

+ 31
- 0
B3ClientService.Web/Pages/B3ClientService/Dialogs/SelectGoodsDialogs.xml View File

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8" ?>
<Select xmlns="urn:XDQuery">
<Columns>
<Field name="ID"/>
</Columns>
<From>
<DmoClass class="BWP.B3ClientService.BO.Goods, B3ClientService"/>
</From>
<Where>
<And>
<Or>
<Contains>
<Field name="Name" />
<QBE paramName="Name"/>
</Contains>
<Contains>
<Field name="Spell" />
<QBE paramName="Name"/>
</Contains>
</Or>
<Contains>
<Field name="Code"/>
<QBE paramName="Code"/>
</Contains>
<EQ>
<Field name="Stopped"/>
<False/>
</EQ>
</And>
</Where>
</Select>

+ 9
- 11
B3ClientService.Web/Utils/B3ClientServiceChoiceBoxDataProvider.cs View File

@ -1,5 +1,6 @@
using BWP.B3ClientService;
using BWP.B3ClientService.BO;
using BWP.B3Frameworks.Utils;
using Forks.EnterpriseServices.DomainObjects2;
using Forks.EnterpriseServices.DomainObjects2.DQuery;
using System;
@ -15,18 +16,15 @@ namespace BWP.Web.Utils
{
public static void Register()
{
ChoiceBoxSettings.Register(B3ClientServiceConsts.DataSources., argu =>
{
var dom = new DQueryDom(new JoinAlias(typeof(ProductBatch)));
dom.Columns.Add(DQSelectColumn.Field("Name"));
dom.Columns.Add(DQSelectColumn.Field("ID"));
if (!string.IsNullOrWhiteSpace(argu.InputArgument))
ChoiceBoxSettings.Register(B3ClientServiceConsts.DataSources., (argu) =>
new ChoiceBoxQueryHelper<ProductBatch>(argu, true)
{
dom.Where.Conditions.Add(DQCondition.Like("Name", argu.InputArgument));
}
dom.OrderBy.Expressions.Add(DQOrderByExpression.Create("Date", true));
return dom.EExecuteList<string, long>().Select(x => new TSingSoft.WebControls2.WordPair(x.Item1, x.Item2.ToString()));
BeforeQuery = query => query.OrderBy.Expressions.Add(DQOrderByExpression.Create("Date", true))
}.GetData());
ChoiceBoxSettings.Register(B3ClientServiceConsts.DataSources., (argu) =>
{
return new ChoiceBoxQueryHelper<Goods>(argu, true).GetData();
});
}
}


+ 150
- 0
B3ClientService.Web/WebControls/SelectNamedValueRelationBox.cs View File

@ -0,0 +1,150 @@
using Forks.EnterpriseServices.BusinessInterfaces;
using Forks.EnterpriseServices.DomainObjects2;
using Forks.EnterpriseServices.DomainObjects2.DQuery;
using Forks.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI;
using System.Web.UI.WebControls;
using TSingSoft.WebControls2;
using TSingSoft.WebPluginFramework;
namespace BWP.Web.WebControls
{
public class SelectNamedValueRelationBox<T> : WebControl, INamingContainer
{
interface IEditor
{
object GetData();
}
IEditor mEditor;
class Editor1<T1> : IEditor
{
Type mRelationType;
string mSelfField;
long mSelfValue;
string mOtherField;
public Editor1(Type relationType, string selfField, long selfValue, string otherField)
{
this.mRelationType = relationType;
this.mSelfField = selfField;
this.mSelfValue = selfValue;
this.mOtherField = otherField;
}
public object GetData()
{
var query = new DQueryDom(new JoinAlias(mRelationType));
query.Where.Conditions.Add(DQCondition.EQ(mSelfField, mSelfValue));
query.Columns.Add(DQSelectColumn.Field(mOtherField));
return query.EExecuteList<NamedValue<T1>>();
}
}
long mSelfValue;
public SelectNamedValueRelationBox(bool canEdit, Type relationType, string selfField, long selfValue, string otherField)
{
CanEdit = canEdit;
mSelfValue = selfValue;
mEditor = new Editor1<T>(relationType, selfField, selfValue, otherField);
}
class RepeaterTemplate : ITemplate
{
public bool CanEdit;
Label label;
LinkButton linkButton;
public void InstantiateIn(Control container)
{
label = new Label();
linkButton = new LinkButton() { Text = "x", Visible = CanEdit };
container.Controls.Add(linkButton);
container.Controls.Add(new LiteralControl(" "));
container.Controls.Add(label);
container.Controls.Add(new LiteralControl(" "));
container.DataBinding += new EventHandler(container_DataBinding);
}
void container_DataBinding(object sender, EventArgs e)
{
var item = (RepeaterItem)sender;
var dataItem = item.DataItem as NamedValue<T>?;
label.Text = dataItem.Value.Name;
linkButton.CommandName = "Delete";
linkButton.CommandArgument = dataItem.Value.Value.ToString();
}
}
Repeater repeater;
NamedValueInput<T> box;
public bool CanEdit;
protected override void CreateChildControls()
{
repeater = new Repeater();
repeater.ItemTemplate = new RepeaterTemplate() { CanEdit = this.CanEdit };
Controls.Add(repeater);
repeater.ItemCommand += (sender, e) =>
{
var value = new NamedValue<T>(short.Parse(e.CommandArgument.ToString()));
using (var context = new TransactionContext())
{
DeleteRelationAction(context.Session, mSelfValue, value);
context.Commit();
}
RepeaterDataBind();
};
box = new NamedValueInput<T>() { EnableTopItem = true, Width = Unit.Pixel(120) };
box.AutoPostBack = true;
box.Visible = CanEdit;
box.SelectedValueChanged += (sender, e) =>
{
if (box.IsEmpty)
{
return;
}
using (var context = new TransactionContext())
{
AddRelationAction(context.Session, mSelfValue, box.Value.Value);
context.Commit();
}
RepeaterDataBind();
box.Clear();
};
Controls.Add(box);
}
public Action<IDmoSession, long, NamedValue<T>> AddRelationAction;
public Action<IDmoSession, long, NamedValue<T>> DeleteRelationAction;
void RepeaterDataBind()
{
EnsureChildControls();
repeater.DataSource = (IList<NamedValue<T>>)mEditor.GetData();
repeater.DataBind();
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
if (!Page.IsPostBack)
{
RepeaterDataBind();
}
}
}
}

+ 11
- 0
B3ClientService/B3ClientService.csproj View File

@ -72,6 +72,11 @@
<ItemGroup>
<Compile Include="B3ClientServiceConsts.cs" />
<Compile Include="B3ClientServiceOnLineConfig.cs" />
<Compile Include="BL\BaseInfo\ClientGoodsSetBL.cs" />
<Compile Include="BL\BaseInfo\GoodsBL.cs" />
<Compile Include="BL\BaseInfo\ProductBatchBL.cs" />
<Compile Include="BL\BaseInfo\WorkerBL.cs" />
<Compile Include="BL\BaseInfo\WorkUnitBL.cs" />
<Compile Include="BO\BaseInfo\BaseInfo.cs" />
<Compile Include="BO\BaseInfo\BodyDiscontItem.cs" />
<Compile Include="BO\BaseInfo\BodyDiscontRelate.cs" />
@ -80,6 +85,7 @@
<Compile Include="BO\BaseInfo\DeliverGoodsLine.cs" />
<Compile Include="BO\BaseInfo\EmpInfoTable.cs" />
<Compile Include="BO\BaseInfo\Farmer.cs" />
<Compile Include="BO\BaseInfo\Goods.cs" />
<Compile Include="BO\BaseInfo\HogGrade.cs" />
<Compile Include="BO\BaseInfo\LiveColonyHouse.cs" />
<Compile Include="BO\BaseInfo\Livestock.cs" />
@ -90,6 +96,8 @@
<Compile Include="BO\BaseInfo\Store.cs" />
<Compile Include="BO\BaseInfo\Supplier.cs" />
<Compile Include="BO\BaseInfo\WhiteBar.cs" />
<Compile Include="BO\BaseInfo\Worker.cs" />
<Compile Include="BO\BaseInfo\WorkerDriveRelate.cs" />
<Compile Include="BO\BaseInfo\WorkShop.cs" />
<Compile Include="BO\BaseInfo\WorkUnit.cs" />
<Compile Include="BO\BaseInfo\Zone.cs" />
@ -137,6 +145,8 @@
<Compile Include="CTuple.cs" />
<Compile Include="DataPatch\UpdatePurchaseTypeColumn.cs" />
<Compile Include="NamedValueTemplate.cs" />
<Compile Include="OfflinRpc\BaseInfoRpc.cs" />
<Compile Include="OfflinRpc\LoginRpc.cs" />
<Compile Include="Rpcs\BillRpc\BaseInfoRpc.cs" />
<Compile Include="Rpcs\BillRpc\BeforeDeathRpc.cs" />
<Compile Include="Rpcs\BillRpc\ByProductWeightRecordRpc.cs" />
@ -184,6 +194,7 @@
<Compile Include="Tasks\UpdateLoad\UploadTrunksIousOutInStoreRecord.cs" />
<Compile Include="Tasks\UpdateLoad\UpLoadWeightBill.cs" />
<Compile Include="ClientServiceUtils.cs" />
<Compile Include="InnerUtils.cs" />
<Compile Include="Utils\SegmentationByPproductTraceBL.cs" />
<Compile Include="Utils\UrlUtil.cs" />
<Compile Include="WordPair.cs" />


+ 1
- 0
B3ClientService/B3ClientServiceConsts.cs View File

@ -11,6 +11,7 @@ namespace BWP.B3ClientService
{
internal const string Prefix = "B3ClientService_";
public const string = Prefix + "生产批次";
public const string = Prefix + "存货";
}
}
}

+ 20
- 0
B3ClientService/BL/BaseInfo/ClientGoodsSetBL.cs View File

@ -0,0 +1,20 @@
using BWP.B3ClientService.BO;
using BWP.B3Frameworks.BL;
using Forks.EnterpriseServices;
using Forks.EnterpriseServices.BusinessInterfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BWP.B3ClientService.BL
{
[LogicName("客户端存货配置")]
[BusinessInterface(typeof(ClientGoodsSetBL))]
public interface IClientGoodsSetBL : IBaseInfoBL<ClientGoodsSet>
{ }
public class ClientGoodsSetBL : BaseInfoBL<ClientGoodsSet>, IClientGoodsSetBL
{
}
}

+ 20
- 0
B3ClientService/BL/BaseInfo/GoodsBL.cs View File

@ -0,0 +1,20 @@
using BWP.B3ClientService.BO;
using BWP.B3Frameworks.BL;
using Forks.EnterpriseServices;
using Forks.EnterpriseServices.BusinessInterfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BWP.B3ClientService.BL
{
[LogicName("存货")]
[BusinessInterface(typeof(GoodsBL))]
public interface IGoodsBL : IBaseInfoBL<Goods>
{ }
public class GoodsBL : BaseInfoBL<Goods>, IGoodsBL
{
}
}

+ 20
- 0
B3ClientService/BL/BaseInfo/ProductBatchBL.cs View File

@ -0,0 +1,20 @@
using BWP.B3ClientService.BO;
using BWP.B3Frameworks.BL;
using Forks.EnterpriseServices;
using Forks.EnterpriseServices.BusinessInterfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BWP.B3ClientService.BL
{
[BusinessInterface(typeof(ProductBatchBL))]
[LogicName("生产批次")]
public interface IProductBatchBL : IBaseInfoBL<ProductBatch>
{ }
public class ProductBatchBL : BaseInfoBL<ProductBatch>, IProductBatchBL
{
}
}

+ 20
- 0
B3ClientService/BL/BaseInfo/WorkUnitBL.cs View File

@ -0,0 +1,20 @@
using BWP.B3ClientService.BO;
using BWP.B3Frameworks.BL;
using Forks.EnterpriseServices;
using Forks.EnterpriseServices.BusinessInterfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BWP.B3ClientService.BL
{
[LogicName("工作单元")]
[BusinessInterface(typeof(WorkUnitBL))]
public interface IWorkUnitBL : IBaseInfoBL<WorkUnit>
{ }
public class WorkUnitBL : BaseInfoBL<WorkUnit>, IWorkUnitBL
{
}
}

+ 45
- 0
B3ClientService/BL/BaseInfo/WorkerBL.cs View File

@ -0,0 +1,45 @@
using BWP.B3ClientService.BO;
using BWP.B3Frameworks.BL;
using Forks.EnterpriseServices;
using Forks.EnterpriseServices.BusinessInterfaces;
using Forks.EnterpriseServices.DomainObjects2.DQuery;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BWP.B3ClientService.BL
{
[LogicName("操作员")]
[BusinessInterface(typeof(WorkerBL))]
public interface IWorkerBL : IBaseInfoBL<Worker>
{
void ChangePassword(long id, string password);
}
public class WorkerBL : BaseInfoBL<Worker>, IWorkerBL
{
protected override void beforeSave(Worker dmo)
{
if (string.IsNullOrEmpty(dmo.StrPwd))
dmo.Password = InnerUtils.EncodePwd(dmo.StrPwd);
base.beforeSave(dmo);
}
protected override void doInsert(Worker dmo)
{
if (string.IsNullOrEmpty(dmo.StrPwd))
throw new Exception("初始密码不能为空!");
dmo.Password = InnerUtils.EncodePwd(dmo.StrPwd);
base.doInsert(dmo);
}
public void ChangePassword(long id, string password)
{
var update = new DQUpdateDom(typeof(Worker));
update.Where.Conditions.Add(DQCondition.EQ("ID", id));
update.Columns.Add(new DQUpdateColumn("Password", InnerUtils.EncodePwd(password)));
Session.ExecuteNonQuery(update);
}
}
}

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

@ -0,0 +1,28 @@
using Forks.EnterpriseServices;
using Forks.EnterpriseServices.DataForm;
using Forks.EnterpriseServices.DomainObjects2;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
namespace BWP.B3ClientService.BO
{
[DFClass,Serializable]
[LogicName("存货")]
public class Goods : B3Frameworks.BO.BaseInfo, B3Frameworks.BO.IWithCodeBaseInfo
{
[LogicName("编码")]
[DFNotEmpty]
[DbColumn(DbType = SqlDbType.NVarChar, AllowNull = false, Unique = true)]
public string Code { get; set; }
[LogicName("规格")]
public string Spec { get; set; }
[LogicName("主单位")]
[DFNotEmpty]
public string MainUnit { get; set; }
}
}

+ 6
- 5
B3ClientService/BO/BaseInfo/ProductBatch.cs View File

@ -4,16 +4,17 @@ using System.Linq;
using System.Text;
using Forks.EnterpriseServices.DomainObjects2;
using TSingSoft.WebPluginFramework;
using Forks.EnterpriseServices.DataForm;
using Forks.EnterpriseServices;
namespace BWP.B3ClientService.BO
{
[Serializable, BOClass]
[KeyField("ID", KeyGenType.assigned)]
public class ProductBatch
[Serializable, DFClass]
[LogicName("生产批次")]
public class ProductBatch : B3Frameworks.BO.BaseInfo
{
public long ID { get; set; }
public string Name { get; set; }
[LogicName("日期")]
public DateTime? Date { get; set; }
}
}

+ 7
- 5
B3ClientService/BO/BaseInfo/WorkUnit.cs View File

@ -1,14 +1,16 @@
using System;
using Forks.EnterpriseServices;
using Forks.EnterpriseServices.DataForm;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BWP.B3ClientService.BO;
namespace BWP.B3ClientService.BO
{
{
[Serializable]
public class WorkUnit:BaseInfo
[DFClass]
[LogicName("工作单元")]
public class WorkUnit : B3Frameworks.BO.BaseInfo
{
public string Code { get; set; }
}
}

+ 30
- 0
B3ClientService/BO/BaseInfo/Worker.cs View File

@ -0,0 +1,30 @@
using Forks.EnterpriseServices;
using Forks.EnterpriseServices.DataForm;
using Forks.EnterpriseServices.DomainObjects2;
using Forks.Utils;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using TSingSoft.WebControls2;
namespace BWP.B3ClientService.BO
{
[DFClass, Serializable]
[LogicName("操作员")]
public class Worker : B3Frameworks.BO.BaseInfo, B3Frameworks.BO.IWithCodeBaseInfo
{
[LogicName("编号")]
[DFNotEmpty]
[DbColumn(DbType = SqlDbType.NVarChar, AllowNull = false, Unique = true)]
public string Code { get; set; }
[DbColumn(AllowNull = false, DbType = SqlDbType.Binary, Length = 16)]
public byte[] Password { get; set; }
[LogicName("初始密码")]
[NonDmoProperty]
public string StrPwd { get; set; }
}
}

+ 21
- 0
B3ClientService/BO/BaseInfo/WorkerDriveRelate.cs View File

@ -0,0 +1,21 @@
using BWP.B3ClientService.NamedValueTemplate;
using Forks.EnterpriseServices.DomainObjects2;
using Forks.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TSingSoft.WebPluginFramework;
namespace BWP.B3ClientService.BO
{
[BOClass]
[KeyField("Worker_ID", KeyGenType.assigned)]
[KeyField("Drive", KeyGenType.assigned)]
public class WorkerDriveRelate
{
public long Worker_ID { get; set; }
public NamedValue<> Drive { get; set; }
}
}

+ 13
- 14
B3ClientService/BO/ClientGoodsSet_/ClientGoodsSet.cs View File

@ -1,31 +1,30 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BWP.B3Frameworks.BO;
using Forks.EnterpriseServices.DomainObjects2;
using Forks.Utils;
using BWP.B3ClientService.NamedValueTemplate;
using Forks.EnterpriseServices;
using Forks.EnterpriseServices.DataForm;
using Newtonsoft.Json;
namespace BWP.B3ClientService.BO
{
[Serializable]
public class ClientGoodsSet:Base
[LogicName("客户端存货配置")]
[Serializable, DFClass]
public class ClientGoodsSet : B3Frameworks.BO.BaseInfo
{
/// <summary>
/// 适用客户端
/// </summary>
public string ApplyClient { get; set; }
public string Name { get; set; }
[LogicName("适用客户端")]
[JsonConverter(typeof(NameValueJsonConverter<适用客户端>))]
public NamedValue<> ApplyClient { get; set; }
private readonly ClientGoodsSet_DetailCollection _details = new ClientGoodsSet_DetailCollection();
[OneToMany(typeof(ClientGoodsSet_Detail), "ID", false)]
[OneToMany(typeof(ClientGoodsSet_Detail), "ID")]
[Join("ID", "ClientGoodsSet_ID")]
[JsonConverter(typeof(OneToManyCollectionJsonConverter<ClientGoodsSet_DetailCollection, ClientGoodsSet_Detail>))]
public ClientGoodsSet_DetailCollection Details
{
get { return _details; }
}
}
}

+ 15
- 14
B3ClientService/BO/ClientGoodsSet_/ClientGoodsSet_Detail.cs View File

@ -6,10 +6,13 @@ using BWP.B3Frameworks.BO;
using Forks.EnterpriseServices;
using Forks.EnterpriseServices.DomainObjects2;
using Forks.Utils;
using Forks.EnterpriseServices.DataForm;
using Newtonsoft.Json;
namespace BWP.B3ClientService.BO
{
[Serializable]
[LogicName("客户端存货配置_明细")]
[Serializable, DFClass]
public class ClientGoodsSet_Detail : Base
{
public long ClientGoodsSet_ID { get; set; }
@ -18,21 +21,23 @@ namespace BWP.B3ClientService.BO
public long Goods_ID { get; set; }
[LogicName("存货")]
[Join("Goods_ID", "ID")]
[ReferenceTo(typeof(Goods), "Name")]
[JsonIgnore]
public string Goods_Name { get; set; }
[LogicName("存货编码")]
[LogicName("编码")]
[Join("Goods_ID", "ID")]
[ReferenceTo(typeof(Goods), "Code")]
[JsonIgnore]
public string Goods_Code { get; set; }
[LogicName("存货规格")]
[LogicName("规格")]
[Join("Goods_ID", "ID")]
[ReferenceTo(typeof(Goods), "Spec")]
[JsonIgnore]
public string Goods_Spec { get; set; }
public string Goods_Spell { get; set; }
public string Goods_MainUnit { get; set; }
[LogicName("主辅换算主单位比例")]
public Money<decimal>? Goods_MainUnitRatio { get; set; }
[LogicName("标准重量")]
public decimal? StandardWeight { get; set; }
@ -41,14 +46,10 @@ namespace BWP.B3ClientService.BO
[LogicName("标准重量下限")]
public decimal? StandardWeightLow { get; set; }
}
[Serializable]
public class ClientGoodsSet_DetailCollection : DmoCollection<ClientGoodsSet_Detail>
{
}
}

+ 68
- 1
B3ClientService/ConvertUtil.cs View File

@ -1,4 +1,8 @@
using System;
using Forks.EnterpriseServices.DomainObjects2;
using Forks.Utils;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@ -20,4 +24,67 @@ namespace BWP.B3ClientService
});
}
}
public class NameValueJsonConverter<T> : JsonConverter
{
public override bool CanConvert(Type objectType)
{
return true;
}
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
JToken t = JToken.FromObject(value);
if (t.Type != JTokenType.Object)
{
t.WriteTo(writer);
}
else
{
NamedValue<T>? newValue = value as NamedValue<T>?;
if (newValue != null)
{
var sValue = newValue.Value.Value;
writer.WriteValue(sValue);
}
}
}
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
throw new NotImplementedException("不支持反序列化");
}
}
public class OneToManyCollectionJsonConverter<T, L> : JsonConverter
where T : DmoCollection<L>
{
public override bool CanConvert(Type objectType)
{
return true;
}
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
throw new NotImplementedException("不支持反序列化");
}
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
var list = (value as DmoCollection<L>).ToList();
JToken t = JToken.FromObject(list);
if (t.Type != JTokenType.Object)
{
t.WriteTo(writer);
}
else
{
if (list != null)
writer.WriteValue(list);
}
}
}
}

+ 17
- 0
B3ClientService/InnerUtils.cs View File

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
namespace BWP.B3ClientService
{
public static class InnerUtils
{
public static byte[] EncodePwd(string pwd)
{
using (MD5 md5 = MD5.Create())
return md5.ComputeHash(Encoding.Unicode.GetBytes(pwd));
}
}
}

+ 13
- 0
B3ClientService/NamedValueTemplate.cs View File

@ -14,4 +14,17 @@ namespace BWP.B3ClientService.NamedValueTemplate
public static readonly NamedValue<> = new NamedValue<>(3);
public static readonly NamedValue<> = new NamedValue<>(4);
}
public sealed class
{
public static readonly NamedValue<> = new NamedValue<>(0);
public static readonly NamedValue<> = new NamedValue<>(1);
}
public sealed class
{
public static readonly NamedValue<> = new NamedValue<>(0);
public static readonly NamedValue<> = new NamedValue<>(1);
public static readonly NamedValue<> = new NamedValue<>(2);
}
}

+ 117
- 0
B3ClientService/OfflinRpc/BaseInfoRpc.cs View File

@ -0,0 +1,117 @@
using BWP.B3ClientService.BO;
using Forks.EnterpriseServices.DomainObjects2;
using Forks.EnterpriseServices.DomainObjects2.DQuery;
using Forks.EnterpriseServices.JsonRpc;
using Forks.EnterpriseServices.SqlDoms;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TSingSoft.WebPluginFramework;
namespace BWP.B3ClientService.Rpcs
{
[Rpc]
public static class SyncBaseInfoRpc
{
[Rpc(RpcFlags.SkipAuth)]
public static string SyncWorkUnit()
{
return GetBaseInfoJosn<WorkUnit>();
}
[Rpc(RpcFlags.SkipAuth)]
public static string SyncProductBatch()
{
return GetBaseInfoJosn<ProductBatch>(DQCondition.EQ("IsLocked", false));
}
static string GetBaseInfoJosn<T>(IDQExpression withCondition = null)
where T : B3Frameworks.BO.BaseInfo, new()
{
var query = new DQueryDom(new JoinAlias(typeof(T)));
query.Columns.Add(DQSelectColumn.Field("ID"));
query.Columns.Add(DQSelectColumn.Field("Name"));
query.Where.Conditions.Add(DQCondition.EQ("Stopped", false));
if (withCondition != null)
query.Where.Conditions.Add(withCondition);
var list = query.EExecuteList<long, string>().Select(x => new MinBaseInfo { ID = x.Item1, Name = x.Item2 });
return JsonConvert.SerializeObject(list);
}
[Rpc(RpcFlags.SkipAuth)]
public static string SyncClientGoodsSetByClient(short type)
{
var main = new JoinAlias(typeof(ClientGoodsSet));
var detail = new JoinAlias(typeof(ClientGoodsSet_Detail));
var query = new DQueryDom(main);
query.From.AddJoin(JoinType.Inner, new DQDmoSource(detail), DQCondition.EQ(main, "ID", detail, "ClientGoodsSet_ID"));
query.Where.Conditions.Add(DQCondition.EQ("ApplyClient", type));
query.Columns.Add(DQSelectColumn.Field("ID"));
query.Columns.Add(DQSelectColumn.Field("Stopped"));
query.Columns.Add(DQSelectColumn.Field("Name"));
query.Columns.Add(DQSelectColumn.Field("ID", detail));
query.Columns.Add(DQSelectColumn.Field("Goods_ID", detail));
query.Columns.Add(DQSelectColumn.Field("StandardWeight", detail));
query.Columns.Add(DQSelectColumn.Field("StandardWeightUp", detail));
query.Columns.Add(DQSelectColumn.Field("StandardWeightLow", detail));
var list = new List<MinClientGoodsSet>();
using (var session = Dmo.NewSession())
{
using (var reader = session.ExecuteReader(query))
{
while (reader.Read())
{
var id = (long)reader[0];
var first = list.FirstOrDefault(x => x.ID == id);
if (first == null)
{
first = new MinClientGoodsSet();
list.Add(first);
first.ID = id;
first.Stopped = (bool)reader[1];
if (first.Stopped)
continue;
first.Name = (string)reader[2];
}
var d = new ClientGoodsSet_Detail();
first.Details.Add(d);
d.ClientGoodsSet_ID = id;
d.ID = (long)reader[3];
d.Goods_ID = (long)reader[4];
d.StandardWeight = (decimal?)reader[5];
d.StandardWeightUp = (decimal?)reader[6];
d.StandardWeightLow = (decimal?)reader[7];
}
}
}
return JsonConvert.SerializeObject(list);
}
class MinBaseInfo
{
public long ID { get; set; }
public string Name { get; set; }
}
class MinClientGoodsSet
{
public long ID { get; set; }
public string Name { get; set; }
public bool Stopped { get; set; }
List<ClientGoodsSet_Detail> _details = new List<ClientGoodsSet_Detail>();
public List<ClientGoodsSet_Detail> Details
{
get { return _details; }
}
}
}
}

+ 59
- 0
B3ClientService/OfflinRpc/LoginRpc.cs View File

@ -0,0 +1,59 @@
using BWP.B3ClientService.BO;
using BWP.B3ClientService.NamedValueTemplate;
using Forks.EnterpriseServices.DomainObjects2;
using Forks.EnterpriseServices.DomainObjects2.DQuery;
using Forks.EnterpriseServices.JsonRpc;
using Forks.Utils;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TSingSoft.WebPluginFramework;
namespace BWP.B3ClientService.Rpcs
{
[Rpc]
public static class LoginRpc
{
[Rpc(RpcFlags.SkipAuth)]
public static long Login(string name, string pwd)
{
var query = new DQueryDom(new JoinAlias(typeof(Worker)));
query.Columns.Add(DQSelectColumn.Field("ID"));
query.Columns.Add(DQSelectColumn.Field("Stopped"));
query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("Name", name), DQCondition.EQ("Password", InnerUtils.EncodePwd(pwd))));
var result = query.EExecuteScalar<long, bool>();
if (result == null)
return 0;
if (result.Item2)
return -1;
return result.Item1;
}
[Rpc(RpcFlags.SkipAuth)]
public static string GetWorkerBindDrive(long id)
{
var query = new DQueryDom(new JoinAlias(typeof(WorkerDriveRelate)));
query.Columns.Add(DQSelectColumn.Field("Drive"));
query.Where.Conditions.Add(DQCondition.EQ("Worker_ID", id));
var result = query.EExecuteList<NamedValue<>>();
return string.Join(",", result.Select(x => x.Value));
}
[Rpc(RpcFlags.SkipAuth)]
public static string GetWorkerNameByCode(string code)
{
var query = new DQueryDom(new JoinAlias(typeof(Worker)));
query.Columns.Add(DQSelectColumn.Field("Name"));
query.Columns.Add(DQSelectColumn.Field("Stopped"));
query.Where.Conditions.Add(DQCondition.EQ("Code",code));
var result = query.EExecuteScalar<string, bool>();
if (result == null)
return "0";
if (result.Item2)
return "-1";
return result.Item1;
}
}
}

+ 2
- 2
B3ClientService/Rpcs/BillRpc/ClientGoodsSetRpc.cs View File

@ -35,13 +35,13 @@ using TSingSoft.WebPluginFramework;
foreach (ClientGoodsSet_Detail setDetail in set.Details)
{
var dto = new ClientGoodsSetDto();
dto.ApplyClient = set.ApplyClient;
//dto.ApplyClient = set.ApplyClient;
dto.Name = set.Name;
dto.Goods_ID = setDetail.Goods_ID;
dto.Goods_Name = setDetail.Goods_Name;
dto.Goods_Code = setDetail.Goods_Code;
dto.Goods_Spec = setDetail.Goods_Spec;
dto.Goods_MainUnit = setDetail.Goods_MainUnit;
//dto.Goods_MainUnit = setDetail.Goods_MainUnit;
dto.StandardWeight = setDetail.StandardWeight;
dto.StandardWeightUp = setDetail.StandardWeightUp;


+ 9
- 0
WebFolder/config/NamedValue/B3ClientService.xml View File

@ -7,4 +7,13 @@
<Word name="入销售库" value="3"/>
<Word name="销售出库" value="4"/>
</NamedValue>
<NamedValue type="BWP.B3ClientService.NamedValueTemplate.终端, B3ClientService">
<Word name="白条入库" value="0"/>
<Word name="白条领用" value="1"/>
</NamedValue>
<NamedValue type="BWP.B3ClientService.NamedValueTemplate.适用客户端, B3ClientService">
<Word name="白条出入库" value="0"/>
<Word name="分割品" value="1"/>
<Word name="副产品" value="2"/>
</NamedValue>
</NamedValueSettings>

+ 59
- 1
WebFolder/config/plugins/B3ClientService.plugin View File

@ -34,19 +34,77 @@
<Function index="3" name="分割入库"/>
<Function index="4" name="车间配货"/>
</FunctionGroup>
<FunctionGroup name="系统管理" roleSchemas="default">
<Function index="0" name="服务器设置"/>
</FunctionGroup>
<FunctionGroup name="报表展示" roleSchemas="default">
<Function index="0" name="白条库存"/>
<Function index="1" name="白条损耗"/>
<Function index="2" name="白条流向"/>
</FunctionGroup>
<FunctionGroup name ="操作员" roleSchemas="default">
<Function index="0" name="访问" />
<Function index="1" name="新建" />
<Function index="2" name="编辑" />
<Function index="3" name="删除" />
<Function index="4" name="停用" />
<Function index="5" name="启用" />
<Function index="6" name="锁定" />
<Function index="7" name="解锁" />
</FunctionGroup>
<FunctionGroup name="存货" roleSchemas="default">
<Function index="0" name="访问" />
<Function index="1" name="新建" />
<Function index="2" name="编辑" />
<Function index="3" name="删除" />
<Function index="4" name="停用" />
<Function index="5" name="启用" />
<Function index="6" name="锁定" />
<Function index="7" name="解锁" />
</FunctionGroup>
<FunctionGroup name="工作单元" roleSchemas="default">
<Function index="0" name="访问" />
<Function index="1" name="新建" />
<Function index="2" name="编辑" />
<Function index="3" name="删除" />
<Function index="4" name="停用" />
<Function index="5" name="启用" />
<Function index="6" name="锁定" />
<Function index="7" name="解锁" />
</FunctionGroup>
<FunctionGroup name="生产批次" roleSchemas="default">
<Function index="0" name="访问" />
<Function index="1" name="新建" />
<Function index="2" name="编辑" />
<Function index="3" name="删除" />
<Function index="4" name="停用" />
<Function index="5" name="启用" />
<Function index="6" name="锁定" />
<Function index="7" name="解锁" />
</FunctionGroup>
<FunctionGroup name="客户端存货配置" roleSchemas="default">
<Function index="0" name="访问" />
<Function index="1" name="新建" />
<Function index="2" name="编辑" />
<Function index="3" name="删除" />
<Function index="4" name="停用" />
<Function index="5" name="启用" />
<Function index="6" name="锁定" />
<Function index="7" name="解锁" />
</FunctionGroup>
</Security>
<Features>
</Features>
<Menus>
<Menu id="0001" name="B3基本模块/系统管理/服务器地址设置" url="B3ClientService/ServerHostConfig.aspx"/>
<Menu id="0001" name="MES系统/系统管理/服务器设置" roles="B3ClientService.系统管理.服务器设置" url="B3ClientService/ServerHostConfig.aspx"/>
<Menu id="0002" name="MES系统/MES报表展示/白条库存" roles="B3ClientService.报表展示.白条库存" url="B3ClientService/Reports/CarcassStoreAnalyse_/CarcassStoreAnalyse.aspx"/>
<Menu id="0003" name="MES系统/MES报表展示/白条损耗" roles="B3ClientService.报表展示.白条损耗" url="B3ClientService/Reports/CarcassLossAnalyse_/CarcassLossAnalyse.aspx"/>
<Menu id="0004" name="MES系统/MES报表展示/白条流向" roles="B3ClientService.报表展示.白条流向" url="B3ClientService/Reports/CarcassTrendAnalyse_/CarcassTrendAnalyse.aspx"/>
<Menu id="0008" name="MES系统/基础信息/操作员" roles="B3ClientService.操作员.访问" url="B3ClientService/BaseInfos/Worker_/WorkerList.aspx"/>
<Menu id="0009" name="MES系统/基础信息/存货" roles="B3ClientService.存货.访问" url="B3ClientService/BaseInfos/Goods_/GoodsList.aspx"/>
<Menu id="0010" name="MES系统/基础信息/工作单元" roles="B3ClientService.工作单元.访问" url="B3ClientService/BaseInfos/WorkUnit_/WorkUnitList.aspx"/>
<Menu id="0011" name="MES系统/基础信息/生产批次" roles="B3ClientService.生产批次.访问" url="B3ClientService/BaseInfos/ProductBatch_/ProductBatchList.aspx"/>
<Menu id="0012" name="MES系统/系统管理/存货配置" roles="B3ClientService.客户端存货配置.访问" url="B3ClientService/BaseInfos/ClientGoodsSet_/ClientGoodsSetList.aspx"/>
</Menus>
<Features>
</Features>


Loading…
Cancel
Save