Browse Source

车间产品分标准件和非标准件,配货的时候标准件按报价数量进行备货,非标准件按辅数量进行备货。

master
yibo 7 years ago
parent
commit
e3f4a66f96
12 changed files with 89 additions and 39 deletions
  1. +3
    -0
      ButcherFactory.BO/BaseInfo/ClientGoodsSet.cs
  2. +3
    -0
      ButcherFactory.BO/Bill/SegmentProduction.cs
  3. +11
    -1
      ButcherFactory.BO/Bill/StockUpEntity.cs
  4. +2
    -0
      ButcherFactory.BO/LocalBL/FormClientGoodsSetBL.cs
  5. +19
    -9
      ButcherFactory.BO/LocalBL/SegmentProductionBL.cs
  6. +2
    -2
      ButcherFactory.BO/LocalBL/SegmentStockUpBL.cs
  7. +25
    -19
      ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.cs
  8. +6
    -2
      ButcherFactory.Form/SegmentProduction_/SegmentProductionPrint.cs
  9. +1
    -1
      ButcherFactory.Form/SegmentProduction_/SegmentProductionPrint.html
  10. +1
    -1
      ButcherFactory.Form/SegmentProduction_/SegmentProductionPrint1.html
  11. +8
    -3
      ButcherFactory.Form/SegmentStockUp_/SegmentStockUpForm.cs
  12. +8
    -1
      ButcherFactory.Tools/MainWindow.xaml.cs

+ 3
- 0
ButcherFactory.BO/BaseInfo/ClientGoodsSet.cs View File

@ -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; }
}


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

@ -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


+ 11
- 1
ButcherFactory.BO/Bill/StockUpEntity.cs View File

@ -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
{


+ 2
- 0
ButcherFactory.BO/LocalBL/FormClientGoodsSetBL.cs View File

@ -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


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

@ -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<string> GetInStoreState(List<string> codeArr)
{
var json = RpcFacade.Call<string>(RpcPath + "CheckInStored", JsonConvert.SerializeObject(codeArr));
return JsonConvert.DeserializeObject<List<string>>(json);
try
{
var json = RpcFacade.Call<string>(RpcPath + "CheckInStored", JsonConvert.SerializeObject(codeArr));
return JsonConvert.DeserializeObject<List<string>>(json);
}
catch(Exception ex)
{
#if DEBUG
throw;
#endif
return new List<string>();
}
}
public static void SetInStored(List<long> 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


+ 2
- 2
ButcherFactory.BO/LocalBL/SegmentStockUpBL.cs View File

@ -21,10 +21,10 @@ namespace ButcherFactory.BO.LocalBL
/// </summary>
/// <param name="code"></param>
/// <returns>GoodsCode:StringExt1,Weight:DecimalExt1</returns>
public static ExtensionObj StockUpScan(string code)
public static Tuple<string, decimal?, bool> StockUpScan(string code)
{
var json = ButcherFactoryUtil.SecondUrlCall<string>(MESPath + "SegmentInStoreRpc/StockUpScan", code);
return JsonConvert.DeserializeObject<ExtensionObj>(json);
return JsonConvert.DeserializeObject<Tuple<string, decimal?, bool>>(json);
}
public static List<SaleOutStoreInfo> GetSaleOutStoreList(DateTime date)


+ 25
- 19
ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.cs View File

@ -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);


+ 6
- 2
ButcherFactory.Form/SegmentProduction_/SegmentProductionPrint.cs View File

@ -23,8 +23,12 @@ namespace ButcherFactory.SegmentProduction_
dt = DateTime.Today;
var dic = new Dictionary<string, string>();
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);


+ 1
- 1
ButcherFactory.Form/SegmentProduction_/SegmentProductionPrint.html View File

@ -16,7 +16,7 @@
</head>
<body>
<div style='font-size:16px;'>品名:$Goods_Name</div>
<div style='margin-top:10px;font-size:14px;'>重量:$Weight KG &nbsp;&nbsp;生产日期:$Date</div>
<div style='margin-top:10px;font-size:14px;'>$Info &nbsp;生产日期:$Date</div>
<table align='center' style='width:100%;margin-top:5px;border-collapse:collapse;border-width:1px;line-height:15px;'>
<tr><td>执行标准:</td><td>GB/T9959.2-2008</td><td rowspan='3'><img src='$ImageUrl' style='margin:-5px 0px -5px 20px;' /></td></tr>
<tr><td>储存条件:</td><td>0~4℃保存</td></tr>


+ 1
- 1
ButcherFactory.Form/SegmentProduction_/SegmentProductionPrint1.html View File

@ -16,7 +16,7 @@
</head>
<body>
<div style='font-size:16px;'>品名:$Goods_Name</div>
<div style='margin-top:10px;font-size:14px;'>重量:$Weight KG &nbsp;&nbsp;生产日期:$Date</div>
<div style='margin-top:10px;font-size:14px;'>$Info &nbsp;生产日期:$Date</div>
<table align='center' style='width:100%;margin-top:5px;border-collapse:collapse;border-width:1px;line-height:15px;'>
<tr><td>执行标准:</td><td>GB/T9959.2-2008</td><td rowspan='3'><img src='$ImageUrl' style='margin:-5px 0px -5px 20px;' /></td></tr>
<tr><td>储存条件:</td><td>-18℃以下保存</td></tr>


+ 8
- 3
ButcherFactory.Form/SegmentStockUp_/SegmentStockUpForm.cs View File

@ -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<string,decimal?,bool> 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);


+ 8
- 1
ButcherFactory.Tools/MainWindow.xaml.cs View File

@ -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("数据库升级成功");
}


Loading…
Cancel
Save