Browse Source

需求单No.184013 分割客户端 增加“去皮功能”

master
yibo 5 months ago
parent
commit
a019d634cb
36 changed files with 713 additions and 281 deletions
  1. +7
    -2
      ButcherFactory.AutoUpdate/ButcherFactory.AutoUpdate.csproj
  2. +50
    -58
      ButcherFactory.AutoUpdate/Properties/Resources.Designer.cs
  3. +18
    -22
      ButcherFactory.AutoUpdate/Properties/Settings.Designer.cs
  4. +3
    -0
      ButcherFactory.AutoUpdate/app.config
  5. +3
    -1
      ButcherFactory.BO/ButcherFactory.BO.csproj
  6. +1
    -1
      ButcherFactory.BO/LocalBL/CarcassInStoreBL.cs
  7. +1
    -1
      ButcherFactory.BO/LocalBL/CarcassSaleOutBL.cs
  8. +1
    -1
      ButcherFactory.BO/LocalBL/CarcassTakeOutBL.cs
  9. +4
    -4
      ButcherFactory.BO/LocalBL/FormClientGoodsSetBL.cs
  10. +1
    -1
      ButcherFactory.BO/LocalBL/SegmentPickUpBL.cs
  11. +12
    -12
      ButcherFactory.BO/LocalBL/SegmentProductionBL.cs
  12. +2
    -2
      ButcherFactory.BO/LocalBL/WeightCountEntityBL.cs
  13. +1
    -1
      ButcherFactory.BO/Utils/Extensions.cs
  14. +7
    -1
      ButcherFactory.Form/ButcherFactory.Form.csproj
  15. +1
    -0
      ButcherFactory.Form/Controls/WeightControl.Designer.cs
  16. +6
    -1
      ButcherFactory.Form/Controls/WeightControl.cs
  17. +1
    -1
      ButcherFactory.Form/Dialogs/AddWeightRecord.cs
  18. +3
    -3
      ButcherFactory.Form/Properties/Resources.Designer.cs
  19. +38
    -0
      ButcherFactory.Form/SegmentProductionAuto_/CallLibrary.cs
  20. BIN
      ButcherFactory.Form/SegmentProductionAuto_/ScaleLibrary.dll
  21. +228
    -125
      ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.Designer.cs
  22. +215
    -9
      ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.cs
  23. +6
    -0
      ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.resx
  24. +19
    -0
      ButcherFactory.Form/SegmentProductionAuto_/Utils.cs
  25. +41
    -0
      ButcherFactory.Form/SegmentProductionAuto_/WeightStatus.cs
  26. +2
    -2
      ButcherFactory.Form/SegmentProduction_/SegmentProductionPrint.cs
  27. +1
    -1
      ButcherFactory.Form/SegmentProduction_/SegmentSumCodePrint.cs
  28. +1
    -1
      ButcherFactory.Form/WeightCount_/WeightCountPrint.cs
  29. +2
    -2
      ButcherFactory.Login/App.xaml.cs
  30. +5
    -2
      ButcherFactory.Login/ButcherFactory.Login.csproj
  31. +7
    -8
      ButcherFactory.Login/Login.xaml.cs
  32. +3
    -0
      ButcherFactory.Login/app.config
  33. +3
    -2
      ButcherFactory.Tools/ButcherFactory.Tools.csproj
  34. +14
    -14
      ButcherFactory.Tools/MainWindow.xaml.cs
  35. +3
    -3
      ButcherFactory.Tools/Properties/Resources.Designer.cs
  36. +3
    -0
      ButcherFactory.Tools/app.config

+ 7
- 2
ButcherFactory.AutoUpdate/ButcherFactory.AutoUpdate.csproj View File

@ -9,8 +9,9 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ButcherFactory.AutoUpdate</RootNamespace>
<AssemblyName>ButcherFactory.AutoUpdate</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
@ -21,15 +22,17 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
@ -64,7 +67,9 @@
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="app.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>


+ 50
- 58
ButcherFactory.AutoUpdate/Properties/Resources.Designer.cs View File

@ -1,71 +1,63 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本: 4.0.30319.42000
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将丢失。
// 重新生成代码,这些更改将丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace ButcherFactory.AutoUpdate.Properties
{
/// <summary>
/// 一个强类型的资源类,用于查找本地化的字符串等。
/// </summary>
// 此类是由 StronglyTypedResourceBuilder
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
namespace ButcherFactory.AutoUpdate.Properties {
using System;
/// <summary>
/// 返回此类使用的、缓存的 ResourceManager 实例
/// 一个强类型的资源类,用于查找本地化的字符串等。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ButcherFactory.AutoUpdate.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
// 此类是由 StronglyTypedResourceBuilder
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// 返回此类使用的缓存的 ResourceManager 实例。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ButcherFactory.AutoUpdate.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// 重写当前线程的 CurrentUICulture 属性,对
/// 使用此强类型资源类的所有资源查找执行重写。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
return resourceMan;
}
}
/// <summary>
/// 为所有资源查找重写当前线程的 CurrentUICulture 属性,
/// 方法是使用此强类型资源类。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}

+ 18
- 22
ButcherFactory.AutoUpdate/Properties/Settings.Designer.cs View File

@ -1,30 +1,26 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace ButcherFactory.AutoUpdate.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
namespace ButcherFactory.AutoUpdate.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.6.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}
}

+ 3
- 0
ButcherFactory.AutoUpdate/app.config View File

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration>

+ 3
- 1
ButcherFactory.BO/ButcherFactory.BO.csproj View File

@ -9,8 +9,9 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ButcherFactory.BO</RootNamespace>
<AssemblyName>ButcherFactory.BO</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@ -28,6 +29,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<Reference Include="Forks.EnterpriseServices, Version=3.1.0.0, Culture=neutral, PublicKeyToken=7254430f49d10aae, processorArchitecture=MSIL">


+ 1
- 1
ButcherFactory.BO/LocalBL/CarcassInStoreBL.cs View File

@ -25,7 +25,7 @@ namespace ButcherFactory.BO.LocalBL
var entity = new CarcassInStore();
entity.WorkUnit_ID = workUnitID;
entity.ProductBatch_ID = batchID;
entity.UserID = AppContext.Worker.ID;
entity.UserID = BO.Utils.AppContext.Worker.ID;
entity.Weight = weight;
entity.RowIndex = GenerateRowIndex(session, batchID);
session.Insert(entity);


+ 1
- 1
ButcherFactory.BO/LocalBL/CarcassSaleOutBL.cs View File

@ -297,7 +297,7 @@ namespace ButcherFactory.BO.LocalBL
type.GetProperty(p.Name).SetValue(delete, p.GetValue(tag));
}
delete.DeleteTime = DateTime.Now;
delete.Deleter = AppContext.Worker.Name;
delete.Deleter = BO.Utils.AppContext.Worker.Name;
session.Insert(delete);
}


+ 1
- 1
ButcherFactory.BO/LocalBL/CarcassTakeOutBL.cs View File

@ -33,7 +33,7 @@ namespace ButcherFactory.BO.LocalBL
}
entity.Number = 1;
entity.Store_ID = storeID;
entity.UserID = AppContext.Worker.ID;
entity.UserID = BO.Utils.AppContext.Worker.ID;
entity.BarCode = barCode;
entity.RowIndex = GenerateRowIndex(session);
session.Insert(entity);


+ 4
- 4
ButcherFactory.BO/LocalBL/FormClientGoodsSetBL.cs View File

