Browse Source

调整方式。

master
yibo 7 years ago
parent
commit
a94785e05c
22 changed files with 532 additions and 189 deletions
  1. +15
    -0
      ButcherFactory.BO/Base/BaseInfo.cs
  2. +14
    -0
      ButcherFactory.BO/Base/DriveType.cs
  3. +29
    -0
      ButcherFactory.BO/Base/SyncBill.cs
  4. +2
    -6
      ButcherFactory.BO/BaseInfo/Goods.cs
  5. +15
    -0
      ButcherFactory.BO/BaseInfo/ProductBatch.cs
  6. +14
    -0
      ButcherFactory.BO/BaseInfo/WorkUnit.cs
  7. +7
    -10
      ButcherFactory.BO/BaseInfo/WpfUser.cs
  8. +31
    -0
      ButcherFactory.BO/Bill/CarcassInStore.cs
  9. +11
    -6
      ButcherFactory.BO/ButcherFactory.BO.csproj
  10. +38
    -0
      ButcherFactory.BO/LocalBL/BaseInfoBL.cs
  11. +54
    -0
      ButcherFactory.BO/Rpcs/BaseInfoSyncRpc.cs
  12. +5
    -5
      ButcherFactory.BO/Utils/AppContext.cs
  13. +1
    -1
      ButcherFactory.BO/Utils/DbUtil.cs
  14. +3
    -25
      ButcherFactory.BO/Utils/FormUtil.cs
  15. +32
    -74
      ButcherFactory.BO/Utils/LoginUtil.cs
  16. +1
    -0
      ButcherFactory.Form/ButcherFactory.Form.csproj
  17. +177
    -40
      ButcherFactory.Form/CarcassInStore_/CarcassInStoreForm.Designer.cs
  18. +25
    -3
      ButcherFactory.Form/CarcassInStore_/CarcassInStoreForm.cs
  19. +20
    -2
      ButcherFactory.Form/CarcassInStore_/CarcassInStoreForm.resx
  20. +4
    -3
      ButcherFactory.Form/SegmentationPick_/SegmentationPickOut.cs
  21. +23
    -0
      ButcherFactory.Form/Utils/ControlsUtil.cs
  22. +11
    -14
      ButcherFactory.Login/Login.cs

+ 15
- 0
ButcherFactory.BO/Base/BaseInfo.cs View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ButcherFactory.BO
{
public abstract class BaseInfo
{
public long ID { get; set; }
public string Name { get; set; }
}
}

+ 14
- 0
ButcherFactory.BO/Base/DriveType.cs View File

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ButcherFactory.BO
{
public enum
{
= 0,
= 1,
}
}

+ 29
- 0
ButcherFactory.BO/Base/SyncBill.cs View File

@ -0,0 +1,29 @@
using Forks.EnterpriseServices.DomainObjects2;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ButcherFactory.BO
{
[KeyField("ID", KeyGenType.identity)]
public abstract class SyncBill
{
public long ID { get; set; }
public int RowVersion { get; set; }
[DbColumn(DbType = SqlDbType.DateTime)]
public DateTime CreateTime { get; set; }
public long UserID { get; set; }
public bool Sync { get; set; }
public bool Delete { get; set; }
public long? ServerID { get; set; }
}
}

ButcherFactory.BO/Base/Goods.cs → ButcherFactory.BO/BaseInfo/Goods.cs View File

