Browse Source

优化,白条入库支持无码入库

master
yibo 7 years ago
parent
commit
9eff83626a
10 changed files with 197 additions and 141 deletions
  1. +1
    -1
      ButcherFactory.BO/LocalBL/BaseInfoBL.cs
  2. +21
    -16
      ButcherFactory.BO/LocalBL/CarcassInStoreBL.cs
  3. +7
    -7
      ButcherFactory.BO/LocalBL/CarcassTakeOutBL.cs
  4. +2
    -2
      ButcherFactory.BO/Rpcs/BaseInfoSyncRpc.cs
  5. +19
    -11
      ButcherFactory.BO/Utils/Extensions.cs
  6. +2
    -2
      ButcherFactory.BO/Utils/LoginUtil.cs
  7. +62
    -38
      ButcherFactory.Form/CarcassInStore_/CarcassInStoreForm.Designer.cs
  8. +31
    -20
      ButcherFactory.Form/CarcassInStore_/CarcassInStoreForm.cs
  9. +8
    -0
      ButcherFactory.Form/CarcassInStore_/CarcassInStoreForm.resx
  10. +44
    -44
      ButcherFactorySolution/ButcherFactorySolution.vdproj

+ 1
- 1
ButcherFactory.BO/LocalBL/BaseInfoBL.cs View File

