Browse Source

..

master
robin 4 years ago
parent
commit
4ef56ada44
7 changed files with 211 additions and 128 deletions
  1. +3
    -4
      ButcherFactory.BO/Bill/SegmentProduction.cs
  2. +25
    -4
      ButcherFactory.BO/LocalBL/SegmentProductionBL.cs
  3. +6
    -6
      ButcherFactory.Form/Controls/CodePanel.Designer.cs
  4. +83
    -83
      ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.Designer.cs
  5. +89
    -27
      ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.cs
  6. +3
    -0
      ButcherFactory.Form/SegmentProductionAuto_/WeightView.cs
  7. +2
    -4
      ButcherFactory.Form/SegmentProduction_/SegmentSumCodePrint.cs

+ 3
- 4
ButcherFactory.BO/Bill/SegmentProduction.cs View File

@ -22,10 +22,9 @@ namespace ButcherFactory.BO
get get
{ {
if (string.IsNullOrEmpty(BarCode)) if (string.IsNullOrEmpty(BarCode))
return null;
var tag = "260912011" + DateTime.Today.Year;
if (BarCode.Contains(tag))
return BarCode.Replace(tag, "");
return null;
if (BarCode.Length > 4)
return BarCode.Substring(BarCode.Length - 4);
return BarCode; return BarCode;
} }
} }


+ 25
- 4
ButcherFactory.BO/LocalBL/SegmentProductionBL.cs View File

