wugang 7 years ago
parent
commit
d27e7a2586
5 changed files with 73 additions and 19 deletions
  1. +3
    -1
      CowOutputClient/AutoCloseWindow.xaml.cs
  2. +16
    -5
      CowOutputClient/OperateWindow.xaml
  3. +25
    -10
      CowOutputClient/OperateWindow.xaml.cs
  4. +2
    -0
      CowOutputClient/app.config
  5. +27
    -3
      WeighBusiness/BL/WeightInfoBL.cs

+ 3
- 1
CowOutputClient/AutoCloseWindow.xaml.cs View File

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Windows;
@ -30,10 +31,11 @@ namespace CowOutputClient
private void Window_Loaded(object sender, RoutedEventArgs e)
{
var seconds = ConfigurationManager.AppSettings["ShowSeconds"];
lblInfo.Content = mInfo;
mShowTimer = new DispatcherTimer();
mShowTimer.Tick += new EventHandler(CloseWindow);
mShowTimer.Interval = new TimeSpan(0, 0, 0, 2, 0);
mShowTimer.Interval = new TimeSpan(0, 0, 0, int.Parse(seconds), 0);
mShowTimer.Start();
}


+ 16
- 5
CowOutputClient/OperateWindow.xaml View File

@ -46,7 +46,7 @@
<Label Content="用户:" FontSize="20px" HorizontalAlignment="Left" Margin="650,20,0,0" VerticalAlignment="Top" />
<Label Content="张三" FontSize="20px" HorizontalAlignment="Left" Margin="710,20,0,0" VerticalAlignment="Top" />-->
<Button Focusable="False" Content="是" Name="btnYesOrNo" Click="btnYesOrNo_Click_1" FontSize="20" HorizontalAlignment="Left" Margin="750,30,0,0" VerticalAlignment="Top" Width="50" Height="40"/>
<Button Focusable="False" Content="注销" Name="btnLogOut" Click="btnLogOut_Click_1" FontSize="20" HorizontalAlignment="Left" Margin="900,30,0,0" VerticalAlignment="Top" Width="100" Height="40"/>
<Button Focusable="False" Content="注销" Name="btnLogOut" Click="btnLogOut_Click_1" FontSize="20" HorizontalAlignment="Left" Margin="930,30,0,0" VerticalAlignment="Top" Width="100" Height="40"/>
<Label Content="开始日期" FontSize="20px" HorizontalAlignment="Left" Margin="400,20,0,0" VerticalAlignment="Top" />
<TextBox x:Name="txtProduceStartDate" FontSize="18" TextAlignment="Justify" VerticalContentAlignment="Center" PreviewMouseDown="txtProduceStartDate_PreviewMouseDown_1" HorizontalAlignment="Left" Height="26" Margin="500,25,0,0" VerticalAlignment="Top" Width="220"/>
<Label Content="结束日期" FontSize="20px" HorizontalAlignment="Left" Margin="400,60,0,0" VerticalAlignment="Top" />
@ -55,7 +55,7 @@
<ComboBox Name="combProductBatch" FontSize="18" Height="30" Width="200" HorizontalAlignment="Left" Margin="500,110,0,0" VerticalAlignment="Top" />
<Button Focusable="False" Content="同步数据" Name="SyncData" Click="SyncData_Click_1" FontSize="20" HorizontalAlignment="Left" Margin="750,100,0,0" VerticalAlignment="Top" Width="100" Height="40"/>
<Button Focusable="False" Content="创建产出单" Name="CreateOutPut" Click="CreateOutPut_Click_1" FontSize="20" HorizontalAlignment="Left" Margin="900,100,0,0" VerticalAlignment="Top" Width="130" Height="40"/>
<DataGrid HorizontalAlignment="Left" VerticalAlignment="Top" SelectionChanged="gridProductPlan_SelectionChanged_1" HeadersVisibility="Column" Name="gridProductPlan" EnableColumnVirtualization="True" EnableRowVirtualization="True" AutoGenerateColumns="False" CanUserAddRows="False" Width="640" Height="300" Margin="390,150,0,0" >
<DataGrid HorizontalAlignment="Left" VerticalAlignment="Top" SelectionChanged="gridProductPlan_SelectionChanged_1" HeadersVisibility="Column" Name="gridProductPlan" EnableColumnVirtualization="True" EnableRowVirtualization="True" AutoGenerateColumns="False" CanUserAddRows="False" Width="640" Height="300" Margin="385,150,0,0" >
<DataGrid.RowStyle>
<Style TargetType="DataGridRow">
<Setter Property="Height" Value="40" />
@ -75,7 +75,18 @@ Property="HorizontalContentAlignment" Value="Center">
</DataGrid.ColumnHeaderStyle>
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding Department_Name}" IsReadOnly="True" Header="部门" Width="1*"/>
<DataGridTextColumn Binding="{Binding Remark}" IsReadOnly="True" Header="备注" Width="1.6*"/>
<DataGridTemplateColumn Header="备注" Width="1.6*">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Button
Click="Remark_Click_1"
Content="{Binding Remark}"
FontSize="15"
/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<!--<DataGridTextColumn Binding="{Binding Remark}" IsReadOnly="True" Header="备注" Width="1.6*" />-->
<DataGridTextColumn Binding="{Binding Goods_Name}" IsReadOnly="True" Header="产品名称" Width="1.7*"/>
<DataGridTextColumn Binding="{Binding Goods_Spec}" IsReadOnly="True" Header="规格" Width="1*"/>
<DataGridTextColumn IsReadOnly="True" Binding="{Binding PlanNumber}" Header="计划数" Width="1*"/>
@ -90,11 +101,11 @@ Property="HorizontalContentAlignment" Value="Center">
FontSize="15"
/>
</DataTemplate>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Binding="{Binding DeliveryDateStr}" IsReadOnly="True" Header="日期" />
<DataGridTextColumn IsReadOnly="True" Header="" Width="0.1*"/>
</DataGrid.Columns>
</DataGrid>
<DataGrid HorizontalAlignment="Left" SelectionChanged="gridWeightInfo_SelectionChanged_1" VerticalAlignment="Top" Margin="390,470,0,0" HeadersVisibility="Column" Name="gridWeightInfo" EnableColumnVirtualization="True" EnableRowVirtualization="True" AutoGenerateColumns="False" CanUserAddRows="False" Width="640" Height="270" >


