Browse Source

需求单No.157837“分割车间称重计数”客户端调整 客户端本地增加1个配置文件,可配置{编码}=x1、x2 对应的MES【存货】

master
yibo 4 years ago
parent
commit
c0772b95bc
8 changed files with 377 additions and 1 deletions
  1. +23
    -0
      ButcherFactory.BO/Bill/SegmentProduction.cs
  2. +9
    -0
      ButcherFactory.BO/LocalBL/SegmentProductionBL.cs
  3. +11
    -1
      ButcherFactory.BO/Utils/XmlUtil.cs
  4. +9
    -0
      ButcherFactory.Form/ButcherFactory.Form.csproj
  5. +125
    -0
      ButcherFactory.Form/SegmentProductionAuto_/GoodsNumberInputDialog.Designer.cs
  6. +68
    -0
      ButcherFactory.Form/SegmentProductionAuto_/GoodsNumberInputDialog.cs
  7. +120
    -0
      ButcherFactory.Form/SegmentProductionAuto_/GoodsNumberInputDialog.resx
  8. +12
    -0
      ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.cs

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

@ -119,6 +119,29 @@ namespace ButcherFactory.BO
public string Action { get; set; } public string Action { get; set; }
public DateTime Time { get; set; } public DateTime Time { get; set; }
}
[MapToTable("Butcher_SegmentGoodsProductNumLog")]
[KeyField("ID", KeyGenType.identity)]
public class SegmentGoodsProductNumLog
{
public long ID { get; set; }
public long Goods_ID { get; set; }
public string Goods_Code { get; set; }
public int Number { get; set; }
private DateTime mTime = DateTime.Now;
[DbColumn(DbType = SqlDbType.DateTime)]
public DateTime Time
{
get { return mTime; }
set { mTime = value; }
}
public string Goods_Name { get; set; }
} }
public class ProductTask public class ProductTask


+ 9
- 0
ButcherFactory.BO/LocalBL/SegmentProductionBL.cs View File

@ -677,6 +677,15 @@ namespace ButcherFactory.BO.LocalBL
var query = new DmoQuery(typeof(GoodsIdentify)); var query = new DmoQuery(typeof(GoodsIdentify));
return query.EExecuteList().Cast<GoodsIdentify>().ToList(); return query.EExecuteList().Cast<GoodsIdentify>().ToList();
} }
public static void InsertProductNumLog(SegmentGoodsProductNumLog log)
{
using (var session = DmoSession.New())
{
session.Insert(log);
session.Commit();
}
}
} }
class SegmentProductionMin class SegmentProductionMin


+ 11
- 1
ButcherFactory.BO/Utils/XmlUtil.cs View File

@ -55,7 +55,7 @@ namespace ButcherFactory.BO.Utils
} }
} }
public static T XmlDeserializeObject<T>(string xmlOfObject) where T : class,new()
public static T XmlDeserializeObject<T>(string xmlOfObject) where T : class, new()
{ {
using (MemoryStream ms = new MemoryStream()) using (MemoryStream ms = new MemoryStream())
{ {
@ -76,5 +76,15 @@ namespace ButcherFactory.BO.Utils
} }
} }
} }
public static string ReadAllText(string fileName)
{
var path = Path.Combine(config, fileName);
if (File.Exists(path))
{
return File.ReadAllText(path);
}
return null;
}
} }
} }

+ 9
- 0
ButcherFactory.Form/ButcherFactory.Form.csproj View File

@ -229,6 +229,12 @@
<Compile Include="SegmentPickUp_\SegmentPickUpForm.Designer.cs"> <Compile Include="SegmentPickUp_\SegmentPickUpForm.Designer.cs">
<DependentUpon>SegmentPickUpForm.cs</DependentUpon> <DependentUpon>SegmentPickUpForm.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="SegmentProductionAuto_\GoodsNumberInputDialog.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="SegmentProductionAuto_\GoodsNumberInputDialog.Designer.cs">
<DependentUpon>GoodsNumberInputDialog.cs</DependentUpon>
</Compile>
<Compile Include="SegmentProductionAuto_\IdentifySelectionDialog.cs"> <Compile Include="SegmentProductionAuto_\IdentifySelectionDialog.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
@ -424,6 +430,9 @@
<EmbeddedResource Include="SegmentPickUp_\SegmentPickUpForm.resx"> <EmbeddedResource Include="SegmentPickUp_\SegmentPickUpForm.resx">
<DependentUpon>SegmentPickUpForm.cs</DependentUpon> <DependentUpon>SegmentPickUpForm.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="SegmentProductionAuto_\GoodsNumberInputDialog.resx">
<DependentUpon>GoodsNumberInputDialog.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="SegmentProductionAuto_\IdentifySelectionDialog.resx"> <EmbeddedResource Include="SegmentProductionAuto_\IdentifySelectionDialog.resx">
<DependentUpon>IdentifySelectionDialog.cs</DependentUpon> <DependentUpon>IdentifySelectionDialog.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>