@ -117,7 +117,7 @@ namespace ButcherFactory.BO.LocalBL
{
if (!ExistSet(detailID, session))
{
var entity = new WorkerGoodsSetProfile { Worker_ID = AppContext.Worker.ID, ClientGoodsSet_Detail_ID = detailID };
var entity = new WorkerGoodsSetProfile { Worker_ID = BO.Utils.AppContext.Worker.ID, ClientGoodsSet_Detail_ID = detailID };
session.Insert(entity);
session.Commit();
}
@ -128,14 +128,14 @@ namespace ButcherFactory.BO.LocalBL
{
var query = new DQueryDom(new JoinAlias(typeof(WorkerGoodsSetProfile)));
query.Columns.Add(DQSelectColumn.Create(DQExpression.Value(1), "c"));
query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("Worker_ID", AppContext.Worker.ID), DQCondition.EQ("ClientGoodsSet_Detail_ID", detailID)));
query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("Worker_ID", BO.Utils.AppContext.Worker.ID), DQCondition.EQ("ClientGoodsSet_Detail_ID", detailID)));
return query.EExecuteScalar(session) != null;
}
public static void DeleteWorkGoodsSet(long detailID)
{
var delete = new DQDeleteDom(typeof(WorkerGoodsSetProfile));
delete.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("Worker_ID", AppContext.Worker.ID), DQCondition.EQ("ClientGoodsSet_Detail_ID", detailID)));
delete.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("Worker_ID", BO.Utils.AppContext.Worker.ID), DQCondition.EQ("ClientGoodsSet_Detail_ID", detailID)));
delete.EExecute();
}
}
@ -148,7 +148,7 @@ namespace ButcherFactory.BO.LocalBL
{
var query = new DQueryDom(new JoinAlias(typeof(WorkerGoodsSetProfile)));
query.Columns.Add(DQSelectColumn.Field("ClientGoodsSet_Detail_ID"));
query.Where.Conditions.Add(DQCondition.EQ("Worker_ID", AppContext.Worker.ID));
query.Where.Conditions.Add(DQCondition.EQ("Worker_ID", BO.Utils.AppContext.Worker.ID));
return query;
}
}


+ 1
- 1
ButcherFactory.BO/LocalBL/SegmentPickUpBL.cs View File

@ -60,7 +60,7 @@ namespace ButcherFactory.BO.LocalBL
using (var session = DmoSession.New())
{
entity.Number = 1;
entity.UserID = AppContext.Worker.ID;
entity.UserID = BO.Utils.AppContext.Worker.ID;
session.Insert(entity);
session.Commit();
}


+ 12
- 12
ButcherFactory.BO/LocalBL/SegmentProductionBL.cs View File

@ -96,12 +96,12 @@ namespace ButcherFactory.BO.LocalBL
if (tuple == null)
{
entity = new TotalCode();
entity.UserID = AppContext.Worker.ID;
entity.UserID = BO.Utils.AppContext.Worker.ID;
entity.GoodsType = 1;
entity.NoTotalCode = true;
entity.RowIndex = 1;
// 年月日+2位机器号
entity.BarCode = string.Format("{0:yyyyMMdd}{1}", date, AppContext.ConnectInfo.ClientCode);
entity.BarCode = string.Format("{0:yyyyMMdd}{1}", date, BO.Utils.AppContext.ConnectInfo.ClientCode);
session.Insert(entity);
session.Commit();
}
@ -206,11 +206,11 @@ namespace ButcherFactory.BO.LocalBL
var entity = new SegmentProduction();
entity.Goods_ID = goodsID;
entity.Weight = weight;
entity.UserID = AppContext.Worker.ID;
entity.UserID = BO.Utils.AppContext.Worker.ID;
entity.WorkUnit_ID = workUnitID;
entity.ProductBatch_ID = productBatchID;
entity.RowIndex = GenerateRowIndex(productBatchID, session);
entity.BarCode = string.Format("260912011{0:yyyyMMdd}{1}{2:00000}", batchDate, AppContext.ConnectInfo.ClientCode, entity.RowIndex);
entity.BarCode = string.Format("260912011{0:yyyyMMdd}{1}{2:00000}", batchDate, BO.Utils.AppContext.ConnectInfo.ClientCode, entity.RowIndex);
session.Insert(entity);
FillMsgID(session, entity);
session.Commit();
@ -222,7 +222,7 @@ namespace ButcherFactory.BO.LocalBL
{
var update = new DQUpdateDom(typeof(SegmentProduction));
update.Where.Conditions.Add(DQCondition.EQ("ID", item.ID));
update.Columns.Add(new DQUpdateColumn("MsgID", string.Format("{0}_{1}", AppContext.ConnectInfo.ClientCode, item.ID)));
update.Columns.Add(new DQUpdateColumn("MsgID", string.Format("{0}_{1}", BO.Utils.AppContext.ConnectInfo.ClientCode, item.ID)));
session.ExecuteNonQuery(update);
}
@ -230,9 +230,9 @@ namespace ButcherFactory.BO.LocalBL
{
using (var session = DmoSession.New())
{
entity.UserID = AppContext.Worker.ID;
entity.UserID = BO.Utils.AppContext.Worker.ID;
entity.RowIndex = GenerateRowIndex(entity.ProductBatch_ID, session);
entity.BarCode = string.Format("260912011{0:yyyyMMdd}{1}{2:00000}", batchDate, AppContext.ConnectInfo.ClientCode, entity.RowIndex);
entity.BarCode = string.Format("260912011{0:yyyyMMdd}{1}{2:00000}", batchDate, BO.Utils.AppContext.ConnectInfo.ClientCode, entity.RowIndex);
entity.Submited = true;
session.Insert(entity);
FillGroupIDAsID(session, entity.ID);
@ -250,11 +250,11 @@ namespace ButcherFactory.BO.LocalBL
{
using (var session = DmoSession.New())
{
entity.UserID = AppContext.Worker.ID;
entity.UserID = BO.Utils.AppContext.Worker.ID;
entity.RowIndex = TotalCodeRowIndex(date, session);
// 年月日+2位机器号+4位顺序号
entity.BarCode = string.Format("{0:yyyyMMdd}{1}{2:0000}", date, AppContext.ConnectInfo.ClientCode, entity.RowIndex);
entity.BarCode = string.Format("{0:yyyyMMdd}{1}{2:0000}", date, BO.Utils.AppContext.ConnectInfo.ClientCode, entity.RowIndex);
session.Insert(entity);
session.Commit();
@ -272,11 +272,11 @@ namespace ButcherFactory.BO.LocalBL
if (tuple == null)
{
entity = new TotalCode();
entity.UserID = AppContext.Worker.ID;
entity.UserID = BO.Utils.AppContext.Worker.ID;
entity.GoodsType = 0;
entity.RowIndex = 1;
// 年月日+2位机器号
entity.BarCode = string.Format("{0:yyyyMMdd}{1}", date, AppContext.ConnectInfo.ClientCode);
entity.BarCode = string.Format("{0:yyyyMMdd}{1}", date, BO.Utils.AppContext.ConnectInfo.ClientCode);
session.Insert(entity);
session.Commit();
}
@ -316,7 +316,7 @@ namespace ButcherFactory.BO.LocalBL
{
var update = new DQUpdateDom(typeof(SegmentProduction));
update.Where.Conditions.Add(DQCondition.EQ("ID", id));
update.Columns.Add(new DQUpdateColumn("MsgID", string.Format("{0}_{1}", AppContext.ConnectInfo.ClientCode, id)));
update.Columns.Add(new DQUpdateColumn("MsgID", string.Format("{0}_{1}", BO.Utils.AppContext.ConnectInfo.ClientCode, id)));
update.Columns.Add(new DQUpdateColumn("GroupID", id));
session.ExecuteNonQuery(update);
}


+ 2
- 2
ButcherFactory.BO/LocalBL/WeightCountEntityBL.cs View File

@ -64,7 +64,7 @@ namespace ButcherFactory.BO.LocalBL
using (var session = DmoSession.New())
{
entity.Number = 1;
entity.UserID = AppContext.Worker.ID;
entity.UserID = BO.Utils.AppContext.Worker.ID;
CreateBarCode(session, entity);
session.Insert(entity);
session.Commit();
@ -76,7 +76,7 @@ namespace ButcherFactory.BO.LocalBL
var query = new DQueryDom(new JoinAlias(typeof(WeightCountEntity)));
query.Where.Conditions.Add(DQCondition.Between("CreateTime", entity.CreateTime.Date, entity.CreateTime.Date + new TimeSpan(23, 59, 59)));
query.Columns.Add(DQSelectColumn.Count());
entity.BarCode = string.Format("260912011{0:yyyyMMdd}{1}{2:00000}", entity.CreateTime, AppContext.ConnectInfo.ClientCode, query.EExecuteScalar(session));
entity.BarCode = string.Format("260912011{0:yyyyMMdd}{1}{2:00000}", entity.CreateTime, BO.Utils.AppContext.ConnectInfo.ClientCode, query.EExecuteScalar(session));
}
public static void UpdateNumber(long id, int number)


+ 1
- 1
ButcherFactory.BO/Utils/Extensions.cs View File

@ -15,7 +15,7 @@ namespace ButcherFactory.BO
{
public static IDmoSessionWithTransaction New()
{
return Dmo.NewSession(AppContext.ConnectInfo.SqlConnection);
return Dmo.NewSession(BO.Utils.AppContext.ConnectInfo.SqlConnection);
}
}


+ 7
- 1
ButcherFactory.Form/ButcherFactory.Form.csproj View File

@ -9,8 +9,9 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ButcherFactory</RootNamespace>
<AssemblyName>ButcherFactory.Form</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@ -28,6 +29,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>
@ -210,6 +212,7 @@
<Compile Include="SegmentPickUp_\SegmentPickUpForm.Designer.cs">
<DependentUpon>SegmentPickUpForm.cs</DependentUpon>
</Compile>
<Compile Include="SegmentProductionAuto_\CallLibrary.cs" />
<Compile Include="SegmentProductionAuto_\Form1.cs">
<SubType>Form</SubType>
</Compile>
@ -228,6 +231,7 @@
<Compile Include="SegmentProductionAuto_\IdentifySelectionDialog.Designer.cs">
<DependentUpon>IdentifySelectionDialog.cs</DependentUpon>
</Compile>
<Compile Include="SegmentProductionAuto_\Utils.cs" />
<Compile Include="SegmentProductionAuto_\WeightDetails.cs" />
<Compile Include="SegmentProductionAuto_\LogForm.cs">
<SubType>Form</SubType>
@ -253,6 +257,7 @@
<Compile Include="SegmentProductionAuto_\ViewTaskForm.Designer.cs">
<DependentUpon>ViewTaskForm.cs</DependentUpon>
</Compile>
<Compile Include="SegmentProductionAuto_\WeightStatus.cs" />
<Compile Include="SegmentProductionAuto_\WeightView.cs">
<SubType>Form</SubType>
</Compile>
@ -422,6 +427,7 @@
<Content Include="Files\today.png" />
<Content Include="Files\uCheck.png" />
<Content Include="Files\wtl.wav" />
<Content Include="SegmentProductionAuto_\ScaleLibrary.dll" />
<Content Include="SegmentProduction_\SegmentProductionPrint.html" />
<Content Include="SegmentProduction_\SegmentProductionPrint1.html" />
<Content Include="SegmentProduction_\SegmentProductionPrintEnd.html" />


+ 1
- 0
ButcherFactory.Form/Controls/WeightControl.Designer.cs View File

@ -97,6 +97,7 @@
this.roundPanel2.Name = "roundPanel2";
this.roundPanel2.Size = new System.Drawing.Size(164, 74);
this.roundPanel2.TabIndex = 0;
this.roundPanel2.Paint += new System.Windows.Forms.PaintEventHandler(this.roundPanel2_Paint);
//
// lblChengZhong
//


+ 6
- 1
ButcherFactory.Form/Controls/WeightControl.cs View File

@ -309,6 +309,11 @@ namespace ButcherFactory.Controls
}
if (weightPort.IsOpen)
weightPort.Close();
}
}
private void roundPanel2_Paint(object sender, PaintEventArgs e)
{
}
}
}