@ -5,15 +5,11 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ButcherFactory.BO.Base
namespace ButcherFactory.BO
{
[MapToTable("Butcher_Goods")]
public class Goods
public class Goods:BaseInfo
{
public long ID { get; set; }
public string Name { get; set; }
public string MainUnit { get; set; }
public decimal? Standard { get; set; }

+ 15
- 0
ButcherFactory.BO/BaseInfo/ProductBatch.cs View File

@ -0,0 +1,15 @@
using Forks.EnterpriseServices.DomainObjects2;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ButcherFactory.BO
{
[MapToTable("Butcher_ProductBatch")]
public class ProductBatch : BaseInfo
{
}
}

+ 14
- 0
ButcherFactory.BO/BaseInfo/WorkUnit.cs View File

@ -0,0 +1,14 @@
using Forks.EnterpriseServices.DomainObjects2;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ButcherFactory.BO
{
[MapToTable("Butcher_WorkUnit")]
public class WorkUnit : BaseInfo
{
}
}

ButcherFactory.BO/Base/WpfUser.cs → ButcherFactory.BO/BaseInfo/WpfUser.cs View File

@ -8,22 +8,19 @@ using System.Threading.Tasks;
namespace ButcherFactory.BO
{
[MapToTable("WpfUser")]
public class WpfUser
[MapToTable("Butcher_Worker")]
public class Worker : BaseInfo
{
public long ID { get; set; }
public string Name { get; set; }
public string Code { get; set; }
[DbColumn(AllowNull = false, DbType = SqlDbType.Binary, Length = 16)]
public byte[] Password { get; set; }
public string Role { get; set; }
List<string> _roleList = new List<string>();
[NonDmoProperty]
public List<string> RoleList { get { return _roleList; } }
[NonDmoProperty]
public bool Login { get; set; }
public IEnumerable<short> RoleList
{
get { return Role.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(x => short.Parse(x)); }
}
}
}

+ 31
- 0
ButcherFactory.BO/Bill/CarcassInStore.cs View File

@ -0,0 +1,31 @@
using Forks.EnterpriseServices.DomainObjects2;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ButcherFactory.BO
{
[MapToTable("Butcher_CarcassInStore")]
public class CarcassInStore : SyncBill
{
public string BarCode { get; set; }
public long WorkUnit_ID { get; set; }
public long ProductBatch_ID { get; set; }
public long Goods_ID { get; set; }
public decimal? Weight { get; set; }
public long? UpID { get; set; }
public decimal? BeforeWeight { get; set; }
[ReferenceTo(typeof(Goods), "Name")]
[Join("Goods_ID", "ID")]
public string Goods_Name { get; set; }
}
}

+ 11
- 6
ButcherFactory.BO/ButcherFactory.BO.csproj View File

@ -56,19 +56,24 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Base\Goods.cs" />
<Compile Include="Base\WpfUser.cs" />
<Compile Include="Base\BaseInfo.cs" />
<Compile Include="BaseInfo\ProductBatch.cs" />
<Compile Include="Base\DriveType.cs" />
<Compile Include="Base\SyncBill.cs" />
<Compile Include="BaseInfo\Goods.cs" />
<Compile Include="BaseInfo\WorkUnit.cs" />
<Compile Include="BaseInfo\WpfUser.cs" />
<Compile Include="Bill\CarcassInStore.cs" />
<Compile Include="LocalBL\BaseInfoBL.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Rpcs\BaseInfoSyncRpc.cs" />
<Compile Include="Utils\AppContext.cs" />
<Compile Include="Utils\DbUtil.cs" />
<Compile Include="Utils\FormUtil.cs" />
<Compile Include="Utils\LoginUtil.cs" />
<Compile Include="Utils\XmlUtil.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="BaseInfo\" />
<Folder Include="Bill\" />
</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.
Other similar extension points exist, see Microsoft.Common.targets.


+ 38
- 0
ButcherFactory.BO/LocalBL/BaseInfoBL.cs View File

@ -0,0 +1,38 @@
using ButcherFactory.BO.Utils;
using Forks.EnterpriseServices.DomainObjects2;
using Forks.EnterpriseServices.DomainObjects2.DQuery;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ButcherFactory.BO.LocalBL
{
public static class BaseInfoBL
{
public static List<BaseInfo> GetList<T>()
where T : BaseInfo, new()
{
var query = new DQueryDom(new JoinAlias(typeof(T)));
query.Columns.Add(DQSelectColumn.Field("ID"));
query.Columns.Add(DQSelectColumn.Field("Name"));
query.OrderBy.Expressions.Add(DQOrderByExpression.Create("ID", true));
var result = new List<BaseInfo>();
using (var session = Dmo.NewSession(AppContext.ConnectInfo.SqlConnection))
{
using (var reader = session.ExecuteReader(query))
{
while (reader.Read())
{
var entity = new T();
result.Add(entity);
entity.ID = (long)reader[0];
entity.Name = (string)reader[1];
}
}
}
return result;
}
}
}

+ 54
- 0
ButcherFactory.BO/Rpcs/BaseInfoSyncRpc.cs View File

@ -0,0 +1,54 @@
using ButcherFactory.BO.Utils;
using Forks.EnterpriseServices.DomainObjects2;
using Forks.JsonRpc.Client;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ButcherFactory.BO.Rpcs
{
public static class BaseInfoSyncRpc
{
const string baseInfoRpcPath = @"/MainSystem/B3ClientService/Rpcs/SyncBaseInfoRpc/";
static void TruncateTable(Type type, IDmoSession session)
{
var table = DmoInfo.Get(type).MappedDBObject;
var sql = string.Format("truncate table [{0}]", table);
session.ExecuteSqlNonQuery(sql);
}
public static void SyncBaseInfo<T>(string methodName = null)
where T : BaseInfo
{
var type = typeof(T);
if (string.IsNullOrEmpty(methodName))
methodName = "Sync" + type.Name;
var json = RpcFacade.Call<string>(baseInfoRpcPath + methodName);
var list = JsonConvert.DeserializeObject<List<T>>(json);
using (var session = Dmo.NewSession(AppContext.ConnectInfo.SqlConnection))
{
TruncateTable(type, session);
foreach (var item in list)
session.Insert(item);
session.Commit();
}
}
public static void SyncGoodsByTag(string tag)
{
//var json = RpcFacade.Call<string>(baseInfoRpcPath + "SyncGoods");
//var list = JsonConvert.DeserializeObject<List<Goods>>(json);
//using (var session = Dmo.NewSession(AppContext.ConnectInfo.SqlConnection))
//{
// TruncateTable(typeof(Goods), session);
// foreach (var item in list)
// session.Insert(item);
// session.Commit();
//}
}
}
}

+ 5
- 5
ButcherFactory.BO/Utils/AppContext.cs View File

@ -12,14 +12,14 @@ namespace ButcherFactory.BO.Utils
static ServerUrlConfig _connectInfo = ServerUrlConfig.Init();
public static ServerUrlConfig ConnectInfo { get { return _connectInfo; } }
static WpfUser _user = null;
public static WpfUser User
static Worker _worker = null;
public static Worker Worker
{
get
{
if (_user == null)
_user = LoginUtil.InitUserFromLocal();
return _user;
if (_worker == null)
_worker = LoginUtil.InitUserFromLocal();
return _worker;
}
}
}


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

@ -23,7 +23,7 @@ namespace ButcherFactory.BO.Utils
static IEnumerable<Type> GetTypes()
{
var asm = Assembly.GetAssembly(typeof(WpfUser));
var asm = Assembly.GetAssembly(typeof(Worker));
foreach (var t in asm.GetExportedTypes())
{
if (t.IsAbstract)


+ 3
- 25
ButcherFactory.BO/Utils/FormUtil.cs View File

@ -32,40 +32,18 @@ namespace ButcherFactory.BO.Utils
var instance = (IWithRoleForm)Activator.CreateInstance(type);
foreach (var item in instance.RoleName)
{
if (AppContext.User.Login)
{
if (LoginUtil.UserIsInRole(item))
{
if (!AppContext.User.RoleList.Contains(item))
AppContext.User.RoleList.Add(item);
form = instance.Generate();
break;
}
else if (AppContext.User.RoleList.Contains(item))
{
AppContext.User.RoleList.Remove(item);
}
}
else
{
if (AppContext.User.RoleList.Contains(item))
form = instance.Generate();
break;
}
if (AppContext.Worker.RoleList.Contains(item))
return instance.Generate();
}
}
if (form != null)
break;
}
if (AppContext.User.Login)
LoginUtil.UpdateUserRole();
return form;
}
}
public interface IWithRoleForm
{
List<string> RoleName { get; }
List<short> RoleName { get; }
Form Generate();
}


