From 2916569258b314171605daee4c999c13a6010d05 Mon Sep 17 00:00:00 2001
From: wugang <1029149336@qq.com>
Date: Mon, 11 Dec 2017 15:51:45 +0800
Subject: [PATCH] =?UTF-8?q?=E5=88=86=E5=89=B2=E5=AE=8C=E5=96=84?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
BO/LocalDmoSession.cs | 3 +-
.../ButcherManageClient.csproj | 12 +
ButcherManageClient/SettingForm.Designer.cs | 14 +
ButcherManageClient/SettingForm.cs | 60 ++++
SegmentationWeight/DropDownSets.cs | 40 +++
SegmentationWeight/ProductTask.cs | 16 ++
.../Rpc/Dto/SegmentationWeightRecord.cs | 30 +-
.../Rpc/Dto/SegmentationWeightRecordDto.cs | 20 ++
.../Rpc/SegmentationWeightRecordRpc.cs | 70 ++++-
SegmentationWeight/SegmentationWeight.csproj | 14 +
.../SegmentationWeightForm.Designer.cs | 270 +++++++++++-------
SegmentationWeight/SegmentationWeightForm.cs | 197 ++++++++++---
.../SegmentationWeightForm.resx | 5 +-
.../LocalSyncBO/TrunksIousOutInStoreRecord.cs | 10 +-
14 files changed, 589 insertions(+), 172 deletions(-)
create mode 100644 SegmentationWeight/DropDownSets.cs
create mode 100644 SegmentationWeight/ProductTask.cs
create mode 100644 SegmentationWeight/Rpc/Dto/SegmentationWeightRecordDto.cs
diff --git a/BO/LocalDmoSession.cs b/BO/LocalDmoSession.cs
index 2aa1cba..abbafff 100644
--- a/BO/LocalDmoSession.cs
+++ b/BO/LocalDmoSession.cs
@@ -43,7 +43,7 @@ namespace BO
///
///
///
- public static void Insert(T detail) where T : LocalSyncBase
+ public static long Insert(T detail) where T : LocalSyncBase
{
using (var session = LocalDmoSession.New())
{
@@ -52,6 +52,7 @@ namespace BO
session.Insert(detail);
session.Commit();
}
+ return detail.ID;
}
///
diff --git a/ButcherManageClient/ButcherManageClient.csproj b/ButcherManageClient/ButcherManageClient.csproj
index 7f39604..b0ee4ff 100644
--- a/ButcherManageClient/ButcherManageClient.csproj
+++ b/ButcherManageClient/ButcherManageClient.csproj
@@ -39,10 +39,18 @@
False
bin\Debug\AutoMapper.dll
+
+ False
+ ..\..\..\tsref\Debug\Forks.EnterpriseServices.dll
+
False
..\..\..\..\BwpB3Project\tsref\Debug\Forks.JsonRpc.Client.dll
+
+ False
+ ..\..\..\tsref\Debug\Forks.Utils.dll
+
@@ -110,6 +118,10 @@
{a782b23e-be6d-4f51-b5cb-5cd259ba97cc}
BWP.WinFormControl
+
+ {f06032a9-bc6c-4123-947b-ef078fab7a74}
+ SegmentationWeight
+
diff --git a/ButcherManageClient/SettingForm.Designer.cs b/ButcherManageClient/SettingForm.Designer.cs
index 6d419df..77a1ad6 100644
--- a/ButcherManageClient/SettingForm.Designer.cs
+++ b/ButcherManageClient/SettingForm.Designer.cs
@@ -36,6 +36,7 @@
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.txtOutAddress = new System.Windows.Forms.TextBox();
+ this.btnUpdate = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// cancelBtn
@@ -116,6 +117,17 @@
this.txtOutAddress.Size = new System.Drawing.Size(363, 26);
this.txtOutAddress.TabIndex = 10;
//
+ // btnUpdate
+ //
+ this.btnUpdate.Font = new System.Drawing.Font("宋体", 20F);
+ this.btnUpdate.Location = new System.Drawing.Point(390, 245);
+ this.btnUpdate.Name = "btnUpdate";
+ this.btnUpdate.Size = new System.Drawing.Size(81, 53);
+ this.btnUpdate.TabIndex = 6;
+ this.btnUpdate.Text = "升级";
+ this.btnUpdate.UseVisualStyleBackColor = true;
+ this.btnUpdate.Click += new System.EventHandler(this.btnUpdate_Click);
+ //
// SettingForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
@@ -127,6 +139,7 @@
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.cancelBtn);
+ this.Controls.Add(this.btnUpdate);
this.Controls.Add(this.saveBtn);
this.Controls.Add(this.uTextBoxWithPad1);
this.Controls.Add(this.label1);
@@ -148,5 +161,6 @@
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox txtOutAddress;
+ private System.Windows.Forms.Button btnUpdate;
}
}
\ No newline at end of file
diff --git a/ButcherManageClient/SettingForm.cs b/ButcherManageClient/SettingForm.cs
index 294d0c3..6f7b1bc 100644
--- a/ButcherManageClient/SettingForm.cs
+++ b/ButcherManageClient/SettingForm.cs
@@ -3,12 +3,18 @@ using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
+using System.IO;
using System.Linq;
+using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using BO.Utils;
+using Forks.EnterpriseServices.DomainObjects2;
using Forks.JsonRpc.Client;
+using Forks.Utils;
+using Forks.Utils.Data;
+using TSingSoft.WebPluginFramework;
namespace ButcherManageClient
{
@@ -45,5 +51,59 @@ namespace ButcherManageClient
RpcFacade.ReInit(ButcherAppContext.Context.UrlConfig.ServerUrl);
MessageBox.Show("设置保存成功!");
}
+
+ private void btnUpdate_Click(object sender, EventArgs e)
+ {
+ using (ISqlUtil sqlUtil = new SqlUtil(offlineSqlConInput.Text.Trim()))
+ {
+ var boTypes = GetTypes();
+ Dmo.UpdateTables(sqlUtil, boTypes);
+ }
+ MessageBox.Show("升级成功");
+ }
+
+ List NeedUpdateDbDll()
+ {
+ var list=new List();
+ list.Add("SegmentationWeight.dll");
+ list.Add("TrunksIousOutInStore.dll");
+ return list;
+ }
+
+ private IEnumerable GetTypes()
+ {
+ var startuppath = Application.StartupPath;
+ DirectoryInfo fdir = new DirectoryInfo(startuppath);
+ var needList = NeedUpdateDbDll();
+ foreach (FileInfo file in fdir.GetFiles("*.dll"))
+ {
+ if (!needList.Contains(file.Name))
+ {
+ continue;
+ }
+ var asm = Assembly.LoadFile(file.FullName);
+ foreach (var t in asm.GetExportedTypes())
+ {
+ if (t.IsAbstract)
+ {
+ continue;
+ }
+ if (t.IsClass && IsMapTable(t))
+ {
+ yield return t;
+ }
+ }
+ }
+ }
+
+ public static bool IsMapTable(Type t)
+ {
+ var attr = ReflectionUtil.GetAttribute(t);
+ if (attr == null)
+ {
+ return false;
+ }
+ return true;
+ }
}
}
diff --git a/SegmentationWeight/DropDownSets.cs b/SegmentationWeight/DropDownSets.cs
new file mode 100644
index 0000000..490d849
--- /dev/null
+++ b/SegmentationWeight/DropDownSets.cs
@@ -0,0 +1,40 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SegmentationWeight
+{
+ public class DropDownSets
+ {
+ public static readonly string 车间 = "车间";
+ public static readonly string 单元 = "单元";
+ public static readonly string 批次 = "批次";
+ public DropDownSets()
+ {
+ Details=new List();
+ }
+
+ public List Details { get; set; }
+ }
+
+ public class DropDownSet
+ {
+ public DropDownSet()
+ {
+ Details=new List();
+ }
+
+ public string Name { get; set; }
+ public List Details { get; set; }
+ }
+
+ public class DropDownSet_Detail
+ {
+ public long ID { get; set; }
+ public string Name { get; set; }
+ public string Code { get; set; }
+
+ }
+}
diff --git a/SegmentationWeight/ProductTask.cs b/SegmentationWeight/ProductTask.cs
new file mode 100644
index 0000000..d740dc4
--- /dev/null
+++ b/SegmentationWeight/ProductTask.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SegmentationWeight
+{
+ public class ProductTask
+ {
+ public long Goods_ID { get; set; }
+ public string Goods_Name { get; set; }
+ public decimal Number { get; set; }
+ public decimal SecondNumber { get; set; }
+ }
+}
diff --git a/SegmentationWeight/Rpc/Dto/SegmentationWeightRecord.cs b/SegmentationWeight/Rpc/Dto/SegmentationWeightRecord.cs
index 65b549a..623d5c9 100644
--- a/SegmentationWeight/Rpc/Dto/SegmentationWeightRecord.cs
+++ b/SegmentationWeight/Rpc/Dto/SegmentationWeightRecord.cs
@@ -3,24 +3,34 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using AutoMapper;
+using BO.BO;
+using Forks.EnterpriseServices.DomainObjects2;
+using Newtonsoft.Json;
namespace SegmentationWeight.Rpc.Dto
{
- public class SegmentationWeightRecord
+ [Serializable]
+ [MapToTable("SegmentationWeightRecord")]
+ public class SegmentationWeightRecord: LocalSyncBase
{
- 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 decimal Weight { get; set; }//皮重
public string CardBarCode{ get; set; }//放产品的车的条码
- public string BiaoShi { get; set; }//用来记录那个工作台或者哪台触摸屏做的
-
+ public string BiaoShi { get; set; }
+ public override string GetDtoJson()
+ {
+ var config = new MapperConfiguration(cfg => {
+ cfg.CreateMap();
+ });
+ var mapper = config.CreateMapper();
+ var dto = mapper.Map(this);
+ dto.Client_ID = this.ID;
+ return JsonConvert.SerializeObject(dto);
+ }
+
}
}
diff --git a/SegmentationWeight/Rpc/Dto/SegmentationWeightRecordDto.cs b/SegmentationWeight/Rpc/Dto/SegmentationWeightRecordDto.cs
new file mode 100644
index 0000000..758ede8
--- /dev/null
+++ b/SegmentationWeight/Rpc/Dto/SegmentationWeightRecordDto.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using BO.BO.Dtos;
+
+namespace SegmentationWeight.Rpc.Dto
+{
+ public class SegmentationWeightRecordDto: SyncBaseDto
+ {
+ 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 string CardBarCode { get; set; }//放产品的车的条码
+ public string BiaoShi { get; set; }
+ }
+}
diff --git a/SegmentationWeight/Rpc/SegmentationWeightRecordRpc.cs b/SegmentationWeight/Rpc/SegmentationWeightRecordRpc.cs
index 97a88ed..1e2e5ba 100644
--- a/SegmentationWeight/Rpc/SegmentationWeightRecordRpc.cs
+++ b/SegmentationWeight/Rpc/SegmentationWeightRecordRpc.cs
@@ -3,19 +3,79 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using BO;
+using BO.BO.Bill;
+using Forks.EnterpriseServices.DomainObjects2;
+using Forks.EnterpriseServices.DomainObjects2.DQuery;
using Forks.JsonRpc.Client;
using Newtonsoft.Json;
using SegmentationWeight.Rpc.Dto;
namespace SegmentationWeight.Rpc
{
- public class SegmentationWeightRecordRpc
+ public class SegmentationWeightRecordRpc : SyncToServerBase
{
- public static long Insert(SegmentationWeightRecord record)
+ // 定义一个静态变量来保存类的实例
+ private static SegmentationWeightRecordRpc uniqueInstance;
+
+ // 定义一个标识确保线程同步
+ private static readonly object locker = new object();
+
+ // 定义私有构造函数,使外界不能创建该类实例
+ private SegmentationWeightRecordRpc()
+ {
+ }
+
+ ///
+ /// 定义公有方法提供一个全局访问点,同时你也可以定义公有属性来提供全局访问点
+ ///
+ ///
+ public static SegmentationWeightRecordRpc GetInstance()
+ {
+ // 当第一个线程运行到这里时,此时会对locker对象 "加锁",
+ // 当第二个线程运行该方法时,首先检测到locker对象为"加锁"状态,该线程就会挂起等待第一个线程解锁
+ // lock语句运行完之后(即线程运行完之后)会对该对象"解锁"
+ // 双重锁定只需要一句判断就可以了
+ if (uniqueInstance == null)
+ {
+ lock (locker)
+ {
+ // 如果类的实例不存在则创建,否则直接返回
+ if (uniqueInstance == null)
+ {
+ uniqueInstance = new SegmentationWeightRecordRpc();
+ }
+ }
+ }
+ return uniqueInstance;
+ }
+
+
+ protected override string InsertRpcUrl
+ {
+ get { return "/MainSystem/B3ClientService/Rpcs/BillRpc/SegmentationWeightRecordRpc/Insert"; }
+ }
+
+ protected override string UpdateRpcUrl
+ {
+ get { return "/MainSystem/B3ClientService/Rpcs/BillRpc/SegmentationWeightRecordRpc/Update"; }
+ }
+
+ protected override string DeleteRpcUrl
+ {
+ get { return "/MainSystem/B3ClientService/Rpcs/BillRpc/SegmentationWeightRecordRpc/Delete"; }
+ }
+
+ public static int GetTodayTotalCount(DateTime date)
{
- var json = JsonConvert.SerializeObject(record);
- var id = RpcFacade.Call("/MainSystem/B3ClientService/Rpcs/BillRpc/SegmentationWeightRecordRpc/Insert", json);
- return id;
+ var query = new DQueryDom(new JoinAlias(typeof(SegmentationWeightRecord)));
+ query.Columns.Add(DQSelectColumn.Count());
+ query.Where.Conditions.Add(DQCondition.GreaterThanOrEqual("CreateTime",date.Date));
+ query.Where.Conditions.Add(DQCondition.LessThan("CreateTime",date.Date.AddDays(1)));;
+ using (var session = LocalDmoSession.New())
+ {
+ return Convert.ToInt32(session.ExecuteScalar(query));
+ }
}
}
}
diff --git a/SegmentationWeight/SegmentationWeight.csproj b/SegmentationWeight/SegmentationWeight.csproj
index a6045d9..ac63c3f 100644
--- a/SegmentationWeight/SegmentationWeight.csproj
+++ b/SegmentationWeight/SegmentationWeight.csproj
@@ -30,10 +30,21 @@
4
+
+ ..\TrunksIousOutInStore\bin\Debug\AutoMapper.dll
+
+
+ False
+ ..\..\..\tsref\Debug\Forks.EnterpriseServices.dll
+
False
..\..\..\tsref\Debug\Forks.JsonRpc.Client.dll
+
+ False
+ ..\..\..\tsref\Debug\Forks.Utils.dll
+
False
..\..\..\tsref\Debug\Newtonsoft.Json.dll
@@ -50,8 +61,11 @@
+
+
+
diff --git a/SegmentationWeight/SegmentationWeightForm.Designer.cs b/SegmentationWeight/SegmentationWeightForm.Designer.cs
index 7573723..dd9557a 100644
--- a/SegmentationWeight/SegmentationWeightForm.Designer.cs
+++ b/SegmentationWeight/SegmentationWeightForm.Designer.cs
@@ -28,25 +28,27 @@
///
private void InitializeComponent()
{
- 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 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();
+ this.panel3 = new System.Windows.Forms.Panel();
+ this.cbxBatch = new System.Windows.Forms.ComboBox();
+ this.cbxWorkUnit = new System.Windows.Forms.ComboBox();
+ this.label6 = new System.Windows.Forms.Label();
+ this.label5 = new System.Windows.Forms.Label();
+ this.cbxWorkShop = new System.Windows.Forms.ComboBox();
+ this.label4 = new System.Windows.Forms.Label();
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.btnGoodsSet = new System.Windows.Forms.Button();
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();
@@ -54,11 +56,16 @@
this.lblGoodsName = new System.Windows.Forms.Label();
this.lblNumber = new System.Windows.Forms.Label();
this.lblWeight = new System.Windows.Forms.Label();
+ 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();
this.splitContainer1.SuspendLayout();
this.panel1.SuspendLayout();
+ this.panel3.SuspendLayout();
this.panel2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit();
this.splitContainer2.Panel1.SuspendLayout();
@@ -85,32 +92,90 @@
//
this.splitContainer1.Panel2.Controls.Add(this.splitContainer2);
this.splitContainer1.Size = new System.Drawing.Size(1041, 587);
- this.splitContainer1.SplitterDistance = 99;
+ this.splitContainer1.SplitterDistance = 110;
this.splitContainer1.SplitterWidth = 1;
this.splitContainer1.TabIndex = 0;
//
// panel1
//
+ this.panel1.Controls.Add(this.panel3);
this.panel1.Controls.Add(this.enableWeight);
this.panel1.Controls.Add(this.panel2);
this.panel1.Controls.Add(this.btnWeightSet);
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1";
- this.panel1.Size = new System.Drawing.Size(1039, 97);
+ this.panel1.Size = new System.Drawing.Size(1039, 108);
this.panel1.TabIndex = 2;
//
- // btnGoodsSet
- //
- this.btnGoodsSet.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.btnGoodsSet.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- this.btnGoodsSet.Location = new System.Drawing.Point(416, 16);
- this.btnGoodsSet.Name = "btnGoodsSet";
- this.btnGoodsSet.Size = new System.Drawing.Size(95, 50);
- this.btnGoodsSet.TabIndex = 34;
- this.btnGoodsSet.Text = "产品设置";
- this.btnGoodsSet.UseVisualStyleBackColor = true;
- this.btnGoodsSet.Click += new System.EventHandler(this.btnGoodsSet_Click);
+ // panel3
+ //
+ this.panel3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+ this.panel3.Controls.Add(this.cbxBatch);
+ this.panel3.Controls.Add(this.cbxWorkUnit);
+ this.panel3.Controls.Add(this.label6);
+ this.panel3.Controls.Add(this.label5);
+ this.panel3.Controls.Add(this.cbxWorkShop);
+ this.panel3.Controls.Add(this.label4);
+ this.panel3.Location = new System.Drawing.Point(805, 4);
+ this.panel3.Name = "panel3";
+ this.panel3.Size = new System.Drawing.Size(231, 100);
+ this.panel3.TabIndex = 34;
+ //
+ // cbxBatch
+ //
+ this.cbxBatch.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+ this.cbxBatch.FormattingEnabled = true;
+ this.cbxBatch.Location = new System.Drawing.Point(78, 73);
+ this.cbxBatch.Name = "cbxBatch";
+ this.cbxBatch.Size = new System.Drawing.Size(121, 20);
+ this.cbxBatch.TabIndex = 39;
+ this.cbxBatch.SelectedIndexChanged += new System.EventHandler(this.cbxBatch_SelectedIndexChanged);
+ //
+ // cbxWorkUnit
+ //
+ this.cbxWorkUnit.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+ this.cbxWorkUnit.FormattingEnabled = true;
+ this.cbxWorkUnit.Location = new System.Drawing.Point(78, 40);
+ this.cbxWorkUnit.Name = "cbxWorkUnit";
+ this.cbxWorkUnit.Size = new System.Drawing.Size(121, 20);
+ this.cbxWorkUnit.TabIndex = 40;
+ //
+ // label6
+ //
+ this.label6.AutoSize = true;
+ this.label6.Location = new System.Drawing.Point(31, 77);
+ this.label6.Name = "label6";
+ this.label6.Size = new System.Drawing.Size(41, 12);
+ this.label6.TabIndex = 36;
+ this.label6.Text = "批次:";
+ //
+ // label5
+ //
+ this.label5.AutoSize = true;
+ this.label5.Location = new System.Drawing.Point(31, 43);
+ this.label5.Name = "label5";
+ this.label5.Size = new System.Drawing.Size(41, 12);
+ this.label5.TabIndex = 37;
+ this.label5.Text = "单元:";
+ //
+ // cbxWorkShop
+ //
+ this.cbxWorkShop.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+ this.cbxWorkShop.FormattingEnabled = true;
+ this.cbxWorkShop.Location = new System.Drawing.Point(79, 7);
+ this.cbxWorkShop.Name = "cbxWorkShop";
+ this.cbxWorkShop.Size = new System.Drawing.Size(121, 20);
+ this.cbxWorkShop.TabIndex = 41;
+ //
+ // label4
+ //
+ this.label4.AutoSize = true;
+ this.label4.Location = new System.Drawing.Point(31, 11);
+ this.label4.Name = "label4";
+ this.label4.Size = new System.Drawing.Size(41, 12);
+ this.label4.TabIndex = 38;
+ this.label4.Text = "车间:";
//
// enableWeight
//
@@ -173,11 +238,23 @@
//
this.splitContainer2.Panel2.Controls.Add(this.uDataGridView1);
this.splitContainer2.Panel2.Controls.Add(this.tableLayoutPanel1);
- this.splitContainer2.Size = new System.Drawing.Size(1041, 487);
+ this.splitContainer2.Size = new System.Drawing.Size(1041, 476);
this.splitContainer2.SplitterDistance = 517;
this.splitContainer2.SplitterWidth = 1;
this.splitContainer2.TabIndex = 0;
//
+ // btnGoodsSet
+ //
+ this.btnGoodsSet.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+ this.btnGoodsSet.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ this.btnGoodsSet.Location = new System.Drawing.Point(416, 16);
+ this.btnGoodsSet.Name = "btnGoodsSet";
+ this.btnGoodsSet.Size = new System.Drawing.Size(95, 50);
+ this.btnGoodsSet.TabIndex = 34;
+ this.btnGoodsSet.Text = "产品设置";
+ this.btnGoodsSet.UseVisualStyleBackColor = true;
+ this.btnGoodsSet.Click += new System.EventHandler(this.btnGoodsSet_Click);
+ //
// flpGoods
//
this.flpGoods.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
@@ -186,7 +263,7 @@
this.flpGoods.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.flpGoods.Location = new System.Drawing.Point(4, 87);
this.flpGoods.Name = "flpGoods";
- this.flpGoods.Size = new System.Drawing.Size(507, 395);
+ this.flpGoods.Size = new System.Drawing.Size(507, 384);
this.flpGoods.TabIndex = 1;
//
// flpClass
@@ -205,89 +282,48 @@
this.uDataGridView1.AllowUserToDeleteRows = false;
this.uDataGridView1.AllowUserToResizeColumns = false;
this.uDataGridView1.AllowUserToResizeRows = false;
- dataGridViewCellStyle4.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
- this.uDataGridView1.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle4;
+ 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;
- 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.uDataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle5;
+ 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.重量});
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;
- 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.uDataGridView1.RowsDefaultCellStyle = dataGridViewCellStyle6;
+ 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(533, 374);
+ this.uDataGridView1.Size = new System.Drawing.Size(515, 363);
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)
| System.Windows.Forms.AnchorStyles.Right)));
this.tableLayoutPanel1.CellBorderStyle = System.Windows.Forms.TableLayoutPanelCellBorderStyle.Single;
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, 106F));
+ this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 58.15603F));
+ this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 41.84397F));
+ this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 124F));
this.tableLayoutPanel1.Controls.Add(this.label1, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.label2, 1, 0);
this.tableLayoutPanel1.Controls.Add(this.label3, 2, 0);
@@ -299,7 +335,7 @@
this.tableLayoutPanel1.RowCount = 2;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 53.57143F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 46.42857F));
- this.tableLayoutPanel1.Size = new System.Drawing.Size(529, 98);
+ this.tableLayoutPanel1.Size = new System.Drawing.Size(515, 98);
this.tableLayoutPanel1.TabIndex = 0;
//
// label1
@@ -309,7 +345,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(270, 50);
+ this.label1.Size = new System.Drawing.Size(219, 50);
this.label1.TabIndex = 0;
this.label1.Text = "产品";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
@@ -319,9 +355,9 @@
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(281, 1);
+ this.label2.Location = new System.Drawing.Point(230, 1);
this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(136, 50);
+ this.label2.Size = new System.Drawing.Size(155, 50);
this.label2.TabIndex = 0;
this.label2.Text = "数量";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
@@ -331,9 +367,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(424, 1);
+ this.label3.Location = new System.Drawing.Point(392, 1);
this.label3.Name = "label3";
- this.label3.Size = new System.Drawing.Size(101, 50);
+ this.label3.Size = new System.Drawing.Size(119, 50);
this.label3.TabIndex = 0;
this.label3.Text = "重量";
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
@@ -345,7 +381,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(270, 45);
+ this.lblGoodsName.Size = new System.Drawing.Size(219, 45);
this.lblGoodsName.TabIndex = 0;
this.lblGoodsName.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
@@ -354,9 +390,9 @@
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(281, 52);
+ this.lblNumber.Location = new System.Drawing.Point(230, 52);
this.lblNumber.Name = "lblNumber";
- this.lblNumber.Size = new System.Drawing.Size(136, 45);
+ this.lblNumber.Size = new System.Drawing.Size(155, 45);
this.lblNumber.TabIndex = 0;
this.lblNumber.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
@@ -365,12 +401,46 @@
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(424, 52);
+ this.lblWeight.Location = new System.Drawing.Point(392, 52);
this.lblWeight.Name = "lblWeight";
- this.lblWeight.Size = new System.Drawing.Size(101, 45);
+ this.lblWeight.Size = new System.Drawing.Size(119, 45);
this.lblWeight.TabIndex = 0;
this.lblWeight.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
+ // 序号
+ //
+ this.序号.DataPropertyName = "ID";
+ this.序号.HeaderText = "序号";
+ this.序号.Name = "序号";
+ this.序号.ReadOnly = true;
+ this.序号.Width = 80;
+ //
+ // 条码
+ //
+ this.条码.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
+ this.条码.DataPropertyName = "BarCode";
+ this.条码.HeaderText = "条码";
+ this.条码.Name = "条码";
+ this.条码.ReadOnly = true;
+ this.条码.Width = 65;
+ //
+ // 产品
+ //
+ this.产品.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
+ this.产品.DataPropertyName = "Goods_Name";
+ this.产品.HeaderText = "产品";
+ this.产品.MinimumWidth = 100;
+ this.产品.Name = "产品";
+ this.产品.ReadOnly = true;
+ //
+ // 重量
+ //
+ this.重量.DataPropertyName = "Weight";
+ this.重量.HeaderText = "重量";
+ this.重量.Name = "重量";
+ this.重量.ReadOnly = true;
+ this.重量.Width = 80;
+ //
// SegmentationWeightForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
@@ -389,6 +459,8 @@
this.splitContainer1.ResumeLayout(false);
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
+ this.panel3.ResumeLayout(false);
+ this.panel3.PerformLayout();
this.panel2.ResumeLayout(false);
this.panel2.PerformLayout();
this.splitContainer2.Panel1.ResumeLayout(false);
@@ -421,10 +493,16 @@
private System.Windows.Forms.Label lblNumber;
private System.Windows.Forms.Label lblWeight;
private BWP.WinFormControl.UDataGridView uDataGridView1;
+ private System.Windows.Forms.Panel panel3;
+ private System.Windows.Forms.ComboBox cbxBatch;
+ private System.Windows.Forms.ComboBox cbxWorkUnit;
+ private System.Windows.Forms.Label label6;
+ private System.Windows.Forms.Label label5;
+ private System.Windows.Forms.ComboBox cbxWorkShop;
+ private System.Windows.Forms.Label label4;
private System.Windows.Forms.DataGridViewTextBoxColumn 序号;
private System.Windows.Forms.DataGridViewTextBoxColumn 条码;
private System.Windows.Forms.DataGridViewTextBoxColumn 产品;
- private System.Windows.Forms.DataGridViewTextBoxColumn 净重;
- private System.Windows.Forms.DataGridViewTextBoxColumn 毛重;
+ private System.Windows.Forms.DataGridViewTextBoxColumn 重量;
}
}
\ No newline at end of file
diff --git a/SegmentationWeight/SegmentationWeightForm.cs b/SegmentationWeight/SegmentationWeightForm.cs
index b181eae..e64f730 100644
--- a/SegmentationWeight/SegmentationWeightForm.cs
+++ b/SegmentationWeight/SegmentationWeightForm.cs
@@ -10,8 +10,12 @@ using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
+using BO;
using BO.Utils;
+using BO.Utils.BillRpc;
using BWP.WinFormControl.WeightDataFormat;
+using Forks.JsonRpc.Client;
+using Newtonsoft.Json;
using SegmentationWeight.Rpc;
using SegmentationWeight.Rpc.Dto;
@@ -19,7 +23,11 @@ namespace SegmentationWeight
{
public partial class SegmentationWeightForm : Form,IAfterLogin
{
+ private readonly string mDropDownSetsFileName = "DropDownSets.xml";
+ private DropDownSets mDropDownSets;
+ private List mProductTasks;
+ private readonly string mProductTasksFileName = "ProductTasks.xml";
#region weightNeed
SerialPort weightPort;
@@ -47,7 +55,115 @@ namespace SegmentationWeight
// if (syncToServer != null && syncToServer.IsAlive)
// syncToServer.Abort();
};
+
+ InitCombox();
+ InitPlanGoodsNumber();
+ }
+
+ private void cbxBatch_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ InitPlanGoodsNumber();
+ }
+
+ private void InitPlanGoodsNumber()
+ {
+ if (LoginRpcUtil.TestConnection(1000))
+ {
+ var json = RpcFacade.Call("/MainSystem/B3ClientService/Rpcs/BillRpc/ProductTaskRpc/GetListByBatch", cbxBatch.Text);
+ mProductTasks = JsonConvert.DeserializeObject>(json);
+ XmlUtil.SerializerObjToFile(mProductTasks,mProductTasksFileName);
+ }
+ else
+ {
+ mProductTasks = XmlUtil.DeserializeFromFile>(mProductTasksFileName);
+ }
+ }
+
+ private void InitCombox()
+ {
+ if (LoginRpcUtil.TestConnection(500))
+ {
+ mDropDownSets = GetmDropDownSets();
+ XmlUtil.SerializerObjToFile(mDropDownSets, mDropDownSetsFileName);
+ }
+ else
+ {
+ mDropDownSets = XmlUtil.DeserializeFromFile(mDropDownSetsFileName);
+ }
+ var shop = mDropDownSets.Details.FirstOrDefault(x => x.Name == DropDownSets.车间);
+ if (shop != null)
+ {
+ cbxWorkShop.DataSource = shop.Details;
+ cbxWorkShop.DisplayMember = "Name";
+ cbxWorkShop.ValueMember = "ID";
+ }
+
+ var unit = mDropDownSets.Details.FirstOrDefault(x => x.Name == DropDownSets.单元);
+ if (unit != null)
+ {
+ cbxWorkUnit.DataSource = unit.Details;
+ cbxWorkUnit.DisplayMember = "Name";
+ cbxWorkUnit.ValueMember = "Code";
+ }
+
+ var batch = mDropDownSets.Details.FirstOrDefault(x => x.Name == DropDownSets.批次);
+ if (batch != null)
+ {
+ cbxBatch.DataSource = batch.Details;
+ cbxBatch.DisplayMember = "Name";
+ cbxBatch.ValueMember = "ID";
+ }
+
+ }
+
+ private DropDownSets GetmDropDownSets()
+ {
+ var sets=new DropDownSets();
+ var wrokUnitSet = GetWrokUnitSet();
+ var wrokShopSet = GetWrokShopSet();
+ var productBatchSet = GetProductBatchSet();
+ sets.Details.Add(wrokUnitSet);
+ sets.Details.Add(wrokShopSet);
+ sets.Details.Add(productBatchSet);
+ return sets;
}
+
+ private DropDownSet GetProductBatchSet()
+ {
+ var json = RpcFacade.Call("/MainSystem/B3ClientService/Rpcs/BaseInfoRpc/GetProductBatchList");
+ var set = new DropDownSet();
+ set.Name = DropDownSets.批次;
+ foreach (var detail in JsonConvert.DeserializeObject>(json))
+ {
+ set.Details.Add(detail);
+ }
+ return set;
+ }
+
+ private DropDownSet GetWrokShopSet()
+ {
+ var json = RpcFacade.Call("/MainSystem/B3ClientService/Rpcs/BaseInfoRpc/GetWorkShopList");
+ var set = new DropDownSet();
+ set.Name = DropDownSets.车间;
+ foreach (var detail in JsonConvert.DeserializeObject>(json))
+ {
+ set.Details.Add(detail);
+ }
+ return set;
+ }
+
+ private DropDownSet GetWrokUnitSet()
+ {
+ var json = RpcFacade.Call("/MainSystem/B3ClientService/Rpcs/BaseInfoRpc/GetWorkUnitList");
+ var set = new DropDownSet();
+ set.Name = DropDownSets.单元;
+ foreach (var detail in JsonConvert.DeserializeObject>(json))
+ {
+ set.Details.Add(detail);
+ }
+ return set;
+ }
+
#region weightNeed
void OpenSerialPort()
{
@@ -339,77 +455,62 @@ namespace SegmentationWeight
{
var btn = sender as Button;
var set = btn.Tag as SegmentationWeightGoodSet;
-
- //todo 打印条码 要判断误差
-
- var weight = 100m;
//添加记录
- var record = GetRecordBySet(set,weight);
- var id=SegmentationWeightRecordRpc.Insert(record);
+ var record = GetRecordBySet(set);
+ var id=LocalDmoSession.Insert(record);
record.ID = id;
mWeightRecords.Add(record);
-
-
RefreshUi();
-
- var entity = CreatePrintEntity("5号里脊肉");
+ var entity = CreatePrintEntity(record);
SegmentationWeightPrint.Print(entity);
}
- PrintEntity CreatePrintEntity(string goodsName)
+ PrintEntity CreatePrintEntity(SegmentationWeightRecord record)
{
var entity = new PrintEntity();
entity.AccountingUnit_Name = "青岛万福集团股份有限公司";
- entity.Goods_Name = goodsName;
+ entity.Goods_Name = record.Goods_Name;
entity.Date = DateTime.Today;
- entity.Checker = "";
+ entity.Checker = "001";
entity.StoreCondition = "0-4℃";
- entity.Place = "青岛莱西市";
+ entity.Place = "青岛莱西市珠海路5号";
entity.TelNumber = "0532-88488888";
-
- int maxindex=0;
-// if (index == null)
-// {
-//// maxindex = LocalGradeAndWeightBL.GetTodayTotalCount(butcherTimeInput.Date.Value);
-// maxindex++;
-// }
-// else
-// {
-// maxindex = index.Value;
-// }
-
- string indexCode = maxindex.ToString("D6");
-
- entity.BarCode = string.Format("WF{0}{1:00000}", DateTime.Today.ToString("yyyyMMdd"), indexCode);
- entity._2DQRCode = string.Format(ButcherAppContext.Context.UrlConfig.OutAddress + "?code={0}&name={1}", entity.BarCode, goodsName);
+ entity.BarCode = record.BarCode;
+ entity._2DQRCode = string.Format(ButcherAppContext.Context.UrlConfig.OutAddress + "?code=", entity.BarCode);
return entity;
}
- private SegmentationWeightRecord GetRecordBySet(SegmentationWeightGoodSet set,decimal maoWeight)
+ private SegmentationWeightRecord GetRecordBySet(SegmentationWeightGoodSet set)
{
+ var unitValue = cbxWorkUnit.SelectedValue.ToString();
+ if (string.IsNullOrWhiteSpace(unitValue))
+ {
+ throw new Exception("请选择工作单元");
+ }
var record=new SegmentationWeightRecord();
record.Goods_ID = set.Goods_ID;
- record.BarCode = "";//todo 条码规则
+ string liushuihao = GetLiuShuiHao();
+ record.BarCode = "A26091201"+DateTime.Today.ToString("yyyyMMdd")+cbxWorkUnit.SelectedValue+ liushuihao;
record.Goods_Name = set.Goods_Name;
record.Goods_Spec = set.Goods_Spec;
- record.BiaoShi = "";//todo 标识
- record.MaoWeight = maoWeight;
- record.PiWeight = 10;
+ record.BiaoShi = cbxWorkUnit.Text;
+ var weight = Convert.ToDecimal(lblChengZhong.Text);
+ record.Weight = weight;
+ record.CardBarCode = ""; //
-// record.JingWeight = record.MaoWeight - record.PiWeight;
+ return record;
+ }
- if (set.Goods_MainUnitRatio > 0)
- {
- record.JingWeight = set.Goods_MainUnitRatio;
- }
- else
+ private int globleLiuShuiHao = 0;
+ private string GetLiuShuiHao()
+ {
+ if (globleLiuShuiHao == 0)
{
- record.JingWeight = record.MaoWeight - record.PiWeight;
+ globleLiuShuiHao = SegmentationWeightRecordRpc.GetTodayTotalCount(DateTime.Today);
}
-
- record.CardBarCode = "车条码"; //todo
-
- return record;
+ globleLiuShuiHao++;
+ string indexCode = globleLiuShuiHao.ToString("D5");
+ return indexCode;
}
void RefreshUi()
@@ -420,7 +521,7 @@ namespace SegmentationWeight
}
lblGoodsName.Text = mWeightRecords.First().Goods_Name;
lblNumber.Text = mWeightRecords.Count.ToString();
- lblWeight.Text = mWeightRecords.Sum(x => x.JingWeight).ToString();
+ lblWeight.Text = mWeightRecords.Sum(x => x.Weight).ToString();
uDataGridView1.DataSource = mWeightRecords;
}
@@ -436,5 +537,7 @@ namespace SegmentationWeight
var form=new WeightSettingFrom();
form.ShowDialog();
}
+
+
}
}
diff --git a/SegmentationWeight/SegmentationWeightForm.resx b/SegmentationWeight/SegmentationWeightForm.resx
index ffe56bb..bc917b2 100644
--- a/SegmentationWeight/SegmentationWeightForm.resx
+++ b/SegmentationWeight/SegmentationWeightForm.resx
@@ -126,10 +126,7 @@
True
-
- True
-
-
+
True
\ No newline at end of file
diff --git a/TrunksIousOutInStore/LocalSyncBO/TrunksIousOutInStoreRecord.cs b/TrunksIousOutInStore/LocalSyncBO/TrunksIousOutInStoreRecord.cs
index 7858671..6565ff7 100644
--- a/TrunksIousOutInStore/LocalSyncBO/TrunksIousOutInStoreRecord.cs
+++ b/TrunksIousOutInStore/LocalSyncBO/TrunksIousOutInStoreRecord.cs
@@ -38,13 +38,5 @@ namespace TrunksIousOutInStore.LocalSyncBO
}
}
- public class CarcassStatus
- {
- public static readonly string 胴体称重 = "胴体称重";
- public static readonly string 入预冷库 = "入预冷库";
- public static readonly string 分割领用 = "分割领用";
- public static readonly string 入销售库 = "入销售库";
- public static readonly string 销售出库 = "销售出库";
-
- }
+
}