Browse Source

...

master
wugang 8 years ago
parent
commit
5d1d96efe8
30 changed files with 1525 additions and 181 deletions
  1. +1
    -1
      CowOutputClient/App.xaml.cs
  2. +730
    -0
      CowOutputClient/CalendarSelecterWindow.xaml
  3. +73
    -0
      CowOutputClient/CalendarSelecterWindow.xaml.cs
  4. +16
    -1
      CowOutputClient/CowOutputClient.csproj
  5. BIN
      CowOutputClient/CowOutputClient.lnk
  6. BIN
      CowOutputClient/Images/stop.png
  7. BIN
      CowOutputClient/Images/today.png
  8. BIN
      CowOutputClient/Images/working.png
  9. +2
    -1
      CowOutputClient/MainWindow.xaml.cs
  10. +30
    -28
      CowOutputClient/OperateWindow.xaml
  11. +234
    -110
      CowOutputClient/OperateWindow.xaml.cs
  12. +1
    -3
      CowOutputClient/SelectedProductWindow.xaml.cs
  13. +7
    -7
      CowOutputClient/app.config
  14. BIN
      CowOutputClient/bin.rar
  15. +221
    -0
      WeighBusiness/BL/GoodsWeightFloatBL.cs
  16. +31
    -16
      WeighBusiness/BL/ProductCatalogBL.cs
  17. +17
    -4
      WeighBusiness/BL/ProductPlanBL.cs
  18. +22
    -7
      WeighBusiness/BL/WeightInfoBL.cs
  19. +21
    -0
      WeighBusiness/BO/CreateTables/CreateGoodsWeightFloat.cs
  20. +34
    -0
      WeighBusiness/BO/CreateTables/CreateGoodsWeightFloat_Detail.cs
  21. +14
    -0
      WeighBusiness/BO/CreateTables/CreateProductCatalog_Detail.cs
  22. +1
    -1
      WeighBusiness/BO/CreateTables/CreateWeightInfo.cs
  23. +19
    -0
      WeighBusiness/BO/GoodsWeightFloat.cs
  24. +22
    -0
      WeighBusiness/BO/GoodsWeightFloat_Detail.cs
  25. +4
    -0
      WeighBusiness/BO/ProductCatalog_Detail.cs
  26. +1
    -1
      WeighBusiness/BO/WeightInfo.cs
  27. +13
    -0
      WeighBusiness/MyThread.cs
  28. +4
    -0
      WeighBusiness/Utils/CreateUtil.cs
  29. +2
    -1
      WeighBusiness/Utils/TableName.cs
  30. +5
    -0
      WeighBusiness/WeighBusiness.csproj

+ 1
- 1
CowOutputClient/App.xaml.cs View File

@ -24,7 +24,7 @@ namespace CowOutputClient
private void App_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
{
WindowUtil.Err(e.Exception.Message.ToString());
WindowUtil.Err(e.Exception.ToString());
e.Handled = true;
}


+ 730
- 0
CowOutputClient/CalendarSelecterWindow.xaml View File

