From 3ddd9c14d9bf41c2f7b617782dd9dd00a323d4f4 Mon Sep 17 00:00:00 2001 From: wushukun <18860363876@163.com> Date: Thu, 4 Jul 2019 16:34:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=AE=9E=E6=97=B6=E5=AE=8C?= =?UTF-8?q?=E5=B7=A5=E6=95=B0=E9=87=8F=20=E8=AF=A6=E8=A7=81=E9=9C=80?= =?UTF-8?q?=E6=B1=82=E5=8D=95=20143291?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CowOutputClient/OperateWindow.xaml | 5 +- CowOutputClient/OperateWindow.xaml.cs | 8 +- WeighBusiness/BL/ProductPlanBL.cs | 113 +++++++++++++++++++++++++- 3 files changed, 119 insertions(+), 7 deletions(-) diff --git a/CowOutputClient/OperateWindow.xaml b/CowOutputClient/OperateWindow.xaml index e6c781f..3c89aa8 100644 --- a/CowOutputClient/OperateWindow.xaml +++ b/CowOutputClient/OperateWindow.xaml @@ -90,8 +90,9 @@ Property="HorizontalContentAlignment" Value="Center"> - - + + + diff --git a/CowOutputClient/OperateWindow.xaml.cs b/CowOutputClient/OperateWindow.xaml.cs index 3cb5bbc..b6b83e1 100644 --- a/CowOutputClient/OperateWindow.xaml.cs +++ b/CowOutputClient/OperateWindow.xaml.cs @@ -294,7 +294,7 @@ namespace CowOutputClient var infoWindow = new AutoCloseWindow("计划数量【" + mButcherDetailData.PlanNumber + "】完工数量【" + finishNum + "】超出【" + (finishNum - mButcherDetailData.PlanNumber) + "】"); infoWindow.ShowDialog(); } - ProductPlanBL.UpdateButhcerDetailFinishNum(finishNum, mButcherDetailData.DetailID, mButcherDetailData.Goods_ID, she); + ProductPlanBL.UpdateButhcerDetailFinishNum(mButcherDetailData,finishNum, mButcherDetailData.DetailID, mButcherDetailData.Goods_ID, she); //weight.DetailSequence = WeightInfoBL.GetCurrentSequence(mButcherDetailData.DetailID); } WeightInfoBL.Insert(weight,she); @@ -303,7 +303,7 @@ namespace CowOutputClient //待事务提交后再更新UI的值 if (mButcherDetailData != null && detail.Goods_ID == mButcherDetailData.Goods_ID) { mButcherDetailData.FinishNum = finishNum; - mButcherDetailData.SurplusNum = (mButcherDetailData.PlanNumber ?? 0) - (mButcherDetailData.FinishNum ?? 0); + mButcherDetailData.SurplusNum = (mButcherDetailData.PlanNumber ?? 0) - (mButcherDetailData.DeliveryNumber ?? 0); } BindGridWeightInfo(weight.ButcDetailID); gridWeightInfo.ScrollIntoView(gridWeightInfo.Items[0]); @@ -489,14 +489,14 @@ namespace CowOutputClient if (results.Count() > 0) { result = results.First(); finishNum = result.FinishNum - detail.Weight; - ProductPlanBL.UpdateButhcerDetailFinishNum(finishNum,result.DetailID,result.Goods_ID,she); + ProductPlanBL.UpdateButhcerDetailFinishNum(result,finishNum, result.DetailID,result.Goods_ID,she); } she.Commit(); } //待事务提交后再更新UI的值 if (result != null) { result.FinishNum = finishNum; - result.SurplusNum = result.PlanNumber - result.FinishNum; + result.SurplusNum = result.PlanNumber - result.DeliveryNumber; } var details = gridWeightInfo.ItemsSource as List; details.Remove(detail); diff --git a/WeighBusiness/BL/ProductPlanBL.cs b/WeighBusiness/BL/ProductPlanBL.cs index e4e1b6c..5a6f164 100644 --- a/WeighBusiness/BL/ProductPlanBL.cs +++ b/WeighBusiness/BL/ProductPlanBL.cs @@ -113,6 +113,7 @@ namespace WeighBusiness.BL } } + //以前逻辑 public static void UpdateButhcerDetailFinishNum(decimal? finishNum,decimal? detailID,long? goodsId, SqlHelperEx she2 = null) { string excuteSql = string.Empty; @@ -143,7 +144,69 @@ namespace WeighBusiness.BL } } } - + + //现在逻辑 + public static void UpdateButhcerDetailFinishNum(ButcherDetailData data,decimal? finishNum, decimal? detailID, long? goodsId, SqlHelperEx she2 = null) + { + string excuteSql = string.Empty; + var table = SqlHelperEx.DoQuery("select ID from {0} where DetailID = {1}".FormatWith(TableNames.生产计划分割明细完工数量, detailID)); + if (table.Rows.Count > 0) + { + excuteSql = string.Format("update " + TableNames.生产计划分割明细完工数量 + " set FinishNumber = {0} where DetailID ={1}", finishNum, detailID); + } + else + { + excuteSql = InsertUtil.GetInsertSql(TableNames.生产计划分割明细完工数量, + new string[] { "DetailID", "Goods_ID", "FinishNumber" }, + new string[] { detailID.ToString(), goodsId.ToString(), (finishNum ?? 0).ToString() }); + } + + bool success = true; + if (she2 == null) + { + using (var she = new SqlHelperEx()) + { + she.CreateTransaction(); + she.ExecuteNonQuery(excuteSql, out success); + if (!success) + { + she.Rollback(); + } + else + { + she.Commit(); + } + } + } + else + { + she2.ExecuteNonQuery(excuteSql, out success); + if (!success) + { + she2.Rollback(); + } + } + if (success) + { + try + { + var usId = UserBL.CurrentUser.ERP_User_ID; + //更新数量 + var method = "/MainSystem/B3_HaoYue/Rpcs/DeliveryNumberInfoRpc/InsertOrUpdateDeliveryNumber"; + var deliveryNum = RpcFacade.Call(method, usId, finishNum, detailID); + data.DeliveryNumber = deliveryNum; + + } + catch + { + + } + + + } + + + } public static string Delete(long ID) { @@ -339,6 +402,28 @@ namespace WeighBusiness.BL list.Add(outDetail); } } + + + try + { + //获取全部的完工数量 + var details = list.Select(x => x.DetailID).Distinct().ToList(); + var method = "/MainSystem/B3_HaoYue/Rpcs/DeliveryNumberInfoRpc/GetDeliveryNumberInfo"; + var deliveryInfo = RpcFacade.Call>>(method, details.ToArray()); + foreach(var tuple in deliveryInfo) + { + if (tuple.Item1 == null) + continue; + foreach(var detail in list.Where(x=> x.DetailID == tuple.Item1.Value)) + { + detail.DeliveryNumber = tuple.Item2; + } + } + } + catch + { + + } return list; } } @@ -356,6 +441,9 @@ namespace WeighBusiness.BL public DateTime? DeliveryDate { get; set; } public string DeliveryDateStr { get; set; } private decimal? mFinishNum; + /// + /// 本机完工数量 + /// public decimal? FinishNum { get @@ -372,6 +460,29 @@ namespace WeighBusiness.BL } } + private decimal? mDeliveryNumber; + + /// + /// 整个系统中的完工数量 + /// + public decimal? DeliveryNumber + { + get + { + return mDeliveryNumber; + } + + set + { + mDeliveryNumber = value; + if (PropertyChanged != null) + { + PropertyChanged(this, new PropertyChangedEventArgs("DeliveryNumber")); + } + } + } + + private decimal? mSurplusNum; public decimal? SurplusNum {