Browse Source

wanfu xuqiu

master
robin 4 years ago
parent
commit
4194b65e03
16 changed files with 849 additions and 80 deletions
  1. +5
    -1
      ButcherFactory.BO/BaseInfo/ClientGoodsSet.cs
  2. +2
    -1
      ButcherFactory.BO/BaseInfo/Goods.cs
  3. +9
    -0
      ButcherFactory.BO/Bill/SegmentProduction.cs
  4. +4
    -2
      ButcherFactory.BO/LocalBL/FormClientGoodsSetBL.cs
  5. +22
    -13
      ButcherFactory.Form/ButcherFactory.Form.csproj
  6. +60
    -0
      ButcherFactory.Form/Controls/CircleButton.cs
  7. +1
    -1
      ButcherFactory.Form/Controls/ColorButton.cs
  8. +75
    -0
      ButcherFactory.Form/Controls/UserControl1.Designer.cs
  9. +20
    -0
      ButcherFactory.Form/Controls/UserControl1.cs
  10. +120
    -0
      ButcherFactory.Form/Controls/UserControl1.resx
  11. +1
    -1
      ButcherFactory.Form/SegmentInStore_/SegmentInStoreForm.cs
  12. +132
    -61
      ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.cs
  13. +148
    -0
      ButcherFactory.Form/SegmentProductionAuto_/WeightView.Designer.cs
  14. +123
    -0
      ButcherFactory.Form/SegmentProductionAuto_/WeightView.cs
  15. +123
    -0
      ButcherFactory.Form/SegmentProductionAuto_/WeightView.resx
  16. +4
    -0
      ButcherFactory.Login/ButcherFactory.Login.csproj

+ 5
- 1
ButcherFactory.BO/BaseInfo/ClientGoodsSet.cs View File

@ -47,7 +47,11 @@ namespace ButcherFactory.BO
[ReferenceTo(typeof(Goods), "ShotPrintName")]
[Join("Goods_ID", "ID")]
public string ShotPrintName { get; set; }
public string ShotPrintName { get; set; }
[ReferenceTo(typeof(Goods), "EachNumber")]
[Join("Goods_ID", "ID")]
public int? EachNumber { get; set; }
public decimal? StandardWeight { get; set; }


+ 2
- 1
ButcherFactory.BO/BaseInfo/Goods.cs View File

@ -24,6 +24,7 @@ namespace ButcherFactory.BO
public short? GoodsType { get; set; }
public string ShotPrintName { get; set; }
public string ShotPrintName { get; set; }
public int? EachNumber { get; set; }
}
}

+ 9
- 0
ButcherFactory.BO/Bill/SegmentProduction.cs View File

@ -149,4 +149,13 @@ namespace ButcherFactory.BO
}
}
}
public class WeightDetail
{
public int No { get; set; }
public decimal Weight { get; set; }
}
}

+ 4
- 2
ButcherFactory.BO/LocalBL/FormClientGoodsSetBL.cs View File

@ -70,7 +70,8 @@ namespace ButcherFactory.BO.LocalBL
query.Columns.Add(DQSelectColumn.Field("GoodsType", detail));
query.Columns.Add(DQSelectColumn.Field("StandardPic", detail));
query.Columns.Add(DQSelectColumn.Field("MainUnit", detail));
query.Columns.Add(DQSelectColumn.Field("ShotPrintName", detail));
query.Columns.Add(DQSelectColumn.Field("ShotPrintName", detail));
query.Columns.Add(DQSelectColumn.Field("EachNumber", detail));
query.OrderBy.Expressions.Add(DQOrderByExpression.Create(main, "ID"));
query.OrderBy.Expressions.Add(DQOrderByExpression.Create(detail, "ID"));
@ -94,7 +95,8 @@ namespace ButcherFactory.BO.LocalBL
entity.GoodsType = (short?)reader[8];
entity.StandardPic = (bool)reader[9];
entity.MainUnit = (string)reader[10];
entity.ShotPrintName = (string)reader[11];
entity.ShotPrintName = (string)reader[11];
entity.EachNumber = (int?)reader[12];
if (result.ContainsKey(key))
result[key].Add(entity);
else