+ 25
- 10
CowOutputClient/OperateWindow.xaml.cs View File

@ -99,7 +99,8 @@ namespace CowOutputClient
inStoreTypeId = long.Parse(ConfigurationManager.AppSettings["InStoreType_ID1"]);
else
inStoreTypeId = long.Parse(ConfigurationManager.AppSettings["InStoreType_ID2"]);
var list = RpcFacade.Call<List<long?>>("/MainSystem/B3_HaoYue/Rpcs/B3CowButcherManageRpc/CreateOutput", output,mTeam.ProductTeam_ID,false,null,mTeam.Name,inStoreTypeId);
var list = RpcFacade.Call<List<long?>>("/MainSystem/B3_HaoYue/Rpcs/B3CowButcherManageRpc/CreateOutput", output, mTeam.ProductTeam_ID, false, null, mTeam.Name, inStoreTypeId);
if (list.Count() > 0) {
var outputId = list[0].Value;
WeightInfoBL.UpdateOutputId(selectedItems.Select(x => x.ID).ToArray(),outputId);
@ -395,9 +396,9 @@ namespace CowOutputClient
if (combProductBatch.SelectedValue == null)
throw new ApplicationException("请选择分割生产批次");
var netWeight = WeightInfoBL.GetButcDetailIDWeight(selectedItem.DetailID);
var weightInfos = WeightInfoBL.GetWeightInfosByDetailId(selectedItem.DetailID);
RpcObject output = null;
if (netWeight != null) {
if (weightInfos.Count > 0) {
output = new RpcObject("/MainSystem/B3CowButcherManage/BO/Output");
output.Set<long?>("AccountingUnit_ID", long.Parse(accountingUnit_ID));
output.Set<long?>("Department_ID", wpfUser.Department_ID);
@ -408,16 +409,24 @@ namespace CowOutputClient
output.Set<string>("Product_Batch", batch.Batch);
output.Set<DateTime?>("Date", DateTime.Now);
output.Set<long?>("ProductTeam_ID", mTeam.ProductTeam_ID);
var details = new ManyList("/MainSystem/B3CowButcherManage/BO/Output_Detail");
var inputDetail = new RpcObject("/MainSystem/B3CowButcherManage/BO/Output_Detail");
inputDetail.Set<long?>("Goods_ID", selectedItem.Goods_ID);
inputDetail.Set<decimal?>("Number", netWeight);
inputDetail.Set<long?>("ButcDetailID", selectedItem.DetailID);
details.Add(inputDetail);
foreach (var item in weightInfos) {
var inputDetail = new RpcObject("/MainSystem/B3CowButcherManage/BO/Output_Detail");
inputDetail.Set<long?>("Goods_ID", item.Goods_ID);
inputDetail.Set<decimal?>("Number", item.NetWeight);
inputDetail.Set<decimal?>("SecondNumber", item.SecondNum);
inputDetail.Set<long?>("ButcDetailID", item.ButcDetailID);
inputDetail.Set<decimal?>("ProductNum", item.ProductNum);
details.Add(inputDetail);
}
output.Set("Details", details);
}
var list = RpcFacade.Call<List<long?>>("/MainSystem/B3_HaoYue/Rpcs/B3CowButcherManageRpc/CreateOutput", output, mTeam.ProductTeam_ID, true, selectedItem.DetailID,mTeam.Name);
long? inStoreTypeId = null;
if (btnYesOrNo.Content.ToString() == "是")
inStoreTypeId = long.Parse(ConfigurationManager.AppSettings["InStoreType_ID1"]);
else
inStoreTypeId = long.Parse(ConfigurationManager.AppSettings["InStoreType_ID2"]);
var list = RpcFacade.Call<List<long?>>("/MainSystem/B3_HaoYue/Rpcs/B3CowButcherManageRpc/CreateOutput", output, mTeam.ProductTeam_ID, true, selectedItem.DetailID,mTeam.Name,inStoreTypeId);
if (list == null) {
ProductPlanBL.UpdateButhcerDetailFinish(selectedItem.DetailID);
var butDetails = gridProductPlan.ItemsSource as List<ButcherDetailData>;
@ -608,5 +617,11 @@ namespace CowOutputClient
btn.Content = btn.Content.ToString() == "是" ? "否" : "是";
}
}
private void Remark_Click_1(object sender, RoutedEventArgs e)
{
var btn = sender as Button;
MessageBox.Show(btn.Content.ToString(), "提示:", MessageBoxButton.OK);
}
}
}

