diff --git a/ButcherFactory.BO/Bill/SegmentProduction.cs b/ButcherFactory.BO/Bill/SegmentProduction.cs index fa5c00d..e39daf9 100644 --- a/ButcherFactory.BO/Bill/SegmentProduction.cs +++ b/ButcherFactory.BO/Bill/SegmentProduction.cs @@ -119,6 +119,29 @@ namespace ButcherFactory.BO public string Action { 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 diff --git a/ButcherFactory.BO/LocalBL/SegmentProductionBL.cs b/ButcherFactory.BO/LocalBL/SegmentProductionBL.cs index 2996528..3bf9bee 100644 --- a/ButcherFactory.BO/LocalBL/SegmentProductionBL.cs +++ b/ButcherFactory.BO/LocalBL/SegmentProductionBL.cs @@ -677,6 +677,15 @@ namespace ButcherFactory.BO.LocalBL var query = new DmoQuery(typeof(GoodsIdentify)); return query.EExecuteList().Cast().ToList(); } + + public static void InsertProductNumLog(SegmentGoodsProductNumLog log) + { + using (var session = DmoSession.New()) + { + session.Insert(log); + session.Commit(); + } + } } class SegmentProductionMin diff --git a/ButcherFactory.BO/Utils/XmlUtil.cs b/ButcherFactory.BO/Utils/XmlUtil.cs index 725394f..930d2ca 100644 --- a/ButcherFactory.BO/Utils/XmlUtil.cs +++ b/ButcherFactory.BO/Utils/XmlUtil.cs @@ -55,7 +55,7 @@ namespace ButcherFactory.BO.Utils } } - public static T XmlDeserializeObject(string xmlOfObject) where T : class,new() + public static T XmlDeserializeObject(string xmlOfObject) where T : class, new() { 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; + } } } diff --git a/ButcherFactory.Form/ButcherFactory.Form.csproj b/ButcherFactory.Form/ButcherFactory.Form.csproj index 39559d5..9ce0a64 100644 --- a/ButcherFactory.Form/ButcherFactory.Form.csproj +++ b/ButcherFactory.Form/ButcherFactory.Form.csproj @@ -229,6 +229,12 @@ SegmentPickUpForm.cs + + Form + + + GoodsNumberInputDialog.cs + Form @@ -424,6 +430,9 @@ SegmentPickUpForm.cs + + GoodsNumberInputDialog.cs + IdentifySelectionDialog.cs diff --git a/ButcherFactory.Form/SegmentProductionAuto_/GoodsNumberInputDialog.Designer.cs b/ButcherFactory.Form/SegmentProductionAuto_/GoodsNumberInputDialog.Designer.cs new file mode 100644 index 0000000..279c82d --- /dev/null +++ b/ButcherFactory.Form/SegmentProductionAuto_/GoodsNumberInputDialog.Designer.cs @@ -0,0 +1,125 @@ + +namespace ButcherFactory.SegmentProductionAuto_ +{ + partial class GoodsNumberInputDialog + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + 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; + } +} \ No newline at end of file diff --git a/ButcherFactory.Form/SegmentProductionAuto_/GoodsNumberInputDialog.cs b/ButcherFactory.Form/SegmentProductionAuto_/GoodsNumberInputDialog.cs new file mode 100644 index 0000000..f923403 --- /dev/null +++ b/ButcherFactory.Form/SegmentProductionAuto_/GoodsNumberInputDialog.cs @@ -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; + } + } +} diff --git a/ButcherFactory.Form/SegmentProductionAuto_/GoodsNumberInputDialog.resx b/ButcherFactory.Form/SegmentProductionAuto_/GoodsNumberInputDialog.resx new file mode 100644 index 0000000..29dcb1b --- /dev/null +++ b/ButcherFactory.Form/SegmentProductionAuto_/GoodsNumberInputDialog.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.cs b/ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.cs index 739f014..a516fb0 100644 --- a/ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.cs +++ b/ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.cs @@ -44,6 +44,7 @@ namespace ButcherFactory.SegmentProductionAuto_ DateTime? batchDate; NotAuto.SegmentProductionFormConfig config; List identityList; + List specialGoodsCodes; public SegmentProductionAutoForm() { InitializeComponent(); @@ -97,6 +98,11 @@ namespace ButcherFactory.SegmentProductionAuto_ uploadData = new Thread(UpLoadLocalData); uploadData.Start(); mCache = XmlUtil.DeserializeFromFile(); + var codes = XmlUtil.ReadAllText("MesGoodsCode.txt"); + if (string.IsNullOrEmpty(codes)) + specialGoodsCodes = new List(); + else + specialGoodsCodes = codes.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToList(); var del = new List(); if (mCache.Cache == null) { @@ -339,6 +345,12 @@ namespace ButcherFactory.SegmentProductionAuto_ throw new Exception(string.Format("重量必须在{0:#0.######}-{1:#0.######}之间", detail.StandardWeightLow, detail.StandardWeightUp)); weight = detail.StandardWeight.Value; } + if (specialGoodsCodes.Contains(detail.Goods_Code)) + { + var dialog = new GoodsNumberInputDialog(detail); + if (dialog.ShowDialog() != DialogResult.OK) + return; + } InsertSegmentProduction(detail, weight); }