+ 22
- 13
ButcherFactory.Form/ButcherFactory.Form.csproj View File

@ -36,10 +36,7 @@
<ItemGroup>
<Reference Include="BwpClientPrint, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\tsref\Debug\BwpClientPrint.dll</HintPath>
</Reference>
<Reference Include="HidLibrary">
<HintPath>..\..\WinFormControl\HidLibrary\bin\Release\HidLibrary.dll</HintPath>
<HintPath>..\ButcherFactory.Login\bin\Debug\BwpClientPrint.dll</HintPath>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
@ -78,6 +75,9 @@
<Compile Include="CarcassSaleOut2_\CarcassSaleOutReadForm.Designer.cs">
<DependentUpon>CarcassSaleOutReadForm.cs</DependentUpon>
</Compile>
<Compile Include="Controls\CircleButton.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Controls\ColorButton.cs">
<SubType>Component</SubType>
</Compile>
@ -96,6 +96,12 @@
<Compile Include="Controls\RoundPanel.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Controls\UserControl1.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Controls\UserControl1.Designer.cs">
<DependentUpon>UserControl1.cs</DependentUpon>
</Compile>
<Compile Include="Controls\Utils\AoHaoSi3000DataFormat.cs" />
<Compile Include="Controls\Utils\DataFormatBase.cs" />
<Compile Include="Controls\Utils\IND560DataFormat.cs" />
@ -199,12 +205,6 @@
<Compile Include="SegmentInStore_\InStoreSummaryView.Designer.cs">
<DependentUpon>InStoreSummaryView.cs</DependentUpon>
</Compile>
<Compile Include="SegmentInStore_\SegmentInStoreForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="SegmentInStore_\SegmentInStoreForm.Designer.cs">
<DependentUpon>SegmentInStoreForm.cs</DependentUpon>
</Compile>
<Compile Include="SegmentInStore_\SegmentInStoreFormConfig.cs" />
<Compile Include="SegmentPickUp_\SegmentPickUpConfig.cs" />
<Compile Include="SegmentPickUp_\SegmentPickUpForm.cs">
@ -237,6 +237,12 @@
<Compile Include="SegmentProductionAuto_\ViewTaskForm.Designer.cs">
<DependentUpon>ViewTaskForm.cs</DependentUpon>
</Compile>
<Compile Include="SegmentProductionAuto_\WeightView.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="SegmentProductionAuto_\WeightView.Designer.cs">
<DependentUpon>WeightView.cs</DependentUpon>
</Compile>
<Compile Include="SegmentProduction_\SegmentProductionForm.cs">
<SubType>Form</SubType>
</Compile>
@ -336,6 +342,9 @@
<EmbeddedResource Include="Controls\InfoBox.resx">
<DependentUpon>InfoBox.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Controls\UserControl1.resx">
<DependentUpon>UserControl1.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Controls\WeightControl.resx">
<DependentUpon>WeightControl.cs</DependentUpon>
</EmbeddedResource>
@ -382,9 +391,6 @@
<EmbeddedResource Include="SegmentInStore_\InStoreSummaryView.resx">
<DependentUpon>InStoreSummaryView.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="SegmentInStore_\SegmentInStoreForm.resx">
<DependentUpon>SegmentInStoreForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="SegmentPickUp_\SegmentPickUpForm.resx">
<DependentUpon>SegmentPickUpForm.cs</DependentUpon>
</EmbeddedResource>
@ -400,6 +406,9 @@
<EmbeddedResource Include="SegmentProductionAuto_\ViewTaskForm.resx">
<DependentUpon>ViewTaskForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="SegmentProductionAuto_\WeightView.resx">
<DependentUpon>WeightView.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="SegmentProduction_\SegmentProductionForm.resx">
<DependentUpon>SegmentProductionForm.cs</DependentUpon>
</EmbeddedResource>


+ 60
- 0
ButcherFactory.Form/Controls/CircleButton.cs View File