+ 32
- 74
ButcherFactory.BO/Utils/LoginUtil.cs View File

@ -14,23 +14,18 @@ namespace ButcherFactory.BO.Utils
{
public static class LoginUtil
{
public static WpfUser InitUserFromLocal()
public static Worker InitUserFromLocal()
{
if (string.IsNullOrEmpty(AppContext.ConnectInfo.SqlConnection))
return new WpfUser();
return new Worker();
using (var session = Dmo.NewSession(AppContext.ConnectInfo.SqlConnection))
{
var query = new DmoQuery(typeof(WpfUser));
var query = new DmoQuery(typeof(Worker));
var obj = session.ExecuteScalar(query);
if (obj != null)
{
var user = (WpfUser)obj;
if (!string.IsNullOrEmpty(user.Role))
user.RoleList.AddRange(user.Role.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries));
return user;
}
return (Worker)obj;
}
return new WpfUser();
return new Worker();
}
public static void InitRpcFacade()
@ -50,71 +45,51 @@ namespace ButcherFactory.BO.Utils
RpcFacade.ReInit(AppContext.ConnectInfo.ServerUrl);
}
public static void LoginOut()
public static string GetWorkerNameByCode(string code)
{
if (AppContext.User.Login)
const string method = "/MainSystem/B3ClientService/Rpcs/LoginRpc/GetWorkerNameByCode";
var result = RpcFacade.Call<string>(method, code);
int r;
if (int.TryParse(result, out r))
{
try
{
AppContext.User.Login = false;
RpcFacade.Logout();
}
catch { };
if (r == 0)
throw new Exception("工号输入错误");
throw new Exception("账号被停用");
}
}
public static string GetUserNameByCode(string code, out string error)
{
try
{
error = string.Empty;
const string wpfUserMethod = "/MainSystem/B3ClientService/Rpcs/UserInfoRpc/GetUserName";
return RpcFacade.Call<string>(wpfUserMethod, code);
}
catch (Exception ex)
else
{
error = ex.ToString();
AppContext.Worker.Code = code;
return result;
}
return string.Empty;
}
public static void Login(string userName, string pwd)
{
RpcFacade.Login(userName, pwd);
AppContext.User.Login = true;
if (userName == AppContext.User.Name)
{
var oldRole = AppContext.User.RoleList.ToList();
AppContext.User.RoleList.Clear();
foreach (var item in oldRole)
{
if (UserIsInRole(item))
AppContext.User.RoleList.Add(item);
}
AppContext.User.Role = string.Join(" ", AppContext.User.RoleList);
}
else
{
AppContext.User.RoleList.Clear();
AppContext.User.Role = null;
}
AppContext.User.Name = userName;
FillUserID(userName);
AppContext.User.Password = EncodePwd(pwd);
RpcLogin(userName, pwd);
const string wpfUserMethod = "/MainSystem/B3ClientService/Rpcs/LoginRpc/GetWorkerBindDrive";
AppContext.Worker.Role = RpcFacade.Call<string>(wpfUserMethod, AppContext.Worker.ID);
AppContext.Worker.Name = userName;
AppContext.Worker.Password = EncodePwd(pwd);
using (var session = Dmo.NewSession(AppContext.ConnectInfo.SqlConnection))
{
var table = DmoInfo.Get(typeof(WpfUser)).MappedDBObject;
var table = DmoInfo.Get(typeof(Worker)).MappedDBObject;
var sql = string.Format(@"delete from [{0}]", table);
session.ExecuteSqlNonQuery(sql);
session.Insert(AppContext.User);
session.Insert(AppContext.Worker);
session.Commit();
}
}
static void FillUserID(string name)
static void RpcLogin(string name, string pwd)
{
const string wpfUserMethod = "/MainSystem/B3ClientService/Rpcs/UserInfoRpc/GetUserID";
AppContext.User.ID = RpcFacade.Call<long>(wpfUserMethod);
const string loginMethod = "/MainSystem/B3ClientService/Rpcs/LoginRpc/Login";
var r = RpcFacade.Call<long>(loginMethod, name, pwd);
if (r == 0)
throw new Exception("工号输入错误");
else if (r == -1)
throw new Exception("账号被停用");
AppContext.Worker.ID = r;
}
public static byte[] EncodePwd(string pwd)
@ -123,23 +98,6 @@ namespace ButcherFactory.BO.Utils
return md5.ComputeHash(Encoding.Unicode.GetBytes(pwd));
}
public static bool UserIsInRole(string roleName)
{
const string method = "/MainSystem/B3ClientService/Rpcs/UserInfoRpc/UserIsInRole";
return RpcFacade.Call<bool>(method, roleName);
}
public static void UpdateUserRole()
{
using (var session = Dmo.NewSession(AppContext.ConnectInfo.SqlConnection))
{
var update = new DQUpdateDom(typeof(WpfUser));
update.Columns.Add(new DQUpdateColumn("Role", string.Join(" ", AppContext.User.RoleList)));
session.ExecuteNonQuery(update);
session.Commit();
}
}
public static bool TestConnection(int? millisecondsTimeout = null)
{
var url = AppContext.ConnectInfo.ServerUrl;


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

@ -60,6 +60,7 @@
<Compile Include="SegmentationPick_\SegmentationPickOut.Designer.cs">
<DependentUpon>SegmentationPickOut.cs</DependentUpon>
</Compile>
<Compile Include="Utils\ControlsUtil.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ButcherFactory.BO\ButcherFactory.BO.csproj">


+ 177
- 40
ButcherFactory.Form/CarcassInStore_/CarcassInStoreForm.Designer.cs View File

@ -29,23 +29,40 @@
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CarcassInStoreForm));
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = 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();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.closeBtn = new WinFormControl.UButton();
this.uTimerLabel1 = new WinFormControl.UTimerLabel();
this.comboBox2 = new System.Windows.Forms.ComboBox();
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.productBatchSelect = new System.Windows.Forms.ComboBox();
this.workUnitSelect = new System.Windows.Forms.ComboBox();
this.uScanPanel1 = new WinFormControl.UScanPanel();
this.netStateWatch1 = new WinFormControl.NetStateWatch();
this.uWeightControl1 = new WinFormControl.UWeightControl();
this.uLabel1 = new WinFormControl.ULabel();
this.uLabel2 = new WinFormControl.ULabel();
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
this.closeBtn = new WinFormControl.UButton();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.historyDataGrid = new WinFormControl.UDataGridView();
this.uLabel4 = new WinFormControl.ULabel();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.needSubmitGrid = new WinFormControl.UDataGridView();
this.uLabel3 = new WinFormControl.ULabel();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit();
this.splitContainer2.Panel1.SuspendLayout();
this.splitContainer2.SuspendLayout();
this.groupBox2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.historyDataGrid)).BeginInit();
this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.needSubmitGrid)).BeginInit();
this.SuspendLayout();
//
// splitContainer1
@ -64,8 +81,8 @@
this.splitContainer1.Panel1.BackColor = System.Drawing.Color.Transparent;
this.splitContainer1.Panel1.Controls.Add(this.closeBtn);
this.splitContainer1.Panel1.Controls.Add(this.uTimerLabel1);
this.splitContainer1.Panel1.Controls.Add(this.comboBox2);
this.splitContainer1.Panel1.Controls.Add(this.comboBox1);
this.splitContainer1.Panel1.Controls.Add(this.productBatchSelect);
this.splitContainer1.Panel1.Controls.Add(this.workUnitSelect);
this.splitContainer1.Panel1.Controls.Add(this.uScanPanel1);
this.splitContainer1.Panel1.Controls.Add(this.netStateWatch1);
this.splitContainer1.Panel1.Controls.Add(this.uWeightControl1);
@ -79,6 +96,24 @@
this.splitContainer1.SplitterDistance = 86;
this.splitContainer1.TabIndex = 0;
//
// closeBtn
//
this.closeBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.closeBtn.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("closeBtn.BackgroundImage")));
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(1046, 7);
this.closeBtn.Name = "closeBtn";
this.closeBtn.PlaySound = false;
this.closeBtn.Size = new System.Drawing.Size(111, 34);
this.closeBtn.SoundType = WinFormControl.SoundType.Click;
this.closeBtn.TabIndex = 9;
this.closeBtn.Text = "关 闭";
this.closeBtn.UseVisualStyleBackColor = true;
//
// uTimerLabel1
//
this.uTimerLabel1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
@ -92,25 +127,25 @@
this.uTimerLabel1.TabIndex = 8;
this.uTimerLabel1.Text = "3月30日 8:54:07";
//
// comboBox2
// productBatchSelect
//
this.comboBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.comboBox2.Font = new System.Drawing.Font("宋体", 15F);
this.comboBox2.FormattingEnabled = true;
this.comboBox2.Location = new System.Drawing.Point(843, 47);
this.comboBox2.Name = "comboBox2";
this.comboBox2.Size = new System.Drawing.Size(170, 28);
this.comboBox2.TabIndex = 4;
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(843, 47);
this.productBatchSelect.Name = "productBatchSelect";
this.productBatchSelect.Size = new System.Drawing.Size(170, 28);
this.productBatchSelect.TabIndex = 4;
//
// comboBox1
// workUnitSelect
//
this.comboBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.comboBox1.Font = new System.Drawing.Font("宋体", 15F);
this.comboBox1.FormattingEnabled = true;
this.comboBox1.Location = new System.Drawing.Point(843, 11);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(170, 28);
this.comboBox1.TabIndex = 3;
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(843, 11);
this.workUnitSelect.Name = "workUnitSelect";
this.workUnitSelect.Size = new System.Drawing.Size(170, 28);
this.workUnitSelect.TabIndex = 3;
//
// uScanPanel1
//
@ -174,6 +209,8 @@
// splitContainer2.Panel1
//
this.splitContainer2.Panel1.BackColor = System.Drawing.Color.Transparent;
this.splitContainer2.Panel1.Controls.Add(this.groupBox2);
this.splitContainer2.Panel1.Controls.Add(this.groupBox1);
//
// splitContainer2.Panel2
//
@ -182,23 +219,110 @@
this.splitContainer2.SplitterDistance = 836;
this.splitContainer2.TabIndex = 0;
//
// closeBtn
//
this.closeBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.closeBtn.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("closeBtn.BackgroundImage")));
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(1046, 7);
this.closeBtn.Name = "closeBtn";
this.closeBtn.PlaySound = false;
this.closeBtn.Size = new System.Drawing.Size(111, 34);
this.closeBtn.SoundType = WinFormControl.SoundType.Click;
this.closeBtn.TabIndex = 9;
this.closeBtn.Text = "关 闭";
this.closeBtn.UseVisualStyleBackColor = true;
// 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, 254);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Padding = new System.Windows.Forms.Padding(5);
this.groupBox2.Size = new System.Drawing.Size(811, 254);
this.groupBox2.TabIndex = 1;
this.groupBox2.TabStop = false;
//
// historyDataGrid
//
this.historyDataGrid.AllowUserToAddRows = false;
this.historyDataGrid.AllowUserToDeleteRows = false;
this.historyDataGrid.AllowUserToResizeColumns = false;
this.historyDataGrid.AllowUserToResizeRows = false;
dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.historyDataGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
this.historyDataGrid.BackgroundColor = System.Drawing.Color.White;
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.historyDataGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;
this.historyDataGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
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.RowHeadersVisible = false;
dataGridViewCellStyle3.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle3.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
this.historyDataGrid.RowsDefaultCellStyle = dataGridViewCellStyle3;
this.historyDataGrid.RowTemplate.Height = 23;
this.historyDataGrid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.historyDataGrid.Size = new System.Drawing.Size(801, 230);
this.historyDataGrid.TabIndex = 2;
//
// 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(62, 18);
this.uLabel4.TabIndex = 1;
this.uLabel4.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.uLabel3);
this.groupBox1.Location = new System.Drawing.Point(11, 15);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Padding = new System.Windows.Forms.Padding(5);
this.groupBox1.Size = new System.Drawing.Size(811, 226);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
//
// needSubmitGrid
//
this.needSubmitGrid.AllowUserToAddRows = false;
this.needSubmitGrid.AllowUserToDeleteRows = false;
this.needSubmitGrid.AllowUserToResizeColumns = false;
this.needSubmitGrid.AllowUserToResizeRows = false;
dataGridViewCellStyle4.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.needSubmitGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle4;
this.needSubmitGrid.BackgroundColor = System.Drawing.Color.White;
dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle5.Font = new System.Drawing.Font("宋体", 12F);
dataGridViewCellStyle5.ForeColor = System.Drawing.Color.White;
dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.needSubmitGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle5;
this.needSubmitGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.needSubmitGrid.Dock = System.Windows.Forms.DockStyle.Fill;
this.needSubmitGrid.Location = new System.Drawing.Point(5, 19);
this.needSubmitGrid.MultiSelect = false;
this.needSubmitGrid.Name = "needSubmitGrid";
this.needSubmitGrid.RowHeadersVisible = false;
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.needSubmitGrid.RowsDefaultCellStyle = dataGridViewCellStyle6;
this.needSubmitGrid.RowTemplate.Height = 23;
this.needSubmitGrid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.needSubmitGrid.Size = new System.Drawing.Size(801, 202);
this.needSubmitGrid.TabIndex = 1;
//
// 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, -1);
this.uLabel3.Name = "uLabel3";
this.uLabel3.Size = new System.Drawing.Size(62, 18);
this.uLabel3.TabIndex = 0;
this.uLabel3.Text = "待提交";
//
// CarcassInStoreForm
//
@ -216,8 +340,15 @@
this.splitContainer1.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false);
this.splitContainer2.Panel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit();
this.splitContainer2.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.historyDataGrid)).EndInit();
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.needSubmitGrid)).EndInit();
this.ResumeLayout(false);
}
@ -228,13 +359,19 @@
private System.Windows.Forms.SplitContainer splitContainer2;
private WinFormControl.ULabel uLabel2;
private WinFormControl.ULabel uLabel1;
private System.Windows.Forms.ComboBox comboBox2;
private System.Windows.Forms.ComboBox comboBox1;
private System.Windows.Forms.ComboBox productBatchSelect;
private System.Windows.Forms.ComboBox workUnitSelect;
private WinFormControl.UScanPanel uScanPanel1;
private WinFormControl.NetStateWatch netStateWatch1;
private WinFormControl.UWeightControl uWeightControl1;
private WinFormControl.UTimerLabel uTimerLabel1;
private WinFormControl.UButton closeBtn;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.GroupBox groupBox1;
private WinFormControl.ULabel uLabel3;
private WinFormControl.ULabel uLabel4;
private WinFormControl.UDataGridView needSubmitGrid;
private WinFormControl.UDataGridView historyDataGrid;
}

