Browse Source

分割品入库。登录优化。

master
yibo 7 years ago
parent
commit
2110c02afd
7 changed files with 245 additions and 27 deletions
  1. +1
    -1
      ButcherFactory.BO/Enums/DriveType.cs
  2. +9
    -0
      ButcherFactory.Form/ButcherFactory.Form.csproj
  3. +48
    -0
      ButcherFactory.Form/SegmentInStore_/SegmentInStoreForm.Designer.cs
  4. +32
    -0
      ButcherFactory.Form/SegmentInStore_/SegmentInStoreForm.cs
  5. +120
    -0
      ButcherFactory.Form/SegmentInStore_/SegmentInStoreForm.resx
  6. +1
    -1
      ButcherFactory.Login/Login.xaml
  7. +34
    -25
      ButcherFactory.Login/Login.xaml.cs

+ 1
- 1
ButcherFactory.BO/Enums/DriveType.cs View File

@ -12,6 +12,6 @@ namespace ButcherFactory.BO
= 0, = 0,
= 1, = 1,
= 2, = 2,
= 3,
= 3,
} }
} }

+ 9
- 0
ButcherFactory.Form/ButcherFactory.Form.csproj View File

@ -128,6 +128,12 @@
<Compile Include="CarcassTakeOut_\CarcassTakeOutForm.Designer.cs"> <Compile Include="CarcassTakeOut_\CarcassTakeOutForm.Designer.cs">
<DependentUpon>CarcassTakeOutForm.cs</DependentUpon> <DependentUpon>CarcassTakeOutForm.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="SegmentInStore_\SegmentInStoreForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="SegmentInStore_\SegmentInStoreForm.Designer.cs">
<DependentUpon>SegmentInStoreForm.cs</DependentUpon>
</Compile>
<Compile Include="SegmentProduction_\SegmentProductionForm.cs"> <Compile Include="SegmentProduction_\SegmentProductionForm.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
@ -184,6 +190,9 @@
<EmbeddedResource Include="Dialogs\WeightRecordDialog.resx"> <EmbeddedResource Include="Dialogs\WeightRecordDialog.resx">
<DependentUpon>WeightRecordDialog.cs</DependentUpon> <DependentUpon>WeightRecordDialog.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="SegmentInStore_\SegmentInStoreForm.resx">
<DependentUpon>SegmentInStoreForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="SegmentProduction_\SegmentProductionForm.resx"> <EmbeddedResource Include="SegmentProduction_\SegmentProductionForm.resx">
<DependentUpon>SegmentProductionForm.cs</DependentUpon> <DependentUpon>SegmentProductionForm.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>


+ 48
- 0
ButcherFactory.Form/SegmentInStore_/SegmentInStoreForm.Designer.cs View File

@ -0,0 +1,48 @@
namespace ButcherFactory.SegmentInStore_
{
partial class SegmentInStoreForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.SuspendLayout();
//
// SegmentInStoreForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.White;
this.ClientSize = new System.Drawing.Size(797, 488);
this.Name = "SegmentInStoreForm";
this.Text = "扫码入库";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.ResumeLayout(false);
}
#endregion
}
}

+ 32
- 0
ButcherFactory.Form/SegmentInStore_/SegmentInStoreForm.cs View File

@ -0,0 +1,32 @@
using ButcherFactory.BO;
using ButcherFactory.BO.Utils;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ButcherFactory.SegmentInStore_
{
public partial class SegmentInStoreForm : Form, IWithRoleForm
{
public List<short> RoleName
{
get { return new List<short> { (short). }; }
}
public Form Generate()
{
return this;
}
public SegmentInStoreForm()
{
InitializeComponent();
}
}
}

+ 120
- 0
ButcherFactory.Form/SegmentInStore_/SegmentInStoreForm.resx View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

+ 1
- 1
ButcherFactory.Login/Login.xaml View File