+ 1
- 1
ButcherFactory.Form/Dialogs/AddWeightRecord.cs View File

@ -49,7 +49,7 @@ namespace ButcherFactory.Dialogs
record.Goods_Name = mDetail.Goods_Name;
record.Number = number;
record.Weight = weight;
record.Operator = AppContext.Worker.Name;
record.Operator = BO.Utils.AppContext.Worker.Name;
var flag = mDetail.Goods_ID == 7318 ? -1 : 0; //套猪袋
CarcassSaleOutBL.AddAndUpdate(record, flag, mProductTime);
DialogResult = DialogResult.OK;


+ 3
- 3
ButcherFactory.Form/Properties/Resources.Designer.cs View File

@ -19,7 +19,7 @@ namespace ButcherFactory.Properties {
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
@ -47,8 +47,8 @@ namespace ButcherFactory.Properties {
}
/// <summary>
/// 使用此强类型资源类,为所有资源查找
/// 重写当前线程的 CurrentUICulture 属性
/// 重写当前线程的 CurrentUICulture 属性,对
/// 使用此强类型资源类的所有资源查找执行重写。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {


+ 38
- 0
ButcherFactory.Form/SegmentProductionAuto_/CallLibrary.cs View File

@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace ButcherFactory.SegmentProductionAuto_
{
static class CallLibrary
{
#region 调用 scale DLL
public delegate void pFunCallback(IntPtr data, int length, IntPtr net);
[DllImport("ScaleLibrary.dll", EntryPoint = "SendZero", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
public static extern int SendZero();//归零
[DllImport("ScaleLibrary.dll", EntryPoint = "sendPort", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
public static extern int sendPort(int Port, int Buadrate);//设置端口
[DllImport("ScaleLibrary.dll", EntryPoint = "isZero", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
public static extern int isZero();//是否是零点
[DllImport("ScaleLibrary.dll", EntryPoint = "isStable", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
public static extern int isStable(); //是否稳定
[DllImport("ScaleLibrary.dll", EntryPoint = "isTare", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
public static extern int isTare(); //是否扣重
[DllImport("ScaleLibrary.dll", EntryPoint = "getStringNet", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
public static extern IntPtr getStringNet(); //获取解析好的重量
[DllImport("ScaleLibrary.dll", EntryPoint = "unbindScale", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
public static extern int unbindScale(); //释放接口
#endregion
}
}

BIN
ButcherFactory.Form/SegmentProductionAuto_/ScaleLibrary.dll View File


+ 228
- 125
ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.Designer.cs View File

@ -28,12 +28,13 @@
/// </summary>
private void InitializeComponent()
{
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle();
this.components = new System.ComponentModel.Container();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
this.uLabel3 = new WinFormControl.ULabel();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.taskDataGrid = new WinFormControl.UDataGridView();
@ -49,10 +50,7 @@
this.label2 = new System.Windows.Forms.Label();
this.statisticNumberBox = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.logBtn = new ButcherFactory.Controls.ColorButton();
this.msglbl = new System.Windows.Forms.Label();
this.closeBtn = new ButcherFactory.Controls.ColorButton();
this.uWeightControl1 = new ButcherFactory.Controls.WeightControl();
this.barPrintCheck = new System.Windows.Forms.CheckBox();
this.uTimerLabel1 = new WinFormControl.UTimerLabel();
this.productBatchSelect = new System.Windows.Forms.ComboBox();
@ -61,17 +59,27 @@
this.uLabel2 = new WinFormControl.ULabel();
this.netStateWatch1 = new WinFormControl.NetStateWatch();
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
this.goodsSetBtn = new ButcherFactory.Controls.ColorButton();
this.flowLayoutPanel2 = new System.Windows.Forms.FlowLayoutPanel();
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.flowLayoutPanel4 = new System.Windows.Forms.FlowLayoutPanel();
this.flowLayoutPanel3 = new System.Windows.Forms.FlowLayoutPanel();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.serialPort1 = new System.IO.Ports.SerialPort(this.components);
this.weightSwitch = new ButcherFactory.Controls.ColorButton();
this.zeroBtn = new ButcherFactory.Controls.ColorButton();
this.roundPanel2 = new ButcherFactory.Controls.RoundPanel(this.components);
this.labelStable = new System.Windows.Forms.Label();
this.labelZero = new System.Windows.Forms.Label();
this.lblChengZhong = new System.Windows.Forms.Label();
this.logBtn = new ButcherFactory.Controls.ColorButton();
this.closeBtn = new ButcherFactory.Controls.ColorButton();
this.goodsSetBtn = new ButcherFactory.Controls.ColorButton();
this.colorButton2 = new ButcherFactory.Controls.ColorButton();
this.viewTaskBtn = new ButcherFactory.Controls.ColorButton();
this.colorButton1 = new ButcherFactory.Controls.ColorButton();
this.deleteBtn = new ButcherFactory.Controls.ColorButton();
this.rePrintBtn = new ButcherFactory.Controls.ColorButton();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.flowLayoutPanel4 = new System.Windows.Forms.FlowLayoutPanel();
this.flowLayoutPanel3 = new System.Windows.Forms.FlowLayoutPanel();
this.groupBox2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.taskDataGrid)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
@ -83,6 +91,7 @@
this.splitContainer2.Panel2.SuspendLayout();
this.splitContainer2.SuspendLayout();
this.groupBox1.SuspendLayout();
this.roundPanel2.SuspendLayout();
this.SuspendLayout();
//
// uLabel3
@ -92,7 +101,7 @@
this.uLabel3.Font = new System.Drawing.Font("宋体", 12F);
this.uLabel3.Location = new System.Drawing.Point(8, 0);
this.uLabel3.Name = "uLabel3";
this.uLabel3.Size = new System.Drawing.Size(72, 16);
this.uLabel3.Size = new System.Drawing.Size(71, 16);
this.uLabel3.TabIndex = 1;
this.uLabel3.Text = "生产历史";
//
@ -112,15 +121,15 @@
this.taskDataGrid.AllowUserToDeleteRows = false;
this.taskDataGrid.AllowUserToResizeColumns = false;
this.taskDataGrid.AllowUserToResizeRows = false;
dataGridViewCellStyle7.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.taskDataGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle7;
dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.taskDataGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
this.taskDataGrid.BackgroundColor = System.Drawing.Color.White;
this.taskDataGrid.BorderStyle = System.Windows.Forms.BorderStyle.None;
dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle8.Font = new System.Drawing.Font("宋体", 12F);
dataGridViewCellStyle8.ForeColor = System.Drawing.Color.White;
dataGridViewCellStyle8.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.taskDataGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle8;
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle2.Font = new System.Drawing.Font("宋体", 12F);
dataGridViewCellStyle2.ForeColor = System.Drawing.Color.White;
dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.taskDataGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;
this.taskDataGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.taskDataGrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.T_Item,
@ -133,9 +142,9 @@
this.taskDataGrid.Name = "taskDataGrid";
this.taskDataGrid.ReadOnly = true;
this.taskDataGrid.RowHeadersVisible = false;
dataGridViewCellStyle12.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle12.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
this.taskDataGrid.RowsDefaultCellStyle = dataGridViewCellStyle12;
dataGridViewCellStyle6.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle6.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
this.taskDataGrid.RowsDefaultCellStyle = dataGridViewCellStyle6;
this.taskDataGrid.RowTemplate.Height = 23;
this.taskDataGrid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.taskDataGrid.Size = new System.Drawing.Size(442, 96);
@ -152,8 +161,8 @@
//
this.T_Need.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.T_Need.DataPropertyName = "Need";
dataGridViewCellStyle9.Format = "#0.######";
this.T_Need.DefaultCellStyle = dataGridViewCellStyle9;
dataGridViewCellStyle3.Format = "#0.######";
this.T_Need.DefaultCellStyle = dataGridViewCellStyle3;
this.T_Need.HeaderText = "订货";
this.T_Need.Name = "T_Need";
this.T_Need.ReadOnly = true;
@ -162,8 +171,8 @@
//
this.T_Done.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.T_Done.DataPropertyName = "Done";
dataGridViewCellStyle10.Format = "#0.######";
this.T_Done.DefaultCellStyle = dataGridViewCellStyle10;
dataGridViewCellStyle4.Format = "#0.######";
this.T_Done.DefaultCellStyle = dataGridViewCellStyle4;
this.T_Done.HeaderText = "完工";
this.T_Done.Name = "T_Done";
this.T_Done.ReadOnly = true;
@ -172,8 +181,8 @@
//
this.T_Last.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.T_Last.DataPropertyName = "Last";
dataGridViewCellStyle11.Format = "#0.######";
this.T_Last.DefaultCellStyle = dataGridViewCellStyle11;
dataGridViewCellStyle5.Format = "#0.######";
this.T_Last.DefaultCellStyle = dataGridViewCellStyle5;
this.T_Last.HeaderText = "剩余";
this.T_Last.Name = "T_Last";
this.T_Last.ReadOnly = true;
@ -186,7 +195,7 @@
this.GoodsLabel.ForeColor = System.Drawing.Color.Blue;
this.GoodsLabel.Location = new System.Drawing.Point(144, 178);
this.GoodsLabel.Name = "GoodsLabel";
this.GoodsLabel.Size = new System.Drawing.Size(72, 16);
this.GoodsLabel.Size = new System.Drawing.Size(71, 16);
this.GoodsLabel.TabIndex = 1;
this.GoodsLabel.Text = "存货名称";
//
@ -202,6 +211,9 @@
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.weightSwitch);
this.splitContainer1.Panel1.Controls.Add(this.zeroBtn);
this.splitContainer1.Panel1.Controls.Add(this.roundPanel2);
this.splitContainer1.Panel1.Controls.Add(this.butcherDateBox);
this.splitContainer1.Panel1.Controls.Add(this.label3);
this.splitContainer1.Panel1.Controls.Add(this.numberInput);
@ -211,7 +223,6 @@
this.splitContainer1.Panel1.Controls.Add(this.logBtn);
this.splitContainer1.Panel1.Controls.Add(this.msglbl);
this.splitContainer1.Panel1.Controls.Add(this.closeBtn);
this.splitContainer1.Panel1.Controls.Add(this.uWeightControl1);
this.splitContainer1.Panel1.Controls.Add(this.barPrintCheck);
this.splitContainer1.Panel1.Controls.Add(this.uTimerLabel1);
this.splitContainer1.Panel1.Controls.Add(this.productBatchSelect);
@ -288,21 +299,6 @@
this.label1.TabIndex = 26;
this.label1.Text = "统计数量:";
//
// logBtn
//
this.logBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.logBtn.BackColor = System.Drawing.Color.CadetBlue;
this.logBtn.Font = new System.Drawing.Font("宋体", 15F);
this.logBtn.ForeColor = System.Drawing.Color.White;
this.logBtn.Location = new System.Drawing.Point(680, 4);
this.logBtn.Name = "logBtn";
this.logBtn.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(158)))), ((int)(((byte)(234)))), ((int)(((byte)(106)))));
this.logBtn.Size = new System.Drawing.Size(101, 41);
this.logBtn.TabIndex = 25;
this.logBtn.Text = "日志";
this.logBtn.UseVisualStyleBackColor = false;
this.logBtn.Click += new System.EventHandler(this.logBtn_Click);
//
// msglbl
//
this.msglbl.AutoSize = true;
@ -313,30 +309,6 @@
this.msglbl.TabIndex = 24;
this.msglbl.Text = "正在获取基础信息";
//
// closeBtn
//
this.closeBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.closeBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(25)))));
this.closeBtn.Font = new System.Drawing.Font("宋体", 15F);
this.closeBtn.ForeColor = System.Drawing.Color.White;
this.closeBtn.Location = new System.Drawing.Point(1109, 7);
this.closeBtn.Name = "closeBtn";
this.closeBtn.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(158)))), ((int)(((byte)(234)))), ((int)(((byte)(106)))));
this.closeBtn.Size = new System.Drawing.Size(111, 41);
this.closeBtn.TabIndex = 18;
this.closeBtn.Text = "关闭";
this.closeBtn.UseVisualStyleBackColor = false;
this.closeBtn.Click += new System.EventHandler(this.closeBtn_Click);
//
// uWeightControl1
//
this.uWeightControl1.BackColor = System.Drawing.Color.Transparent;
this.uWeightControl1.Location = new System.Drawing.Point(12, 7);
this.uWeightControl1.Name = "uWeightControl1";
this.uWeightControl1.Size = new System.Drawing.Size(262, 74);
this.uWeightControl1.TabIndex = 17;
this.uWeightControl1.WeightFalg = null;
//
// barPrintCheck
//
this.barPrintCheck.AutoSize = true;
@ -357,7 +329,7 @@
this.uTimerLabel1.Format = "M月d日 H:mm:ss";
this.uTimerLabel1.Location = new System.Drawing.Point(1084, 53);
this.uTimerLabel1.Name = "uTimerLabel1";
this.uTimerLabel1.Size = new System.Drawing.Size(136, 16);
this.uTimerLabel1.Size = new System.Drawing.Size(135, 16);
this.uTimerLabel1.TabIndex = 14;
this.uTimerLabel1.Text = "4月21日 16:32:19";
//
@ -441,21 +413,6 @@
this.splitContainer2.SplitterDistance = 761;
this.splitContainer2.TabIndex = 0;
//
// goodsSetBtn
//
this.goodsSetBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.goodsSetBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(77)))), ((int)(((byte)(135)))), ((int)(((byte)(245)))));
this.goodsSetBtn.Font = new System.Drawing.Font("宋体", 15F);
this.goodsSetBtn.ForeColor = System.Drawing.Color.White;
this.goodsSetBtn.Location = new System.Drawing.Point(645, 3);
this.goodsSetBtn.Name = "goodsSetBtn";
this.goodsSetBtn.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(158)))), ((int)(((byte)(234)))), ((int)(((byte)(106)))));
this.goodsSetBtn.Size = new System.Drawing.Size(111, 62);
this.goodsSetBtn.TabIndex = 19;
this.goodsSetBtn.Text = "产品设置";
this.goodsSetBtn.UseVisualStyleBackColor = false;
this.goodsSetBtn.Click += new System.EventHandler(this.goodsSetBtn_Click);
//
// flowLayoutPanel2
//
this.flowLayoutPanel2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
@ -478,6 +435,179 @@
this.flowLayoutPanel1.Size = new System.Drawing.Size(640, 70);
this.flowLayoutPanel1.TabIndex = 22;
//
// groupBox1
//
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
this.groupBox1.Controls.Add(this.flowLayoutPanel4);
this.groupBox1.Controls.Add(this.flowLayoutPanel3);
this.groupBox1.Controls.Add(this.uLabel3);
this.groupBox1.Location = new System.Drawing.Point(8, 222);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Padding = new System.Windows.Forms.Padding(5);
this.groupBox1.Size = new System.Drawing.Size(447, 381);
this.groupBox1.TabIndex = 5;
this.groupBox1.TabStop = false;
//
// flowLayoutPanel4
//
this.flowLayoutPanel4.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.flowLayoutPanel4.AutoScroll = true;
this.flowLayoutPanel4.Location = new System.Drawing.Point(5, 90);
this.flowLayoutPanel4.Name = "flowLayoutPanel4";
this.flowLayoutPanel4.Size = new System.Drawing.Size(437, 286);
this.flowLayoutPanel4.TabIndex = 5;
//
// flowLayoutPanel3
//
this.flowLayoutPanel3.AutoScroll = true;
this.flowLayoutPanel3.BackColor = System.Drawing.Color.White;
this.flowLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Top;
this.flowLayoutPanel3.Location = new System.Drawing.Point(5, 19);
this.flowLayoutPanel3.Margin = new System.Windows.Forms.Padding(0);
this.flowLayoutPanel3.Name = "flowLayoutPanel3";
this.flowLayoutPanel3.Size = new System.Drawing.Size(437, 68);
this.flowLayoutPanel3.TabIndex = 4;
this.flowLayoutPanel3.WrapContents = false;
//
// timer1
//
this.timer1.Interval = 50;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// serialPort1
//
this.serialPort1.PortName = "COM3";
//
// weightSwitch
//
this.weightSwitch.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(77)))), ((int)(((byte)(135)))), ((int)(((byte)(245)))));
this.weightSwitch.Font = new System.Drawing.Font("宋体", 10F);
this.weightSwitch.ForeColor = System.Drawing.Color.White;
this.weightSwitch.Location = new System.Drawing.Point(173, 43);
this.weightSwitch.Name = "weightSwitch";
this.weightSwitch.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(158)))), ((int)(((byte)(234)))), ((int)(((byte)(106)))));
this.weightSwitch.Size = new System.Drawing.Size(90, 32);
this.weightSwitch.StateHold = true;
this.weightSwitch.TabIndex = 38;
this.weightSwitch.Text = "启用称重";
this.weightSwitch.UseVisualStyleBackColor = false;
this.weightSwitch.Click += new System.EventHandler(this.weightSwitch_Click);
//
// zeroBtn
//
this.zeroBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(144)))), ((int)(((byte)(98)))), ((int)(((byte)(222)))));
this.zeroBtn.Font = new System.Drawing.Font("宋体", 10F);
this.zeroBtn.ForeColor = System.Drawing.Color.White;
this.zeroBtn.Location = new System.Drawing.Point(173, 4);
this.zeroBtn.Name = "zeroBtn";
this.zeroBtn.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(158)))), ((int)(((byte)(234)))), ((int)(((byte)(106)))));
this.zeroBtn.Size = new System.Drawing.Size(90, 32);
this.zeroBtn.TabIndex = 37;
this.zeroBtn.Text = "归零";
this.zeroBtn.UseVisualStyleBackColor = false;
this.zeroBtn.Click += new System.EventHandler(this.zeroBtn_Click);
//
// roundPanel2
//
this.roundPanel2._setRoundRadius = 15;
this.roundPanel2.BackColor = System.Drawing.Color.Black;
this.roundPanel2.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.roundPanel2.Controls.Add(this.labelStable);
this.roundPanel2.Controls.Add(this.labelZero);
this.roundPanel2.Controls.Add(this.lblChengZhong);
this.roundPanel2.Location = new System.Drawing.Point(6, 3);
this.roundPanel2.Margin = new System.Windows.Forms.Padding(0);
this.roundPanel2.Name = "roundPanel2";
this.roundPanel2.Size = new System.Drawing.Size(162, 74);
this.roundPanel2.TabIndex = 36;
//
// labelStable
//
this.labelStable.AutoSize = true;
this.labelStable.BackColor = System.Drawing.Color.White;
this.labelStable.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.labelStable.Font = new System.Drawing.Font("微软雅黑", 9F);
this.labelStable.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.labelStable.Location = new System.Drawing.Point(119, 1);
this.labelStable.Name = "labelStable";
this.labelStable.Size = new System.Drawing.Size(17, 19);
this.labelStable.TabIndex = 13;
this.labelStable.Text = "S";
this.labelStable.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// labelZero
//
this.labelZero.AutoSize = true;
this.labelZero.BackColor = System.Drawing.Color.White;
this.labelZero.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.labelZero.Font = new System.Drawing.Font("微软雅黑", 9F);
this.labelZero.Location = new System.Drawing.Point(138, 1);
this.labelZero.Name = "labelZero";
this.labelZero.Size = new System.Drawing.Size(17, 19);
this.labelZero.TabIndex = 12;
this.labelZero.Text = "0";
this.labelZero.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// lblChengZhong
//
this.lblChengZhong.AutoSize = true;
this.lblChengZhong.Font = new System.Drawing.Font("宋体", 25F);
this.lblChengZhong.ForeColor = System.Drawing.Color.Red;
this.lblChengZhong.Location = new System.Drawing.Point(5, 19);
this.lblChengZhong.Margin = new System.Windows.Forms.Padding(0);
this.lblChengZhong.Name = "lblChengZhong";
this.lblChengZhong.Size = new System.Drawing.Size(83, 34);
this.lblChengZhong.TabIndex = 0;
this.lblChengZhong.Text = "0.00";
//
// logBtn
//
this.logBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.logBtn.BackColor = System.Drawing.Color.CadetBlue;
this.logBtn.Font = new System.Drawing.Font("宋体", 15F);
this.logBtn.ForeColor = System.Drawing.Color.White;
this.logBtn.Location = new System.Drawing.Point(680, 4);
this.logBtn.Name = "logBtn";
this.logBtn.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(158)))), ((int)(((byte)(234)))), ((int)(((byte)(106)))));
this.logBtn.Size = new System.Drawing.Size(101, 41);
this.logBtn.TabIndex = 25;
this.logBtn.Text = "日志";
this.logBtn.UseVisualStyleBackColor = false;
this.logBtn.Click += new System.EventHandler(this.logBtn_Click);
//
// closeBtn
//
this.closeBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.closeBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(25)))));
this.closeBtn.Font = new System.Drawing.Font("宋体", 15F);
this.closeBtn.ForeColor = System.Drawing.Color.White;
this.closeBtn.Location = new System.Drawing.Point(1109, 7);
this.closeBtn.Name = "closeBtn";
this.closeBtn.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(158)))), ((int)(((byte)(234)))), ((int)(((byte)(106)))));
this.closeBtn.Size = new System.Drawing.Size(111, 41);
this.closeBtn.TabIndex = 18;
this.closeBtn.Text = "关闭";
this.closeBtn.UseVisualStyleBackColor = false;
this.closeBtn.Click += new System.EventHandler(this.closeBtn_Click);
//
// goodsSetBtn
//
this.goodsSetBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.goodsSetBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(77)))), ((int)(((byte)(135)))), ((int)(((byte)(245)))));
this.goodsSetBtn.Font = new System.Drawing.Font("宋体", 15F);
this.goodsSetBtn.ForeColor = System.Drawing.Color.White;
this.goodsSetBtn.Location = new System.Drawing.Point(645, 3);
this.goodsSetBtn.Name = "goodsSetBtn";
this.goodsSetBtn.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(158)))), ((int)(((byte)(234)))), ((int)(((byte)(106)))));
this.goodsSetBtn.Size = new System.Drawing.Size(111, 62);
this.goodsSetBtn.TabIndex = 19;
this.goodsSetBtn.Text = "产品设置";
this.goodsSetBtn.UseVisualStyleBackColor = false;
this.goodsSetBtn.Click += new System.EventHandler(this.goodsSetBtn_Click);
//
// colorButton2
//
this.colorButton2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(192)))), ((int)(((byte)(192)))));
@ -552,43 +682,6 @@
this.rePrintBtn.Visible = false;
this.rePrintBtn.Click += new System.EventHandler(this.rePrintBtn_Click);
//
// groupBox1
//
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
this.groupBox1.Controls.Add(this.flowLayoutPanel4);
this.groupBox1.Controls.Add(this.flowLayoutPanel3);
this.groupBox1.Controls.Add(this.uLabel3);
this.groupBox1.Location = new System.Drawing.Point(8, 222);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Padding = new System.Windows.Forms.Padding(5);
this.groupBox1.Size = new System.Drawing.Size(447, 381);
this.groupBox1.TabIndex = 5;
this.groupBox1.TabStop = false;
//
// flowLayoutPanel4
//
this.flowLayoutPanel4.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.flowLayoutPanel4.AutoScroll = true;
this.flowLayoutPanel4.Location = new System.Drawing.Point(5, 90);
this.flowLayoutPanel4.Name = "flowLayoutPanel4";
this.flowLayoutPanel4.Size = new System.Drawing.Size(437, 286);
this.flowLayoutPanel4.TabIndex = 5;
//
// flowLayoutPanel3
//
this.flowLayoutPanel3.AutoScroll = true;
this.flowLayoutPanel3.BackColor = System.Drawing.Color.White;
this.flowLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Top;
this.flowLayoutPanel3.Location = new System.Drawing.Point(5, 19);
this.flowLayoutPanel3.Margin = new System.Windows.Forms.Padding(0);
this.flowLayoutPanel3.Name = "flowLayoutPanel3";
this.flowLayoutPanel3.Size = new System.Drawing.Size(437, 68);
this.flowLayoutPanel3.TabIndex = 4;
this.flowLayoutPanel3.WrapContents = false;
//
// SegmentProductionAutoForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
@ -599,6 +692,7 @@
this.Name = "SegmentProductionAutoForm";
this.Text = "分割品车间称重计数";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.Load += new System.EventHandler(this.SegmentProductionAutoForm_Load);
this.groupBox2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.taskDataGrid)).EndInit();
this.splitContainer1.Panel1.ResumeLayout(false);
@ -613,6 +707,8 @@
this.splitContainer2.ResumeLayout(false);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.roundPanel2.ResumeLayout(false);
this.roundPanel2.PerformLayout();
this.ResumeLayout(false);
}
@ -638,7 +734,6 @@
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel2;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
private Controls.WeightControl uWeightControl1;
private Controls.ColorButton rePrintBtn;
private Controls.ColorButton closeBtn;
private Controls.ColorButton goodsSetBtn;
@ -657,5 +752,13 @@
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel4;
private System.Windows.Forms.Label label3;
private WinFormControl.ULabel butcherDateBox;
private Controls.ColorButton weightSwitch;
private Controls.ColorButton zeroBtn;
private Controls.RoundPanel roundPanel2;
private System.Windows.Forms.Label lblChengZhong;
private System.Windows.Forms.Timer timer1;
private System.IO.Ports.SerialPort serialPort1;
private System.Windows.Forms.Label labelStable;
private System.Windows.Forms.Label labelZero;
}
}