+ 2
- 0
CowOutputClient/app.config View File

@ -46,5 +46,7 @@
<add key="InStoreType_ID1" value="1" />
<!-- 入库类型ID2 -->
<add key="InStoreType_ID2" value="2" />
<!-- 称重序号提示框显示秒数 -->
<add key="ShowSeconds" value="1" />
</appSettings>
</configuration>

+ 27
- 3
WeighBusiness/BL/WeightInfoBL.cs View File

@ -69,6 +69,30 @@ namespace WeighBusiness.BL
return num2 > 0 ? num1 + 1 : num1;
}
public static List<WeightInfo> GetWeightInfosByDetailId(long detailID)
{
var sql = "select SecondNum,Weight,SubWeight,NetWeight,CreateTime,Goods_ID,ID,Goods_Name,Goods_Spec,ButcDetailID,ProductNum from {0} where Output_ID is null and ButcDetailID = {1}".FormatWith(TableNames., detailID);
var table = SqlHelperEx.DoQuery(sql);
if (table.Rows.Count == 0)
return new List<WeightInfo>();
var list = new List<WeightInfo>();
foreach (DataRow row in table.Rows) {
var detail = new WeightInfo();
detail.SecondNum = DataTypeUtil.GetDecimalNum(row[0]);
detail.Weight = DataTypeUtil.GetDecimalNum(row[1]);
detail.SubWeight = DataTypeUtil.GetDecimalNullNum(row[2]);
detail.NetWeight = DataTypeUtil.GetDecimalNullNum(row[3]);
detail.CreateTime = DateTime.Parse(row[4].ToString());
detail.Goods_ID = DataTypeUtil.GetLongNum(row[5]);
detail.ID = DataTypeUtil.GetLongNum(row[6]);
detail.Goods_Name = DataTypeUtil.ToStringEmptyIfNull(row[7]);
detail.Goods_Spec = DataTypeUtil.ToStringEmptyIfNull(row[8]);
detail.ButcDetailID = DataTypeUtil.GetLongNullNum(row[9]);
detail.ProductNum = DataTypeUtil.GetDecimalNullNum(row[10]);
list.Add(detail);
}
return list;
}
public static List<WeightInfo> GetWeightInfos(bool hasOutputId = false,long? detailID = null)
{
@ -125,10 +149,10 @@ namespace WeighBusiness.BL
return wList;
}
public static decimal? GetButcDetailIDWeight(long? butcDetailID,SqlHelperEx she2 = null)
public static Tuple<decimal?,decimal?> GetButcDetailIDWeight(long? butcDetailID,SqlHelperEx she2 = null)
{
if (butcDetailID != null) {
var sql = "select sum(NetWeight) from {0} where ButcDetailID = {1} and Output_ID is null".FormatWith(TableNames., butcDetailID);
var sql = "select sum(NetWeight),sum(SecondNum) from {0} where ButcDetailID = {1} and Output_ID is null".FormatWith(TableNames., butcDetailID);
DataTable table;
if (she2 == null) {
using (var she = new SqlHelperEx()) {
@ -140,7 +164,7 @@ namespace WeighBusiness.BL
if (table.Rows.Count == 0) {
return null;
}
return DataTypeUtil.GetDecimalNullNum(table.Rows[0][0]);
return new Tuple<decimal?,decimal?>(DataTypeUtil.GetDecimalNullNum(table.Rows[0][0]),DataTypeUtil.GetDecimalNullNum(table.Rows[0][1]));
}
return null;
}


Loading…
Cancel
Save