@ -0,0 +1,730 @@
<Window x:Class="CowOutputClient.CalendarSelecterWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
WindowStartupLocation="CenterScreen"
Title="MainWindow"
Width="500"
Height="500"
WindowStyle="None" Background="{x:Null}"
AllowsTransparency="True"
MouseLeftButtonDown="DragWindow"
>
<Window.Resources>
<Style x:Key="CalendarStyle1"
TargetType="{x:Type Calendar}">
<!--日历控件的背景色,也可以改成绑定的-->
<Setter Property="Background"
Value="#f6f6f6" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Calendar}">
<StackPanel x:Name="PART_Root"
HorizontalAlignment="Center"
VerticalAlignment="Center">
<!--这个是日历控件的主体元件,也是内部元件PART_CalendarItem名称不要更改,可以改它的其它样式属性-->
<CalendarItem x:Name="PART_CalendarItem"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Background="{TemplateBinding Background}"
Style="{TemplateBinding CalendarItemStyle}"
Height="{TemplateBinding Height}"
Width="{TemplateBinding Width}"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch" />
</StackPanel>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--日历主体样式表-->
<Style x:Key="CalendarItemStyle1"
TargetType="{x:Type CalendarItem}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type CalendarItem}">
<ControlTemplate.Resources>
<DataTemplate x:Key="{x:Static CalendarItem.DayTitleTemplateResourceKey}">
<!--日历星期几的绑定样式,我格式化成周一,周二等-->
<TextBlock Foreground="#666666"
FontSize="16"
FontFamily="微软雅黑"
HorizontalAlignment="Center"
Margin="0 15"
Text="{Binding StringFormat=周{0} }"
VerticalAlignment="Center" />
</DataTemplate>
</ControlTemplate.Resources>
<Grid x:Name="PART_Root">
<Grid.Resources>
<!--设置日历控件 IsEnable=false 时的不可用遮罩层颜色,并且会播放过渡动画-->
<SolidColorBrush x:Key="DisabledColor"
Color="#A5FFFFFF" />
</Grid.Resources>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="Disabled">
<!--设置日历控件 IsEnable=false 时遮罩层透明度0-1变色动画-->
<Storyboard>
<DoubleAnimation Duration="0"
To="1"
Storyboard.TargetProperty="Opacity"
Storyboard.TargetName="PART_DisabledVisual" />
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Border BorderBrush="#cfcfcf"
BorderThickness="0"
Background="{TemplateBinding Background}"
CornerRadius="2">
<Border>
<Grid>
<Grid.Resources>
<!--日历头左箭头按钮样式模版-->
<ControlTemplate x:Key="PreviousButtonTemplate"
TargetType="{x:Type Button}">
<!--鼠标悬停在左箭头按钮上时改变鼠标指针样式-->
<Grid Cursor="Hand">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="MouseOver">
<!--鼠标悬停在左箭头按钮上时左箭头颜色变化动画-->
<Storyboard>
<ColorAnimation Duration="0"
To="#FF73A9D8"
Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)"
Storyboard.TargetName="path" />
</Storyboard>
</VisualState>
<VisualState x:Name="Disabled">
<Storyboard>
<DoubleAnimation Duration="0"
To=".5"
Storyboard.TargetProperty="(Shape.Fill).(Brush.Opacity)"
Storyboard.TargetName="path" />
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<!--左箭头整个区域矩形块-->
<Rectangle Fill="#363636"
Opacity="1"
Stretch="Fill" />
<Grid>
<!--左箭头-->
<Path x:Name="path"
Data="M288.75,232.25 L288.75,240.625 L283,236.625 z"
Fill="#e0e0e0"
HorizontalAlignment="Left"
Height="15"
Width="15"
Margin="20,0,0,0"
Stretch="Fill"
VerticalAlignment="Center" />
</Grid>
</Grid>
</ControlTemplate>
<!--日历头右箭头按钮样式模版,这块跟左箭头样式模版没什么区别-->
<ControlTemplate x:Key="NextButtonTemplate"
TargetType="{x:Type Button}">
<Grid Cursor="Hand">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="MouseOver">
<Storyboard>
<ColorAnimation Duration="0"
To="#FF73A9D8"
Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)"
Storyboard.TargetName="path" />
</Storyboard>
</VisualState>
<VisualState x:Name="Disabled">
<Storyboard>
<DoubleAnimation Duration="0"
To=".5"
Storyboard.TargetProperty="(Shape.Fill).(Brush.Opacity)"
Storyboard.TargetName="path" />
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Rectangle Fill="#363636"
Opacity="1"
Stretch="Fill" />
<Grid>
<Path x:Name="path"
Data="M282.875,231.875 L282.875,240.375 L288.625,236 z"
Fill="#e0e0e0"
HorizontalAlignment="Right"
Height="15"
Width="15"
Margin="0,0,20,0"
Stretch="Fill"
VerticalAlignment="Center" />
</Grid>
</Grid>
</ControlTemplate>
<!--日历头中间年按钮样式模版-->
<ControlTemplate x:Key="HeaderButtonTemplate"
TargetType="{x:Type Button}">
<Grid Cursor="Hand">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="MouseOver">
<Storyboard>
<ColorAnimation Duration="0"
To="#FF73A9D8"
Storyboard.TargetProperty="(TextElement.Foreground).(SolidColorBrush.Color)"
Storyboard.TargetName="buttonContent" />
</Storyboard>
</VisualState>
<VisualState x:Name="Disabled">
<Storyboard>
<DoubleAnimation Duration="0"
To=".5"
Storyboard.TargetProperty="Opacity"
Storyboard.TargetName="buttonContent" />
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<ContentPresenter x:Name="buttonContent"
ContentTemplate="{TemplateBinding ContentTemplate}"
Content="{TemplateBinding Content}"
TextElement.Foreground="#e0e0e0"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
Margin="1,4,1,9"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
</Grid>
</ControlTemplate>
</Grid.Resources>
<Grid.RowDefinitions>
<!--日历头,左箭头,年,右箭头-->
<RowDefinition Height="Auto" />
<!--日历内容,星期几和具体的日期几号几号-->
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<!--左箭头-->
<ColumnDefinition Width="Auto" />
<!--年-->
<ColumnDefinition Width="*" />
<!--右箭头-->
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<!--头,左箭头,年,右箭头,整体的背景色-->
<Border Grid.Row="0"
Grid.ColumnSpan="3"
Background="#363636"></Border>
<!--左箭头-->
<Button x:Name="PART_PreviousButton"
Grid.Column="0"
Focusable="False"
HorizontalAlignment="Left"
Grid.Row="0"
Template="{StaticResource PreviousButtonTemplate}" />
<!--年-->
<Button x:Name="PART_HeaderButton"
Grid.Column="1"
FontFamily="微软雅黑"
Focusable="False"
FontSize="26"
HorizontalAlignment="Center"
Grid.Row="0"
Template="{StaticResource HeaderButtonTemplate}"
VerticalAlignment="Center" />
<!--右箭头-->
<Button x:Name="PART_NextButton"
Grid.Column="2"
Focusable="False"
HorizontalAlignment="Right"
Grid.Row="0"
Template="{StaticResource NextButtonTemplate}" />
<!--日期几号几号内容显示-->
<Border Grid.Row="1"
Grid.ColumnSpan="3"
Margin="0"
BorderBrush="#cfcfcf"
BorderThickness="3,0,3,3">
<Grid x:Name="PART_MonthView"
HorizontalAlignment="Center"
Visibility="Visible">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
</Grid>
</Border>
<!--月和年内容显示-->
<Grid x:Name="PART_YearView"
Grid.ColumnSpan="3"
HorizontalAlignment="Center"
Margin="6,-3,7,6"
Grid.Row="1"
Visibility="Hidden"
VerticalAlignment="Center">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
</Grid>
</Grid>
</Border>
</Border>
<!--日历不可用的遮罩层-->
<Rectangle x:Name="PART_DisabledVisual"
Fill="{StaticResource DisabledColor}"
Opacity="0"
RadiusY="2"
RadiusX="2"
Stretch="Fill"
Stroke="{StaticResource DisabledColor}"
StrokeThickness="1"
Visibility="Collapsed" />
</Grid>
<!--触发器属性-->
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled"
Value="False">
<Setter Property="Visibility"
TargetName="PART_DisabledVisual"
Value="Visible" />
</Trigger>
<DataTrigger Binding="{Binding DisplayMode, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Calendar}}}"
Value="Year">
<Setter Property="Visibility"
TargetName="PART_MonthView"
Value="Hidden" />
<Setter Property="Visibility"
TargetName="PART_YearView"
Value="Visible" />
</DataTrigger>
<DataTrigger Binding="{Binding DisplayMode, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Calendar}}}"
Value="Decade">
<Setter Property="Visibility"
TargetName="PART_MonthView"
Value="Hidden" />
<Setter Property="Visibility"
TargetName="PART_YearView"
Value="Visible" />
</DataTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--单个几号几号按钮的样式模版-->
<Style x:Key="CalendarDayButtonStyle1"
TargetType="{x:Type CalendarDayButton}" >
<Setter Property="Margin"
Value="1" />
<Setter Property="MinWidth"
Value="5" />
<Setter Property="MinHeight"
Value="5" />
<Setter Property="FontSize"
Value="22" />
<Setter Property="FontFamily"
Value="微软雅黑" />
<Setter Property="HorizontalContentAlignment"
Value="Center" />
<Setter Property="VerticalContentAlignment"
Value="Center" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type CalendarDayButton}">
<Grid>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualStateGroup.Transitions>
<VisualTransition GeneratedDuration="0:0:0.1" />
</VisualStateGroup.Transitions>
<VisualState x:Name="Normal" />
<!--悬停的颜色动画-->
<VisualState x:Name="MouseOver">
<Storyboard>
<DoubleAnimation Duration="0"
To="0.5"
Storyboard.TargetProperty="Opacity"
Storyboard.TargetName="HighlightBackground" />
</Storyboard>
</VisualState>
<!--按下后动画-->
<VisualState x:Name="Pressed">
<Storyboard>
<DoubleAnimation Duration="0"
To="0.5"
Storyboard.TargetProperty="Opacity"
Storyboard.TargetName="HighlightBackground" />
</Storyboard>
</VisualState>
<!--不可用动画-->
<VisualState x:Name="Disabled">
<Storyboard>
<DoubleAnimation Duration="0"
To="0"
Storyboard.TargetProperty="Opacity"
Storyboard.TargetName="HighlightBackground" />
<DoubleAnimation Duration="0"
To=".35"
Storyboard.TargetProperty="Opacity"
Storyboard.TargetName="NormalText" />
</Storyboard>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="SelectionStates">
<VisualStateGroup.Transitions>
<VisualTransition GeneratedDuration="0" />
</VisualStateGroup.Transitions>
<VisualState x:Name="Unselected" />
<!--选中某日期的样式-->
<VisualState x:Name="Selected">
<Storyboard>
<DoubleAnimation Duration="0"
To=".75"
Storyboard.TargetProperty="Opacity"
Storyboard.TargetName="SelectedBackground" />
<ColorAnimation Duration="0"
To="white"
Storyboard.TargetProperty="(TextElement.Foreground).(SolidColorBrush.Color)"
Storyboard.TargetName="NormalText" />
</Storyboard>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="CalendarButtonFocusStates">
<VisualStateGroup.Transitions>
<VisualTransition GeneratedDuration="0" />
</VisualStateGroup.Transitions>
<VisualState x:Name="CalendarButtonFocused">
<Storyboard>
<ObjectAnimationUsingKeyFrames Duration="0"
Storyboard.TargetProperty="Visibility"
Storyboard.TargetName="DayButtonFocusVisual">
<DiscreteObjectKeyFrame KeyTime="0">
<DiscreteObjectKeyFrame.Value>
<Visibility>Visible</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="CalendarButtonUnfocused">
<Storyboard>
<ObjectAnimationUsingKeyFrames Duration="0"
Storyboard.TargetProperty="Visibility"
Storyboard.TargetName="DayButtonFocusVisual">
<DiscreteObjectKeyFrame KeyTime="0">
<DiscreteObjectKeyFrame.Value>
<Visibility>Collapsed</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="ActiveStates">
<VisualStateGroup.Transitions>
<VisualTransition GeneratedDuration="0" />
</VisualStateGroup.Transitions>
<VisualState x:Name="Active" />
<VisualState x:Name="Inactive">
<Storyboard>
<ColorAnimation Duration="0"
To="#b4b3b3"
Storyboard.TargetProperty="(TextElement.Foreground).(SolidColorBrush.Color)"
Storyboard.TargetName="NormalText" />
</Storyboard>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="DayStates">
<VisualStateGroup.Transitions>
<VisualTransition GeneratedDuration="0" />
</VisualStateGroup.Transitions>
<VisualState x:Name="RegularDay" />
<!--今天的样式-->
<VisualState x:Name="Today">
<Storyboard>
<DoubleAnimation Duration="0"
To="1"
Storyboard.TargetProperty="Opacity"
Storyboard.TargetName="TodayBackground" />
<ColorAnimation Duration="0"
To="#666666"
Storyboard.TargetProperty="(TextElement.Foreground).(SolidColorBrush.Color)"
Storyboard.TargetName="NormalText" />
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility"
Storyboard.TargetName="imgToday">
<DiscreteObjectKeyFrame KeyTime="0">
<DiscreteObjectKeyFrame.Value>
<Visibility>Visible</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
<!--过期日期的-->
<VisualStateGroup x:Name="BlackoutDayStates">
<VisualStateGroup.Transitions>
<VisualTransition GeneratedDuration="0" />
</VisualStateGroup.Transitions>
<VisualState x:Name="NormalDay" />
<VisualState x:Name="BlackoutDay">
<Storyboard>
<DoubleAnimation Duration="0"
To=".2"
Storyboard.TargetProperty="Opacity"
Storyboard.TargetName="Blackout" />
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Border BorderBrush="#bbbbbb"
BorderThickness="1">
<Border BorderBrush="white"
BorderThickness="2,2,0,0"
Margin="1,1,0,0"></Border>
</Border>
<Rectangle x:Name="TodayBackground"
Fill="#c6c6c6"
Opacity="0"
RadiusY="1"
RadiusX="1" />
<Rectangle x:Name="SelectedBackground"
Fill="#6eafbf"
Opacity="0"
RadiusY="1"
RadiusX="1" />
<Border BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Background="{TemplateBinding Background}" />
<Rectangle x:Name="HighlightBackground"
Fill="#FFBADDE9"
Opacity="0"
RadiusY="1"
RadiusX="1" />
<ContentPresenter x:Name="NormalText"
TextElement.Foreground="#666666"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
<Path x:Name="Blackout"
Data="M8.1772461,11.029181 L10.433105,11.029181 L11.700684,12.801641 L12.973633,11.029181 L15.191895,11.029181 L12.844727,13.999395 L15.21875,17.060919 L12.962891,17.060919 L11.673828,15.256231 L10.352539,17.060919 L8.1396484,17.060919 L10.519043,14.042364 z"
Fill="#FF000000"
HorizontalAlignment="Stretch"
Margin="3"
Opacity="0"
RenderTransformOrigin="0.5,0.5"
Stretch="Fill"
VerticalAlignment="Stretch" />
<Rectangle x:Name="DayButtonFocusVisual"
IsHitTestVisible="false"
RadiusY="1"
RadiusX="1"
Stroke="#FF45D6FA"
Visibility="Collapsed" />
<Image x:Name="imgToday"
Width="44"
Height="34"
VerticalAlignment="Top"
HorizontalAlignment="Left"
Initialized="imgToday_Initialized"
Visibility="Hidden" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="CalendarButtonStyle1"
TargetType="{x:Type CalendarButton}" >
<Setter Property="Background"
Value="#FFBADDE9" />
<Setter Property="MinWidth"
Value="80" />
<Setter Property="MinHeight"
Value="80" />
<Setter Property="Margin"
Value="20" />
<Setter Property="FontSize"
Value="25" />
<Setter Property="HorizontalContentAlignment"
Value="Center" />
<Setter Property="VerticalContentAlignment"
Value="Center" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type CalendarButton}">
<Grid>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualStateGroup.Transitions>
<VisualTransition GeneratedDuration="0:0:0.1" />
</VisualStateGroup.Transitions>
<VisualState x:Name="Normal" />
<VisualState x:Name="MouseOver">
<Storyboard>
<DoubleAnimation Duration="0"
To=".5"
Storyboard.TargetProperty="Opacity"
Storyboard.TargetName="Background" />
</Storyboard>
</VisualState>
<VisualState x:Name="Pressed">
<Storyboard>
<DoubleAnimation Duration="0"
To=".5"
Storyboard.TargetProperty="Opacity"
Storyboard.TargetName="Background" />
</Storyboard>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="SelectionStates">
<VisualStateGroup.Transitions>
<VisualTransition GeneratedDuration="0" />
</VisualStateGroup.Transitions>
<VisualState x:Name="Unselected" />
<VisualState x:Name="Selected">
<Storyboard>
<DoubleAnimation Duration="0"
To=".75"
Storyboard.TargetProperty="Opacity"
Storyboard.TargetName="SelectedBackground" />
</Storyboard>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="ActiveStates">
<VisualStateGroup.Transitions>
<VisualTransition GeneratedDuration="0" />
</VisualStateGroup.Transitions>
<VisualState x:Name="Active" />
<VisualState x:Name="Inactive">
<Storyboard>
<ColorAnimation Duration="0"
To="#FF777777"
Storyboard.TargetProperty="(TextElement.Foreground).(SolidColorBrush.Color)"
Storyboard.TargetName="NormalText" />
</Storyboard>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="CalendarButtonFocusStates">
<VisualStateGroup.Transitions>
<VisualTransition GeneratedDuration="0" />
</VisualStateGroup.Transitions>
<VisualState x:Name="CalendarButtonFocused">
<Storyboard>
<ObjectAnimationUsingKeyFrames Duration="0"
Storyboard.TargetProperty="Visibility"
Storyboard.TargetName="CalendarButtonFocusVisual">
<DiscreteObjectKeyFrame KeyTime="0">
<DiscreteObjectKeyFrame.Value>
<Visibility>Visible</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="CalendarButtonUnfocused">
<Storyboard>
<ObjectAnimationUsingKeyFrames Duration="0"
Storyboard.TargetProperty="Visibility"
Storyboard.TargetName="CalendarButtonFocusVisual">
<DiscreteObjectKeyFrame KeyTime="0">
<DiscreteObjectKeyFrame.Value>
<Visibility>Collapsed</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Rectangle x:Name="SelectedBackground"
Fill="{TemplateBinding Background}"
Opacity="0"
RadiusY="1"
RadiusX="1" />
<Rectangle x:Name="Background"
Fill="{TemplateBinding Background}"
Opacity="0"
RadiusY="1"
RadiusX="1" />
<ContentPresenter x:Name="NormalText"
TextElement.Foreground="#FF333333"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
Margin="1,0,1,1"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
<Rectangle x:Name="CalendarButtonFocusVisual"
IsHitTestVisible="false"
RadiusY="1"
RadiusX="1"
Stroke="#FF45D6FA"
Visibility="Collapsed" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsFocused"
Value="True">
<Setter Property="Visibility"
TargetName="CalendarButtonFocusVisual"
Value="Visible" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Window.Resources>
<Grid x:Name="LayoutRoot">
<Calendar x:Name="MC" Style="{DynamicResource CalendarStyle1}"
CalendarItemStyle="{DynamicResource CalendarItemStyle1}"
CalendarDayButtonStyle="{DynamicResource CalendarDayButtonStyle1}"
CalendarButtonStyle="{DynamicResource CalendarButtonStyle1}"
SelectedDatesChanged="MC_SelectedDatesChanged"
Width="500"
Height="500">
</Calendar>
</Grid>
</Window>