@ -83,8 +83,9 @@ namespace ButcherFactory.BO.LocalBL
query.Columns.Add(DQSelectColumn.Field("RowIndex")); query.Columns.Add(DQSelectColumn.Field("RowIndex"));
query.Columns.Add(DQSelectColumn.Field("BarCode")); query.Columns.Add(DQSelectColumn.Field("BarCode"));
query.Where.Conditions.Add(DQCondition.GreaterThanOrEqual("CreateTime", date.Date)); query.Where.Conditions.Add(DQCondition.GreaterThanOrEqual("CreateTime", date.Date));
query.Where.Conditions.Add(DQCondition.LessThan("CreateTime", date.Date.AddDays(1)));
query.OrderBy.Expressions.Add(DQOrderByExpression.Create("ID"));
query.Where.Conditions.Add(DQCondition.LessThan("CreateTime", date.Date.AddDays(1)));
query.Where.Conditions.Add(DQCondition.And( DQCondition.EQ("Delete", false) ));
query.OrderBy.Expressions.Add(DQOrderByExpression.Create("ID",true));
var list = new BindingList<TotalCode>(); var list = new BindingList<TotalCode>();
using (var session = DmoSession.New()) using (var session = DmoSession.New())
@ -463,8 +464,28 @@ namespace ButcherFactory.BO.LocalBL
var log = new SegmentLog(entity.BarCode, "删除"); var log = new SegmentLog(entity.BarCode, "删除");
log.Message = string.Format("存货名称:{0} 重量:{1:#0.###}", entity.Goods_Name, entity.Weight); log.Message = string.Format("存货名称:{0} 重量:{1:#0.###}", entity.Goods_Name, entity.Weight);
InsertLog(log); InsertLog(log);
}
}
public static void DeleteTotalCode(TotalCode entity)
{
var update = new DQUpdateDom(typeof(TotalCode));
update.Where.Conditions.Add(DQCondition.EQ("ID", entity.ID));
update.Columns.Add(new DQUpdateColumn("Delete", true));
update.Columns.Add(new DQUpdateColumn("RowVersion", DQExpression.Add(DQExpression.Field("RowVersion"), DQExpression.Value(1))));
update.EExecute();
var update1 = new DQUpdateDom(typeof(SegmentProduction));
update1.Where.Conditions.Add(DQCondition.EQ("TotalCode_ID", entity.ID));
update1.Columns.Add(new DQUpdateColumn("Sync", true));
update1.Columns.Add(new DQUpdateColumn("Delete", true));
update1.Columns.Add(new DQUpdateColumn("RowVersion", DQExpression.Add(DQExpression.Field("RowVersion"), DQExpression.Value(1))));
update1.EExecute();
var log = new SegmentLog(entity.BarCode, "删除");
log.Message = string.Format("总码:删除");
InsertLog(log);
}
static bool? CheckCanDelete(string barCode) static bool? CheckCanDelete(string barCode)
{ {
try try


+ 6
- 6
ButcherFactory.Form/Controls/CodePanel.Designer.cs View File

@ -37,21 +37,21 @@
this.flowLayoutPanel1.AutoScroll = true; this.flowLayoutPanel1.AutoScroll = true;
this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Bottom; this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Bottom;
this.flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; this.flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 64);
this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 46);
this.flowLayoutPanel1.Name = "flowLayoutPanel1"; this.flowLayoutPanel1.Name = "flowLayoutPanel1";
this.flowLayoutPanel1.Size = new System.Drawing.Size(130, 534);
this.flowLayoutPanel1.Size = new System.Drawing.Size(101, 552);
this.flowLayoutPanel1.TabIndex = 0; this.flowLayoutPanel1.TabIndex = 0;
this.flowLayoutPanel1.WrapContents = false; this.flowLayoutPanel1.WrapContents = false;
// //
// Button // Button
// //
this.Button.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
this.Button.BackColor = System.Drawing.Color.Violet;
this.Button.Font = new System.Drawing.Font("黑体", 15F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.Button.Font = new System.Drawing.Font("黑体", 15F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.Button.ForeColor = System.Drawing.Color.Black; this.Button.ForeColor = System.Drawing.Color.Black;
this.Button.Location = new System.Drawing.Point(0, 0);
this.Button.Location = new System.Drawing.Point(3, 3);
this.Button.Name = "Button"; this.Button.Name = "Button";
this.Button.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(15)))), ((int)(((byte)(215)))), ((int)(((byte)(107))))); this.Button.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(15)))), ((int)(((byte)(215)))), ((int)(((byte)(107)))));
this.Button.Size = new System.Drawing.Size(127, 58);
this.Button.Size = new System.Drawing.Size(90, 40);
this.Button.TabIndex = 1; this.Button.TabIndex = 1;
this.Button.UseVisualStyleBackColor = false; this.Button.UseVisualStyleBackColor = false;
// //
@ -63,7 +63,7 @@
this.Controls.Add(this.Button); this.Controls.Add(this.Button);
this.Controls.Add(this.flowLayoutPanel1); this.Controls.Add(this.flowLayoutPanel1);
this.Name = "CodePanel"; this.Name = "CodePanel";
this.Size = new System.Drawing.Size(130, 598);
this.Size = new System.Drawing.Size(101, 598);
this.ResumeLayout(false); this.ResumeLayout(false);
} }


+ 83
- 83
ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.Designer.cs View File