+ 215
- 9
ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.cs View File

@ -17,7 +17,8 @@ using WinFormControl;
using ButcherFactory.Utils;
using NotAuto = ButcherFactory.SegmentProduction_;
using ButcherFactory.Controls;
using System.Runtime.InteropServices;
namespace ButcherFactory.SegmentProductionAuto_
{
public partial class SegmentProductionAutoForm : Form, IWithRoleForm
@ -84,6 +85,8 @@ namespace ButcherFactory.SegmentProductionAuto_
uploadData.Abort();
if (checkInStoreState != null && checkInStoreState.IsAlive)
checkInStoreState.Abort();
if (Utils.mPortOpened)
closePort();
}
public WeightDetails mCache;
@ -125,6 +128,7 @@ namespace ButcherFactory.SegmentProductionAuto_
_freshTotalCode = SegmentProductionBL.InitFreshTotalCode();
_stayTotalCode = SegmentProductionBL.InitStayTotalCode();
identityList = SegmentProductionBL.GetGoodsIdentify();
}
void LoadBind()
@ -233,7 +237,16 @@ namespace ButcherFactory.SegmentProductionAuto_
return;
}
}
var weight = uWeightControl1.Weight;
if (!status.StableStatus)
{
MessageBox.Show("称重稳定后再操作!");
return;
}
decimal weight = 0;
if (!decimal.TryParse(lblChengZhong.Text, out weight)) {
MessageBox.Show("重量错误,是否未归零!");
return;
}
//#if DEBUG
// if (weight == 0)
// weight = (g.StandardWeightLow ?? 4.0m) + 0.1m;
@ -332,13 +345,23 @@ namespace ButcherFactory.SegmentProductionAuto_
if (batchID == null)
throw new Exception("请先选择批次");
var btn = sender as ColorButton;
var detail = btn.Tag as ClientGoodsSet_Detail;
var weight = uWeightControl1.Weight;
//#if DEBUG
// if (weight == 0)
// weight = (detail.StandardWeightLow ?? 4.0m) + 0.1m;
//#endif
if (weight <= 0)
var detail = btn.Tag as ClientGoodsSet_Detail;
if (!status.StableStatus)
{
MessageBox.Show("称重稳定后再操作!");
return;
}
decimal weight = 0;
if (!decimal.TryParse(lblChengZhong.Text, out weight))
{
MessageBox.Show("重量错误,是否未归零!");
return;
}
//#if DEBUG
// if (weight == 0)
// weight = (detail.StandardWeightLow ?? 4.0m) + 0.1m;
//#endif
if (weight <= 0)
throw new Exception("重量必须大于0");
if (detail.StandardWeight.HasValue)
@ -1084,5 +1107,188 @@ namespace ButcherFactory.SegmentProductionAuto_
butcherDateBox.Text = butcherDate.ToString("yyyy-MM-dd");
}
}
WeightStatus status = new WeightStatus();
#region 称相关
private void init()
{
zeroBtn.Enabled = false;
// weightSwitch.Enabled = false;
System.Windows.Forms.Control.CheckForIllegalCrossThreadCalls = false;//忽略程序跨越线程运行导致的错误.没有此句将会产生错误
}
private void weightSwitch_Click(object sender, EventArgs e)
{
this.lblChengZhong.Text = "0.00";
if (Utils.mPortOpened)//关闭动作
{
if (CallLibrary.unbindScale() == 1)
{
Utils.mPortOpened = false; //串口打开标记
closePort();
}
}
else
{
if (!Utils.mPortOpened)
{
openPort();
}
}
weightSwitch.Text = Utils.mPortOpened ? "停止称重" : "启用称重";
}
#region 打开 关闭 串口
private void openPort()
{
try
{
int port = 3;
int baudrate = 9600;
if (CallLibrary.sendPort(port, baudrate) == 1)
{
Utils.mPortOpened = true; //串口打开标记
timer1.Enabled = true;
zeroBtn.Enabled = true;
//this.labelStatus.Text = Utils.rm.GetString("comOpen");
//Console.WriteLine("Open port Complete.");
}
else
{
Utils.mPortOpened = false; //串口打开标记
timer1.Enabled = false;
MessageBox.Show("串口打开失败");
// this.labelStatus.Text = Utils.rm.GetString("comFail");
// Console.WriteLine("Open port fail .");
}
}
catch (Exception ex)
{
MessageBox.Show("" + ex);
}
}
private void closePort()
{
timer1.Enabled = false;
Utils.mPortOpened = false;
// this.labelStatus.Text = Utils.rm.GetString("comClose");
this.zeroBtn.Enabled = false;
this.labelZero.BackColor = Color.White;
this.labelZero.ForeColor = Color.Black;
this.labelStable.BackColor = Color.White;
this.labelStable.ForeColor = Color.Black;
status.TareStatus = false;
}
#endregion
private void zeroBtn_Click(object sender, EventArgs e)
{
if (CallLibrary.SendZero() == 1)
{
//MessageBox.Show("Zero is successful");
// MessageBox.Show(Utils.rm.GetString("zeroIsOk"));
}
else
{
MessageBox.Show(Utils.rm.GetString("zeroisFail"));
}
}
#endregion
private void SegmentProductionAutoForm_Load(object sender, EventArgs e)
{
init();
}
#region 重量处理
string netWeight = string.Empty;
private void timer1_Tick(object sender, EventArgs e)
{
try
{
timer1.Interval = 100;
if (Utils.mPortOpened)
{
IntPtr stringNet = CallLibrary.getStringNet();
netWeight = Marshal.PtrToStringAnsi(stringNet); //重量
Console.WriteLine("weight data:" + netWeight);
weightNet(netWeight);
if (CallLibrary.isZero() != 1)
{
this.labelZero.BackColor = Color.White;
this.labelZero.ForeColor = Color.Black;
status.ZeroStatus = false;
}
else
{
this.labelZero.BackColor = Color.Green;
this.labelZero.ForeColor = Color.White;
status.ZeroStatus = true;
}
//稳定
if (CallLibrary.isStable() != 1)
{
this.labelStable.BackColor = Color.White;
this.labelStable.ForeColor = Color.Black;
status.StableStatus = false;
}
else
{
this.labelStable.BackColor = Color.Green;
this.labelStable.ForeColor = Color.White;
status.StableStatus = true;
}
if (CallLibrary.isTare() != 1)
{
status.TareStatus = false;
}
else
{
status.TareStatus = true;
}
}
else
{
this.lblChengZhong.Text = "0.00";
this.labelZero.BackColor = Color.White;
//this.labelStatus.BackColor = Color.White;
//this.labelStatus.ForeColor = Color.Black;
}
}
catch //(Exception ex)
{
//Console.WriteLine(ex);
}
}
private void weightNet(string netWeight)
{
if (netWeight != null)
{
if (!netWeight.Contains("--UL--") && !netWeight.Contains("--OL--"))
{
this.lblChengZhong.Text = double.Parse(netWeight).ToString("0.00");
}
else
{
if (netWeight.Contains("--UL--"))
{
this.lblChengZhong.Text = "--UL--";
}
else if (netWeight.Contains("--OL--"))
{
this.lblChengZhong.Text = "--OL--";
}
}
}
}
#endregion
}
}