+ 73
- 0
CowOutputClient/CalendarSelecterWindow.xaml.cs View File

@ -0,0 +1,73 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace CowOutputClient
{
/// <summary>
/// Calendar.xaml 的交互逻辑
/// </summary>
public partial class CalendarSelecterWindow : Window, INotifyPropertyChanged
{
public CalendarSelecterWindow()
{
InitializeComponent();
}
public void DragWindow(object sender, MouseButtonEventArgs args)
{
this.DragMove();
}
private DateTime _result;
public DateTime Result
{
get { return _result; }
private set { _result = value; OnPropertyChanged("Result"); }
}
private void MC_SelectedDatesChanged(object sender, RoutedEventArgs e)
{
Result = MC.SelectedDate.Value;
DialogResult = true;
}
public event PropertyChangedEventHandler PropertyChanged;
protected void OnPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
private void imgToday_Initialized(object sender, EventArgs e)
{
Assembly myAssembly = Assembly.GetExecutingAssembly();
//格式为:项目名称-文件夹地址-文件名称
Stream myStream = myAssembly.GetManifestResourceStream("CowOutputClient.Images.today.png");
//图片格式
BitmapImage image = new BitmapImage();
image.BeginInit();
image.StreamSource = myStream;
image.EndInit();
myStream.Dispose();
myStream.Close();
var imagePanel = (sender as Image);
imagePanel.Source = image;
}
}
}

+ 16
- 1
CowOutputClient/CowOutputClient.csproj View File

@ -61,6 +61,9 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="CalendarSelecterWindow.xaml.cs">
<DependentUpon>CalendarSelecterWindow.xaml</DependentUpon>
</Compile>
<Compile Include="OperateWindow.xaml.cs">
<DependentUpon>OperateWindow.xaml</DependentUpon>
</Compile>
@ -68,6 +71,10 @@
<DependentUpon>SelectedProductWindow.xaml</DependentUpon>
</Compile>
<Compile Include="Utils\WindowUtil.cs" />
<Page Include="CalendarSelecterWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Controls\CaptionBarButton.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
@ -114,7 +121,10 @@
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="app.config" />
<None Include="app.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<SubType>Designer</SubType>
</None>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
@ -149,6 +159,11 @@
<Name>WeighBusiness</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Images\stop.png" />
<EmbeddedResource Include="Images\today.png" />
<EmbeddedResource Include="Images\working.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.


BIN
CowOutputClient/CowOutputClient.lnk View File


BIN
CowOutputClient/Images/stop.png View File

Before After
Width: 30  |  Height: 30  |  Size: 380 B

BIN
CowOutputClient/Images/today.png View File

Before After
Width: 44  |  Height: 34  |  Size: 1.1 KiB

BIN
CowOutputClient/Images/working.png View File

Before After
Width: 30  |  Height: 30  |  Size: 516 B

+ 2
- 1
CowOutputClient/MainWindow.xaml.cs View File

@ -81,12 +81,13 @@ namespace CowOutputClient
ProductCatalogBL.SyncProductCatalog();
ProductPlanBL.SyncProductPlan();
ProductTeamBL.SyncProductTeam();
GoodsWeightFloatBL.SyncGoodsWeightFloat();
}
private void ShowWinodw()
{
var window = new OperateWindow();
window.WindowState = System.Windows.WindowState.Maximized;
//window.WindowState = System.Windows.WindowState.Maximized;
window.Focus();
this.Visibility = System.Windows.Visibility.Hidden;
App.Current.MainWindow = window;


+ 30
- 28
CowOutputClient/OperateWindow.xaml View File

@ -8,8 +8,15 @@
</Border>
</Border>
<TextBlock Text="" Name="ComWeight" HorizontalAlignment="Left" TextAlignment="Center" Background="Black" Foreground="Green" FontSize="35" VerticalAlignment="Top" Margin="30,30,0,0" Width="120" Height="50"/>
<Button Focusable="False" Content="产品配置" Name="btnProductSet" Click="btnProductSet_Click_1" FontSize="20" HorizontalAlignment="Left" Margin="280,30,0,0" VerticalAlignment="Top" Width="100" Height="40"/>
<WrapPanel Name="ProductCatalogPanel" ItemHeight="45" ItemWidth="110" Width="350" Height="100" Margin="30,90,0,0" HorizontalAlignment="Left" VerticalAlignment="Top">
<Button Focusable="False" Content="去皮" Name="btnTare" Click="btnTare_Click_1" FontSize="20" HorizontalAlignment="Left" Margin="180,30,0,0" VerticalAlignment="Top" Width="100" Height="40"/>
<Button Focusable="False" Content="清除" Name="btnClear" Click="btnClear_Click_1" FontSize="20" HorizontalAlignment="Left" Margin="300,30,0,0" VerticalAlignment="Top" Width="70" Height="40"/>
<Button Focusable="False" Content="产品配置" Name="btnProductSet" Click="btnProductSet_Click_1" FontSize="20" HorizontalAlignment="Left" Margin="30,100,0,0" VerticalAlignment="Top" Width="100" Height="40"/>
<StackPanel Orientation="Vertical" Height="66" Width="180" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="180,80,0,0">
<RadioButton x:Name="rbSingleWeight" IsChecked="True" GroupName="W" FontSize="17">单计重量</RadioButton>
<RadioButton x:Name="rbFixedNum" GroupName="W" FontSize="17" Margin="0,0,0,0">固定数量双计量</RadioButton>
<RadioButton x:Name="rbSelectedNum" GroupName="W" FontSize="17" Margin="0,0,0,0">选数双计量</RadioButton>
</StackPanel>
<WrapPanel Name="ProductCatalogPanel" ItemHeight="45" ItemWidth="110" Width="350" Height="100" Margin="30,150,0,0" HorizontalAlignment="Left" VerticalAlignment="Top">
<!--<Button Focusable="False" Content="鲜品" Name="btn4" Click="btnCreateBill_Click" FontSize="20" Margin="10,10,0,0" />
<Button Focusable="False" Content="鲜品" Name="btn3" Click="btnCreateBill_Click" FontSize="20" Margin="10,10,0,0" />
<Button Focusable="False" Content="鲜品" Name="btn2" Click="btnCreateBill_Click" FontSize="20" Margin="10,10,0,0" />
@ -17,10 +24,7 @@
<Button Focusable="False" Content="鲜品" Name="btn6" Click="btnCreateBill_Click" FontSize="20" Margin="10,0,0,0" />
<Button Focusable="False" Content="鲜品" Name="btn8" Click="btnCreateBill_Click" FontSize="20" Margin="10,0,0,0" />-->
</WrapPanel>
<!--<StackPanel Orientation="Horizontal" Height="90" Width="350" Margin="30,100,0,0" >
</StackPanel>-->
<Grid Name="Grid1" Margin="30,200,0,0" Width="350" Height="540" HorizontalAlignment="Left" VerticalAlignment="Top">
<Grid Name="Grid1" Margin="30,260,0,0" Width="350" Height="480" HorizontalAlignment="Left" VerticalAlignment="Top">
<Border BorderThickness="1" BorderBrush="Black">
</Border>
<ScrollViewer x:Name="scrList" Margin="0" VerticalScrollBarVisibility="Auto">
@ -34,21 +38,15 @@
<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="btnLogOut" Click="btnLogOut_Click_1" FontSize="20" HorizontalAlignment="Left" Margin="900,30,0,0" VerticalAlignment="Top" Width="100" Height="40"/>
<Label Content="生产日期" FontSize="20px" HorizontalAlignment="Left" Margin="400,60,0,0" VerticalAlignment="Top" />
<!--<TextBox x:Name="txtProductDate" VerticalContentAlignment="Center" HorizontalAlignment="Left" Height="26" Margin="500,65,0,0" VerticalAlignment="Top" Width="220"/>-->
<Grid Width="260" Height="35" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="500,65,0,0">
<TextBox x:Name="txtProduceYear" Text="" FontSize="18" PreviewMouseDown="txtProduceYear_PreviewMouseDown_1" IsReadOnly="True" HorizontalAlignment="Left" Height="26" Margin="10,5,0,0" VerticalAlignment="Top" Width="70" TextAlignment="Center"/>
<TextBlock Text="年" FontSize="20" Margin="90,5,0,0" HorizontalAlignment="Left" VerticalAlignment="Top"/>
<TextBox x:Name="txtProduceMonth" FontSize="18" PreviewMouseDown="txtProduceMonth_PreviewMouseDown_1" IsReadOnly="True" HorizontalAlignment="Left" Height="26" Margin="115,5,0,0" VerticalAlignment="Top" Width="40" TextAlignment="Center"/>
<TextBlock Text="月" FontSize="20" Margin="160,5,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" TextAlignment="Center"/>
<TextBox x:Name="txtProduceDay" FontSize="18" PreviewMouseDown="txtProduceDay_PreviewMouseDown_1" IsReadOnly="True" HorizontalAlignment="Left" Height="26" Margin="185,5,0,0" VerticalAlignment="Top" Width="40" />
<TextBlock Text="日" FontSize="20" Margin="230,5,0,0" HorizontalAlignment="Left" VerticalAlignment="Top"/>
</Grid>
<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" />
<TextBox x:Name="txtProductDate" FontSize="18" TextAlignment="Justify" VerticalContentAlignment="Center" PreviewMouseDown="txtProductDate_PreviewMouseDown_1" HorizontalAlignment="Left" Height="26" Margin="500,65,0,0" VerticalAlignment="Top" Width="220"/>
<Label Content="生产批次" FontSize="20px" HorizontalAlignment="Left" Margin="400,100,0,0" VerticalAlignment="Top" />
<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="400,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="390,150,0,0" >
<DataGrid.RowStyle>
<Style TargetType="DataGridRow">
<Setter Property="Height" Value="40" />
@ -67,27 +65,29 @@ Property="HorizontalContentAlignment" Value="Center">
</Style>
</DataGrid.ColumnHeaderStyle>
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding Department_Name}" IsReadOnly="True" Header="部门" Width="2*"/>
<DataGridTextColumn Binding="{Binding Remark}" IsReadOnly="True" Header="备注" Width="2*"/>
<DataGridTextColumn Binding="{Binding Goods_Name}" IsReadOnly="True" Header="产品名称" Width="2*"/>
<DataGridTextColumn Binding="{Binding Goods_Spec}" IsReadOnly="True" Header="规格" Width="2*"/>
<DataGridTextColumn IsReadOnly="True" Binding="{Binding PlanNumber}" Header="计划数量" Width="2*"/>
<DataGridTextColumn IsReadOnly="True" Binding="{Binding FinishNum}" Header="完工数量" Width="2*"/>
<DataGridTextColumn IsReadOnly="True" Binding="{Binding SurplusNum}" Header="余数" Width="2*"/>
<DataGridTemplateColumn Header="操作" Width="1.5*">
<DataGridTextColumn Binding="{Binding Department_Name}" IsReadOnly="True" Header="部门" Width="1*"/>
<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*"/>
<DataGridTextColumn IsReadOnly="True" Binding="{Binding FinishNum}" Header="完工数量" Width="1*"/>
<DataGridTextColumn IsReadOnly="True" Binding="{Binding SurplusNum}" Header="余数" Width="1*"/>
<DataGridTemplateColumn Header="操作" Width="1*">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Button Content="完毕"
Click="Button_Click_1"
Tag="{Binding}"
FontSize="20"
FontSize="15"
/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn IsReadOnly="True" Header="" Width="0.1*"/>
</DataGrid.Columns>
</DataGrid>
<DataGrid HorizontalAlignment="Left" VerticalAlignment="Top" Margin="400,470,0,0" HeadersVisibility="Column" Name="gridWeightInfo" EnableColumnVirtualization="True" EnableRowVirtualization="True" AutoGenerateColumns="False" CanUserAddRows="False" Width="640" Height="270" >
<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" >
<DataGrid.RowStyle>
<Style TargetType="DataGridRow">
<Setter Property="Height" Value="40" />
@ -126,7 +126,7 @@ Property="HorizontalContentAlignment" Value="Center">
<DataGridTextColumn IsReadOnly="True" Binding="{Binding NetWeight}" Header="净重" Width="1*"/>
<DataGridTextColumn IsReadOnly="True" Binding="{Binding Weight}" Header="毛重" Width="1*"/>
<DataGridTextColumn IsReadOnly="True" Binding="{Binding SubWeight}" Header="皮重" Width="1*"/>
<DataGridTextColumn IsReadOnly="True" Binding="{Binding Num}" Header="数量" Width="1*"/>
<DataGridTextColumn IsReadOnly="True" Binding="{Binding SecondNum}" Header="数量" Width="1.5*"/>
<DataGridTemplateColumn Header="操作" Width="1.5*">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
@ -134,10 +134,12 @@ Property="HorizontalContentAlignment" Value="Center">
Click="DeleteButton_Click_2"
Tag="{Binding}"
FontSize="20"
/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn IsReadOnly="True" Binding="{Binding Num}" Header="" Width="0.1*"/>
</DataGrid.Columns>
</DataGrid>
</Grid>


