Browse Source

完善万福客户端

master
robin 4 years ago
parent
commit
24c6c8317d
3 changed files with 162 additions and 46 deletions
  1. +12
    -5
      ButcherFactory.BO/LocalBL/SegmentProductionBL.cs
  2. +36
    -5
      ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.Designer.cs
  3. +114
    -36
      ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.cs

+ 12
- 5
ButcherFactory.BO/LocalBL/SegmentProductionBL.cs View File

@ -426,7 +426,7 @@ namespace ButcherFactory.BO.LocalBL
return list;
}
public static void UploadSegmentInfo()
public static string UploadSegmentInfo(bool throwEx=false)
{
try
{
@ -434,7 +434,7 @@ namespace ButcherFactory.BO.LocalBL
{
var needUpload = GetUnSyncData(session);
if (needUpload.Count == 0)
return;
return "";
var json = JsonConvert.SerializeObject(needUpload);
RpcFacade.Call<int>(RpcPath + "Insert", json);
@ -442,13 +442,20 @@ namespace ButcherFactory.BO.LocalBL
SetLocalAsSyncd(item, session);
session.Commit();
}
}
catch
}
catch (Exception ex)
{
#if DEBUG
throw;
#endif
}
if (throwEx)
{
return ex.Message;
}
return "";
}
return "";
}
static List<SegmentProductionMin> GetUnSyncData(IDmoSession session)


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

@ -59,7 +59,9 @@
this.flowLayoutPanel2 = new System.Windows.Forms.FlowLayoutPanel();
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.flowLayoutPanel4 = new System.Windows.Forms.FlowLayoutPanel();
this.flowLayoutPanel3 = new System.Windows.Forms.FlowLayoutPanel();
this.colorButton3 = new ButcherFactory.Controls.ColorButton();
this.logBtn = new ButcherFactory.Controls.ColorButton();
this.closeBtn = new ButcherFactory.Controls.ColorButton();
this.uWeightControl1 = new ButcherFactory.Controls.WeightControl();
@ -199,6 +201,7 @@
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.colorButton3);
this.splitContainer1.Panel1.Controls.Add(this.numberInput);
this.splitContainer1.Panel1.Controls.Add(this.label2);
this.splitContainer1.Panel1.Controls.Add(this.statisticNumberBox);
@ -265,7 +268,7 @@
//
this.msglbl.AutoSize = true;
this.msglbl.ForeColor = System.Drawing.Color.Red;
this.msglbl.Location = new System.Drawing.Point(458, 14);
this.msglbl.Location = new System.Drawing.Point(388, 11);
this.msglbl.Name = "msglbl";
this.msglbl.Size = new System.Drawing.Size(101, 12);
this.msglbl.TabIndex = 24;
@ -401,6 +404,7 @@
//
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.flowLayoutPanel4);
this.groupBox1.Controls.Add(this.flowLayoutPanel3);
this.groupBox1.Controls.Add(this.uLabel3);
this.groupBox1.Location = new System.Drawing.Point(8, 222);
@ -410,27 +414,52 @@
this.groupBox1.TabIndex = 5;
this.groupBox1.TabStop = false;
//
// flowLayoutPanel4
//
this.flowLayoutPanel4.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.flowLayoutPanel4.Location = new System.Drawing.Point(5, 90);
this.flowLayoutPanel4.Name = "flowLayoutPanel4";
this.flowLayoutPanel4.Size = new System.Drawing.Size(437, 286);
this.flowLayoutPanel4.TabIndex = 5;
//
// flowLayoutPanel3
//
this.flowLayoutPanel3.AutoScroll = true;
this.flowLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Fill;
this.flowLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Top;
this.flowLayoutPanel3.Location = new System.Drawing.Point(5, 19);
this.flowLayoutPanel3.Margin = new System.Windows.Forms.Padding(0);
this.flowLayoutPanel3.Name = "flowLayoutPanel3";
this.flowLayoutPanel3.Size = new System.Drawing.Size(437, 357);
this.flowLayoutPanel3.Size = new System.Drawing.Size(437, 68);
this.flowLayoutPanel3.TabIndex = 4;
this.flowLayoutPanel3.WrapContents = false;
//
// colorButton3
//
this.colorButton3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.colorButton3.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));
this.colorButton3.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.colorButton3.ForeColor = System.Drawing.Color.White;
this.colorButton3.Location = new System.Drawing.Point(567, 4);
this.colorButton3.Name = "colorButton3";
this.colorButton3.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(15)))), ((int)(((byte)(215)))), ((int)(((byte)(107)))));
this.colorButton3.Size = new System.Drawing.Size(101, 41);
this.colorButton3.TabIndex = 30;
this.colorButton3.Text = "手工上传";
this.colorButton3.UseVisualStyleBackColor = false;
this.colorButton3.Click += new System.EventHandler(this.colorButton3_Click);
//
// 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.Location = new System.Drawing.Point(680, 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.Size = new System.Drawing.Size(101, 41);
this.logBtn.TabIndex = 25;
this.logBtn.Text = "日志";
this.logBtn.UseVisualStyleBackColor = false;
@ -612,5 +641,7 @@
private Controls.ColorButton colorButton1;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel3;
private Controls.ColorButton colorButton2;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel4;
private Controls.ColorButton colorButton3;
}
}

