diff --git a/ButcherFactory.BO/BaseInfo/ClientGoodsSet.cs b/ButcherFactory.BO/BaseInfo/ClientGoodsSet.cs index b460122..d27ea1b 100644 --- a/ButcherFactory.BO/BaseInfo/ClientGoodsSet.cs +++ b/ButcherFactory.BO/BaseInfo/ClientGoodsSet.cs @@ -47,6 +47,9 @@ namespace ButcherFactory.BO public decimal? StandardWeightLow { get; set; } + [DbColumn(DefaultValue = 0)] + public bool StandardPic { get; set; } + [NonDmoProperty] public bool Selected { get; set; } } diff --git a/ButcherFactory.BO/Bill/SegmentProduction.cs b/ButcherFactory.BO/Bill/SegmentProduction.cs index 0b057d6..d78e65d 100644 --- a/ButcherFactory.BO/Bill/SegmentProduction.cs +++ b/ButcherFactory.BO/Bill/SegmentProduction.cs @@ -59,6 +59,9 @@ namespace ButcherFactory.BO [DbColumn(DefaultValue = false)] public bool InStored { get; set; } + + [DbColumn(DefaultValue = 0)] + public bool StandardPic { get; set; } } public class ProductTask diff --git a/ButcherFactory.BO/Bill/StockUpEntity.cs b/ButcherFactory.BO/Bill/StockUpEntity.cs index 5e7ab8d..3faaebc 100644 --- a/ButcherFactory.BO/Bill/StockUpEntity.cs +++ b/ButcherFactory.BO/Bill/StockUpEntity.cs @@ -22,9 +22,16 @@ namespace ButcherFactory.BO public decimal? SSecondNumber { get; set; } public decimal? SUnitNum { get; set; } public decimal? Rate { get; set; } + [DbColumn(DefaultValue = 0)] + public bool StandardPic { get; set; } public bool Finishd { - get { return (UnitNum ?? 0) <= (SUnitNum ?? 0); } + get + { + if (StandardPic) + return (UnitNum ?? 0) <= (SUnitNum ?? 0); + return (SecondNumber ?? 0) <= (SSecondNumber ?? 0); + } } } @@ -46,6 +53,9 @@ namespace ButcherFactory.BO public decimal? UnitNumber { get; set; } + [DbColumn(DefaultValue = 0)] + public bool StandardPic { get; set; } + [NonDmoProperty] public string ShortCode { diff --git a/ButcherFactory.BO/LocalBL/FormClientGoodsSetBL.cs b/ButcherFactory.BO/LocalBL/FormClientGoodsSetBL.cs index aefd7d1..d02758c 100644 --- a/ButcherFactory.BO/LocalBL/FormClientGoodsSetBL.cs +++ b/ButcherFactory.BO/LocalBL/FormClientGoodsSetBL.cs @@ -68,6 +68,7 @@ namespace ButcherFactory.BO.LocalBL query.Columns.Add(DQSelectColumn.Field("Goods_Spec", detail)); query.Columns.Add(DQSelectColumn.Field("Goods_Code", detail)); query.Columns.Add(DQSelectColumn.Field("GoodsType", detail)); + query.Columns.Add(DQSelectColumn.Field("StandardPic", detail)); query.OrderBy.Expressions.Add(DQOrderByExpression.Create(main, "ID")); query.OrderBy.Expressions.Add(DQOrderByExpression.Create(detail, "ID")); @@ -89,6 +90,7 @@ namespace ButcherFactory.BO.LocalBL entity.Goods_Spec = (string)reader[6]; entity.Goods_Code = (string)reader[7]; entity.GoodsType = (short?)reader[8]; + entity.StandardPic = (bool)reader[9]; if (result.ContainsKey(key)) result[key].Add(entity); else diff --git a/ButcherFactory.BO/LocalBL/SegmentProductionBL.cs b/ButcherFactory.BO/LocalBL/SegmentProductionBL.cs index 3344fc5..f207ea2 100644 --- a/ButcherFactory.BO/LocalBL/SegmentProductionBL.cs +++ b/ButcherFactory.BO/LocalBL/SegmentProductionBL.cs @@ -29,6 +29,7 @@ namespace ButcherFactory.BO.LocalBL query.Columns.Add(DQSelectColumn.Field("GroupID")); query.Columns.Add(DQSelectColumn.Field("TrunOutID")); query.Columns.Add(DQSelectColumn.Field("Goods_Spec")); + query.Columns.Add(DQSelectColumn.Field("StandardPic")); query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("InStored", false), DQCondition.EQ("Delete", false), DQCondition.EQ("Submited", submited))); query.OrderBy.Expressions.Add(DQOrderByExpression.Create("ID", true)); if (submited) @@ -52,6 +53,7 @@ namespace ButcherFactory.BO.LocalBL entity.GroupID = (long?)reader[5]; entity.TrunOutID = (long?)reader[6]; entity.Goods_Spec = (string)reader[7]; + entity.StandardPic = (bool)reader[8]; entity.Submited = submited; list.Add(entity); } @@ -79,17 +81,12 @@ namespace ButcherFactory.BO.LocalBL } } - public static SegmentProduction InsertAndSetGroupID(long goodsID, decimal weight, long? workUnitID, long productBatchID, DateTime batchDate, bool test) + public static SegmentProduction InsertAndSetGroupID(SegmentProduction entity,DateTime batchDate, bool test) { using (var session = DmoSession.New()) { - var entity = new SegmentProduction(); - entity.Goods_ID = goodsID; - entity.Weight = weight; entity.UserID = AppContext.Worker.ID; - entity.WorkUnit_ID = workUnitID; - entity.ProductBatch_ID = productBatchID; - entity.RowIndex = GenerateRowIndex(productBatchID, session); + entity.RowIndex = GenerateRowIndex(entity.ProductBatch_ID, session); entity.BarCode = string.Format("260912011{0:yyyyMMdd}{1}{2:00000}", batchDate, AppContext.ConnectInfo.ClientCode, entity.RowIndex); entity.Submited = true; if (!test) @@ -167,8 +164,18 @@ namespace ButcherFactory.BO.LocalBL public static List GetInStoreState(List codeArr) { - var json = RpcFacade.Call(RpcPath + "CheckInStored", JsonConvert.SerializeObject(codeArr)); - return JsonConvert.DeserializeObject>(json); + try + { + var json = RpcFacade.Call(RpcPath + "CheckInStored", JsonConvert.SerializeObject(codeArr)); + return JsonConvert.DeserializeObject>(json); + } + catch(Exception ex) + { +#if DEBUG + throw; +#endif + return new List(); + } } public static void SetInStored(List ids) @@ -262,6 +269,7 @@ namespace ButcherFactory.BO.LocalBL query.Columns.Add(DQSelectColumn.Field("Weight")); query.Columns.Add(DQSelectColumn.Field("CreateTime")); query.Columns.Add(DQSelectColumn.Field("Delete")); + query.Columns.Add(DQSelectColumn.Field("StandardPic")); query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("Submited", true), DQCondition.EQ("Sync", false))); query.Range = SelectRange.Top(10); query.OrderBy.Expressions.Add(DQOrderByExpression.Create("ID")); @@ -282,6 +290,7 @@ namespace ButcherFactory.BO.LocalBL obj.Weight = (decimal)reader[7]; obj.ProductTime = (DateTime)reader[8]; obj.Delete = (bool)reader[9]; + obj.StandardPic = (bool)reader[10]; upload.Add(obj); } } @@ -341,6 +350,7 @@ namespace ButcherFactory.BO.LocalBL public decimal? Weight { get; set; } public DateTime? InStoreTime { get; set; } public bool Delete { get; set; } + public bool StandardPic { get; set; } } class TaskTemp diff --git a/ButcherFactory.BO/LocalBL/SegmentStockUpBL.cs b/ButcherFactory.BO/LocalBL/SegmentStockUpBL.cs index b52d95f..c16f10f 100644 --- a/ButcherFactory.BO/LocalBL/SegmentStockUpBL.cs +++ b/ButcherFactory.BO/LocalBL/SegmentStockUpBL.cs @@ -21,10 +21,10 @@ namespace ButcherFactory.BO.LocalBL /// /// /// GoodsCode:StringExt1,Weight:DecimalExt1 - public static ExtensionObj StockUpScan(string code) + public static Tuple StockUpScan(string code) { var json = ButcherFactoryUtil.SecondUrlCall(MESPath + "SegmentInStoreRpc/StockUpScan", code); - return JsonConvert.DeserializeObject(json); + return JsonConvert.DeserializeObject>(json); } public static List GetSaleOutStoreList(DateTime date) diff --git a/ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.cs b/ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.cs index 7dcaa3b..4cb4cbc 100644 --- a/ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.cs +++ b/ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.cs @@ -131,7 +131,7 @@ namespace ButcherFactory.SegmentProductionAuto_ var arr = goodsSetDic[groupBtn.Text]; foreach (var item in arr) { - var btn = new ColorButton() { Width = 127, Height = 75, Text = item.Goods_Name, Tag = item, Font = new Font("宋体", 15), BackColor = goodsColor, Margin = new Padding(20, 10, 20, 35), PlaySound = true }; + 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); } @@ -152,7 +152,13 @@ namespace ButcherFactory.SegmentProductionAuto_ throw new Exception(string.Format("重量必须在{0:#0.######}-{1:#0.######}之间", detail.StandardWeightLow, detail.StandardWeightUp)); weight = detail.StandardWeight.Value; } - var entity = SegmentProductionBL.InsertAndSetGroupID(detail.Goods_ID, weight, config.WorkUnitID, batchID.Value, batchDate.Value, testCkBox.Checked); + var 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; + SegmentProductionBL.InsertAndSetGroupID(entity, batchDate.Value, testCkBox.Checked); entity.Goods_Code = detail.Goods_Code; entity.Goods_Name = detail.Goods_Name; entity.Goods_Spec = detail.Goods_Spec; @@ -182,10 +188,10 @@ namespace ButcherFactory.SegmentProductionAuto_ void RefreshTask(object obj) { + var entity = obj as SegmentProduction; + taskDataGrid.DataSource = SegmentProductionBL.GetProductTask(batchDate ?? DateTime.Today, entity); this.Invoke(new Action(() => { - var entity = obj as SegmentProduction; - taskDataGrid.DataSource = SegmentProductionBL.GetProductTask(batchDate ?? DateTime.Today, entity); taskDataGrid.Refresh(); })); } @@ -207,11 +213,11 @@ namespace ButcherFactory.SegmentProductionAuto_ { try { - this.Invoke(new Action(() => - { - if (netStateWatch1.NetState) - SegmentProductionBL.UploadSegmentInfo(); - })); + //this.Invoke(new Action(() => + //{ + if (netStateWatch1.NetState) + SegmentProductionBL.UploadSegmentInfo(); + //})); } catch { } Thread.Sleep(2000); @@ -224,25 +230,25 @@ namespace ButcherFactory.SegmentProductionAuto_ { try { - this.Invoke(new Action(() => + if (netStateWatch1.NetState) { - if (netStateWatch1.NetState) + if (historyList.Any()) { - if (historyList.Any()) + var arr = historyList.Reverse().Take(20).ToList(); + var inStored = SegmentProductionBL.GetInStoreState(arr.Select(x => x.BarCode).ToList()); + var tag = arr.Where(x => inStored.Contains(x.BarCode)); + if (tag.Any()) { - var arr = historyList.Reverse().Take(20).ToList(); - var inStored = SegmentProductionBL.GetInStoreState(arr.Select(x => x.BarCode).ToList()); - var tag = arr.Where(x => inStored.Contains(x.BarCode)); - if (tag.Any()) + SegmentProductionBL.SetInStored(tag.Select(x => x.ID).ToList()); + this.Invoke(new Action(() => { - SegmentProductionBL.SetInStored(tag.Select(x => x.ID).ToList()); foreach (var item in tag) historyList.Remove(item); historyDataGrid.Refresh(); - } + })); } } - })); + } } catch { } Thread.Sleep(5000); diff --git a/ButcherFactory.Form/SegmentProduction_/SegmentProductionPrint.cs b/ButcherFactory.Form/SegmentProduction_/SegmentProductionPrint.cs index 9ec3b8a..4ebe89b 100644 --- a/ButcherFactory.Form/SegmentProduction_/SegmentProductionPrint.cs +++ b/ButcherFactory.Form/SegmentProduction_/SegmentProductionPrint.cs @@ -23,8 +23,12 @@ namespace ButcherFactory.SegmentProduction_ dt = DateTime.Today; var dic = new Dictionary(); dic.Add("$Goods_Name", entity.Goods_Name); - //dic.Add("$Goods_Spec", entity.Goods_Spec); - dic.Add("$Weight", entity.Weight.ToString("#0.##")); + var info = string.Empty; + if (entity.StandardPic) + info = string.Format("规格:{0}", entity.Goods_Spec); + else + info = string.Format("重量:{0:#0.##}KG", entity.Weight); + dic.Add("$Info", info); dic.Add("$Date", dt.Value.ToString("yyyy/MM/dd")); var imgUrl = string.Format(IMGFILE, id); var url = string.Format(AppContext.ConnectInfo.TraceBackUrl + "?code={0}", entity.BarCode); diff --git a/ButcherFactory.Form/SegmentProduction_/SegmentProductionPrint.html b/ButcherFactory.Form/SegmentProduction_/SegmentProductionPrint.html index 22c7393..df717f7 100644 --- a/ButcherFactory.Form/SegmentProduction_/SegmentProductionPrint.html +++ b/ButcherFactory.Form/SegmentProduction_/SegmentProductionPrint.html @@ -16,7 +16,7 @@
品名:$Goods_Name
-
重量:$Weight KG   生产日期:$Date
+
$Info  生产日期:$Date
diff --git a/ButcherFactory.Form/SegmentProduction_/SegmentProductionPrint1.html b/ButcherFactory.Form/SegmentProduction_/SegmentProductionPrint1.html index 1595a26..86006e6 100644 --- a/ButcherFactory.Form/SegmentProduction_/SegmentProductionPrint1.html +++ b/ButcherFactory.Form/SegmentProduction_/SegmentProductionPrint1.html @@ -16,7 +16,7 @@
品名:$Goods_Name
-
重量:$Weight KG   生产日期:$Date
+
$Info  生产日期:$Date
执行标准:GB/T9959.2-2008
储存条件:0~4℃保存
diff --git a/ButcherFactory.Form/SegmentStockUp_/SegmentStockUpForm.cs b/ButcherFactory.Form/SegmentStockUp_/SegmentStockUpForm.cs index 029be36..46fbcbc 100644 --- a/ButcherFactory.Form/SegmentStockUp_/SegmentStockUpForm.cs +++ b/ButcherFactory.Form/SegmentStockUp_/SegmentStockUpForm.cs @@ -105,6 +105,7 @@ namespace ButcherFactory.SegmentStockUp_ var first = allMain.FirstOrDefault(x => x.DetailID == g.Key); if (first != null) { + first.StandardPic = g.First().StandardPic; first.SUnitNum = g.Sum(x => x.UnitNumber ?? 0); first.SSecondNumber = g.Sum(x => x.SecondNumber ?? 0); } @@ -134,7 +135,7 @@ namespace ButcherFactory.SegmentStockUp_ InfoBox.Show("错误", "条码未入库", Color.Blue, 1); return; } - var first = allMain.FirstOrDefault(x => !x.Finishd && x.Goods_Code == info.StringExt1); + var first = allMain.FirstOrDefault(x => !x.Finishd && x.Goods_Code == info.Item1); if (first == null) { InfoBox.Show("提示", "没有订单", Color.Red, 1); @@ -143,7 +144,7 @@ namespace ButcherFactory.SegmentStockUp_ InsertDetail(info, first); } - void InsertDetail(ExtensionObj scan,SaleOutStoreInfo saleOutStore) + void InsertDetail(Tuple scan,SaleOutStoreInfo saleOutStore) { var detail = new SegmentStockUp(); detail.BarCode = uScanPanel1.TextBox.Text; @@ -152,13 +153,17 @@ namespace ButcherFactory.SegmentStockUp_ detail.DeliverGoodsLine_Name = saleOutStore.DeliverGoodsLine_Name; detail.Goods_Name = saleOutStore.Goods_Name; detail.BillID = saleOutStore.BillID; - detail.UnitNumber = scan.DecimalExt1; + detail.UnitNumber = scan.Item2; + detail.StandardPic = scan.Item3; if (detail.UnitNumber.HasValue && saleOutStore.Rate.HasValue) detail.SecondNumber = detail.UnitNumber * saleOutStore.Rate; + else + detail.SecondNumber = 1; SegmentStockUpBL.Insert(detail); allDetail.Add(detail); if (printCk.Checked) SegmentStockUpPrint.Print(detail, saleOutStore.Customer_Name); + saleOutStore.StandardPic = detail.StandardPic; saleOutStore.SSecondNumber = (saleOutStore.SSecondNumber ?? 0) + (detail.SecondNumber ?? 0); saleOutStore.SUnitNum = (saleOutStore.SUnitNum ?? 0) + (detail.UnitNumber ?? 0); BindMainGrid(saleOutStore); diff --git a/ButcherFactory.Tools/MainWindow.xaml.cs b/ButcherFactory.Tools/MainWindow.xaml.cs index 6d76999..b353f1d 100644 --- a/ButcherFactory.Tools/MainWindow.xaml.cs +++ b/ButcherFactory.Tools/MainWindow.xaml.cs @@ -56,7 +56,14 @@ namespace ButcherFactory.Tools { MessageBox.Show("请先设置数据库地址", "错误", MessageBoxButton.OK, MessageBoxImage.Error); } - DbUtil.UpdateDatabase(AppContext.ConnectInfo.SqlConnection); + try + { + DbUtil.UpdateDatabase(AppContext.ConnectInfo.SqlConnection); + } + catch (Exception ex) { + MessageBox.Show(ex.Message); + return; + } MessageBox.Show("数据库升级成功"); }
执行标准:GB/T9959.2-2008
储存条件:-18℃以下保存