@ -47,10 +47,7 @@
this.label2 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label();
this.statisticNumberBox = new System.Windows.Forms.TextBox(); this.statisticNumberBox = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
this.logBtn = new ButcherFactory.Controls.ColorButton();
this.msglbl = new System.Windows.Forms.Label(); this.msglbl = new System.Windows.Forms.Label();
this.closeBtn = new ButcherFactory.Controls.ColorButton();
this.uWeightControl1 = new ButcherFactory.Controls.WeightControl();
this.barPrintCheck = new System.Windows.Forms.CheckBox(); this.barPrintCheck = new System.Windows.Forms.CheckBox();
this.uTimerLabel1 = new WinFormControl.UTimerLabel(); this.uTimerLabel1 = new WinFormControl.UTimerLabel();
this.productBatchSelect = new System.Windows.Forms.ComboBox(); this.productBatchSelect = new System.Windows.Forms.ComboBox();
@ -59,16 +56,19 @@
this.uLabel2 = new WinFormControl.ULabel(); this.uLabel2 = new WinFormControl.ULabel();
this.netStateWatch1 = new WinFormControl.NetStateWatch(); this.netStateWatch1 = new WinFormControl.NetStateWatch();
this.splitContainer2 = new System.Windows.Forms.SplitContainer(); this.splitContainer2 = new System.Windows.Forms.SplitContainer();
this.goodsSetBtn = new ButcherFactory.Controls.ColorButton();
this.flowLayoutPanel2 = new System.Windows.Forms.FlowLayoutPanel(); this.flowLayoutPanel2 = new System.Windows.Forms.FlowLayoutPanel();
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.flowLayoutPanel3 = new System.Windows.Forms.FlowLayoutPanel();
this.logBtn = new ButcherFactory.Controls.ColorButton();
this.closeBtn = new ButcherFactory.Controls.ColorButton();
this.uWeightControl1 = new ButcherFactory.Controls.WeightControl();
this.goodsSetBtn = new ButcherFactory.Controls.ColorButton();
this.colorButton2 = new ButcherFactory.Controls.ColorButton(); this.colorButton2 = new ButcherFactory.Controls.ColorButton();
this.viewTaskBtn = new ButcherFactory.Controls.ColorButton(); this.viewTaskBtn = new ButcherFactory.Controls.ColorButton();
this.colorButton1 = new ButcherFactory.Controls.ColorButton(); this.colorButton1 = new ButcherFactory.Controls.ColorButton();
this.deleteBtn = new ButcherFactory.Controls.ColorButton(); this.deleteBtn = new ButcherFactory.Controls.ColorButton();
this.rePrintBtn = new ButcherFactory.Controls.ColorButton(); this.rePrintBtn = new ButcherFactory.Controls.ColorButton();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.flowLayoutPanel3 = new System.Windows.Forms.FlowLayoutPanel();
this.groupBox2.SuspendLayout(); this.groupBox2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.taskDataGrid)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.taskDataGrid)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
@ -261,21 +261,6 @@
this.label1.TabIndex = 26; this.label1.TabIndex = 26;
this.label1.Text = "统计数量:"; this.label1.Text = "统计数量:";
// //
// logBtn
//
this.logBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.logBtn.BackColor = System.Drawing.Color.CadetBlue;
this.logBtn.Font = new System.Drawing.Font("宋体", 15F);
this.logBtn.ForeColor = System.Drawing.Color.White;
this.logBtn.Location = new System.Drawing.Point(670, 4);
this.logBtn.Name = "logBtn";
this.logBtn.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(158)))), ((int)(((byte)(234)))), ((int)(((byte)(106)))));
this.logBtn.Size = new System.Drawing.Size(111, 41);
this.logBtn.TabIndex = 25;
this.logBtn.Text = "日志";
this.logBtn.UseVisualStyleBackColor = false;
this.logBtn.Click += new System.EventHandler(this.logBtn_Click);
//
// msglbl // msglbl
// //
this.msglbl.AutoSize = true; this.msglbl.AutoSize = true;
@ -286,30 +271,6 @@
this.msglbl.TabIndex = 24; this.msglbl.TabIndex = 24;
this.msglbl.Text = "正在获取基础信息"; this.msglbl.Text = "正在获取基础信息";
// //
// closeBtn
//
this.closeBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.closeBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(25)))));
this.closeBtn.Font = new System.Drawing.Font("宋体", 15F);
this.closeBtn.ForeColor = System.Drawing.Color.White;
this.closeBtn.Location = new System.Drawing.Point(1109, 7);
this.closeBtn.Name = "closeBtn";
this.closeBtn.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(158)))), ((int)(((byte)(234)))), ((int)(((byte)(106)))));
this.closeBtn.Size = new System.Drawing.Size(111, 41);
this.closeBtn.TabIndex = 18;
this.closeBtn.Text = "关闭";
this.closeBtn.UseVisualStyleBackColor = false;
this.closeBtn.Click += new System.EventHandler(this.closeBtn_Click);
//
// uWeightControl1
//
this.uWeightControl1.BackColor = System.Drawing.Color.Transparent;
this.uWeightControl1.Location = new System.Drawing.Point(12, 7);
this.uWeightControl1.Name = "uWeightControl1";
this.uWeightControl1.Size = new System.Drawing.Size(262, 74);
this.uWeightControl1.TabIndex = 17;
this.uWeightControl1.WeightFalg = null;
//
// barPrintCheck // barPrintCheck
// //
this.barPrintCheck.AutoSize = true; this.barPrintCheck.AutoSize = true;
@ -414,21 +375,6 @@
this.splitContainer2.SplitterDistance = 761; this.splitContainer2.SplitterDistance = 761;
this.splitContainer2.TabIndex = 0; this.splitContainer2.TabIndex = 0;
// //
// goodsSetBtn
//
this.goodsSetBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.goodsSetBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(77)))), ((int)(((byte)(135)))), ((int)(((byte)(245)))));
this.goodsSetBtn.Font = new System.Drawing.Font("宋体", 15F);
this.goodsSetBtn.ForeColor = System.Drawing.Color.White;
this.goodsSetBtn.Location = new System.Drawing.Point(645, 3);
this.goodsSetBtn.Name = "goodsSetBtn";
this.goodsSetBtn.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(158)))), ((int)(((byte)(234)))), ((int)(((byte)(106)))));
this.goodsSetBtn.Size = new System.Drawing.Size(111, 62);
this.goodsSetBtn.TabIndex = 19;
this.goodsSetBtn.Text = "产品设置";
this.goodsSetBtn.UseVisualStyleBackColor = false;
this.goodsSetBtn.Click += new System.EventHandler(this.goodsSetBtn_Click);
//
// flowLayoutPanel2 // flowLayoutPanel2
// //
this.flowLayoutPanel2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) this.flowLayoutPanel2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
@ -451,6 +397,83 @@
this.flowLayoutPanel1.Size = new System.Drawing.Size(640, 70); this.flowLayoutPanel1.Size = new System.Drawing.Size(640, 70);
this.flowLayoutPanel1.TabIndex = 22; this.flowLayoutPanel1.TabIndex = 22;
// //
// groupBox1
//
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
this.groupBox1.Controls.Add(this.flowLayoutPanel3);
this.groupBox1.Controls.Add(this.uLabel3);
this.groupBox1.Location = new System.Drawing.Point(8, 222);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Padding = new System.Windows.Forms.Padding(5);
this.groupBox1.Size = new System.Drawing.Size(447, 381);
this.groupBox1.TabIndex = 5;
this.groupBox1.TabStop = false;
//
// flowLayoutPanel3
//
this.flowLayoutPanel3.AutoScroll = true;
this.flowLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Fill;
this.flowLayoutPanel3.Location = new System.Drawing.Point(5, 19);
this.flowLayoutPanel3.Name = "flowLayoutPanel3";
this.flowLayoutPanel3.Size = new System.Drawing.Size(437, 357);
this.flowLayoutPanel3.TabIndex = 4;
this.flowLayoutPanel3.WrapContents = false;
//
// logBtn
//
this.logBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.logBtn.BackColor = System.Drawing.Color.CadetBlue;
this.logBtn.Font = new System.Drawing.Font("宋体", 15F);
this.logBtn.ForeColor = System.Drawing.Color.White;
this.logBtn.Location = new System.Drawing.Point(670, 4);
this.logBtn.Name = "logBtn";
this.logBtn.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(158)))), ((int)(((byte)(234)))), ((int)(((byte)(106)))));
this.logBtn.Size = new System.Drawing.Size(111, 41);
this.logBtn.TabIndex = 25;
this.logBtn.Text = "日志";
this.logBtn.UseVisualStyleBackColor = false;
this.logBtn.Click += new System.EventHandler(this.logBtn_Click);
//
// closeBtn
//
this.closeBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.closeBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(25)))));
this.closeBtn.Font = new System.Drawing.Font("宋体", 15F);
this.closeBtn.ForeColor = System.Drawing.Color.White;
this.closeBtn.Location = new System.Drawing.Point(1109, 7);
this.closeBtn.Name = "closeBtn";
this.closeBtn.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(158)))), ((int)(((byte)(234)))), ((int)(((byte)(106)))));
this.closeBtn.Size = new System.Drawing.Size(111, 41);
this.closeBtn.TabIndex = 18;
this.closeBtn.Text = "关闭";
this.closeBtn.UseVisualStyleBackColor = false;
this.closeBtn.Click += new System.EventHandler(this.closeBtn_Click);
//
// uWeightControl1
//
this.uWeightControl1.BackColor = System.Drawing.Color.Transparent;
this.uWeightControl1.Location = new System.Drawing.Point(12, 7);
this.uWeightControl1.Name = "uWeightControl1";
this.uWeightControl1.Size = new System.Drawing.Size(262, 74);
this.uWeightControl1.TabIndex = 17;
this.uWeightControl1.WeightFalg = null;
//
// goodsSetBtn
//
this.goodsSetBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.goodsSetBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(77)))), ((int)(((byte)(135)))), ((int)(((byte)(245)))));
this.goodsSetBtn.Font = new System.Drawing.Font("宋体", 15F);
this.goodsSetBtn.ForeColor = System.Drawing.Color.White;
this.goodsSetBtn.Location = new System.Drawing.Point(645, 3);
this.goodsSetBtn.Name = "goodsSetBtn";
this.goodsSetBtn.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(158)))), ((int)(((byte)(234)))), ((int)(((byte)(106)))));
this.goodsSetBtn.Size = new System.Drawing.Size(111, 62);
this.goodsSetBtn.TabIndex = 19;
this.goodsSetBtn.Text = "产品设置";
this.goodsSetBtn.UseVisualStyleBackColor = false;
this.goodsSetBtn.Click += new System.EventHandler(this.goodsSetBtn_Click);
//
// colorButton2 // colorButton2
// //
this.colorButton2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(192)))), ((int)(((byte)(192))))); this.colorButton2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(192)))), ((int)(((byte)(192)))));
@ -523,29 +546,6 @@
this.rePrintBtn.UseVisualStyleBackColor = false; this.rePrintBtn.UseVisualStyleBackColor = false;
this.rePrintBtn.Click += new System.EventHandler(this.rePrintBtn_Click); this.rePrintBtn.Click += new System.EventHandler(this.rePrintBtn_Click);
// //
// groupBox1
//
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
this.groupBox1.Controls.Add(this.flowLayoutPanel3);
this.groupBox1.Controls.Add(this.uLabel3);
this.groupBox1.Location = new System.Drawing.Point(8, 222);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Padding = new System.Windows.Forms.Padding(5);
this.groupBox1.Size = new System.Drawing.Size(447, 381);
this.groupBox1.TabIndex = 5;
this.groupBox1.TabStop = false;
//
// flowLayoutPanel3
//
this.flowLayoutPanel3.AutoScroll = true;
this.flowLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Fill;
this.flowLayoutPanel3.Location = new System.Drawing.Point(5, 19);
this.flowLayoutPanel3.Name = "flowLayoutPanel3";
this.flowLayoutPanel3.Size = new System.Drawing.Size(437, 357);
this.flowLayoutPanel3.TabIndex = 4;
this.flowLayoutPanel3.WrapContents = false;
//
// SegmentProductionAutoForm // SegmentProductionAutoForm
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);