+ 234
- 110
CowOutputClient/OperateWindow.xaml.cs View File

@ -32,9 +32,12 @@ namespace CowOutputClient
WpfUser wpfUser;
ProductTeam mTeam;
DateTime mProduceDate;
DateTime mProduceStartDate;
string accountingUnit_ID = ConfigurationManager.AppSettings["AccountingUnit_ID"];
string domain_ID = ConfigurationManager.AppSettings["Domain_ID"];
ButcherDetailData mButcherDetailData;
bool IsLoad = true;
decimal? tare = null;
public OperateWindow()
{
@ -70,23 +73,43 @@ namespace CowOutputClient
throw new ApplicationException("请先勾选称重记录");
var output = new RpcObject("/MainSystem/B3CowButcherManage/BO/Output");
output.Set<long?>("AccountingUnit_ID", long.Parse(accountingUnit_ID));
output.Set<long?>("Department_ID", 0);
output.Set<long?>("Department_ID", wpfUser.Department_ID);
output.Set<long?>("Domain_ID", long.Parse(domain_ID));
output.Set<long?>("Employee_ID", wpfUser.Employee_ID ?? 0);
output.Set<long?>("ProductBatch_ID", (long)combProductBatch.SelectedValue);
var batch = (ProductBatch)combProductBatch.SelectedItem;
output.Set<long?>("ProductBatch_ID", batch.Batch_ID);
output.Set<string>("Product_Batch", batch.Batch);
output.Set<DateTime?>("Date", DateTime.Now);
var details = new ManyList("/MainSystem/B3CowButcherManage/BO/Output_Detail");
foreach (var item in selectedItems) {
var inputDetail = new RpcObject("/MainSystem/B3CowButcherManage/BO/Output_Detail");
inputDetail.Set<long?>("Goods_ID", item.Goods_ID);
inputDetail.Set<decimal?>("Number", item.Weight);
inputDetail.Set<decimal?>("Number", item.NetWeight);
inputDetail.Set<long?>("ButcDetailID", item.ButcDetailID);
details.Add(inputDetail);
}
output.Set("Details", details);
var outputId = RpcFacade.Call<long>("/MainSystem/B3_HaoYue/Rpcs/B3CowButcherManageRpc/CreateOutput", output);
if (outputId > 0) {
WeightInfoBL.UpdateOutputId(selectedItems.Select(x => x.ID).ToArray(), outputId);
//BindGridInputInfo();
var list = RpcFacade.Call<List<long?>>("/MainSystem/B3_HaoYue/Rpcs/B3CowButcherManageRpc/CreateOutput", output,mTeam.ProductTeam_ID);
if (list.Count() > 0) {
var outputId = list[0].Value;
WeightInfoBL.UpdateOutputId(selectedItems.Select(x => x.ID).ToArray(),outputId);
BindGridWeightInfo();
var butDetails = gridProductPlan.ItemsSource as List<ButcherDetailData>;
if (list.Count > 1) {
for (int i = 1; i < list.Count; i++) {
ProductPlanBL.UpdateButhcerDetailFinish(list[i].Value);
var result = butDetails.Where(x => x.DetailID == list[i].Value);
butDetails.Remove(result.First());
}
var resultList = new List<ButcherDetailData>();
foreach (var item in butDetails) {
resultList.Add(item);
}
gridProductPlan.ItemsSource = null;
gridProductPlan.ItemsSource = resultList;
}
WindowUtil.Inf("生成产出单No." + outputId);
}
}
@ -94,10 +117,11 @@ namespace CowOutputClient
List<ProCataGoods> catalogsDetails = new List<ProCataGoods>();
private void BindBaseData()
{
txtProduceYear.Text = DateTime.Now.ToString("yyyy");
txtProduceMonth.Text = DateTime.Now.ToString("MM");
txtProduceDay.Text = DateTime.Now.ToString("dd");
mProduceDate = DateTime.Now.Date;
txtProductDate.Text = DateTime.Now.Date.ToString("yyyy-MM-dd");
txtProduceStartDate.Text = txtProductDate.Text;
mProduceStartDate = mProduceDate;
BindProductCatalogs();
BindCombProductBatch();
BindGridProductPlan();
@ -176,51 +200,100 @@ namespace CowOutputClient
}
}
private void SetStandardWeight(GoodsWeightFloat_Detail floatData, ProCataGoods detail, decimal? num, WeightInfo weight)
{
if (floatData != null && floatData.StandardWeight != null) {
if (!CheckGoodsWeight(detail, num, floatData)) {
return;
} else {
weight.Weight = floatData.StandardWeight.Value;
}
} else {
weight.Weight = num.Value;
}
}
private void ReadWeight(ProCataGoods detail)
{
//if (string.IsNullOrEmpty(txtProductBatch.Text))
// throw new ApplicationException("请输入屠宰生产批次");
bool isSecondNum = false;
var w = ConfigurationManager.AppSettings["Weight"];
decimal? goodsWeight = null;
decimal? num = null;
if (!string.IsNullOrEmpty(w)) {
ComWeight.Text = w;
goodsWeight = decimal.Parse(w);
}
if (rbSingleWeight.IsChecked == true) {
if (goodsWeight == null && string.IsNullOrEmpty(ComWeight.Text))
WindowUtil.Err("没称重不能读入");
else if (!string.IsNullOrEmpty(ComWeight.Text))
goodsWeight = decimal.Parse(ComWeight.Text);
} else {
var keypadWindow = new Keypad(this);
if (keypadWindow.ShowDialog() == true && !string.IsNullOrEmpty(keypadWindow.Result)) {
goodsWeight = decimal.Parse(keypadWindow.Result);
}
if (rbFixedNum.IsChecked == true) {
isSecondNum = true;
} else {
if (string.IsNullOrEmpty(ComWeight.Text)) {
WindowUtil.Err("没称重不能读入");
return;
}
num = decimal.Parse(ComWeight.Text);
}
}
if (string.IsNullOrEmpty(ComWeight.Text))
WindowUtil.Err("没称重不能读入");
var weight = new WeightInfo();
weight.Goods_Name = detail.Goods_Name;
weight.Goods_Spec = detail.Goods_Name;
weight.Goods_Spec = detail.Goods_Spec;
weight.Goods_ID = detail.Goods_ID;
weight.Weight = decimal.Parse(ComWeight.Text);
//decimal result = 0;
//if (weight.LegType == LegType.前腿 && combForeLeg.SelectedValue != null && !string.IsNullOrEmpty(txtForeLegNum.Text)) {
// result = ((decimal)combForeLeg.SelectedValue) * (int.Parse(txtForeLegNum.Text));
//}
//if (weight.LegType == LegType.后腿 && combHindLeg.SelectedValue != null && !string.IsNullOrEmpty(txtForeHindNum.Text)) {
// result = ((decimal)combHindLeg.SelectedValue) * (int.Parse(txtForeHindNum.Text));
//}
//weight.SubWeight = result;
//weight.NetWeight = weight.Weight - weight.SubWeight;
//weight.ProductBatch = txtProductBatch.Text;
var floatData = GoodsWeightFloatBL.GetGoodsWeightFloatData(detail.Goods_ID);
if (isSecondNum) {
if (detail.UnitConvertDirection == "双向转换" || detail.UnitConvertDirection == "由辅至主") {
weight.Weight = (goodsWeight / (detail.SecondUnitRatio ?? 1) * (detail.MainUnitRatio ?? 1)) ?? 0;
weight.SecondNum = goodsWeight;
}
} else if (rbSelectedNum.IsChecked == true) {
SetStandardWeight(floatData, detail, num, weight);
weight.SecondNum = goodsWeight;
} else {
SetStandardWeight(floatData, detail, goodsWeight??0, weight);
}
weight.SubWeight = tare;
weight.NetWeight = weight.Weight - (weight.SubWeight??0);
weight.CreateTime = DateTime.Now;
decimal? finishNum = null;
using (var she = new SqlHelperEx()) {
she.CreateTransaction();
if (mButcherDetailData != null) {
if (detail.Goods_ID == mButcherDetailData.Goods_ID) {
if (mButcherDetailData != null && detail.Goods_ID == mButcherDetailData.Goods_ID) {
weight.ButcDetailID = mButcherDetailData.DetailID;
finishNum = (mButcherDetailData.FinishNum ?? 0) + weight.Weight;
finishNum = (mButcherDetailData.FinishNum ?? 0) + weight.NetWeight;
if (finishNum > mButcherDetailData.PlanNumber)
throw new ApplicationException("计划数量【"+mButcherDetailData.PlanNumber+"】完工数量【"+finishNum+"】超出【"+(finishNum-mButcherDetailData.PlanNumber)+"】");
ProductPlanBL.UpdateButhcerDetailFinishNum(finishNum, mButcherDetailData.DetailID, mButcherDetailData.Goods_ID, she);
}
}
WeightInfoBL.Insert(weight,she);
she.Commit();
}
//待事务提交后再更新UI的值
if (mButcherDetailData != null) {
mButcherDetailData.FinishNum = finishNum;
mButcherDetailData.SurplusNum = (mButcherDetailData.PlanNumber ?? 0) - (mButcherDetailData.FinishNum ?? 0);
if (mButcherDetailData != null && detail.Goods_ID == mButcherDetailData.Goods_ID) {
mButcherDetailData.FinishNum = finishNum;
mButcherDetailData.SurplusNum = (mButcherDetailData.PlanNumber ?? 0) - (mButcherDetailData.FinishNum ?? 0);
}
BindGridWeightInfo();
gridWeightInfo.ScrollIntoView(gridWeightInfo.Items[0]);
}
private static bool CheckGoodsWeight(ProCataGoods detail, decimal? num, GoodsWeightFloat_Detail floatData)
{
var result = floatData.StandardWeight + (floatData.UpWeight ?? 0);
if (num < floatData.StandardWeight) {
WindowUtil.Err("【" + detail.Goods_Name + "】低于标准重量【" + floatData.StandardWeight + "】");
return false;
} else if (num > result) {
WindowUtil.Err("【" + detail.Goods_Name + "】高于上浮后重量【" + result + "】");
return false;
}
return true;
}
private void Grid_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
@ -236,6 +309,7 @@ namespace CowOutputClient
wpfUser = WpfUserBL.Load(UserBL.CurrentUser.ERP_User_ID);
mTeam = ProductTeamBL.GetProductTeam(wpfUser.Employee_ID);
BindBaseData();
//IsLoad = false;
}
private void OnRead(string sParam)
@ -252,85 +326,16 @@ namespace CowOutputClient
private void BindCombProductBatch()
{
var batchs = ProductPlanBL.GetProductBatch(mProduceDate);
var batchs = ProductPlanBL.GetProductBatch(mProduceDate,mProduceStartDate,IsLoad);
combProductBatch.ItemsSource = batchs;
combProductBatch.SelectedValuePath = "Batch_ID";
combProductBatch.DisplayMemberPath = "Batch";
}
private void txtProduceYear_PreviewMouseDown_1(object sender, MouseButtonEventArgs e)
{
var keypadWindow = new Keypad(this);
if (keypadWindow.ShowDialog() == true && !string.IsNullOrEmpty(keypadWindow.Result)) {
try {
var year = int.Parse(keypadWindow.Result);
if (year < 1990) {
WindowUtil.Inf("年份格式不正确");
return;
}
txtProduceYear.Text = keypadWindow.Result;
} catch (Exception ex) {
WindowUtil.Inf("年份格式不正确");
}
try {
mProduceDate = new DateTime(int.Parse(txtProduceYear.Text), int.Parse(txtProduceMonth.Text), int.Parse(txtProduceDay.Text));
} catch (Exception exe) {
WindowUtil.Inf("输入日期格式不正确");
}
BindCombProductBatch();
BindGridProductPlan();
}
}
private void txtProduceMonth_PreviewMouseDown_1(object sender, MouseButtonEventArgs e)
{
var keypadWindow = new Keypad(this);
if (keypadWindow.ShowDialog() == true && !string.IsNullOrEmpty(keypadWindow.Result)) {
try {
var month = int.Parse(keypadWindow.Result);
txtProduceMonth.Text = keypadWindow.Result;
} catch (Exception ex) {
WindowUtil.Inf("月份格式不正确");
}
try {
mProduceDate = new DateTime(int.Parse(txtProduceYear.Text), int.Parse(txtProduceMonth.Text), int.Parse(txtProduceDay.Text));
} catch (Exception exe) {
WindowUtil.Inf("输入日期格式不正确");
}
BindCombProductBatch();
BindGridProductPlan();
}
}
private void txtProduceDay_PreviewMouseDown_1(object sender, MouseButtonEventArgs e)
{
var keypadWindow = new Keypad(this);
if (keypadWindow.ShowDialog() == true && !string.IsNullOrEmpty(keypadWindow.Result)) {
try {
var day = int.Parse(keypadWindow.Result);
txtProduceDay.Text = keypadWindow.Result;
} catch (Exception ex) {
WindowUtil.Err("天数格式不正确");
}
try {
mProduceDate = new DateTime(int.Parse(txtProduceYear.Text), int.Parse(txtProduceMonth.Text), int.Parse(txtProduceDay.Text));
} catch (Exception exe) {
WindowUtil.Inf("输入日期格式不正确");
}
BindCombProductBatch();
BindGridProductPlan();
}
}
private void BindGridProductPlan()
{
if (mTeam != null) {
var details = ProductPlanBL.GetButcherDetails(mProduceDate, mTeam.ProductTeam_ID);
var details = ProductPlanBL.GetButcherDetails(mProduceDate,mProduceStartDate, mTeam.ProductTeam_ID);
gridProductPlan.ItemsSource = details;
}
}
@ -359,16 +364,65 @@ namespace CowOutputClient
private void Button_Click_1(object sender, RoutedEventArgs e)
{
var selectedItem = gridProductPlan.SelectedItem as ButcherDetailData;
var num = RpcFacade.Call<int>("/MainSystem/B3_HaoYue/Rpcs/B3CowButcherManageRpc/FinishButcherDetail", selectedItem.DetailID);
if (num == 1) {
ProductPlanBL.UpdateButhcerDetailFinish(selectedItem.DetailID);
BindGridProductPlan();
if (MessageBox.Show("确认完毕吗?", "温馨提示:", MessageBoxButton.OKCancel,MessageBoxImage.Information) == MessageBoxResult.Cancel) {
return;
}
var selectedItem = (sender as Button).Tag as ButcherDetailData;
if (combProductBatch.SelectedValue == null)
throw new ApplicationException("请选择分割生产批次");
var netWeight = WeightInfoBL.GetButcDetailIDWeight(selectedItem.DetailID);
var output = new RpcObject("/MainSystem/B3CowButcherManage/BO/Output");
output.Set<long?>("AccountingUnit_ID", long.Parse(accountingUnit_ID));
output.Set<long?>("Department_ID", wpfUser.Department_ID);
output.Set<long?>("Domain_ID", long.Parse(domain_ID));
output.Set<long?>("Employee_ID", wpfUser.Employee_ID ?? 0);
var batch = (ProductBatch)combProductBatch.SelectedItem;
output.Set<long?>("ProductBatch_ID", batch.Batch_ID);
output.Set<string>("Product_Batch", batch.Batch);
output.Set<DateTime?>("Date", DateTime.Now);
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);
output.Set("Details", details);
var list = RpcFacade.Call<List<long?>>("/MainSystem/B3_HaoYue/Rpcs/B3CowButcherManageRpc/CreateOutput", output, mTeam.ProductTeam_ID);
if (list.Count() > 0) {
var outputId = list[0].Value;
WeightInfoBL.UpdateOutputIdByButcDetailID(selectedItem.DetailID, outputId);
BindGridWeightInfo();
var butDetails = gridProductPlan.ItemsSource as List<ButcherDetailData>;
if (list.Count > 1) {
for (int i = 1; i < list.Count; i++) {
ProductPlanBL.UpdateButhcerDetailFinish(list[i].Value);
var result = butDetails.Where(x => x.DetailID == list[i].Value);
butDetails.Remove(result.First());
}
var resultList = new List<ButcherDetailData>();
foreach (var item in butDetails) {
resultList.Add(item);
}
gridProductPlan.ItemsSource = null;
gridProductPlan.ItemsSource = resultList;
}
WindowUtil.Inf("生成产出单No." + outputId);
}
//var num = RpcFacade.Call<int>("/MainSystem/B3_HaoYue/Rpcs/B3CowButcherManageRpc/FinishButcherDetail", selectedItem.DetailID);
//if (num == 1) {
// ProductPlanBL.UpdateButhcerDetailFinish(selectedItem.DetailID);
// BindGridProductPlan();
//}
}
private void DeleteButton_Click_2(object sender, RoutedEventArgs e)
{
if (MessageBox.Show("确认删除吗?", "温馨提示:", MessageBoxButton.OKCancel,MessageBoxImage.Information) == MessageBoxResult.Cancel) {
return;
}
var detail = (sender as Button).Tag as WeightInfo;
ButcherDetailData result = null;
@ -421,8 +475,78 @@ namespace CowOutputClient
{
if (gridProductPlan.SelectedIndex != -1) {
mButcherDetailData = gridProductPlan.SelectedItem as ButcherDetailData;
if (CatalogDetails.Children != null && CatalogDetails.Children.Count > 0) {
foreach (var item in CatalogDetails.Children) {
var bor = item as Border;
if (bor != null) {
var block = bor.Child as TextBlock;
var goods = block.Tag as ProCataGoods;
if (goods.Goods_ID == mButcherDetailData.Goods_ID) {
block.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#3598fe"));
block.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#fff"));
} else {
block.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#fff"));
block.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#000"));
}
}
}
}
gridProductPlan.SelectedIndex = -1;
}
}
private void txtProductDate_PreviewMouseDown_1(object sender, MouseButtonEventArgs e)
{
var calendar = new CalendarSelecterWindow();
if (calendar.ShowDialog() == true) {
mProduceDate = calendar.Result;
if (mProduceStartDate > mProduceDate)
throw new ApplicationException("结束日期不能小于开始日期");
txtProductDate.Text = calendar.Result.ToString("yyyy-MM-dd");
BindCombProductBatch();
//BindGridProductPlan();
}
}
private void txtProduceStartDate_PreviewMouseDown_1(object sender, MouseButtonEventArgs e)
{
var calendar = new CalendarSelecterWindow();
if (calendar.ShowDialog() == true) {
mProduceStartDate = calendar.Result;
if (mProduceStartDate > mProduceDate)
throw new ApplicationException("开始日期不能大于结束日期");
txtProduceStartDate.Text = calendar.Result.ToString("yyyy-MM-dd");
BindCombProductBatch();
//BindGridProductPlan();
}
}
private void btnTare_Click_1(object sender, RoutedEventArgs e)
{
var w = ConfigurationManager.AppSettings["Weight"];
if (!string.IsNullOrEmpty(w)) {
ComWeight.Text = w;
}
if (string.IsNullOrEmpty(ComWeight.Text))
WindowUtil.Err("称上没有重量");
tare = decimal.Parse(ComWeight.Text);
btnTare.Content = ComWeight.Text;
}
private void btnClear_Click_1(object sender, RoutedEventArgs e)
{
tare = null;
btnTare.Content = "去皮";
}
private void gridWeightInfo_SelectionChanged_1(object sender, SelectionChangedEventArgs e)
{
if (gridWeightInfo.SelectedIndex != -1) {
var data = gridWeightInfo.SelectedItem as WeightInfo;
data.IsSelected = data.IsSelected ? false : true;
gridWeightInfo.SelectedIndex = -1;
}
}
}
}

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