+ 6
- 0
ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.resx View File

@ -120,4 +120,10 @@
<metadata name="T_Last.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>216, 16</value>
</metadata>
<metadata name="serialPort1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>306, 16</value>
</metadata>
</root>

+ 19
- 0
ButcherFactory.Form/SegmentProductionAuto_/Utils.cs View File

@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Resources;
using System.Text;
using System.Threading.Tasks;
namespace ButcherFactory.SegmentProductionAuto_
{
internal class Utils
{
public static bool mPortOpened = false; //串口状态
public static bool WFlag = true; //w1 & w2 状态显示
//配置文件位置
public static ResourceManager rm = new ResourceManager(typeof(SegmentProductionAutoForm)); //资源文件
}
}

+ 41
- 0
ButcherFactory.Form/SegmentProductionAuto_/WeightStatus.cs View File

@ -0,0 +1,41 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ButcherFactory.SegmentProductionAuto_
{
internal class WeightStatus
{
private bool isZero;
/// <summary>
/// 零点状态
/// </summary>
public bool ZeroStatus
{
get { return isZero; }
set { isZero = value; }
}
private bool isTare;
/// <summary>
/// 扣重状态
/// </summary>
public bool TareStatus
{
get { return isTare; }
set { isTare = value; }
}
private bool isStable;
/// <summary>
/// 稳定状态
/// </summary>
public bool StableStatus
{
get { return isStable; }
set { isStable = value; }
}
}
}

