diff --git a/B3ButcherManageClient.sln b/B3ButcherManageClient.sln index 13e4fb2..db2de42 100644 --- a/B3ButcherManageClient.sln +++ b/B3ButcherManageClient.sln @@ -29,6 +29,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TrunksIousOutInStore", "Tru EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SegmentationWeight", "SegmentationWeight\SegmentationWeight.csproj", "{F06032A9-BC6C-4123-947B-EF078FAB7A74}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SegmentationInStore", "SegmentationInStore\SegmentationInStore.csproj", "{7528B945-C2CC-4266-83BD-D2214140C4BD}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -85,6 +87,10 @@ Global {F06032A9-BC6C-4123-947B-EF078FAB7A74}.Debug|Any CPU.Build.0 = Debug|Any CPU {F06032A9-BC6C-4123-947B-EF078FAB7A74}.Release|Any CPU.ActiveCfg = Release|Any CPU {F06032A9-BC6C-4123-947B-EF078FAB7A74}.Release|Any CPU.Build.0 = Release|Any CPU + {7528B945-C2CC-4266-83BD-D2214140C4BD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7528B945-C2CC-4266-83BD-D2214140C4BD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7528B945-C2CC-4266-83BD-D2214140C4BD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7528B945-C2CC-4266-83BD-D2214140C4BD}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/BO/BO.csproj b/BO/BO.csproj index 99d5b5d..61c4c69 100644 --- a/BO/BO.csproj +++ b/BO/BO.csproj @@ -57,6 +57,7 @@ + diff --git a/BO/BardCodeHook.cs b/BO/BardCodeHook.cs new file mode 100644 index 0000000..c90b723 --- /dev/null +++ b/BO/BardCodeHook.cs @@ -0,0 +1,242 @@ +using System; +using System.Diagnostics; +using System.Reflection; +using System.Runtime.InteropServices; +using System.Text; + +namespace BO +{ + /// + /// 获取键盘输入或者USB扫描枪数据 可以是没有焦点 应为使用的是全局钩子 + /// USB扫描枪 是模拟键盘按下 + /// 这里主要处理扫描枪的值,手动输入的值不太好处理 + /// + public class BardCodeHooK + { + public delegate void BardCodeDeletegate(BarCodes barCode); + public event BardCodeDeletegate BarCodeEvent; + + //定义成静态,这样不会抛出回收异常 + private static HookProc hookproc; + + + public struct BarCodes + { + public int VirtKey;//虚拟吗 + public int ScanCode;//扫描码 + public string KeyName;//键名 + public uint Ascll;//Ascll + public char Chr;//字符 + + + public string OriginalChrs; //原始 字符 + public string OriginalAsciis;//原始 ASCII + + + public string OriginalBarCode; //原始数据条码 + + + public bool IsValid;//条码是否有效 + public DateTime Time;//扫描时间, + + + public string BarCode;//条码信息 保存最终的条码 + } + + + private struct EventMsg + { + public int message; + public int paramL; + public int paramH; + public int Time; + public int hwnd; + } + + + [DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)] + private static extern int SetWindowsHookEx(int idHook, HookProc lpfn, IntPtr hInstance, int threadId); + + + [DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)] + private static extern bool UnhookWindowsHookEx(int idHook); + + + [DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)] + private static extern int CallNextHookEx(int idHook, int nCode, Int32 wParam, IntPtr lParam); + + + [DllImport("user32", EntryPoint = "GetKeyNameText")] + private static extern int GetKeyNameText(int IParam, StringBuilder lpBuffer, int nSize); + + + [DllImport("user32", EntryPoint = "GetKeyboardState")] + private static extern int GetKeyboardState(byte[] pbKeyState); + + + [DllImport("user32", EntryPoint = "ToAscii")] + private static extern bool ToAscii(int VirtualKey, int ScanCode, byte[] lpKeySate, ref uint lpChar, int uFlags); + + + [DllImport("kernel32.dll")] + public static extern IntPtr GetModuleHandle(string name); + + + + + delegate int HookProc(int nCode, Int32 wParam, IntPtr lParam); + BarCodes barCode = new BarCodes(); + int hKeyboardHook = 0; + // string strBarCode = ""; + StringBuilder sbBarCode = new StringBuilder(); + + + + + + + + private int KeyboardHookProc(int nCode, Int32 wParam, IntPtr lParam) + { + int i_calledNext = -10; + if (nCode == 0) + { + EventMsg msg = (EventMsg)Marshal.PtrToStructure(lParam, typeof(EventMsg)); + if (wParam == 0x100)//WM_KEYDOWN=0x100 + { + barCode.VirtKey = msg.message & 0xff;//虚拟吗 + barCode.ScanCode = msg.paramL & 0xff;//扫描码 + StringBuilder strKeyName = new StringBuilder(225); + if (GetKeyNameText(barCode.ScanCode * 65536, strKeyName, 255) > 0) + { + barCode.KeyName = strKeyName.ToString().Trim(new char[] { ' ', '\0' }); + } + else + { + barCode.KeyName = ""; + } + byte[] kbArray = new byte[256]; + uint uKey = 0; + GetKeyboardState(kbArray); + + + // if (barCode.KeyName.Equals("A") || barCode.KeyName.Equals("a")) + // { + if (ToAscii(barCode.VirtKey, barCode.ScanCode, kbArray, ref uKey, 0)) + { + barCode.Ascll = uKey; + barCode.Chr = Convert.ToChar(uKey); + barCode.OriginalChrs += " " + Convert.ToString(barCode.Chr); + barCode.OriginalAsciis += " " + Convert.ToString(barCode.Ascll); + barCode.OriginalBarCode += Convert.ToString(barCode.Chr); + } + // } + + + TimeSpan ts = DateTime.Now.Subtract(barCode.Time); + + + if (ts.TotalMilliseconds > 50) + {//时间戳,大于50 毫秒表示手动输入 + + sbBarCode.Remove(0, sbBarCode.Length); + sbBarCode.Append(barCode.Chr.ToString()); + + barCode.OriginalChrs = " " + Convert.ToString(barCode.Chr); + barCode.OriginalAsciis = " " + Convert.ToString(barCode.Ascll); + + + barCode.OriginalBarCode = Convert.ToString(barCode.Chr); + + } + else + { + if ((msg.message & 0xff) == 13 && sbBarCode.Length > 3) + { + //回车 + barCode.BarCode = barCode.OriginalBarCode.Replace("\r","").Replace("\t",""); + barCode.IsValid = true; + sbBarCode.Remove(0, sbBarCode.Length); + } + sbBarCode.Append(barCode.Chr.ToString()); + + } + + try + { + if (BarCodeEvent != null && barCode.IsValid) + { + + //barCode.BarCode = barCode.BarCode.Replace("\b", "").Replace("\0",""); 可以不需要 因为大于50毫秒已经处理 + //先进行 WINDOWS事件往下传 + i_calledNext = CallNextHookEx(hKeyboardHook, nCode, wParam, lParam); + + + + + BarCodeEvent(barCode);//触发事件 + + barCode.BarCode = ""; + + + barCode.OriginalChrs = ""; + barCode.OriginalAsciis = ""; + barCode.OriginalBarCode = ""; + + } + + } + catch { } + finally + { + barCode.IsValid = false; //最后一定要 设置barCode无效 + barCode.Time = DateTime.Now; + } + } + } + if (i_calledNext == -10) + { + i_calledNext = CallNextHookEx(hKeyboardHook, nCode, wParam, lParam); + } + return i_calledNext; + } + + + //安装钩子 + public bool Start() + { + if (hKeyboardHook == 0) + { + hookproc = new HookProc(KeyboardHookProc); + + //GetModuleHandle 函数 替代 Marshal.GetHINSTANCE + //防止在 framework4.0中 注册钩子不成功 + var moduleName1 = Process.GetCurrentProcess().MainModule.ModuleName; + var moduleName = Assembly.GetExecutingAssembly().ManifestModule.Name; + IntPtr modulePtr = GetModuleHandle(moduleName1); + + + //WH_KEYBOARD_LL=13 + //全局钩子 WH_KEYBOARD_LL +// hKeyboardHook = SetWindowsHookEx(13, hookproc, Marshal.GetHINSTANCE(Assembly.GetExecutingAssembly().GetModules()[0]), 0); + + + hKeyboardHook = SetWindowsHookEx(13, hookproc, modulePtr, 0); + } + return (hKeyboardHook != 0); + } + + + //卸载钩子 + public bool Stop() + { + if (hKeyboardHook != 0) + { + return UnhookWindowsHookEx(hKeyboardHook); + } + return true; + } + + + } +} diff --git a/SegmentationInStore/Properties/AssemblyInfo.cs b/SegmentationInStore/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..97539e2 --- /dev/null +++ b/SegmentationInStore/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// 有关程序集的一般信息由以下 +// 控制。更改这些特性值可修改 +// 与程序集关联的信息。 +[assembly: AssemblyTitle("SegmentationInStore")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("SegmentationInStore")] +[assembly: AssemblyCopyright("Copyright © 2017")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +//将 ComVisible 设置为 false 将使此程序集中的类型 +//对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, +//请将此类型的 ComVisible 特性设置为 true。 +[assembly: ComVisible(false)] + +// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID +[assembly: Guid("7528b945-c2cc-4266-83bd-d2214140c4bd")] + +// 程序集的版本信息由下列四个值组成: +// +// 主版本 +// 次版本 +// 生成号 +// 修订号 +// +//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, +// 方法是按如下所示使用“*”: : +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/SegmentationInStore/Rpc/Dto/SegmentationInStoreDto.cs b/SegmentationInStore/Rpc/Dto/SegmentationInStoreDto.cs new file mode 100644 index 0000000..0582de2 --- /dev/null +++ b/SegmentationInStore/Rpc/Dto/SegmentationInStoreDto.cs @@ -0,0 +1,19 @@ +using System; + +namespace SegmentationInStore.Rpc.Dto +{ + public class SegmentationInStoreDto + { + public long ID { get; set; } + public string BarCode { get; set; } + public long Goods_ID { get; set; } + public string Goods_Name { get; set; } + public string Goods_Spec { get; set; } + public decimal Weight { get; set; } + public DateTime CreateTime { get; set; } + public long? Store_ID { get; set; } + public string Store_Name { get; set; } + + + } +} diff --git a/SegmentationInStore/Rpc/Dto/SegmentationWeightRecord.cs b/SegmentationInStore/Rpc/Dto/SegmentationWeightRecord.cs new file mode 100644 index 0000000..394a8d3 --- /dev/null +++ b/SegmentationInStore/Rpc/Dto/SegmentationWeightRecord.cs @@ -0,0 +1,20 @@ +namespace SegmentationInStore.Rpc.Dto +{ + public class SegmentationWeightRecord + { + public long ID { get; set; } + + public string BarCode { get; set; }//条码 + + public long Goods_ID { get; set; } + public string Goods_Name { get; set; } + public string Goods_Spec { get; set; } + + public decimal PiWeight { get; set; }//皮重 + public decimal MaoWeight { get; set; }//毛重 + public decimal JingWeight { get; set; }//净重 + public string CardBarCode{ get; set; }//放产品的车的条码 + public string BiaoShi { get; set; }//用来记录那个工作台或者哪台触摸屏做的 + + } +} diff --git a/SegmentationInStore/Rpc/Ext.cs b/SegmentationInStore/Rpc/Ext.cs new file mode 100644 index 0000000..cec4cf0 --- /dev/null +++ b/SegmentationInStore/Rpc/Ext.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using SegmentationInStore.Rpc.Dto; + +namespace SegmentationInStore.Rpc +{ + public static class Ext + { + public static SegmentationInStoreDto EToSegmentationInStore(this SegmentationWeightRecord record) + { + var instore=new SegmentationInStoreDto(); + instore.BarCode = record.BarCode; + instore.Goods_ID = record.Goods_ID; + instore.Goods_Name = record.Goods_Name; + instore.Goods_Spec = record.Goods_Spec; + instore.Weight = record.JingWeight; + return instore; + } + } +} diff --git a/SegmentationInStore/Rpc/SegmentationInStoreRpc.cs b/SegmentationInStore/Rpc/SegmentationInStoreRpc.cs new file mode 100644 index 0000000..8c746f0 --- /dev/null +++ b/SegmentationInStore/Rpc/SegmentationInStoreRpc.cs @@ -0,0 +1,40 @@ +using System.Collections.Generic; +using Forks.JsonRpc.Client; +using Newtonsoft.Json; +using SegmentationInStore.Rpc.Dto; + +namespace SegmentationInStore.Rpc +{ + public class SegmentationInStoreRpc + { + /// + /// 获取所有未扫码的 + /// + /// + public static List GetNotInStoreList() + { + var json = RpcFacade.Call("/MainSystem/B3ClientService/Rpcs/BillRpc/SegmentationWeightRecordRpc/GetNotInStoreList"); + var list= JsonConvert.DeserializeObject>(json); + return list; + } + + /// + /// 获取所有未扫码的 + /// + /// + public static List GetNotInStoreListByMaxId(long id) + { + var json = RpcFacade.Call("/MainSystem/B3ClientService/Rpcs/BillRpc/SegmentationWeightRecordRpc/GetNotInStoreListByMaxId",id); + var list= JsonConvert.DeserializeObject>(json); + return list; + } + /// + /// 添加入库记录 + /// + public static long Insert(SegmentationInStoreDto instore) + { + var json = JsonConvert.SerializeObject(instore); + return RpcFacade.Call("/MainSystem/B3ClientService/Rpcs/BillRpc/SegmentationInStoreRecordRpc/Insert", json); + } + } +} diff --git a/SegmentationInStore/SegmentationInStore.csproj b/SegmentationInStore/SegmentationInStore.csproj new file mode 100644 index 0000000..150d153 --- /dev/null +++ b/SegmentationInStore/SegmentationInStore.csproj @@ -0,0 +1,89 @@ + + + + + Debug + AnyCPU + {7528B945-C2CC-4266-83BD-D2214140C4BD} + Library + Properties + SegmentationInStore + SegmentationInStore + v4.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + False + ..\..\..\tsref\Debug\Newtonsoft.Json.dll + + + + + + + + + + + + + + + + + + + + + + + + Form + + + SegmentationInStoreForm.cs + + + + + SegmentationInStoreForm.cs + + + + + {8968f14a-c7c7-4751-96ce-b114fbfd65ef} + BO + + + {A782B23E-BE6D-4F51-B5CB-5CD259BA97CC} + BWP.WinFormControl + + + + + \ No newline at end of file diff --git a/SegmentationInStore/SegmentationInStoreForm.Designer.cs b/SegmentationInStore/SegmentationInStoreForm.Designer.cs new file mode 100644 index 0000000..4dbb2c7 --- /dev/null +++ b/SegmentationInStore/SegmentationInStoreForm.Designer.cs @@ -0,0 +1,524 @@ +namespace SegmentationInStore +{ + partial class SegmentationInStoreForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + 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 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 dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); + this.splitContainer1 = new System.Windows.Forms.SplitContainer(); + this.splitContainer2 = new System.Windows.Forms.SplitContainer(); + this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.gridUnSubmit = new BWP.WinFormControl.UDataGridView(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.gridUnScan = new BWP.WinFormControl.UDataGridView(); + this.groupBox4 = new System.Windows.Forms.GroupBox(); + this.groupBox3 = new System.Windows.Forms.GroupBox(); + this.gridSubmited = new BWP.WinFormControl.UDataGridView(); + this.button1 = new System.Windows.Forms.Button(); + this.uComboBox1 = new BWP.WinFormControl.UComboBox(); + this.label1 = new System.Windows.Forms.Label(); + this.timerSyncUnScan = new System.Windows.Forms.Timer(this.components); + this.timerUpload = new System.Windows.Forms.Timer(this.components); + this.submited序号 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.submited条码 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.submited产品 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.submited重量 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.submited仓库 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.submited日期 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.unscan序号 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.unscan条码 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.unscan产品 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.unscan重量 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.unscan日期 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.unsubmit条码 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.unsubmit产品 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.unsubmit重量 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.unsubmit仓库 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); + this.splitContainer1.Panel2.SuspendLayout(); + this.splitContainer1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit(); + this.splitContainer2.Panel1.SuspendLayout(); + this.splitContainer2.Panel2.SuspendLayout(); + this.splitContainer2.SuspendLayout(); + this.groupBox2.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.gridUnSubmit)).BeginInit(); + this.groupBox1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.gridUnScan)).BeginInit(); + this.groupBox3.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.gridSubmited)).BeginInit(); + this.SuspendLayout(); + // + // splitContainer1 + // + this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; + this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1; + this.splitContainer1.Location = new System.Drawing.Point(0, 0); + this.splitContainer1.Name = "splitContainer1"; + this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal; + // + // splitContainer1.Panel2 + // + this.splitContainer1.Panel2.Controls.Add(this.splitContainer2); + this.splitContainer1.Size = new System.Drawing.Size(1031, 558); + this.splitContainer1.SplitterDistance = 25; + this.splitContainer1.TabIndex = 0; + // + // splitContainer2 + // + this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill; + this.splitContainer2.Location = new System.Drawing.Point(0, 0); + this.splitContainer2.Name = "splitContainer2"; + // + // splitContainer2.Panel1 + // + this.splitContainer2.Panel1.Controls.Add(this.groupBox2); + this.splitContainer2.Panel1.Controls.Add(this.groupBox1); + // + // splitContainer2.Panel2 + // + this.splitContainer2.Panel2.Controls.Add(this.groupBox4); + this.splitContainer2.Panel2.Controls.Add(this.groupBox3); + this.splitContainer2.Panel2.Controls.Add(this.button1); + this.splitContainer2.Panel2.Controls.Add(this.uComboBox1); + this.splitContainer2.Panel2.Controls.Add(this.label1); + this.splitContainer2.Size = new System.Drawing.Size(1031, 529); + this.splitContainer2.SplitterDistance = 467; + this.splitContainer2.TabIndex = 0; + // + // groupBox2 + // + this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBox2.Controls.Add(this.gridUnSubmit); + this.groupBox2.Location = new System.Drawing.Point(4, 313); + this.groupBox2.Name = "groupBox2"; + this.groupBox2.Size = new System.Drawing.Size(460, 213); + this.groupBox2.TabIndex = 1; + this.groupBox2.TabStop = false; + this.groupBox2.Text = "等待提交产品"; + // + // gridUnSubmit + // + this.gridUnSubmit.AllowUserToAddRows = false; + this.gridUnSubmit.AllowUserToDeleteRows = false; + this.gridUnSubmit.AllowUserToResizeColumns = false; + this.gridUnSubmit.AllowUserToResizeRows = false; + dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); + this.gridUnSubmit.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1; + this.gridUnSubmit.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.gridUnSubmit.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2; + this.gridUnSubmit.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.gridUnSubmit.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.unsubmit条码, + this.unsubmit产品, + this.unsubmit重量, + this.unsubmit仓库}); + this.gridUnSubmit.Dock = System.Windows.Forms.DockStyle.Fill; + this.gridUnSubmit.Location = new System.Drawing.Point(3, 17); + this.gridUnSubmit.MultiSelect = false; + this.gridUnSubmit.Name = "gridUnSubmit"; + this.gridUnSubmit.ReadOnly = true; + this.gridUnSubmit.RowHeadersVisible = false; + dataGridViewCellStyle4.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle4.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218))))); + this.gridUnSubmit.RowsDefaultCellStyle = dataGridViewCellStyle4; + this.gridUnSubmit.RowTemplate.Height = 23; + this.gridUnSubmit.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; + this.gridUnSubmit.Size = new System.Drawing.Size(454, 193); + this.gridUnSubmit.TabIndex = 1; + // + // groupBox1 + // + this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBox1.Controls.Add(this.gridUnScan); + this.groupBox1.Location = new System.Drawing.Point(4, 4); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(460, 302); + this.groupBox1.TabIndex = 0; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "未扫码产品"; + // + // gridUnScan + // + this.gridUnScan.AllowUserToAddRows = false; + this.gridUnScan.AllowUserToDeleteRows = false; + this.gridUnScan.AllowUserToResizeColumns = false; + this.gridUnScan.AllowUserToResizeRows = false; + dataGridViewCellStyle5.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); + this.gridUnScan.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle5; + this.gridUnScan.BackgroundColor = System.Drawing.Color.White; + dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle6.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle6.Font = new System.Drawing.Font("宋体", 12F); + dataGridViewCellStyle6.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle6.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle6.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.gridUnScan.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle6; + this.gridUnScan.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.gridUnScan.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.unscan序号, + this.unscan条码, + this.unscan产品, + this.unscan重量, + this.unscan日期}); + this.gridUnScan.Dock = System.Windows.Forms.DockStyle.Fill; + this.gridUnScan.Location = new System.Drawing.Point(3, 17); + this.gridUnScan.MultiSelect = false; + this.gridUnScan.Name = "gridUnScan"; + this.gridUnScan.ReadOnly = true; + this.gridUnScan.RowHeadersVisible = false; + dataGridViewCellStyle9.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle9.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218))))); + this.gridUnScan.RowsDefaultCellStyle = dataGridViewCellStyle9; + this.gridUnScan.RowTemplate.Height = 23; + this.gridUnScan.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; + this.gridUnScan.Size = new System.Drawing.Size(454, 282); + this.gridUnScan.TabIndex = 0; + // + // groupBox4 + // + this.groupBox4.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBox4.Location = new System.Drawing.Point(4, 324); + this.groupBox4.Name = "groupBox4"; + this.groupBox4.Size = new System.Drawing.Size(553, 205); + this.groupBox4.TabIndex = 4; + this.groupBox4.TabStop = false; + this.groupBox4.Text = "最近异常记录"; + // + // groupBox3 + // + this.groupBox3.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBox3.Controls.Add(this.gridSubmited); + this.groupBox3.Location = new System.Drawing.Point(4, 47); + this.groupBox3.Name = "groupBox3"; + this.groupBox3.Size = new System.Drawing.Size(553, 259); + this.groupBox3.TabIndex = 3; + this.groupBox3.TabStop = false; + this.groupBox3.Text = "已提交产品"; + // + // gridSubmited + // + this.gridSubmited.AllowUserToAddRows = false; + this.gridSubmited.AllowUserToDeleteRows = false; + this.gridSubmited.AllowUserToResizeColumns = false; + this.gridSubmited.AllowUserToResizeRows = false; + dataGridViewCellStyle10.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); + this.gridSubmited.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle10; + this.gridSubmited.BackgroundColor = System.Drawing.Color.White; + dataGridViewCellStyle11.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle11.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle11.Font = new System.Drawing.Font("宋体", 12F); + dataGridViewCellStyle11.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle11.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle11.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle11.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.gridSubmited.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle11; + this.gridSubmited.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.gridSubmited.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.submited序号, + this.submited条码, + this.submited产品, + this.submited重量, + this.submited仓库, + this.submited日期}); + this.gridSubmited.Dock = System.Windows.Forms.DockStyle.Fill; + this.gridSubmited.Location = new System.Drawing.Point(3, 17); + this.gridSubmited.MultiSelect = false; + this.gridSubmited.Name = "gridSubmited"; + this.gridSubmited.ReadOnly = true; + this.gridSubmited.RowHeadersVisible = false; + dataGridViewCellStyle14.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle14.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218))))); + this.gridSubmited.RowsDefaultCellStyle = dataGridViewCellStyle14; + this.gridSubmited.RowTemplate.Height = 23; + this.gridSubmited.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; + this.gridSubmited.Size = new System.Drawing.Size(547, 239); + this.gridSubmited.TabIndex = 1; + // + // button1 + // + this.button1.Location = new System.Drawing.Point(262, 14); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(89, 23); + this.button1.TabIndex = 2; + this.button1.Text = "同步数据"; + this.button1.UseVisualStyleBackColor = true; + // + // uComboBox1 + // + this.uComboBox1.CodeArgs = null; + this.uComboBox1.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed; + this.uComboBox1.EnableTopItem = true; + this.uComboBox1.FormattingEnabled = true; + this.uComboBox1.Location = new System.Drawing.Point(97, 14); + this.uComboBox1.Name = "uComboBox1"; + this.uComboBox1.Range = 10; + this.uComboBox1.Size = new System.Drawing.Size(140, 22); + this.uComboBox1.TabIndex = 1; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(26, 19); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(65, 12); + this.label1.TabIndex = 0; + this.label1.Text = "入库仓库:"; + // + // timerSyncUnScan + // + this.timerSyncUnScan.Enabled = true; + this.timerSyncUnScan.Interval = 1000; + this.timerSyncUnScan.Tick += new System.EventHandler(this.timerSyncUnScan_Tick); + // + // timerUpload + // + this.timerUpload.Enabled = true; + this.timerUpload.Interval = 1000; + this.timerUpload.Tick += new System.EventHandler(this.timerUpload_Tick); + // + // submited序号 + // + this.submited序号.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells; + this.submited序号.DataPropertyName = "ID"; + this.submited序号.HeaderText = "序号"; + this.submited序号.Name = "submited序号"; + this.submited序号.ReadOnly = true; + this.submited序号.Width = 65; + // + // submited条码 + // + this.submited条码.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells; + this.submited条码.DataPropertyName = "BarCode"; + this.submited条码.HeaderText = "条码"; + this.submited条码.Name = "submited条码"; + this.submited条码.ReadOnly = true; + this.submited条码.Width = 65; + // + // submited产品 + // + this.submited产品.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.submited产品.DataPropertyName = "Goods_Name"; + this.submited产品.HeaderText = "产品"; + this.submited产品.Name = "submited产品"; + this.submited产品.ReadOnly = true; + // + // submited重量 + // + this.submited重量.DataPropertyName = "Weight"; + dataGridViewCellStyle12.Format = "N2"; + dataGridViewCellStyle12.NullValue = null; + this.submited重量.DefaultCellStyle = dataGridViewCellStyle12; + this.submited重量.HeaderText = "重量"; + this.submited重量.Name = "submited重量"; + this.submited重量.ReadOnly = true; + // + // submited仓库 + // + this.submited仓库.DataPropertyName = "Store_Name"; + this.submited仓库.HeaderText = "仓库"; + this.submited仓库.Name = "submited仓库"; + this.submited仓库.ReadOnly = true; + // + // submited日期 + // + this.submited日期.DataPropertyName = "CreateTime"; + dataGridViewCellStyle13.Format = "F"; + dataGridViewCellStyle13.NullValue = null; + this.submited日期.DefaultCellStyle = dataGridViewCellStyle13; + this.submited日期.HeaderText = "日期"; + this.submited日期.Name = "submited日期"; + this.submited日期.ReadOnly = true; + // + // unscan序号 + // + this.unscan序号.DataPropertyName = "ID"; + this.unscan序号.HeaderText = "序号"; + this.unscan序号.Name = "unscan序号"; + this.unscan序号.ReadOnly = true; + // + // unscan条码 + // + this.unscan条码.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.unscan条码.DataPropertyName = "BarCode"; + this.unscan条码.HeaderText = "条码"; + this.unscan条码.Name = "unscan条码"; + this.unscan条码.ReadOnly = true; + // + // unscan产品 + // + this.unscan产品.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells; + this.unscan产品.DataPropertyName = "Goods_Name"; + this.unscan产品.HeaderText = "产品"; + this.unscan产品.Name = "unscan产品"; + this.unscan产品.ReadOnly = true; + this.unscan产品.Width = 65; + // + // unscan重量 + // + this.unscan重量.DataPropertyName = "JingWeight"; + dataGridViewCellStyle7.Format = "N2"; + this.unscan重量.DefaultCellStyle = dataGridViewCellStyle7; + this.unscan重量.HeaderText = "重量"; + this.unscan重量.Name = "unscan重量"; + this.unscan重量.ReadOnly = true; + // + // unscan日期 + // + this.unscan日期.DataPropertyName = "CreateTime"; + dataGridViewCellStyle8.Format = "F"; + dataGridViewCellStyle8.NullValue = null; + this.unscan日期.DefaultCellStyle = dataGridViewCellStyle8; + this.unscan日期.HeaderText = "日期"; + this.unscan日期.Name = "unscan日期"; + this.unscan日期.ReadOnly = true; + // + // unsubmit条码 + // + this.unsubmit条码.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells; + this.unsubmit条码.DataPropertyName = "BarCode"; + this.unsubmit条码.HeaderText = "条码"; + this.unsubmit条码.Name = "unsubmit条码"; + this.unsubmit条码.ReadOnly = true; + this.unsubmit条码.Width = 65; + // + // unsubmit产品 + // + this.unsubmit产品.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.unsubmit产品.DataPropertyName = "Goods_Name"; + this.unsubmit产品.HeaderText = "产品"; + this.unsubmit产品.Name = "unsubmit产品"; + this.unsubmit产品.ReadOnly = true; + // + // unsubmit重量 + // + this.unsubmit重量.DataPropertyName = "Weight"; + dataGridViewCellStyle3.Format = "N2"; + this.unsubmit重量.DefaultCellStyle = dataGridViewCellStyle3; + this.unsubmit重量.HeaderText = "重量"; + this.unsubmit重量.Name = "unsubmit重量"; + this.unsubmit重量.ReadOnly = true; + // + // unsubmit仓库 + // + this.unsubmit仓库.DataPropertyName = "Store_Name"; + this.unsubmit仓库.HeaderText = "仓库"; + this.unsubmit仓库.Name = "unsubmit仓库"; + this.unsubmit仓库.ReadOnly = true; + // + // SegmentationInStoreForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(1031, 558); + this.Controls.Add(this.splitContainer1); + this.MinimizeBox = false; + this.Name = "SegmentationInStoreForm"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "分割品入库"; + this.WindowState = System.Windows.Forms.FormWindowState.Maximized; + this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.SegmentationInStoreForm_FormClosed); + this.Load += new System.EventHandler(this.SegmentationInStoreForm_Load); + this.splitContainer1.Panel2.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); + this.splitContainer1.ResumeLayout(false); + this.splitContainer2.Panel1.ResumeLayout(false); + this.splitContainer2.Panel2.ResumeLayout(false); + this.splitContainer2.Panel2.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit(); + this.splitContainer2.ResumeLayout(false); + this.groupBox2.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.gridUnSubmit)).EndInit(); + this.groupBox1.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.gridUnScan)).EndInit(); + this.groupBox3.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.gridSubmited)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.SplitContainer splitContainer1; + private System.Windows.Forms.SplitContainer splitContainer2; + private System.Windows.Forms.GroupBox groupBox2; + private System.Windows.Forms.GroupBox groupBox1; + private BWP.WinFormControl.UComboBox uComboBox1; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.GroupBox groupBox3; + private System.Windows.Forms.GroupBox groupBox4; + private System.Windows.Forms.Timer timerSyncUnScan; + private BWP.WinFormControl.UDataGridView gridUnSubmit; + private BWP.WinFormControl.UDataGridView gridUnScan; + private BWP.WinFormControl.UDataGridView gridSubmited; + private System.Windows.Forms.Timer timerUpload; + private System.Windows.Forms.DataGridViewTextBoxColumn unsubmit条码; + private System.Windows.Forms.DataGridViewTextBoxColumn unsubmit产品; + private System.Windows.Forms.DataGridViewTextBoxColumn unsubmit重量; + private System.Windows.Forms.DataGridViewTextBoxColumn unsubmit仓库; + private System.Windows.Forms.DataGridViewTextBoxColumn unscan序号; + private System.Windows.Forms.DataGridViewTextBoxColumn unscan条码; + private System.Windows.Forms.DataGridViewTextBoxColumn unscan产品; + private System.Windows.Forms.DataGridViewTextBoxColumn unscan重量; + private System.Windows.Forms.DataGridViewTextBoxColumn unscan日期; + private System.Windows.Forms.DataGridViewTextBoxColumn submited序号; + private System.Windows.Forms.DataGridViewTextBoxColumn submited条码; + private System.Windows.Forms.DataGridViewTextBoxColumn submited产品; + private System.Windows.Forms.DataGridViewTextBoxColumn submited重量; + private System.Windows.Forms.DataGridViewTextBoxColumn submited仓库; + private System.Windows.Forms.DataGridViewTextBoxColumn submited日期; + } +} \ No newline at end of file diff --git a/SegmentationInStore/SegmentationInStoreForm.cs b/SegmentationInStore/SegmentationInStoreForm.cs new file mode 100644 index 0000000..cbc97bf --- /dev/null +++ b/SegmentationInStore/SegmentationInStoreForm.cs @@ -0,0 +1,168 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Windows.Forms; +using BO; +using BO.Utils; +using SegmentationInStore.Rpc; +using SegmentationInStore.Rpc.Dto; + +namespace SegmentationInStore +{ + public partial class SegmentationInStoreForm : Form,IAfterLogin + { + private static readonly Object lockOjbUnScan = new object(); + private static readonly Object lockOjbUnSubmit = new object(); + private static readonly Object lockOjbSubmited = new object(); + + private BindingList mUnScanList; + private BindingList mUnSubmitList; + private BindingList mSubmitedList; + + + BardCodeHooK BarCode = new BardCodeHooK(); + public SegmentationInStoreForm() + { + InitializeComponent(); + gridUnScan.AutoGenerateColumns = false; + gridUnSubmit.AutoGenerateColumns = false; + gridSubmited.AutoGenerateColumns = false; + mUnScanList=new BindingList(); + mUnSubmitList = new BindingList(); + mSubmitedList = new BindingList(); + BarCode.BarCodeEvent += new BardCodeHooK.BardCodeDeletegate(BarCode_BarCodeEvent); + } + + void BarCode_BarCodeEvent(BardCodeHooK.BarCodes barCode) + { + ShowInfo(barCode); + } + private delegate void ShowInfoDelegate(BardCodeHooK.BarCodes barCode); + + private void ShowInfo(BardCodeHooK.BarCodes barCode) + { + if (this.InvokeRequired) + { + this.BeginInvoke(new ShowInfoDelegate(ShowInfo), new object[] { barCode }); + } + else + { + if (barCode.IsValid) + { + if (!string.IsNullOrWhiteSpace(barCode.BarCode)) + { + doInsertUnSubmit(barCode.BarCode); + } + } + } + } + + private void doInsertUnSubmit(string barCode) + { + var fd = mUnScanList.FirstOrDefault(x => x.BarCode == barCode); + if (fd == null) + { + //todo 放到错误信息里 + } + mUnScanList.Remove(fd); + var inStoreDto = fd.EToSegmentationInStore(); + inStoreDto.Store_ID = 0; + inStoreDto.Store_Name = "仓库"; + mUnSubmitList.Insert(0, inStoreDto); + BindUnSubmitGrid(); + } + + void BindUnScanGrid() + { + lock (lockOjbUnScan) + { + gridUnScan.DataSource = mUnScanList; + } + } + void BindUnSubmitGrid() + { + lock (lockOjbUnSubmit) + { + gridUnSubmit.DataSource = mUnSubmitList; + } + } + void BindSubmitedGrid() + { + lock (lockOjbSubmited) + { + gridSubmited.DataSource = mSubmitedList; + } + } + + + + private void SegmentationInStoreForm_Load(object sender, EventArgs e) + { + var enable=BarCode.Start(); + if (!enable) + { + MessageBox.Show("注册扫码失败,联系管理员"); + } + } + + //同步未扫码 + private void timerSyncUnScan_Tick(object sender, EventArgs e) + { + if (mUnScanList.Count < 1) + { + var list = SegmentationInStoreRpc.GetNotInStoreList(); + foreach (SegmentationWeightRecord record in list) + { + mUnScanList.Insert(0,record); + } + } + else + { + var maxid = mUnScanList.Max(x => x.ID); + var list = SegmentationInStoreRpc.GetNotInStoreListByMaxId(maxid); + foreach (SegmentationWeightRecord record in list) + { + mUnScanList.Insert(0,record); + } + } + BindUnScanGrid(); + } + + //扫到的 未提交的提交 + private void timerUpload_Tick(object sender, EventArgs e) + { + var unSubmitList = mUnSubmitList.ToList(); + for (int i = unSubmitList.Count-1; i >=0 ; i--) + { + try + { + var dto = unSubmitList[i]; + dto.CreateTime = DateTime.Now; + dto.ID=SegmentationInStoreRpc.Insert(dto); + mSubmitedList.Insert(0,dto); + mUnSubmitList.Remove(dto); + } + catch (Exception ex) + { + //todo 记录异常 + } + } + //把成功的从未提交记录中移除 + BindUnSubmitGrid(); + BindSubmitedGrid(); + + } + + public string RoleName { get { return "分割入库"; } } + public Form Generate() + { + return this; + } + + private void SegmentationInStoreForm_FormClosed(object sender, FormClosedEventArgs e) + { + BarCode.Stop(); + } + } +} diff --git a/SegmentationInStore/SegmentationInStoreForm.resx b/SegmentationInStore/SegmentationInStoreForm.resx new file mode 100644 index 0000000..a630f3d --- /dev/null +++ b/SegmentationInStore/SegmentationInStoreForm.resx @@ -0,0 +1,171 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + 17, 17 + + + 159, 18 + + \ No newline at end of file diff --git a/SegmentationWeight/Rpc/Dto/SegmentationWeightRecord.cs b/SegmentationWeight/Rpc/Dto/SegmentationWeightRecord.cs index 302971d..65b549a 100644 --- a/SegmentationWeight/Rpc/Dto/SegmentationWeightRecord.cs +++ b/SegmentationWeight/Rpc/Dto/SegmentationWeightRecord.cs @@ -14,6 +14,7 @@ namespace SegmentationWeight.Rpc.Dto public long Goods_ID { get; set; } public string Goods_Name { get; set; } + public string Goods_Spec { get; set; } public decimal PiWeight { get; set; }//皮重 public decimal MaoWeight { get; set; }//毛重 diff --git a/SegmentationWeight/SegmentationWeightForm.Designer.cs b/SegmentationWeight/SegmentationWeightForm.Designer.cs index b885c00..83dcdfe 100644 --- a/SegmentationWeight/SegmentationWeightForm.Designer.cs +++ b/SegmentationWeight/SegmentationWeightForm.Designer.cs @@ -28,9 +28,9 @@ /// private void InitializeComponent() { - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle(); + 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(); this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.panel1 = new System.Windows.Forms.Panel(); this.btnGoodsSet = new System.Windows.Forms.Button(); @@ -41,6 +41,12 @@ this.splitContainer2 = new System.Windows.Forms.SplitContainer(); this.flpGoods = new System.Windows.Forms.FlowLayoutPanel(); this.flpClass = new System.Windows.Forms.FlowLayoutPanel(); + this.uDataGridView1 = new BWP.WinFormControl.UDataGridView(); + 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.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.label1 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); @@ -48,12 +54,6 @@ this.lblGoodsName = new System.Windows.Forms.Label(); this.lblNumber = new System.Windows.Forms.Label(); this.lblWeight = new System.Windows.Forms.Label(); - this.uDataGridView1 = new BWP.WinFormControl.UDataGridView(); - 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(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); @@ -64,8 +64,8 @@ this.splitContainer2.Panel1.SuspendLayout(); this.splitContainer2.Panel2.SuspendLayout(); this.splitContainer2.SuspendLayout(); - this.tableLayoutPanel1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.uDataGridView1)).BeginInit(); + this.tableLayoutPanel1.SuspendLayout(); this.SuspendLayout(); // // splitContainer1 @@ -173,7 +173,7 @@ this.splitContainer2.Panel2.Controls.Add(this.uDataGridView1); this.splitContainer2.Panel2.Controls.Add(this.tableLayoutPanel1); this.splitContainer2.Size = new System.Drawing.Size(1041, 447); - this.splitContainer2.SplitterDistance = 550; + this.splitContainer2.SplitterDistance = 553; this.splitContainer2.SplitterWidth = 1; this.splitContainer2.TabIndex = 0; // @@ -192,9 +192,89 @@ | System.Windows.Forms.AnchorStyles.Right))); this.flpClass.Location = new System.Drawing.Point(4, 4); this.flpClass.Name = "flpClass"; - this.flpClass.Size = new System.Drawing.Size(541, 76); + this.flpClass.Size = new System.Drawing.Size(544, 76); this.flpClass.TabIndex = 0; // + // uDataGridView1 + // + this.uDataGridView1.AllowUserToAddRows = false; + this.uDataGridView1.AllowUserToDeleteRows = false; + this.uDataGridView1.AllowUserToResizeColumns = false; + this.uDataGridView1.AllowUserToResizeRows = false; + dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); + this.uDataGridView1.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1; + this.uDataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.uDataGridView1.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.uDataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2; + this.uDataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.uDataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.序号, + this.条码, + this.产品, + this.净重, + this.毛重}); + this.uDataGridView1.Location = new System.Drawing.Point(3, 108); + this.uDataGridView1.MultiSelect = false; + this.uDataGridView1.Name = "uDataGridView1"; + this.uDataGridView1.ReadOnly = true; + this.uDataGridView1.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.uDataGridView1.RowsDefaultCellStyle = dataGridViewCellStyle3; + this.uDataGridView1.RowTemplate.Height = 23; + this.uDataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; + this.uDataGridView1.Size = new System.Drawing.Size(483, 334); + this.uDataGridView1.TabIndex = 1; + // + // 序号 + // + this.序号.DataPropertyName = "ID"; + this.序号.HeaderText = "序号"; + this.序号.Name = "序号"; + this.序号.ReadOnly = true; + this.序号.Width = 80; + // + // 条码 + // + this.条码.DataPropertyName = "BarCode"; + this.条码.HeaderText = "条码"; + this.条码.Name = "条码"; + this.条码.ReadOnly = true; + // + // 产品 + // + this.产品.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.产品.DataPropertyName = "Goods_Name"; + this.产品.HeaderText = "产品"; + this.产品.MinimumWidth = 100; + this.产品.Name = "产品"; + this.产品.ReadOnly = true; + // + // 净重 + // + this.净重.DataPropertyName = "JingWeight"; + this.净重.HeaderText = "净重"; + this.净重.Name = "净重"; + this.净重.ReadOnly = true; + this.净重.Width = 80; + // + // 毛重 + // + this.毛重.DataPropertyName = "MaoWeight"; + this.毛重.HeaderText = "毛重"; + this.毛重.Name = "毛重"; + this.毛重.ReadOnly = true; + this.毛重.Width = 80; + // // tableLayoutPanel1 // this.tableLayoutPanel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) @@ -203,7 +283,7 @@ this.tableLayoutPanel1.ColumnCount = 3; this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 65.90909F)); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 34.09091F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 84F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 86F)); this.tableLayoutPanel1.Controls.Add(this.label1, 0, 0); this.tableLayoutPanel1.Controls.Add(this.label2, 1, 0); this.tableLayoutPanel1.Controls.Add(this.label3, 2, 0); @@ -225,7 +305,7 @@ | System.Windows.Forms.AnchorStyles.Right))); this.label1.Location = new System.Drawing.Point(4, 1); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(256, 50); + this.label1.Size = new System.Drawing.Size(254, 50); this.label1.TabIndex = 0; this.label1.Text = "产品"; this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; @@ -235,7 +315,7 @@ this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.label2.Location = new System.Drawing.Point(267, 1); + this.label2.Location = new System.Drawing.Point(265, 1); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(129, 50); this.label2.TabIndex = 0; @@ -247,9 +327,9 @@ this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.label3.Location = new System.Drawing.Point(403, 1); + this.label3.Location = new System.Drawing.Point(401, 1); this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(79, 50); + this.label3.Size = new System.Drawing.Size(81, 50); this.label3.TabIndex = 0; this.label3.Text = "重量"; this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; @@ -261,7 +341,7 @@ | System.Windows.Forms.AnchorStyles.Right))); this.lblGoodsName.Location = new System.Drawing.Point(4, 52); this.lblGoodsName.Name = "lblGoodsName"; - this.lblGoodsName.Size = new System.Drawing.Size(256, 45); + this.lblGoodsName.Size = new System.Drawing.Size(254, 45); this.lblGoodsName.TabIndex = 0; this.lblGoodsName.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // @@ -270,7 +350,7 @@ this.lblNumber.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.lblNumber.Location = new System.Drawing.Point(267, 52); + this.lblNumber.Location = new System.Drawing.Point(265, 52); this.lblNumber.Name = "lblNumber"; this.lblNumber.Size = new System.Drawing.Size(129, 45); this.lblNumber.TabIndex = 0; @@ -281,99 +361,18 @@ this.lblWeight.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.lblWeight.Location = new System.Drawing.Point(403, 52); + this.lblWeight.Location = new System.Drawing.Point(401, 52); this.lblWeight.Name = "lblWeight"; - this.lblWeight.Size = new System.Drawing.Size(79, 45); + this.lblWeight.Size = new System.Drawing.Size(81, 45); this.lblWeight.TabIndex = 0; this.lblWeight.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // - // uDataGridView1 - // - this.uDataGridView1.AllowUserToAddRows = false; - this.uDataGridView1.AllowUserToDeleteRows = false; - this.uDataGridView1.AllowUserToResizeColumns = false; - this.uDataGridView1.AllowUserToResizeRows = false; - dataGridViewCellStyle7.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); - this.uDataGridView1.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle7; - this.uDataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.uDataGridView1.BackgroundColor = System.Drawing.Color.White; - dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle8.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle8.Font = new System.Drawing.Font("宋体", 12F); - dataGridViewCellStyle8.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle8.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle8.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle8.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.uDataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle8; - this.uDataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.uDataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { - this.序号, - this.条码, - this.产品, - this.净重, - this.毛重}); - this.uDataGridView1.Location = new System.Drawing.Point(3, 108); - this.uDataGridView1.MultiSelect = false; - this.uDataGridView1.Name = "uDataGridView1"; - this.uDataGridView1.ReadOnly = true; - this.uDataGridView1.RowHeadersVisible = false; - dataGridViewCellStyle9.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle9.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218))))); - this.uDataGridView1.RowsDefaultCellStyle = dataGridViewCellStyle9; - this.uDataGridView1.RowTemplate.Height = 23; - this.uDataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; - this.uDataGridView1.Size = new System.Drawing.Size(483, 334); - this.uDataGridView1.TabIndex = 1; - // - // 序号 - // - this.序号.DataPropertyName = "ID"; - this.序号.HeaderText = "序号"; - this.序号.Name = "序号"; - this.序号.ReadOnly = true; - this.序号.Width = 80; - // - // 条码 - // - this.条码.DataPropertyName = "BarCode"; - this.条码.HeaderText = "条码"; - this.条码.Name = "条码"; - this.条码.ReadOnly = true; - // - // 产品 - // - this.产品.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - this.产品.DataPropertyName = "Goods_Name"; - this.产品.HeaderText = "产品"; - this.产品.MinimumWidth = 100; - this.产品.Name = "产品"; - this.产品.ReadOnly = true; - // - // 净重 - // - this.净重.DataPropertyName = "JingWeight"; - this.净重.HeaderText = "净重"; - this.净重.Name = "净重"; - this.净重.ReadOnly = true; - this.净重.Width = 80; - // - // 毛重 - // - this.毛重.DataPropertyName = "MaoWeight"; - this.毛重.HeaderText = "毛重"; - this.毛重.Name = "毛重"; - this.毛重.ReadOnly = true; - this.毛重.Width = 80; - // // SegmentationWeightForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(1041, 547); this.Controls.Add(this.splitContainer1); - this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "SegmentationWeightForm"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; @@ -392,8 +391,8 @@ this.splitContainer2.Panel2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit(); this.splitContainer2.ResumeLayout(false); - this.tableLayoutPanel1.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.uDataGridView1)).EndInit(); + this.tableLayoutPanel1.ResumeLayout(false); this.ResumeLayout(false); } diff --git a/SegmentationWeight/SegmentationWeightForm.cs b/SegmentationWeight/SegmentationWeightForm.cs index 825e99d..063253f 100644 --- a/SegmentationWeight/SegmentationWeightForm.cs +++ b/SegmentationWeight/SegmentationWeightForm.cs @@ -357,6 +357,7 @@ namespace SegmentationWeight record.Goods_ID = set.Goods_ID; record.BarCode = "";//todo 条码规则 record.Goods_Name = set.Goods_Name; + record.Goods_Spec = set.Goods_Spec; record.BiaoShi = "";//todo 标识 record.MaoWeight = maoWeight; record.PiWeight = 10; diff --git a/TrunksIousOutInStore/TrunksIousOutInStoreForm.Designer.cs b/TrunksIousOutInStore/TrunksIousOutInStoreForm.Designer.cs index 188525a..dbbc747 100644 --- a/TrunksIousOutInStore/TrunksIousOutInStoreForm.Designer.cs +++ b/TrunksIousOutInStore/TrunksIousOutInStoreForm.Designer.cs @@ -28,7 +28,6 @@ /// 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(); @@ -37,6 +36,9 @@ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = 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(); + this.panel2 = new System.Windows.Forms.Panel(); + this.lblChengZhong = new System.Windows.Forms.Label(); this.btnWeightSet = new System.Windows.Forms.Button(); this.splitContainer2 = new System.Windows.Forms.SplitContainer(); this.uComboBox1 = new BWP.WinFormControl.UComboBox(); @@ -61,15 +63,13 @@ this.uncheck规格 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.uncheck数量 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.uncheck重量 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.timer1 = new System.Windows.Forms.Timer(this.components); - this.enableWeight = new System.Windows.Forms.CheckBox(); - this.panel2 = new System.Windows.Forms.Panel(); - this.lblChengZhong = new System.Windows.Forms.Label(); + this.timer1 = new System.Windows.Forms.Timer(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); this.splitContainer1.SuspendLayout(); this.panel1.SuspendLayout(); + this.panel2.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit(); this.splitContainer2.Panel1.SuspendLayout(); this.splitContainer2.Panel2.SuspendLayout(); @@ -81,7 +81,6 @@ ((System.ComponentModel.ISupportInitialize)(this.gridChecked)).BeginInit(); this.groupBox1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.gridUnCheck)).BeginInit(); - this.panel2.SuspendLayout(); this.SuspendLayout(); // // splitContainer1 @@ -117,6 +116,39 @@ this.panel1.Size = new System.Drawing.Size(1251, 100); this.panel1.TabIndex = 1; // + // enableWeight + // + this.enableWeight.AutoCheck = false; + this.enableWeight.AutoSize = true; + this.enableWeight.Font = new System.Drawing.Font("宋体", 18F); + this.enableWeight.Location = new System.Drawing.Point(249, 8); + this.enableWeight.Name = "enableWeight"; + this.enableWeight.Size = new System.Drawing.Size(125, 28); + this.enableWeight.TabIndex = 33; + this.enableWeight.Text = "启用称重"; + this.enableWeight.UseVisualStyleBackColor = true; + this.enableWeight.Click += new System.EventHandler(this.enableWeight_Click); + // + // panel2 + // + this.panel2.BackColor = System.Drawing.Color.Black; + this.panel2.Controls.Add(this.lblChengZhong); + this.panel2.Location = new System.Drawing.Point(3, 8); + this.panel2.Name = "panel2"; + this.panel2.Size = new System.Drawing.Size(237, 78); + this.panel2.TabIndex = 32; + // + // lblChengZhong + // + this.lblChengZhong.AutoSize = true; + this.lblChengZhong.Font = new System.Drawing.Font("宋体", 30F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.lblChengZhong.ForeColor = System.Drawing.Color.Red; + this.lblChengZhong.Location = new System.Drawing.Point(15, 18); + this.lblChengZhong.Name = "lblChengZhong"; + this.lblChengZhong.Size = new System.Drawing.Size(97, 40); + this.lblChengZhong.TabIndex = 0; + this.lblChengZhong.Text = "0.00"; + // // btnWeightSet // this.btnWeightSet.Font = new System.Drawing.Font("宋体", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); @@ -417,39 +449,6 @@ this.timer1.Interval = 1000; this.timer1.Tick += new System.EventHandler(this.timer1_Tick); // - // enableWeight - // - this.enableWeight.AutoCheck = false; - this.enableWeight.AutoSize = true; - this.enableWeight.Font = new System.Drawing.Font("宋体", 18F); - this.enableWeight.Location = new System.Drawing.Point(249, 8); - this.enableWeight.Name = "enableWeight"; - this.enableWeight.Size = new System.Drawing.Size(125, 28); - this.enableWeight.TabIndex = 33; - this.enableWeight.Text = "启用称重"; - this.enableWeight.UseVisualStyleBackColor = true; - this.enableWeight.Click += new System.EventHandler(this.enableWeight_Click); - // - // panel2 - // - this.panel2.BackColor = System.Drawing.Color.Black; - this.panel2.Controls.Add(this.lblChengZhong); - this.panel2.Location = new System.Drawing.Point(3, 8); - this.panel2.Name = "panel2"; - this.panel2.Size = new System.Drawing.Size(237, 78); - this.panel2.TabIndex = 32; - // - // lblChengZhong - // - this.lblChengZhong.AutoSize = true; - this.lblChengZhong.Font = new System.Drawing.Font("宋体", 30F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.lblChengZhong.ForeColor = System.Drawing.Color.Red; - this.lblChengZhong.Location = new System.Drawing.Point(15, 18); - this.lblChengZhong.Name = "lblChengZhong"; - this.lblChengZhong.Size = new System.Drawing.Size(97, 40); - this.lblChengZhong.TabIndex = 0; - this.lblChengZhong.Text = "0.00"; - // // TrunksIousOutInStoreForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); @@ -457,14 +456,15 @@ this.ClientSize = new System.Drawing.Size(1276, 741); this.Controls.Add(this.splitContainer1); this.KeyPreview = true; - this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "TrunksIousOutInStoreForm"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "胴体白条出入库"; this.WindowState = System.Windows.Forms.FormWindowState.Maximized; 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.KeyUp += new System.Windows.Forms.KeyEventHandler(this.TrunksIousOutInStoreForm_KeyUp); this.splitContainer1.Panel1.ResumeLayout(false); this.splitContainer1.Panel2.ResumeLayout(false); @@ -472,6 +472,8 @@ this.splitContainer1.ResumeLayout(false); this.panel1.ResumeLayout(false); this.panel1.PerformLayout(); + this.panel2.ResumeLayout(false); + this.panel2.PerformLayout(); this.splitContainer2.Panel1.ResumeLayout(false); this.splitContainer2.Panel1.PerformLayout(); this.splitContainer2.Panel2.ResumeLayout(false); @@ -484,8 +486,6 @@ ((System.ComponentModel.ISupportInitialize)(this.gridChecked)).EndInit(); this.groupBox1.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.gridUnCheck)).EndInit(); - this.panel2.ResumeLayout(false); - this.panel2.PerformLayout(); this.ResumeLayout(false); } diff --git a/TrunksIousOutInStore/TrunksIousOutInStoreForm.cs b/TrunksIousOutInStore/TrunksIousOutInStoreForm.cs index 073297b..cfd8391 100644 --- a/TrunksIousOutInStore/TrunksIousOutInStoreForm.cs +++ b/TrunksIousOutInStore/TrunksIousOutInStoreForm.cs @@ -9,6 +9,7 @@ using System.Linq; using System.Text; using System.Threading; using System.Windows.Forms; +using BO; using BO.Utils; using BO.Utils.BillRpc; using BWP.WinFormControl.WeightDataFormat; @@ -19,7 +20,7 @@ namespace TrunksIousOutInStore public partial class TrunksIousOutInStoreForm : Form, IAfterLogin { - + BardCodeHooK BarCode = new BardCodeHooK(); #region weightNeed SerialPort weightPort; @@ -33,6 +34,7 @@ namespace TrunksIousOutInStore public TrunksIousOutInStoreForm() { InitializeComponent(); + gridUnCheck.AutoGenerateColumns = false; gridChecked.AutoGenerateColumns = false; @@ -47,6 +49,27 @@ namespace TrunksIousOutInStore // syncToServer.Abort(); }; + BarCode.BarCodeEvent += new BardCodeHooK.BardCodeDeletegate(BarCode_BarCodeEvent); + } + void BarCode_BarCodeEvent(BardCodeHooK.BarCodes barCode) + { + ShowInfo(barCode); + } + private delegate void ShowInfoDelegate(BardCodeHooK.BarCodes barCode); + + private void ShowInfo(BardCodeHooK.BarCodes barCode) + { + if (this.InvokeRequired) + { + this.BeginInvoke(new ShowInfoDelegate(ShowInfo), new object[] { barCode }); + } + else + { + if (barCode.IsValid) + { + doInsertUnSubmit(barCode.BarCode, null); + } + } } #region weightNeed @@ -261,23 +284,23 @@ namespace TrunksIousOutInStore private void TrunksIousOutInStoreForm_KeyUp(object sender, KeyEventArgs e) { - switch (e.KeyData) - { - case Keys.Enter: - barCode = ""; - break; - - default: - barCode += (char)e.KeyValue; - barCode = barCode.Replace("\r", "").Replace("\t", ""); - if (barCode.Length == 4) - { - - doInsertUnSubmit(barCode, null); - barCode = ""; - } - break; - } +// switch (e.KeyData) +// { +// case Keys.Enter: +// barCode = ""; +// break; +// +// default: +// barCode += (char)e.KeyValue; +// barCode = barCode.Replace("\r", "").Replace("\t", ""); +// if (barCode.Length == 4) +// { +// +// doInsertUnSubmit(barCode, null); +// barCode = ""; +// } +// break; +// } } @@ -343,7 +366,7 @@ namespace TrunksIousOutInStore private void TrunksIousOutInStoreForm_Load(object sender, EventArgs e) { - + var enableScanBarCode = BarCode.Start(); } private void TrunksIousOutInStoreForm_FormClosing(object sender, FormClosingEventArgs e) @@ -407,5 +430,15 @@ namespace TrunksIousOutInStore enableWeight_Click(sender, e); } } + + private void TrunksIousOutInStoreForm_FormClosed(object sender, FormClosedEventArgs e) + { + BarCode.Stop(); + } + + private void TrunksIousOutInStoreForm_KeyDown(object sender, KeyEventArgs e) + { + gridUnCheck.Focus(); + } } }