@ -0,0 +1,60 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
using System.Windows.Forms;
namespace ButcherFactory.Controls
{
public class CircleButton : System.Windows.Forms.Button
{
public CircleButton()
{
this.SetStyle(ControlStyles.AllPaintingInWmPaint |
ControlStyles.DoubleBuffer |
ControlStyles.UserPaint, true);
this.ForeColor = Color.White;
this.BackColor = Color.DeepSkyBlue;
}
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
System.Drawing.Drawing2D.GraphicsPath path = new System.Drawing.Drawing2D.GraphicsPath();
path.AddEllipse(2, 2, this.Width - 6, this.Height - 6);
Graphics g = e.Graphics;
g.DrawEllipse(new Pen(Color.Black, 2), 2, 2, Width - 6, Height - 6);
Region = new Region(path);
}
private int _minCount = 0;
public int MinCount
{
get { return _minCount; }
set {
if (value > _maxCount)
{
value = 1;
}
_minCount = value;
this.Text = string.Format("{0}-{1}", _maxCount, _minCount);
}
}
private int _maxCount = 1;
public int MaxCount
{
get { return _maxCount; }
set {
_maxCount = value;
this.Text = string.Format("{0}-{1}", _minCount, _minCount);
}
}
}
}

+ 1
- 1
ButcherFactory.Form/Controls/ColorButton.cs View File

@ -11,7 +11,7 @@ using WinFormControl;
namespace ButcherFactory.Controls
{
class ColorButton : System.Windows.Forms.Button
public class ColorButton : System.Windows.Forms.Button
{
public ColorButton()
{


+ 75
- 0
ButcherFactory.Form/Controls/UserControl1.Designer.cs View File

@ -0,0 +1,75 @@
namespace ButcherFactory.Controls
{
partial class ButtonTag
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region 组件设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.Label = new ButcherFactory.Controls.CircleButton();
this.Button = new ButcherFactory.Controls.ColorButton();
this.SuspendLayout();
//
// Tag
//
this.Label.BackColor = System.Drawing.Color.DeepSkyBlue;
this.Label.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.Label.ForeColor = System.Drawing.Color.White;
this.Label.Location = new System.Drawing.Point(111, 0);
this.Label.Name = "Tag";
this.Label.Size = new System.Drawing.Size(36, 33);
this.Label.TabIndex = 1;
this.Label.UseVisualStyleBackColor = false;
//
// Button
//
this.Button.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(77)))), ((int)(((byte)(135)))), ((int)(((byte)(245)))));
this.Button.ForeColor = System.Drawing.Color.White;
this.Button.Location = new System.Drawing.Point(0, 0);
this.Button.Name = "Button";
this.Button.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(15)))), ((int)(((byte)(215)))), ((int)(((byte)(107)))));
this.Button.Size = new System.Drawing.Size(140, 90);
this.Button.TabIndex = 2;
this.Button.UseVisualStyleBackColor = false;
//
// ButtonTag
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.Label);
this.Controls.Add(this.Button);
this.Name = "ButtonTag";
this.Size = new System.Drawing.Size(147, 90);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
public ColorButton Button;
public CircleButton Label;
}
}

+ 20
- 0
ButcherFactory.Form/Controls/UserControl1.cs View File

@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ButcherFactory.Controls
{
public partial class ButtonTag : UserControl
{
public ButtonTag()
{
InitializeComponent();
}
}
}

+ 120
- 0
ButcherFactory.Form/Controls/UserControl1.resx View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

+ 1
- 1
ButcherFactory.Form/SegmentInStore_/SegmentInStoreForm.cs View File

@ -38,7 +38,7 @@ namespace ButcherFactory.SegmentInStore_
BindingList<SegmentInStore> unInstoreList;
BindingList<SegmentCodeError> exceptionList;
BindingList<SegmentInStore> backStoreList;
private static Scanner1902 _scanner;
private static Scanner1902 _scanner;
long? storeID;
bool isBack = false;


+ 132
- 61
ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.cs View File

