Commit 0a0b5331 by 陶然

Merge branch 'D500' into 'master'

D500 See merge request !1
parents d35172c8 d1fbea9d
......@@ -8,3 +8,5 @@
/Src/Kivii.Client.SamplePackages.V4.0.csproj.user
/packages
/Src/bin/Debug
/Src/bin/SamplePackage
/Src/obj/Release
......@@ -16,6 +16,7 @@ namespace Kivii.Client.SamplePackages
public const string RouteSamplePrePackaging = "/Restful/Kivii.Samples.Entities.Sample/PrePackaging";
public const string RouteSamplePackaging = "/Restful/Kivii.Samples.Entities.Sample/Packaging";
public const string RouteSampleUnPackaging = "/Restful/Kivii.Samples.Entities.Sample/UnPackaging";
public const string RouteSampleCreate = "/Restful/Kivii.Samples.Entities.Sample/Create";
}
}
......@@ -41,6 +41,7 @@
this.tbCurrentLocation = new System.Windows.Forms.TextBox();
this.tbCurrentDepartment = new System.Windows.Forms.TextBox();
this.gbLogin = new System.Windows.Forms.GroupBox();
this.lbLogStatus = new System.Windows.Forms.Label();
this.btnLogout = new System.Windows.Forms.Button();
this.btnLogin = new System.Windows.Forms.Button();
this.lblUrl = new System.Windows.Forms.Label();
......@@ -51,6 +52,10 @@
this.tbxUserName = new System.Windows.Forms.TextBox();
this.plToolBar = new System.Windows.Forms.Panel();
this.gbTools = new System.Windows.Forms.GroupBox();
this.ckbAutoCreatePackage = new System.Windows.Forms.CheckBox();
this.lbTips = new System.Windows.Forms.Label();
this.lbScanSample = new System.Windows.Forms.Label();
this.tbScanSample = new System.Windows.Forms.TextBox();
this.btnClearCurrentPackage = new System.Windows.Forms.Button();
this.btnScanRfid = new System.Windows.Forms.Button();
this.cbSetCurrentPackageNode = new System.Windows.Forms.ComboBox();
......@@ -85,7 +90,7 @@
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.Size = new System.Drawing.Size(265, 659);
this.plLeft.TabIndex = 0;
//
// gbInfo
......@@ -99,9 +104,9 @@
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.Location = new System.Drawing.Point(0, 346);
this.gbInfo.Name = "gbInfo";
this.gbInfo.Size = new System.Drawing.Size(265, 278);
this.gbInfo.Size = new System.Drawing.Size(265, 313);
this.gbInfo.TabIndex = 1;
this.gbInfo.TabStop = false;
this.gbInfo.Text = "信息";
......@@ -112,7 +117,7 @@
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.Size = new System.Drawing.Size(80, 16);
this.lbCurrentPackageNode.TabIndex = 7;
this.lbCurrentPackageNode.Text = "当前袋子:";
//
......@@ -122,7 +127,7 @@
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.Size = new System.Drawing.Size(80, 16);
this.lbCurrentPackage.TabIndex = 6;
this.lbCurrentPackage.Text = "当前箱号:";
//
......@@ -132,7 +137,7 @@
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.Size = new System.Drawing.Size(80, 16);
this.lbCurrentLocation.TabIndex = 5;
this.lbCurrentLocation.Text = "当前位置:";
//
......@@ -142,7 +147,7 @@
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.Size = new System.Drawing.Size(80, 16);
this.lbCurrentDepartment.TabIndex = 4;
this.lbCurrentDepartment.Text = "当前部门:";
//
......@@ -188,6 +193,7 @@
//
// gbLogin
//
this.gbLogin.Controls.Add(this.lbLogStatus);
this.gbLogin.Controls.Add(this.btnLogout);
this.gbLogin.Controls.Add(this.btnLogin);
this.gbLogin.Controls.Add(this.lblUrl);
......@@ -199,17 +205,28 @@
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.Size = new System.Drawing.Size(265, 346);
this.gbLogin.TabIndex = 0;
this.gbLogin.TabStop = false;
this.gbLogin.Text = "登录";
//
// lbLogStatus
//
this.lbLogStatus.AutoSize = true;
this.lbLogStatus.Font = new System.Drawing.Font("宋体", 25F);
this.lbLogStatus.ForeColor = System.Drawing.Color.Red;
this.lbLogStatus.Location = new System.Drawing.Point(12, 242);
this.lbLogStatus.Name = "lbLogStatus";
this.lbLogStatus.Size = new System.Drawing.Size(117, 34);
this.lbLogStatus.TabIndex = 29;
this.lbLogStatus.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.Location = new System.Drawing.Point(131, 288);
this.btnLogout.Name = "btnLogout";
this.btnLogout.Size = new System.Drawing.Size(107, 43);
this.btnLogout.TabIndex = 28;
......@@ -222,7 +239,7 @@
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.Location = new System.Drawing.Point(12, 288);
this.btnLogin.Name = "btnLogin";
this.btnLogin.Size = new System.Drawing.Size(107, 43);
this.btnLogin.TabIndex = 27;
......@@ -293,11 +310,15 @@
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.Size = new System.Drawing.Size(912, 125);
this.plToolBar.TabIndex = 1;
//
// gbTools
//
this.gbTools.Controls.Add(this.ckbAutoCreatePackage);
this.gbTools.Controls.Add(this.lbTips);
this.gbTools.Controls.Add(this.lbScanSample);
this.gbTools.Controls.Add(this.tbScanSample);
this.gbTools.Controls.Add(this.btnClearCurrentPackage);
this.gbTools.Controls.Add(this.btnScanRfid);
this.gbTools.Controls.Add(this.cbSetCurrentPackageNode);
......@@ -307,16 +328,59 @@
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.Size = new System.Drawing.Size(912, 125);
this.gbTools.TabIndex = 0;
this.gbTools.TabStop = false;
this.gbTools.Text = "操作台";
//
// ckbAutoCreatePackage
//
this.ckbAutoCreatePackage.AutoSize = true;
this.ckbAutoCreatePackage.Checked = true;
this.ckbAutoCreatePackage.CheckState = System.Windows.Forms.CheckState.Checked;
this.ckbAutoCreatePackage.Location = new System.Drawing.Point(196, 41);
this.ckbAutoCreatePackage.Name = "ckbAutoCreatePackage";
this.ckbAutoCreatePackage.Size = new System.Drawing.Size(72, 16);
this.ckbAutoCreatePackage.TabIndex = 81;
this.ckbAutoCreatePackage.Text = "创建箱号";
this.ckbAutoCreatePackage.UseVisualStyleBackColor = true;
//
// lbTips
//
this.lbTips.AutoSize = true;
this.lbTips.Font = new System.Drawing.Font("宋体", 10F);
this.lbTips.ForeColor = System.Drawing.SystemColors.ButtonShadow;
this.lbTips.Location = new System.Drawing.Point(529, 46);
this.lbTips.Name = "lbTips";
this.lbTips.Size = new System.Drawing.Size(119, 14);
this.lbTips.TabIndex = 80;
this.lbTips.Text = "(输入完成报告号)";
//
// lbScanSample
//
this.lbScanSample.AutoSize = true;
this.lbScanSample.Font = new System.Drawing.Font("宋体", 18F);
this.lbScanSample.Location = new System.Drawing.Point(421, 36);
this.lbScanSample.Name = "lbScanSample";
this.lbScanSample.Size = new System.Drawing.Size(118, 24);
this.lbScanSample.TabIndex = 79;
this.lbScanSample.Text = "手动入箱:";
//
// tbScanSample
//
this.tbScanSample.BackColor = System.Drawing.SystemColors.Window;
this.tbScanSample.Font = new System.Drawing.Font("宋体", 18F);
this.tbScanSample.Location = new System.Drawing.Point(425, 63);
this.tbScanSample.Name = "tbScanSample";
this.tbScanSample.Size = new System.Drawing.Size(249, 35);
this.tbScanSample.TabIndex = 78;
this.tbScanSample.KeyDown += new System.Windows.Forms.KeyEventHandler(this.tbScanSample_KeyDown);
//
// btnClearCurrentPackage
//
this.btnClearCurrentPackage.Location = new System.Drawing.Point(130, 37);
this.btnClearCurrentPackage.Location = new System.Drawing.Point(121, 37);
this.btnClearCurrentPackage.Name = "btnClearCurrentPackage";
this.btnClearCurrentPackage.Size = new System.Drawing.Size(103, 23);
this.btnClearCurrentPackage.Size = new System.Drawing.Size(67, 23);
this.btnClearCurrentPackage.TabIndex = 77;
this.btnClearCurrentPackage.Text = "重设";
this.btnClearCurrentPackage.UseVisualStyleBackColor = true;
......@@ -328,7 +392,7 @@
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.Location = new System.Drawing.Point(783, 17);
this.btnScanRfid.Name = "btnScanRfid";
this.btnScanRfid.Size = new System.Drawing.Size(126, 105);
this.btnScanRfid.TabIndex = 76;
......@@ -347,9 +411,9 @@
"4号袋",
"5号袋",
"6号袋"});
this.cbSetCurrentPackageNode.Location = new System.Drawing.Point(239, 63);
this.cbSetCurrentPackageNode.Location = new System.Drawing.Point(276, 63);
this.cbSetCurrentPackageNode.Name = "cbSetCurrentPackageNode";
this.cbSetCurrentPackageNode.Size = new System.Drawing.Size(180, 35);
this.cbSetCurrentPackageNode.Size = new System.Drawing.Size(143, 35);
this.cbSetCurrentPackageNode.TabIndex = 30;
this.cbSetCurrentPackageNode.TextChanged += new System.EventHandler(this.cbSetCurrentPackageNode_TextChanged);
//
......@@ -357,7 +421,7 @@
//
this.lbSetPackageNode.AutoSize = true;
this.lbSetPackageNode.Font = new System.Drawing.Font("宋体", 18F);
this.lbSetPackageNode.Location = new System.Drawing.Point(235, 36);
this.lbSetPackageNode.Location = new System.Drawing.Point(274, 36);
this.lbSetPackageNode.Name = "lbSetPackageNode";
this.lbSetPackageNode.Size = new System.Drawing.Size(118, 24);
this.lbSetPackageNode.TabIndex = 28;
......@@ -379,7 +443,7 @@
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.Size = new System.Drawing.Size(266, 35);
this.tbSetCurrentPackage.TabIndex = 25;
this.tbSetCurrentPackage.KeyDown += new System.Windows.Forms.KeyEventHandler(this.tbSetCurrentPackage_KeyDown);
//
......@@ -389,7 +453,7 @@
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.Size = new System.Drawing.Size(912, 534);
this.plMain.TabIndex = 2;
//
// gbMain
......@@ -398,7 +462,7 @@
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.Size = new System.Drawing.Size(912, 534);
this.gbMain.TabIndex = 0;
this.gbMain.TabStop = false;
this.gbMain.Text = "入箱列表";
......@@ -422,7 +486,7 @@
this.dgvSamples.Name = "dgvSamples";
this.dgvSamples.ReadOnly = true;
this.dgvSamples.RowTemplate.Height = 23;
this.dgvSamples.Size = new System.Drawing.Size(787, 449);
this.dgvSamples.Size = new System.Drawing.Size(906, 514);
this.dgvSamples.TabIndex = 0;
this.dgvSamples.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvSamples_CellContentClick);
this.dgvSamples.RowPostPaint += new System.Windows.Forms.DataGridViewRowPostPaintEventHandler(this.dgvSamples_RowPostPaint);
......@@ -434,37 +498,39 @@
this.SampleAction.DefaultCellStyle = dataGridViewCellStyle1;
this.SampleAction.Frozen = true;
this.SampleAction.HeaderText = "操作";
this.SampleAction.MinimumWidth = 100;
this.SampleAction.MinimumWidth = 80;
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 = "撤销入箱";
this.SampleAction.Width = 80;
//
// SampleBizId
//
this.SampleBizId.DataPropertyName = "BizId";
this.SampleBizId.Frozen = true;
this.SampleBizId.HeaderText = "样品报告号";
this.SampleBizId.MinimumWidth = 150;
this.SampleBizId.MinimumWidth = 160;
this.SampleBizId.Name = "SampleBizId";
this.SampleBizId.ReadOnly = true;
this.SampleBizId.Width = 150;
this.SampleBizId.Width = 160;
//
// SampleOwnerName
//
this.SampleOwnerName.DataPropertyName = "OwnerName";
this.SampleOwnerName.HeaderText = "所属部门";
this.SampleOwnerName.MinimumWidth = 100;
this.SampleOwnerName.MinimumWidth = 90;
this.SampleOwnerName.Name = "SampleOwnerName";
this.SampleOwnerName.ReadOnly = true;
this.SampleOwnerName.Width = 90;
//
// SampleName
//
this.SampleName.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.SampleName.DataPropertyName = "Name";
this.SampleName.HeaderText = "样品名称";
this.SampleName.MinimumWidth = 120;
this.SampleName.MinimumWidth = 100;
this.SampleName.Name = "SampleName";
this.SampleName.ReadOnly = true;
//
......@@ -472,19 +538,17 @@
//
this.SampleDealTime.DataPropertyName = "DealTime";
this.SampleDealTime.HeaderText = "委托日期";
this.SampleDealTime.MinimumWidth = 120;
this.SampleDealTime.MinimumWidth = 100;
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.MinimumWidth = 100;
this.SampleDeadTime.Name = "SampleDeadTime";
this.SampleDeadTime.ReadOnly = true;
this.SampleDeadTime.Width = 120;
//
// SampleQuantityUnit
//
......@@ -507,13 +571,13 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1058, 594);
this.ClientSize = new System.Drawing.Size(1177, 659);
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 D500)";
this.Text = "样品入箱客户端 1.0(23.6.08 D500)";
this.Load += new System.EventHandler(this.FrmMain_Load);
this.plLeft.ResumeLayout(false);
this.gbInfo.ResumeLayout(false);
......@@ -562,6 +626,11 @@
private System.Windows.Forms.Button btnScanRfid;
private System.Windows.Forms.DataGridView dgvSamples;
private System.Windows.Forms.Button btnClearCurrentPackage;
private System.Windows.Forms.TextBox tbScanSample;
private System.Windows.Forms.Label lbScanSample;
private System.Windows.Forms.Label lbTips;
private System.Windows.Forms.CheckBox ckbAutoCreatePackage;
private System.Windows.Forms.Label lbLogStatus;
private System.Windows.Forms.DataGridViewButtonColumn SampleAction;
private System.Windows.Forms.DataGridViewTextBoxColumn SampleBizId;
private System.Windows.Forms.DataGridViewTextBoxColumn SampleOwnerName;
......
......@@ -9,6 +9,7 @@ using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading;
using System.Timers;
......@@ -62,6 +63,8 @@ namespace Kivii.Client.SamplePackages
btnLogin.Enabled = true;
btnLogout.Enabled = false;
btnScanRfid.Enabled = false;
tbScanSample.Enabled = false;
tbScanSample.Text = "";
btnClearCurrentPackage.Enabled = false;
tbCurrentLocation.Text = "";
tbCurrentDepartment.Text = "";
......@@ -165,9 +168,9 @@ namespace Kivii.Client.SamplePackages
//request.OwnerKvid = Guid.Parse("208C24FB-1443-4B9E-9886-02ED3B9A8F45");//安全组
//request.OwnerKvid = Guid.Parse("7CF9CF7B-19F5-4A1A-A94C-5BC21EA8ED76");//纤维含量组
//request.OwnerKvid = Guid.Parse("BB355D5A-9D4E-4337-B577-7BB7A1625F68");//羽绒组
var task = _client.PostAsync(request);
task.Success(resp =>
try
{
var resp = _client.Post(request);
if (resp.Results.Count <= 0)
{
MessageBox.Show("未找到当前登录人所在组及位置信息!", "位置信息");
......@@ -178,13 +181,13 @@ namespace Kivii.Client.SamplePackages
_currentLocation.PopulateWith(location);
tbSetCurrentPackage.Enabled = _currentLocation != null;
tbCurrentLocation.Text = _currentLocation.Address;
});
task.Error(err =>
}
catch (Exception ex)
{
_currentLocation = null;
tbSetCurrentPackage.Enabled = _currentLocation != null;
MessageBox.Show(err.Message, "位置信息");
});
MessageBox.Show(ex.GetResponseStatus().Message, ex.Message);
}
}
private void querySampleInPackaged()
......@@ -220,11 +223,18 @@ namespace Kivii.Client.SamplePackages
});
}
private void samplePrepackaging(string tid)
private void samplePrepackaging(string tid, string epc = null, string bizId = null)
{
if (tid.IsNullOrEmpty()) return;
if (tid.IsNullOrEmpty() && bizId.IsNullOrEmpty() && epc.IsNullOrEmpty()) return;
var request = new SamplePrePackaging();
request.Tid = tid;
if (!tid.IsNullOrEmpty()) request.Tid = tid;
Guid epcKvid = Guid.Empty;
if (Guid.TryParse(epc, out epcKvid))
{
//return;
request.BizKvid = epcKvid;
}
if (!bizId.IsNullOrEmpty()) request.BizId = bizId;
request.OwnerKvid = _currentLocation.OwnerKvid;
try
{
......@@ -317,6 +327,30 @@ namespace Kivii.Client.SamplePackages
MessageBox.Show(ex.GetResponseStatus().Message, "撤销入箱");
}
}
private void setCurrentPackage(Sample package)
{
_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 || _currentPackage.Status == (int)PackageStatus.Full;
tbScanSample.Enabled = _currentPackage.Status == (int)PackageStatus.Empty || _currentPackage.Status == (int)PackageStatus.Full;
tbScanSample.Text = "";
if (_currentPackage.Status == (int)PackageStatus.Full || _currentPackage.Status == (int)PackageStatus.Inbound)
{
querySampleInPackaged();
}
if (_currentPackage.Status == (int)PackageStatus.Inbound)
{
MessageBox.Show("当前箱子已入库,无法继续操作!", "箱号设置");
return;
}
cbSetCurrentPackageNode.SelectedIndex = 0;
Thread.Sleep(200);
btnScanRfid_Click(null, null);
}
private void searchPackage()
{
......@@ -338,29 +372,64 @@ namespace Kivii.Client.SamplePackages
{
if (resp.Results.Count <= 0)
{
_currentPackage = null;
MessageBox.Show("未找到箱号!", "箱号设置");
return;
if (!ckbAutoCreatePackage.Checked)
{
_currentPackage = null;
MessageBox.Show("未找到箱号!", "箱号设置");
return;
}
else
{
var requestCreate=new PackageCreate();
requestCreate.Item = new Sample();
requestCreate.Item.Name = tbSetCurrentPackage.Text;
requestCreate.Item.Type = SampleType.Package;
requestCreate.Item.OperateTime = DateTime.Now;
var createTask = _client.PostAsync(requestCreate);
createTask.Success(res =>
{
if(res.Results.Count <= 0)
{
_currentPackage = null;
MessageBox.Show("创建箱号失败!", "箱号设置");
return;
}
var createPackage = res.Results.FirstOrDefault();
setCurrentPackage(createPackage);
return;
});
createTask.Error(ex =>
{
_currentPackage = null;
MessageBox.Show("创建箱号失败!", "箱号设置");
return;
});
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 || _currentPackage.Status == (int)PackageStatus.Full;
if (_currentPackage.Status == (int)PackageStatus.Full || _currentPackage.Status == (int)PackageStatus.Inbound)
{
querySampleInPackaged();
}
if (_currentPackage.Status == (int)PackageStatus.Inbound)
{
MessageBox.Show("当前箱子已入库,无法继续操作!", "箱号设置");
return;
}
cbSetCurrentPackageNode.SelectedIndex = 0;
btnScanRfid_Click(null, null);
setCurrentPackage(package);
//_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 || _currentPackage.Status == (int)PackageStatus.Full;
//tbScanSample.Enabled = _currentPackage.Status == (int)PackageStatus.Empty || _currentPackage.Status == (int)PackageStatus.Full;
//tbScanSample.Text = "";
//if (_currentPackage.Status == (int)PackageStatus.Full || _currentPackage.Status == (int)PackageStatus.Inbound)
//{
// querySampleInPackaged();
//}
//if (_currentPackage.Status == (int)PackageStatus.Inbound)
//{
// MessageBox.Show("当前箱子已入库,无法继续操作!", "箱号设置");
// return;
//}
//cbSetCurrentPackageNode.SelectedIndex = 0;
//Thread.Sleep(200);
//btnScanRfid_Click(null, null);
});
task.Error(err =>
{
......@@ -371,6 +440,9 @@ namespace Kivii.Client.SamplePackages
cbSetCurrentPackageNode.SelectedItem = null;
cbSetCurrentPackageNode.Enabled = false;
btnScanRfid.Enabled = false;
tbScanSample.Enabled = false;
tbScanSample.Text = "";
MessageBox.Show(err.Message, "箱号设置");
});
}
......@@ -405,8 +477,14 @@ namespace Kivii.Client.SamplePackages
{
return;
}
Thread.Sleep(500);//给下一个写卡让出时间
samplePrepackaging(tid);
string epc = null;
Thread.Sleep(150);//给下一个写卡让出时间
ReadEpcResult writeResult = ReaderInstance.ReadEpc();
if (writeResult.ReadResult.Result == AccessResult.Success)
{
epc = writeResult.TagAccessed.Epc;
}
samplePrepackaging(tid, epc);
//var th = KiviiContext.NewThread(() =>
//{
// samplePrepackaging(tid);
......@@ -444,6 +522,8 @@ namespace Kivii.Client.SamplePackages
tbxServiceUrl.Enabled = btnLogin.Enabled;
tbxUserName.Enabled = btnLogin.Enabled;
tbxPassword.Enabled = btnLogin.Enabled;
lbLogStatus.Text = "登录成功";
lbLogStatus.ForeColor = Color.Green;
//tbSetCurrentPackage.Enabled = !btnLogin.Enabled;
setDefault(tbxServiceUrl, tbxUserName, tbxPassword);
}, true);
......@@ -470,6 +550,8 @@ namespace Kivii.Client.SamplePackages
task.Success(resp =>
{
initControls();
lbLogStatus.Text = "未登录";
lbLogStatus.ForeColor = Color.Red;
_client.Dispose();
_client = null;
initUserInfo();
......@@ -507,6 +589,9 @@ namespace Kivii.Client.SamplePackages
cbSetCurrentPackageNode.SelectedItem = null;
cbSetCurrentPackageNode.Enabled = false;
btnScanRfid.Enabled = false;
tbScanSample.Enabled = false;
tbScanSample.Text = "";
dgvSamples.DataSource = null;
}
......@@ -621,5 +706,33 @@ namespace Kivii.Client.SamplePackages
if (currentRowSample == null) return;
sampleUnpackaging(currentRowSample);
}
private void tbScanSample_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
if (_client == null)
{
MessageBox.Show("请先登录.");
return;
}
if (_currentLocation == null)
{
MessageBox.Show("未获取当前位置.");
return;
}
if (_currentPackage == null)
{
MessageBox.Show("未获取当前箱号.");
return;
}
if (_currentPackage.Status == (int)PackageStatus.Inbound)
{
MessageBox.Show("当前箱子已入库,无法继续操作!");
return;
}
samplePrepackaging(null, null, tbScanSample.Text);
}
}
}
}
......@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("5.4.2023.5240")]
[assembly: AssemblyFileVersion("5.4.2023.5240")]
[assembly: AssemblyVersion("5.4.2023.6050")]
[assembly: AssemblyFileVersion("5.4.2023.6050")]
......@@ -32,6 +32,8 @@ namespace Kivii.Samples.Transforms
public class SamplePrePackaging:IReturn<RestfulExecutionResponse<Sample>>
{
public string Tid { get; set; }
public string BizId { get; set; }
public Guid BizKvid { get; set; }
public Guid OwnerKvid { get; set; }//要打包的样品的所属信息
}
......@@ -49,4 +51,10 @@ namespace Kivii.Samples.Transforms
public Guid Kvid { get; set; }//要流转样品信息
public Location Location { get; set; }//地点位置信息,只需要InternalCode
}
[Route(Configs.RouteSampleCreate)]
public class PackageCreate : IReturn<RestfulCreateResponse<Sample>>
{
public Sample Item { get; set; }
}
}
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