@ -16,7 +16,7 @@
<Label Content="密 码 :" FontFamily="微软雅黑" FontSize="22px" HorizontalAlignment="Left" Margin="142,202,0,0" VerticalAlignment="Top" Width="90" /> <Label Content="密 码 :" FontFamily="微软雅黑" FontSize="22px" HorizontalAlignment="Left" Margin="142,202,0,0" VerticalAlignment="Top" Width="90" />
<PasswordBox Name="pwdInput" HorizontalAlignment="Left" Height="33" Margin="233,208,0,0" VerticalAlignment="Top" FontSize="17" Width="187" VerticalContentAlignment="Center" PreviewMouseLeftButtonDown="PwdTextBoxClick"/> <PasswordBox Name="pwdInput" HorizontalAlignment="Left" Height="33" Margin="233,208,0,0" VerticalAlignment="Top" FontSize="17" Width="187" VerticalContentAlignment="Center" PreviewMouseLeftButtonDown="PwdTextBoxClick"/>
<Button Style="{StaticResource Login}" Content="登录" Foreground="#FFFFFF" HorizontalAlignment="Left" Margin="233,260,0,0" VerticalAlignment="Top" Width="80" Height="40" FontSize="18" BorderBrush="#0675E3" Click="LoginBtn_Click">
<Button Name="loginBtn" Style="{StaticResource Login}" Content="登录" Foreground="#FFFFFF" HorizontalAlignment="Left" Margin="233,260,0,0" VerticalAlignment="Top" Width="80" Height="40" FontSize="18" BorderBrush="#0675E3" Click="LoginBtn_Click">
<!--<Button.Background> <!--<Button.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"> <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FF055EB6" Offset="1"/> <GradientStop Color="#FF055EB6" Offset="1"/>


+ 34
- 25
ButcherFactory.Login/Login.xaml.cs View File

@ -35,35 +35,44 @@ namespace ButcherFactory.Login
private async void LoginBtn_Click(object sender, RoutedEventArgs e) private async void LoginBtn_Click(object sender, RoutedEventArgs e)
{ {
if (string.IsNullOrEmpty(AppContext.ConnectInfo.SqlConnection))
throw new Exception("请设置数据库地址!");
var username = userNameInput.Text.Trim();
var pwd = pwdInput.Password;
if (string.IsNullOrEmpty(username))
throw new Exception("请输入用户名");
LoginUtil.InitRpcFacade();
if (LoginUtil.TestConnection(1000))
try
{ {
await Task.Factory.StartNew(() => LoginUtil.Login(username, pwd, AppContext.ConnectInfo.ServerMode));
loginBtn.IsEnabled = false;
if (string.IsNullOrEmpty(AppContext.ConnectInfo.SqlConnection))
throw new Exception("请设置数据库地址!");
var username = userNameInput.Text.Trim();
var pwd = pwdInput.Password;
if (string.IsNullOrEmpty(username))
throw new Exception("请输入用户名");
LoginUtil.InitRpcFacade();
if (LoginUtil.TestConnection(1000))
{
await Task.Factory.StartNew(() => LoginUtil.Login(username, pwd, AppContext.ConnectInfo.ServerMode));
}
else
{
if (AppContext.ConnectInfo.ServerMode == 1)
throw new Exception("网络错误");
if (AppContext.Worker.Name != username || string.Join("", LoginUtil.EncodePwd(pwd)) != string.Join("", AppContext.Worker.Password))
throw new Exception("离线时只能使用上次登录信息登录");
}
var form = FormUtil.CreateFrom();
if (form == null)
throw new Exception("权限不符");
form.FormClosing += delegate
{
this.Show();
};
form.Show();
Hide();
} }
else
catch { throw; }
finally
{ {
if (AppContext.ConnectInfo.ServerMode == 1)
throw new Exception("网络错误");
if (AppContext.Worker.Name != username || string.Join("", LoginUtil.EncodePwd(pwd)) != string.Join("", AppContext.Worker.Password))
throw new Exception("离线时只能使用上次登录信息登录");
loginBtn.IsEnabled = true;
} }
var form = FormUtil.CreateFrom();
if (form == null)
throw new Exception("权限不符");
form.FormClosing += delegate
{
this.Show();
};
form.Show();
Hide();
} }
private void ExistBtn_Click(object sender, RoutedEventArgs e) private void ExistBtn_Click(object sender, RoutedEventArgs e)


Loading…
Cancel
Save