+ 2
- 2
ButcherFactory.Form/SegmentProduction_/SegmentProductionPrint.cs View File

@ -19,7 +19,7 @@ namespace ButcherFactory.SegmentProduction_
static string CustomerDefine = "GB/T9959.2-2008";
public static void Print(SegmentProduction entity, DateTime? dt, string template)
{
if (AppContext.ConnectInfo.TraceBackUrl == "default")
if (BO.Utils.AppContext.ConnectInfo.TraceBackUrl == "default")
throw new Exception("请先配置追溯服务器地址");
if (dt == null)
dt = DateTime.Today;
@ -42,7 +42,7 @@ namespace ButcherFactory.SegmentProduction_
code = code.Substring(17);
dic.Add("$Code", code);
var imgUrl = string.Format(IMGFILE, id);
var url = string.Format(AppContext.ConnectInfo.TraceBackUrl + "?code={0}", entity.BarCode);
var url = string.Format(BO.Utils.AppContext.ConnectInfo.TraceBackUrl + "?code={0}", entity.BarCode);
BwpClientPrint.BwpClientWebPrint.Create2DPic(url, imgUrl, 120);
dic.Add("$ImageUrl", imgUrl);
dic.Add("$Identity", entity.Identify);


+ 1
- 1
ButcherFactory.Form/SegmentProduction_/SegmentSumCodePrint.cs View File

@ -18,7 +18,7 @@ namespace ButcherFactory.SegmentProduction_
const string IMGFILE = @"TempImg\_sum_img{0}.png";
public static void Print(SegmentProduction[] entitys, string template)
{
if (AppContext.ConnectInfo.TraceBackUrl == "default")
if (BO.Utils.AppContext.ConnectInfo.TraceBackUrl == "default")
throw new Exception("请先配置追溯服务器地址");
var dic = new Dictionary<string, string>();


+ 1
- 1
ButcherFactory.Form/WeightCount_/WeightCountPrint.cs View File

@ -26,7 +26,7 @@ namespace ButcherFactory.WeightCount_
code = code.Substring(17);
dic.Add("$Code", code);
var imgUrl = string.Format(IMGFILE, id);
var url = string.Format(AppContext.ConnectInfo.TraceBackUrl + "?code={0}", entity.BarCode);
var url = string.Format(BO.Utils.AppContext.ConnectInfo.TraceBackUrl + "?code={0}", entity.BarCode);
BwpClientPrint.BwpClientWebPrint.Create2DPic(url, imgUrl, 120);
dic.Add("$ImageUrl", imgUrl);


+ 2
- 2
ButcherFactory.Login/App.xaml.cs View File

@ -100,9 +100,9 @@ namespace ButcherFactory.Login
{
try
{
if (!string.IsNullOrEmpty(AppContext.ConnectInfo.SqlConnection))
if (!string.IsNullOrEmpty(BO.Utils.AppContext.ConnectInfo.SqlConnection))
{
DbUtil.UpdateDatabase(AppContext.ConnectInfo.SqlConnection);
DbUtil.UpdateDatabase(BO.Utils.AppContext.ConnectInfo.SqlConnection);
}
}
catch


+ 5
- 2
ButcherFactory.Login/ButcherFactory.Login.csproj View File

@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ButcherFactory.Login</RootNamespace>
<AssemblyName>ButcherFactory.Login</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
@ -27,7 +27,7 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
@ -103,6 +103,9 @@
<Resource Include="images\setting.png" />
<Resource Include="images\update.png" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
</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.


+ 7
- 8
ButcherFactory.Login/Login.xaml.cs View File

@ -23,8 +23,8 @@ namespace ButcherFactory.Login
try
{
userNameInput.Text = AppContext.Worker.Name;
if (!string.IsNullOrEmpty(AppContext.Worker.Name))
userNameInput.Text = BO.Utils.AppContext.Worker.Name;
if (!string.IsNullOrEmpty(BO.Utils.AppContext.Worker.Name))
pwdInput.Focus();
}
catch { }
@ -38,11 +38,10 @@ namespace ButcherFactory.Login
private async void LoginBtn_Click(object sender, RoutedEventArgs e)
{
//new ButcherFactory.Form1().Show();
try
{
loginBtn.IsEnabled = false;
if (string.IsNullOrEmpty(AppContext.ConnectInfo.SqlConnection))
if (string.IsNullOrEmpty(BO.Utils.AppContext.ConnectInfo.SqlConnection))
throw new Exception("请设置数据库地址!");
var username = userNameInput.Text.Trim();
var pwd = pwdInput.Password;
@ -51,13 +50,13 @@ namespace ButcherFactory.Login
LoginUtil.InitRpcFacade();
if (LoginUtil.TestConnection(1000))
{
await Task.Factory.StartNew(() => LoginUtil.Login(username, pwd, AppContext.ConnectInfo.ServerMode));
await Task.Factory.StartNew(() => LoginUtil.Login(username, pwd, BO.Utils.AppContext.ConnectInfo.ServerMode));
}
else
{
if (AppContext.ConnectInfo.ServerMode == 1)
if (BO.Utils.AppContext.ConnectInfo.ServerMode == 1)
throw new Exception("网络错误");
if (AppContext.Worker.Name != username || string.Join("", LoginUtil.EncodePwd(pwd)) != string.Join("", AppContext.Worker.Password))
if (BO.Utils.AppContext.Worker.Name != username || string.Join("", LoginUtil.EncodePwd(pwd)) != string.Join("", BO.Utils.AppContext.Worker.Password))
throw new Exception("离线时只能使用上次登录信息登录");
}
@ -92,7 +91,7 @@ namespace ButcherFactory.Login
{
if (!LoginUtil.TestConnection(1000))
{
if (string.IsNullOrEmpty(AppContext.Worker.Name))
if (string.IsNullOrEmpty(BO.Utils.AppContext.Worker.Name))
throw new Exception("请检查网络");
throw new Exception("离线时无法切换用户");
}


+ 3
- 0
ButcherFactory.Login/app.config View File

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration>

+ 3
- 2
ButcherFactory.Tools/ButcherFactory.Tools.csproj View File

@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ButcherFactory.Tools</RootNamespace>
<AssemblyName>ButcherFactory.Tools</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
@ -27,7 +27,7 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
@ -91,6 +91,7 @@
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="app.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>


+ 14
- 14
ButcherFactory.Tools/MainWindow.xaml.cs View File

@ -28,21 +28,21 @@ namespace ButcherFactory.Tools
modeComboBox.Items.Add("B3");
try
{
modeComboBox.SelectedIndex = AppContext.ConnectInfo.ServerMode;
modeComboBox.SelectedIndex = BO.Utils.AppContext.ConnectInfo.ServerMode;
var list = XmlUtil.DeserializeFromFile<List<DbSelectEntity>>("Config\\DbSelectList.xml");
dbComboBox.SelectedValuePath = "Value";
dbComboBox.DisplayMemberPath = "Name";
dbComboBox.ItemsSource = list;
if (!string.IsNullOrEmpty(AppContext.ConnectInfo.SqlConnection))
if (!string.IsNullOrEmpty(BO.Utils.AppContext.ConnectInfo.SqlConnection))
{
var idx = list.FindIndex(x => x.Value == AppContext.ConnectInfo.SqlConnection);
var idx = list.FindIndex(x => x.Value == BO.Utils.AppContext.ConnectInfo.SqlConnection);
if (idx > -1)
dbComboBox.SelectedIndex = idx;
}
this.mesUrlBox.Text = AppContext.ConnectInfo.MESUrl;
this.b3UrlBox.Text = AppContext.ConnectInfo.B3Url;
this.clientCodeBox.Text = AppContext.ConnectInfo.ClientCode;
this.mesUrlBox.Text = BO.Utils.AppContext.ConnectInfo.MESUrl;
this.b3UrlBox.Text = BO.Utils.AppContext.ConnectInfo.B3Url;
this.clientCodeBox.Text = BO.Utils.AppContext.ConnectInfo.ClientCode;
}
catch (Exception ex)
{
@ -52,13 +52,13 @@ namespace ButcherFactory.Tools
private void Button_Click(object sender, RoutedEventArgs e)
{
if (string.IsNullOrEmpty(AppContext.ConnectInfo.SqlConnection))
if (string.IsNullOrEmpty(BO.Utils.AppContext.ConnectInfo.SqlConnection))
{
MessageBox.Show("请先设置数据库地址", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
}
try
{
DbUtil.UpdateDatabase(AppContext.ConnectInfo.SqlConnection);
DbUtil.UpdateDatabase(BO.Utils.AppContext.ConnectInfo.SqlConnection);
}
catch (Exception ex) {
MessageBox.Show(ex.Message);
@ -69,18 +69,18 @@ namespace ButcherFactory.Tools
private void SaveBtnClick(object sender, RoutedEventArgs e)
{
AppContext.ConnectInfo.MESUrl = this.mesUrlBox.Text.Trim();
AppContext.ConnectInfo.B3Url = this.b3UrlBox.Text.Trim();
AppContext.ConnectInfo.SqlConnection = (string)dbComboBox.SelectedValue;
AppContext.ConnectInfo.ServerMode = modeComboBox.SelectedIndex;
BO.Utils.AppContext.ConnectInfo.MESUrl = this.mesUrlBox.Text.Trim();
BO.Utils.AppContext.ConnectInfo.B3Url = this.b3UrlBox.Text.Trim();
BO.Utils.AppContext.ConnectInfo.SqlConnection = (string)dbComboBox.SelectedValue;
BO.Utils.AppContext.ConnectInfo.ServerMode = modeComboBox.SelectedIndex;
var code = this.clientCodeBox.Text.Trim();
if (!string.IsNullOrEmpty(code) && code.Length != 2)
{
MessageBox.Show("机器码长度必须为2位");
return;
}
AppContext.ConnectInfo.ClientCode = code;
AppContext.ConnectInfo.Save();
BO.Utils.AppContext.ConnectInfo.ClientCode = code;
BO.Utils.AppContext.ConnectInfo.Save();
MessageBox.Show("设置保存成功!");
}


+ 3
- 3
ButcherFactory.Tools/Properties/Resources.Designer.cs View File

@ -19,7 +19,7 @@ namespace ButcherFactory.Tools.Properties {
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
@ -47,8 +47,8 @@ namespace ButcherFactory.Tools.Properties {
}
/// <summary>
/// 使用此强类型资源类,为所有资源查找
/// 重写当前线程的 CurrentUICulture 属性
/// 重写当前线程的 CurrentUICulture 属性,对
/// 使用此强类型资源类的所有资源查找执行重写。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {


+ 3
- 0
ButcherFactory.Tools/app.config View File

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration>

Loading…
Cancel
Save