@ -117,9 +117,7 @@ namespace CowOutputClient
private void btnSave_Click_1(object sender, RoutedEventArgs e)
{
var selectedList = catalogsDetails.Where(x => x.IsSelected);
if (selectedList.Count() > 0)
ProductCatalogBL.UpdateProductCatalogDetails(selectedList.ToList());
ProductCatalogBL.UpdateProductCatalogDetails(catalogsDetails.Where(x => x.IsSelected));
this.DialogResult = true;
}
}


+ 7
- 7
CowOutputClient/app.config View File

@ -13,26 +13,26 @@
<add key="Goods_ID" value="2776" />
<!-- ************************* 电子秤1相关 ****************************-->
<!--串口名称-->
<add key="PortName" value="COM1" />
<add key="PortName" value="COM4" />
<!--波特率-->
<add key="BaudRate" value="1200" />
<add key="BaudRate" value="9600" />
<!--数据开始标志位,16进制表示-->
<add key="BeginHexNumber" value="02" />
<add key="BeginHexNumber" value="0A" />
<!--数据长度-->
<add key="DataLength" value="11" />
<add key="DataLength" value="17" />
<!--数据位-->
<add key="DataBits" value="7" />
<add key="DataBits" value="8" />
<!--奇偶校验-->
<add key="Parity" value="" />
<!--服务端口-->
<add key="ServicePort" value="8181" />
<add key="ServiceType" value="Comet" />
<!--数据来源类型-->
<add key="DataSource" value="XK3190-A1+" />
<add key="DataSource" value="AWH-SA" />
<!--数据类型-->
<add key="DataType" value="Decimal" />
<!--返回消息的格式化,目使用.net中类型格式化的语法,例如{0}-->
<add key="Format" value="{0:0.00}" />
<add key="Format" value="{0:0.000}" />
<add key="Delay" value="4" />
<add key="NoBeginChar" value="false" />
<add key="Weight" value="2" />