@ -19,7 +19,7 @@ namespace ButcherFactory.BO.LocalBL
query.Columns.Add(DQSelectColumn.Field("Name"));
query.OrderBy.Expressions.Add(DQOrderByExpression.Create("ID", true));
var result = new List<BaseInfo>();
using (var session = Dmo.NewSession(AppContext.ConnectInfo.SqlConnection))
using (var session = DmoSession.New())
{
using (var reader = session.ExecuteReader(query))
{


+ 21
- 16
ButcherFactory.BO/LocalBL/CarcassInStoreBL.cs View File

@ -53,18 +53,19 @@ namespace ButcherFactory.BO.LocalBL
static List<CarcassInStore> InsertOrUpdate(long? workUnitID, long? batchID, IEnumerable<Tuple<long, string>> data, bool fromPad)
{
var list = new List<CarcassInStore>();
using (var session = Dmo.NewSession(AppContext.ConnectInfo.SqlConnection))
using (var session = DmoSession.New())
{
foreach (var item in data)
{
var id = GetExistWithUpdate(item, session);
if (id.HasValue)
var idWeight = GetExistWithUpdate(item, session);
if (idWeight != null)
{
var exist = new CarcassInStore();
list.Add(exist);
exist.ID = id.Value;
exist.ID = idWeight.Item1;
exist.Goods_ID = item.Item1;
exist.Goods_Name = GetGoodsName(item.Item1, session);
exist.Weight = idWeight.Item2;
}
else
{
@ -103,16 +104,19 @@ namespace ButcherFactory.BO.LocalBL
return _goodsNames[id];
}
static long? GetExistWithUpdate(Tuple<long, string> goodsCode, IDmoSession session)
static Tuple<long, decimal?> GetExistWithUpdate(Tuple<long, string> goodsCode, IDmoSession session)
{
if (string.IsNullOrEmpty(goodsCode.Item2))
return null;
var query = new DQueryDom(new JoinAlias(typeof(CarcassInStore)));
query.Columns.Add(DQSelectColumn.Field("ID"));
query.Columns.Add(DQSelectColumn.Field("Weight"));
query.Where.Conditions.Add(DQCondition.EQ("BarCode", goodsCode.Item2));
var id = (long?)session.ExecuteScalar(query);
if (id == null)
var result = query.EExecuteScalar<long, decimal?>();
if (result == null)
return null;
Update(id.Value, "Goods_ID", goodsCode.Item1, session);
return id.Value;
Update(result.Item1, "Goods_ID", goodsCode.Item1, session);
return result;
}
static void Update(long id, string fileName, object value, IDmoSession session)
@ -127,7 +131,7 @@ namespace ButcherFactory.BO.LocalBL
public static void Update(long id, string fileName, object value)
{
using (var session = Dmo.NewSession(AppContext.ConnectInfo.SqlConnection))
using (var session = DmoSession.New())
{
Update(id, fileName, value, session);
session.Commit();
@ -151,7 +155,7 @@ namespace ButcherFactory.BO.LocalBL
query.Where.Conditions.Add(DQCondition.IsNull(DQExpression.Field("Weight")));
query.OrderBy.Expressions.Add(DQOrderByExpression.Create("ID", true));
var result = new BindingList<CarcassInStore>();
using (var session = Dmo.NewSession(AppContext.ConnectInfo.SqlConnection))
using (var session = DmoSession.New())
{
using (var reader = session.ExecuteReader(query))
{
@ -194,7 +198,7 @@ namespace ButcherFactory.BO.LocalBL
var list = JsonConvert.DeserializeObject<List<ExtensionObj>>(json);
if (list.Any())
{
using (var session = Dmo.NewSession(AppContext.ConnectInfo.SqlConnection))
using (var session = DmoSession.New())
{
foreach (var item in list)
SaveWeightInDB(item, session);
@ -224,7 +228,7 @@ namespace ButcherFactory.BO.LocalBL
{
try
{
using (var session = Dmo.NewSession(AppContext.ConnectInfo.SqlConnection))
using (var session = DmoSession.New())
{
var needUpload = GetUnSyncData(session);
if (needUpload.Count == 0)
@ -237,7 +241,8 @@ namespace ButcherFactory.BO.LocalBL
session.Commit();
}
}
catch {
catch
{
#if DEBUG
throw;
#endif
@ -246,7 +251,7 @@ namespace ButcherFactory.BO.LocalBL
static List<CarcassInStoreObj> GetUnSyncData(IDmoSession session)
{
var query = new DQueryDom(new JoinAlias(typeof(CarcassInStore)));
var query = new DQueryDom(new JoinAlias("_main",typeof(CarcassInStore)));
query.Columns.Add(DQSelectColumn.Field("ID"));
query.Columns.Add(DQSelectColumn.Field("RowVersion"));
query.Columns.Add(DQSelectColumn.Field("BarCode"));
@ -256,7 +261,7 @@ namespace ButcherFactory.BO.LocalBL
query.Columns.Add(DQSelectColumn.Field("Goods_ID"));
query.Columns.Add(DQSelectColumn.Field("Weight"));
query.Columns.Add(DQSelectColumn.Field("CreateTime"));
query.Where.Conditions.Add(DQCondition.And(DQCondition.IsNotNull(DQExpression.Field("Weight")), DQCondition.EQ("Sync", false)));
query.Where.Conditions.Add(DQCondition.And(DQExpression.Snippet("[_main].[BarCode] != ''"), DQCondition.IsNotNull(DQExpression.Field("Weight")), DQCondition.EQ("Sync", false)));
query.Range = SelectRange.Top(10);
query.OrderBy.Expressions.Add(DQOrderByExpression.Create("ID"));


+ 7
- 7
ButcherFactory.BO/LocalBL/CarcassTakeOutBL.cs View File

@ -20,7 +20,7 @@ namespace ButcherFactory.BO.LocalBL
public static CarcassTakeOut InsertOrUpdate(long? workUnitID, string barCode, out bool isNew)
{
using (var session = Dmo.NewSession(AppContext.ConnectInfo.SqlConnection))
using (var session = DmoSession.New())
{
var entity = GetEntityByBarCode(barCode, session);
if (entity == null)
@ -68,7 +68,7 @@ namespace ButcherFactory.BO.LocalBL
public static void Delete(long id)
{
using (var session = Dmo.NewSession(AppContext.ConnectInfo.SqlConnection))
using (var session = DmoSession.New())
{
Update(id, session, new Tuple<string, object>("Delete", true));
session.Commit();
@ -88,7 +88,7 @@ namespace ButcherFactory.BO.LocalBL
query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("Submited", history), DQCondition.EQ("Delete", false)));
query.OrderBy.Expressions.Add(DQOrderByExpression.Create("ID", true));
var result = new BindingList<CarcassTakeOut>();
using (var session = Dmo.NewSession(AppContext.ConnectInfo.SqlConnection))
using (var session = DmoSession.New())
{
using (var reader = session.ExecuteReader(query))
{
@ -110,7 +110,7 @@ namespace ButcherFactory.BO.LocalBL
public static void SetWeight(IEnumerable<long> ids, decimal weight)
{
var id = ids.Max();
using (var session = Dmo.NewSession(AppContext.ConnectInfo.SqlConnection))
using (var session = DmoSession.New())
{
Update(id, session, new Tuple<string, object>("GroupID", id), new Tuple<string, object>("Weight", weight));
GroupUpdate(ids.Where(x => x != id), session, new Tuple<string, object>("GroupID", id), new Tuple<string, object>("Weight", 0));
@ -132,7 +132,7 @@ namespace ButcherFactory.BO.LocalBL
public static void Submit(IEnumerable<long> ids)
{
using (var session = Dmo.NewSession(AppContext.ConnectInfo.SqlConnection))
using (var session = DmoSession.New())
{
GroupUpdate(ids, session, new Tuple<string, object>("Submited", true));
session.Commit();
@ -147,7 +147,7 @@ namespace ButcherFactory.BO.LocalBL
var list = JsonConvert.DeserializeObject<List<ExtensionObj>>(json);
if (list.Any())
{
using (var session = Dmo.NewSession(AppContext.ConnectInfo.SqlConnection))
using (var session = DmoSession.New())
{
foreach (var item in list)
SaveBeforeInfoInDB(item, session);
@ -177,7 +177,7 @@ namespace ButcherFactory.BO.LocalBL
{
try
{
using (var session = Dmo.NewSession(AppContext.ConnectInfo.SqlConnection))
using (var session = DmoSession.New())
{
var needUpload = GetUnSyncData(session);
if (needUpload.Count == 0)


+ 2
- 2
ButcherFactory.BO/Rpcs/BaseInfoSyncRpc.cs View File

@ -30,7 +30,7 @@ namespace ButcherFactory.BO.Rpcs
methodName = "Sync" + type.Name;
var json = RpcFacade.Call<string>(baseInfoRpcPath + methodName);
var list = JsonConvert.DeserializeObject<List<T>>(json);
using (var session = Dmo.NewSession(AppContext.ConnectInfo.SqlConnection))
using (var session = DmoSession.New())
{
TruncateTable(type, session);
foreach (var item in list)
@ -43,7 +43,7 @@ namespace ButcherFactory.BO.Rpcs
{
var json = RpcFacade.Call<string>(baseInfoRpcPath + "SyncClientGoodsSetByClient", (short)applyClient);
var list = JsonConvert.DeserializeObject<List<ClientGoodsSet>>(json);
using (var session = Dmo.NewSession(AppContext.ConnectInfo.SqlConnection))
using (var session = DmoSession.New())
{
foreach (var item in list)
{


+ 19
- 11
ButcherFactory.BO/Utils/Extensions.cs View File

@ -11,6 +11,14 @@ using System.Threading.Tasks;
namespace ButcherFactory.BO
{
public static class DmoSession
{
public static IDmoSessionWithTransaction New()
{
return Dmo.NewSession(AppContext.ConnectInfo.SqlConnection);
}
}
public static class Extensions
{
public static object EExecuteScalar(this DQueryDom query, IDmoSession session)
@ -20,7 +28,7 @@ namespace ButcherFactory.BO
public static object EExecuteScalar(this DQueryDom query)
{
using (var session = Dmo.NewSession(AppContext.ConnectInfo.SqlConnection))
using (var session = DmoSession.New())
{
return query.EExecuteScalar(session);
}
@ -54,7 +62,7 @@ namespace ButcherFactory.BO
public static Tuple<T1, T2> EExecuteScalar<T1, T2>(this DQueryDom query)
{
using (var session = Dmo.NewSession(AppContext.ConnectInfo.SqlConnection))
using (var session = DmoSession.New())
{
return query.EExecuteScalar<T1, T2>(session);
}
@ -78,7 +86,7 @@ namespace ButcherFactory.BO
public static Tuple<T1, T2, T3> EExecuteScalar<T1, T2, T3>(this DQueryDom query)
{
using (var session = Dmo.NewSession(AppContext.ConnectInfo.SqlConnection))
using (var session = DmoSession.New())
{
return query.EExecuteScalar<T1, T2, T3>(session);
}
@ -113,7 +121,7 @@ namespace ButcherFactory.BO
public static List<T> EExecuteList<T>(this DQueryDom query)
{
using (var session = Dmo.NewSession(AppContext.ConnectInfo.SqlConnection))
using (var session = DmoSession.New())
{
return query.EExecuteList<T>(session);
}
@ -176,7 +184,7 @@ namespace ButcherFactory.BO
public static List<TDmo> EExecuteDmoList<TDmo>(this DQueryDom query, params string[] fields) where TDmo : new()
{
using (var session = Dmo.NewSession(AppContext.ConnectInfo.SqlConnection))
using (var session = DmoSession.New())
{
return query.EExecuteDmoList<TDmo>(session, fields);
}
@ -201,7 +209,7 @@ namespace ButcherFactory.BO
public static List<Tuple<T1, T2>> EExecuteList<T1, T2>(this DQueryDom query)
{
using (var session = Dmo.NewSession(AppContext.ConnectInfo.SqlConnection))
using (var session = DmoSession.New())
{
return query.EExecuteList<T1, T2>(session);
}
@ -226,7 +234,7 @@ namespace ButcherFactory.BO
public static List<Tuple<T1, T2, T3>> EExecuteList<T1, T2, T3>(this DQueryDom query)
{
using (var session = Dmo.NewSession(AppContext.ConnectInfo.SqlConnection))
using (var session = DmoSession.New())
{
return query.EExecuteList<T1, T2, T3>(session);
}
@ -234,7 +242,7 @@ namespace ButcherFactory.BO
public static List<Tuple<T1, T2, T3, T4>> EExecuteList<T1, T2, T3, T4>(this DQueryDom query)
{
using (var session = Dmo.NewSession(AppContext.ConnectInfo.SqlConnection))
using (var session = DmoSession.New())
{
return query.EExecuteList<T1, T2, T3, T4>(session);
}
@ -260,7 +268,7 @@ namespace ButcherFactory.BO
public static List<Tuple<T1, T2, T3, T4, T5>> EExecuteList<T1, T2, T3, T4, T5>(this DQueryDom query)
{
using (var session = Dmo.NewSession(AppContext.ConnectInfo.SqlConnection))
using (var session = DmoSession.New())
{
return query.EExecuteList<T1, T2, T3, T4, T5>(session);
}
@ -285,7 +293,7 @@ namespace ButcherFactory.BO
public static IList EExecuteList(this DmoQuery query)
{
using (var session = Dmo.NewSession(AppContext.ConnectInfo.SqlConnection))
using (var session = DmoSession.New())
{
return session.ExecuteList(query);
}
@ -293,7 +301,7 @@ namespace ButcherFactory.BO
public static void EExecute(this DQUpdateDom update)
{
using (var session = Dmo.NewSession(AppContext.ConnectInfo.SqlConnection))
using (var session = DmoSession.New())
{
session.ExecuteNonQuery(update);
session.Commit();


+ 2
- 2
ButcherFactory.BO/Utils/LoginUtil.cs View File

@ -18,7 +18,7 @@ namespace ButcherFactory.BO.Utils
{
if (string.IsNullOrEmpty(AppContext.ConnectInfo.SqlConnection))
return new Worker();
using (var session = Dmo.NewSession(AppContext.ConnectInfo.SqlConnection))
using (var session = DmoSession.New())
{
var query = new DmoQuery(typeof(Worker));
var obj = session.ExecuteScalar(query);
@ -71,7 +71,7 @@ namespace ButcherFactory.BO.Utils
AppContext.Worker.Name = userName;
AppContext.Worker.Password = EncodePwd(pwd);
using (var session = Dmo.NewSession(AppContext.ConnectInfo.SqlConnection))
using (var session = DmoSession.New())
{
var table = DmoInfo.Get(typeof(Worker)).MappedDBObject;
var sql = string.Format(@"delete from [{0}]", table);


+ 62
- 38
ButcherFactory.Form/CarcassInStore_/CarcassInStoreForm.Designer.cs View File

@ -28,17 +28,17 @@
/// </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 dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CarcassInStoreForm));
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle16 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle17 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle18 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle20 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle19 = new System.Windows.Forms.DataGridViewCellStyle();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.closeBtn = new WinFormControl.UButton();
this.uTimerLabel1 = new WinFormControl.UTimerLabel();
@ -67,6 +67,7 @@
this.U_Weight = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.uLabel3 = new WinFormControl.ULabel();
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
this.noCodeBtn = new WinFormControl.UButton();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
@ -95,6 +96,7 @@
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.BackColor = System.Drawing.Color.Transparent;
this.splitContainer1.Panel1.Controls.Add(this.noCodeBtn);
this.splitContainer1.Panel1.Controls.Add(this.closeBtn);
this.splitContainer1.Panel1.Controls.Add(this.uTimerLabel1);
this.splitContainer1.Panel1.Controls.Add(this.productBatchSelect);
@ -259,15 +261,15 @@
this.historyDataGrid.AllowUserToDeleteRows = false;
this.historyDataGrid.AllowUserToResizeColumns = false;
this.historyDataGrid.AllowUserToResizeRows = false;
dataGridViewCellStyle11.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.historyDataGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle11;
dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.historyDataGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
this.historyDataGrid.BackgroundColor = System.Drawing.Color.White;
this.historyDataGrid.BorderStyle = System.Windows.Forms.BorderStyle.None;
dataGridViewCellStyle12.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle12.Font = new System.Drawing.Font("宋体", 12F);
dataGridViewCellStyle12.ForeColor = System.Drawing.Color.White;
dataGridViewCellStyle12.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.historyDataGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle12;
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.historyDataGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;
this.historyDataGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.historyDataGrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.H_ID,
@ -282,9 +284,9 @@
this.historyDataGrid.Name = "historyDataGrid";
this.historyDataGrid.ReadOnly = true;
this.historyDataGrid.RowHeadersVisible = false;
dataGridViewCellStyle16.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle16.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
this.historyDataGrid.RowsDefaultCellStyle = dataGridViewCellStyle16;
dataGridViewCellStyle6.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle6.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
this.historyDataGrid.RowsDefaultCellStyle = dataGridViewCellStyle6;
this.historyDataGrid.RowTemplate.Height = 23;
this.historyDataGrid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.historyDataGrid.Size = new System.Drawing.Size(574, 230);
@ -317,8 +319,8 @@
// H_Weight
//
this.H_Weight.DataPropertyName = "Weight";
dataGridViewCellStyle13.Format = "#0.######";
this.H_Weight.DefaultCellStyle = dataGridViewCellStyle13;
dataGridViewCellStyle3.Format = "#0.######";
this.H_Weight.DefaultCellStyle = dataGridViewCellStyle3;
this.H_Weight.HeaderText = "入库重量";
this.H_Weight.Name = "H_Weight";
this.H_Weight.ReadOnly = true;
@ -326,8 +328,8 @@
// H_BeforeWeight
//
this.H_BeforeWeight.DataPropertyName = "BeforeWeight";
dataGridViewCellStyle14.Format = "#0.######";
this.H_BeforeWeight.DefaultCellStyle = dataGridViewCellStyle14;
dataGridViewCellStyle4.Format = "#0.######";
this.H_BeforeWeight.DefaultCellStyle = dataGridViewCellStyle4;
this.H_BeforeWeight.HeaderText = "胴体重量";
this.H_BeforeWeight.Name = "H_BeforeWeight";
this.H_BeforeWeight.ReadOnly = true;
@ -335,8 +337,8 @@
// H_Discont
//
this.H_Discont.DataPropertyName = "Discont";
dataGridViewCellStyle15.Format = "#0.######";
this.H_Discont.DefaultCellStyle = dataGridViewCellStyle15;
dataGridViewCellStyle5.Format = "#0.######";
this.H_Discont.DefaultCellStyle = dataGridViewCellStyle5;
this.H_Discont.HeaderText = "损耗";
this.H_Discont.Name = "H_Discont";
this.H_Discont.ReadOnly = true;
@ -371,15 +373,15 @@
this.needSubmitGrid.AllowUserToDeleteRows = false;
this.needSubmitGrid.AllowUserToResizeColumns = false;
this.needSubmitGrid.AllowUserToResizeRows = false;
dataGridViewCellStyle17.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.needSubmitGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle17;
dataGridViewCellStyle7.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.needSubmitGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle7;
this.needSubmitGrid.BackgroundColor = System.Drawing.Color.White;
this.needSubmitGrid.BorderStyle = System.Windows.Forms.BorderStyle.None;
dataGridViewCellStyle18.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle18.Font = new System.Drawing.Font("宋体", 12F);
dataGridViewCellStyle18.ForeColor = System.Drawing.Color.White;
dataGridViewCellStyle18.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.needSubmitGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle18;
dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle8.Font = new System.Drawing.Font("宋体", 12F);
dataGridViewCellStyle8.ForeColor = System.Drawing.Color.White;
dataGridViewCellStyle8.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.needSubmitGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle8;
this.needSubmitGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.needSubmitGrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.U_ID,
@ -392,9 +394,9 @@
this.needSubmitGrid.Name = "needSubmitGrid";
this.needSubmitGrid.ReadOnly = true;
this.needSubmitGrid.RowHeadersVisible = false;
dataGridViewCellStyle20.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle20.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
this.needSubmitGrid.RowsDefaultCellStyle = dataGridViewCellStyle20;
dataGridViewCellStyle10.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle10.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
this.needSubmitGrid.RowsDefaultCellStyle = dataGridViewCellStyle10;
this.needSubmitGrid.RowTemplate.Height = 23;
this.needSubmitGrid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.needSubmitGrid.Size = new System.Drawing.Size(574, 202);
@ -427,8 +429,8 @@
// U_Weight
//
this.U_Weight.DataPropertyName = "Weight";
dataGridViewCellStyle19.Format = "#0.######";
this.U_Weight.DefaultCellStyle = dataGridViewCellStyle19;
dataGridViewCellStyle9.Format = "#0.######";
this.U_Weight.DefaultCellStyle = dataGridViewCellStyle9;
this.U_Weight.HeaderText = "重量";
this.U_Weight.Name = "U_Weight";
this.U_Weight.ReadOnly = true;
@ -453,6 +455,27 @@
this.flowLayoutPanel1.Size = new System.Drawing.Size(549, 519);
this.flowLayoutPanel1.TabIndex = 0;
//
// noCodeBtn
//
this.noCodeBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.noCodeBtn.AsClicked = false;
this.noCodeBtn.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("noCodeBtn.BackgroundImage")));
this.noCodeBtn.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(45)))), ((int)(((byte)(155)))), ((int)(((byte)(214)))));
this.noCodeBtn.FlatAppearance.BorderSize = 0;
this.noCodeBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.noCodeBtn.Font = new System.Drawing.Font("宋体", 15F);
this.noCodeBtn.ForeColor = System.Drawing.Color.Black;
this.noCodeBtn.Location = new System.Drawing.Point(503, 44);
this.noCodeBtn.Name = "noCodeBtn";
this.noCodeBtn.PlaySound = false;
this.noCodeBtn.Size = new System.Drawing.Size(111, 34);
this.noCodeBtn.SoundType = WinFormControl.SoundType.Click;
this.noCodeBtn.TabIndex = 10;
this.noCodeBtn.Text = "无 码";
this.noCodeBtn.UseVisualStyleBackColor = true;
this.noCodeBtn.WithStataHode = true;
this.noCodeBtn.Click += new System.EventHandler(this.noCodeBtn_Click);
//
// CarcassInStoreForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
@ -513,6 +536,7 @@
private System.Windows.Forms.DataGridViewTextBoxColumn U_BarCode;
private System.Windows.Forms.DataGridViewTextBoxColumn U_Goods_Name;
private System.Windows.Forms.DataGridViewTextBoxColumn U_Weight;
private WinFormControl.UButton noCodeBtn;
}

+ 31
- 20
ButcherFactory.Form/CarcassInStore_/CarcassInStoreForm.cs View File

@ -140,14 +140,22 @@ namespace ButcherFactory.CarcassInStore_
var btn = new UButton() { Width = 130, Height = 75, Text = item.Goods_Name, Tag = item.Goods_ID, Font = new Font("宋体", 15), Margin = new Padding(26, 10, 26, 35), PlaySound = true };
btn.Click += (sender, e) =>
{
if (string.IsNullOrEmpty(uScanPanel1.TextBox.Text))
throw new Exception("请先扫码");
if (uScanPanel1.TextBox.Text.Length != 23)
throw new Exception("条码格式不正确");
if (!noCode)
{
if (string.IsNullOrEmpty(uScanPanel1.TextBox.Text))
throw new Exception("请先扫码");
if (uScanPanel1.TextBox.Text.Length != 23)
throw new Exception("条码格式不正确");
}
var c = sender as UButton;
var list = CarcassInStoreBL.InsertOrUpdate(workUnitID, batchID, (long)c.Tag, uScanPanel1.TextBox.Text);
AfterUpdateOrInsert(list);
uScanPanel1.TextBox.Text = string.Empty;
if (noCode)
{
noCodeBtn_Click(c, EventArgs.Empty);
noCodeBtn.AsClicked = false;
}
};
flowLayoutPanel1.Controls.Add(btn);
}
@ -162,7 +170,7 @@ namespace ButcherFactory.CarcassInStore_
bool downNeedRefresh = false;
foreach (var item in list)
{
if (string.IsNullOrEmpty(item.BarCode))
if (item.Weight.HasValue)
{
var first = historyList.FirstOrDefault(x => x.ID == item.ID);
if (first != null)
@ -170,28 +178,20 @@ namespace ButcherFactory.CarcassInStore_
first.Goods_Name = item.Goods_Name;
downNeedRefresh = true;
}
else
{
var upFirst = needSubmitedList.FirstOrDefault(x => x.ID == item.ID);
if (upFirst != null)
{
upFirst.Goods_Name = item.Goods_Name;
upNeedRefresh = true;
}
}
}
else
{
needSubmitedList.Add(item);
var ordered = needSubmitedList.OrderByDescending(x => x.ID).ToList();
needSubmitedList.Clear();
ordered.ForEach(x => needSubmitedList.Add(x));
var upFirst = needSubmitedList.FirstOrDefault(x => x.ID == item.ID);
if (upFirst != null)
upFirst.Goods_Name = item.Goods_Name;
else
needSubmitedList.Insert(0, item);
upNeedRefresh = true;
}
}
if (upNeedRefresh)
needSubmitGrid.Refresh();
if (downNeedRefresh)
else if (downNeedRefresh)
historyDataGrid.Refresh();
}
}
@ -237,7 +237,7 @@ namespace ButcherFactory.CarcassInStore_
{
if (netStateWatch1.NetState)
{
var list = historyList.Where(x => x.BeforeWeight == null).Take(5);
var list = historyList.Where(x => x.BeforeWeight == null && !string.IsNullOrEmpty(x.BarCode)).Take(5);
if (list.Any())
{
var back = CarcassInStoreBL.GetBeforeWeight(list.Select(x => x.BarCode));
@ -275,5 +275,16 @@ namespace ButcherFactory.CarcassInStore_
{
Close();
}
bool noCode;
private void noCodeBtn_Click(object sender, EventArgs e)
{
if (noCode)
noCodeBtn.Text = "无 码";
else
noCodeBtn.Text = "等待插入";
noCode = !noCode;
}
}
}

+ 8
- 0
ButcherFactory.Form/CarcassInStore_/CarcassInStoreForm.resx View File

@ -118,6 +118,14 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="noCodeBtn.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAAGAAAAAwCAIAAABhdOiYAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
wwAADsMBx2+oZAAAAHNJREFUaEPt0AENACAMwDAkowVB14aDz0CTKui5b1gICoKCoCAoCAqCgqAgKAgK
goKgICgICoKCoCAoCAqCgqAgKAgKgoKgICgICoKCoCAoCAqCgqAgKAgKgoKgICgICoKCoCAoCAqCgqAg
KAgKgoKg1ZsPvpCB0hBohjQAAAAASUVORK5CYII=
</value>
</data>
<data name="closeBtn.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAAGAAAAAwCAIAAABhdOiYAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO


+ 44
- 44
ButcherFactorySolution/ButcherFactorySolution.vdproj View File

@ -21,31 +21,31 @@
}
"Entry"
{
"MsmKey" = "8:_01E56548E879FA791BE1522C98562ED5"
"OwnerKey" = "8:_48F4C977267B436F8DD1B5D0D47494BE"
"MsmKey" = "8:_0F5E9869CD634524B5A3066FC1D1D93E"
"OwnerKey" = "8:_UNDEFINED"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
{
"MsmKey" = "8:_01E56548E879FA791BE1522C98562ED5"
"OwnerKey" = "8:_BF905506D35441369705E8C12149682E"
"MsmKey" = "8:_3E728084E6413DC3E740199EBCA6CF15"
"OwnerKey" = "8:_48F4C977267B436F8DD1B5D0D47494BE"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
{
"MsmKey" = "8:_0F5E9869CD634524B5A3066FC1D1D93E"
"OwnerKey" = "8:_UNDEFINED"
"MsmKey" = "8:_3E728084E6413DC3E740199EBCA6CF15"
"OwnerKey" = "8:_BF905506D35441369705E8C12149682E"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
{
"MsmKey" = "8:_3E728084E6413DC3E740199EBCA6CF15"
"MsmKey" = "8:_4083346C24A7D8470DB4B61D58809784"
"OwnerKey" = "8:_48F4C977267B436F8DD1B5D0D47494BE"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
{
"MsmKey" = "8:_3E728084E6413DC3E740199EBCA6CF15"
"MsmKey" = "8:_4083346C24A7D8470DB4B61D58809784"
"OwnerKey" = "8:_BF905506D35441369705E8C12149682E"
"MsmSig" = "8:_UNDEFINED"
}
@ -82,7 +82,7 @@
"Entry"
{
"MsmKey" = "8:_4D70C75DA5B25015E8DDBF829D234FE8"
"OwnerKey" = "8:_01E56548E879FA791BE1522C98562ED5"
"OwnerKey" = "8:_4083346C24A7D8470DB4B61D58809784"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
@ -106,13 +106,13 @@
"Entry"
{
"MsmKey" = "8:_8D58B6FD6249E85E930D55CCE736855E"
"OwnerKey" = "8:_48F4C977267B436F8DD1B5D0D47494BE"
"OwnerKey" = "8:_4083346C24A7D8470DB4B61D58809784"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
{
"MsmKey" = "8:_8D58B6FD6249E85E930D55CCE736855E"
"OwnerKey" = "8:_01E56548E879FA791BE1522C98562ED5"
"OwnerKey" = "8:_48F4C977267B436F8DD1B5D0D47494BE"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
@ -148,7 +148,7 @@
"Entry"
{
"MsmKey" = "8:_C1BAA40E3F5E065EA88D97DA96D5992D"
"OwnerKey" = "8:_01E56548E879FA791BE1522C98562ED5"
"OwnerKey" = "8:_4083346C24A7D8470DB4B61D58809784"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
@ -178,7 +178,7 @@
"Entry"
{
"MsmKey" = "8:_D75F76D9C28EDCFD7454D52CBB18C6E9"
"OwnerKey" = "8:_01E56548E879FA791BE1522C98562ED5"
"OwnerKey" = "8:_4083346C24A7D8470DB4B61D58809784"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
@ -202,19 +202,19 @@
"Entry"
{
"MsmKey" = "8:_UNDEFINED"
"OwnerKey" = "8:_BF905506D35441369705E8C12149682E"
"OwnerKey" = "8:_4083346C24A7D8470DB4B61D58809784"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
{
"MsmKey" = "8:_UNDEFINED"
"OwnerKey" = "8:_3E728084E6413DC3E740199EBCA6CF15"
"OwnerKey" = "8:_BF905506D35441369705E8C12149682E"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
{
"MsmKey" = "8:_UNDEFINED"
"OwnerKey" = "8:_01E56548E879FA791BE1522C98562ED5"
"OwnerKey" = "8:_3E728084E6413DC3E740199EBCA6CF15"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
@ -374,23 +374,12 @@
"IsDependency" = "11:FALSE"
"IsolateTo" = "8:"
}
"{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_01E56548E879FA791BE1522C98562ED5"
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_0F5E9869CD634524B5A3066FC1D1D93E"
{
"AssemblyRegister" = "3:1"
"AssemblyIsInGAC" = "11:FALSE"
"AssemblyAsmDisplayName" = "8:ButcherFactory.BO, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"
"ScatterAssemblies"
{
"_01E56548E879FA791BE1522C98562ED5"
{
"Name" = "8:ButcherFactory.BO.dll"
"Attributes" = "3:512"
}
}
"SourcePath" = "8:ButcherFactory.BO.dll"
"TargetName" = "8:"
"SourcePath" = "8:..\\..\\WinFormControl\\WinFormControl\\Sounds\\shotSucc.wav"
"TargetName" = "8:shotSucc.wav"
"Tag" = "8:"
"Folder" = "8:_A4535DAA71C54DC088A3FA09FCED8C88"
"Folder" = "8:_6866532246094A308566729453EB35CA"
"Condition" = "8:"
"Transitive" = "11:FALSE"
"Vital" = "11:TRUE"
@ -402,15 +391,26 @@
"PackageAs" = "3:1"
"Register" = "3:1"
"Exclude" = "11:FALSE"
"IsDependency" = "11:TRUE"
"IsDependency" = "11:FALSE"
"IsolateTo" = "8:"
}
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_0F5E9869CD634524B5A3066FC1D1D93E"
"{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_3E728084E6413DC3E740199EBCA6CF15"
{
"SourcePath" = "8:..\\..\\WinFormControl\\WinFormControl\\Sounds\\shotSucc.wav"
"TargetName" = "8:shotSucc.wav"
"AssemblyRegister" = "3:1"
"AssemblyIsInGAC" = "11:FALSE"
"AssemblyAsmDisplayName" = "8:WinFormControl, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"
"ScatterAssemblies"
{
"_3E728084E6413DC3E740199EBCA6CF15"
{
"Name" = "8:WinFormControl.dll"
"Attributes" = "3:512"
}
}
"SourcePath" = "8:WinFormControl.dll"
"TargetName" = "8:"
"Tag" = "8:"
"Folder" = "8:_6866532246094A308566729453EB35CA"
"Folder" = "8:_A4535DAA71C54DC088A3FA09FCED8C88"
"Condition" = "8:"
"Transitive" = "11:FALSE"
"Vital" = "11:TRUE"
@ -422,23 +422,23 @@
"PackageAs" = "3:1"
"Register" = "3:1"
"Exclude" = "11:FALSE"
"IsDependency" = "11:FALSE"
"IsDependency" = "11:TRUE"
"IsolateTo" = "8:"
}
"{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_3E728084E6413DC3E740199EBCA6CF15"
"{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_4083346C24A7D8470DB4B61D58809784"
{
"AssemblyRegister" = "3:1"
"AssemblyIsInGAC" = "11:FALSE"
"AssemblyAsmDisplayName" = "8:WinFormControl, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"
"AssemblyAsmDisplayName" = "8:ButcherFactory.BO, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"
"ScatterAssemblies"
{
"_3E728084E6413DC3E740199EBCA6CF15"
"_4083346C24A7D8470DB4B61D58809784"
{
"Name" = "8:WinFormControl.dll"
"Name" = "8:ButcherFactory.BO.dll"
"Attributes" = "3:512"
}
}
"SourcePath" = "8:WinFormControl.dll"
"SourcePath" = "8:ButcherFactory.BO.dll"
"TargetName" = "8:"
"Tag" = "8:"
"Folder" = "8:_A4535DAA71C54DC088A3FA09FCED8C88"
@ -883,7 +883,7 @@
"Name" = "8:Microsoft Visual Studio"
"ProductName" = "8:青花瓷屠宰车间管理"
"ProductCode" = "8:{8D06A3CB-94E1-40DF-BF89-0A822D5302EF}"
"PackageCode" = "8:{4B5166F7-81DC-4836-94B5-FB2F83C03ADA}"
"PackageCode" = "8:{9BB79266-FF42-4A54-A165-99346FD7411F}"
"UpgradeCode" = "8:{D5614731-239C-49A6-8F35-DB6F5D8E8A8C}"
"AspNetVersion" = "8:4.0.30319.0"
"RestartWWWService" = "11:FALSE"
@ -1446,7 +1446,7 @@
{
"{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_48F4C977267B436F8DD1B5D0D47494BE"
{
"SourcePath" = "8:..\\ButcherFactory.Login\\obj\\Debug\\ButcherFactory.Login.exe"
"SourcePath" = "8:..\\ButcherFactory.Login\\obj\\Release\\ButcherFactory.Login.exe"
"TargetName" = "8:"
"Tag" = "8:"
"Folder" = "8:_A4535DAA71C54DC088A3FA09FCED8C88"


Loading…
Cancel
Save