| @ -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(); | |||
| } | |||
| } | |||
| } | |||
| @ -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); | |||
| } | |||
| } | |||
| } | |||
| @ -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> | |||
| @ -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()); | |||
| } | |||
| } | |||
| } | |||
| @ -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"); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @ -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> | |||
| @ -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()); | |||
| } | |||
| } | |||
| } | |||
| @ -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"); | |||
| } | |||
| } | |||
| } | |||
| @ -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> | |||
| @ -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()); | |||
| } | |||
| } | |||
| } | |||
| @ -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> | |||
| { | |||
| } | |||
| } | |||
| @ -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> | |||
| @ -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); | |||
| } | |||
| } | |||
| } | |||
| @ -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> | |||
| { | |||
| } | |||
| } | |||
| @ -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> | |||
| @ -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"]; | |||
| } | |||
| } | |||
| } | |||
| @ -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> | |||
| @ -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(); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @ -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 | |||
| { | |||
| } | |||
| } | |||
| @ -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 | |||
| { | |||
| } | |||
| } | |||
| @ -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 | |||
| { | |||
| } | |||
| } | |||
| @ -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 | |||
| { | |||
| } | |||
| } | |||
| @ -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); | |||
| } | |||
| } | |||
| } | |||
| @ -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; } | |||
| } | |||
| } | |||
| @ -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; } | |||
| } | |||
| } | |||
| @ -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; } | |||
| } | |||
| } | |||
| @ -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; } | |||
| } | |||
| } | |||
| @ -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; } | |||
| } | |||
| } | |||
| } | |||
| @ -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)); | |||
| } | |||
| } | |||
| } | |||
| @ -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; } | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @ -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; | |||
| } | |||
| } | |||
| } | |||