@ -168,19 +168,85 @@ namespace ButcherFactory.SegmentProductionAuto_
}
Color goodsColor = Color.FromArgb(250, 120, 24);
string groupKey = string.Empty;
void GroupGoodsSetClick(object sender, EventArgs e)
{
flowLayoutPanel2.Controls.Clear();
var groupBtn = sender as ColorButton;
groupKey = groupBtn.Text;
var arr = goodsSetDic[groupKey];
foreach (var item in arr)
{
var btn = new ColorButton() { Width = 140, Height = 90, Text = item.Goods_Name, Tag = item, Font = new Font("黑体", 15, FontStyle.Bold), BackColor = Color.Black, Margin = new Padding(20, 10, 20, 35), PlaySound = true, ForeColor = Color.White };
btn.Click += GoodsBtnClick;
flowLayoutPanel2.Controls.Add(btn);
}
string groupKey = string.Empty;
public Dictionary<long, List<decimal>> wDic = new Dictionary<long, List<decimal>>();
void GroupGoodsSetClick(object sender, EventArgs e)
{
flowLayoutPanel2.Controls.Clear();
var groupBtn = sender as ColorButton;
groupKey = groupBtn.Text;
var arr = goodsSetDic[groupKey];
int i = 0;
foreach (var item in arr)
{
var bTag = new ButtonTag();
if ((item.EachNumber ?? 0) > 0)
{
bTag.Label.MaxCount = item.EachNumber.Value;
bTag.Label.Text = string.Format("{0}-0", item.EachNumber.Value);
bTag.Button.Click += delegate
{
if (batchID == null)
throw new Exception("请先选择批次");
var weight = uWeightControl1.Weight;
if (weight == 0)
throw new Exception("重量不能为0");
if (item.StandardWeight.HasValue)
{
if (weight < (item.StandardWeightLow ?? 0) || weight > (item.StandardWeightUp ?? 0))
throw new Exception(string.Format("重量必须在{0:#0.######}-{1:#0.######}之间", item.StandardWeightLow, item.StandardWeightUp));
weight = item.StandardWeight.Value;
}
List<decimal> l = null;
if (wDic.ContainsKey(item.Goods_ID))
{
l = wDic[item.Goods_ID];
if (l.Count >= item.EachNumber.Value)
{
l.Clear();
}
l.Add(weight);
}
else
{
wDic.Add(item.Goods_ID, l = new List<decimal>() { weight });
}
bTag.Label.MinCount = l.Count();
if (l.Count >= item.EachNumber.Value)
{
weight = l.Sum(x => x);
InsertSegmentProduction(item, weight);
}
};
bTag.Label.Click += delegate
{
List<decimal> l = new List<decimal>(0);
if (wDic.ContainsKey(item.Goods_ID))
{
l = wDic[item.Goods_ID];
}
new WeightView(this, bTag).ShowDialog();
};
}
else
{
bTag.Label.Visible = false;
bTag.Button.Click += GoodsBtnClick;
}
bTag.Button.Tag = item;
bTag.Button.Text = item.Goods_Name;
bTag.Button.Font = new Font("黑体", 15, FontStyle.Bold);
bTag.Button.BackColor = Color.Black;
bTag.Button.Margin = new Padding(20, 10, 20, 35);
bTag.Button.PlaySound = true;
bTag.Button.ForeColor = Color.White;
bTag.Button.Width = 140;
bTag.Button.Height = 90;
flowLayoutPanel2.Controls.Add(bTag);
i++;
}
}
void GoodsBtnClick(object sender, EventArgs e)
@ -189,58 +255,63 @@ namespace ButcherFactory.SegmentProductionAuto_
throw new Exception("请先选择批次");
var btn = sender as ColorButton;
var detail = btn.Tag as ClientGoodsSet_Detail;
var weight = uWeightControl1.Weight;
if (weight == 0)
throw new Exception("重量不能为0");
if (detail.StandardWeight.HasValue)
{
if (weight < (detail.StandardWeightLow ?? 0) || weight > (detail.StandardWeightUp ?? 0))
throw new Exception(string.Format("重量必须在{0:#0.######}-{1:#0.######}之间", detail.StandardWeightLow, detail.StandardWeightUp));
weight = detail.StandardWeight.Value;
}
var pics = int.Parse(numberInput.Text);
if (pics <= 0)
pics = 1;
else if (pics > 50)
pics = 50;
SegmentProduction entity = null;
for (var i = 0; i < pics; i++)
var weight = uWeightControl1.Weight;
if (weight == 0)
throw new Exception("重量不能为0");
if (detail.StandardWeight.HasValue)
{
entity = new SegmentProduction();
entity.Goods_ID = detail.Goods_ID;
entity.Weight = weight;
entity.WorkUnit_ID = config.WorkUnitID;
entity.ProductBatch_ID = batchID.Value;
entity.StandardPic = detail.StandardPic;
if (!string.IsNullOrEmpty(statisticNumberBox.Text))
entity.StatisticNumber = decimal.Parse(statisticNumberBox.Text);
SegmentProductionBL.InsertAndSetGroupID(entity, batchDate.Value);
entity.Goods_Code = detail.Goods_Code;
entity.Goods_Name = detail.Goods_Name;
entity.Goods_Spec = detail.Goods_Spec;
entity.MainUnit = detail.MainUnit;
entity.ShotPrintName = detail.ShotPrintName;
if (weight < (detail.StandardWeightLow ?? 0) || weight > (detail.StandardWeightUp ?? 0))
throw new Exception(string.Format("重量必须在{0:#0.######}-{1:#0.######}之间", detail.StandardWeightLow, detail.StandardWeightUp));
weight = detail.StandardWeight.Value;
}
InsertSegmentProduction(detail, weight);
}
historyList.Insert(0, entity);
if (historyList.Count > 30)
historyList.RemoveAt(30);
if (barPrintCheck.Checked)
private void InsertSegmentProduction(ClientGoodsSet_Detail detail, decimal weight)
{
var pics = int.Parse(numberInput.Text);
if (pics <= 0)
pics = 1;
else if (pics > 50)
pics = 50;
SegmentProduction entity = null;
for (var i = 0; i < pics; i++)
{
var template = config.Template;
if (detail.GoodsType.HasValue)
template = detail.GoodsType == 0 ? "SegmentProductionPrint.html" : "SegmentProductionPrint1.html";
NotAuto.SegmentProductionPrint.Print(entity, batchDate, template);
var log = new SegmentLog(entity.BarCode, "打印");
log.Message = string.Format("存货名称:{0} 重量:{1:#0.###}", entity.Goods_Name, entity.Weight);
SegmentProductionBL.InsertLog(log);
entity = new SegmentProduction();
entity.Goods_ID = detail.Goods_ID;
entity.Weight = weight;
entity.WorkUnit_ID = config.WorkUnitID;
entity.ProductBatch_ID = batchID.Value;
entity.StandardPic = detail.StandardPic;
if (!string.IsNullOrEmpty(statisticNumberBox.Text))
entity.StatisticNumber = decimal.Parse(statisticNumberBox.Text);
SegmentProductionBL.InsertAndSetGroupID(entity, batchDate.Value);
entity.Goods_Code = detail.Goods_Code;
entity.Goods_Name = detail.Goods_Name;
entity.Goods_Spec = detail.Goods_Spec;
entity.MainUnit = detail.MainUnit;
entity.ShotPrintName = detail.ShotPrintName;
historyList.Insert(0, entity);
if (historyList.Count > 30)
historyList.RemoveAt(30);
if (barPrintCheck.Checked)
{
var template = config.Template;
if (detail.GoodsType.HasValue)
template = detail.GoodsType == 0 ? "SegmentProductionPrint.html" : "SegmentProductionPrint1.html";
NotAuto.SegmentProductionPrint.Print(entity, batchDate, template);
var log = new SegmentLog(entity.BarCode, "打印");
log.Message = string.Format("存货名称:{0} 重量:{1:#0.###}", entity.Goods_Name, entity.Weight);
SegmentProductionBL.InsertLog(log);
}
}
}
GoodsLabel.Text = detail.Goods_Name;
historyDataGrid.FirstDisplayedScrollingRowIndex = 0;
historyDataGrid.ClearSelection();
historyDataGrid.Refresh();
var thd = new Thread(new ParameterizedThreadStart(RefreshTask));
thd.Start(entity);
GoodsLabel.Text = detail.Goods_Name;
historyDataGrid.FirstDisplayedScrollingRowIndex = 0;
historyDataGrid.ClearSelection();
historyDataGrid.Refresh();
var thd = new Thread(new ParameterizedThreadStart(RefreshTask));
thd.Start(entity);
}
void RefreshTask(object obj)


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