BIN
CowOutputClient/bin.rar View File


+ 221
- 0
WeighBusiness/BL/GoodsWeightFloatBL.cs View File

@ -0,0 +1,221 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Text;
using FireBirdUtil.SqlUtils;
using Forks.JsonRpc.Client;
using Forks.JsonRpc.Client.Data;
using Utils.Datas;
using WeighBusiness.BO;
using WeighBusiness.Utils;
using WeighBusiness.Utils.SqlUtils;
namespace WeighBusiness.BL
{
public static class GoodsWeightFloatBL
{
public static List<GoodsWeightFloat> GetGoodsWeightFloatRowVersion()
{
var table = SqlHelperEx.DoQuery("select GoodsWeightFloat_ID,RowVersion from {0}".FormatWith(TableNames.));
if (table.Rows.Count == 0)
return new List<GoodsWeightFloat>();
var list = new List<GoodsWeightFloat>();
foreach (DataRow row in table.Rows) {
var plan = new GoodsWeightFloat();
plan.GoodsWeightFloat_ID = (long)(int.Parse(row[0].ToString()));
plan.RowVersion = int.Parse(row[1].ToString());
list.Add(plan);
}
return list;
}
public static GoodsWeightFloat_Detail GetGoodsWeightFloatData(long? goodsId)
{
var table = SqlHelperEx.DoQuery("select StandardWeight,UpWeight from {0} where Goods_ID = {1}".FormatWith(TableNames., goodsId));
if (table.Rows.Count == 0)
return null;
foreach (DataRow row in table.Rows) {
var floatDetail = new GoodsWeightFloat_Detail();
floatDetail.StandardWeight = DataTypeUtil.GetDecimalNullNum(row[0]);
floatDetail.UpWeight = DataTypeUtil.GetDecimalNullNum(row[1]);
return floatDetail;
}
return null;
}
public static void Insert(List<GoodsWeightFloat> floats, List<GoodsWeightFloat_Detail> floatDetails)
{
using (var she = new SqlHelperEx()) {
she.CreateTransaction();
bool success = false;
string errorMessage;
if (floatDetails.Count() > 0) {
foreach (var detail in floats) {
string insertSql = InsertUtil.GetInsertSql(TableNames.,
new string[] { "GoodsWeightFloat_ID","RowVersion" },
new string[] { detail.GoodsWeightFloat_ID.ToString(), detail.RowVersion.ToString() });
she.ExecuteNonQuery(insertSql, out success, out errorMessage);
if (!success && !string.IsNullOrEmpty(errorMessage)) {
she.Rollback();
throw new ApplicationException(errorMessage);
}
}
}
if (floatDetails.Count() > 0) {
foreach (var detail in floatDetails) {
string insertSql = InsertUtil.GetInsertSql(TableNames.,
new string[] { "GoodsWeightFloat_ID", "Goods_ID", "DetailID", "StandardWeight", "UpWeight" },
new string[] { detail.GoodsWeightFloat_ID.ToString(), detail.Goods_ID.ToString(), detail.DetailID.ToString(),detail.StandardWeight == null?"null":detail.StandardWeight.ToString(),detail.UpWeight==null?"null":detail.UpWeight.ToString() });
she.ExecuteNonQuery(insertSql, out success, out errorMessage);
if (!success && !string.IsNullOrEmpty(errorMessage)) {
she.Rollback();
throw new ApplicationException(errorMessage);
}
}
}
if (!success) {
she.Rollback();
} else {
she.Commit();
}
}
}
public static string Delete(long ID)
{
bool success;
string errorMessage;
using (var she = new SqlHelperEx()) {
she.CreateTransaction();
var sql = SqlUtil.GetDeleteSql(TableNames., " where GoodsWeightFloat_ID=" + ID.ToString());
she.ExecuteNonQuery(sql, out success, out errorMessage);
if (success) {
var sql3 = SqlUtil.GetDeleteSql(TableNames., " where GoodsWeightFloat_ID=" + ID.ToString());
she.ExecuteNonQuery(sql3, out success, out errorMessage);
}
if (!success)
she.Rollback();
else
she.Commit();
}
return errorMessage;
}
public static void SyncGoodsWeightFloat()
{
var domain_ID = ConfigurationManager.AppSettings["Domain_ID"];
var method = "/MainSystem/B3_HaoYue/Rpcs/B3CowButcherManageRpc/GetGoodsWeightFloatRowVersion";
if (domain_ID != null && !string.IsNullOrEmpty(domain_ID)) {
var goodsWeightFloatRowVersions = RpcFacade.Call<List<Tuple<long?, int?>>>(method, long.Parse(domain_ID));
var oldGoodsWeightFloatRowVersions = GetGoodsWeightFloatRowVersion();
var needInsertGoodsWeightFloatID = new List<long?>();
var needDeleteAndInsertGoodsWeightFloatID = new List<long?>();
if (goodsWeightFloatRowVersions.Count > 0) {
if (oldGoodsWeightFloatRowVersions.Count() <= 0) {
goodsWeightFloatRowVersions.ForEach(x => needInsertGoodsWeightFloatID.Add(x.Item1));
} else {
foreach (var floatRowVersion in goodsWeightFloatRowVersions) {
var float_ID = floatRowVersion.Item1;
var oldWeightFloats = oldGoodsWeightFloatRowVersions.Where(x => x.GoodsWeightFloat_ID == float_ID);
if (oldWeightFloats.Count() > 0 && oldWeightFloats.FirstOrDefault().RowVersion != floatRowVersion.Item2) {
needDeleteAndInsertGoodsWeightFloatID.Add(floatRowVersion.Item1);
} else if (oldWeightFloats.Count() <= 0) {
needInsertGoodsWeightFloatID.Add(float_ID);
}
}
foreach (var oldVersion in oldGoodsWeightFloatRowVersions) {
if (!goodsWeightFloatRowVersions.Any(x => x.Item1 == oldVersion.GoodsWeightFloat_ID)) {
Delete(oldVersion.GoodsWeightFloat_ID);
}
}
}
} else {
Delete();
}
if (needDeleteAndInsertGoodsWeightFloatID.Count() > 0) {
foreach (var floatID in needDeleteAndInsertGoodsWeightFloatID) {
var error = Delete(floatID.Value);
if (!string.IsNullOrEmpty(error)) {
throw new ApplicationException(error);
}
needInsertGoodsWeightFloatID.Add(floatID);
}
}
if (needInsertGoodsWeightFloatID.Count > 0) {
var getGoodsWeightFloatDetail = "/MainSystem/B3_HaoYue/Rpcs/B3CowButcherManageRpc/GetGoodsWeightFloatInDetailData";
var goodsWeightFloatDetails = RpcFacade.Call<List<Tuple<long?, long?, long?, decimal?, decimal?>>>(getGoodsWeightFloatDetail, needInsertGoodsWeightFloatID.ToArray(),0);
var list = new List<GoodsWeightFloat>();
var floatList = new List<GoodsWeightFloat_Detail>();
foreach (var floatId in needInsertGoodsWeightFloatID) {
var wFloat = new GoodsWeightFloat();
wFloat.GoodsWeightFloat_ID = floatId.Value;
var result = goodsWeightFloatRowVersions.Where(x => x.Item1 == floatId).First();
wFloat.RowVersion = result.Item2.Value;
list.Add(wFloat);
}
if (goodsWeightFloatDetails.Count() > 0) {
foreach (var detail in goodsWeightFloatDetails) {
var floatDetail = new GoodsWeightFloat_Detail();
floatDetail.GoodsWeightFloat_ID = detail.Item1.Value;
floatDetail.Goods_ID = detail.Item2.Value;
floatDetail.DetailID = detail.Item3.Value;
floatDetail.StandardWeight = detail.Item4;
floatDetail.UpWeight = detail.Item5;
floatList.Add(floatDetail);
}
}
Insert(list, floatList);
}
}
}
public static string Delete()
{
bool success;
string errorMessage;
using (var she = new SqlHelperEx()) {
she.CreateTransaction();
var sql = SqlUtil.GetDeleteSql(TableNames.);
she.ExecuteNonQuery(sql, out success, out errorMessage);
if (success) {
var sql2 = SqlUtil.GetDeleteSql(TableNames.);
she.ExecuteNonQuery(sql2, out success, out errorMessage);
}
if (!success)
she.Rollback();
else
she.Commit();
}
return errorMessage;
}
public static ProductTeam GetProductTeam(long? employeeId)
{
var table = SqlHelperEx.DoQuery("select ProductTeam_ID,Name,ProduceType from {0} where Employee_ID = {1}".FormatWith(TableNames., employeeId == null ? "null" : employeeId.Value.ToString()));
if (table.Rows.Count > 0) {
foreach (DataRow row in table.Rows) {
var team = new ProductTeam();
team.ProductTeam_ID = (long)(int.Parse(row[0].ToString()));
team.Name = row[1].ToString();
team.ProduceType = row[2].ToString();
return team;
}
}
return null;
}
}
}

+ 31
- 16
WeighBusiness/BL/ProductCatalogBL.cs View File