+ 25
- 3
ButcherFactory.Form/CarcassInStore_/CarcassInStoreForm.cs View File

@ -1,4 +1,6 @@
using ButcherFactory.BO.Utils;
using ButcherFactory.BO;
using ButcherFactory.BO.Rpcs;
using ButcherFactory.BO.Utils;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@ -8,6 +10,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using ButcherFactory.Utils;
namespace ButcherFactory.CarcassInStore_
{
@ -19,9 +22,28 @@ namespace ButcherFactory.CarcassInStore_
netStateWatch1.GetConnectState = () => LoginUtil.TestConnection(500);
}
public List<string> RoleName
protected override void OnLoad(EventArgs e)
{
get { return new List<string> { "车间业务.白条入库"}; }
base.OnLoad(e);
SyncBaseInfo();
}
void SyncBaseInfo()
{
if (netStateWatch1.NetState)
{
BaseInfoSyncRpc.SyncGoodsByTag("");
BaseInfoSyncRpc.SyncBaseInfo<WorkUnit>();
BaseInfoSyncRpc.SyncBaseInfo<ProductBatch>();
}
workUnitSelect.EBindComboBox<WorkUnit>();
productBatchSelect.EBindComboBox<ProductBatch>();
}
public List<short> RoleName
{
get { return new List<short> { (short). }; }
}
public Form Generate()