+ 125
- 0
ButcherFactory.Form/SegmentProductionAuto_/GoodsNumberInputDialog.Designer.cs View File

@ -0,0 +1,125 @@

namespace ButcherFactory.SegmentProductionAuto_
{
partial class GoodsNumberInputDialog
{
/// <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()
{
this.okBtn = new ButcherFactory.Controls.ColorButton();
this.cancelBtn = new ButcherFactory.Controls.ColorButton();
this.goodsNameLbl = new System.Windows.Forms.Label();
this.identityRemark = new System.Windows.Forms.Label();
this.numberBox = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// okBtn
//
this.okBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(77)))), ((int)(((byte)(135)))), ((int)(((byte)(245)))));
this.okBtn.Font = new System.Drawing.Font("微软雅黑", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.okBtn.ForeColor = System.Drawing.Color.White;
this.okBtn.Location = new System.Drawing.Point(66, 194);
this.okBtn.Name = "okBtn";
this.okBtn.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(15)))), ((int)(((byte)(215)))), ((int)(((byte)(107)))));
this.okBtn.Size = new System.Drawing.Size(140, 56);
this.okBtn.TabIndex = 1;
this.okBtn.Text = "确定";
this.okBtn.UseVisualStyleBackColor = false;
this.okBtn.Click += new System.EventHandler(this.okBtn_Click);
//
// cancelBtn
//
this.cancelBtn.BackColor = System.Drawing.Color.Red;
this.cancelBtn.Font = new System.Drawing.Font("微软雅黑", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.cancelBtn.ForeColor = System.Drawing.Color.White;
this.cancelBtn.Location = new System.Drawing.Point(298, 194);
this.cancelBtn.Name = "cancelBtn";
this.cancelBtn.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(15)))), ((int)(((byte)(215)))), ((int)(((byte)(107)))));
this.cancelBtn.Size = new System.Drawing.Size(137, 56);
this.cancelBtn.TabIndex = 2;
this.cancelBtn.Text = "取消";
this.cancelBtn.UseVisualStyleBackColor = false;
this.cancelBtn.Click += new System.EventHandler(this.cancelBtn_Click);
//
// goodsNameLbl
//
this.goodsNameLbl.AutoSize = true;
this.goodsNameLbl.Font = new System.Drawing.Font("微软雅黑", 17F, System.Drawing.FontStyle.Bold);
this.goodsNameLbl.ForeColor = System.Drawing.Color.DeepSkyBlue;
this.goodsNameLbl.Location = new System.Drawing.Point(29, 22);
this.goodsNameLbl.Name = "goodsNameLbl";
this.goodsNameLbl.Size = new System.Drawing.Size(83, 31);
this.goodsNameLbl.TabIndex = 5;
this.goodsNameLbl.Text = "冻带皮";
//
// identityRemark
//
this.identityRemark.AutoSize = true;
this.identityRemark.Font = new System.Drawing.Font("微软雅黑", 14F);
this.identityRemark.ForeColor = System.Drawing.Color.Black;
this.identityRemark.Location = new System.Drawing.Point(105, 101);
this.identityRemark.Name = "identityRemark";
this.identityRemark.Size = new System.Drawing.Size(50, 25);
this.identityRemark.TabIndex = 6;
this.identityRemark.Text = "件数";
//
// numberBox
//
this.numberBox.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.numberBox.Location = new System.Drawing.Point(200, 99);
this.numberBox.Name = "numberBox";
this.numberBox.Size = new System.Drawing.Size(194, 29);
this.numberBox.TabIndex = 7;
this.numberBox.Click += new System.EventHandler(this.numberBox_Click);
//
// GoodsNumberInputDialog
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(532, 290);
this.Controls.Add(this.numberBox);
this.Controls.Add(this.identityRemark);
this.Controls.Add(this.goodsNameLbl);
this.Controls.Add(this.cancelBtn);
this.Controls.Add(this.okBtn);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Name = "GoodsNumberInputDialog";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "产品件数录入";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private Controls.ColorButton okBtn;
private Controls.ColorButton cancelBtn;
private System.Windows.Forms.Label goodsNameLbl;
private System.Windows.Forms.Label identityRemark;
private System.Windows.Forms.TextBox numberBox;
}
}