@ -0,0 +1,148 @@
namespace ButcherFactory.SegmentProductionAuto_
{
partial class WeightView
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
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 dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
this.taskGrid = new WinFormControl.UDataGridView();
this.label1 = new System.Windows.Forms.Label();
this.I_No = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.I_Weight = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.deleteBtn = new ButcherFactory.Controls.ColorButton();
((System.ComponentModel.ISupportInitialize)(this.taskGrid)).BeginInit();
this.SuspendLayout();
//
// taskGrid
//
this.taskGrid.AllowUserToAddRows = false;
this.taskGrid.AllowUserToDeleteRows = false;
this.taskGrid.AllowUserToResizeColumns = false;
this.taskGrid.AllowUserToResizeRows = false;
dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.taskGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
this.taskGrid.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.taskGrid.BackgroundColor = System.Drawing.Color.White;
this.taskGrid.BorderStyle = System.Windows.Forms.BorderStyle.None;
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle2.Font = new System.Drawing.Font("宋体", 12F);
dataGridViewCellStyle2.ForeColor = System.Drawing.Color.White;
dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.taskGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;
this.taskGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.taskGrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.I_No,
this.I_Weight});
this.taskGrid.Location = new System.Drawing.Point(12, 63);
this.taskGrid.MultiSelect = false;
this.taskGrid.Name = "taskGrid";
this.taskGrid.ReadOnly = true;
this.taskGrid.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.taskGrid.RowsDefaultCellStyle = dataGridViewCellStyle4;
this.taskGrid.RowTemplate.Height = 23;
this.taskGrid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.taskGrid.Size = new System.Drawing.Size(263, 184);
this.taskGrid.TabIndex = 13;
this.taskGrid.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.taskGrid_CellContentClick);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("宋体", 13F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label1.ForeColor = System.Drawing.Color.Red;
this.label1.Location = new System.Drawing.Point(12, 9);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(17, 18);
this.label1.TabIndex = 14;
this.label1.Text = " ";
//
// I_No
//
this.I_No.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.I_No.DataPropertyName = "No";
this.I_No.FillWeight = 150F;
this.I_No.HeaderText = "序号";
this.I_No.Name = "I_No";
this.I_No.ReadOnly = true;
//
// I_Weight
//
this.I_Weight.DataPropertyName = "Weight";
dataGridViewCellStyle3.Format = "#0.######";
this.I_Weight.DefaultCellStyle = dataGridViewCellStyle3;
this.I_Weight.HeaderText = "重量";
this.I_Weight.Name = "I_Weight";
this.I_Weight.ReadOnly = true;
this.I_Weight.Width = 120;
//
// deleteBtn
//
this.deleteBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.deleteBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(25)))));
this.deleteBtn.Font = new System.Drawing.Font("宋体", 15F);
this.deleteBtn.ForeColor = System.Drawing.Color.White;
this.deleteBtn.Location = new System.Drawing.Point(164, 16);
this.deleteBtn.Name = "deleteBtn";
this.deleteBtn.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(158)))), ((int)(((byte)(234)))), ((int)(((byte)(106)))));
this.deleteBtn.Size = new System.Drawing.Size(111, 41);
this.deleteBtn.TabIndex = 24;
this.deleteBtn.Text = "删除";
this.deleteBtn.UseVisualStyleBackColor = false;
this.deleteBtn.Click += new System.EventHandler(this.deleteBtn_Click);
//
// WeightView
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(287, 259);
this.Controls.Add(this.deleteBtn);
this.Controls.Add(this.label1);
this.Controls.Add(this.taskGrid);
this.Name = "WeightView";
this.Text = "称重明细";
((System.ComponentModel.ISupportInitialize)(this.taskGrid)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private WinFormControl.UDataGridView taskGrid;
private System.Windows.Forms.DataGridViewTextBoxColumn I_No;
private System.Windows.Forms.DataGridViewTextBoxColumn I_Weight;
private System.Windows.Forms.Label label1;
private Controls.ColorButton deleteBtn;
}
}

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