+ 20
- 2
ButcherFactory.Form/CarcassInStore_/CarcassInStoreForm.resx View File

@ -135,10 +135,10 @@
<metadata name="uTimerLabel1.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="comboBox2.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="productBatchSelect.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="comboBox1.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="workUnitSelect.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="uScanPanel1.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
@ -159,6 +159,24 @@
<metadata name="splitContainer2.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="groupBox2.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="historyDataGrid.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="uLabel4.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="groupBox1.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="needSubmitGrid.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="uLabel3.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>

+ 4
- 3
ButcherFactory.Form/SegmentationPick_/SegmentationPickOut.cs View File

@ -1,4 +1,5 @@
using ButcherFactory.BO.Utils;
using ButcherFactory.BO;
using ButcherFactory.BO.Utils;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@ -18,9 +19,9 @@ namespace ButcherFactory.SegmentationPick_
InitializeComponent();
}
public List<string> RoleName
public List<short> RoleName
{
get { return new List<string> { "车间业务.领料退料" }; }
get { return new List<short> { (short). }; }
}
public Form Generate()


+ 23
- 0
ButcherFactory.Form/Utils/ControlsUtil.cs View File

@ -0,0 +1,23 @@
using ButcherFactory.BO;
using ButcherFactory.BO.LocalBL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ButcherFactory.Utils
{
public static class ControlsUtil
{
public static void EBindComboBox<T>(this ComboBox box)
where T : BaseInfo, new()
{
box.DataSource = BaseInfoBL.GetList<T>();
box.DisplayMember = "Name";
box.ValueMember = "ID";
box.Refresh();
}
}
}

