From 4825cbf5ddbc770de1b1c4b86e2ed29dee33d025 Mon Sep 17 00:00:00 2001
From: wugang <425674808@qq.com>
Date: Thu, 28 Dec 2017 09:34:10 +0800
Subject: [PATCH] ...
---
CowOutputClient/OperateWindow.xaml | 24 ++++++++----
CowOutputClient/OperateWindow.xaml.cs | 56 +++++++++++++++++----------
WeighBusiness/BL/ProductCatalogBL.cs | 2 +-
WeighBusiness/BL/ProductPlanBL.cs | 2 +-
WeighBusiness/BL/WeightInfoBL.cs | 4 +-
5 files changed, 56 insertions(+), 32 deletions(-)
diff --git a/CowOutputClient/OperateWindow.xaml b/CowOutputClient/OperateWindow.xaml
index 60e3db6..1759bb6 100644
--- a/CowOutputClient/OperateWindow.xaml
+++ b/CowOutputClient/OperateWindow.xaml
@@ -16,20 +16,28 @@
固定数量双计量
选数双计量
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/CowOutputClient/OperateWindow.xaml.cs b/CowOutputClient/OperateWindow.xaml.cs
index 0c427b3..50af1c8 100644
--- a/CowOutputClient/OperateWindow.xaml.cs
+++ b/CowOutputClient/OperateWindow.xaml.cs
@@ -60,6 +60,7 @@ namespace CowOutputClient
ProductTeamBL.SyncProductTeam();
BindCombProductBatch();
BindGridProductPlan();
+ BindProductCatalogs();
WindowUtil.Inf("同步成功");
}
@@ -90,7 +91,7 @@ namespace CowOutputClient
details.Add(inputDetail);
}
output.Set("Details", details);
- var list = RpcFacade.Call>("/MainSystem/B3_HaoYue/Rpcs/B3CowButcherManageRpc/CreateOutput", output,mTeam.ProductTeam_ID);
+ var list = RpcFacade.Call>("/MainSystem/B3_HaoYue/Rpcs/B3CowButcherManageRpc/CreateOutput", output,mTeam.ProductTeam_ID,false,null);
if (list.Count() > 0) {
var outputId = list[0].Value;
WeightInfoBL.UpdateOutputId(selectedItems.Select(x => x.ID).ToArray(),outputId);
@@ -372,25 +373,40 @@ namespace CowOutputClient
if (combProductBatch.SelectedValue == null)
throw new ApplicationException("请选择分割生产批次");
var netWeight = WeightInfoBL.GetButcDetailIDWeight(selectedItem.DetailID);
- var output = new RpcObject("/MainSystem/B3CowButcherManage/BO/Output");
- output.Set("AccountingUnit_ID", long.Parse(accountingUnit_ID));
- output.Set("Department_ID", wpfUser.Department_ID);
- output.Set("Domain_ID", long.Parse(domain_ID));
- output.Set("Employee_ID", wpfUser.Employee_ID ?? 0);
- var batch = (ProductBatch)combProductBatch.SelectedItem;
- output.Set("ProductBatch_ID", batch.Batch_ID);
- output.Set("Product_Batch", batch.Batch);
- output.Set("Date", DateTime.Now);
-
- var details = new ManyList("/MainSystem/B3CowButcherManage/BO/Output_Detail");
- var inputDetail = new RpcObject("/MainSystem/B3CowButcherManage/BO/Output_Detail");
- inputDetail.Set("Goods_ID", selectedItem.Goods_ID);
- inputDetail.Set("Number", netWeight);
- inputDetail.Set("ButcDetailID", selectedItem.DetailID);
- details.Add(inputDetail);
- output.Set("Details", details);
- var list = RpcFacade.Call>("/MainSystem/B3_HaoYue/Rpcs/B3CowButcherManageRpc/CreateOutput", output, mTeam.ProductTeam_ID);
- if (list.Count() > 0) {
+ RpcObject output = null;
+ if (netWeight != null) {
+ output = new RpcObject("/MainSystem/B3CowButcherManage/BO/Output");
+ output.Set("AccountingUnit_ID", long.Parse(accountingUnit_ID));
+ output.Set("Department_ID", wpfUser.Department_ID);
+ output.Set("Domain_ID", long.Parse(domain_ID));
+ output.Set("Employee_ID", wpfUser.Employee_ID ?? 0);
+ var batch = (ProductBatch)combProductBatch.SelectedItem;
+ output.Set("ProductBatch_ID", batch.Batch_ID);
+ output.Set("Product_Batch", batch.Batch);
+ output.Set("Date", DateTime.Now);
+
+ var details = new ManyList("/MainSystem/B3CowButcherManage/BO/Output_Detail");
+ var inputDetail = new RpcObject("/MainSystem/B3CowButcherManage/BO/Output_Detail");
+ inputDetail.Set("Goods_ID", selectedItem.Goods_ID);
+ inputDetail.Set("Number", netWeight);
+ inputDetail.Set("ButcDetailID", selectedItem.DetailID);
+ details.Add(inputDetail);
+ output.Set("Details", details);
+ }
+ var list = RpcFacade.Call>("/MainSystem/B3_HaoYue/Rpcs/B3CowButcherManageRpc/CreateOutput", output, mTeam.ProductTeam_ID, true, selectedItem.DetailID);
+ if (list == null) {
+ ProductPlanBL.UpdateButhcerDetailFinish(selectedItem.DetailID);
+ var butDetails = gridProductPlan.ItemsSource as List;
+ var result = butDetails.Where(x => x.DetailID == selectedItem.DetailID);
+ butDetails.Remove(result.First());
+ var resultList = new List();
+ foreach (var item in butDetails) {
+ resultList.Add(item);
+ }
+ gridProductPlan.ItemsSource = null;
+ gridProductPlan.ItemsSource = resultList;
+ }
+ else if (list.Count() > 0) {
var outputId = list[0].Value;
WeightInfoBL.UpdateOutputIdByButcDetailID(selectedItem.DetailID, outputId);
BindGridWeightInfo();
diff --git a/WeighBusiness/BL/ProductCatalogBL.cs b/WeighBusiness/BL/ProductCatalogBL.cs
index e2a7241..c5be8d3 100644
--- a/WeighBusiness/BL/ProductCatalogBL.cs
+++ b/WeighBusiness/BL/ProductCatalogBL.cs
@@ -226,7 +226,7 @@ namespace WeighBusiness.BL
public static List GetProductCatalogDetails(bool? isSelected = null)
{
- var table = SqlHelperEx.DoQuery("select a.ProductCatalog_ID,a.CatalogDetail_ID,a.Goods_Name,a.Goods_ID,b.Goods_ID,a.UnitConvertDirection,a.MainUnitRatio,a.SecondUnitRatio,a.Goods_Spec from {0} a left outer join {1} b on a.Goods_ID = b.Goods_ID where 1=1 {2}".FormatWith(TableNames.客户端产品分类明细, TableNames.客户端产品分类配制存货, isSelected == true ? "and b.Goods_ID is not null" : string.Empty));
+ var table = SqlHelperEx.DoQuery("select a.ProductCatalog_ID,a.CatalogDetail_ID,a.Goods_Name,a.Goods_ID,b.Goods_ID,a.UnitConvertDirection,a.MainUnitRatio,a.SecondUnitRatio,a.Goods_Spec from {0} a left outer join {1} b on a.ProductCatalog_ID = b.ProductCatalog_ID and a.Goods_ID = b.Goods_ID where 1=1 {2}".FormatWith(TableNames.客户端产品分类明细, TableNames.客户端产品分类配制存货, isSelected == true ? "and b.Goods_ID is not null" : string.Empty));
if (table.Rows.Count == 0)
return new List();
var list = new List();
diff --git a/WeighBusiness/BL/ProductPlanBL.cs b/WeighBusiness/BL/ProductPlanBL.cs
index 869f39b..e14dc71 100644
--- a/WeighBusiness/BL/ProductPlanBL.cs
+++ b/WeighBusiness/BL/ProductPlanBL.cs
@@ -316,7 +316,7 @@ namespace WeighBusiness.BL
public static List GetButcherDetails(DateTime date,DateTime startDate,long planTeamID)
{
var list = new List();
- var sql = "select a.Goods_ID, a.Goods_Name,a.Goods_Spec,a.Goods_MainUnit,a.PlanNumber,a.DetailID,e.FinishNumber,a.Department_Name,a.Remark from {0} a inner join {1} b on a.ProductPlan_ID = b.ProductPlan_ID inner join {2} c on c.Goods_ID = a.Goods_ID inner join {3} d on c.ProductTeam_ID = d.ProductTeam_ID left outer join {4} e on a.DetailID = e.DetailID where b.PlanDate >='{5}' and b.PlanDate < '{6}' and a.IsFinish = 0 and d.ProductTeam_ID = {7}".FormatWith(TableNames.生产计划分割明细, TableNames.生产计划, TableNames.生产班组产出明细, TableNames.生产班组, TableNames.生产计划分割明细完工数量, startDate, date.AddDays(1), planTeamID);
+ var sql = "select a.Goods_ID, a.Goods_Name,a.Goods_Spec,a.Goods_MainUnit,a.PlanNumber,a.DetailID,e.FinishNumber,a.Department_Name,a.Remark from {0} a inner join {1} b on a.ProductPlan_ID = b.ProductPlan_ID inner join {2} c on c.Goods_ID = a.Goods_ID inner join {3} d on c.ProductTeam_ID = d.ProductTeam_ID left outer join {4} e on a.DetailID = e.DetailID where a.IsFinish = 0 and d.ProductTeam_ID = {5}".FormatWith(TableNames.生产计划分割明细, TableNames.生产计划, TableNames.生产班组产出明细, TableNames.生产班组, TableNames.生产计划分割明细完工数量,planTeamID);
if (!string.IsNullOrEmpty(sql)) {
var table = SqlHelperEx.DoQuery(sql);
foreach (DataRow row in table.Rows) {
diff --git a/WeighBusiness/BL/WeightInfoBL.cs b/WeighBusiness/BL/WeightInfoBL.cs
index 93330ee..b8bd8c7 100644
--- a/WeighBusiness/BL/WeightInfoBL.cs
+++ b/WeighBusiness/BL/WeightInfoBL.cs
@@ -100,7 +100,7 @@ namespace WeighBusiness.BL
public static decimal? GetButcDetailIDWeight(long? butcDetailID,SqlHelperEx she2 = null)
{
if (butcDetailID != null) {
- var sql = "select sum(NetWeight) from {0} where ButcDetailID = {1}".FormatWith(TableNames.称重记录, butcDetailID);
+ var sql = "select sum(NetWeight) from {0} where ButcDetailID = {1} and Output_ID is null".FormatWith(TableNames.称重记录, butcDetailID);
DataTable table;
if (she2 == null) {
using (var she = new SqlHelperEx()) {
@@ -112,7 +112,7 @@ namespace WeighBusiness.BL
if (table.Rows.Count == 0) {
return null;
}
- return (decimal?)table.Rows[0][0];
+ return DataTypeUtil.GetDecimalNullNum(table.Rows[0][0]);
}
return null;
}