|
|
|
@ -95,8 +95,8 @@ namespace ButcherFactory.SegmentSaleOut_ |
|
|
|
if (string.IsNullOrEmpty(barCode)) |
|
|
|
throw new Exception("条码错误"); |
|
|
|
if (already) |
|
|
|
throw new Exception("正在查看已配货记录,不允许配货"); |
|
|
|
if (detailGridView.CurrentRow == null) |
|
|
|
throw new Exception("正在查看已配货记录,不允许配货"); |
|
|
|
if (details == null || details.Count == 0) |
|
|
|
throw new Exception("没有订货明细"); |
|
|
|
if (weightRecord.Any(x => x.BarCode == barCode)) |
|
|
|
throw new Exception("扫码重复"); |
|
|
|
@ -112,7 +112,7 @@ namespace ButcherFactory.SegmentSaleOut_ |
|
|
|
|
|
|
|
void InsertDetailByScan(string barCode) |
|
|
|
{ |
|
|
|
var orderDetail = detailGridView.CurrentRow.DataBoundItem as SaleOutStore_Detail; |
|
|
|
//var orderDetail = detailGridView.CurrentRow.DataBoundItem as SaleOutStore_Detail;
|
|
|
|
var detail = new SegmentSaleOut_Detail(); |
|
|
|
detail.BarCode = barCode; |
|
|
|
if (weightRecord.Any()) |
|
|
|
@ -120,12 +120,12 @@ namespace ButcherFactory.SegmentSaleOut_ |
|
|
|
else |
|
|
|
detail.Idx = 1; |
|
|
|
|
|
|
|
SegmentSaleOutBL.InsertByCode(orderDetail, detail); |
|
|
|
var detailID = SegmentSaleOutBL.InsertByCode(details, detail); |
|
|
|
|
|
|
|
weightRecord.Insert(0, detail); |
|
|
|
weightRecordGridView.FirstDisplayedScrollingRowIndex = 0; |
|
|
|
weightRecordGridView.Refresh(); |
|
|
|
BindDetailByLocal(orderDetail.ID); |
|
|
|
weightRecordGridView.Refresh(); |
|
|
|
BindDetailByLocal(detailID); |
|
|
|
} |
|
|
|
|
|
|
|
void BatchInsertByScan(string barCode) |
|
|
|
@ -133,7 +133,7 @@ namespace ButcherFactory.SegmentSaleOut_ |
|
|
|
var results = SegmentSaleOutBL.InsertByStockUp(barCode, details); |
|
|
|
var orderDetail = detailGridView.CurrentRow.DataBoundItem as SaleOutStore_Detail; |
|
|
|
var idx = weightRecord.Any() ? weightRecord.Max(x => x.Idx) + 1 : 1; |
|
|
|
foreach (var item in results.Where(x=>x.DetailID==orderDetail.ID)) |
|
|
|
foreach (var item in results) |
|
|
|
{ |
|
|
|
item.Idx = idx; |
|
|
|
weightRecord.Insert(0, item); |
|
|
|
@ -400,22 +400,23 @@ namespace ButcherFactory.SegmentSaleOut_ |
|
|
|
weightRecord = SegmentSaleOutBL.GetWeightRecord((long)row.Cells["D_ID"].Value); |
|
|
|
weightRecordGridView.DataSource = weightRecord; |
|
|
|
weightRecordGridView.Refresh(); |
|
|
|
} |
|
|
|
|
|
|
|
void BindDetailByLocal(long detailID) |
|
|
|
{ |
|
|
|
var first = details.First(x => x.ID == detailID); |
|
|
|
first.SNumber = weightRecord.Sum(x => x.Number); |
|
|
|
first.SSecondNumber = weightRecord.Sum(x => x.SecondNumber ?? 0); |
|
|
|
foreach (DataGridViewRow row in detailGridView.Rows) |
|
|
|
{ |
|
|
|
if ((long)row.Cells[0].Value == detailID) |
|
|
|
{ |
|
|
|
row.Selected = true; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
detailGridView.Refresh(); |
|
|
|
} |
|
|
|
|
|
|
|
void BindDetailByLocal(long detailID) |
|
|
|
{ |
|
|
|
var first = details.First(x => x.ID == detailID); |
|
|
|
var list = weightRecord.Where(x => x.DetailID == detailID); |
|
|
|
first.SNumber = list.Sum(x => x.Number); |
|
|
|
first.SSecondNumber = list.Sum(x => x.SecondNumber ?? 0); |
|
|
|
foreach (DataGridViewRow row in detailGridView.Rows) |
|
|
|
{ |
|
|
|
if ((long)row.Cells[0].Value == detailID) |
|
|
|
{ |
|
|
|
row.Selected = true; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
detailGridView.Refresh(); |
|
|
|
} |
|
|
|
|
|
|
|
void BindLabels(SaleOutStore entity) |
|
|
|
|