+ 89
- 27
ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.cs View File

@ -89,7 +89,7 @@ namespace ButcherFactory.SegmentProductionAuto_
if (checkInStoreState != null && checkInStoreState.IsAlive) if (checkInStoreState != null && checkInStoreState.IsAlive)
checkInStoreState.Abort(); checkInStoreState.Abort();
} }
WeightDetails mCache;
public WeightDetails mCache;
protected override void OnLoad(EventArgs e) protected override void OnLoad(EventArgs e)
{ {
base.OnLoad(e); base.OnLoad(e);
@ -216,6 +216,10 @@ namespace ButcherFactory.SegmentProductionAuto_
{ {
if (batchID == null) if (batchID == null)
throw new Exception("请先选择批次"); throw new Exception("请先选择批次");
if (_totalCode == null || _codePanel == null)
{
throw new Exception(string.Format("请先选择总码!"));
}
var weight = uWeightControl1.Weight; var weight = uWeightControl1.Weight;
#if DEBUG #if DEBUG
if (weight == 0) if (weight == 0)
@ -360,12 +364,13 @@ namespace ButcherFactory.SegmentProductionAuto_
} }
SegmentProduction current; SegmentProduction current;
ColorButton _labelBt;
private ColorButton initSegmentBt(SegmentProduction entity) private ColorButton initSegmentBt(SegmentProduction entity)
{ {
var bt = new ColorButton() { Text = entity.ShortCode }; var bt = new ColorButton() { Text = entity.ShortCode };
bt.Tag = entity; bt.Tag = entity;
bt.Width = 110;
bt.Height = 50;
bt.Width = 90;
bt.Height = 35;
bt.Font = new Font("黑体", 13, FontStyle.Bold); bt.Font = new Font("黑体", 13, FontStyle.Bold);
bt.BackColor = Color.DarkCyan; bt.BackColor = Color.DarkCyan;
bt.SelectedColor = Color.DarkOrange; bt.SelectedColor = Color.DarkOrange;
@ -375,10 +380,19 @@ namespace ButcherFactory.SegmentProductionAuto_
if (bt.Selected) if (bt.Selected)
{ {
current = entity; current = entity;
_labelBt = bt;
GoodsLabel.Text = entity.Goods_Name; GoodsLabel.Text = entity.Goods_Name;
if (_codePanel != null)
{
_codePanel.Button.Selected = false;
_codePanel.Button.Invalidate();
}
_totalCode = null;
_codePanel = null;
} }
else else
{
{
_labelBt = null;
current = null; current = null;
GoodsLabel.Text = ""; GoodsLabel.Text = "";
} }
@ -525,28 +539,68 @@ namespace ButcherFactory.SegmentProductionAuto_
private void templateBtn_Click(object sender, EventArgs e) private void templateBtn_Click(object sender, EventArgs e)
{ {
new TemplateSelector(config).ShowDialog(); new TemplateSelector(config).ShowDialog();
}
private void deleteBtn_Click(object sender, EventArgs e)
{
if (current == null)
return;
if (MessageBox.Show("确定删除选中记录?", "删除确认", MessageBoxButtons.OKCancel) != DialogResult.OK)
return;
//var tag = historyDataGrid.SelectedRows[0].DataBoundItem as SegmentProduction;
if (current.CreateTime.AddMinutes(1) < DateTime.Now)
{
MessageBox.Show("已超出可删除时间范围");
return;
}
SegmentProductionBL.Delete(current);
historyList.Remove(current);
RefreshCodePanel();
var thd = new Thread(new ParameterizedThreadStart(RefreshTask));
thd.Start(current);
}
private void deleteBtn_Click(object sender, EventArgs e)
{
if (_totalCode == null || _codePanel == null)
{
if (current == null)
return;
if (MessageBox.Show("确定删除选中记录?", "删除确认", MessageBoxButtons.OKCancel) != DialogResult.OK)
return;
//var tag = historyDataGrid.SelectedRows[0].DataBoundItem as SegmentProduction;
if (current.CreateTime.AddMinutes(1) < DateTime.Now)
{
MessageBox.Show("已超出可删除时间范围");
return;
}
SegmentProduction d = current;
SegmentProductionBL.Delete(d);
historyList.Remove(d);
if (_labelBt != null)
{
var parent=_labelBt.Parent;
parent.Controls.Remove(_labelBt);
}
//RefreshCodePanel();
var thd = new Thread(new ParameterizedThreadStart(RefreshTask));
thd.Start(d);
current = null;
}
else
{
var deleteList = historyList.Where(x => x.TotalCode_ID == _totalCode.ID).ToList();
SegmentProductionBL.DeleteTotalCode(_totalCode);
allCode.Remove(_totalCode);
codeButtons.Remove(_codePanel.Button);
foreach (var item in deleteList)
{
historyList.Remove(item);
var thd = new Thread(new ParameterizedThreadStart(RefreshTask));
thd.Start(item);
}
flowLayoutPanel3.Controls.Remove(_codePanel);
// RefreshCodePanel();
current = null;
if (allCode.Count > 0)
{
_totalCode = allCode[0];
_codePanel = (CodePanel)flowLayoutPanel3.Controls[0];
_codePanel.Button.Selected = true;
_codePanel.Button.Invalidate();
}
else
{
_totalCode = null;
_codePanel = null;
}
}
} }
private void logBtn_Click(object sender, EventArgs e) private void logBtn_Click(object sender, EventArgs e)
@ -617,8 +671,10 @@ namespace ButcherFactory.SegmentProductionAuto_
var n = new CodePanel(); var n = new CodePanel();
var tCode = SegmentProductionBL.InsertTotalCode(new TotalCode()); var tCode = SegmentProductionBL.InsertTotalCode(new TotalCode());
allCode.Insert(0, tCode);
AddCodeButton(n, tCode,true); AddCodeButton(n, tCode,true);
flowLayoutPanel3.Controls.Add(n); flowLayoutPanel3.Controls.Add(n);
flowLayoutPanel3.Controls.SetChildIndex(n, 0);
} }
private void AddCodeButton(CodePanel n, TotalCode tCode,bool add=false) private void AddCodeButton(CodePanel n, TotalCode tCode,bool add=false)
@ -627,12 +683,18 @@ namespace ButcherFactory.SegmentProductionAuto_
n.Button.Text = tCode.ShortCode; n.Button.Text = tCode.ShortCode;
n.Button.Click += delegate n.Button.Click += delegate
{ {
current = null;
n.Button.Selected = !n.Button.Selected; n.Button.Selected = !n.Button.Selected;
if (n.Button.Selected) if (n.Button.Selected)
{ {
_codePanel = n; _codePanel = n;
_totalCode = tCode; _totalCode = tCode;
if (_labelBt != null)
{
_labelBt.Selected = false;
_labelBt.Invalidate();
}
_labelBt = null;
} }
else else
{ {


+ 3
- 0
ButcherFactory.Form/SegmentProductionAuto_/WeightView.cs View File

@ -1,4 +1,5 @@
using ButcherFactory.BO; using ButcherFactory.BO;
using ButcherFactory.BO.Utils;
using ButcherFactory.Controls; using ButcherFactory.Controls;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -106,6 +107,8 @@ namespace ButcherFactory.SegmentProductionAuto_
var l = form.wDic[goods.Goods_ID]; var l = form.wDic[goods.Goods_ID];
l.RemoveAt(tag.No - 1); l.RemoveAt(tag.No - 1);
bTag.Label.MinCount = l.Count; bTag.Label.MinCount = l.Count;
form.mCache.Cache = form.wDic;
XmlUtil.SerializerObjToFile( form.mCache);
} }
list.Remove(tag); list.Remove(tag);
int i = 1; int i = 1;


+ 2
- 4
ButcherFactory.Form/SegmentProduction_/SegmentSumCodePrint.cs View File

@ -35,12 +35,10 @@ namespace ButcherFactory.SegmentProduction_
dic.Add("$Goods_Name", info); dic.Add("$Goods_Name", info);
dic.Add("$Date", DateTime.Now.ToString("yyyy/MM/dd HH:mm")); dic.Add("$Date", DateTime.Now.ToString("yyyy/MM/dd HH:mm"));
var code = entity.BarCode;
if (code.Length > 17)
code = code.Substring(17);
var code = entity.TotalCode_Code;
dic.Add("$Code", code); dic.Add("$Code", code);
var imgUrl = string.Format(IMGFILE, id); var imgUrl = string.Format(IMGFILE, id);
var url = string.Format(AppContext.ConnectInfo.TraceBackUrl + "?code={0}", entity.BarCode);
var url = string.Format(AppContext.ConnectInfo.TraceBackUrl + "?code={0}",entity.TotalCode_Code);
BwpClientPrint.BwpClientWebPrint.Create2DPic(url, imgUrl, 120); BwpClientPrint.BwpClientWebPrint.Create2DPic(url, imgUrl, 120);
dic.Add("$ImageUrl", imgUrl); dic.Add("$ImageUrl", imgUrl);


Loading…
Cancel
Save