Commit 195dfe53 by 陶然

init

parent ff0fe5d9
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<connectionStrings>
<!--<add name="Database" providerName="Sqlite" connectionString="$ROOT\AppData\primary.sqlite"/>-->
</connectionStrings>
</configuration>
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Kivii.Client.SamplePackages
{
internal class Configs
{
public const string DefaultBaseUrl = "http://k5.jst-gov.com";
public const string TableUiSetting = "ui_settings";
public const string RouteLocationQuery = "/Restful/Kivii.Samples.Entities.Location/Query";
public const string RouteSampleQuery = "/Restful/Kivii.Samples.Entities.Sample/Query";
}
}
using Kivii.DataAnnotations;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Kivii.Samples.Entities
{
public class Sample : EntityWithMetadata, IEntityInAssemblyDb, IEntityHasRemark, IEntityHasCreator, IEntityHasUpdater
{
#region 第三方关联V1.0
[ApiMember(Description = "关联业务,例如:此样品用于具体某一报告,此处记录报告信息")]
[InternalSetter]
[StringLength(200), Default("")]
public string BizId { get; set; }
[ApiMember(Description = "业务Kvid")]
[InternalSetter]
[DefaultEmptyGuid]
public Guid BizKvid { get; set; }
[ApiMember(Description = "业务类型,指实体类型全名称")]
[InternalSetter]
[StringLength(200), Default("")]
public string BizType { get; set; }
[InternalSetter]
[DefaultEmptyGuid]
public Guid OwnerKvid { get; set; }
[InternalSetter]
[StringLength(500)]//所属信息,记录当前数据的所属信息,可以是部门可以是组织可以是个人
public string OwnerName { get; set; }
#endregion
#region 关联信息
[InternalSetter]
[DefaultEmptyGuid]
public Guid RootKvid { get; set; }
[ApiMember(Description = "父级样品Kvid")]
[DefaultEmptyGuid]
public Guid ParentKvid { get; set; }
[ApiMember(Description = "包裹名称")]
[StringLength(200), Default("")]
public string PackageName { get; set; }
[ApiMember(Description = "包裹Kvid,只有在样品打包后会记录当前样品所属的包裹Kvid,包裹也是样品实体,包裹类型")]
[DefaultEmptyGuid]
public Guid PackageKvid { get; set; }
[ApiMember(Description = "来源名称")]
[IgnoreUpdate]
[StringLength(200), Default("")]
public string SourceName { get; set; }
[ApiMember(Description = "来源编号,邮寄则为记录快递号,抽样则为计划编号")]
[IgnoreUpdate]
[StringLength(200), Default("")]
public string SourceNumber { get; set; }
[ApiMember(Description = "来源类型,例如是快递方式则记录,顺丰,中通等")]
[IgnoreUpdate]
[StringLength(200), Default("")]
public string SourceType { get; set; }
#endregion
#region 基本信息
[ApiMember(Description = "样品名称")]
[Required]
[StringLength(200)]
public string Name { get; set; }
[ApiMember(Description = "样品内部编号")]
[StringLength(200), Default("")]
public string InternalCode { get; set; }
[ApiMember(Description = "样品编号")]
[SerialNumber]
[StringLength(100), Default("")]
public string SerialNumber { get; set; }
[ApiMember(Description = "样品批次编号")]
[StringLength(200), Default("")]
public string BatchNumber { get; set; }
[ApiMember(Description = "样品类型,类型:主样,子样,包裹")]
[StringLength(50), Default("")]
public SampleType Type { get; set; }
#region 时间相关
[ApiMember(Description = "抽样时间,一般用于监督,委托抽样使用")]
public DateTime? SamplingTime { get; set; }
[ApiMember(Description = "登记时间")]
public DateTime? RegistTime { get; set; }
[ApiMember(Description = "检验开始日期")]
public DateTime? TestStartDate { get; set; }
[ApiMember(Description = "检验结束日期")]
public DateTime? TestFinishDate { get; set; }
[ApiMember(Description = "样品受理日期")]
public DateTime? DealTime { get; set; }
[ApiMember(Description = "样品完成日期")]
public DateTime? DeadTime { get; set; }
[ApiMember(Description = "操作日期")]
public DateTime OperateTime { get; set; }
#endregion
[ApiMember(Description = "样品分类")]
[StringLength(50), Default("")]
public string Category { get; set; }
[ApiMember(Description = "样品品牌")]
[StringLength(200), Default("")]
public string Brand { get; set; }
[ApiMember(Description = "样品规格")]
[StringLength(200), Default("")]
public string Specification { get; set; }
[ApiMember(Description = "样品型号")]
[StringLength(200), Default("")]
public string Model { get; set; }
[ApiMember(Description = "样品材质")]
[StringLength(200), Default("")]
public string Material { get; set; }
[ApiMember(Description = "样品品级")]
[StringLength(200), Default("")]
public string Grade { get; set; }
[ApiMember(Description = "安全类别")]
[StringLength(200), Default("")]
public string GradeSafety { get; set; }
[ApiMember(Description = "样品状况,一般是指收到样品时的状况,是否完好等")]
[StringLength(200), Default("")]
public string Condition { get; set; }
#endregion
#region 数量相关
[ApiMember(Description = "样品数量")]
[DecimalLength(10, 2), Default(0)]
public decimal Quantity { get; set; }
[ApiMember(Description = "数量单位")]
[StringLength(50), Default("")]
public string QuantityUnit { get; set; }
#endregion
#region 生产单位信息及生产日期
[ApiMember(Description = "生产单位")]
[StringLength(100), Default("")]
public string ManufacturerName { get; set; }
[ApiMember(Description = "生产单位Kvid")]
[DefaultEmptyGuid]
[IgnoreUpdate]
public Guid ManufacturerKvid { get; set; }
[ApiMember(Description = "生产单位联系人姓名")]
[StringLength(50), Default("")]
public string ManufacturerContactName { get; set; }
[ApiMember(Description = "生产单位联系人Kvid")]
[DefaultEmptyGuid]
[IgnoreUpdate]
public Guid ManufacturerContactKvid { get; set; }
[ApiMember(Description = "生产单位联系人电话")]
[StringLength(50), Default("")]
//正则表达式验证:(^(\d{3,4}-)?\d{7,8})$|(13[0-9]{9})
public string ManufacturerContactNumber { get; set; }
[ApiMember(Description = "生产单位地址")]
[StringLength(200), Default("")]
public string ManufacturerAddress { get; set; }
[ApiMember(Description = "生产日期")]
public DateTime? ProductionDate { get; set; }
#endregion
#region 文本 备注
[ApiMember(Description = "摘要")]
[StringLength(1000), Default("")]
public string Summary { get; set; }
[ApiMember(Description = "备注")]
[StringLength(1000), Default("")]
public string Remark { get; set; }
#endregion
[Ignore]
public DateTime? AssignTime { get; set; }
/// <summary>
/// 样品当前所在位置
/// </summary>
[Ignore]
public Location CurrentLocation { get; set; }
/// <summary>
/// 样品当前最新的路由信息
/// </summary>
[Ignore]
public Route CurrentRoute { get; set; }
/// <summary>
/// 样品的所有路由信息
/// </summary>
[Ignore]
public List<Route> Routes { get; set; }
/// <summary>
/// 当前样品下一级的子样品信息
/// </summary>
[Ignore]
public List<Sample> Childrens { get; set; }
/// <summary>
/// 当前样品所在包裹的完整信息
/// </summary>
[Ignore]
public Sample CurrentPackage { get; set; }
#region 创建/更新人V1.0
[ApiMember(Description = "创建人Kvid ")]
[IgnoreUpdate]
[CurrentMemberKvid]
public Guid CreatorKvid { get; set; }
[ApiMember(Description = "创建人")]
[IgnoreUpdate]
[StringLength(50), CurrentMemberName]
public string CreatorName { get; set; }
[ApiMember(Description = "更新人Kvid ")]
[CurrentMemberKvid]
public Guid UpdaterKvid { get; set; }
[ApiMember(Description = "更新人")]
[StringLength(50), CurrentMemberName]
public string UpdaterName { get; set; }
#endregion
}
public class Location : EntityWithMetadata
{
[InternalSetter]
[DefaultEmptyGuid]
public Guid OwnerKvid { get; set; }
[InternalSetter]
[StringLength(500)]//所属信息,记录当前数据的所属信息,可以是部门可以是组织可以是个人
public string OwnerName { get; set; }
[ApiMember(Description = "地点名称")]
[Required]
[StringLength(200)]
public string Title { get; set; }
[ApiMember(Description = "地点地址")]
[StringLength(500), Default("")]
public string Address { get; set; }
/// <summary>
/// 内部编码,唯一,样品在流转过程中必须传入目标地点的InternalCode
/// </summary>
[ApiMember(Description = "内部编码")]
[StringLength(200), Required]
[Unique()]
public string InternalCode { get; set; }
[ApiMember(Description = "配置类型")]
[StringLength(50), Default("")]
public string Type { get; set; }
[InternalSetter]
[DefaultEmptyGuid]
public Guid ManagerKvid { get; set; }
[InternalSetter]
[StringLength(500)]
public string ManagerName { get; set; }
#region 文本 摘要 备注
[ApiMember(Description = "摘要,最大500字")]
//[IgnoreUpdate]
[StringLength(500), Default("")]
public string Summary { get; set; }
[ApiMember(Description = "备注,最大2000字")]
[StringLength(2000), Default("")]
public string Remark { get; set; }
#endregion
}
public class Route : EntityWithMetadata, IEntityHasBiz, IEntityInAssemblyDb, IEntityHasRemark, IEntityHasCreator, IEntityHasUpdater
{
[ApiMember(Description = "样品名称")]
[IgnoreUpdate]
[StringLength(200), Default("")]
public string SampleName { get; set; }
[ApiMember(Description = "样品Kvid")]
[DefaultEmptyGuid]
public Guid SampleKvid { get; set; }
[ApiMember(Description = "主样品Kvid")]
[DefaultEmptyGuid]
public Guid SampleRootKvid { get; set; }
[ApiMember(Description = "父级样品Kvid")]
[DefaultEmptyGuid]
public Guid SampleParentKvid { get; set; }
#region 第三方关联V1.0
[ApiMember(Description = "关联业务,例如:此样品用于具体某一报告,此处记录报告信息")]
[InternalSetter]
[StringLength(200), Default("")]
public string BizId { get; set; }
[ApiMember(Description = "业务Kvid")]
[InternalSetter]
[DefaultEmptyGuid]
public Guid BizKvid { get; set; }
[ApiMember(Description = "业务类型,指实体类型全名称")]
[InternalSetter]
[StringLength(200), Default("")]
public string BizType { get; set; }
#endregion
#region 基本信息
[ApiMember(Description = "样品路由标题")]
[StringLength(200), Required]
public string Title { get; set; }
/// <summary>
/// 送样,快递等
/// </summary>
[ApiMember(Description = "样品路由类型")]
[StringLength(50)]
public string Type { get; set; }
/// <summary>
/// 当前路由地点
/// </summary>
[ApiMember(Description = "当前路由地点")]
[StringLength(200), Required]
public string CurrentLocationTitle { get; set; }
[ApiMember(Description = "当前路由地点Kvid")]
[DefaultEmptyGuid]
public Guid CurrentLocationKvid { get; set; }
/// <summary>
/// 目标地点,目标节点是下一个节点产生后返写的,代表此样品已经从当前节点离开
/// </summary>
[ApiMember(Description = "目标路由地点")]
[StringLength(200)]
public string NextLocationTitle { get; set; }
[ApiMember(Description = "目标路由地点Kvid")]
[DefaultEmptyGuid]
public Guid NextLocationKvid { get; set; }
/// <summary>
/// 操作人
/// </summary>
[ApiMember(Description = "操作人")]
[StringLength(100), Default("")]
public string OperatorName { get; set; }
/// <summary>
/// 操作人Kvid
/// </summary>
[ApiMember(Description = "操作人Kvid")]
public Guid OperatorKvid { get; set; }
/// <summary>
/// 操作日期
/// </summary>
[ApiMember(Description = "操作日期")]
public DateTime OperateTime { get; set; }
/// <summary>
/// 摘要
/// </summary>
[ApiMember(Description = "摘要")]
[StringLength(1000), Default("")]
public string Summary { get; set; }
[ApiMember(Description = "备注")]
[StringLength(1000), Default("")]
public string Remark { get; set; }
[ApiMember(Description = "创建人Kvid ")]
[IgnoreUpdate]
[CurrentMemberKvid]
public Guid CreatorKvid { get; set; }
[ApiMember(Description = "创建人")]
[IgnoreUpdate]
[StringLength(50), CurrentMemberName]
public string CreatorName { get; set; }
[ApiMember(Description = "更新人Kvid ")]
[CurrentMemberKvid]
public Guid UpdaterKvid { get; set; }
[ApiMember(Description = "更新人")]
[StringLength(50), CurrentMemberName]
public string UpdaterName { get; set; }
#endregion
}
public class RfidBound : EntityWithMetadata, IEntityInAssemblyDb
{
[ApiMember(Description = "Tid")]
[Required, Unique]
[StringLength(500)]
public string Tid { get; set; }
[ApiMember(Description = "Epc")]
[StringLength(500)]
public string Epc { get; set; }
}
public enum SampleType
{
Unsupport = 0,
/// <summary>
/// 主样
/// </summary>
Master,
/// <summary>
/// 子样
/// </summary>
Node,
/// <summary>
/// 包裹
/// </summary>
Package
}
public enum PackageStatus
{
/// <summary>
/// 空闲
/// </summary>
Empty = 0,
/// <summary>
/// 装箱
/// </summary>
Full = 100,
/// <summary>
/// 入库
/// </summary>
Inbound = 200
}
}
using Kivii.DataAnnotations;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Kivii.Client.SamplePackages.Entities
{
[Alias(Configs.TableUiSetting)]
public class UiSetting : Entity
{
[Required]
[Unique("Form-Control")]
public string FormName { get; set; }
[Required]
[Unique("Form-Control")]
public string ControlName { get; set; }
[Default("")]
public string ControlValue { get; set; }
}
}
......@@ -28,22 +28,547 @@
/// </summary>
private void InitializeComponent()
{
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmMain));
this.plLeft = new System.Windows.Forms.Panel();
this.gbInfo = new System.Windows.Forms.GroupBox();
this.lbCurrentPackageNode = new System.Windows.Forms.Label();
this.lbCurrentPackage = new System.Windows.Forms.Label();
this.lbCurrentLocation = new System.Windows.Forms.Label();
this.lbCurrentDepartment = new System.Windows.Forms.Label();
this.tbCurrentPackageNode = new System.Windows.Forms.TextBox();
this.tbCurrentPackage = new System.Windows.Forms.TextBox();
this.tbCurrentLocation = new System.Windows.Forms.TextBox();
this.tbCurrentDepartment = new System.Windows.Forms.TextBox();
this.gbLogin = new System.Windows.Forms.GroupBox();
this.btnLogout = new System.Windows.Forms.Button();
this.btnLogin = new System.Windows.Forms.Button();
this.lblUrl = new System.Windows.Forms.Label();
this.lblUser = new System.Windows.Forms.Label();
this.lblPassword = new System.Windows.Forms.Label();
this.tbxPassword = new System.Windows.Forms.TextBox();
this.tbxServiceUrl = new System.Windows.Forms.TextBox();
this.tbxUserName = new System.Windows.Forms.TextBox();
this.plToolBar = new System.Windows.Forms.Panel();
this.gbTools = new System.Windows.Forms.GroupBox();
this.lbSetPackage = new System.Windows.Forms.Label();
this.tbSetCurrentPackage = new System.Windows.Forms.TextBox();
this.plMain = new System.Windows.Forms.Panel();
this.gbMain = new System.Windows.Forms.GroupBox();
this.lbSetPackageNode = new System.Windows.Forms.Label();
this.cbSetCurrentPackageNode = new System.Windows.Forms.ComboBox();
this.btnScanRfid = new System.Windows.Forms.Button();
this.dgvSamples = new System.Windows.Forms.DataGridView();
this.btnClearCurrentPackage = new System.Windows.Forms.Button();
this.SampleAction = new System.Windows.Forms.DataGridViewButtonColumn();
this.SampleBizId = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.SampleOwnerName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.SampleName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.SampleDealTime = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.SampleDeadTime = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.SampleQuantityUnit = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.SamplePackageName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.plLeft.SuspendLayout();
this.gbInfo.SuspendLayout();
this.gbLogin.SuspendLayout();
this.plToolBar.SuspendLayout();
this.gbTools.SuspendLayout();
this.plMain.SuspendLayout();
this.gbMain.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dgvSamples)).BeginInit();
this.SuspendLayout();
//
// plLeft
//
this.plLeft.Controls.Add(this.gbInfo);
this.plLeft.Controls.Add(this.gbLogin);
this.plLeft.Dock = System.Windows.Forms.DockStyle.Left;
this.plLeft.Location = new System.Drawing.Point(0, 0);
this.plLeft.Name = "plLeft";
this.plLeft.Size = new System.Drawing.Size(265, 594);
this.plLeft.TabIndex = 0;
//
// gbInfo
//
this.gbInfo.Controls.Add(this.lbCurrentPackageNode);
this.gbInfo.Controls.Add(this.lbCurrentPackage);
this.gbInfo.Controls.Add(this.lbCurrentLocation);
this.gbInfo.Controls.Add(this.lbCurrentDepartment);
this.gbInfo.Controls.Add(this.tbCurrentPackageNode);
this.gbInfo.Controls.Add(this.tbCurrentPackage);
this.gbInfo.Controls.Add(this.tbCurrentLocation);
this.gbInfo.Controls.Add(this.tbCurrentDepartment);
this.gbInfo.Dock = System.Windows.Forms.DockStyle.Fill;
this.gbInfo.Location = new System.Drawing.Point(0, 316);
this.gbInfo.Name = "gbInfo";
this.gbInfo.Size = new System.Drawing.Size(265, 278);
this.gbInfo.TabIndex = 1;
this.gbInfo.TabStop = false;
this.gbInfo.Text = "信息";
//
// lbCurrentPackageNode
//
this.lbCurrentPackageNode.AutoSize = true;
this.lbCurrentPackageNode.Font = new System.Drawing.Font("宋体", 12F);
this.lbCurrentPackageNode.Location = new System.Drawing.Point(16, 180);
this.lbCurrentPackageNode.Name = "lbCurrentPackageNode";
this.lbCurrentPackageNode.Size = new System.Drawing.Size(79, 16);
this.lbCurrentPackageNode.TabIndex = 7;
this.lbCurrentPackageNode.Text = "当前袋子:";
//
// lbCurrentPackage
//
this.lbCurrentPackage.AutoSize = true;
this.lbCurrentPackage.Font = new System.Drawing.Font("宋体", 12F);
this.lbCurrentPackage.Location = new System.Drawing.Point(16, 127);
this.lbCurrentPackage.Name = "lbCurrentPackage";
this.lbCurrentPackage.Size = new System.Drawing.Size(79, 16);
this.lbCurrentPackage.TabIndex = 6;
this.lbCurrentPackage.Text = "当前箱号:";
//
// lbCurrentLocation
//
this.lbCurrentLocation.AutoSize = true;
this.lbCurrentLocation.Font = new System.Drawing.Font("宋体", 12F);
this.lbCurrentLocation.Location = new System.Drawing.Point(16, 74);
this.lbCurrentLocation.Name = "lbCurrentLocation";
this.lbCurrentLocation.Size = new System.Drawing.Size(79, 16);
this.lbCurrentLocation.TabIndex = 5;
this.lbCurrentLocation.Text = "当前位置:";
//
// lbCurrentDepartment
//
this.lbCurrentDepartment.AutoSize = true;
this.lbCurrentDepartment.Font = new System.Drawing.Font("宋体", 12F);
this.lbCurrentDepartment.Location = new System.Drawing.Point(16, 21);
this.lbCurrentDepartment.Name = "lbCurrentDepartment";
this.lbCurrentDepartment.Size = new System.Drawing.Size(79, 16);
this.lbCurrentDepartment.TabIndex = 4;
this.lbCurrentDepartment.Text = "当前部门:";
//
// tbCurrentPackageNode
//
this.tbCurrentPackageNode.Enabled = false;
this.tbCurrentPackageNode.Font = new System.Drawing.Font("宋体", 18F);
this.tbCurrentPackageNode.Location = new System.Drawing.Point(16, 195);
this.tbCurrentPackageNode.Name = "tbCurrentPackageNode";
this.tbCurrentPackageNode.ReadOnly = true;
this.tbCurrentPackageNode.Size = new System.Drawing.Size(226, 35);
this.tbCurrentPackageNode.TabIndex = 3;
//
// tbCurrentPackage
//
this.tbCurrentPackage.Enabled = false;
this.tbCurrentPackage.Font = new System.Drawing.Font("宋体", 18F);
this.tbCurrentPackage.Location = new System.Drawing.Point(16, 142);
this.tbCurrentPackage.Name = "tbCurrentPackage";
this.tbCurrentPackage.ReadOnly = true;
this.tbCurrentPackage.Size = new System.Drawing.Size(226, 35);
this.tbCurrentPackage.TabIndex = 2;
//
// tbCurrentLocation
//
this.tbCurrentLocation.Enabled = false;
this.tbCurrentLocation.Font = new System.Drawing.Font("宋体", 18F);
this.tbCurrentLocation.Location = new System.Drawing.Point(16, 89);
this.tbCurrentLocation.Name = "tbCurrentLocation";
this.tbCurrentLocation.ReadOnly = true;
this.tbCurrentLocation.Size = new System.Drawing.Size(226, 35);
this.tbCurrentLocation.TabIndex = 1;
//
// tbCurrentDepartment
//
this.tbCurrentDepartment.Enabled = false;
this.tbCurrentDepartment.Font = new System.Drawing.Font("宋体", 18F);
this.tbCurrentDepartment.Location = new System.Drawing.Point(16, 36);
this.tbCurrentDepartment.Name = "tbCurrentDepartment";
this.tbCurrentDepartment.ReadOnly = true;
this.tbCurrentDepartment.Size = new System.Drawing.Size(226, 35);
this.tbCurrentDepartment.TabIndex = 0;
//
// gbLogin
//
this.gbLogin.Controls.Add(this.btnLogout);
this.gbLogin.Controls.Add(this.btnLogin);
this.gbLogin.Controls.Add(this.lblUrl);
this.gbLogin.Controls.Add(this.lblUser);
this.gbLogin.Controls.Add(this.lblPassword);
this.gbLogin.Controls.Add(this.tbxPassword);
this.gbLogin.Controls.Add(this.tbxServiceUrl);
this.gbLogin.Controls.Add(this.tbxUserName);
this.gbLogin.Dock = System.Windows.Forms.DockStyle.Top;
this.gbLogin.Location = new System.Drawing.Point(0, 0);
this.gbLogin.Name = "gbLogin";
this.gbLogin.Size = new System.Drawing.Size(265, 316);
this.gbLogin.TabIndex = 0;
this.gbLogin.TabStop = false;
this.gbLogin.Text = "登录";
//
// btnLogout
//
this.btnLogout.BackColor = System.Drawing.Color.LavenderBlush;
this.btnLogout.Font = new System.Drawing.Font("宋体", 15F);
this.btnLogout.ForeColor = System.Drawing.Color.Crimson;
this.btnLogout.Location = new System.Drawing.Point(135, 267);
this.btnLogout.Name = "btnLogout";
this.btnLogout.Size = new System.Drawing.Size(107, 43);
this.btnLogout.TabIndex = 28;
this.btnLogout.Text = "退 出";
this.btnLogout.UseVisualStyleBackColor = false;
this.btnLogout.Click += new System.EventHandler(this.btnLogout_Click);
//
// btnLogin
//
this.btnLogin.BackColor = System.Drawing.Color.MintCream;
this.btnLogin.Font = new System.Drawing.Font("宋体", 15F);
this.btnLogin.ForeColor = System.Drawing.Color.DarkGreen;
this.btnLogin.Location = new System.Drawing.Point(16, 267);
this.btnLogin.Name = "btnLogin";
this.btnLogin.Size = new System.Drawing.Size(107, 43);
this.btnLogin.TabIndex = 27;
this.btnLogin.Text = "登 录";
this.btnLogin.UseVisualStyleBackColor = false;
this.btnLogin.Click += new System.EventHandler(this.btnLogin_Click);
//
// lblUrl
//
this.lblUrl.AutoSize = true;
this.lblUrl.Font = new System.Drawing.Font("宋体", 18F);
this.lblUrl.Location = new System.Drawing.Point(8, 36);
this.lblUrl.Name = "lblUrl";
this.lblUrl.Size = new System.Drawing.Size(94, 24);
this.lblUrl.TabIndex = 21;
this.lblUrl.Text = "地 址:";
//
// lblUser
//
this.lblUser.AutoSize = true;
this.lblUser.Font = new System.Drawing.Font("宋体", 18F);
this.lblUser.Location = new System.Drawing.Point(8, 101);
this.lblUser.Name = "lblUser";
this.lblUser.Size = new System.Drawing.Size(94, 24);
this.lblUser.TabIndex = 22;
this.lblUser.Text = "用户名:";
//
// lblPassword
//
this.lblPassword.AutoSize = true;
this.lblPassword.Font = new System.Drawing.Font("宋体", 18F);
this.lblPassword.Location = new System.Drawing.Point(8, 166);
this.lblPassword.Name = "lblPassword";
this.lblPassword.Size = new System.Drawing.Size(94, 24);
this.lblPassword.TabIndex = 23;
this.lblPassword.Text = "密 码:";
//
// tbxPassword
//
this.tbxPassword.Font = new System.Drawing.Font("宋体", 18F);
this.tbxPassword.Location = new System.Drawing.Point(12, 193);
this.tbxPassword.Name = "tbxPassword";
this.tbxPassword.PasswordChar = '*';
this.tbxPassword.Size = new System.Drawing.Size(226, 35);
this.tbxPassword.TabIndex = 26;
this.tbxPassword.KeyDown += new System.Windows.Forms.KeyEventHandler(this.tbxPassword_KeyDown);
//
// tbxServiceUrl
//
this.tbxServiceUrl.BackColor = System.Drawing.SystemColors.Window;
this.tbxServiceUrl.Font = new System.Drawing.Font("宋体", 18F);
this.tbxServiceUrl.Location = new System.Drawing.Point(12, 63);
this.tbxServiceUrl.Name = "tbxServiceUrl";
this.tbxServiceUrl.Size = new System.Drawing.Size(226, 35);
this.tbxServiceUrl.TabIndex = 24;
//
// tbxUserName
//
this.tbxUserName.Font = new System.Drawing.Font("宋体", 18F);
this.tbxUserName.Location = new System.Drawing.Point(12, 128);
this.tbxUserName.Name = "tbxUserName";
this.tbxUserName.Size = new System.Drawing.Size(226, 35);
this.tbxUserName.TabIndex = 25;
//
// plToolBar
//
this.plToolBar.Controls.Add(this.gbTools);
this.plToolBar.Dock = System.Windows.Forms.DockStyle.Top;
this.plToolBar.Location = new System.Drawing.Point(265, 0);
this.plToolBar.Name = "plToolBar";
this.plToolBar.Size = new System.Drawing.Size(793, 125);
this.plToolBar.TabIndex = 1;
//
// gbTools
//
this.gbTools.Controls.Add(this.btnClearCurrentPackage);
this.gbTools.Controls.Add(this.btnScanRfid);
this.gbTools.Controls.Add(this.cbSetCurrentPackageNode);
this.gbTools.Controls.Add(this.lbSetPackageNode);
this.gbTools.Controls.Add(this.lbSetPackage);
this.gbTools.Controls.Add(this.tbSetCurrentPackage);
this.gbTools.Dock = System.Windows.Forms.DockStyle.Fill;
this.gbTools.Location = new System.Drawing.Point(0, 0);
this.gbTools.Name = "gbTools";
this.gbTools.Size = new System.Drawing.Size(793, 125);
this.gbTools.TabIndex = 0;
this.gbTools.TabStop = false;
this.gbTools.Text = "操作台";
//
// lbSetPackage
//
this.lbSetPackage.AutoSize = true;
this.lbSetPackage.Font = new System.Drawing.Font("宋体", 18F);
this.lbSetPackage.Location = new System.Drawing.Point(6, 36);
this.lbSetPackage.Name = "lbSetPackage";
this.lbSetPackage.Size = new System.Drawing.Size(118, 24);
this.lbSetPackage.TabIndex = 26;
this.lbSetPackage.Text = "箱号设置:";
//
// tbSetCurrentPackage
//
this.tbSetCurrentPackage.BackColor = System.Drawing.SystemColors.Window;
this.tbSetCurrentPackage.Font = new System.Drawing.Font("宋体", 18F);
this.tbSetCurrentPackage.Location = new System.Drawing.Point(6, 63);
this.tbSetCurrentPackage.Name = "tbSetCurrentPackage";
this.tbSetCurrentPackage.Size = new System.Drawing.Size(227, 35);
this.tbSetCurrentPackage.TabIndex = 25;
this.tbSetCurrentPackage.KeyDown += new System.Windows.Forms.KeyEventHandler(this.tbSetCurrentPackage_KeyDown);
//
// plMain
//
this.plMain.Controls.Add(this.gbMain);
this.plMain.Dock = System.Windows.Forms.DockStyle.Fill;
this.plMain.Location = new System.Drawing.Point(265, 125);
this.plMain.Name = "plMain";
this.plMain.Size = new System.Drawing.Size(793, 469);
this.plMain.TabIndex = 2;
//
// gbMain
//
this.gbMain.Controls.Add(this.dgvSamples);
this.gbMain.Dock = System.Windows.Forms.DockStyle.Fill;
this.gbMain.Location = new System.Drawing.Point(0, 0);
this.gbMain.Name = "gbMain";
this.gbMain.Size = new System.Drawing.Size(793, 469);
this.gbMain.TabIndex = 0;
this.gbMain.TabStop = false;
this.gbMain.Text = "入箱列表";
//
// lbSetPackageNode
//
this.lbSetPackageNode.AutoSize = true;
this.lbSetPackageNode.Font = new System.Drawing.Font("宋体", 18F);
this.lbSetPackageNode.Location = new System.Drawing.Point(235, 36);
this.lbSetPackageNode.Name = "lbSetPackageNode";
this.lbSetPackageNode.Size = new System.Drawing.Size(118, 24);
this.lbSetPackageNode.TabIndex = 28;
this.lbSetPackageNode.Text = "袋子选择:";
//
// cbSetCurrentPackageNode
//
this.cbSetCurrentPackageNode.Font = new System.Drawing.Font("宋体", 20F);
this.cbSetCurrentPackageNode.FormattingEnabled = true;
this.cbSetCurrentPackageNode.Items.AddRange(new object[] {
"1号袋",
"2号袋",
"3号袋",
"4号袋",
"5号袋",
"6号袋"});
this.cbSetCurrentPackageNode.Location = new System.Drawing.Point(239, 63);
this.cbSetCurrentPackageNode.Name = "cbSetCurrentPackageNode";
this.cbSetCurrentPackageNode.Size = new System.Drawing.Size(180, 35);
this.cbSetCurrentPackageNode.TabIndex = 30;
this.cbSetCurrentPackageNode.TextChanged += new System.EventHandler(this.cbSetCurrentPackageNode_TextChanged);
//
// btnScanRfid
//
this.btnScanRfid.BackColor = System.Drawing.Color.PapayaWhip;
this.btnScanRfid.Dock = System.Windows.Forms.DockStyle.Right;
this.btnScanRfid.Font = new System.Drawing.Font("宋体", 25F, System.Drawing.FontStyle.Bold);
this.btnScanRfid.ForeColor = System.Drawing.Color.Chocolate;
this.btnScanRfid.Location = new System.Drawing.Point(664, 17);
this.btnScanRfid.Name = "btnScanRfid";
this.btnScanRfid.Size = new System.Drawing.Size(126, 105);
this.btnScanRfid.TabIndex = 76;
this.btnScanRfid.Text = "开始扫描";
this.btnScanRfid.UseVisualStyleBackColor = false;
//
// dgvSamples
//
this.dgvSamples.AllowUserToAddRows = false;
this.dgvSamples.AllowUserToDeleteRows = false;
this.dgvSamples.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvSamples.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.SampleAction,
this.SampleBizId,
this.SampleOwnerName,
this.SampleName,
this.SampleDealTime,
this.SampleDeadTime,
this.SampleQuantityUnit,
this.SamplePackageName});
this.dgvSamples.Dock = System.Windows.Forms.DockStyle.Fill;
this.dgvSamples.Location = new System.Drawing.Point(3, 17);
this.dgvSamples.Name = "dgvSamples";
this.dgvSamples.ReadOnly = true;
this.dgvSamples.RowTemplate.Height = 23;
this.dgvSamples.Size = new System.Drawing.Size(787, 449);
this.dgvSamples.TabIndex = 0;
this.dgvSamples.RowPostPaint += new System.Windows.Forms.DataGridViewRowPostPaintEventHandler(this.dgvSamples_RowPostPaint);
//
// btnClearCurrentPackage
//
this.btnClearCurrentPackage.Location = new System.Drawing.Point(130, 37);
this.btnClearCurrentPackage.Name = "btnClearCurrentPackage";
this.btnClearCurrentPackage.Size = new System.Drawing.Size(103, 23);
this.btnClearCurrentPackage.TabIndex = 77;
this.btnClearCurrentPackage.Text = "重设";
this.btnClearCurrentPackage.UseVisualStyleBackColor = true;
this.btnClearCurrentPackage.Click += new System.EventHandler(this.btnClearCurrentPackage_Click);
//
// SampleAction
//
dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle1.NullValue = "撤销入箱";
this.SampleAction.DefaultCellStyle = dataGridViewCellStyle1;
this.SampleAction.Frozen = true;
this.SampleAction.HeaderText = "操作";
this.SampleAction.MinimumWidth = 100;
this.SampleAction.Name = "SampleAction";
this.SampleAction.ReadOnly = true;
this.SampleAction.Resizable = System.Windows.Forms.DataGridViewTriState.True;
this.SampleAction.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
this.SampleAction.Text = "撤销入箱";
//
// SampleBizId
//
this.SampleBizId.DataPropertyName = "BizId";
this.SampleBizId.Frozen = true;
this.SampleBizId.HeaderText = "样品报告号";
this.SampleBizId.MinimumWidth = 150;
this.SampleBizId.Name = "SampleBizId";
this.SampleBizId.ReadOnly = true;
this.SampleBizId.Width = 150;
//
// SampleOwnerName
//
this.SampleOwnerName.DataPropertyName = "OwnerName";
this.SampleOwnerName.HeaderText = "所属部门";
this.SampleOwnerName.MinimumWidth = 100;
this.SampleOwnerName.Name = "SampleOwnerName";
this.SampleOwnerName.ReadOnly = true;
//
// SampleName
//
this.SampleName.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
this.SampleName.DataPropertyName = "Name";
this.SampleName.HeaderText = "样品名称";
this.SampleName.MinimumWidth = 120;
this.SampleName.Name = "SampleName";
this.SampleName.ReadOnly = true;
this.SampleName.Width = 120;
//
// SampleDealTime
//
this.SampleDealTime.DataPropertyName = "DealTime";
this.SampleDealTime.HeaderText = "委托日期";
this.SampleDealTime.MinimumWidth = 120;
this.SampleDealTime.Name = "SampleDealTime";
this.SampleDealTime.ReadOnly = true;
this.SampleDealTime.Width = 120;
//
// SampleDeadTime
//
this.SampleDeadTime.DataPropertyName = "DeadTime";
this.SampleDeadTime.HeaderText = "完成日期";
this.SampleDeadTime.MinimumWidth = 120;
this.SampleDeadTime.Name = "SampleDeadTime";
this.SampleDeadTime.ReadOnly = true;
this.SampleDeadTime.Width = 120;
//
// SampleQuantityUnit
//
this.SampleQuantityUnit.DataPropertyName = "QuantityUnit";
this.SampleQuantityUnit.HeaderText = "数量/单位";
this.SampleQuantityUnit.MinimumWidth = 100;
this.SampleQuantityUnit.Name = "SampleQuantityUnit";
this.SampleQuantityUnit.ReadOnly = true;
//
// SamplePackageName
//
this.SamplePackageName.DataPropertyName = "PackageName";
this.SamplePackageName.HeaderText = "箱号";
this.SamplePackageName.MinimumWidth = 120;
this.SamplePackageName.Name = "SamplePackageName";
this.SamplePackageName.ReadOnly = true;
this.SamplePackageName.Width = 120;
//
// FrmMain
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.ClientSize = new System.Drawing.Size(1058, 594);
this.Controls.Add(this.plMain);
this.Controls.Add(this.plToolBar);
this.Controls.Add(this.plLeft);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "FrmMain";
this.Text = "样品入箱客户端 1.0(23.5.24)";
this.Load += new System.EventHandler(this.FrmMain_Load);
this.plLeft.ResumeLayout(false);
this.gbInfo.ResumeLayout(false);
this.gbInfo.PerformLayout();
this.gbLogin.ResumeLayout(false);
this.gbLogin.PerformLayout();
this.plToolBar.ResumeLayout(false);
this.gbTools.ResumeLayout(false);
this.gbTools.PerformLayout();
this.plMain.ResumeLayout(false);
this.gbMain.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dgvSamples)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Panel plLeft;
private System.Windows.Forms.Panel plToolBar;
private System.Windows.Forms.Panel plMain;
private System.Windows.Forms.GroupBox gbLogin;
private System.Windows.Forms.GroupBox gbInfo;
private System.Windows.Forms.GroupBox gbTools;
private System.Windows.Forms.GroupBox gbMain;
private System.Windows.Forms.Button btnLogout;
private System.Windows.Forms.Button btnLogin;
private System.Windows.Forms.Label lblUrl;
private System.Windows.Forms.Label lblUser;
private System.Windows.Forms.Label lblPassword;
private System.Windows.Forms.TextBox tbxPassword;
private System.Windows.Forms.TextBox tbxServiceUrl;
private System.Windows.Forms.TextBox tbxUserName;
private System.Windows.Forms.TextBox tbCurrentLocation;
private System.Windows.Forms.TextBox tbCurrentDepartment;
private System.Windows.Forms.Label lbCurrentLocation;
private System.Windows.Forms.Label lbCurrentDepartment;
private System.Windows.Forms.TextBox tbCurrentPackageNode;
private System.Windows.Forms.TextBox tbCurrentPackage;
private System.Windows.Forms.Label lbCurrentPackage;
private System.Windows.Forms.Label lbCurrentPackageNode;
private System.Windows.Forms.Label lbSetPackage;
private System.Windows.Forms.TextBox tbSetCurrentPackage;
private System.Windows.Forms.ComboBox cbSetCurrentPackageNode;
private System.Windows.Forms.Label lbSetPackageNode;
private System.Windows.Forms.Button btnScanRfid;
private System.Windows.Forms.DataGridView dgvSamples;
private System.Windows.Forms.Button btnClearCurrentPackage;
private System.Windows.Forms.DataGridViewButtonColumn SampleAction;
private System.Windows.Forms.DataGridViewTextBoxColumn SampleBizId;
private System.Windows.Forms.DataGridViewTextBoxColumn SampleOwnerName;
private System.Windows.Forms.DataGridViewTextBoxColumn SampleName;
private System.Windows.Forms.DataGridViewTextBoxColumn SampleDealTime;
private System.Windows.Forms.DataGridViewTextBoxColumn SampleDeadTime;
private System.Windows.Forms.DataGridViewTextBoxColumn SampleQuantityUnit;
private System.Windows.Forms.DataGridViewTextBoxColumn SamplePackageName;
}
}
using System;
using Kivii.Client.SamplePackages.Entities;
using Kivii.Linq;
using Kivii.Samples.Entities;
using Kivii.Samples.Transforms;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Windows.Forms;
namespace Kivii.Client.SamplePackages
{
public partial class FrmMain : Form
{
#region 私有变量
private JsonServiceClient _client;
private Location _currentLocation;
private Sample _currentPackage;
private List<Sample> _currentSamples;
private AuthenticateResponse _userInfo;
#endregion
public FrmMain()
{
InitializeComponent();
}
private void FrmMain_Load(object sender, EventArgs e)
{
initControls();
loadDefault(tbxServiceUrl, tbxUserName, tbxPassword);
}
#region 界面控件默认值及控制
private void initControls()
{
dgvSamples.AutoGenerateColumns = false;
tbxServiceUrl.Enabled = true;
tbxUserName.Enabled = true;
tbxPassword.Enabled = true;
tbSetCurrentPackage.Enabled = false;
cbSetCurrentPackageNode.Enabled = false;
btnLogin.Enabled = true;
btnLogout.Enabled = false;
btnScanRfid.Enabled = false;
btnClearCurrentPackage.Enabled = false;
tbCurrentLocation.Text = "";
tbCurrentDepartment.Text = "";
tbCurrentPackage.Text = "";
tbCurrentPackageNode.Text = "";
tbSetCurrentPackage.Text = "";
cbSetCurrentPackageNode.SelectedItem = null;
_currentSamples = null;
dgvSamples.DataSource = null;
}
private void loadDefault(params Control[] ctls)
{
try
{
using (var conn = KiviiContext.GetOpenedDbConnection<UiSetting>())
{
foreach (var ctl in ctls)
{
//UiSetting setting = null;
var setting = conn.Select<UiSetting>(o => o.FormName == this.Name && o.ControlName == ctl.Name).FirstOrDefault();
if (setting == null)
{
if (ctl.Name == tbxServiceUrl.Name) ctl.Text = Configs.DefaultBaseUrl;
continue;
}
ctl.Text = setting.ControlValue;
}
}
}
catch
{
}
}
private void setDefault(params Control[] ctls)
{
try
{
using (var conn = KiviiContext.GetOpenedDbConnection<UiSetting>())
{
foreach (var ctl in ctls)
{
var setting = conn.Select<UiSetting>(o => o.FormName == this.Name && o.ControlName == ctl.Name).FirstOrDefault();
if (setting == null)
{
setting = new UiSetting();
setting.FormName = this.Name;
setting.ControlName = ctl.Name;
setting.ControlValue = ctl.Text;
conn.Insert(setting);
}
else
{
setting.ControlValue = ctl.Text;
conn.Update(setting);
}
}
}
}
catch
{
}
}
#endregion
#region 业务方法
private void initUserInfo(AuthenticateResponse response = null)
{
if (response == null)
{
_userInfo = null;
_currentLocation = null;
_currentPackage = null;
return;
}
_userInfo = new AuthenticateResponse();
_userInfo.PopulateWith(response);
tbCurrentDepartment.Text = _userInfo.DepartmentName;
initLocation();
}
private void initLocation()
{
if (_client == null)
{
MessageBox.Show("请先登录!");
return;
}
if (_userInfo == null)
{
MessageBox.Show("未取得登录人信息,请重新登录!");
return;
}
var request = new LocationQuery();
request.OwnerKvid = _userInfo.DepartmentKvid;
var task = _client.PostAsync(request);
task.Success(resp =>
{
if (resp.Results.Count <= 0)
{
MessageBox.Show("未找到当前登录人所在组及位置信息!", "位置信息");
return;
}
var location = resp.Results.FirstOrDefault();
_currentLocation = new Location();
_currentLocation.PopulateWith(location);
tbSetCurrentPackage.Enabled = _currentLocation != null;
tbCurrentLocation.Text = _currentLocation.Address;
});
task.Error(err =>
{
_currentLocation = null;
tbSetCurrentPackage.Enabled = _currentLocation != null;
MessageBox.Show(err.Message, "位置信息");
});
}
private void querySampleInPackaged()
{
if (_client == null)
{
MessageBox.Show("请先登录!");
return;
}
if(_currentPackage==null)
{
MessageBox.Show("请先设置箱号!");
return;
}
this.Invoke(new Action(delegate
{
dgvSamples.DataSource = null;
}));
var request = new SampleQuery2();
request.PackageKvid = _currentPackage.Kvid;
var task = _client.PostAsync(request);
task.Success(resp =>
{
_currentSamples = resp.Results.ToList();
this.Invoke(new Action(delegate
{
dgvSamples.DataSource = _currentSamples;
}));
});
task.Error(err =>
{
MessageBox.Show(err.Message, "查询样品");
});
}
private void searchPackage()
{
if (_client == null)
{
MessageBox.Show("请先登录!");
return;
}
if (tbSetCurrentPackage.Text.IsNullOrEmpty())
{
MessageBox.Show("请输入箱号!");
return;
}
var request = new SampleQuery();
request.Name = tbSetCurrentPackage.Text;
request.Type = SampleType.Package;
var task = _client.PostAsync(request);
task.Success(resp =>
{
if (resp.Results.Count <= 0)
{
_currentPackage = null;
MessageBox.Show("未找到箱号!", "箱号设置");
return;
}
var package = resp.Results.FirstOrDefault();
_currentPackage = new Sample();
_currentPackage.PopulateWith(package);
tbSetCurrentPackage.Enabled = _currentPackage == null;
tbCurrentPackage.Text = _currentPackage.Name + (_currentPackage.PackageName.IsNullOrEmpty() ? "" : $"({_currentPackage.PackageName})");
btnClearCurrentPackage.Enabled = _currentPackage != null;
cbSetCurrentPackageNode.Enabled = _currentPackage.Status == (int)PackageStatus.Empty|| _currentPackage.Status == (int)PackageStatus.Full; ;
btnScanRfid.Enabled = _currentPackage.Status == (int)PackageStatus.Empty;
if (_currentPackage.Status == (int)PackageStatus.Full || _currentPackage.Status == (int)PackageStatus.Inbound)
{
querySampleInPackaged();
}
if (_currentPackage.Status == (int)PackageStatus.Inbound)
{
MessageBox.Show("当前箱子已入库,无法继续操作!", "箱号设置");
}
});
task.Error(err =>
{
_currentPackage = null;
tbSetCurrentPackage.Enabled = true;
tbCurrentPackage.Text = "";
btnClearCurrentPackage.Enabled = false;
cbSetCurrentPackageNode.SelectedItem = null;
cbSetCurrentPackageNode.Enabled = false;
btnScanRfid.Enabled = false;
MessageBox.Show(err.Message, "箱号设置");
});
}
#endregion
private void btnLogin_Click(object sender, EventArgs e)
{
if (_client != null)
{
MessageBox.Show("登陆前先退出原连接");
return;
}
btnLogin.Enabled = false;
_client = new JsonServiceClient(tbxServiceUrl.Text);
var auth = new Authenticate { UserName = tbxUserName.Text, Password = tbxPassword.Text, provider = "Kivii" };
var task = _client.PostAsync(auth);
task.Success(resp =>
{
initUserInfo(resp);
btnLogin.Enabled = false;
btnLogout.Enabled = !btnLogin.Enabled;
tbxServiceUrl.Enabled = btnLogin.Enabled;
tbxUserName.Enabled = btnLogin.Enabled;
tbxPassword.Enabled = btnLogin.Enabled;
//tbSetCurrentPackage.Enabled = !btnLogin.Enabled;
setDefault(tbxServiceUrl, tbxUserName, tbxPassword);
}, true);
task.Error(err =>
{
btnLogin.Enabled = true;
initUserInfo();
_client.Dispose();
_client = null;
MessageBox.Show(err.Message, "Login Error");
}, true);
}
private void btnLogout_Click(object sender, EventArgs e)
{
if (_client == null)
{
MessageBox.Show("未连接");
return;
}
btnLogout.Enabled = false;
var auth = new Authenticate { provider = "Logout" };
var task = _client.PostAsync(auth);
task.Success(resp =>
{
initControls();
_client.Dispose();
_client = null;
initUserInfo();
});
task.Error(err =>
{
btnLogout.Enabled = true;
MessageBox.Show(err.Message, "Logout Error");
});
}
private void tbxPassword_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
btnLogin_Click(null, null);
}
}
private void tbSetCurrentPackage_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
searchPackage();
}
}
private void btnClearCurrentPackage_Click(object sender, EventArgs e)
{
_currentPackage = null;
_currentSamples = null;
tbSetCurrentPackage.Enabled = true;
tbCurrentPackage.Text = "";
btnClearCurrentPackage.Enabled = false;
cbSetCurrentPackageNode.SelectedItem = null;
cbSetCurrentPackageNode.Enabled = false;
btnScanRfid.Enabled = false;
dgvSamples.DataSource = null;
}
private void cbSetCurrentPackageNode_TextChanged(object sender, EventArgs e)
{
tbCurrentPackageNode.Text = cbSetCurrentPackageNode.Text;
}
private void dgvSamples_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
{
dgvSamples.TopLeftHeaderCell.Value = "序号";
//自动编号,与数据无关
Rectangle rectangle = new Rectangle(e.RowBounds.Location.X,
e.RowBounds.Location.Y,
dgvSamples.RowHeadersWidth - 4,
e.RowBounds.Height);
TextRenderer.DrawText(e.Graphics,
(e.RowIndex + 1).ToString(),
dgvSamples.RowHeadersDefaultCellStyle.Font,
rectangle,
dgvSamples.RowHeadersDefaultCellStyle.ForeColor,
TextFormatFlags.VerticalCenter | TextFormatFlags.Right);
}
}
}
......@@ -117,6 +117,30 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="SampleAction.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="SampleBizId.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="SampleOwnerName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="SampleName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="SampleDealTime.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="SampleDeadTime.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="SampleQuantityUnit.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="SamplePackageName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
......
......@@ -32,6 +32,18 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Kivii.Common.V4.0, Version=5.6.2023.4000, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Kivii.Common.5.6.2023.4000\lib\net40\Kivii.Common.V4.0.dll</HintPath>
</Reference>
<Reference Include="Kivii.Core.V4.0, Version=5.6.2023.4140, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Kivii.Core.5.6.2023.4140\lib\net40\Kivii.Core.V4.0.dll</HintPath>
</Reference>
<Reference Include="Kivii.Linq.Sqlite.V4.0, Version=5.6.2023.3000, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Kivii.Linq.Sqlite.5.6.2023.3000\lib\net40\Kivii.Linq.Sqlite.V4.0.dll</HintPath>
</Reference>
<Reference Include="Kivii.Linq.V4.0, Version=5.6.2023.4200, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Kivii.Linq.5.6.2023.4200\lib\net40\Kivii.Linq.V4.0.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
......@@ -44,6 +56,9 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Configs.cs" />
<Compile Include="Entities\Sample.Entities.cs" />
<Compile Include="Entities\UiSetting.cs" />
<Compile Include="FrmMain.cs">
<SubType>Form</SubType>
</Compile>
......@@ -52,6 +67,7 @@
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Requests\RestfulRequests.cs" />
<EmbeddedResource Include="FrmMain.resx">
<DependentUpon>FrmMain.cs</DependentUpon>
</EmbeddedResource>
......@@ -64,6 +80,8 @@
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="App.config" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
......
using Kivii.Client.SamplePackages;
using Kivii.Samples.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Kivii.Samples.Transforms
{
[Route(Configs.RouteLocationQuery)]
public class LocationQuery : IReturn<RestfulQueryResponse<Location>>
{
public Guid OwnerKvid { get; set; }
}
[Route(Configs.RouteSampleQuery)]
public class SampleQuery : IReturn<RestfulQueryResponse<Sample>>
{
public string Name { get; set; }
public SampleType Type { get; set; }
//public Guid PackageKvid { get; set; }
}
[Route(Configs.RouteSampleQuery)]
public class SampleQuery2 : IReturn<RestfulQueryResponse<Sample>>
{
public Guid PackageKvid { get; set; }
}
}
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Kivii.Common" version="5.6.2023.4000" targetFramework="net40" />
<package id="Kivii.Core" version="5.6.2023.4140" targetFramework="net40" />
<package id="Kivii.Linq" version="5.6.2023.4200" targetFramework="net40" />
<package id="Kivii.Linq.Sqlite" version="5.6.2023.3000" targetFramework="net40" />
</packages>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment