Browse Source

调整。

master
yibo 7 years ago
parent
commit
82ce57e7d0
9 changed files with 178 additions and 47 deletions
  1. +14
    -12
      ButcherFactory.BO/LocalBL/SegmentInStoreBL.cs
  2. +36
    -5
      ButcherFactory.BO/LocalBL/SegmentProductionBL.cs
  3. +26
    -9
      ButcherFactory.BO/Utils/XmlUtil.cs
  4. +2
    -2
      ButcherFactory.Form/Controls/InfoBox.Designer.cs
  5. +14
    -2
      ButcherFactory.Form/SegmentInStore_/SegmentInStoreForm.cs
  6. +32
    -14
      ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.Designer.cs
  7. +31
    -2
      ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.cs
  8. +21
    -1
      ButcherFactory.Login/App.xaml.cs
  9. +2
    -0
      SelfHelpClient/ReadCardForm.Designer.cs

+ 14
- 12
ButcherFactory.BO/LocalBL/SegmentInStoreBL.cs View File

@ -80,7 +80,7 @@ namespace ButcherFactory.BO.LocalBL
var json = RpcFacade.Call<string>(RpcPath + "GetUnInStoreList"); var json = RpcFacade.Call<string>(RpcPath + "GetUnInStoreList");
var list = JsonConvert.DeserializeObject<List<SegmentInStore>>(json); var list = JsonConvert.DeserializeObject<List<SegmentInStore>>(json);
//var inStored = GetInstoredList(list.Select(x => x.BarCode)); //var inStored = GetInstoredList(list.Select(x => x.BarCode));
// var result = list.Where(x => !inStored.Any(y => x.BarCode == y)).ToList();
// var result = list.Where(x => !inStored.Any(y => x.BarCode == y)).ToList();
var idx = 1; var idx = 1;
foreach (var item in list) foreach (var item in list)
{ {
@ -109,7 +109,7 @@ namespace ButcherFactory.BO.LocalBL
} }
} }
public static SegmentInStore InsertInStore(string barCode, long? storeID, int rowIndex)
public static SegmentInStore InsertInStore(string barCode, long? storeID, int rowIndex, out string msg)
{ {
using (var session = DmoSession.New()) using (var session = DmoSession.New())
{ {
@ -158,20 +158,22 @@ namespace ButcherFactory.BO.LocalBL
//if inStored Error 已入库 //if inStored Error 已入库
//if isBacking Error 正在退库 //if isBacking Error 正在退库
//if back Error 已退库 //if back Error 已退库
var msg = "已入库";
var append = "已入库";
switch (localData.Item2) switch (localData.Item2)
{ {
case 1: case 1:
msg = "正在退库";
append = "正在退库";
break; break;
case 2: case 2:
msg = "已退库";
append = "已退库";
break; break;
} }
throw new Exception(string.Format("入库失败!当前条码{0}", msg));
msg = string.Format("入库失败!当前条码{0}", append);
return null;
} }
} }
session.Commit(); session.Commit();
msg = string.Empty;
return entity; return entity;
} }
} }
@ -187,27 +189,27 @@ namespace ButcherFactory.BO.LocalBL
return query.EExecuteScalar<long, int>(session); return query.EExecuteScalar<long, int>(session);
} }
public static void SetAsBacking(string barCode, int rowIndex)
public static string SetAsBacking(string barCode, int rowIndex)
{ {
using (var session = DmoSession.New()) using (var session = DmoSession.New())
{ {
var localData = GetLocalData(session, barCode); var localData = GetLocalData(session, barCode);
if (localData == null) if (localData == null)
throw new Exception("未入库,无法退库");
return "未入库,无法退库";
switch (localData.Item2) switch (localData.Item2)
{ {
case -1: case -1:
throw new Exception("已删除,无法退库");
return "已删除,无法退库";
case 1: case 1:
throw new Exception("已在退库中,等待提交");
return "已在退库中,等待提交";
case 2: case 2:
throw new Exception("已退库,无法重复退库");
return "已退库,无法重复退库";
default: default:
Update(session, localData.Item1, Update(session, localData.Item1,
new Tuple<string, object>("State", 1), new Tuple<string, object>("State", 1),
new Tuple<string, object>("RowIndex", rowIndex)); new Tuple<string, object>("RowIndex", rowIndex));
session.Commit(); session.Commit();
break;
return string.Empty;
} }
} }
} }


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

@ -72,14 +72,14 @@ namespace ButcherFactory.BO.LocalBL
entity.WorkUnit_ID = workUnitID; entity.WorkUnit_ID = workUnitID;
entity.ProductBatch_ID = productBatchID; entity.ProductBatch_ID = productBatchID;
entity.RowIndex = GenerateRowIndex(productBatchID, session); entity.RowIndex = GenerateRowIndex(productBatchID, session);
entity.BarCode = string.Format("260912011{0:yyyyMMdd}{1}{2:00000}", batchDate,AppContext.ConnectInfo.ClientCode, entity.RowIndex);
entity.BarCode = string.Format("260912011{0:yyyyMMdd}{1}{2:00000}", batchDate, AppContext.ConnectInfo.ClientCode, entity.RowIndex);
session.Insert(entity); session.Insert(entity);
session.Commit(); session.Commit();
return entity; return entity;
} }
} }
public static SegmentProduction InsertAndSetGroupID(long goodsID, decimal weight, long? workUnitID, long productBatchID, DateTime batchDate,bool test)
public static SegmentProduction InsertAndSetGroupID(long goodsID, decimal weight, long? workUnitID, long productBatchID, DateTime batchDate, bool test)
{ {
using (var session = DmoSession.New()) using (var session = DmoSession.New())
{ {
@ -175,7 +175,7 @@ namespace ButcherFactory.BO.LocalBL
{ {
var update = new DQUpdateDom(typeof(SegmentProduction)); var update = new DQUpdateDom(typeof(SegmentProduction));
update.Columns.Add(new DQUpdateColumn("InStored", true)); update.Columns.Add(new DQUpdateColumn("InStored", true));
update.Where.Conditions.Add(DQCondition.InList(DQExpression.Field("ID"),ids.Select(x=>DQExpression.Value(x)).ToArray()));
update.Where.Conditions.Add(DQCondition.InList(DQExpression.Field("ID"), ids.Select(x => DQExpression.Value(x)).ToArray()));
update.EExecute(); update.EExecute();
} }
@ -209,7 +209,7 @@ namespace ButcherFactory.BO.LocalBL
var query = new DQueryDom(new JoinAlias(typeof(SegmentProduction))); var query = new DQueryDom(new JoinAlias(typeof(SegmentProduction)));
query.Columns.Add(DQSelectColumn.Sum("Weight")); query.Columns.Add(DQSelectColumn.Sum("Weight"));
query.Columns.Add(DQSelectColumn.Count()); query.Columns.Add(DQSelectColumn.Count());
query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("ProductBatch_ID", detail.ProductBatch_ID), DQCondition.EQ("Goods_ID", detail.Goods_ID)));
query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("Delete", false), DQCondition.EQ("ProductBatch_ID", detail.ProductBatch_ID), DQCondition.EQ("Goods_ID", detail.Goods_ID)));
using (var session = DmoSession.New()) using (var session = DmoSession.New())
{ {
using (var reader = session.ExecuteReader(query)) using (var reader = session.ExecuteReader(query))
@ -261,6 +261,7 @@ namespace ButcherFactory.BO.LocalBL
query.Columns.Add(DQSelectColumn.Field("Goods_ID")); query.Columns.Add(DQSelectColumn.Field("Goods_ID"));
query.Columns.Add(DQSelectColumn.Field("Weight")); query.Columns.Add(DQSelectColumn.Field("Weight"));
query.Columns.Add(DQSelectColumn.Field("CreateTime")); query.Columns.Add(DQSelectColumn.Field("CreateTime"));
query.Columns.Add(DQSelectColumn.Field("Delete"));
query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("Submited", true), DQCondition.EQ("Sync", false))); query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("Submited", true), DQCondition.EQ("Sync", false)));
query.Range = SelectRange.Top(10); query.Range = SelectRange.Top(10);
query.OrderBy.Expressions.Add(DQOrderByExpression.Create("ID")); query.OrderBy.Expressions.Add(DQOrderByExpression.Create("ID"));
@ -280,6 +281,7 @@ namespace ButcherFactory.BO.LocalBL
obj.Goods_ID = (long)reader[6]; obj.Goods_ID = (long)reader[6];
obj.Weight = (decimal)reader[7]; obj.Weight = (decimal)reader[7];
obj.ProductTime = (DateTime)reader[8]; obj.ProductTime = (DateTime)reader[8];
obj.Delete = (bool)reader[9];
upload.Add(obj); upload.Add(obj);
} }
} }
@ -293,6 +295,35 @@ namespace ButcherFactory.BO.LocalBL
update.Columns.Add(new DQUpdateColumn("Sync", true)); update.Columns.Add(new DQUpdateColumn("Sync", true));
session.ExecuteNonQuery(update); session.ExecuteNonQuery(update);
} }
public static void SetAsDelete(long id, string barCode)
{
var canDelete = CheckCanDelete(barCode);
if (canDelete == null)
throw new Exception("网络中断,请稍后再试!");
else if (canDelete == false)
throw new Exception("已入库,不允许删除!");
var update = new DQUpdateDom(typeof(SegmentProduction));
update.Where.Conditions.Add(DQCondition.EQ("ID", id));
update.Columns.Add(new DQUpdateColumn("Sync", false));
update.Columns.Add(new DQUpdateColumn("Delete", true));
update.Columns.Add(new DQUpdateColumn("RowVersion", DQExpression.Add(DQExpression.Field("RowVersion"), DQExpression.Value(1))));
update.EExecute();
}
static bool? CheckCanDelete(string barCode)
{
try
{
var rst = RpcFacade.Call<string>(RpcPath + "CheckInStored", JsonConvert.SerializeObject(new List<string> { barCode }));
return JsonConvert.DeserializeObject<List<string>>(rst).Count == 0;
}
catch
{
return null;
}
}
} }
class SegmentProductionMin class SegmentProductionMin
@ -309,7 +340,7 @@ namespace ButcherFactory.BO.LocalBL
public long? Goods_ID { get; set; } public long? Goods_ID { get; set; }
public decimal? Weight { get; set; } public decimal? Weight { get; set; }
public DateTime? InStoreTime { get; set; } public DateTime? InStoreTime { get; set; }
public bool Delete { get; set; }
} }
class TaskTemp class TaskTemp


+ 26
- 9
ButcherFactory.BO/Utils/XmlUtil.cs View File

@ -39,23 +39,40 @@ namespace ButcherFactory.BO.Utils
using (var reader = new StreamReader(fileName)) using (var reader = new StreamReader(fileName))
{ {
var xs = new XmlSerializer(typeof(T)); var xs = new XmlSerializer(typeof(T));
object obj = xs.Deserialize(reader);
reader.Close();
return (T)obj;
try
{
object obj = xs.Deserialize(reader);
return (T)obj;
}
catch
{
return new T();
}
finally
{
reader.Close();
}
} }
} }
public static T XmlDeserializeObject<T>(string xmlOfObject) where T : class
public static T XmlDeserializeObject<T>(string xmlOfObject) where T : class,new()
{ {
using (MemoryStream ms = new MemoryStream()) using (MemoryStream ms = new MemoryStream())
{ {
using (StreamWriter sr = new StreamWriter(ms, Encoding.UTF8)) using (StreamWriter sr = new StreamWriter(ms, Encoding.UTF8))
{ {
sr.Write(xmlOfObject);
sr.Flush();
ms.Seek(0, SeekOrigin.Begin);
XmlSerializer serializer = new XmlSerializer(typeof(T));
return serializer.Deserialize(ms) as T;
try
{
sr.Write(xmlOfObject);
sr.Flush();
ms.Seek(0, SeekOrigin.Begin);
XmlSerializer serializer = new XmlSerializer(typeof(T));
return serializer.Deserialize(ms) as T;
}
catch
{
return new T();
}
} }
} }
} }


+ 2
- 2
ButcherFactory.Form/Controls/InfoBox.Designer.cs View File

@ -35,9 +35,9 @@
// button1 // button1
// //
this.button1.Font = new System.Drawing.Font("宋体", 15F); this.button1.Font = new System.Drawing.Font("宋体", 15F);
this.button1.Location = new System.Drawing.Point(180, 278);
this.button1.Location = new System.Drawing.Point(143, 278);
this.button1.Name = "button1"; this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(120, 56);
this.button1.Size = new System.Drawing.Size(200, 56);
this.button1.TabIndex = 0; this.button1.TabIndex = 0;
this.button1.Text = "确定"; this.button1.Text = "确定";
this.button1.UseVisualStyleBackColor = true; this.button1.UseVisualStyleBackColor = true;


+ 14
- 2
ButcherFactory.Form/SegmentInStore_/SegmentInStoreForm.cs View File

@ -13,6 +13,7 @@ using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using ButcherFactory.Utils; using ButcherFactory.Utils;
using ButcherFactory.BO.LocalBL; using ButcherFactory.BO.LocalBL;
using ButcherFactory.Controls;
namespace ButcherFactory.SegmentInStore_ namespace ButcherFactory.SegmentInStore_
{ {
@ -140,7 +141,12 @@ namespace ButcherFactory.SegmentInStore_
if (isBack) if (isBack)
{ {
var idx = backStoreList.Any() ? backStoreList.First().RowIndex.Value : 0; var idx = backStoreList.Any() ? backStoreList.First().RowIndex.Value : 0;
SegmentInStoreBL.SetAsBacking(uScanPanel1.TextBox.Text, idx + 1);
var msg = SegmentInStoreBL.SetAsBacking(uScanPanel1.TextBox.Text, idx + 1);
if (!string.IsNullOrEmpty(msg))
{
InfoBox.Show("错误", msg, Color.Red, 2);
return;
}
BindBackGrid(); BindBackGrid();
var fir = inStoreList.FirstOrDefault(x => x.BarCode == uScanPanel1.TextBox.Text); var fir = inStoreList.FirstOrDefault(x => x.BarCode == uScanPanel1.TextBox.Text);
if (fir != null) if (fir != null)
@ -152,7 +158,13 @@ namespace ButcherFactory.SegmentInStore_
else else
{ {
var idx = inStoreList.Any() ? inStoreList.First().RowIndex.Value : 0; var idx = inStoreList.Any() ? inStoreList.First().RowIndex.Value : 0;
var entity = SegmentInStoreBL.InsertInStore(uScanPanel1.TextBox.Text, storeID, idx + 1);
string msg;
var entity = SegmentInStoreBL.InsertInStore(uScanPanel1.TextBox.Text, storeID, idx + 1,out msg);
if (!string.IsNullOrEmpty(msg))
{
InfoBox.Show("错误", msg, Color.Red, 2);
return;
}
inStoreList.Insert(0, entity); inStoreList.Insert(0, entity);
if (inStoreList.Count >= 30) if (inStoreList.Count >= 30)
inStoreList.RemoveAt(30); inStoreList.RemoveAt(30);


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

@ -47,6 +47,7 @@
this.T_Last = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.T_Last = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.GoodsLabel = new WinFormControl.ULabel(); this.GoodsLabel = new WinFormControl.ULabel();
this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.templateBtn = new ButcherFactory.Controls.ColorButton();
this.closeBtn = new ButcherFactory.Controls.ColorButton(); this.closeBtn = new ButcherFactory.Controls.ColorButton();
this.uWeightControl1 = new ButcherFactory.Controls.WeightControl(); this.uWeightControl1 = new ButcherFactory.Controls.WeightControl();
this.testCkBox = new System.Windows.Forms.CheckBox(); this.testCkBox = new System.Windows.Forms.CheckBox();
@ -69,7 +70,7 @@
this.H_BarCode = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.H_BarCode = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.H_Goods_Name = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.H_Goods_Name = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.H_Weight = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.H_Weight = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.templateBtn = new ButcherFactory.Controls.ColorButton();
this.deleteBtn = new ButcherFactory.Controls.ColorButton();
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();
@ -221,6 +222,20 @@
this.splitContainer1.SplitterDistance = 87; this.splitContainer1.SplitterDistance = 87;
this.splitContainer1.TabIndex = 1; this.splitContainer1.TabIndex = 1;
// //
// templateBtn
//
this.templateBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(144)))), ((int)(((byte)(98)))), ((int)(((byte)(222)))));
this.templateBtn.Font = new System.Drawing.Font("宋体", 15F);
this.templateBtn.ForeColor = System.Drawing.Color.White;
this.templateBtn.Location = new System.Drawing.Point(648, 35);
this.templateBtn.Name = "templateBtn";
this.templateBtn.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(158)))), ((int)(((byte)(234)))), ((int)(((byte)(106)))));
this.templateBtn.Size = new System.Drawing.Size(111, 41);
this.templateBtn.TabIndex = 23;
this.templateBtn.Text = "选择标签";
this.templateBtn.UseVisualStyleBackColor = false;
this.templateBtn.Click += new System.EventHandler(this.templateBtn_Click);
//
// closeBtn // closeBtn
// //
this.closeBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.closeBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
@ -348,6 +363,7 @@
// //
// splitContainer2.Panel2 // splitContainer2.Panel2
// //
this.splitContainer2.Panel2.Controls.Add(this.deleteBtn);
this.splitContainer2.Panel2.Controls.Add(this.rePrintBtn); this.splitContainer2.Panel2.Controls.Add(this.rePrintBtn);
this.splitContainer2.Panel2.Controls.Add(this.groupBox1); this.splitContainer2.Panel2.Controls.Add(this.groupBox1);
this.splitContainer2.Panel2.Controls.Add(this.groupBox2); this.splitContainer2.Panel2.Controls.Add(this.groupBox2);
@ -496,19 +512,20 @@
this.H_Weight.Name = "H_Weight"; this.H_Weight.Name = "H_Weight";
this.H_Weight.ReadOnly = true; this.H_Weight.ReadOnly = true;
// //
// templateBtn
//
this.templateBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(144)))), ((int)(((byte)(98)))), ((int)(((byte)(222)))));
this.templateBtn.Font = new System.Drawing.Font("宋体", 15F);
this.templateBtn.ForeColor = System.Drawing.Color.White;
this.templateBtn.Location = new System.Drawing.Point(648, 35);
this.templateBtn.Name = "templateBtn";
this.templateBtn.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(158)))), ((int)(((byte)(234)))), ((int)(((byte)(106)))));
this.templateBtn.Size = new System.Drawing.Size(111, 41);
this.templateBtn.TabIndex = 23;
this.templateBtn.Text = "选择标签";
this.templateBtn.UseVisualStyleBackColor = false;
this.templateBtn.Click += new System.EventHandler(this.templateBtn_Click);
// 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(178, 129);
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 = 23;
this.deleteBtn.Text = "删除";
this.deleteBtn.UseVisualStyleBackColor = false;
this.deleteBtn.Click += new System.EventHandler(this.deleteBtn_Click);
// //
// SegmentProductionAutoForm // SegmentProductionAutoForm
// //
@ -573,5 +590,6 @@
private Controls.ColorButton goodsSetBtn; private Controls.ColorButton goodsSetBtn;
private System.Windows.Forms.CheckBox testCkBox; private System.Windows.Forms.CheckBox testCkBox;
private Controls.ColorButton templateBtn; private Controls.ColorButton templateBtn;
private Controls.ColorButton deleteBtn;
} }
} }

+ 31
- 2
ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.cs View File

@ -102,7 +102,7 @@ namespace ButcherFactory.SegmentProductionAuto_
} }
productBatchSelect.EBindComboBox<ProductBatch>(x => x.Date == DateTime.Today, 6, "Date"); productBatchSelect.EBindComboBox<ProductBatch>(x => x.Date == DateTime.Today, 6, "Date");
config = XmlUtil.DeserializeFromFile<NotAuto.SegmentProductionFormConfig>(); config = XmlUtil.DeserializeFromFile<NotAuto.SegmentProductionFormConfig>();
workUnitSelect.EBindComboBox<WorkUnit>(x => x.ID == config.WorkUnitID);
workUnitSelect.EBindComboBox<WorkUnit>(x => x.ID == config.WorkUnitID, top: 100);
BindGoods(); BindGoods();
BindGrid(); BindGrid();
@ -162,6 +162,7 @@ namespace ButcherFactory.SegmentProductionAuto_
if (historyList.Count > 30) if (historyList.Count > 30)
historyList.RemoveAt(30); historyList.RemoveAt(30);
historyDataGrid.FirstDisplayedScrollingRowIndex = 0; historyDataGrid.FirstDisplayedScrollingRowIndex = 0;
historyDataGrid.Rows[0].Selected = true;
historyDataGrid.Refresh(); historyDataGrid.Refresh();
} }
if (barPrintCheck.Checked) if (barPrintCheck.Checked)
@ -173,9 +174,19 @@ namespace ButcherFactory.SegmentProductionAuto_
} }
if (!testCkBox.Checked) if (!testCkBox.Checked)
{ {
var thd = new Thread(new ParameterizedThreadStart(RefreshTask));
thd.Start(entity);
}
}
void RefreshTask(object obj)
{
this.Invoke(new Action(() =>
{
var entity = obj as SegmentProduction;
taskDataGrid.DataSource = SegmentProductionBL.GetProductTask(batchDate ?? DateTime.Today, entity); taskDataGrid.DataSource = SegmentProductionBL.GetProductTask(batchDate ?? DateTime.Today, entity);
taskDataGrid.Refresh(); taskDataGrid.Refresh();
}
}));
} }
void BindGrid() void BindGrid()
@ -263,5 +274,23 @@ namespace ButcherFactory.SegmentProductionAuto_
{ {
new TemplateSelector(config).ShowDialog(); new TemplateSelector(config).ShowDialog();
} }
private void deleteBtn_Click(object sender, EventArgs e)
{
if (historyDataGrid.CurrentRow == null)
return;
if (MessageBox.Show( "确定删除选中记录?","删除确认", MessageBoxButtons.OKCancel) != DialogResult.OK)
return;
var item = historyDataGrid.CurrentRow.DataBoundItem as SegmentProduction;
SegmentProductionBL.SetAsDelete(item.ID, item.BarCode);
historyList.Remove(item);
historyDataGrid.DataSource = historyList;
if (historyList.Any())
historyDataGrid.Rows[0].Selected = true;
historyDataGrid.Refresh();
var thd = new Thread(new ParameterizedThreadStart(RefreshTask));
thd.Start(item);
}
} }
} }