+ 114
- 36
ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.cs View File

@ -348,12 +348,29 @@ namespace ButcherFactory.SegmentProductionAuto_
entity.StatisticNumber = decimal.Parse(statisticNumberBox.Text);
TotalCode thisTotal = null;
CodePanel thisPanel;
ColorButton thisPanel;
bool rebuild = false;
if (entity.GoodsType == 0)
{
entity.TotalCode_ID = _freshTotalCode.ID;
thisTotal = _freshTotalCode;
thisPanel = _freshPanel;
if (_totalCode.GoodsType != 0)
{
foreach (var bt in codeButtons)
{
if (bt.Selected)
{
bt.Selected = false;
bt.Invalidate();
}
}
_codePanel = _freshPanel;
_codePanel.Selected = true;
_codePanel.Invalidate();
_totalCode = _freshTotalCode;
rebuild=true;
}
}
else
{
@ -375,9 +392,15 @@ namespace ButcherFactory.SegmentProductionAuto_
entity.Goods_Spec = detail.Goods_Spec;
entity.MainUnit = detail.MainUnit;
entity.ShotPrintName = detail.ShotPrintName;
thisPanel.Add(initSegmentBt(entity, thisPanel, thisTotal), true);
if(rebuild){
BindflowLayoutPanel(thisPanel, thisTotal);
}
var c = initSegmentBt(entity, thisPanel, thisTotal);
flowLayoutPanel4.Controls.Add(c);
flowLayoutPanel4.Controls.SetChildIndex(c, 0);
historyList.Insert(0, entity);
if (historyList.Count > 30)
@ -401,7 +424,7 @@ namespace ButcherFactory.SegmentProductionAuto_
SegmentProduction current;
ColorButton _labelBt;
private ColorButton initSegmentBt(SegmentProduction entity, CodePanel parent, TotalCode tCode)
private ColorButton initSegmentBt(SegmentProduction entity, ColorButton parent, TotalCode tCode)
{
var bt = new ColorButton() { Text = entity.ShortCode };
bt.Tag = entity;
@ -422,11 +445,11 @@ namespace ButcherFactory.SegmentProductionAuto_
GoodsLabel.Text = entity.Goods_Name;
if (_codePanel != null)
{
_codePanel.Button.Selected = false;
_codePanel.Button.Invalidate();
_codePanel. Selected = false;
_codePanel. Invalidate();
}
parent.Button.Selected = true;
parent.Button.Invalidate();
parent .Selected = true;
parent. Invalidate();
_totalCode = tCode;
_codePanel = parent;
}
@ -481,6 +504,7 @@ namespace ButcherFactory.SegmentProductionAuto_
{
flowLayoutPanel3.Controls.Clear();
codeButtons.Clear();
flowLayoutPanel4.Controls.Clear();
foreach (var item in allCode)
{
if (item.GoodsType == 0)
@ -494,14 +518,10 @@ namespace ButcherFactory.SegmentProductionAuto_
continue;
}
}
var details = historyList.Where(x => x.TotalCode_ID == item.ID);
var n = new CodePanel();
var n = new ColorButton();
AddCodeButton(n, item);
foreach (var seg in details)
{
n.Add(initSegmentBt(seg,n,item));
}
flowLayoutPanel3.Controls.Add(n);
}
}
@ -549,24 +569,42 @@ namespace ButcherFactory.SegmentProductionAuto_
foreach (var item2 in groupByTotal)
{
var d = item2.FirstOrDefault();
//鲜品不删除总码
if (d.GoodsType == 0)
{
if (_freshPanel != null)
{
var list=new List<ColorButton>();
foreach (var t in item2)
{
_freshPanel.RemoveBar(t.BarCode);
}
foreach (ColorButton item in flowLayoutPanel4.Controls)
{
var tagItem = (SegmentProduction)item.Tag;
if (tagItem.BarCode == t.BarCode)
{
list.Add(item) ;
break;
}
}
}
foreach (var item in list)
{
flowLayoutPanel4.Controls.Remove(item);
}
}
continue;
}
var f = codeButtons.FirstOrDefault(x => ((TotalCode)x.Tag).ID == item2.Key);
if (f != null)
{
flowLayoutPanel3.Controls.Remove(f.Parent);
flowLayoutPanel3.Controls.Remove(f);
codeButtons.Remove(f);
}
if (_codePanel != null && _totalCode.ID == item2.Key)
{
flowLayoutPanel4.Controls.Clear();
}
}
foreach (var item in tag)
@ -661,9 +699,14 @@ namespace ButcherFactory.SegmentProductionAuto_
MessageBox.Show("总码下已有条码,不允许直接删除总码");
return;
}
if (_totalCode.GoodsType == 0)
{
MessageBox.Show("鲜品总码不允许删除");
return;
}
SegmentProductionBL.DeleteTotalCode(_totalCode);
allCode.Remove(_totalCode);
codeButtons.Remove(_codePanel.Button);
codeButtons.Remove(_codePanel );
foreach (var item in deleteList)
{
historyList.Remove(item);
@ -676,9 +719,10 @@ namespace ButcherFactory.SegmentProductionAuto_
if (allCode.Count > 0)
{
_totalCode = allCode[0];
_codePanel = (CodePanel)flowLayoutPanel3.Controls[0];
_codePanel.Button.Selected = true;
_codePanel.Button.Invalidate();
_codePanel = (ColorButton)flowLayoutPanel3.Controls[0];
_codePanel.Selected = true;
_codePanel.Invalidate();
BindflowLayoutPanel(_codePanel, _totalCode);
}
else
{
@ -750,37 +794,39 @@ namespace ButcherFactory.SegmentProductionAuto_
}
}
}
CodePanel _codePanel;
CodePanel _freshPanel;
ColorButton _codePanel;
ColorButton _freshPanel;
TotalCode _totalCode;
TotalCode _freshTotalCode;
private void colorButton1_Click(object sender, EventArgs e)
{
var n = new CodePanel();
var n = new ColorButton();
var tCode = SegmentProductionBL.InsertTotalCode(new TotalCode());
allCode.Insert(0, tCode);
AddCodeButton(n, tCode,true);
flowLayoutPanel4.Controls.Clear();
flowLayoutPanel3.Controls.Add(n);
flowLayoutPanel3.Controls.SetChildIndex(n, 1);
}
private void AddCodeButton(CodePanel n, TotalCode tCode,bool add=false)
private void AddCodeButton(ColorButton n, TotalCode tCode, bool add = false)
{
n.Button.Tag = tCode;
n .Tag = tCode;
if (tCode.GoodsType == 0)
{
n.Button.Text ="鲜品";
n .Text ="鲜品";
_freshPanel = n;
}
else
n.Button.Text = tCode.ShortCode;
n.Button.Click += delegate
n .Text = tCode.ShortCode;
n .Click += delegate
{
n.Button.Selected = !n.Button.Selected;
if (n.Button.Selected)
n .Selected = !n.Selected;
if (n .Selected)
{
current = null;
_codePanel = n;
@ -791,15 +837,18 @@ namespace ButcherFactory.SegmentProductionAuto_
_labelBt.Invalidate();
}
_labelBt = null;
BindflowLayoutPanel(n, tCode);
}
else
{
flowLayoutPanel4.Controls.Clear();
_codePanel = null;
_totalCode = null;
}
foreach (var bt in codeButtons)
{
if (bt.Text != n.Button.Text && bt.Selected)
if (bt.Text != n.Text && bt.Selected)
{
bt.Selected = false;
bt.Invalidate();
@ -810,7 +859,7 @@ namespace ButcherFactory.SegmentProductionAuto_
if (add)
{
_codePanel = n;
n.Button.Selected = true;
n .Selected = true;
_totalCode = tCode;
foreach (var bt in codeButtons)
{
@ -821,7 +870,27 @@ namespace ButcherFactory.SegmentProductionAuto_
}
}
}
codeButtons.Add(n.Button);
n.BackColor = Color.LightGray;
n.Font = new Font("黑体", 16F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
n.ForeColor = Color.Black;
// n.Location = new Point(3, 3);
//n.Name = "Button";
n.SelectedColor = Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(255)))), ((int)(((byte)(128)))));
n.Size = new Size(99, 40);
//n.TabIndex = 1;
n.UseVisualStyleBackColor = false;
codeButtons.Add(n );
}
private void BindflowLayoutPanel(ColorButton tButton, TotalCode tCode)
{
var details = historyList.Where(x => x.TotalCode_ID == tCode.ID);
flowLayoutPanel4.Controls.Clear();
foreach (var d in details)
{
flowLayoutPanel4.Controls.Add(initSegmentBt(d, tButton, tCode));
}
}
private void colorButton2_Click(object sender, EventArgs e)
@ -844,5 +913,14 @@ namespace ButcherFactory.SegmentProductionAuto_
log.Message = string.Format("总码:{0} ", dmos[0].TotalCode_Code);
SegmentProductionBL.InsertLog(log);
}
private void colorButton3_Click(object sender, EventArgs e)
{
var msg= SegmentProductionBL.UploadSegmentInfo(true);
if (!string.IsNullOrEmpty(msg))
{
MessageBox.Show(msg);
}
}
}
}

Loading…
Cancel
Save