@ -67,8 +67,8 @@ namespace WeighBusiness.BL
if (catalogDetails.Count() > 0) {
foreach (var detail in catalogDetails) {
string insertSql = InsertUtil.GetInsertSql(TableNames.,
new string[] { "ProductCatalog_ID", "CatalogDetail_ID", "Goods_Name", "Goods_ID" },
new string[] { detail.ProductCatalog_ID.ToString(), detail.CatalogDetail_ID.ToString(), detail.Goods_Name, detail.Goods_ID.ToString()});
new string[] { "ProductCatalog_ID", "CatalogDetail_ID", "Goods_Name", "Goods_ID", "UnitConvertDirection", "MainUnitRatio", "SecondUnitRatio","Goods_Spec" },
new string[] { detail.ProductCatalog_ID.ToString(), detail.CatalogDetail_ID.ToString(), detail.Goods_Name, detail.Goods_ID.ToString(), detail.UnitConvertDirection == null ? "null" : detail.UnitConvertDirection.ToString(), detail.MainUnitRatio == null ? "null" : detail.MainUnitRatio.ToString(), detail.SecondUnitRatio == null ? "null" : detail.SecondUnitRatio.ToString(),detail.Goods_Spec });
she.ExecuteNonQuery(insertSql, out success, out errorMessage);
if (!success && !string.IsNullOrEmpty(errorMessage)) {
she.Rollback();
@ -152,7 +152,7 @@ namespace WeighBusiness.BL
if (needInsertCatalogID.Count > 0) {
var method2 = "/MainSystem/B3_HaoYue/Rpcs/B3CowButcherManageRpc/GetProductCatalogDetailData";
var catalogDetails = RpcFacade.Call<List<Tuple<long?, long?, string, long?>>>(method2, needInsertCatalogID.ToArray());
var catalogDetails = RpcFacade.Call<List<RpcObject>>(method2, needInsertCatalogID.ToArray());
var list = new List<ProductCatalog>();
var detailList = new List<ProductCatalog_Detail>();
@ -169,10 +169,15 @@ namespace WeighBusiness.BL
if (catalogDetails.Count() > 0) {
foreach (var detail in catalogDetails) {
var catalogDetail = new ProductCatalog_Detail();
catalogDetail.ProductCatalog_ID = detail.Item1.Value;
catalogDetail.CatalogDetail_ID = detail.Item2.Value;
catalogDetail.Goods_Name = detail.Item3;
catalogDetail.Goods_ID = detail.Item4.Value;
catalogDetail.ProductCatalog_ID = detail.Get<long>("ProductCatalog_ID");
catalogDetail.CatalogDetail_ID = detail.Get<long>("ID");
catalogDetail.Goods_Name = detail.Get<string>("Goods_Name");
catalogDetail.Goods_ID = detail.Get<long>("Goods_ID");
if (detail.Get<NamedValue>("UnitConvertDirection") != null)
catalogDetail.UnitConvertDirection = detail.Get<NamedValue>("UnitConvertDirection").ToString();
catalogDetail.MainUnitRatio = detail.Get<decimal?>("MainUnitRatio");
catalogDetail.SecondUnitRatio = detail.Get<decimal?>("SecondUnitRatio");
catalogDetail.Goods_Spec = detail.Get<string>("Goods_Spec");
detailList.Add(catalogDetail);
}
}
@ -221,7 +226,7 @@ namespace WeighBusiness.BL
public static List<ProCataGoods> GetProductCatalogDetails(bool? isSelected = null)
{
var table = SqlHelperEx.DoQuery("select a.ProductCatalog_ID,a.CatalogDetail_ID,a.Goods_Name,a.Goods_ID,b.Goods_ID 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.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<ProCataGoods>();
var list = new List<ProCataGoods>();
@ -232,25 +237,31 @@ namespace WeighBusiness.BL
catalog.Goods_Name = row[2].ToString();
catalog.Goods_ID = (long)(int.Parse(row[3].ToString()));
catalog.IsSelected = DataTypeUtil.GetLongNum(row[4])==0?false:true;
catalog.UnitConvertDirection = DataTypeUtil.ToStringEmptyIfNull(row[5]);
catalog.MainUnitRatio = DataTypeUtil.GetDecimalNullNum(row[6]);
catalog.SecondUnitRatio = DataTypeUtil.GetDecimalNullNum(row[7]);
catalog.Goods_Spec = DataTypeUtil.ToStringEmptyIfNull(row[8]);
list.Add(catalog);
}
return list;
}
public static void UpdateProductCatalogDetails(List<ProCataGoods> selectedList)
public static void UpdateProductCatalogDetails(IEnumerable<ProCataGoods> selectedList)
{
bool success = true;
using (var she = new SqlHelperEx()) {
she.CreateTransaction();
string deleteSql = string.Format("delete from " + TableNames.);
she.ExecuteNonQuery(deleteSql, out success);
foreach (var catalogDetail in selectedList) {
string insertSql = InsertUtil.GetInsertSql(TableNames.,
new string[] { "ProductCatalog_ID","Goods_ID" },
new string[] { catalogDetail.ProductCatalog_ID.ToString(), catalogDetail.Goods_ID.ToString() });
she.ExecuteNonQuery(insertSql, out success);
if (!success)
she.Rollback();
if (selectedList.Count() > 0) {
foreach (var catalogDetail in selectedList) {
string insertSql = InsertUtil.GetInsertSql(TableNames.,
new string[] { "ProductCatalog_ID", "Goods_ID" },
new string[] { catalogDetail.ProductCatalog_ID.ToString(), catalogDetail.Goods_ID.ToString() });
she.ExecuteNonQuery(insertSql, out success);
if (!success)
she.Rollback();
}
}
she.Commit();
}
@ -262,7 +273,11 @@ namespace WeighBusiness.BL
public long ProductCatalog_ID { get; set; }
public long CatalogDetail_ID { get; set; }
public string Goods_Name { get; set; }
public string Goods_Spec { get; set; }
public long Goods_ID { get; set; }
public string UnitConvertDirection { get; set; }
public decimal? MainUnitRatio { get; set; }
public decimal? SecondUnitRatio { get; set; }
private bool mIsSelected = false;
public bool IsSelected
{


+ 17
- 4
WeighBusiness/BL/ProductPlanBL.cs View File

@ -157,6 +157,10 @@ namespace WeighBusiness.BL
var sql2 = SqlUtil.GetDeleteSql(TableNames., " where ProductPlan_ID=" + ID.ToString());
she.ExecuteNonQuery(sql2, out success, out errorMessage);
}
if (success) {
var sql2 = SqlUtil.GetDeleteSql(TableNames., " where ProductPlan_ID=" + ID.ToString());
she.ExecuteNonQuery(sql2, out success, out errorMessage);
}
if (!success)
she.Rollback();
else
@ -264,10 +268,15 @@ namespace WeighBusiness.BL
}
}
public static List<ProductBatch> GetProductBatch(DateTime date)
public static List<ProductBatch> GetProductBatch(DateTime date,DateTime startDate,bool isLoad)
{
var list = new List<ProductBatch>();
var querySql = "select Batch_ID,Batch from {0} where BillDate >='{1}' and BillDate < '{2}'".FormatWith(TableNames., date, date.AddDays(1));
var querySql = string.Empty;
if (!isLoad) {
querySql = "select Batch_ID,Batch from {0} where BillDate >='{1}' and BillDate < '{2}'".FormatWith(TableNames., startDate, date.AddDays(1));
} else {
querySql = "select Batch_ID,Batch from {0}".FormatWith(TableNames., startDate.AddDays(1));
}
var table = SqlHelperEx.DoQuery(querySql);
if (table.Rows.Count == 0)
return new List<ProductBatch>();
@ -292,6 +301,10 @@ namespace WeighBusiness.BL
var sql3 = SqlUtil.GetDeleteSql(TableNames.);
she.ExecuteNonQuery(sql3, out success, out errorMessage);
}
if (success) {
var sql3 = SqlUtil.GetDeleteSql(TableNames.);
she.ExecuteNonQuery(sql3, out success, out errorMessage);
}
if (!success)
she.Rollback();
else
@ -300,10 +313,10 @@ namespace WeighBusiness.BL
return errorMessage;
}
public static List<ButcherDetailData> GetButcherDetails(DateTime date, long planTeamID)
public static List<ButcherDetailData> GetButcherDetails(DateTime date,DateTime startDate,long planTeamID)
{
var list = new List<ButcherDetailData>();
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., date, 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 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);
if (!string.IsNullOrEmpty(sql)) {
var table = SqlHelperEx.DoQuery(sql);
foreach (DataRow row in table.Rows) {


+ 22
- 7
WeighBusiness/BL/WeightInfoBL.cs View File

@ -18,8 +18,8 @@ namespace WeighBusiness.BL
public static bool Insert(WeightInfo weight,SqlHelperEx she2 = null)
{
string insertSql = InsertUtil.GetInsertSql(TableNames.,
new string[] { "Goods_Name", "Goods_Spec", "Goods_ID", "Weight", "SubWeight", "NetWeight", "CreateTime", "ProductBatch", "IsSend", "Num", "ButcDetailID" },
new string[] {weight.Goods_Name,weight.Goods_Spec, weight.Goods_ID.ToString(), weight.Weight.ToString(), weight.SubWeight == null ? "null" : weight.SubWeight.ToString(), weight.NetWeight == null ? "null" : weight.NetWeight.ToString(), weight.CreateTime == null ? "null" : weight.CreateTime.ToString(),weight.ProductBatch,weight.IsSelected?"1":"0",weight.Num==null?"null":weight.Num.ToString(),weight.ButcDetailID==null?"null":weight.ButcDetailID.ToString()});
new string[] { "Goods_Name", "Goods_Spec", "Goods_ID", "Weight", "SubWeight", "NetWeight", "CreateTime", "ProductBatch", "IsSend", "SecondNum", "ButcDetailID" },
new string[] { weight.Goods_Name, weight.Goods_Spec, weight.Goods_ID.ToString(), weight.Weight.ToString(), weight.SubWeight == null ? "null" : weight.SubWeight.ToString(), weight.NetWeight == null ? "null" : weight.NetWeight.ToString(), weight.CreateTime == null ? "null" : weight.CreateTime.ToString(), weight.ProductBatch, weight.IsSelected ? "1" : "0", weight.SecondNum == null ? "null" : weight.SecondNum.ToString(), weight.ButcDetailID == null ? "null" : weight.ButcDetailID.ToString() });
bool success;
string errorMsg;
if (she2 == null) {
@ -72,15 +72,15 @@ namespace WeighBusiness.BL
public static List<WeightInfo> GetWeightInfos(bool hasOutputId = false)
{
var sql = "select Num,Weight,SubWeight,NetWeight,CreateTime,Goods_ID,ID,Goods_Name,Goods_Spec,ButcDetailID from {0} where 1=1 {1} order by ID desc".FormatWith(TableNames., hasOutputId ? "and Output_ID is not null" : "and Output_ID is null");
var sql = "select SecondNum,Weight,SubWeight,NetWeight,CreateTime,Goods_ID,ID,Goods_Name,Goods_Spec,ButcDetailID from {0} where 1=1 {1} order by ID desc".FormatWith(TableNames., hasOutputId ? "and Output_ID is not null" : "and Output_ID is null");
var table = SqlHelperEx.DoQuery(sql);
if (table.Rows.Count == 0)
return new List<WeightInfo>();
var list = new List<WeightInfo>();
var i = 1;
var i = table.Rows.Count;
foreach (DataRow row in table.Rows) {
var detail = new WeightInfo();
detail.Num = DataTypeUtil.GetDecimalNum(row[0]);
detail.SecondNum = DataTypeUtil.GetDecimalNum(row[0]);
detail.Weight = DataTypeUtil.GetDecimalNum(row[1]);
detail.SubWeight = DataTypeUtil.GetDecimalNullNum(row[2]);
detail.NetWeight = DataTypeUtil.GetDecimalNullNum(row[3]);
@ -91,7 +91,7 @@ namespace WeighBusiness.BL
detail.Goods_Spec = DataTypeUtil.ToStringEmptyIfNull(row[8]);
detail.ButcDetailID = DataTypeUtil.GetLongNullNum(row[9]);
detail.Number = i;
i++;
i--;
list.Add(detail);
}
return list;
@ -100,7 +100,7 @@ namespace WeighBusiness.BL
public static decimal? GetButcDetailIDWeight(long? butcDetailID,SqlHelperEx she2 = null)
{
if (butcDetailID != null) {
var sql = "select sum(Weight) from {0} where ButcDetailID = {1}".FormatWith(TableNames., butcDetailID);
var sql = "select sum(NetWeight) from {0} where ButcDetailID = {1}".FormatWith(TableNames., butcDetailID);
DataTable table;
if (she2 == null) {
using (var she = new SqlHelperEx()) {
@ -132,6 +132,21 @@ namespace WeighBusiness.BL
}
}
public static void UpdateOutputIdByButcDetailID(long butcDetailID, long outputId)
{
string updateSql = string.Format("update " + TableNames. + " set Output_ID = {0} where ButcDetailID = {1}", outputId, butcDetailID);
bool success = true;
using (var she = new SqlHelperEx()) {
she.CreateTransaction();
she.ExecuteNonQuery(updateSql, out success);
if (!success) {
she.Rollback();
} else {
she.Commit();
}
}
}
public static int GetUnfinishedBatchPageCount(int pageSize)
{
var sql = "select count(ID) from {0} where State=0".FormatWith(TableNames.);


+ 21
- 0
WeighBusiness/BO/CreateTables/CreateGoodsWeightFloat.cs View File

@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FireBirdUtil.DataTypes;
using FireBirdUtil.SqlHelpers;
namespace WeighBusiness.BO.CreateTables
{
public class CreateGoodsWeightFloat : CreateBaseTable
{
public CreateGoodsWeightFloat(string tableName) : base(tableName) { }
public override void AddFields(CreateTableHelper cth)
{
cth.AddField(new FieldInfo() { FieldName = "GoodsWeightFloat_ID", FieldType = FBType.Integer, IsNotNull = true });
cth.AddField(new FieldInfo() { FieldName = "RowVersion", FieldType = FBType.Integer });
base.AddFields(cth);
}
}
}

+ 34
- 0
WeighBusiness/BO/CreateTables/CreateGoodsWeightFloat_Detail.cs View File

@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FireBirdUtil.DataTypes;
using FireBirdUtil.SqlHelpers;
namespace WeighBusiness.BO.CreateTables
{
public class CreateGoodsWeightFloat_Detail : CreateBaseTable
{
public CreateGoodsWeightFloat_Detail(string tableName) : base(tableName) { }
public override void AddFields(CreateTableHelper cth)
{
cth.AddField(new FieldInfo() { FieldName = "GoodsWeightFloat_ID", FieldType = FBType.Integer, IsNotNull = true });
cth.AddField(new FieldInfo() { FieldName = "Goods_ID", FieldType = FBType.Integer, IsNotNull = true });
cth.AddField(new FieldInfo() { FieldName = "DetailID", FieldType = FBType.Integer, IsNotNull = true });
cth.AddField(new FieldInfo() {
FieldName = "StandardWeight",
FieldType = FBType.Decimal,
FieldTypeParams = "(18,6)",
IsNotNull = false
});
cth.AddField(new FieldInfo() {
FieldName = "UpWeight",
FieldType = FBType.Decimal,
FieldTypeParams = "(18,6)",
IsNotNull = false
});
base.AddFields(cth);
}
}
}

+ 14
- 0
WeighBusiness/BO/CreateTables/CreateProductCatalog_Detail.cs View File

@ -17,6 +17,20 @@ namespace WeighBusiness.BO.CreateTables
cth.AddField(new FieldInfo() { FieldName = "CatalogDetail_ID", FieldType = FBType.Integer, IsNotNull = true });
cth.AddField(new FieldInfo() { FieldName = "Goods_Name", FieldType = FBType.Varchar, FieldTypeParams = "(100)", IsNotNull = true });
cth.AddField(new FieldInfo() { FieldName = "Goods_ID", FieldType = FBType.Integer, IsNotNull = true });
cth.AddField(new FieldInfo() { FieldName = "UnitConvertDirection", FieldType = FBType.Varchar, FieldTypeParams = "(100)", IsNotNull = false });
cth.AddField(new FieldInfo() {
FieldName = "MainUnitRatio",
FieldType = FBType.Decimal,
FieldTypeParams = "(18,6)",
IsNotNull = false
});
cth.AddField(new FieldInfo() {
FieldName = "SecondUnitRatio",
FieldType = FBType.Decimal,
FieldTypeParams = "(18,6)",
IsNotNull = false
});
cth.AddField(new FieldInfo() { FieldName = "Goods_Spec", FieldType = FBType.Varchar, FieldTypeParams = "(100)", IsNotNull = false });
base.AddFields(cth);
}


+ 1
- 1
WeighBusiness/BO/CreateTables/CreateWeightInfo.cs View File

@ -27,7 +27,7 @@ namespace WeighBusiness.BO.CreateTables
IsNotNull = false
});
cth.AddField(new FieldInfo() {
FieldName = "Num",
FieldName = "SecondNum",
FieldType = FBType.Decimal,
FieldTypeParams = "(18,6)",
IsNotNull = false


+ 19
- 0
WeighBusiness/BO/GoodsWeightFloat.cs View File

@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WeighBusiness.Utils;
namespace WeighBusiness.BO
{
public class GoodsWeightFloat : Base
{
public override string TableName
{
get { return TableNames.; }
}
public long GoodsWeightFloat_ID { get; set; }
public int RowVersion { get; set; }
}
}

+ 22
- 0
WeighBusiness/BO/GoodsWeightFloat_Detail.cs View File

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WeighBusiness.Utils;
namespace WeighBusiness.BO
{
public class GoodsWeightFloat_Detail : Base
{
public override string TableName
{
get { return TableNames.; }
}
public long GoodsWeightFloat_ID { get; set; }
public long Goods_ID { get; set; }
public long DetailID { get; set; }
public decimal? StandardWeight { get; set; }
public decimal? UpWeight { get; set; }
}
}

+ 4
- 0
WeighBusiness/BO/ProductCatalog_Detail.cs View File

@ -18,6 +18,10 @@ namespace WeighBusiness.BO
public long ProductCatalog_ID { get; set; }
public long CatalogDetail_ID { get; set; }
public string Goods_Name { get; set; }
public string Goods_Spec { get; set; }
public long Goods_ID { get; set; }
public string UnitConvertDirection { get; set; }
public decimal? MainUnitRatio { get; set; }
public decimal? SecondUnitRatio { get; set; }
}
}

+ 1
- 1
WeighBusiness/BO/WeightInfo.cs View File

@ -13,7 +13,7 @@ namespace WeighBusiness.BO
public decimal Weight { get; set; }
public decimal? SubWeight { get; set; }
public decimal? NetWeight { get; set; }
public decimal? Num { get; set; }
public decimal? SecondNum { get; set; }
public DateTime CreateTime { get; set; }
public long Goods_ID { get; set; }
public string ProductBatch { get; set; }


+ 13
- 0
WeighBusiness/MyThread.cs View File

@ -340,6 +340,7 @@ namespace SerialPortWebSocketAdapter
message = FormatBase3190A12(buffer, config);
break;
case "AWH-SA":
case "ACS-W(SA)":
message = FormatBaseAWH_SA(buffer, config);
break;
default:
@ -375,6 +376,18 @@ namespace SerialPortWebSocketAdapter
return output;
}
private static string FormatBaseACS_W_SA(byte[] buffer, _Config config)
{
var output = Encoding.ASCII.GetString(buffer);
if (output.Length > 0) {
//output = Reverse(output);
output = output.TrimStart('0');
output = (decimal.Parse(output) / 1000).ToString();
}
return output;
}
private static string FormatBaseAWH_SA(byte[] buffer, _Config config)
{
var output = Encoding.ASCII.GetString(buffer);


+ 4
- 0
WeighBusiness/Utils/CreateUtil.cs View File

@ -123,6 +123,10 @@ namespace WeighBusiness.Utils
return false;
if (!new CreateButcherDetailFinishNum(TableNames.).Create(out errorMessage))
return false;
if (!new CreateGoodsWeightFloat_Detail(TableNames.).Create(out errorMessage))
return false;
if (!new CreateGoodsWeightFloat(TableNames.).Create(out errorMessage))
return false;
return true;
}


+ 2
- 1
WeighBusiness/Utils/TableName.cs View File

@ -52,7 +52,8 @@ namespace WeighBusiness.Utils
public const string = "ProductTeamOutDetail";
public const string = "SelectedGoods";
public const string = "ButcherFiniNum";
public const string = "GoodsWeightFloat";
public const string = "WeightFloatDetail";
}
public enum WeightType


+ 5
- 0
WeighBusiness/WeighBusiness.csproj View File

@ -77,6 +77,7 @@
<Compile Include="BL\DishBL.cs" />
<Compile Include="BL\DispatchBillDetailBL.cs" />
<Compile Include="BL\GoodsBL.cs" />
<Compile Include="BL\GoodsWeightFloatBL.cs" />
<Compile Include="BL\PoleBL.cs" />
<Compile Include="BL\LittleCarBL.cs" />
<Compile Include="BL\ProduceBatch_RoadMap_RefBL.cs" />
@ -116,6 +117,7 @@
<Compile Include="BO\CreateTables\CreateDishTable.cs" />
<Compile Include="BO\CreateTables\CreateDispatchBillDetail.cs" />
<Compile Include="BO\CreateTables\CreateGoodsTable.cs" />
<Compile Include="BO\CreateTables\CreateGoodsWeightFloat.cs" />
<Compile Include="BO\CreateTables\CreateLittleCarTable.cs" />
<Compile Include="BO\CreateTables\CreatePoleTable.cs" />
<Compile Include="BO\CreateTables\CreateProduceIntakeDetailTable.cs" />
@ -132,9 +134,12 @@
<Compile Include="BO\CreateTables\CreatePSInfoTable.cs" />
<Compile Include="BO\CreateTables\CreateProduceBatch_RoadMap_Ref.cs" />
<Compile Include="BO\CreateTables\CreateUnfinishedBatch.cs" />
<Compile Include="BO\CreateTables\CreateGoodsWeightFloat_Detail.cs" />
<Compile Include="BO\Dish.cs" />
<Compile Include="BO\DispatchBillDetail.cs" />
<Compile Include="BO\Goods.cs" />
<Compile Include="BO\GoodsWeightFloat.cs" />
<Compile Include="BO\GoodsWeightFloat_Detail.cs" />
<Compile Include="BO\LittleCar.cs" />
<Compile Include="BO\INameWeight.cs" />
<Compile Include="BO\Pole.cs" />


Loading…
Cancel
Save