From 98f55057c0eb853bd0a7ae1e0c273b722fd7551a Mon Sep 17 00:00:00 2001
From: wugang <1029149336@qq.com>
Date: Fri, 10 Nov 2017 13:08:42 +0800
Subject: [PATCH] =?UTF-8?q?=E6=89=AB=E7=A0=81=E6=9C=89bug=20=E6=9C=89?=
=?UTF-8?q?=E4=B9=B1=E7=A0=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
BO/BO.csproj | 4 +-
BO/BO/Dtos/ClientGoodsSetDto.cs | 1 +
BO/BO/Dtos/ClientGoodsSetDtoExt.cs | 26 +++
BO/BO/LocalSyncBase.cs | 8 +-
BO/{ => BarCodeScan}/BardCodeHook.cs | 3 +-
BO/BarCodeScan/BwpBarCodes.cs | 25 +++
BO/Utils/BillRpc/ClientGoodsSetRpc.cs | 6 +
BO/Utils/LoginRpcUtil.cs | 2 +-
BO/Utils/UrlUtil.cs | 64 ++++--
.../LocalSyncBO/TrunksIousOutInStoreRecord.cs | 2 +
.../TrunksIousOutInStore.csproj | 1 +
.../TrunksIousOutInStoreClientGoodsSet.cs | 14 ++
.../TrunksIousOutInStoreForm.Designer.cs | 152 +++++++-------
.../TrunksIousOutInStoreForm.cs | 195 ++++++++++++++++--
14 files changed, 391 insertions(+), 112 deletions(-)
create mode 100644 BO/BO/Dtos/ClientGoodsSetDtoExt.cs
rename BO/{ => BarCodeScan}/BardCodeHook.cs (97%)
create mode 100644 BO/BarCodeScan/BwpBarCodes.cs
create mode 100644 TrunksIousOutInStore/TrunksIousOutInStoreClientGoodsSet.cs
diff --git a/BO/BO.csproj b/BO/BO.csproj
index aa3b607..91c7bcf 100644
--- a/BO/BO.csproj
+++ b/BO/BO.csproj
@@ -62,7 +62,8 @@
-
+
+
@@ -83,6 +84,7 @@
+
diff --git a/BO/BO/Dtos/ClientGoodsSetDto.cs b/BO/BO/Dtos/ClientGoodsSetDto.cs
index 4c46c77..3dcb624 100644
--- a/BO/BO/Dtos/ClientGoodsSetDto.cs
+++ b/BO/BO/Dtos/ClientGoodsSetDto.cs
@@ -9,6 +9,7 @@ namespace BO.BO.Dtos
[Serializable]
public class ClientGoodsSetDto
{
+ public string ApplyClient { get; set; }
public string Name { get; set; }
public long Goods_ID { get; set; }
public string Goods_Name { get; set; }
diff --git a/BO/BO/Dtos/ClientGoodsSetDtoExt.cs b/BO/BO/Dtos/ClientGoodsSetDtoExt.cs
new file mode 100644
index 0000000..cc8d688
--- /dev/null
+++ b/BO/BO/Dtos/ClientGoodsSetDtoExt.cs
@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BO.BO.Dtos
+{
+ public static class ClientGoodsSetDtoExt
+ {
+ public static T CreateChild(this ClientGoodsSetDto dto) where T:ClientGoodsSetDto,new()
+ {
+ var t=new T();
+ t.ApplyClient = dto.ApplyClient;
+ t.ApplyClient = dto.ApplyClient;
+ t.Name = dto.Name;
+ t.Goods_ID = dto.Goods_ID;
+ t.Goods_Name = dto.Goods_Name;
+ t.Goods_Code = dto.Goods_Code;
+ t.Goods_Spec = dto.Goods_Spec;
+ t.Goods_MainUnitRatio = dto.Goods_MainUnitRatio;
+ t.Goods_AllowableError = dto.Goods_AllowableError;
+ return t;
+ }
+ }
+}
diff --git a/BO/BO/LocalSyncBase.cs b/BO/BO/LocalSyncBase.cs
index 1757200..5e290e3 100644
--- a/BO/BO/LocalSyncBase.cs
+++ b/BO/BO/LocalSyncBase.cs
@@ -3,9 +3,12 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using BO.Utils;
+using Forks.EnterpriseServices.DomainObjects2;
namespace BO.BO
{
+ [KeyField("ID", KeyGenType.identity)]
public abstract class LocalSyncBase
{
///
@@ -58,10 +61,13 @@ namespace BO.BO
set { mCreateTime = value; }
}
+
+ private string mCreateUserName = ButcherAppContext.Context.UserConfig.UserName;
+
///
/// 每条记录都要记录创建人 将来可可以记录标识用
///
- public string CreateUserName { get; set; }
+ public string CreateUserName { get { return mCreateUserName; }set { mCreateUserName = value; } }
}
diff --git a/BO/BardCodeHook.cs b/BO/BarCodeScan/BardCodeHook.cs
similarity index 97%
rename from BO/BardCodeHook.cs
rename to BO/BarCodeScan/BardCodeHook.cs
index c90b723..9e6f8ae 100644
--- a/BO/BardCodeHook.cs
+++ b/BO/BarCodeScan/BardCodeHook.cs
@@ -154,7 +154,8 @@ namespace BO
if ((msg.message & 0xff) == 13 && sbBarCode.Length > 3)
{
//回车
- barCode.BarCode = barCode.OriginalBarCode.Replace("\r","").Replace("\t","");
+// barCode.BarCode = barCode.OriginalBarCode.Replace("\r","").Replace("\t","");
+ barCode.BarCode = barCode.OriginalBarCode;
barCode.IsValid = true;
sbBarCode.Remove(0, sbBarCode.Length);
}
diff --git a/BO/BarCodeScan/BwpBarCodes.cs b/BO/BarCodeScan/BwpBarCodes.cs
new file mode 100644
index 0000000..7b516aa
--- /dev/null
+++ b/BO/BarCodeScan/BwpBarCodes.cs
@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BO.BarCodeScan
+{
+ public class BwpBarCodes
+ {
+ public BwpBarCodes()
+ {
+ StringBuilder=new StringBuilder();
+ }
+
+ public bool IsValid; //条码是否有效
+ public DateTime Time; //扫描时间,
+ public StringBuilder StringBuilder;
+
+ public string BarCode
+ {
+ get { return StringBuilder.ToString(); } //条码信息 保存最终的条码
+ }
+ }
+}
diff --git a/BO/Utils/BillRpc/ClientGoodsSetRpc.cs b/BO/Utils/BillRpc/ClientGoodsSetRpc.cs
index 6ea2b7f..5e5e779 100644
--- a/BO/Utils/BillRpc/ClientGoodsSetRpc.cs
+++ b/BO/Utils/BillRpc/ClientGoodsSetRpc.cs
@@ -18,5 +18,11 @@ namespace BO.Utils.BillRpc
var list = serializer.Deserialize>(json);
return list;
}
+ public static List GetListByApplyClient(string applyClient)
+ {
+ var json = RpcFacade.Call("/MainSystem/B3ClientService/Rpcs/BillRpc/ClientGoodsSetRpc/GetListByApplyClient",applyClient);
+ var list = serializer.Deserialize>(json);
+ return list;
+ }
}
}
diff --git a/BO/Utils/LoginRpcUtil.cs b/BO/Utils/LoginRpcUtil.cs
index 472d288..69b69cb 100644
--- a/BO/Utils/LoginRpcUtil.cs
+++ b/BO/Utils/LoginRpcUtil.cs
@@ -55,7 +55,7 @@ namespace BO.Utils
//{
//HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
var uri = new Uri(url);
- return TestConnection(uri.Host, uri.Port, 500);
+ return TestConnection(uri.Host, uri.Port, 1000);
// HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
diff --git a/BO/Utils/UrlUtil.cs b/BO/Utils/UrlUtil.cs
index 8155909..933e8cd 100644
--- a/BO/Utils/UrlUtil.cs
+++ b/BO/Utils/UrlUtil.cs
@@ -13,37 +13,59 @@ namespace BO.Utils
public static string GetBarCode(string barCode)
{
//如果是链接
- if (barCode.Contains("?") && barCode.ToLower().Contains("http"))
- {
- Uri uri = new Uri(barCode);
- string queryString = uri.Query;
- NameValueCollection col = GetQueryString(queryString);
- string code = col["code"];
+ //http://www.bwpsoft.com?code=WF20171108000003&name=
- return code;
- }
- else
+ if (barCode.Contains("?") && barCode.ToLower().Contains("http"))
{
- return barCode;
+ barCode = barCode.Replace("http://www.bwpsoft.com?code=", "");
+ var andIndex = barCode.IndexOf("&", StringComparison.Ordinal);
+ barCode = barCode.Substring(0, andIndex);
}
-
+ return barCode.Trim();
+
+// if (barCode.Contains("?") && barCode.ToLower().Contains("http"))
+// {
+// Uri uri = new Uri(barCode);
+// string queryString = uri.Query;
+// NameValueCollection col = GetQueryString(queryString);
+// string code = col["code"];
+//
+// return code;
+// }
+// else
+// {
+// return barCode;
+// }
+
}
public static string GetGoodsName(string barCode)
{
//如果是链接
- if (barCode.Contains("?") && barCode.ToLower().Contains("http"))
- {
- Uri uri = new Uri(barCode);
- string queryString = uri.Query;
- NameValueCollection col = GetQueryString(queryString);
- string name = col["name"];
- return name;
- }
- else
+
+
+ if (barCode.Contains("name="))
{
- return "";
+ var index = barCode.IndexOf("name=", StringComparison.Ordinal);
+
+ barCode = barCode.Substring(index+5);
+ return barCode.Trim();
}
+ return "";
+
+
+ // if (barCode.Contains("?") && barCode.ToLower().Contains("http"))
+ // {
+ // Uri uri = new Uri(barCode);
+ // string queryString = uri.Query;
+ // NameValueCollection col = GetQueryString(queryString);
+ // string name = col["name"];
+ // return name;
+ // }
+ // else
+ // {
+ // return "";
+ // }
}
diff --git a/TrunksIousOutInStore/LocalSyncBO/TrunksIousOutInStoreRecord.cs b/TrunksIousOutInStore/LocalSyncBO/TrunksIousOutInStoreRecord.cs
index 6fbe572..8b50f03 100644
--- a/TrunksIousOutInStore/LocalSyncBO/TrunksIousOutInStoreRecord.cs
+++ b/TrunksIousOutInStore/LocalSyncBO/TrunksIousOutInStoreRecord.cs
@@ -1,10 +1,12 @@
using System;
using BO.BO;
+using Forks.EnterpriseServices.DomainObjects2;
namespace TrunksIousOutInStore.LocalSyncBO
{
[Serializable]
+ [MapToTable("TrunksIousOutInStoreRecord")]
public class TrunksIousOutInStoreRecord: LocalSyncBase
{
public string BarCode { get; set; }
diff --git a/TrunksIousOutInStore/TrunksIousOutInStore.csproj b/TrunksIousOutInStore/TrunksIousOutInStore.csproj
index 2f96e2c..f7ab903 100644
--- a/TrunksIousOutInStore/TrunksIousOutInStore.csproj
+++ b/TrunksIousOutInStore/TrunksIousOutInStore.csproj
@@ -63,6 +63,7 @@
+
diff --git a/TrunksIousOutInStore/TrunksIousOutInStoreClientGoodsSet.cs b/TrunksIousOutInStore/TrunksIousOutInStoreClientGoodsSet.cs
new file mode 100644
index 0000000..be9f48b
--- /dev/null
+++ b/TrunksIousOutInStore/TrunksIousOutInStoreClientGoodsSet.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using BO.BO.Dtos;
+
+namespace TrunksIousOutInStore
+{
+ public class TrunksIousOutInStoreClientGoodsSet:ClientGoodsSetDto
+ {
+
+ }
+}
diff --git a/TrunksIousOutInStore/TrunksIousOutInStoreForm.Designer.cs b/TrunksIousOutInStore/TrunksIousOutInStoreForm.Designer.cs
index 5a358df..b89958f 100644
--- a/TrunksIousOutInStore/TrunksIousOutInStoreForm.Designer.cs
+++ b/TrunksIousOutInStore/TrunksIousOutInStoreForm.Designer.cs
@@ -29,12 +29,12 @@
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle();
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle();
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = new System.Windows.Forms.DataGridViewCellStyle();
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle16 = new System.Windows.Forms.DataGridViewCellStyle();
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle17 = new System.Windows.Forms.DataGridViewCellStyle();
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle18 = new System.Windows.Forms.DataGridViewCellStyle();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.panel1 = new System.Windows.Forms.Panel();
this.enableWeight = new System.Windows.Forms.CheckBox();
@@ -58,16 +58,16 @@
this.timerChectNetStatus = new System.Windows.Forms.Timer(this.components);
this.timerSyncToService = new System.Windows.Forms.Timer(this.components);
this.timerCheckSyncSucessed = new System.Windows.Forms.Timer(this.components);
- this.uncheck序号 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.uncheck条码 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.uncheck产品名称 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.uncheck数量 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.uncheck重量 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.序号 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.条码 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.产品名称 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.数量 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.重量 = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.uncheck序号 = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.uncheck条码 = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.uncheck产品名称 = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.uncheck数量 = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.uncheck重量 = new System.Windows.Forms.DataGridViewTextBoxColumn();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
@@ -245,6 +245,7 @@
this.btnCreateBill.TabIndex = 0;
this.btnCreateBill.Text = "创建领料";
this.btnCreateBill.UseVisualStyleBackColor = true;
+ this.btnCreateBill.Click += new System.EventHandler(this.btnCreateBill_Click);
//
// btnSubmit
//
@@ -296,17 +297,17 @@
this.gridChecked.AllowUserToDeleteRows = false;
this.gridChecked.AllowUserToResizeColumns = false;
this.gridChecked.AllowUserToResizeRows = false;
- dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
- this.gridChecked.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
+ dataGridViewCellStyle13.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
+ this.gridChecked.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle13;
this.gridChecked.BackgroundColor = System.Drawing.Color.White;
- dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
- dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Control;
- dataGridViewCellStyle2.Font = new System.Drawing.Font("宋体", 12F);
- dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.WindowText;
- dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight;
- dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
- dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
- this.gridChecked.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;
+ dataGridViewCellStyle14.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
+ dataGridViewCellStyle14.BackColor = System.Drawing.SystemColors.Control;
+ dataGridViewCellStyle14.Font = new System.Drawing.Font("宋体", 12F);
+ dataGridViewCellStyle14.ForeColor = System.Drawing.SystemColors.WindowText;
+ dataGridViewCellStyle14.SelectionBackColor = System.Drawing.SystemColors.Highlight;
+ dataGridViewCellStyle14.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
+ dataGridViewCellStyle14.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
+ this.gridChecked.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle14;
this.gridChecked.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.gridChecked.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.序号,
@@ -320,9 +321,9 @@
this.gridChecked.Name = "gridChecked";
this.gridChecked.ReadOnly = true;
this.gridChecked.RowHeadersVisible = false;
- dataGridViewCellStyle3.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- dataGridViewCellStyle3.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
- this.gridChecked.RowsDefaultCellStyle = dataGridViewCellStyle3;
+ dataGridViewCellStyle15.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ dataGridViewCellStyle15.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
+ this.gridChecked.RowsDefaultCellStyle = dataGridViewCellStyle15;
this.gridChecked.RowTemplate.Height = 23;
this.gridChecked.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.gridChecked.Size = new System.Drawing.Size(693, 320);
@@ -346,17 +347,17 @@
this.gridUnCheck.AllowUserToDeleteRows = false;
this.gridUnCheck.AllowUserToResizeColumns = false;
this.gridUnCheck.AllowUserToResizeRows = false;
- dataGridViewCellStyle4.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
- this.gridUnCheck.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle4;
+ dataGridViewCellStyle16.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
+ this.gridUnCheck.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle16;
this.gridUnCheck.BackgroundColor = System.Drawing.Color.White;
- dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
- dataGridViewCellStyle5.BackColor = System.Drawing.SystemColors.Control;
- dataGridViewCellStyle5.Font = new System.Drawing.Font("宋体", 12F);
- dataGridViewCellStyle5.ForeColor = System.Drawing.SystemColors.WindowText;
- dataGridViewCellStyle5.SelectionBackColor = System.Drawing.SystemColors.Highlight;
- dataGridViewCellStyle5.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
- dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
- this.gridUnCheck.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle5;
+ dataGridViewCellStyle17.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
+ dataGridViewCellStyle17.BackColor = System.Drawing.SystemColors.Control;
+ dataGridViewCellStyle17.Font = new System.Drawing.Font("宋体", 12F);
+ dataGridViewCellStyle17.ForeColor = System.Drawing.SystemColors.WindowText;
+ dataGridViewCellStyle17.SelectionBackColor = System.Drawing.SystemColors.Highlight;
+ dataGridViewCellStyle17.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
+ dataGridViewCellStyle17.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
+ this.gridUnCheck.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle17;
this.gridUnCheck.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.gridUnCheck.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.uncheck序号,
@@ -370,9 +371,9 @@
this.gridUnCheck.Name = "gridUnCheck";
this.gridUnCheck.ReadOnly = true;
this.gridUnCheck.RowHeadersVisible = false;
- dataGridViewCellStyle6.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- dataGridViewCellStyle6.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
- this.gridUnCheck.RowsDefaultCellStyle = dataGridViewCellStyle6;
+ dataGridViewCellStyle18.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ dataGridViewCellStyle18.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
+ this.gridUnCheck.RowsDefaultCellStyle = dataGridViewCellStyle18;
this.gridUnCheck.RowTemplate.Height = 23;
this.gridUnCheck.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.gridUnCheck.Size = new System.Drawing.Size(699, 200);
@@ -400,7 +401,6 @@
//
// timerSyncToService
//
- this.timerSyncToService.Enabled = true;
this.timerSyncToService.Interval = 5000;
this.timerSyncToService.Tick += new System.EventHandler(this.timerSyncToService_Tick);
//
@@ -410,43 +410,6 @@
this.timerCheckSyncSucessed.Interval = 4000;
this.timerCheckSyncSucessed.Tick += new System.EventHandler(this.timerCheckSyncSucessed_Tick);
//
- // uncheck序号
- //
- this.uncheck序号.DataPropertyName = "ID";
- this.uncheck序号.HeaderText = "序号";
- this.uncheck序号.Name = "uncheck序号";
- this.uncheck序号.ReadOnly = true;
- //
- // uncheck条码
- //
- this.uncheck条码.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
- this.uncheck条码.DataPropertyName = "BarCode";
- this.uncheck条码.HeaderText = "条码";
- this.uncheck条码.Name = "uncheck条码";
- this.uncheck条码.ReadOnly = true;
- //
- // uncheck产品名称
- //
- this.uncheck产品名称.DataPropertyName = "Goods_Name";
- this.uncheck产品名称.HeaderText = "产品名称";
- this.uncheck产品名称.Name = "uncheck产品名称";
- this.uncheck产品名称.ReadOnly = true;
- this.uncheck产品名称.Width = 120;
- //
- // uncheck数量
- //
- this.uncheck数量.DataPropertyName = "Number";
- this.uncheck数量.HeaderText = "数量";
- this.uncheck数量.Name = "uncheck数量";
- this.uncheck数量.ReadOnly = true;
- //
- // uncheck重量
- //
- this.uncheck重量.DataPropertyName = "Weight";
- this.uncheck重量.HeaderText = "重量";
- this.uncheck重量.Name = "uncheck重量";
- this.uncheck重量.ReadOnly = true;
- //
// 序号
//
this.序号.DataPropertyName = "ID";
@@ -484,6 +447,44 @@
this.重量.Name = "重量";
this.重量.ReadOnly = true;
//
+ // uncheck序号
+ //
+ this.uncheck序号.DataPropertyName = "ID";
+ this.uncheck序号.HeaderText = "序号";
+ this.uncheck序号.Name = "uncheck序号";
+ this.uncheck序号.ReadOnly = true;
+ this.uncheck序号.Visible = false;
+ //
+ // uncheck条码
+ //
+ this.uncheck条码.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
+ this.uncheck条码.DataPropertyName = "BarCode";
+ this.uncheck条码.HeaderText = "条码";
+ this.uncheck条码.Name = "uncheck条码";
+ this.uncheck条码.ReadOnly = true;
+ //
+ // uncheck产品名称
+ //
+ this.uncheck产品名称.DataPropertyName = "Goods_Name";
+ this.uncheck产品名称.HeaderText = "产品名称";
+ this.uncheck产品名称.Name = "uncheck产品名称";
+ this.uncheck产品名称.ReadOnly = true;
+ this.uncheck产品名称.Width = 120;
+ //
+ // uncheck数量
+ //
+ this.uncheck数量.DataPropertyName = "Number";
+ this.uncheck数量.HeaderText = "数量";
+ this.uncheck数量.Name = "uncheck数量";
+ this.uncheck数量.ReadOnly = true;
+ //
+ // uncheck重量
+ //
+ this.uncheck重量.DataPropertyName = "Weight";
+ this.uncheck重量.HeaderText = "重量";
+ this.uncheck重量.Name = "uncheck重量";
+ this.uncheck重量.ReadOnly = true;
+ //
// TrunksIousOutInStoreForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
@@ -499,6 +500,7 @@
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.TrunksIousOutInStoreForm_FormClosing);
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.TrunksIousOutInStoreForm_FormClosed);
this.Load += new System.EventHandler(this.TrunksIousOutInStoreForm_Load);
+ this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.TrunksIousOutInStoreForm_KeyDown);
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
diff --git a/TrunksIousOutInStore/TrunksIousOutInStoreForm.cs b/TrunksIousOutInStore/TrunksIousOutInStoreForm.cs
index 06bdc66..383b401 100644
--- a/TrunksIousOutInStore/TrunksIousOutInStoreForm.cs
+++ b/TrunksIousOutInStore/TrunksIousOutInStoreForm.cs
@@ -5,12 +5,15 @@ using System.Collections.Specialized;
using System.ComponentModel;
using System.Data;
using System.Drawing;
+using System.IO;
using System.IO.Ports;
using System.Linq;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using BO;
+using BO.BarCodeScan;
+using BO.BO.Dtos;
using BO.Utils;
using BO.Utils.BillRpc;
using BWP.WinFormControl.WeightDataFormat;
@@ -22,7 +25,10 @@ namespace TrunksIousOutInStore
public partial class TrunksIousOutInStoreForm : Form, IAfterLogin
{
- BardCodeHooK BarCode = new BardCodeHooK();
+ private readonly string ClientGoodsSetApplyClient = "白条出入库";
+ public const string DATA_PATH = "LocalData/TrunksIousOutInStore";
+
+ // BardCodeHooK BarCode = new BardCodeHooK();
#region weightNeed
SerialPort weightPort;
@@ -51,7 +57,12 @@ namespace TrunksIousOutInStore
// syncToServer.Abort();
};
- BarCode.BarCodeEvent += new BardCodeHooK.BardCodeDeletegate(BarCode_BarCodeEvent);
+ // BarCode.BarCodeEvent += new BardCodeHooK.BardCodeDeletegate(BarCode_BarCodeEvent);
+
+ if (!Directory.Exists(DATA_PATH))
+ {
+ Directory.CreateDirectory(DATA_PATH);
+ }
}
void BarCode_BarCodeEvent(BardCodeHooK.BarCodes barCode)
{
@@ -69,7 +80,13 @@ namespace TrunksIousOutInStore
{
if (barCode.IsValid)
{
- var code = UrlUtil.GetBarCode(barCode.BarCode);
+ // using (var sw=new StreamWriter("d:\\1122.txt",true))
+ // {
+ // sw.Write(barCode.BarCode);
+ // }
+ // MessageBox.Show(barCode.BarCode);
+ // MessageBox.Show(barCode.OriginalBarCode);
+ var code = UrlUtil.GetBarCode(barCode.BarCode.Trim());
var goodsName = UrlUtil.GetGoodsName(barCode.BarCode);
doInsertUnSubmit(code, goodsName, null);
}
@@ -170,7 +187,7 @@ namespace TrunksIousOutInStore
if (str != "0")
{
//AddWeightDetail(decimal.Parse(lblChengZhong.Text));
- doInsertUnSubmit("","", decimal.Parse(lblChengZhong.Text));
+ doInsertUnSubmit("", "", decimal.Parse(lblChengZhong.Text));
}
}));
}
@@ -193,7 +210,7 @@ namespace TrunksIousOutInStore
//lblChengZhong.Text = string.Format(format, num);
if (str != "0")
{
- doInsertUnSubmit("","", decimal.Parse(string.Format(format, num)));
+ doInsertUnSubmit("", "", decimal.Parse(string.Format(format, num)));
//AddWeightDetail(decimal.Parse(string.Format(format, num)));
}
}));
@@ -282,15 +299,21 @@ namespace TrunksIousOutInStore
}
#endregion
-
-
+
+
static object _obj = new object();
- private void doInsertUnSubmit(string barCode,string goodsName, decimal? weight)
+ private void doInsertUnSubmit(string barCode, string goodsName, decimal? weight)
{
lock (_obj)
{
var record = new TrunksIousOutInStoreRecord();
record.Goods_Name = goodsName;
+ var set = GetSelectedClientGoodsSet();
+ if (set != null)
+ {
+ record.Goods_Name = set.Goods_Name;
+ record.Goods_ID = set.Goods_ID;
+ }
record.Number = 1;
record.CarcassStatus = cbxBaiTiaoStatus.Text;
if (!string.IsNullOrWhiteSpace(barCode))
@@ -300,6 +323,7 @@ namespace TrunksIousOutInStore
var fd = unSumbitList.FirstOrDefault(x => string.IsNullOrWhiteSpace(x.BarCode) && x.Weight.HasValue);
if (fd == null)
{
+ // record.ID = unSumbitList.Max(x => x.ID) + 1;
unSumbitList.Add(record);
}
else
@@ -315,6 +339,7 @@ namespace TrunksIousOutInStore
var fd = unSumbitList.FirstOrDefault(x => !string.IsNullOrWhiteSpace(x.BarCode) && x.Weight == null);
if (fd == null)
{
+ // record.ID = unSumbitList.Max(x => x.ID) + 1;
unSumbitList.Add(record);
}
else
@@ -323,8 +348,9 @@ namespace TrunksIousOutInStore
fd.Weight = weight;
}
}
-
- BindUnCheckGrid();
+ gridUnCheck.Refresh();
+ Application.DoEvents();
+ // BindUnCheckGrid();
}
// barCodequeue.Enqueue(barCode);
@@ -341,9 +367,95 @@ namespace TrunksIousOutInStore
return this;
}
+
+
+
+
+ string goodsSetFileName = Path.Combine(DATA_PATH, "TrunksIousOutInStoreClientGoodsSet.xml");
+
+ private List mLocaList;
+
+ void InitLocalList()
+ {
+ if (LoginRpcUtil.TestConnection())
+ {
+ mLocaList = ClientGoodsSetRpc.GetListByApplyClient(ClientGoodsSetApplyClient).Select(x => x.CreateChild()).ToList();
+ XmlUtil.SerializerObjToFile(mLocaList, goodsSetFileName);
+ }
+ else
+ {
+ mLocaList = XmlUtil.DeserializeFromFile>(goodsSetFileName);
+ }
+
+ }
+
private void TrunksIousOutInStoreForm_Load(object sender, EventArgs e)
{
- var enableScanBarCode = BarCode.Start();
+ // BarCode.Start();
+
+ InitLocalList();
+
+ InitGoodsControl();
+
+ GridUnCheckFocus();
+ }
+
+ private void InitGoodsControl()
+ {
+ flpGoods.Controls.Clear();
+ foreach (TrunksIousOutInStoreClientGoodsSet set in mLocaList)
+ {
+ var btn = CreateGoodsSetButton(set);
+ flpGoods.Controls.Add(btn);
+ }
+ }
+
+ private Button CreateGoodsSetButton(TrunksIousOutInStoreClientGoodsSet set)
+ {
+ var btn = new Button();
+ btn.Text = set.Goods_Name;
+ btn.Tag = set;
+ btn.Width = 100;
+ btn.Height = 60;
+ btn.Click += BtnSet_Click;
+ return btn;
+ }
+
+ private void BtnSet_Click(object sender, EventArgs e)
+ {
+ var btn = sender as Button;
+ foreach (Button button in flpGoods.Controls)
+ {
+ if (button.Text == btn.Text)
+ {
+ if (button.BackColor == Color.Aqua)
+ {
+ button.BackColor = SystemColors.Control;
+ }
+ else
+ {
+ button.BackColor = Color.Aqua;
+ }
+ }
+ else
+ {
+ button.BackColor = SystemColors.Control;
+ }
+ }
+ gridUnCheck.Focus();
+ Application.DoEvents();
+ }
+
+ TrunksIousOutInStoreClientGoodsSet GetSelectedClientGoodsSet()
+ {
+ foreach (Button button in flpGoods.Controls)
+ {
+ if (button.BackColor == Color.Aqua)
+ {
+ return button.Tag as TrunksIousOutInStoreClientGoodsSet;
+ }
+ }
+ return null;
}
private void TrunksIousOutInStoreForm_FormClosing(object sender, FormClosingEventArgs e)
@@ -406,12 +518,18 @@ namespace TrunksIousOutInStore
if (f.ShowDialog() == DialogResult.OK)
{
enableWeight_Click(sender, e);
+ GridUnCheckFocus();
}
}
+ void GridUnCheckFocus()
+ {
+ gridUnCheck.Focus();
+ }
+
private void TrunksIousOutInStoreForm_FormClosed(object sender, FormClosedEventArgs e)
{
- BarCode.Stop();
+ // BarCode.Stop();
}
@@ -475,5 +593,58 @@ namespace TrunksIousOutInStore
timerCheckSyncSucessed.Start();
}
#endregion
+
+ private void btnCreateBill_Click(object sender, EventArgs e)
+ {
+ GridUnCheckFocus();
+ }
+
+ BwpBarCodes barCodes = new BwpBarCodes();
+ private void TrunksIousOutInStoreForm_KeyDown(object sender, KeyEventArgs e)
+ {
+
+ TimeSpan ts = DateTime.Now.Subtract(barCodes.Time);
+
+ char keyvalue = (char) e.KeyValue;
+ var str = keyvalue.ToString();
+ if (e.Shift)
+ {
+ if (e.KeyValue == 16)
+ {
+ str = ":";
+ }
+ }
+ barCodes.StringBuilder.Append(str);
+
+ if (ts.TotalMilliseconds < 50)
+ {
+ if (e.KeyData == Keys.Enter && barCodes.BarCode.Length > 0)
+ {
+ //回车
+ barCodes.IsValid = true;
+ barCodes.StringBuilder.Remove(barCodes.StringBuilder.Length - 1, 1);
+ }
+ }
+ try
+ {
+ if (barCodes.IsValid)
+ {
+
+
+ MessageBox.Show(barCodes.BarCode);
+ barCodes.StringBuilder = new StringBuilder();
+ }
+ }
+ catch
+ {
+ }
+ finally
+ {
+
+ barCodes.IsValid = false; //最后一定要 设置barCode无效
+ barCodes.Time = DateTime.Now;
+ }
+
+ }
}
}