| @ -0,0 +1,34 @@ | |||||
| using Forks.EnterpriseServices.DomainObjects2; | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Linq; | |||||
| using System.Text; | |||||
| using System.Threading.Tasks; | |||||
| namespace ButcherFactory.BO.Bill | |||||
| { | |||||
| [MapToTable("Butcher_WeightCountEntity")] | |||||
| public class WeightCountEntity : SyncBill | |||||
| { | |||||
| public long? WorkUnit_ID { get; set; } | |||||
| public long? Store_ID { get; set; } | |||||
| public long? Goods_ID { get; set; } | |||||
| public long? ProductBatch_ID { get; set; } | |||||
| public decimal? Weight { get; set; } | |||||
| [DbColumn(DefaultValue = 1)] | |||||
| public int Number { get; set; } | |||||
| [ReferenceTo(typeof(Goods), "Name")] | |||||
| [Join("Goods_ID", "ID")] | |||||
| public string Goods_Name { get; set; } | |||||
| public bool Submited { get; set; } | |||||
| public bool ProduceOut { get; set; } | |||||
| } | |||||
| } | |||||
| @ -1,113 +1,115 @@ | |||||
| <?xml version="1.0" encoding="utf-8"?> | |||||
| <Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |||||
| <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | |||||
| <PropertyGroup> | |||||
| <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | |||||
| <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | |||||
| <ProjectGuid>{B258C523-269C-4ED7-AB71-7196D5D2EF65}</ProjectGuid> | |||||
| <OutputType>Library</OutputType> | |||||
| <AppDesignerFolder>Properties</AppDesignerFolder> | |||||
| <RootNamespace>ButcherFactory.BO</RootNamespace> | |||||
| <AssemblyName>ButcherFactory.BO</AssemblyName> | |||||
| <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> | |||||
| <FileAlignment>512</FileAlignment> | |||||
| </PropertyGroup> | |||||
| <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | |||||
| <DebugSymbols>true</DebugSymbols> | |||||
| <DebugType>full</DebugType> | |||||
| <Optimize>false</Optimize> | |||||
| <OutputPath>bin\Debug\</OutputPath> | |||||
| <DefineConstants>DEBUG;TRACE</DefineConstants> | |||||
| <ErrorReport>prompt</ErrorReport> | |||||
| <WarningLevel>4</WarningLevel> | |||||
| </PropertyGroup> | |||||
| <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | |||||
| <DebugType>pdbonly</DebugType> | |||||
| <Optimize>true</Optimize> | |||||
| <OutputPath>bin\Release\</OutputPath> | |||||
| <DefineConstants>TRACE</DefineConstants> | |||||
| <ErrorReport>prompt</ErrorReport> | |||||
| <WarningLevel>4</WarningLevel> | |||||
| </PropertyGroup> | |||||
| <ItemGroup> | |||||
| <Reference Include="Forks.EnterpriseServices, Version=3.1.0.0, Culture=neutral, PublicKeyToken=7254430f49d10aae, processorArchitecture=MSIL"> | |||||
| <SpecificVersion>False</SpecificVersion> | |||||
| <HintPath>..\..\..\tsref\Debug\Forks.EnterpriseServices.dll</HintPath> | |||||
| </Reference> | |||||
| <Reference Include="Forks.JsonRpc.Client, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7254430f49d10aae, processorArchitecture=MSIL"> | |||||
| <SpecificVersion>False</SpecificVersion> | |||||
| <HintPath>..\..\..\tsref\Debug\Forks.JsonRpc.Client.dll</HintPath> | |||||
| </Reference> | |||||
| <Reference Include="Forks.Utils, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7254430f49d10aae, processorArchitecture=MSIL"> | |||||
| <SpecificVersion>False</SpecificVersion> | |||||
| <HintPath>..\..\..\tsref\release\Forks.Utils.dll</HintPath> | |||||
| </Reference> | |||||
| <Reference Include="Newtonsoft.Json, Version=4.0.3.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> | |||||
| <SpecificVersion>False</SpecificVersion> | |||||
| <HintPath>..\..\..\tsref\Debug\Newtonsoft.Json.dll</HintPath> | |||||
| </Reference> | |||||
| <Reference Include="System" /> | |||||
| <Reference Include="System.Core" /> | |||||
| <Reference Include="System.Windows.Forms" /> | |||||
| <Reference Include="System.Xml.Linq" /> | |||||
| <Reference Include="System.Data.DataSetExtensions" /> | |||||
| <Reference Include="Microsoft.CSharp" /> | |||||
| <Reference Include="System.Data" /> | |||||
| <Reference Include="System.Xml" /> | |||||
| </ItemGroup> | |||||
| <ItemGroup> | |||||
| <Compile Include="BaseInfo\ClientGoodsSet.cs" /> | |||||
| <Compile Include="BaseInfo\Goods.cs" /> | |||||
| <Compile Include="BaseInfo\Store.cs" /> | |||||
| <Compile Include="Base\BaseInfo.cs" /> | |||||
| <Compile Include="BaseInfo\ProductBatch.cs" /> | |||||
| <Compile Include="Base\ExtensionObj.cs" /> | |||||
| <Compile Include="Bill\CarcassSaleOut_Delete.cs" /> | |||||
| <Compile Include="Bill\CarcassSaleOut_Detail.cs" /> | |||||
| <Compile Include="Bill\CarcassTakeOut.cs" /> | |||||
| <Compile Include="Bill\CarcassTakeOutWeightTemp.cs" /> | |||||
| <Compile Include="Bill\SegmentInStore.cs" /> | |||||
| <Compile Include="Bill\SegmentPickUp.cs" /> | |||||
| <Compile Include="Bill\SegmentProduction.cs" /> | |||||
| <Compile Include="Bill\SegmentSaleOut_Detail.cs" /> | |||||
| <Compile Include="Bill\StockUpEntity.cs" /> | |||||
| <Compile Include="Enums\ApplyClient.cs" /> | |||||
| <Compile Include="Enums\DriveType.cs" /> | |||||
| <Compile Include="Base\SyncBill.cs" /> | |||||
| <Compile Include="BaseInfo\WorkUnit.cs" /> | |||||
| <Compile Include="BaseInfo\Worker.cs" /> | |||||
| <Compile Include="Base\WorkerGoodsSetProfile.cs" /> | |||||
| <Compile Include="Bill\CarcassInStore.cs" /> | |||||
| <Compile Include="LocalBL\BaseInfoBL.cs" /> | |||||
| <Compile Include="LocalBL\BLUtil.cs" /> | |||||
| <Compile Include="LocalBL\CarcassInStoreBL.cs" /> | |||||
| <Compile Include="LocalBL\CarcassSaleOutBL.cs" /> | |||||
| <Compile Include="LocalBL\CarcassTakeOutBL.cs" /> | |||||
| <Compile Include="LocalBL\DialogBL.cs" /> | |||||
| <Compile Include="LocalBL\FormClientGoodsSetBL.cs" /> | |||||
| <Compile Include="LocalBL\SegmentInStoreBL.cs" /> | |||||
| <Compile Include="LocalBL\SegmentPickUpBL.cs" /> | |||||
| <Compile Include="LocalBL\SegmentProductionBL.cs" /> | |||||
| <Compile Include="LocalBL\SegmentSaleOutBL.cs" /> | |||||
| <Compile Include="LocalBL\SegmentStockUpBL.cs" /> | |||||
| <Compile Include="Properties\AssemblyInfo.cs" /> | |||||
| <Compile Include="Rpcs\BaseInfoSyncRpc.cs" /> | |||||
| <Compile Include="Utils\AppContext.cs" /> | |||||
| <Compile Include="Utils\ButcherFactoryUtil.cs" /> | |||||
| <Compile Include="Utils\ClientRpc.cs" /> | |||||
| <Compile Include="Utils\DbUtil.cs" /> | |||||
| <Compile Include="Utils\Extensions.cs" /> | |||||
| <Compile Include="Utils\FormUtil.cs" /> | |||||
| <Compile Include="Utils\LoginUtil.cs" /> | |||||
| <Compile Include="Utils\XmlUtil.cs" /> | |||||
| </ItemGroup> | |||||
| <ItemGroup /> | |||||
| <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | |||||
| <?xml version="1.0" encoding="utf-8"?> | |||||
| <Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |||||
| <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | |||||
| <PropertyGroup> | |||||
| <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | |||||
| <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | |||||
| <ProjectGuid>{B258C523-269C-4ED7-AB71-7196D5D2EF65}</ProjectGuid> | |||||
| <OutputType>Library</OutputType> | |||||
| <AppDesignerFolder>Properties</AppDesignerFolder> | |||||
| <RootNamespace>ButcherFactory.BO</RootNamespace> | |||||
| <AssemblyName>ButcherFactory.BO</AssemblyName> | |||||
| <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> | |||||
| <FileAlignment>512</FileAlignment> | |||||
| </PropertyGroup> | |||||
| <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | |||||
| <DebugSymbols>true</DebugSymbols> | |||||
| <DebugType>full</DebugType> | |||||
| <Optimize>false</Optimize> | |||||
| <OutputPath>bin\Debug\</OutputPath> | |||||
| <DefineConstants>DEBUG;TRACE</DefineConstants> | |||||
| <ErrorReport>prompt</ErrorReport> | |||||
| <WarningLevel>4</WarningLevel> | |||||
| </PropertyGroup> | |||||
| <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | |||||
| <DebugType>pdbonly</DebugType> | |||||
| <Optimize>true</Optimize> | |||||
| <OutputPath>bin\Release\</OutputPath> | |||||
| <DefineConstants>TRACE</DefineConstants> | |||||
| <ErrorReport>prompt</ErrorReport> | |||||
| <WarningLevel>4</WarningLevel> | |||||
| </PropertyGroup> | |||||
| <ItemGroup> | |||||
| <Reference Include="Forks.EnterpriseServices, Version=3.1.0.0, Culture=neutral, PublicKeyToken=7254430f49d10aae, processorArchitecture=MSIL"> | |||||
| <SpecificVersion>False</SpecificVersion> | |||||
| <HintPath>..\..\..\tsref\Debug\Forks.EnterpriseServices.dll</HintPath> | |||||
| </Reference> | |||||
| <Reference Include="Forks.JsonRpc.Client, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7254430f49d10aae, processorArchitecture=MSIL"> | |||||
| <SpecificVersion>False</SpecificVersion> | |||||
| <HintPath>..\..\..\tsref\Debug\Forks.JsonRpc.Client.dll</HintPath> | |||||
| </Reference> | |||||
| <Reference Include="Forks.Utils, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7254430f49d10aae, processorArchitecture=MSIL"> | |||||
| <SpecificVersion>False</SpecificVersion> | |||||
| <HintPath>..\..\..\tsref\release\Forks.Utils.dll</HintPath> | |||||
| </Reference> | |||||
| <Reference Include="Newtonsoft.Json, Version=4.0.3.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> | |||||
| <SpecificVersion>False</SpecificVersion> | |||||
| <HintPath>..\..\..\tsref\Debug\Newtonsoft.Json.dll</HintPath> | |||||
| </Reference> | |||||
| <Reference Include="System" /> | |||||
| <Reference Include="System.Core" /> | |||||
| <Reference Include="System.Windows.Forms" /> | |||||
| <Reference Include="System.Xml.Linq" /> | |||||
| <Reference Include="System.Data.DataSetExtensions" /> | |||||
| <Reference Include="Microsoft.CSharp" /> | |||||
| <Reference Include="System.Data" /> | |||||
| <Reference Include="System.Xml" /> | |||||
| </ItemGroup> | |||||
| <ItemGroup> | |||||
| <Compile Include="BaseInfo\ClientGoodsSet.cs" /> | |||||
| <Compile Include="BaseInfo\Goods.cs" /> | |||||
| <Compile Include="BaseInfo\Store.cs" /> | |||||
| <Compile Include="Base\BaseInfo.cs" /> | |||||
| <Compile Include="BaseInfo\ProductBatch.cs" /> | |||||
| <Compile Include="Base\ExtensionObj.cs" /> | |||||
| <Compile Include="Bill\CarcassSaleOut_Delete.cs" /> | |||||
| <Compile Include="Bill\CarcassSaleOut_Detail.cs" /> | |||||
| <Compile Include="Bill\CarcassTakeOut.cs" /> | |||||
| <Compile Include="Bill\CarcassTakeOutWeightTemp.cs" /> | |||||
| <Compile Include="Bill\SegmentInStore.cs" /> | |||||
| <Compile Include="Bill\SegmentPickUp.cs" /> | |||||
| <Compile Include="Bill\SegmentProduction.cs" /> | |||||
| <Compile Include="Bill\SegmentSaleOut_Detail.cs" /> | |||||
| <Compile Include="Bill\StockUpEntity.cs" /> | |||||
| <Compile Include="Bill\WeightCountEntity.cs" /> | |||||
| <Compile Include="Enums\ApplyClient.cs" /> | |||||
| <Compile Include="Enums\DriveType.cs" /> | |||||
| <Compile Include="Base\SyncBill.cs" /> | |||||
| <Compile Include="BaseInfo\WorkUnit.cs" /> | |||||
| <Compile Include="BaseInfo\Worker.cs" /> | |||||
| <Compile Include="Base\WorkerGoodsSetProfile.cs" /> | |||||
| <Compile Include="Bill\CarcassInStore.cs" /> | |||||
| <Compile Include="LocalBL\BaseInfoBL.cs" /> | |||||
| <Compile Include="LocalBL\BLUtil.cs" /> | |||||
| <Compile Include="LocalBL\CarcassInStoreBL.cs" /> | |||||
| <Compile Include="LocalBL\CarcassSaleOutBL.cs" /> | |||||
| <Compile Include="LocalBL\CarcassTakeOutBL.cs" /> | |||||
| <Compile Include="LocalBL\DialogBL.cs" /> | |||||
| <Compile Include="LocalBL\FormClientGoodsSetBL.cs" /> | |||||
| <Compile Include="LocalBL\SegmentInStoreBL.cs" /> | |||||
| <Compile Include="LocalBL\SegmentPickUpBL.cs" /> | |||||
| <Compile Include="LocalBL\SegmentProductionBL.cs" /> | |||||
| <Compile Include="LocalBL\SegmentSaleOutBL.cs" /> | |||||
| <Compile Include="LocalBL\SegmentStockUpBL.cs" /> | |||||
| <Compile Include="LocalBL\WeightCountEntityBL.cs" /> | |||||
| <Compile Include="Properties\AssemblyInfo.cs" /> | |||||
| <Compile Include="Rpcs\BaseInfoSyncRpc.cs" /> | |||||
| <Compile Include="Utils\AppContext.cs" /> | |||||
| <Compile Include="Utils\ButcherFactoryUtil.cs" /> | |||||
| <Compile Include="Utils\ClientRpc.cs" /> | |||||
| <Compile Include="Utils\DbUtil.cs" /> | |||||
| <Compile Include="Utils\Extensions.cs" /> | |||||
| <Compile Include="Utils\FormUtil.cs" /> | |||||
| <Compile Include="Utils\LoginUtil.cs" /> | |||||
| <Compile Include="Utils\XmlUtil.cs" /> | |||||
| </ItemGroup> | |||||
| <ItemGroup /> | |||||
| <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | |||||
| <!-- To modify your build process, add your task inside one of the targets below and uncomment it. | <!-- 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. | Other similar extension points exist, see Microsoft.Common.targets. | ||||
| <Target Name="BeforeBuild"> | <Target Name="BeforeBuild"> | ||||
| </Target> | </Target> | ||||
| <Target Name="AfterBuild"> | <Target Name="AfterBuild"> | ||||
| </Target> | </Target> | ||||
| --> | |||||
| --> | |||||
| </Project> | </Project> | ||||
| @ -0,0 +1,159 @@ | |||||
| using ButcherFactory.BO.Bill; | |||||
| using ButcherFactory.BO.Utils; | |||||
| using Forks.EnterpriseServices.DomainObjects2; | |||||
| using Forks.EnterpriseServices.DomainObjects2.DQuery; | |||||
| using Forks.EnterpriseServices.SqlDoms; | |||||
| using Forks.JsonRpc.Client; | |||||
| using Newtonsoft.Json; | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.ComponentModel; | |||||
| using System.Linq; | |||||
| using System.Text; | |||||
| using System.Threading.Tasks; | |||||
| namespace ButcherFactory.BO.LocalBL | |||||
| { | |||||
| public static class WeightCountEntityBL | |||||
| { | |||||
| const string RpcPath = @"/MainSystem/B3ClientService/Rpcs/WeightCountEntityRpc/"; | |||||
| public static BindingList<WeightCountEntity> GetWeightCountEntity(bool produce, bool submited) | |||||
| { | |||||
| var query = new DQueryDom(new JoinAlias(typeof(WeightCountEntity))); | |||||
| query.Columns.Add(DQSelectColumn.Field("ID")); | |||||
| query.Columns.Add(DQSelectColumn.Field("RowIndex")); | |||||
| query.Columns.Add(DQSelectColumn.Field("Goods_Name")); | |||||
| query.Columns.Add(DQSelectColumn.Field("Number")); | |||||
| query.Columns.Add(DQSelectColumn.Field("Weight")); | |||||
| //query.Columns.Add(DQSelectColumn.Field("CreateTime")); | |||||
| query.OrderBy.Expressions.Add(DQOrderByExpression.Create("ID", true)); | |||||
| query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("ProduceOut", produce), DQCondition.EQ("Submited", submited))); | |||||
| if (submited) | |||||
| { | |||||
| query.Where.Conditions.Add(DQCondition.And(DQCondition.Between("CreateTime", DateTime.Today, DateTime.Today + new TimeSpan(23, 59, 59)))); | |||||
| query.Range = SelectRange.Top(20); | |||||
| } | |||||
| var list = new BindingList<WeightCountEntity>(); | |||||
| using (var session = DmoSession.New()) | |||||
| { | |||||
| using (var reader = session.ExecuteReader(query)) | |||||
| { | |||||
| while (reader.Read()) | |||||
| { | |||||
| var entity = new WeightCountEntity(); | |||||
| entity.ID = (long)reader[0]; | |||||
| entity.RowIndex = (int)reader[1]; | |||||
| entity.Goods_Name = (string)reader[2]; | |||||
| entity.Number = (int)reader[3]; | |||||
| entity.Weight = (decimal?)reader[4]; | |||||
| //entity.CreateTime = (DateTime)reader[5]; | |||||
| list.Add(entity); | |||||
| } | |||||
| } | |||||
| } | |||||
| return list; | |||||
| } | |||||
| public static void InsertEntityByWeight(WeightCountEntity entity) | |||||
| { | |||||
| using (var session = DmoSession.New()) | |||||
| { | |||||
| entity.Number = 1; | |||||
| entity.UserID = AppContext.Worker.ID; | |||||
| session.Insert(entity); | |||||
| session.Commit(); | |||||
| } | |||||
| } | |||||
| public static void UpdateNumber(long id, int number) | |||||
| { | |||||
| var update = new DQUpdateDom(typeof(WeightCountEntity)); | |||||
| update.Where.Conditions.Add(DQCondition.EQ("ID", id)); | |||||
| update.Columns.Add(new DQUpdateColumn("Number", number)); | |||||
| update.EExecute(); | |||||
| } | |||||
| public static void UpdateSubmit(IEnumerable<long> ids) | |||||
| { | |||||
| var update = new DQUpdateDom(typeof(WeightCountEntity)); | |||||
| update.Where.Conditions.Add(DQCondition.InList(DQExpression.Field("ID"), ids.Select(x => DQExpression.Value(x)).ToArray())); | |||||
| update.Columns.Add(new DQUpdateColumn("Submited", true)); | |||||
| update.EExecute(); | |||||
| } | |||||
| public static void Upload() | |||||
| { | |||||
| try | |||||
| { | |||||
| using (var session = DmoSession.New()) | |||||
| { | |||||
| var needUpload = GetUnSyncData(session); | |||||
| if (needUpload.Count == 0) | |||||
| return; | |||||
| var method = RpcPath + "Upload"; | |||||
| var json = JsonConvert.SerializeObject(needUpload); | |||||
| RpcFacade.Call<int>(method, json); | |||||
| foreach (var item in needUpload) | |||||
| SetLocalAsSyncd(item, session); | |||||
| session.Commit(); | |||||
| } | |||||
| } | |||||
| catch | |||||
| { | |||||
| #if DEBUG | |||||
| throw; | |||||
| #endif | |||||
| } | |||||
| } | |||||
| static List<WeightCountEntity> GetUnSyncData(IDmoSession session) | |||||
| { | |||||
| var query = new DQueryDom(new JoinAlias(typeof(WeightCountEntity))); | |||||
| query.Columns.Add(DQSelectColumn.Field("ID")); | |||||
| query.Columns.Add(DQSelectColumn.Field("RowVersion")); | |||||
| query.Columns.Add(DQSelectColumn.Field("UserID")); | |||||
| query.Columns.Add(DQSelectColumn.Field("WorkUnit_ID")); | |||||
| query.Columns.Add(DQSelectColumn.Field("ProductBatch_ID")); | |||||
| query.Columns.Add(DQSelectColumn.Field("Goods_ID")); | |||||
| query.Columns.Add(DQSelectColumn.Field("Weight")); | |||||
| query.Columns.Add(DQSelectColumn.Field("CreateTime")); | |||||
| query.Columns.Add(DQSelectColumn.Field("Number")); | |||||
| query.Columns.Add(DQSelectColumn.Field("Store_ID")); | |||||
| query.Columns.Add(DQSelectColumn.Field("ProduceOut")); | |||||
| query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("Submited", true), DQCondition.EQ("Sync", false))); | |||||
| query.Range = SelectRange.Top(10); | |||||
| query.OrderBy.Expressions.Add(DQOrderByExpression.Create("ID")); | |||||
| var upload = new List<WeightCountEntity>(); | |||||
| using (var reader = session.ExecuteReader(query)) | |||||
| { | |||||
| while (reader.Read()) | |||||
| { | |||||
| var obj = new WeightCountEntity(); | |||||
| obj.ID = (long)reader[0]; | |||||
| obj.RowVersion = (int)reader[1]; | |||||
| obj.UserID = (long)reader[2]; | |||||
| obj.WorkUnit_ID = (long?)reader[4]; | |||||
| obj.ProductBatch_ID = (long?)reader[4]; | |||||
| obj.Goods_ID = (long?)reader[5]; | |||||
| obj.Weight = (decimal?)reader[6]; | |||||
| obj.CreateTime = (DateTime)reader[7]; | |||||
| obj.Number = (int)reader[8]; | |||||
| obj.Store_ID = (long?)reader[9]; | |||||
| obj.ProduceOut = (bool)reader[10]; | |||||
| upload.Add(obj); | |||||
| } | |||||
| } | |||||
| return upload; | |||||
| } | |||||
| static void SetLocalAsSyncd(WeightCountEntity obj, IDmoSession session) | |||||
| { | |||||
| var update = new DQUpdateDom(typeof(WeightCountEntity)); | |||||
| update.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("ID", obj.ID), DQCondition.EQ("RowVersion", obj.RowVersion))); | |||||
| update.Columns.Add(new DQUpdateColumn("Sync", true)); | |||||
| session.ExecuteNonQuery(update); | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,18 @@ | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Linq; | |||||
| using System.Text; | |||||
| using System.Threading.Tasks; | |||||
| namespace ButcherFactory.WeightCount_ | |||||
| { | |||||
| public class WeightCountConfig | |||||
| { | |||||
| public long? WorkUnitID { get; set; } | |||||
| public long? Store_ID { get; set; } | |||||
| private bool mProduceOut = true; | |||||
| public bool ProduceOut { get { return mProduceOut; } set { mProduceOut = value; } } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,601 @@ | |||||
| namespace ButcherFactory.WeightCount_ | |||||
| { | |||||
| partial class WeightCountForm | |||||
| { | |||||
| /// <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() | |||||
| { | |||||
| System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle17 = new System.Windows.Forms.DataGridViewCellStyle(); | |||||
| System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle18 = new System.Windows.Forms.DataGridViewCellStyle(); | |||||
| System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle19 = new System.Windows.Forms.DataGridViewCellStyle(); | |||||
| System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle20 = new System.Windows.Forms.DataGridViewCellStyle(); | |||||
| System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(WeightCountForm)); | |||||
| System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle21 = new System.Windows.Forms.DataGridViewCellStyle(); | |||||
| System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle22 = new System.Windows.Forms.DataGridViewCellStyle(); | |||||
| System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle24 = new System.Windows.Forms.DataGridViewCellStyle(); | |||||
| System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle23 = new System.Windows.Forms.DataGridViewCellStyle(); | |||||
| this.H_Weight = new System.Windows.Forms.DataGridViewTextBoxColumn(); | |||||
| this.H_Goods_Name = new System.Windows.Forms.DataGridViewTextBoxColumn(); | |||||
| this.H_RowIndex = new System.Windows.Forms.DataGridViewTextBoxColumn(); | |||||
| this.H_ID = new System.Windows.Forms.DataGridViewTextBoxColumn(); | |||||
| this.historyDataGrid = new WinFormControl.UDataGridView(); | |||||
| this.H_Number = new System.Windows.Forms.DataGridViewTextBoxColumn(); | |||||
| this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); | |||||
| this.groupBox2 = new System.Windows.Forms.GroupBox(); | |||||
| this.uLabel4 = new WinFormControl.ULabel(); | |||||
| this.storeSelect = new System.Windows.Forms.ComboBox(); | |||||
| this.uLabel5 = new WinFormControl.ULabel(); | |||||
| this.splitContainer1 = new System.Windows.Forms.SplitContainer(); | |||||
| this.typeBtn = new WinFormControl.UButton(); | |||||
| this.uLabel6 = new WinFormControl.ULabel(); | |||||
| this.numSetBtn = new WinFormControl.UButton(); | |||||
| this.productBatchSelect = new System.Windows.Forms.ComboBox(); | |||||
| this.uLabel2 = new WinFormControl.ULabel(); | |||||
| this.closeBtn = new WinFormControl.UButton(); | |||||
| this.uTimerLabel1 = new WinFormControl.UTimerLabel(); | |||||
| this.workUnitSelect = new System.Windows.Forms.ComboBox(); | |||||
| this.netStateWatch1 = new WinFormControl.NetStateWatch(); | |||||
| this.uWeightControl1 = new WinFormControl.UWeightControl(); | |||||
| this.uLabel1 = new WinFormControl.ULabel(); | |||||
| this.groupBox1 = new System.Windows.Forms.GroupBox(); | |||||
| this.needSubmitGrid = new WinFormControl.UDataGridView(); | |||||
| this.U_ID = new System.Windows.Forms.DataGridViewTextBoxColumn(); | |||||
| this.U_RowIndex = new System.Windows.Forms.DataGridViewTextBoxColumn(); | |||||
| this.U_Goods_Name = new System.Windows.Forms.DataGridViewTextBoxColumn(); | |||||
| this.U_Number = new System.Windows.Forms.DataGridViewTextBoxColumn(); | |||||
| this.U_Weight = new System.Windows.Forms.DataGridViewTextBoxColumn(); | |||||
| this.numFlowPanel = new System.Windows.Forms.FlowLayoutPanel(); | |||||
| this.submitBtn = new WinFormControl.UButton(); | |||||
| this.uLabel3 = new WinFormControl.ULabel(); | |||||
| ((System.ComponentModel.ISupportInitialize)(this.historyDataGrid)).BeginInit(); | |||||
| this.groupBox2.SuspendLayout(); | |||||
| ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); | |||||
| this.splitContainer1.Panel1.SuspendLayout(); | |||||
| this.splitContainer1.Panel2.SuspendLayout(); | |||||
| this.splitContainer1.SuspendLayout(); | |||||
| this.groupBox1.SuspendLayout(); | |||||
| ((System.ComponentModel.ISupportInitialize)(this.needSubmitGrid)).BeginInit(); | |||||
| this.SuspendLayout(); | |||||
| // | |||||
| // H_Weight | |||||
| // | |||||
| this.H_Weight.DataPropertyName = "Weight"; | |||||
| dataGridViewCellStyle17.Format = "#0.######"; | |||||
| this.H_Weight.DefaultCellStyle = dataGridViewCellStyle17; | |||||
| this.H_Weight.HeaderText = "重量"; | |||||
| this.H_Weight.Name = "H_Weight"; | |||||
| this.H_Weight.ReadOnly = true; | |||||
| // | |||||
| // H_Goods_Name | |||||
| // | |||||
| this.H_Goods_Name.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; | |||||
| this.H_Goods_Name.DataPropertyName = "Goods_Name"; | |||||
| this.H_Goods_Name.HeaderText = "产品名称"; | |||||
| this.H_Goods_Name.Name = "H_Goods_Name"; | |||||
| this.H_Goods_Name.ReadOnly = true; | |||||
| // | |||||
| // H_RowIndex | |||||
| // | |||||
| this.H_RowIndex.DataPropertyName = "RowIndex"; | |||||
| this.H_RowIndex.HeaderText = "序号"; | |||||
| this.H_RowIndex.Name = "H_RowIndex"; | |||||
| this.H_RowIndex.ReadOnly = true; | |||||
| // | |||||
| // H_ID | |||||
| // | |||||
| this.H_ID.DataPropertyName = "ID"; | |||||
| this.H_ID.HeaderText = "ID"; | |||||
| this.H_ID.Name = "H_ID"; | |||||
| this.H_ID.ReadOnly = true; | |||||
| this.H_ID.Visible = false; | |||||
| // | |||||
| // historyDataGrid | |||||
| // | |||||
| this.historyDataGrid.AllowUserToAddRows = false; | |||||
| this.historyDataGrid.AllowUserToDeleteRows = false; | |||||
| this.historyDataGrid.AllowUserToResizeColumns = false; | |||||
| this.historyDataGrid.AllowUserToResizeRows = false; | |||||
| dataGridViewCellStyle18.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); | |||||
| this.historyDataGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle18; | |||||
| this.historyDataGrid.BackgroundColor = System.Drawing.Color.White; | |||||
| this.historyDataGrid.BorderStyle = System.Windows.Forms.BorderStyle.None; | |||||
| dataGridViewCellStyle19.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; | |||||
| dataGridViewCellStyle19.Font = new System.Drawing.Font("宋体", 12F); | |||||
| dataGridViewCellStyle19.ForeColor = System.Drawing.Color.White; | |||||
| dataGridViewCellStyle19.WrapMode = System.Windows.Forms.DataGridViewTriState.True; | |||||
| this.historyDataGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle19; | |||||
| this.historyDataGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; | |||||
| this.historyDataGrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { | |||||
| this.H_ID, | |||||
| this.H_RowIndex, | |||||
| this.H_Goods_Name, | |||||
| this.H_Number, | |||||
| this.H_Weight}); | |||||
| this.historyDataGrid.Dock = System.Windows.Forms.DockStyle.Fill; | |||||
| this.historyDataGrid.Location = new System.Drawing.Point(5, 19); | |||||
| this.historyDataGrid.MultiSelect = false; | |||||
| this.historyDataGrid.Name = "historyDataGrid"; | |||||
| this.historyDataGrid.ReadOnly = true; | |||||
| this.historyDataGrid.RowHeadersVisible = false; | |||||
| dataGridViewCellStyle20.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); | |||||
| dataGridViewCellStyle20.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218))))); | |||||
| this.historyDataGrid.RowsDefaultCellStyle = dataGridViewCellStyle20; | |||||
| this.historyDataGrid.RowTemplate.Height = 23; | |||||
| this.historyDataGrid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; | |||||
| this.historyDataGrid.Size = new System.Drawing.Size(590, 158); | |||||
| this.historyDataGrid.TabIndex = 2; | |||||
| // | |||||
| // H_Number | |||||
| // | |||||
| this.H_Number.DataPropertyName = "Number"; | |||||
| this.H_Number.HeaderText = "数量"; | |||||
| this.H_Number.Name = "H_Number"; | |||||
| this.H_Number.ReadOnly = true; | |||||
| // | |||||
| // flowLayoutPanel1 | |||||
| // | |||||
| this.flowLayoutPanel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | |||||
| | System.Windows.Forms.AnchorStyles.Right))); | |||||
| this.flowLayoutPanel1.AutoScroll = true; | |||||
| this.flowLayoutPanel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; | |||||
| this.flowLayoutPanel1.Location = new System.Drawing.Point(627, -1); | |||||
| this.flowLayoutPanel1.Name = "flowLayoutPanel1"; | |||||
| this.flowLayoutPanel1.Size = new System.Drawing.Size(680, 521); | |||||
| this.flowLayoutPanel1.TabIndex = 4; | |||||
| // | |||||
| // groupBox2 | |||||
| // | |||||
| this.groupBox2.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.groupBox2.Controls.Add(this.historyDataGrid); | |||||
| this.groupBox2.Controls.Add(this.uLabel4); | |||||
| this.groupBox2.Location = new System.Drawing.Point(11, 324); | |||||
| this.groupBox2.Name = "groupBox2"; | |||||
| this.groupBox2.Padding = new System.Windows.Forms.Padding(5); | |||||
| this.groupBox2.Size = new System.Drawing.Size(600, 182); | |||||
| this.groupBox2.TabIndex = 3; | |||||
| this.groupBox2.TabStop = false; | |||||
| // | |||||
| // uLabel4 | |||||
| // | |||||
| this.uLabel4.AutoSize = true; | |||||
| this.uLabel4.BackColor = System.Drawing.Color.White; | |||||
| this.uLabel4.Font = new System.Drawing.Font("宋体", 13F); | |||||
| this.uLabel4.Location = new System.Drawing.Point(8, -1); | |||||
| this.uLabel4.Name = "uLabel4"; | |||||
| this.uLabel4.Size = new System.Drawing.Size(80, 18); | |||||
| this.uLabel4.TabIndex = 1; | |||||
| this.uLabel4.Text = "历史领料"; | |||||
| // | |||||
| // storeSelect | |||||
| // | |||||
| this.storeSelect.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); | |||||
| this.storeSelect.Font = new System.Drawing.Font("宋体", 15F); | |||||
| this.storeSelect.FormattingEnabled = true; | |||||
| this.storeSelect.Location = new System.Drawing.Point(696, 11); | |||||
| this.storeSelect.Name = "storeSelect"; | |||||
| this.storeSelect.Size = new System.Drawing.Size(170, 28); | |||||
| this.storeSelect.TabIndex = 23; | |||||
| // | |||||
| // uLabel5 | |||||
| // | |||||
| this.uLabel5.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); | |||||
| this.uLabel5.AutoSize = true; | |||||
| this.uLabel5.BackColor = System.Drawing.Color.Transparent; | |||||
| this.uLabel5.Font = new System.Drawing.Font("宋体", 15F); | |||||
| this.uLabel5.Location = new System.Drawing.Point(595, 14); | |||||
| this.uLabel5.Name = "uLabel5"; | |||||
| this.uLabel5.Size = new System.Drawing.Size(109, 20); | |||||
| this.uLabel5.TabIndex = 22; | |||||
| this.uLabel5.Text = "入库仓库:"; | |||||
| // | |||||
| // splitContainer1 | |||||
| // | |||||
| this.splitContainer1.BackColor = System.Drawing.Color.Transparent; | |||||
| this.splitContainer1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; | |||||
| this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; | |||||
| this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1; | |||||
| this.splitContainer1.IsSplitterFixed = true; | |||||
| this.splitContainer1.Location = new System.Drawing.Point(0, 0); | |||||
| this.splitContainer1.Name = "splitContainer1"; | |||||
| this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal; | |||||
| // | |||||
| // splitContainer1.Panel1 | |||||
| // | |||||
| this.splitContainer1.Panel1.BackColor = System.Drawing.Color.Transparent; | |||||
| this.splitContainer1.Panel1.Controls.Add(this.typeBtn); | |||||
| this.splitContainer1.Panel1.Controls.Add(this.uLabel6); | |||||
| this.splitContainer1.Panel1.Controls.Add(this.storeSelect); | |||||
| this.splitContainer1.Panel1.Controls.Add(this.uLabel5); | |||||
| this.splitContainer1.Panel1.Controls.Add(this.numSetBtn); | |||||
| this.splitContainer1.Panel1.Controls.Add(this.productBatchSelect); | |||||
| this.splitContainer1.Panel1.Controls.Add(this.uLabel2); | |||||
| this.splitContainer1.Panel1.Controls.Add(this.closeBtn); | |||||
| this.splitContainer1.Panel1.Controls.Add(this.uTimerLabel1); | |||||
| this.splitContainer1.Panel1.Controls.Add(this.workUnitSelect); | |||||
| this.splitContainer1.Panel1.Controls.Add(this.netStateWatch1); | |||||
| this.splitContainer1.Panel1.Controls.Add(this.uWeightControl1); | |||||
| this.splitContainer1.Panel1.Controls.Add(this.uLabel1); | |||||
| // | |||||
| // splitContainer1.Panel2 | |||||
| // | |||||
| this.splitContainer1.Panel2.Controls.Add(this.flowLayoutPanel1); | |||||
| this.splitContainer1.Panel2.Controls.Add(this.groupBox2); | |||||
| this.splitContainer1.Panel2.Controls.Add(this.groupBox1); | |||||
| this.splitContainer1.Size = new System.Drawing.Size(1305, 611); | |||||
| this.splitContainer1.SplitterDistance = 86; | |||||
| this.splitContainer1.TabIndex = 3; | |||||
| // | |||||
| // typeBtn | |||||
| // | |||||
| this.typeBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); | |||||
| this.typeBtn.AsClicked = false; | |||||
| this.typeBtn.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("typeBtn.BackgroundImage"))); | |||||
| this.typeBtn.EnableGroup = false; | |||||
| this.typeBtn.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(45)))), ((int)(((byte)(155)))), ((int)(((byte)(214))))); | |||||
| this.typeBtn.FlatAppearance.BorderSize = 0; | |||||
| this.typeBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat; | |||||
| this.typeBtn.Font = new System.Drawing.Font("宋体", 15F); | |||||
| this.typeBtn.ForeColor = System.Drawing.Color.Black; | |||||
| this.typeBtn.Location = new System.Drawing.Point(696, 46); | |||||
| this.typeBtn.Name = "typeBtn"; | |||||
| this.typeBtn.PlaySound = false; | |||||
| this.typeBtn.SelfControlEnable = false; | |||||
| this.typeBtn.Size = new System.Drawing.Size(111, 34); | |||||
| this.typeBtn.SoundType = WinFormControl.SoundType.Click; | |||||
| this.typeBtn.TabIndex = 25; | |||||
| this.typeBtn.UseVisualStyleBackColor = true; | |||||
| this.typeBtn.WithStataHode = false; | |||||
| this.typeBtn.Click += new System.EventHandler(this.typeBtn_Click); | |||||
| // | |||||
| // uLabel6 | |||||
| // | |||||
| this.uLabel6.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); | |||||
| this.uLabel6.AutoSize = true; | |||||
| this.uLabel6.BackColor = System.Drawing.Color.Transparent; | |||||
| this.uLabel6.Font = new System.Drawing.Font("宋体", 15F); | |||||
| this.uLabel6.Location = new System.Drawing.Point(595, 53); | |||||
| this.uLabel6.Name = "uLabel6"; | |||||
| this.uLabel6.Size = new System.Drawing.Size(109, 20); | |||||
| this.uLabel6.TabIndex = 24; | |||||
| this.uLabel6.Text = "当前操作:"; | |||||
| // | |||||
| // numSetBtn | |||||
| // | |||||
| this.numSetBtn.AsClicked = false; | |||||
| this.numSetBtn.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("numSetBtn.BackgroundImage"))); | |||||
| this.numSetBtn.EnableGroup = false; | |||||
| this.numSetBtn.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(45)))), ((int)(((byte)(155)))), ((int)(((byte)(214))))); | |||||
| this.numSetBtn.FlatAppearance.BorderSize = 0; | |||||
| this.numSetBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat; | |||||
| this.numSetBtn.Font = new System.Drawing.Font("宋体", 15F); | |||||
| this.numSetBtn.ForeColor = System.Drawing.Color.Black; | |||||
| this.numSetBtn.Location = new System.Drawing.Point(358, 46); | |||||
| this.numSetBtn.Name = "numSetBtn"; | |||||
| this.numSetBtn.PlaySound = false; | |||||
| this.numSetBtn.SelfControlEnable = false; | |||||
| this.numSetBtn.Size = new System.Drawing.Size(111, 34); | |||||
| this.numSetBtn.SoundType = WinFormControl.SoundType.Click; | |||||
| this.numSetBtn.TabIndex = 21; | |||||
| this.numSetBtn.Text = "数量设置"; | |||||
| this.numSetBtn.UseVisualStyleBackColor = true; | |||||
| this.numSetBtn.WithStataHode = false; | |||||
| this.numSetBtn.Click += new System.EventHandler(this.numSetBtn_Click); | |||||
| // | |||||
| // productBatchSelect | |||||
| // | |||||
| this.productBatchSelect.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); | |||||
| this.productBatchSelect.Font = new System.Drawing.Font("宋体", 15F); | |||||
| this.productBatchSelect.FormattingEnabled = true; | |||||
| this.productBatchSelect.Location = new System.Drawing.Point(984, 50); | |||||
| this.productBatchSelect.Name = "productBatchSelect"; | |||||
| this.productBatchSelect.Size = new System.Drawing.Size(170, 28); | |||||
| this.productBatchSelect.TabIndex = 18; | |||||
| // | |||||
| // uLabel2 | |||||
| // | |||||
| this.uLabel2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); | |||||
| this.uLabel2.AutoSize = true; | |||||
| this.uLabel2.BackColor = System.Drawing.Color.Transparent; | |||||
| this.uLabel2.Font = new System.Drawing.Font("宋体", 15F); | |||||
| this.uLabel2.Location = new System.Drawing.Point(883, 53); | |||||
| this.uLabel2.Name = "uLabel2"; | |||||
| this.uLabel2.Size = new System.Drawing.Size(109, 20); | |||||
| this.uLabel2.TabIndex = 16; | |||||
| this.uLabel2.Text = "生产批次:"; | |||||
| // | |||||
| // closeBtn | |||||
| // | |||||
| this.closeBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); | |||||
| this.closeBtn.AsClicked = false; | |||||
| this.closeBtn.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("closeBtn.BackgroundImage"))); | |||||
| this.closeBtn.EnableGroup = false; | |||||
| this.closeBtn.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(45)))), ((int)(((byte)(155)))), ((int)(((byte)(214))))); | |||||
| this.closeBtn.FlatAppearance.BorderSize = 0; | |||||
| this.closeBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat; | |||||
| this.closeBtn.Font = new System.Drawing.Font("宋体", 15F); | |||||
| this.closeBtn.ForeColor = System.Drawing.Color.Black; | |||||
| this.closeBtn.Location = new System.Drawing.Point(1187, 7); | |||||
| this.closeBtn.Name = "closeBtn"; | |||||
| this.closeBtn.PlaySound = false; | |||||
| this.closeBtn.SelfControlEnable = false; | |||||
| this.closeBtn.Size = new System.Drawing.Size(111, 34); | |||||
| this.closeBtn.SoundType = WinFormControl.SoundType.Click; | |||||
| this.closeBtn.TabIndex = 10; | |||||
| this.closeBtn.Text = "关 闭"; | |||||
| this.closeBtn.UseVisualStyleBackColor = true; | |||||
| this.closeBtn.WithStataHode = false; | |||||
| this.closeBtn.Click += new System.EventHandler(this.closeBtn_Click); | |||||
| // | |||||
| // uTimerLabel1 | |||||
| // | |||||
| this.uTimerLabel1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); | |||||
| this.uTimerLabel1.AutoSize = true; | |||||
| this.uTimerLabel1.BackColor = System.Drawing.Color.Transparent; | |||||
| this.uTimerLabel1.Font = new System.Drawing.Font("黑体", 12F); | |||||
| this.uTimerLabel1.Format = "M月d日 H:mm:ss"; | |||||
| this.uTimerLabel1.Location = new System.Drawing.Point(1165, 53); | |||||
| this.uTimerLabel1.Name = "uTimerLabel1"; | |||||
| this.uTimerLabel1.Size = new System.Drawing.Size(128, 16); | |||||
| this.uTimerLabel1.TabIndex = 8; | |||||
| this.uTimerLabel1.Text = "3月30日 8:54:07"; | |||||
| // | |||||
| // workUnitSelect | |||||
| // | |||||
| this.workUnitSelect.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); | |||||
| this.workUnitSelect.Font = new System.Drawing.Font("宋体", 15F); | |||||
| this.workUnitSelect.FormattingEnabled = true; | |||||
| this.workUnitSelect.Location = new System.Drawing.Point(984, 11); | |||||
| this.workUnitSelect.Name = "workUnitSelect"; | |||||
| this.workUnitSelect.Size = new System.Drawing.Size(170, 28); | |||||
| this.workUnitSelect.TabIndex = 7; | |||||
| // | |||||
| // netStateWatch1 | |||||
| // | |||||
| this.netStateWatch1.BackColor = System.Drawing.Color.Transparent; | |||||
| this.netStateWatch1.Location = new System.Drawing.Point(354, 4); | |||||
| this.netStateWatch1.Name = "netStateWatch1"; | |||||
| this.netStateWatch1.Size = new System.Drawing.Size(90, 39); | |||||
| this.netStateWatch1.TabIndex = 1; | |||||
| // | |||||
| // uWeightControl1 | |||||
| // | |||||
| this.uWeightControl1.BackColor = System.Drawing.Color.Transparent; | |||||
| this.uWeightControl1.Location = new System.Drawing.Point(3, 3); | |||||
| this.uWeightControl1.Name = "uWeightControl1"; | |||||
| this.uWeightControl1.Size = new System.Drawing.Size(349, 78); | |||||
| this.uWeightControl1.TabIndex = 0; | |||||
| this.uWeightControl1.WeightFalg = null; | |||||
| // | |||||
| // uLabel1 | |||||
| // | |||||
| this.uLabel1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); | |||||
| this.uLabel1.AutoSize = true; | |||||
| this.uLabel1.BackColor = System.Drawing.Color.Transparent; | |||||
| this.uLabel1.Font = new System.Drawing.Font("宋体", 15F); | |||||
| this.uLabel1.Location = new System.Drawing.Point(883, 14); | |||||
| this.uLabel1.Name = "uLabel1"; | |||||
| this.uLabel1.Size = new System.Drawing.Size(109, 20); | |||||
| this.uLabel1.TabIndex = 5; | |||||
| this.uLabel1.Text = "工作单元:"; | |||||
| // | |||||
| // groupBox1 | |||||
| // | |||||
| this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | |||||
| | System.Windows.Forms.AnchorStyles.Right))); | |||||
| this.groupBox1.Controls.Add(this.needSubmitGrid); | |||||
| this.groupBox1.Controls.Add(this.numFlowPanel); | |||||
| this.groupBox1.Controls.Add(this.submitBtn); | |||||
| this.groupBox1.Controls.Add(this.uLabel3); | |||||
| this.groupBox1.Location = new System.Drawing.Point(11, 13); | |||||
| this.groupBox1.Name = "groupBox1"; | |||||
| this.groupBox1.Padding = new System.Windows.Forms.Padding(5); | |||||
| this.groupBox1.Size = new System.Drawing.Size(600, 305); | |||||
| this.groupBox1.TabIndex = 2; | |||||
| this.groupBox1.TabStop = false; | |||||
| // | |||||
| // needSubmitGrid | |||||
| // | |||||
| this.needSubmitGrid.AllowUserToAddRows = false; | |||||
| this.needSubmitGrid.AllowUserToDeleteRows = false; | |||||
| this.needSubmitGrid.AllowUserToResizeColumns = false; | |||||
| this.needSubmitGrid.AllowUserToResizeRows = false; | |||||
| dataGridViewCellStyle21.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); | |||||
| this.needSubmitGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle21; | |||||
| this.needSubmitGrid.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | |||||
| | System.Windows.Forms.AnchorStyles.Right))); | |||||
| this.needSubmitGrid.BackgroundColor = System.Drawing.Color.White; | |||||
| this.needSubmitGrid.BorderStyle = System.Windows.Forms.BorderStyle.None; | |||||
| dataGridViewCellStyle22.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; | |||||
| dataGridViewCellStyle22.Font = new System.Drawing.Font("宋体", 12F); | |||||
| dataGridViewCellStyle22.ForeColor = System.Drawing.Color.White; | |||||
| dataGridViewCellStyle22.WrapMode = System.Windows.Forms.DataGridViewTriState.True; | |||||
| this.needSubmitGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle22; | |||||
| this.needSubmitGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; | |||||
| this.needSubmitGrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { | |||||
| this.U_ID, | |||||
| this.U_RowIndex, | |||||
| this.U_Goods_Name, | |||||
| this.U_Number, | |||||
| this.U_Weight}); | |||||
| this.needSubmitGrid.Location = new System.Drawing.Point(5, 57); | |||||
| this.needSubmitGrid.MultiSelect = false; | |||||
| this.needSubmitGrid.Name = "needSubmitGrid"; | |||||
| this.needSubmitGrid.ReadOnly = true; | |||||
| this.needSubmitGrid.RowHeadersVisible = false; | |||||
| dataGridViewCellStyle24.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); | |||||
| dataGridViewCellStyle24.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218))))); | |||||
| this.needSubmitGrid.RowsDefaultCellStyle = dataGridViewCellStyle24; | |||||
| this.needSubmitGrid.RowTemplate.Height = 30; | |||||
| this.needSubmitGrid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; | |||||
| this.needSubmitGrid.Size = new System.Drawing.Size(590, 240); | |||||
| this.needSubmitGrid.TabIndex = 16; | |||||
| // | |||||
| // U_ID | |||||
| // | |||||
| this.U_ID.DataPropertyName = "ID"; | |||||
| this.U_ID.HeaderText = "ID"; | |||||
| this.U_ID.Name = "U_ID"; | |||||
| this.U_ID.ReadOnly = true; | |||||
| this.U_ID.Visible = false; | |||||
| // | |||||
| // U_RowIndex | |||||
| // | |||||
| this.U_RowIndex.DataPropertyName = "RowIndex"; | |||||
| this.U_RowIndex.HeaderText = "序号"; | |||||
| this.U_RowIndex.Name = "U_RowIndex"; | |||||
| this.U_RowIndex.ReadOnly = true; | |||||
| // | |||||
| // U_Goods_Name | |||||
| // | |||||
| this.U_Goods_Name.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; | |||||
| this.U_Goods_Name.DataPropertyName = "Goods_Name"; | |||||
| this.U_Goods_Name.HeaderText = "产品名称"; | |||||
| this.U_Goods_Name.Name = "U_Goods_Name"; | |||||
| this.U_Goods_Name.ReadOnly = true; | |||||
| // | |||||
| // U_Number | |||||
| // | |||||
| this.U_Number.DataPropertyName = "Number"; | |||||
| this.U_Number.HeaderText = "数量"; | |||||
| this.U_Number.Name = "U_Number"; | |||||
| this.U_Number.ReadOnly = true; | |||||
| // | |||||
| // U_Weight | |||||
| // | |||||
| this.U_Weight.DataPropertyName = "Weight"; | |||||
| dataGridViewCellStyle23.Format = "#0.######"; | |||||
| this.U_Weight.DefaultCellStyle = dataGridViewCellStyle23; | |||||
| this.U_Weight.HeaderText = "重量"; | |||||
| this.U_Weight.Name = "U_Weight"; | |||||
| this.U_Weight.ReadOnly = true; | |||||
| // | |||||
| // numFlowPanel | |||||
| // | |||||
| this.numFlowPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); | |||||
| this.numFlowPanel.FlowDirection = System.Windows.Forms.FlowDirection.RightToLeft; | |||||
| this.numFlowPanel.Location = new System.Drawing.Point(143, 13); | |||||
| this.numFlowPanel.Name = "numFlowPanel"; | |||||
| this.numFlowPanel.Size = new System.Drawing.Size(452, 41); | |||||
| this.numFlowPanel.TabIndex = 15; | |||||
| // | |||||
| // submitBtn | |||||
| // | |||||
| this.submitBtn.AsClicked = false; | |||||
| this.submitBtn.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("submitBtn.BackgroundImage"))); | |||||
| this.submitBtn.EnableGroup = false; | |||||
| this.submitBtn.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(45)))), ((int)(((byte)(155)))), ((int)(((byte)(214))))); | |||||
| this.submitBtn.FlatAppearance.BorderSize = 0; | |||||
| this.submitBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat; | |||||
| this.submitBtn.Font = new System.Drawing.Font("宋体", 15F); | |||||
| this.submitBtn.ForeColor = System.Drawing.Color.Black; | |||||
| this.submitBtn.Location = new System.Drawing.Point(11, 20); | |||||
| this.submitBtn.Name = "submitBtn"; | |||||
| this.submitBtn.PlaySound = false; | |||||
| this.submitBtn.SelfControlEnable = false; | |||||
| this.submitBtn.Size = new System.Drawing.Size(111, 34); | |||||
| this.submitBtn.SoundType = WinFormControl.SoundType.Click; | |||||
| this.submitBtn.TabIndex = 11; | |||||
| this.submitBtn.Text = "提 交"; | |||||
| this.submitBtn.UseVisualStyleBackColor = true; | |||||
| this.submitBtn.WithStataHode = false; | |||||
| this.submitBtn.Click += new System.EventHandler(this.submitBtn_Click); | |||||
| // | |||||
| // uLabel3 | |||||
| // | |||||
| this.uLabel3.AutoSize = true; | |||||
| this.uLabel3.BackColor = System.Drawing.Color.White; | |||||
| this.uLabel3.Font = new System.Drawing.Font("宋体", 13F); | |||||
| this.uLabel3.Location = new System.Drawing.Point(8, 0); | |||||
| this.uLabel3.Name = "uLabel3"; | |||||
| this.uLabel3.Size = new System.Drawing.Size(80, 18); | |||||
| this.uLabel3.TabIndex = 0; | |||||
| this.uLabel3.Text = "领料明细"; | |||||
| // | |||||
| // WeightCountForm | |||||
| // | |||||
| 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(1305, 611); | |||||
| this.Controls.Add(this.splitContainer1); | |||||
| this.MinimumSize = new System.Drawing.Size(1321, 650); | |||||
| this.Name = "WeightCountForm"; | |||||
| this.Text = "称重计数"; | |||||
| this.WindowState = System.Windows.Forms.FormWindowState.Maximized; | |||||
| ((System.ComponentModel.ISupportInitialize)(this.historyDataGrid)).EndInit(); | |||||
| this.groupBox2.ResumeLayout(false); | |||||
| this.groupBox2.PerformLayout(); | |||||
| this.splitContainer1.Panel1.ResumeLayout(false); | |||||
| this.splitContainer1.Panel1.PerformLayout(); | |||||
| this.splitContainer1.Panel2.ResumeLayout(false); | |||||
| ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); | |||||
| this.splitContainer1.ResumeLayout(false); | |||||
| this.groupBox1.ResumeLayout(false); | |||||
| this.groupBox1.PerformLayout(); | |||||
| ((System.ComponentModel.ISupportInitialize)(this.needSubmitGrid)).EndInit(); | |||||
| this.ResumeLayout(false); | |||||
| } | |||||
| #endregion | |||||
| private System.Windows.Forms.DataGridViewTextBoxColumn H_Weight; | |||||
| private System.Windows.Forms.DataGridViewTextBoxColumn H_Goods_Name; | |||||
| private System.Windows.Forms.DataGridViewTextBoxColumn H_RowIndex; | |||||
| private System.Windows.Forms.DataGridViewTextBoxColumn H_ID; | |||||
| private WinFormControl.UDataGridView historyDataGrid; | |||||
| private System.Windows.Forms.DataGridViewTextBoxColumn H_Number; | |||||
| private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; | |||||
| private System.Windows.Forms.GroupBox groupBox2; | |||||
| private WinFormControl.ULabel uLabel4; | |||||
| private System.Windows.Forms.ComboBox storeSelect; | |||||
| private WinFormControl.ULabel uLabel5; | |||||
| private System.Windows.Forms.SplitContainer splitContainer1; | |||||
| private WinFormControl.UButton numSetBtn; | |||||
| private System.Windows.Forms.ComboBox productBatchSelect; | |||||
| private WinFormControl.ULabel uLabel2; | |||||
| private WinFormControl.UButton closeBtn; | |||||
| private WinFormControl.UTimerLabel uTimerLabel1; | |||||
| private System.Windows.Forms.ComboBox workUnitSelect; | |||||
| private WinFormControl.NetStateWatch netStateWatch1; | |||||
| private WinFormControl.UWeightControl uWeightControl1; | |||||
| private WinFormControl.ULabel uLabel1; | |||||
| private System.Windows.Forms.GroupBox groupBox1; | |||||
| private WinFormControl.UDataGridView needSubmitGrid; | |||||
| private System.Windows.Forms.DataGridViewTextBoxColumn U_ID; | |||||
| private System.Windows.Forms.DataGridViewTextBoxColumn U_RowIndex; | |||||
| private System.Windows.Forms.DataGridViewTextBoxColumn U_Goods_Name; | |||||
| private System.Windows.Forms.DataGridViewTextBoxColumn U_Number; | |||||
| private System.Windows.Forms.DataGridViewTextBoxColumn U_Weight; | |||||
| private System.Windows.Forms.FlowLayoutPanel numFlowPanel; | |||||
| private WinFormControl.UButton submitBtn; | |||||
| private WinFormControl.ULabel uLabel3; | |||||
| private WinFormControl.ULabel uLabel6; | |||||
| private WinFormControl.UButton typeBtn; | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,283 @@ | |||||
| using ButcherFactory.BO; | |||||
| using ButcherFactory.BO.LocalBL; | |||||
| using ButcherFactory.BO.Rpcs; | |||||
| 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; | |||||
| using System.Threading.Tasks; | |||||
| using System.Windows.Forms; | |||||
| using WinFormControl; | |||||
| using ButcherFactory.Utils; | |||||
| using ButcherFactory.Dialogs; | |||||
| using ButcherFactory.BO.Bill; | |||||
| namespace ButcherFactory.WeightCount_ | |||||
| { | |||||
| public partial class WeightCountForm : Form, IWithRoleForm | |||||
| { | |||||
| #region IWithRoleForm | |||||
| public List<short> RoleName | |||||
| { | |||||
| get { return new List<short> { (short)设备类别.称重计数 }; } | |||||
| } | |||||
| public Form Generate() | |||||
| { | |||||
| return this; | |||||
| } | |||||
| #endregion | |||||
| const string FilePatch = @"Config\NumberSetDialog.cfg"; | |||||
| Thread uploadData; | |||||
| BindingList<WeightCountEntity> needSubmitedList; | |||||
| BindingList<WeightCountEntity> historyList; | |||||
| WeightCountConfig config; | |||||
| long? batchID; | |||||
| public WeightCountForm() | |||||
| { | |||||
| InitializeComponent(); | |||||
| BuildNumberPanel(); | |||||
| workUnitSelect.SelectedIndexChanged += delegate | |||||
| { | |||||
| if (workUnitSelect.SelectedValue == null) | |||||
| config.WorkUnitID = null; | |||||
| else | |||||
| config.WorkUnitID = (long)workUnitSelect.SelectedValue; | |||||
| XmlUtil.SerializerObjToFile(config); | |||||
| }; | |||||
| storeSelect.SelectedIndexChanged += delegate | |||||
| { | |||||
| if (storeSelect.SelectedValue == null) | |||||
| config.Store_ID = null; | |||||
| else | |||||
| config.Store_ID = (long)storeSelect.SelectedValue; | |||||
| XmlUtil.SerializerObjToFile(config); | |||||
| }; | |||||
| productBatchSelect.SelectedIndexChanged += delegate | |||||
| { | |||||
| if (productBatchSelect.SelectedValue == null) | |||||
| batchID = null; | |||||
| else | |||||
| batchID = (long)productBatchSelect.SelectedValue; | |||||
| }; | |||||
| this.FormClosing += delegate | |||||
| { | |||||
| if (uploadData != null && uploadData.IsAlive) | |||||
| uploadData.Abort(); | |||||
| }; | |||||
| } | |||||
| protected override void OnLoad(EventArgs e) | |||||
| { | |||||
| base.OnLoad(e); | |||||
| var initTask = new Thread(LoadBind); | |||||
| initTask.Start(); | |||||
| uploadData = new Thread(UpLoadLocalData); | |||||
| uploadData.Start(); | |||||
| } | |||||
| private void LoadBind() | |||||
| { | |||||
| this.Invoke(new Action(() => | |||||
| { | |||||
| BLUtil.DeleteLocalDb<WeightCountEntity>(); | |||||
| BaseInfoSyncRpc.SyncGoodsByTag(ApplyClient.称重计数); | |||||
| BaseInfoSyncRpc.SyncBaseInfo<WorkUnit>(); | |||||
| BaseInfoSyncRpc.SyncProductBatch(1); | |||||
| BaseInfoSyncRpc.SyncBaseInfo<Store>(); | |||||
| productBatchSelect.EBindComboBox<ProductBatch>(x => x.Date == DateTime.Today, 6, "Date"); | |||||
| config = XmlUtil.DeserializeFromFile<WeightCountConfig>(); | |||||
| workUnitSelect.EBindComboBox<WorkUnit>(x => x.ID == config.WorkUnitID, top: 100); | |||||
| storeSelect.EBindComboBox<Store>(x => x.ID == config.Store_ID, top: 100); | |||||
| BindGoods(); | |||||
| AfterChangeType(); | |||||
| })); | |||||
| } | |||||
| List<UButton> goodsBtns = new List<UButton>(); | |||||
| void BindGoods() | |||||
| { | |||||
| var goods = FormClientGoodsSetBL.GetGoodsList(); | |||||
| foreach (var item in goods) | |||||
| { | |||||
| var btn = new UButton() { Width = 120, Height = 75, Text = item.Goods_Name, Tag = item.Goods_ID, Font = new Font("宋体", 15), Margin = new Padding(22, 10, 22, 30), PlaySound = true }; | |||||
| btn.Click += GoodsBtnClick; | |||||
| goodsBtns.Add(btn); | |||||
| flowLayoutPanel1.Controls.Add(btn); | |||||
| } | |||||
| } | |||||
| void GoodsBtnClick(object sender, EventArgs e) | |||||
| { | |||||
| if (batchID == null) | |||||
| throw new Exception("请先选择批次"); | |||||
| if (!config.ProduceOut && config.Store_ID == null) | |||||
| throw new Exception("请先选择仓库"); | |||||
| if (uWeightControl1.Weight == 0) | |||||
| throw new Exception("重量不能为0!"); | |||||
| var c = sender as UButton; | |||||
| var entity = new WeightCountEntity(); | |||||
| entity.RowIndex = GetRowIndex(); | |||||
| entity.Weight = uWeightControl1.Weight; | |||||
| entity.Goods_ID = (long)c.Tag; | |||||
| entity.Goods_Name = c.Text; | |||||
| entity.ProductBatch_ID = batchID; | |||||
| entity.WorkUnit_ID = config.WorkUnitID; | |||||
| if (!config.ProduceOut) | |||||
| entity.Store_ID = config.Store_ID; | |||||
| entity.ProduceOut = config.ProduceOut; | |||||
| WeightCountEntityBL.InsertEntityByWeight(entity); | |||||
| needSubmitedList.Insert(0, entity); | |||||
| AfterInsert(); | |||||
| } | |||||
| void BindGrid() | |||||
| { | |||||
| needSubmitedList = WeightCountEntityBL.GetWeightCountEntity(config.ProduceOut, false); | |||||
| needSubmitGrid.DataSource = needSubmitedList; | |||||
| needSubmitGrid.Refresh(); | |||||
| historyList = WeightCountEntityBL.GetWeightCountEntity(config.ProduceOut, true); | |||||
| historyDataGrid.DataSource = historyList; | |||||
| historyDataGrid.Refresh(); | |||||
| } | |||||
| private void UpLoadLocalData() | |||||
| { | |||||
| while (true) | |||||
| { | |||||
| if (this.IsHandleCreated) | |||||
| { | |||||
| this.Invoke(new Action(() => | |||||
| { | |||||
| WeightCountEntityBL.Upload(); | |||||
| })); | |||||
| } | |||||
| Thread.Sleep(2000); | |||||
| } | |||||
| } | |||||
| void AfterInsert() | |||||
| { | |||||
| needSubmitGrid.FirstDisplayedScrollingRowIndex = 0; | |||||
| needSubmitGrid.Rows[0].Selected = true; | |||||
| needSubmitGrid.CurrentCell = needSubmitGrid.Rows[0].Cells[2]; | |||||
| needSubmitGrid.Refresh(); | |||||
| } | |||||
| int GetRowIndex() | |||||
| { | |||||
| var f = needSubmitedList.FirstOrDefault(x => x.CreateTime.Date == DateTime.Today); | |||||
| if (f != null) | |||||
| return f.RowIndex.Value + 1; | |||||
| else if (historyList.Any()) | |||||
| return historyList.First().RowIndex.Value + 1; | |||||
| else | |||||
| return 1; | |||||
| } | |||||
| private void closeBtn_Click(object sender, EventArgs e) | |||||
| { | |||||
| Close(); | |||||
| } | |||||
| private void submitBtn_Click(object sender, EventArgs e) | |||||
| { | |||||
| if (needSubmitedList.Count == 0) | |||||
| throw new Exception("没有待提交记录"); | |||||
| var arr = needSubmitedList.ToList(); | |||||
| arr.Reverse(); | |||||
| WeightCountEntityBL.UpdateSubmit(needSubmitedList.Select(x => x.ID)); | |||||
| foreach (var item in arr) | |||||
| { | |||||
| historyList.Insert(0, item); | |||||
| if (historyList.Count > 50) | |||||
| historyList.RemoveAt(50); | |||||
| needSubmitedList.Remove(item); | |||||
| } | |||||
| historyDataGrid.FirstDisplayedScrollingRowIndex = 0; | |||||
| historyDataGrid.Refresh(); | |||||
| needSubmitGrid.Refresh(); | |||||
| } | |||||
| private void numSetBtn_Click(object sender, EventArgs e) | |||||
| { | |||||
| new NumberSetDialog().ShowDialog(); | |||||
| BuildNumberPanel(); | |||||
| } | |||||
| void BuildNumberPanel() | |||||
| { | |||||
| numFlowPanel.Controls.Clear(); | |||||
| if (!System.IO.File.Exists(FilePatch)) | |||||
| return; | |||||
| var simpBtn = new UButton() { Width = 100, Height = 34, Text = "自定义", Font = new Font("宋体", 15), Margin = new Padding(6, 2, 6, 0), WithStataHode = true, EnableGroup = true }; | |||||
| simpBtn.Click += delegate | |||||
| { | |||||
| var cr = GetCurrentRowEntity(); | |||||
| if (cr == null) | |||||
| return; | |||||
| var keyBoard = new NumberPad(); | |||||
| if (keyBoard.ShowDialog() == true) | |||||
| { | |||||
| var v = 0; | |||||
| if (int.TryParse(keyBoard.Result, out v) && v > 0) | |||||
| { | |||||
| cr.Number = v; | |||||
| WeightCountEntityBL.UpdateNumber(cr.ID, cr.Number); | |||||
| needSubmitGrid.Refresh(); | |||||
| } | |||||
| else | |||||
| throw new Exception("输入数量有误!"); | |||||
| } | |||||
| }; | |||||
| numFlowPanel.Controls.Add(simpBtn); | |||||
| var arr = System.IO.File.ReadAllText(FilePatch).Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Reverse(); | |||||
| foreach (var item in arr) | |||||
| { | |||||
| var btn = new UButton() { Width = 100, Height = 34, Text = item, Font = new Font("宋体", 15), Margin = new Padding(6, 2, 6, 0), WithStataHode = true, EnableGroup = true }; | |||||
| btn.Click += (sender, e) => | |||||
| { | |||||
| var row = GetCurrentRowEntity(); | |||||
| if (row == null) | |||||
| return; | |||||
| var b = sender as UButton; | |||||
| row.Number = int.Parse(b.Text); | |||||
| WeightCountEntityBL.UpdateNumber(row.ID, row.Number); | |||||
| needSubmitGrid.Refresh(); | |||||
| }; | |||||
| numFlowPanel.Controls.Add(btn); | |||||
| } | |||||
| } | |||||
| WeightCountEntity GetCurrentRowEntity() | |||||
| { | |||||
| if (needSubmitGrid.CurrentRow == null) | |||||
| return null; | |||||
| return needSubmitGrid.CurrentRow.DataBoundItem as WeightCountEntity; | |||||
| } | |||||
| private void typeBtn_Click(object sender, EventArgs e) | |||||
| { | |||||
| config.ProduceOut = !config.ProduceOut; | |||||
| XmlUtil.SerializerObjToFile(config); | |||||
| AfterChangeType(); | |||||
| } | |||||
| void AfterChangeType() | |||||
| { | |||||
| typeBtn.Text = config.ProduceOut ? "产出" : "入库"; | |||||
| BindGrid(); | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,168 @@ | |||||
| <?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> | |||||
| <metadata name="H_RowIndex.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <value>True</value> | |||||
| </metadata> | |||||
| <metadata name="H_Number.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <value>True</value> | |||||
| </metadata> | |||||
| <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> | |||||
| <data name="typeBtn.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> | |||||
| <value> | |||||
| iVBORw0KGgoAAAANSUhEUgAAAGAAAAAwCAIAAABhdOiYAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO | |||||
| wwAADsMBx2+oZAAAAHNJREFUaEPt0AENACAMwDAkowVB14aDz0CTKui5b1gICoKCoCAoCAqCgqAgKAgK | |||||
| goKgICgICoKCoCAoCAqCgqAgKAgKgoKgICgICoKCoCAoCAqCgqAgKAgKgoKgICgICoKCoCAoCAqCgqAg | |||||
| KAgKgoKg1ZsPvpCB0hBohjQAAAAASUVORK5CYII= | |||||
| </value> | |||||
| </data> | |||||
| <data name="numSetBtn.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> | |||||
| <value> | |||||
| iVBORw0KGgoAAAANSUhEUgAAAGAAAAAwCAIAAABhdOiYAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO | |||||
| wwAADsMBx2+oZAAAAHNJREFUaEPt0AENACAMwDAkowVB14aDz0CTKui5b1gICoKCoCAoCAqCgqAgKAgK | |||||
| goKgICgICoKCoCAoCAqCgqAgKAgKgoKgICgICoKCoCAoCAqCgqAgKAgKgoKgICgICoKCoCAoCAqCgqAg | |||||
| KAgKgoKg1ZsPvpCB0hBohjQAAAAASUVORK5CYII= | |||||
| </value> | |||||
| </data> | |||||
| <data name="closeBtn.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> | |||||
| <value> | |||||
| iVBORw0KGgoAAAANSUhEUgAAAGAAAAAwCAIAAABhdOiYAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO | |||||
| wwAADsMBx2+oZAAAAHNJREFUaEPt0AENACAMwDAkowVB14aDz0CTKui5b1gICoKCoCAoCAqCgqAgKAgK | |||||
| goKgICgICoKCoCAoCAqCgqAgKAgKgoKgICgICoKCoCAoCAqCgqAgKAgKgoKgICgICoKCoCAoCAqCgqAg | |||||
| KAgKgoKg1ZsPvpCB0hBohjQAAAAASUVORK5CYII= | |||||
| </value> | |||||
| </data> | |||||
| <metadata name="U_RowIndex.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <value>True</value> | |||||
| </metadata> | |||||
| <metadata name="U_Number.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <value>True</value> | |||||
| </metadata> | |||||
| <metadata name="U_Weight.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <value>True</value> | |||||
| </metadata> | |||||
| <data name="submitBtn.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> | |||||
| <value> | |||||
| iVBORw0KGgoAAAANSUhEUgAAAGAAAAAwCAIAAABhdOiYAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO | |||||
| wwAADsMBx2+oZAAAAHNJREFUaEPt0AENACAMwDAkowVB14aDz0CTKui5b1gICoKCoCAoCAqCgqAgKAgK | |||||
| goKgICgICoKCoCAoCAqCgqAgKAgKgoKgICgICoKCoCAoCAqCgqAgKAgKgoKgICgICoKCoCAoCAqCgqAg | |||||
| KAgKgoKg1ZsPvpCB0hBohjQAAAAASUVORK5CYII= | |||||
| </value> | |||||
| </data> | |||||
| </root> | |||||