+ 11
- 14
ButcherFactory.Login/Login.cs View File

@ -17,10 +17,13 @@ namespace ButcherFactory.Login
public Login()
{
InitializeComponent();
userNameBox.Text = AppContext.User.Name;
pwdBox.Text = "123";
if (!string.IsNullOrEmpty(AppContext.User.Name))
pwdBox.Focus();
try
{
userNameBox.Text = AppContext.Worker.Name;
if (!string.IsNullOrEmpty(AppContext.Worker.Name))
pwdBox.Focus();
}
catch { }
}
private Point mousePoint = new Point();
@ -47,14 +50,14 @@ namespace ButcherFactory.Login
var pwd = pwdBox.Text;
if (string.IsNullOrEmpty(username))
throw new Exception("请输入用户名");
LoginUtil.InitRpcFacade();
if (LoginUtil.TestConnection(1000))
{
LoginUtil.InitRpcFacade();
await Task.Factory.StartNew(() => LoginUtil.Login(username, pwd));
}
else
{
if (AppContext.User.Name != username || string.Join("", LoginUtil.EncodePwd(pwd)) != string.Join("", AppContext.User.Password))
if (AppContext.Worker.Name != username || string.Join("", LoginUtil.EncodePwd(pwd)) != string.Join("", AppContext.Worker.Password))
throw new Exception("离线时只能使用上次登录信息登录");
}
@ -65,7 +68,6 @@ namespace ButcherFactory.Login
form.FormClosing += delegate
{
SubFormClosing();
LoginUtil.LoginOut();
};
form.Show();
Hide();
@ -102,16 +104,11 @@ namespace ButcherFactory.Login
{
if (!LoginUtil.TestConnection(1000))
{
if (string.IsNullOrEmpty(AppContext.User.Name))
if (string.IsNullOrEmpty(AppContext.Worker.Name))
throw new Exception("请检查网络");
throw new Exception("离线时无法切换用户");
}
string errorInfo;
userNameBox.Text = LoginUtil.GetUserNameByCode(keyBoard.Result, out errorInfo);
if (string.IsNullOrEmpty(userNameBox.Text))
throw new Exception("工号输入错误");
if (!string.IsNullOrEmpty(errorInfo))
MessageBox.Show(errorInfo);
userNameBox.Text = LoginUtil.GetWorkerNameByCode(keyBoard.Result);
}
}
}


Loading…
Cancel
Save