+ 21
- 1
ButcherFactory.Login/App.xaml.cs View File

@ -1,4 +1,5 @@
using System;
using ButcherFactory.BO.Utils;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Configuration; using System.Configuration;
using System.Data; using System.Data;
@ -45,6 +46,8 @@ namespace ButcherFactory.Login
var tempImages = new System.IO.DirectoryInfo("TempImg").GetFiles(); var tempImages = new System.IO.DirectoryInfo("TempImg").GetFiles();
foreach (var f in tempImages) foreach (var f in tempImages)
f.Delete(); f.Delete();
if (e.Args.Length == 1 && e.Args[0] == "true")
UpdateDb();
} }
///<summary> ///<summary>
@ -92,5 +95,22 @@ namespace ButcherFactory.Login
MessageBox.Show("错误:" + e.Exception.Message + " \n详细信息:" + e.Exception.StackTrace); MessageBox.Show("错误:" + e.Exception.Message + " \n详细信息:" + e.Exception.StackTrace);
e.Handled = true; e.Handled = true;
} }
void UpdateDb()
{
try
{
if (!string.IsNullOrEmpty(AppContext.ConnectInfo.SqlConnection))
{
DbUtil.UpdateDatabase(AppContext.ConnectInfo.SqlConnection);
}
}
catch
{
#if DEBUG
throw;
#endif
}
}
} }
} }

+ 2
- 0
SelfHelpClient/ReadCardForm.Designer.cs View File

@ -64,6 +64,7 @@
// ganyingPanel // ganyingPanel
// //
this.ganyingPanel.BackgroundImage = global::SelfHelpClient.Properties.Resources.ganying; this.ganyingPanel.BackgroundImage = global::SelfHelpClient.Properties.Resources.ganying;
this.ganyingPanel.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
this.ganyingPanel.Location = new System.Drawing.Point(327, 31); this.ganyingPanel.Location = new System.Drawing.Point(327, 31);
this.ganyingPanel.Name = "ganyingPanel"; this.ganyingPanel.Name = "ganyingPanel";
this.ganyingPanel.Size = new System.Drawing.Size(221, 152); this.ganyingPanel.Size = new System.Drawing.Size(221, 152);
@ -96,6 +97,7 @@
// shuakaPanel // shuakaPanel
// //
this.shuakaPanel.BackgroundImage = global::SelfHelpClient.Properties.Resources.shuaka; this.shuakaPanel.BackgroundImage = global::SelfHelpClient.Properties.Resources.shuaka;
this.shuakaPanel.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
this.shuakaPanel.Location = new System.Drawing.Point(451, 175); this.shuakaPanel.Location = new System.Drawing.Point(451, 175);
this.shuakaPanel.Name = "shuakaPanel"; this.shuakaPanel.Name = "shuakaPanel";
this.shuakaPanel.Size = new System.Drawing.Size(279, 258); this.shuakaPanel.Size = new System.Drawing.Size(279, 258);


Loading…
Cancel
Save