+ 68
- 0
ButcherFactory.Form/SegmentProductionAuto_/GoodsNumberInputDialog.cs View File

@ -0,0 +1,68 @@
using ButcherFactory.BO;
using ButcherFactory.BO.LocalBL;
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;
using WinFormControl;
namespace ButcherFactory.SegmentProductionAuto_
{
public partial class GoodsNumberInputDialog : Form
{
ClientGoodsSet_Detail goodsInfo;
int number = 0;
public GoodsNumberInputDialog(ClientGoodsSet_Detail mGoods)
{
goodsInfo = mGoods;
InitializeComponent();
goodsNameLbl.Text = goodsInfo.Goods_Name;
}
private void numberBox_Click(object sender, EventArgs e)
{
var keyBoard = new NumberPad();
if (keyBoard.ShowDialog() == true)
{
if (string.IsNullOrEmpty(keyBoard.Result))
numberBox.Text = null;
else
{
int pics;
if (int.TryParse(keyBoard.Result, out pics))
{
numberBox.Text = pics.ToString();
number = pics;
}
else
{
numberBox.Text = null;
}
}
}
}
private void okBtn_Click(object sender, EventArgs e)
{
if (number == 0)
throw new Exception("请输入数量");
var log = new SegmentGoodsProductNumLog();
log.Goods_ID = goodsInfo.Goods_ID;
log.Goods_Code = goodsInfo.Goods_Code;
log.Goods_Name = goodsInfo.Goods_Name;
log.Number = number;
SegmentProductionBL.InsertProductNumLog(log);
DialogResult = DialogResult.OK;
}
private void cancelBtn_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
}
}
}

+ 120
- 0
ButcherFactory.Form/SegmentProductionAuto_/GoodsNumberInputDialog.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>

+ 12
- 0
ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.cs View File

@ -44,6 +44,7 @@ namespace ButcherFactory.SegmentProductionAuto_
DateTime? batchDate; DateTime? batchDate;
NotAuto.SegmentProductionFormConfig config; NotAuto.SegmentProductionFormConfig config;
List<GoodsIdentify> identityList; List<GoodsIdentify> identityList;
List<string> specialGoodsCodes;
public SegmentProductionAutoForm() public SegmentProductionAutoForm()
{ {
InitializeComponent(); InitializeComponent();
@ -97,6 +98,11 @@ namespace ButcherFactory.SegmentProductionAuto_
uploadData = new Thread(UpLoadLocalData); uploadData = new Thread(UpLoadLocalData);
uploadData.Start(); uploadData.Start();
mCache = XmlUtil.DeserializeFromFile<WeightDetails>(); mCache = XmlUtil.DeserializeFromFile<WeightDetails>();
var codes = XmlUtil.ReadAllText("MesGoodsCode.txt");
if (string.IsNullOrEmpty(codes))
specialGoodsCodes = new List<string>();
else
specialGoodsCodes = codes.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToList();
var del = new List<long>(); var del = new List<long>();
if (mCache.Cache == null) if (mCache.Cache == null)
{ {
@ -339,6 +345,12 @@ namespace ButcherFactory.SegmentProductionAuto_
throw new Exception(string.Format("重量必须在{0:#0.######}-{1:#0.######}之间", detail.StandardWeightLow, detail.StandardWeightUp)); throw new Exception(string.Format("重量必须在{0:#0.######}-{1:#0.######}之间", detail.StandardWeightLow, detail.StandardWeightUp));
weight = detail.StandardWeight.Value; weight = detail.StandardWeight.Value;
} }
if (specialGoodsCodes.Contains(detail.Goods_Code))
{
var dialog = new GoodsNumberInputDialog(detail);
if (dialog.ShowDialog() != DialogResult.OK)
return;
}
InsertSegmentProduction(detail, weight); InsertSegmentProduction(detail, weight);
} }


Loading…
Cancel
Save