@ -0,0 +1,123 @@
using ButcherFactory.BO;
using ButcherFactory.Controls;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ButcherFactory.SegmentProductionAuto_
{
public partial class WeightView : Form
{
BindingList<WeightDetail> list;
ClientGoodsSet_Detail goods;
private SegmentProductionAutoForm form;
private ButtonTag bTag;
public WeightView()
{
InitializeComponent();
taskGrid.RowPrePaint += uDataGridView1_RowPrePaint;
taskGrid.CellPainting += uDataGridView1_CellPainting;
}
public WeightView(SegmentProductionAutoForm form, ButtonTag bTag)
: this()
{
this.bTag = bTag;
this.form = form;
goods = ((ClientGoodsSet_Detail)bTag.Button.Tag);
label1.Text = goods.Goods_Name;
list = new BindingList<WeightDetail>();
var l = new List<decimal>(0);
if (form.wDic.ContainsKey(goods.Goods_ID))
{
l = form.wDic[goods.Goods_ID];
}
int i = 1;
foreach (var item in l)
{
list.Add(new WeightDetail { No = i, Weight = item });
i++;
}
}
private void uDataGridView1_RowPrePaint(object sender, DataGridViewRowPrePaintEventArgs e)
{
//if (e.RowIndex == taskGrid.Rows.Count - 1)
//{
// var row = taskGrid.Rows[e.RowIndex];
// row.DefaultCellStyle.SelectionForeColor = Color.Black;
// row.DefaultCellStyle.BackColor = Color.Khaki;
// row.DefaultCellStyle.SelectionBackColor = Color.Khaki;
//}
}
private void uDataGridView1_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
{
var last = taskGrid.Rows.Count - 1;
if (e.RowIndex == last)
{
if (e.ColumnIndex == 0)
{
}
}
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
taskGrid.DataSource = list;
taskGrid.Refresh();
}
private void CloseBtn_Click(object sender, EventArgs e)
{
this.Close();
}
private void taskGrid_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
}
private void deleteBtn_Click(object sender, EventArgs e)
{
var row = taskGrid.SelectedRows;
if (row.Count == 0)
return;
if (MessageBox.Show("确定删除选中记录?", "删除确认", MessageBoxButtons.OKCancel) != DialogResult.OK)
return;
var tag = taskGrid.SelectedRows[0].DataBoundItem as WeightDetail;
if (form.wDic.ContainsKey(goods.Goods_ID))
{
var l = form.wDic[goods.Goods_ID];
l.RemoveAt(tag.No - 1);
bTag.Label.MinCount = l.Count;
}
list.Remove(tag);
int i = 1;
foreach (var item in list)
{
item.No = i;
i++;
}
taskGrid.DataSource = list;
taskGrid.ClearSelection();
taskGrid.Refresh();
}
}
}

+ 123
- 0
ButcherFactory.Form/SegmentProductionAuto_/WeightView.resx View File

@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="I_Weight.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>

+ 4
- 0
ButcherFactory.Login/ButcherFactory.Login.csproj View File

@ -94,6 +94,10 @@
<Project>{b258c523-269c-4ed7-ab71-7196d5d2ef65}</Project>
<Name>ButcherFactory.BO</Name>
</ProjectReference>
<ProjectReference Include="..\ButcherFactory.Form\ButcherFactory.Form.csproj">
<Project>{2485631b-624c-43e0-9287-86fa1c8485fc}</Project>
<Name>ButcherFactory.Form</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.


Loading…
Cancel
Save