diff --git a/ButcherFactory.BO/Bill/CarcassSaleOut_Detail.cs b/ButcherFactory.BO/Bill/CarcassSaleOut_Detail.cs new file mode 100644 index 0000000..3cbb2a9 --- /dev/null +++ b/ButcherFactory.BO/Bill/CarcassSaleOut_Detail.cs @@ -0,0 +1,104 @@ +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_CarcassSaleOut_Detail")] + [KeyField("ID", KeyGenType.identity)] + public class CarcassSaleOut_Detail + { + public CarcassSaleOut_Detail() + { + Time = DateTime.Now; + } + + public long ID { get; set; } + + public long? BillID { get; set; } + + public long? DetailID { get; set; } + + public string BarCode { get; set; } + + public long? Goods_ID { get; set; } + + public string Goods_Name { get; set; } + + public string Goods_Code { get; set; } + + public long? ProductBatch_ID { get; set; } + + [NonDmoProperty] + public int Number { get; set; } + + public decimal? InStoreWeight { get; set; } + + public decimal Weight { get; set; } + + [NonDmoProperty] + public decimal? DiffWeight + { + get + { + if (InStoreWeight.HasValue) + return InStoreWeight.Value - Weight; + return null; + } + } + + public DateTime Time { get; set; } + + public bool Filled { get; set; } + } + + public class SaleOutStore + { + public long ID { get; set; } + + public string Customer_Name { get; set; } + + public DateTime? SendTime { get; set; } + + public string DeliverGoodsLine_Name { get; set; } + + public string Address { get; set; } + + public string CarNumber { get; set; } + } + + public class SaleOutStore_Detail + { + public long SaleOutStore_ID { get; set; } + + public long ID { get; set; } + + public string Customer_Name { get; set; } + + public string Goods_Code { get; set; } + + public string Goods_Name { get; set; } + + public decimal? SecondNumber { get; set; } + + public decimal? Number { get; set; } + + public decimal? SSecondNumber { get; set; } + + public decimal? SNumber { get; set; } + + public decimal? DiffNumber + { + get + { + if (Number.HasValue && SNumber.HasValue) + return Number.Value - SNumber.Value; + return null; + } + } + + } +} diff --git a/ButcherFactory.BO/ButcherFactory.BO.csproj b/ButcherFactory.BO/ButcherFactory.BO.csproj index 67f88ba..348d631 100644 --- a/ButcherFactory.BO/ButcherFactory.BO.csproj +++ b/ButcherFactory.BO/ButcherFactory.BO.csproj @@ -61,6 +61,7 @@ + @@ -73,13 +74,16 @@ + + + diff --git a/ButcherFactory.BO/Enums/DriveType.cs b/ButcherFactory.BO/Enums/DriveType.cs index d34887a..d5577d4 100644 --- a/ButcherFactory.BO/Enums/DriveType.cs +++ b/ButcherFactory.BO/Enums/DriveType.cs @@ -8,6 +8,7 @@ namespace ButcherFactory.BO { public enum 设备类别 { + 白条发货 = -1, 白条入库 = 0, 白条领用 = 1, 分割生产 = 2, diff --git a/ButcherFactory.BO/LocalBL/CarcassSaleOutBL.cs b/ButcherFactory.BO/LocalBL/CarcassSaleOutBL.cs new file mode 100644 index 0000000..965a6c4 --- /dev/null +++ b/ButcherFactory.BO/LocalBL/CarcassSaleOutBL.cs @@ -0,0 +1,183 @@ +using ButcherFactory.BO.Utils; +using Forks.EnterpriseServices.DomainObjects2; +using Forks.EnterpriseServices.DomainObjects2.DQuery; +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 CarcassSaleOutBL + { + const string RpcPath = @"/MainSystem/B3Sale/Rpcs/"; + const string MESPath = @"/MainSystem/B3ClientService/Rpcs/"; + + public static BindingList GetSaleOutStoreList(DateTime sendDate, long? deliverGoodsLineID, long? customerID, int billState, long? storeID) + { + var json = RpcFacade.Call(RpcPath + "SaleOutStoreRpc/GetSaleOutStoreList", sendDate, billState, deliverGoodsLineID, customerID, storeID); + var list = JsonConvert.DeserializeObject>(json); + return new BindingList(list); + } + + public static BindingList GetSaleOutStoreDetailList(long id) + { + var json = RpcFacade.Call(RpcPath + "SaleOutStoreRpc/GetSaleOutStoreDetailList", id); + var list = JsonConvert.DeserializeObject>(json); + return new BindingList(list); + } + + public static BindingList GetWeightRecord(long detailID) + { + var query = new DmoQuery(typeof(CarcassSaleOut_Detail)); + query.Where.Conditions.Add(DQCondition.EQ("DetailID", detailID)); + query.OrderBy.Expressions.Add(DQOrderByExpression.Create("ID", true)); + var list = query.EExecuteList().Cast().ToList(); + return new BindingList(list); + } + + public static CarcassSaleOut_Detail Insert(decimal weight) + { + using (var session = DmoSession.New()) + { + var detail = new CarcassSaleOut_Detail() { Weight = weight }; + session.Insert(detail); + session.Commit(); + return detail; + } + } + + public static BindingList GetUnSubmitWeightRecord() + { + var query = new DmoQuery(typeof(CarcassSaleOut_Detail)); + query.Where.Conditions.Add(DQCondition.IsNull(DQExpression.Field("DetailID"))); + query.OrderBy.Expressions.Add(DQOrderByExpression.Create("ID", true)); + var list = query.EExecuteList().Cast().ToList(); + return new BindingList(list); + } + + static Dictionary> goodsInfos = new Dictionary>(); + public static void FillDetail(CarcassSaleOut_Detail first, string barCode, long? batchID) + { + using (var session = DmoSession.New()) + { + var list = new List>(); + if (barCode.StartsWith("G")) + { + var gid = long.Parse(barCode.TrimStart('G')); + var gInfo = GetGoodsInfo(gid); + first.Goods_ID = gid; + first.Goods_Name = gInfo.Item1; + first.Goods_Code = gInfo.Item2; + first.ProductBatch_ID = batchID; + list.Add(new Tuple("ProductBatch_ID", first.ProductBatch_ID)); + } + else + { + var json = ButcherFactoryUtil.SimpleMESCall(MESPath + "CarcassSaleOutStoreRpc/GetCarcassInstoreInfo", barCode); + var mesInfo = JsonConvert.DeserializeObject(json); + if (!string.IsNullOrEmpty(mesInfo.Goods_Code)) + { + var gInfo = GetGoodsInfo(mesInfo.Goods_Code); + first.Goods_Code = mesInfo.Goods_Code; + first.InStoreWeight = mesInfo.InStoreWeight; + first.Goods_ID = gInfo.Item1; + first.Goods_Name = gInfo.Item2; + } + first.BarCode = barCode; + list.Add(new Tuple("BarCode", first.BarCode)); + list.Add(new Tuple("InStoreWeight", first.InStoreWeight)); + } + first.Filled = true; + list.Add(new Tuple("Goods_ID", first.Goods_ID)); + list.Add(new Tuple("Goods_Name", first.Goods_Name)); + list.Add(new Tuple("Goods_Code", first.Goods_Code)); + list.Add(new Tuple("Filled", first.Filled)); + Update(session, first.ID, list.ToArray()); + session.Commit(); + } + } + + static void Update(IDmoSession session, long id, params Tuple[] pops) + { + var update = new DQUpdateDom(typeof(CarcassSaleOut_Detail)); + foreach (var item in pops) + update.Columns.Add(new DQUpdateColumn(item.Item1, item.Item2)); + update.Where.Conditions.Add(DQCondition.EQ("ID", id)); + session.ExecuteNonQuery(update); + } + + static Tuple GetGoodsInfo(long id) + { + if (!goodsInfos.ContainsKey(id)) + { + var json = RpcFacade.Call(RpcPath + "BaseInfoSelectRpc/GetGoodsInfo", "ID", id); + var g = JsonConvert.DeserializeObject(json); + if (g.LongExt1 == null) + throw new Exception("没有找到存货No." + id); + goodsInfos.Add(id, new Tuple(g.StringExt1, g.StringExt2)); + } + return goodsInfos[id]; + } + + public static Tuple GetGoodsInfo(string code) + { + long id = 0; + if (!goodsInfos.Any(x => x.Value.Item2 == code)) + { + var json = RpcFacade.Call(RpcPath + "BaseInfoSelectRpc/GetGoodsInfo", "Code", code); + var g = JsonConvert.DeserializeObject(json); + if (g.LongExt1 == null) + throw new Exception("没有找到存货编码 " + code); + id = g.LongExt1.Value; + goodsInfos.Add(id, new Tuple(g.StringExt1, g.StringExt2)); + } + return new Tuple(id, goodsInfos[id].Item1); + } + + public static List GetBatchFromEMS() + { + var json = ButcherFactoryUtil.SimpleMESCall(MESPath + "SyncBaseInfoRpc/GetProductBatch", 9); + return JsonConvert.DeserializeObject>(json); + } + + public static void SubmitDetails(BindingList details, SaleOutStore_Detail detail) + { + var arr = details.Select(x => new WeightRecord { WeightTime = x.Time, MainUnitNum = x.Weight, ProductBatch_ID = x.ProductBatch_ID, BarCode = x.BarCode }); + RpcFacade.Call(RpcPath + "SaleOutStoreRpc/SaveWeightRecord", JsonConvert.SerializeObject(arr), detail.ID); + + var update = new DQUpdateDom(typeof(CarcassSaleOut_Detail)); + update.Where.Conditions.Add(DQCondition.InList(DQExpression.Field("ID"), details.Select(x => DQExpression.Value(x.ID)).ToArray())); + update.Columns.Add(new DQUpdateColumn("BillID", detail.SaleOutStore_ID)); + update.Columns.Add(new DQUpdateColumn("DetailID", detail.ID)); + update.EExecute(); + + detail.SNumber = (detail.SNumber ?? 0) + details.Sum(x => x.Weight); + detail.SSecondNumber = (detail.SSecondNumber ?? 0) + details.Count(); + } + + public static void SetGoodsFinish(long id) + { + RpcFacade.Call(RpcPath + "SaleOutStoreRpc/SetFinishAssignState", id); + } + } + + class SaleOutCarcassObj + { + public string Goods_Code { get; set; } + + public decimal? InStoreWeight { get; set; } + } + + class WeightRecord + { + public string BarCode { get; set; } + public long? ProductBatch_ID { get; set; } + public DateTime WeightTime { get; set; } + public decimal? MainUnitNum { get; set; } + } +} diff --git a/ButcherFactory.BO/LocalBL/DialogBL.cs b/ButcherFactory.BO/LocalBL/DialogBL.cs new file mode 100644 index 0000000..7404cee --- /dev/null +++ b/ButcherFactory.BO/LocalBL/DialogBL.cs @@ -0,0 +1,35 @@ +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.LocalBL +{ + public static class DialogBL + { + const string RpcPath = @"/MainSystem/B3Sale/Rpcs/BaseInfoSelectRpc/"; + public static IEnumerable GetStoreList() + { + return GetBaseInfoList("GetStoreList"); + } + + public static IEnumerable GetDeliverGoodsLineList() + { + return GetBaseInfoList("GetDeliverGoodsLineList"); + } + + public static IEnumerable GetCustomerList(string spell) + { + return GetBaseInfoList("GetCustomerList", spell); + } + + static IEnumerable GetBaseInfoList(string method, params string[] spell) + { + var json = RpcFacade.Call(RpcPath + method, spell); + return JsonConvert.DeserializeObject>(json); + } + } +} diff --git a/ButcherFactory.BO/Utils/AppContext.cs b/ButcherFactory.BO/Utils/AppContext.cs index ac99095..1ba2f65 100644 --- a/ButcherFactory.BO/Utils/AppContext.cs +++ b/ButcherFactory.BO/Utils/AppContext.cs @@ -31,6 +31,8 @@ namespace ButcherFactory.BO.Utils return XmlUtil.DeserializeFromFile(); } + public int ServerMode { get; set; } + public string ServerUrl { get; set; } public string SqlConnection { get; set; } diff --git a/ButcherFactory.BO/Utils/ButcherFactoryUtil.cs b/ButcherFactory.BO/Utils/ButcherFactoryUtil.cs index b41e2e0..b194f6c 100644 --- a/ButcherFactory.BO/Utils/ButcherFactoryUtil.cs +++ b/ButcherFactory.BO/Utils/ButcherFactoryUtil.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -28,5 +29,25 @@ namespace ButcherFactory.BO.Utils } return result; } + + static ClientRpc clientRpc; + + public static T SimpleMESCall(string method, params object[] args) + { + InitClientRpc(); + return clientRpc.Call(method, args); + } + + static void InitClientRpc() + { + if (clientRpc != null) + return; + if (!File.Exists("MESUrl.cfg")) + throw new Exception("缺少配置文件MESUrl.cfg"); + var url = File.ReadAllText("MESUrl.cfg"); + if (string.IsNullOrEmpty(url)) + throw new Exception("MESUrl.cfg 配置文件错误"); + clientRpc = new ClientRpc(url); + } } } diff --git a/ButcherFactory.BO/Utils/ClientRpc.cs b/ButcherFactory.BO/Utils/ClientRpc.cs new file mode 100644 index 0000000..2db7609 --- /dev/null +++ b/ButcherFactory.BO/Utils/ClientRpc.cs @@ -0,0 +1,125 @@ +using Forks.JsonRpc.Client; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Net; +using System.Text; +using System.Threading.Tasks; + +namespace ButcherFactory.BO.Utils +{ + public class ClientRpc + { + public ClientRpc(string url) + { + mUrl = url; + } + + class _Error + { + public int? code { get; set; } + public string message { get; set; } + } + class _ErrorResposne + { + public _Error error { get; set; } + } + + string mUrl; + + public string Url + { + get + { + return mUrl; + } + } + + public T Call(string method, params object[] args) + { + var resp = DoCall(method, args); + + if (resp.error != null) + { + throw new Exception(string.Format("{0}:{1}", resp.error.code, resp.error.message)); + } + + return resp.result; + } + + LRestClientReponse DoCall(string method, object[] args) + { + var request = (HttpWebRequest)WebRequest.Create(mUrl); + request.Method = "POST"; + request.ContentType = "application/json"; + var dic = new Dictionary(); + dic.Add("method", method); + dic.Add("id", 1); + dic.Add("params", args); + + var json = JsonConvert.SerializeObject(dic); + + var buffer = Encoding.UTF8.GetBytes(json); + + var requestStream = request.GetRequestStream(); + requestStream.Write(buffer, 0, buffer.Length); + + var responseJson = GetResponseJSON(request); + + try + { + var result = JsonConvert.DeserializeObject>(responseJson); + return result; + } + catch + { + try + { + var errorResponse = JsonConvert.DeserializeObject<_ErrorResposne>(responseJson); + if (errorResponse.error != null) + { + throw new JsonRpcException(errorResponse.error.message); + } + } + catch + { + throw new Exception("JSON反序列化失败:" + responseJson); + } + throw new Exception("JSON反序列化失败:" + responseJson); + } + + } + + public class LRestClientReponseError + { + public string code { get; set; } + public string message { get; set; } + + public override string ToString() + { + return string.Format("{0}:{1}", code, message); + } + } + + public class LRestClientReponse + { + public long id { get; set; } + public LRestClientReponseError error { get; set; } + public T result { get; set; } + } + + private static string GetResponseJSON(HttpWebRequest request) + { + var response = request.GetResponse(); + using (var stream = response.GetResponseStream()) + { + using (var reader = new StreamReader(stream, Encoding.UTF8)) + { + return reader.ReadToEnd(); + } + } + } + } +} diff --git a/ButcherFactory.BO/Utils/LoginUtil.cs b/ButcherFactory.BO/Utils/LoginUtil.cs index 678a708..dc4c3d8 100644 --- a/ButcherFactory.BO/Utils/LoginUtil.cs +++ b/ButcherFactory.BO/Utils/LoginUtil.cs @@ -47,7 +47,9 @@ namespace ButcherFactory.BO.Utils public static string GetWorkerNameByCode(string code) { - const string method = "/MainSystem/B3ClientService/Rpcs/LoginRpc/GetWorkerNameByCode"; + string method = "/MainSystem/B3ClientService/Rpcs/LoginRpc/GetWorkerNameByCode"; + if (AppContext.ConnectInfo.ServerMode == 1) + method = "/MainSystem/B3ButcherManage/Rpcs/ClientRpc/GetUserName"; var result = RpcFacade.Call(method, code); int r; if (int.TryParse(result, out r)) @@ -63,11 +65,12 @@ namespace ButcherFactory.BO.Utils } } - public static void Login(string userName, string pwd) + public static void Login(string userName, string pwd, int mode) { - RpcLogin(userName, pwd); - const string wpfUserMethod = "/MainSystem/B3ClientService/Rpcs/LoginRpc/GetWorkerBindDrive"; - AppContext.Worker.Role = RpcFacade.Call(wpfUserMethod, AppContext.Worker.ID); + if (mode == 0) + RpcLogin(userName, pwd); + else + FacedLogin(userName, pwd); AppContext.Worker.Name = userName; AppContext.Worker.Password = EncodePwd(pwd); @@ -81,6 +84,12 @@ namespace ButcherFactory.BO.Utils } } + static void FacedLogin(string userName, string pwd) + { + RpcFacade.Login(userName, pwd); + AppContext.Worker.Role = ((short)设备类别.白条发货).ToString(); + } + static void RpcLogin(string name, string pwd) { const string loginMethod = "/MainSystem/B3ClientService/Rpcs/LoginRpc/Login"; @@ -90,6 +99,8 @@ namespace ButcherFactory.BO.Utils else if (r == -1) throw new Exception("账号被停用"); AppContext.Worker.ID = r; + const string wpfUserMethod = "/MainSystem/B3ClientService/Rpcs/LoginRpc/GetWorkerBindDrive"; + AppContext.Worker.Role = RpcFacade.Call(wpfUserMethod, AppContext.Worker.ID); } public static byte[] EncodePwd(string pwd) diff --git a/ButcherFactory.Form/ButcherFactory.Form.csproj b/ButcherFactory.Form/ButcherFactory.Form.csproj index ce5bda7..6252cbb 100644 --- a/ButcherFactory.Form/ButcherFactory.Form.csproj +++ b/ButcherFactory.Form/ButcherFactory.Form.csproj @@ -58,13 +58,52 @@ CarcassInStoreForm.cs + + Form + + + CarcassSaleOutForm.cs + + + CalendarSelecter.xaml + Form ClientGoodsSetDialog.cs + + Form + + + SelectBillStateDialog.cs + + + Form + + + SelectCustomerDialog.cs + + + Form + + + SelectDeliverGoodsLineDialog.cs + + + Form + + + SelectStoreDialog.cs + + + Form + + + WeightRecordDialog.cs + Form @@ -97,12 +136,30 @@ CarcassInStoreForm.cs + + CarcassSaleOutForm.cs + CarcassTakeOutForm.cs ClientGoodsSetDialog.cs + + SelectBillStateDialog.cs + + + SelectCustomerDialog.cs + + + SelectDeliverGoodsLineDialog.cs + + + SelectStoreDialog.cs + + + WeightRecordDialog.cs + SegmentProductionForm.cs @@ -110,6 +167,12 @@ TrunOutDialog.cs + + + Designer + MSBuild:Compile + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + + iVBORw0KGgoAAAANSUhEUgAAAGAAAAAwCAIAAABhdOiYAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + wwAADsMBx2+oZAAAAHNJREFUaEPt0AENACAMwDAkowVB14aDz0CTKui5b1gICoKCoCAoCAqCgqAgKAgK + goKgICgICoKCoCAoCAqCgqAgKAgKgoKgICgICoKCoCAoCAqCgqAgKAgKgoKgICgICoKCoCAoCAqCgqAg + KAgKgoKg1ZsPvpCB0hBohjQAAAAASUVORK5CYII= + + + + + iVBORw0KGgoAAAANSUhEUgAAAGAAAAAwCAIAAABhdOiYAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + wwAADsMBx2+oZAAAAHNJREFUaEPt0AENACAMwDAkowVB14aDz0CTKui5b1gICoKCoCAoCAqCgqAgKAgK + goKgICgICoKCoCAoCAqCgqAgKAgKgoKgICgICoKCoCAoCAqCgqAgKAgKgoKgICgICoKCoCAoCAqCgqAg + KAgKgoKg1ZsPvpCB0hBohjQAAAAASUVORK5CYII= + + + + + iVBORw0KGgoAAAANSUhEUgAAAGAAAAAwCAIAAABhdOiYAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + wwAADsMBx2+oZAAAAHNJREFUaEPt0AENACAMwDAkowVB14aDz0CTKui5b1gICoKCoCAoCAqCgqAgKAgK + goKgICgICoKCoCAoCAqCgqAgKAgKgoKgICgICoKCoCAoCAqCgqAgKAgKgoKgICgICoKCoCAoCAqCgqAg + KAgKgoKg1ZsPvpCB0hBohjQAAAAASUVORK5CYII= + + + + + iVBORw0KGgoAAAANSUhEUgAAAGAAAAAwCAIAAABhdOiYAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + wwAADsMBx2+oZAAAAHNJREFUaEPt0AENACAMwDAkowVB14aDz0CTKui5b1gICoKCoCAoCAqCgqAgKAgK + goKgICgICoKCoCAoCAqCgqAgKAgKgoKgICgICoKCoCAoCAqCgqAgKAgKgoKgICgICoKCoCAoCAqCgqAg + KAgKgoKg1ZsPvpCB0hBohjQAAAAASUVORK5CYII= + + + + + iVBORw0KGgoAAAANSUhEUgAAAGAAAAAwCAIAAABhdOiYAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + wwAADsMBx2+oZAAAAHNJREFUaEPt0AENACAMwDAkowVB14aDz0CTKui5b1gICoKCoCAoCAqCgqAgKAgK + goKgICgICoKCoCAoCAqCgqAgKAgKgoKgICgICoKCoCAoCAqCgqAgKAgKgoKgICgICoKCoCAoCAqCgqAg + KAgKgoKg1ZsPvpCB0hBohjQAAAAASUVORK5CYII= + + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + + iVBORw0KGgoAAAANSUhEUgAAAGAAAAAwCAIAAABhdOiYAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + wwAADsMBx2+oZAAAAHNJREFUaEPt0AENACAMwDAkowVB14aDz0CTKui5b1gICoKCoCAoCAqCgqAgKAgK + goKgICgICoKCoCAoCAqCgqAgKAgKgoKgICgICoKCoCAoCAqCgqAgKAgKgoKgICgICoKCoCAoCAqCgqAg + KAgKgoKg1ZsPvpCB0hBohjQAAAAASUVORK5CYII= + + + \ No newline at end of file diff --git a/ButcherFactory.Form/CarcassTakeOut_/CarcassTakeOutForm.Designer.cs b/ButcherFactory.Form/CarcassTakeOut_/CarcassTakeOutForm.Designer.cs index 11533a9..34f4010 100644 --- a/ButcherFactory.Form/CarcassTakeOut_/CarcassTakeOutForm.Designer.cs +++ b/ButcherFactory.Form/CarcassTakeOut_/CarcassTakeOutForm.Designer.cs @@ -45,7 +45,6 @@ this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.productBatchSelect = new System.Windows.Forms.ComboBox(); this.uLabel2 = new WinFormControl.ULabel(); - this.noBarCode = new WinFormControl.UButton(); this.closeBtn = new WinFormControl.UButton(); this.uTimerLabel1 = new WinFormControl.UTimerLabel(); this.uScanPanel1 = new WinFormControl.UScanPanel(); @@ -118,7 +117,6 @@ this.splitContainer1.Panel1.BackColor = System.Drawing.Color.Transparent; this.splitContainer1.Panel1.Controls.Add(this.productBatchSelect); this.splitContainer1.Panel1.Controls.Add(this.uLabel2); - this.splitContainer1.Panel1.Controls.Add(this.noBarCode); this.splitContainer1.Panel1.Controls.Add(this.closeBtn); this.splitContainer1.Panel1.Controls.Add(this.uTimerLabel1); this.splitContainer1.Panel1.Controls.Add(this.workUnitSelect); @@ -158,29 +156,6 @@ this.uLabel2.TabIndex = 16; this.uLabel2.Text = "生产批次:"; // - // noBarCode - // - this.noBarCode.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.noBarCode.AsClicked = false; - this.noBarCode.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("noBarCode.BackgroundImage"))); - this.noBarCode.EnableGroup = false; - this.noBarCode.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(45)))), ((int)(((byte)(155)))), ((int)(((byte)(214))))); - this.noBarCode.FlatAppearance.BorderSize = 0; - this.noBarCode.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.noBarCode.Font = new System.Drawing.Font("宋体", 15F); - this.noBarCode.ForeColor = System.Drawing.Color.Black; - this.noBarCode.Location = new System.Drawing.Point(591, 45); - this.noBarCode.Name = "noBarCode"; - this.noBarCode.PlaySound = false; - this.noBarCode.SelfControlEnable = false; - this.noBarCode.Size = new System.Drawing.Size(114, 34); - this.noBarCode.SoundType = WinFormControl.SoundType.Click; - this.noBarCode.TabIndex = 2; - this.noBarCode.Text = "无 码"; - this.noBarCode.UseVisualStyleBackColor = true; - this.noBarCode.WithStataHode = true; - this.noBarCode.Click += new System.EventHandler(this.noBarCode_Click); - // // closeBtn // this.closeBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); @@ -658,7 +633,6 @@ private System.Windows.Forms.SplitContainer splitContainer2; private System.Windows.Forms.DataGridViewTextBoxColumn W_ID; private System.Windows.Forms.DataGridViewTextBoxColumn W_Weight; - private WinFormControl.UButton noBarCode; private System.Windows.Forms.ComboBox productBatchSelect; private WinFormControl.ULabel uLabel2; private System.Windows.Forms.DataGridViewTextBoxColumn U_ID; diff --git a/ButcherFactory.Form/CarcassTakeOut_/CarcassTakeOutForm.cs b/ButcherFactory.Form/CarcassTakeOut_/CarcassTakeOutForm.cs index 8f79fe6..4827a9e 100644 --- a/ButcherFactory.Form/CarcassTakeOut_/CarcassTakeOutForm.cs +++ b/ButcherFactory.Form/CarcassTakeOut_/CarcassTakeOutForm.cs @@ -91,7 +91,7 @@ namespace ButcherFactory.CarcassTakeOut_ BaseInfoSyncRpc.SyncBaseInfo(); } - productBatchSelect.EBindComboBox(x => x.Date == DateTime.Today, 3, "Date"); + productBatchSelect.EBindComboBox(x => x.Date == DateTime.Today, 6, "Date"); var config = XmlUtil.DeserializeFromFile(); workUnitSelect.EBindComboBox(x => x.ID == config.WorkUnitID); @@ -100,28 +100,27 @@ namespace ButcherFactory.CarcassTakeOut_ })); } - bool noCode = false; + List goodsBtns = new List(); 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 += (sender, e) => - { - if (batchID == null) - throw new Exception("请先选择批次"); - if (!noCode) - throw new Exception("如果无码请先点击无码按钮"); - var c = sender as UButton; - Insert(null, (long)c.Tag, c.Text); - noBarCode_Click(sender, EventArgs.Empty); - noBarCode.AsClicked = false; - }; + btn.Click += GoodsBtnClick; + goodsBtns.Add(btn); flowLayoutPanel1.Controls.Add(btn); } } + void GoodsBtnClick(object sender, EventArgs e) + { + if (batchID == null) + throw new Exception("请先选择批次"); + var c = sender as UButton; + Insert(null, (long)c.Tag, c.Text); + } + void BindGrid() { weightList = CarcassTakeOutBL.GetWeightList(); @@ -199,9 +198,20 @@ namespace ButcherFactory.CarcassTakeOut_ var barCode = uScanPanel1.TextBox.Text.Trim(); if (string.IsNullOrEmpty(barCode)) throw new Exception("请先扫码"); - if (barCode.Length != 23) - throw new Exception("条码格式不正确"); - Insert(barCode, null, null); + if (barCode.StartsWith("G")) + { + var gId = barCode.TrimStart('G'); + var first = goodsBtns.FirstOrDefault(x => x.Tag.ToString() == gId); + if (first == null) + throw new Exception(string.Format("没找到ID为{0}的存货", gId)); + GoodsBtnClick(first, EventArgs.Empty); + } + else + { + if (barCode.Length != 23) + throw new Exception("条码格式不正确"); + Insert(barCode, null, null); + } } void Insert(string barCode, long? goodsID, string goodsName) @@ -212,7 +222,9 @@ namespace ButcherFactory.CarcassTakeOut_ if (string.IsNullOrEmpty(barCode)) entity.Goods_Name = goodsName; needSubmitedList.Insert(0, entity); + needSubmitGrid.FirstDisplayedScrollingRowIndex = 0; needSubmitGrid.Refresh(); + uScanPanel1.TextBox.Clear(); } private void closeBtn_Click(object sender, EventArgs e) @@ -253,11 +265,5 @@ namespace ButcherFactory.CarcassTakeOut_ weightGrid.FirstDisplayedScrollingRowIndex = 0; weightGrid.Refresh(); } - - private void noBarCode_Click(object sender, EventArgs e) - { - noCode = !noCode; - noBarCode.Text = noCode ? "等待插入" : "无 码"; - } } } diff --git a/ButcherFactory.Form/CarcassTakeOut_/CarcassTakeOutForm.resx b/ButcherFactory.Form/CarcassTakeOut_/CarcassTakeOutForm.resx index fd4a836..441ddc6 100644 --- a/ButcherFactory.Form/CarcassTakeOut_/CarcassTakeOutForm.resx +++ b/ButcherFactory.Form/CarcassTakeOut_/CarcassTakeOutForm.resx @@ -118,14 +118,6 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - iVBORw0KGgoAAAANSUhEUgAAAGAAAAAwCAIAAABhdOiYAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO - wwAADsMBx2+oZAAAAHNJREFUaEPt0AENACAMwDAkowVB14aDz0CTKui5b1gICoKCoCAoCAqCgqAgKAgK - goKgICgICoKCoCAoCAqCgqAgKAgKgoKgICgICoKCoCAoCAqCgqAgKAgKgoKgICgICoKCoCAoCAqCgqAg - KAgKgoKg1ZsPvpCB0hBohjQAAAAASUVORK5CYII= - - iVBORw0KGgoAAAANSUhEUgAAAGAAAAAwCAIAAABhdOiYAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO diff --git a/ButcherFactory.Form/Dialogs/CalendarSelecter.xaml b/ButcherFactory.Form/Dialogs/CalendarSelecter.xaml new file mode 100644 index 0000000..04a8685 --- /dev/null +++ b/ButcherFactory.Form/Dialogs/CalendarSelecter.xaml @@ -0,0 +1,730 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ButcherFactory.Form/Dialogs/CalendarSelecter.xaml.cs b/ButcherFactory.Form/Dialogs/CalendarSelecter.xaml.cs new file mode 100644 index 0000000..7938536 --- /dev/null +++ b/ButcherFactory.Form/Dialogs/CalendarSelecter.xaml.cs @@ -0,0 +1,61 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace ButcherFactory.Dialogs +{ + /// + /// CalendarSelecter.xaml 的交互逻辑 + /// + public partial class CalendarSelecter : Window, INotifyPropertyChanged + { + public CalendarSelecter() + { + InitializeComponent(); + } + + public void DragWindow(object sender, MouseButtonEventArgs args) + { + this.DragMove(); + } + + private DateTime _result; + public DateTime Result + { + get { return _result; } + private set { _result = value; OnPropertyChanged("Result"); } + } + + private void MC_SelectedDatesChanged(object sender, EventArgs e) + { + Result = MC.SelectedDate.Value; + DialogResult = true; + } + + public event PropertyChangedEventHandler PropertyChanged; + protected void OnPropertyChanged(string propertyName) + { + if (PropertyChanged != null) + PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + + private void imgToday_Initialized(object sender, EventArgs e) + { + var imagePanel = (sender as Image); + var path = System.IO.Path.Combine(Environment.CurrentDirectory, "Images", "today.png"); + imagePanel.Source = new BitmapImage(new Uri(path, UriKind.Absolute)); ; + } + } +} diff --git a/ButcherFactory.Form/Dialogs/SelectBillStateDialog.Designer.cs b/ButcherFactory.Form/Dialogs/SelectBillStateDialog.Designer.cs new file mode 100644 index 0000000..4177788 --- /dev/null +++ b/ButcherFactory.Form/Dialogs/SelectBillStateDialog.Designer.cs @@ -0,0 +1,155 @@ +namespace ButcherFactory.Dialogs +{ + partial class SelectBillStateDialog + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SelectBillStateDialog)); + this.uButton1 = new WinFormControl.UButton(); + this.uButton2 = new WinFormControl.UButton(); + this.uButton3 = new WinFormControl.UButton(); + this.uButton4 = new WinFormControl.UButton(); + this.SuspendLayout(); + // + // uButton1 + // + this.uButton1.AsClicked = false; + this.uButton1.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("uButton1.BackgroundImage"))); + this.uButton1.EnableGroup = false; + this.uButton1.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(45)))), ((int)(((byte)(155)))), ((int)(((byte)(214))))); + this.uButton1.FlatAppearance.BorderSize = 0; + this.uButton1.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.uButton1.Font = new System.Drawing.Font("宋体", 12F); + this.uButton1.ForeColor = System.Drawing.Color.Black; + this.uButton1.Location = new System.Drawing.Point(63, 36); + this.uButton1.Name = "uButton1"; + this.uButton1.PlaySound = false; + this.uButton1.SelfControlEnable = false; + this.uButton1.Size = new System.Drawing.Size(120, 75); + this.uButton1.SoundType = WinFormControl.SoundType.Click; + this.uButton1.TabIndex = 0; + this.uButton1.Tag = "0"; + this.uButton1.Text = "未审核"; + this.uButton1.UseVisualStyleBackColor = true; + this.uButton1.WithStataHode = false; + this.uButton1.Click += new System.EventHandler(this.BtnClick); + // + // uButton2 + // + this.uButton2.AsClicked = false; + this.uButton2.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("uButton2.BackgroundImage"))); + this.uButton2.EnableGroup = false; + this.uButton2.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(45)))), ((int)(((byte)(155)))), ((int)(((byte)(214))))); + this.uButton2.FlatAppearance.BorderSize = 0; + this.uButton2.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.uButton2.Font = new System.Drawing.Font("宋体", 12F); + this.uButton2.ForeColor = System.Drawing.Color.Black; + this.uButton2.Location = new System.Drawing.Point(255, 36); + this.uButton2.Name = "uButton2"; + this.uButton2.PlaySound = false; + this.uButton2.SelfControlEnable = false; + this.uButton2.Size = new System.Drawing.Size(120, 75); + this.uButton2.SoundType = WinFormControl.SoundType.Click; + this.uButton2.TabIndex = 1; + this.uButton2.Tag = "20"; + this.uButton2.Text = "已审核"; + this.uButton2.UseVisualStyleBackColor = true; + this.uButton2.WithStataHode = false; + this.uButton2.Click += new System.EventHandler(this.BtnClick); + // + // uButton3 + // + this.uButton3.AsClicked = false; + this.uButton3.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("uButton3.BackgroundImage"))); + this.uButton3.EnableGroup = false; + this.uButton3.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(45)))), ((int)(((byte)(155)))), ((int)(((byte)(214))))); + this.uButton3.FlatAppearance.BorderSize = 0; + this.uButton3.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.uButton3.Font = new System.Drawing.Font("宋体", 12F); + this.uButton3.ForeColor = System.Drawing.Color.Black; + this.uButton3.Location = new System.Drawing.Point(63, 151); + this.uButton3.Name = "uButton3"; + this.uButton3.PlaySound = false; + this.uButton3.SelfControlEnable = false; + this.uButton3.Size = new System.Drawing.Size(120, 75); + this.uButton3.SoundType = WinFormControl.SoundType.Click; + this.uButton3.TabIndex = 2; + this.uButton3.Tag = "30"; + this.uButton3.Text = "已完毕"; + this.uButton3.UseVisualStyleBackColor = true; + this.uButton3.WithStataHode = false; + this.uButton3.Click += new System.EventHandler(this.BtnClick); + // + // uButton4 + // + this.uButton4.AsClicked = false; + this.uButton4.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("uButton4.BackgroundImage"))); + this.uButton4.EnableGroup = false; + this.uButton4.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(45)))), ((int)(((byte)(155)))), ((int)(((byte)(214))))); + this.uButton4.FlatAppearance.BorderSize = 0; + this.uButton4.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.uButton4.Font = new System.Drawing.Font("宋体", 12F); + this.uButton4.ForeColor = System.Drawing.Color.Black; + this.uButton4.Location = new System.Drawing.Point(255, 151); + this.uButton4.Name = "uButton4"; + this.uButton4.PlaySound = false; + this.uButton4.SelfControlEnable = false; + this.uButton4.Size = new System.Drawing.Size(120, 75); + this.uButton4.SoundType = WinFormControl.SoundType.Click; + this.uButton4.TabIndex = 3; + this.uButton4.Tag = "1"; + this.uButton4.Text = "已作废"; + this.uButton4.UseVisualStyleBackColor = true; + this.uButton4.WithStataHode = false; + this.uButton4.Click += new System.EventHandler(this.BtnClick); + // + // SelectBillStateDialog + // + 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(445, 263); + this.Controls.Add(this.uButton4); + this.Controls.Add(this.uButton3); + this.Controls.Add(this.uButton2); + this.Controls.Add(this.uButton1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.Name = "SelectBillStateDialog"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "单据状态"; + this.ResumeLayout(false); + + } + + #endregion + + private WinFormControl.UButton uButton1; + private WinFormControl.UButton uButton2; + private WinFormControl.UButton uButton3; + private WinFormControl.UButton uButton4; + } +} \ No newline at end of file diff --git a/ButcherFactory.Form/Dialogs/SelectBillStateDialog.cs b/ButcherFactory.Form/Dialogs/SelectBillStateDialog.cs new file mode 100644 index 0000000..205cf2d --- /dev/null +++ b/ButcherFactory.Form/Dialogs/SelectBillStateDialog.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using WinFormControl; + +namespace ButcherFactory.Dialogs +{ + public partial class SelectBillStateDialog : Form + { + public Tuple Result; + public SelectBillStateDialog() + { + InitializeComponent(); + } + + void BtnClick(object sender, EventArgs e) + { + var btn = sender as UButton; + Result = new Tuple(btn.Text, Convert.ToInt32(btn.Tag)); + DialogResult = DialogResult.OK; + this.Close(); + } + } +} diff --git a/ButcherFactory.Form/Dialogs/SelectBillStateDialog.resx b/ButcherFactory.Form/Dialogs/SelectBillStateDialog.resx new file mode 100644 index 0000000..b261e23 --- /dev/null +++ b/ButcherFactory.Form/Dialogs/SelectBillStateDialog.resx @@ -0,0 +1,153 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + + iVBORw0KGgoAAAANSUhEUgAAAGAAAAAwCAIAAABhdOiYAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + wwAADsMBx2+oZAAAAHNJREFUaEPt0AENACAMwDAkowVB14aDz0CTKui5b1gICoKCoCAoCAqCgqAgKAgK + goKgICgICoKCoCAoCAqCgqAgKAgKgoKgICgICoKCoCAoCAqCgqAgKAgKgoKgICgICoKCoCAoCAqCgqAg + KAgKgoKg1ZsPvpCB0hBohjQAAAAASUVORK5CYII= + + + + + iVBORw0KGgoAAAANSUhEUgAAAGAAAAAwCAIAAABhdOiYAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + wwAADsMBx2+oZAAAAHNJREFUaEPt0AENACAMwDAkowVB14aDz0CTKui5b1gICoKCoCAoCAqCgqAgKAgK + goKgICgICoKCoCAoCAqCgqAgKAgKgoKgICgICoKCoCAoCAqCgqAgKAgKgoKgICgICoKCoCAoCAqCgqAg + KAgKgoKg1ZsPvpCB0hBohjQAAAAASUVORK5CYII= + + + + + iVBORw0KGgoAAAANSUhEUgAAAGAAAAAwCAIAAABhdOiYAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + wwAADsMBx2+oZAAAAHNJREFUaEPt0AENACAMwDAkowVB14aDz0CTKui5b1gICoKCoCAoCAqCgqAgKAgK + goKgICgICoKCoCAoCAqCgqAgKAgKgoKgICgICoKCoCAoCAqCgqAgKAgKgoKgICgICoKCoCAoCAqCgqAg + KAgKgoKg1ZsPvpCB0hBohjQAAAAASUVORK5CYII= + + + + + iVBORw0KGgoAAAANSUhEUgAAAGAAAAAwCAIAAABhdOiYAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + wwAADsMBx2+oZAAAAHNJREFUaEPt0AENACAMwDAkowVB14aDz0CTKui5b1gICoKCoCAoCAqCgqAgKAgK + goKgICgICoKCoCAoCAqCgqAgKAgKgoKgICgICoKCoCAoCAqCgqAgKAgKgoKgICgICoKCoCAoCAqCgqAg + KAgKgoKg1ZsPvpCB0hBohjQAAAAASUVORK5CYII= + + + \ No newline at end of file diff --git a/ButcherFactory.Form/Dialogs/SelectCustomerDialog.Designer.cs b/ButcherFactory.Form/Dialogs/SelectCustomerDialog.Designer.cs new file mode 100644 index 0000000..ade2c35 --- /dev/null +++ b/ButcherFactory.Form/Dialogs/SelectCustomerDialog.Designer.cs @@ -0,0 +1,170 @@ +namespace ButcherFactory.Dialogs +{ + partial class SelectCustomerDialog + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SelectCustomerDialog)); + this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); + this.flowLayoutPanel2 = new System.Windows.Forms.FlowLayoutPanel(); + this.flowLayoutPanel3 = new System.Windows.Forms.FlowLayoutPanel(); + this.flowLayoutPanel4 = new System.Windows.Forms.FlowLayoutPanel(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.uButton1 = new WinFormControl.UButton(); + this.searchBtn = new WinFormControl.UButton(); + this.panel1 = new System.Windows.Forms.Panel(); + this.panel1.SuspendLayout(); + this.SuspendLayout(); + // + // flowLayoutPanel1 + // + this.flowLayoutPanel1.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.flowLayoutPanel1.AutoScroll = true; + this.flowLayoutPanel1.Location = new System.Drawing.Point(2, 2); + this.flowLayoutPanel1.Name = "flowLayoutPanel1"; + this.flowLayoutPanel1.Size = new System.Drawing.Size(1000, 278); + this.flowLayoutPanel1.TabIndex = 0; + // + // flowLayoutPanel2 + // + this.flowLayoutPanel2.Location = new System.Drawing.Point(0, 47); + this.flowLayoutPanel2.Name = "flowLayoutPanel2"; + this.flowLayoutPanel2.Size = new System.Drawing.Size(1000, 54); + this.flowLayoutPanel2.TabIndex = 1; + // + // flowLayoutPanel3 + // + this.flowLayoutPanel3.Location = new System.Drawing.Point(26, 114); + this.flowLayoutPanel3.Name = "flowLayoutPanel3"; + this.flowLayoutPanel3.Size = new System.Drawing.Size(974, 54); + this.flowLayoutPanel3.TabIndex = 2; + // + // flowLayoutPanel4 + // + this.flowLayoutPanel4.Location = new System.Drawing.Point(62, 179); + this.flowLayoutPanel4.Name = "flowLayoutPanel4"; + this.flowLayoutPanel4.Size = new System.Drawing.Size(938, 54); + this.flowLayoutPanel4.TabIndex = 3; + // + // textBox1 + // + this.textBox1.Font = new System.Drawing.Font("宋体", 14F); + this.textBox1.Location = new System.Drawing.Point(14, 9); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(194, 29); + this.textBox1.TabIndex = 4; + // + // uButton1 + // + this.uButton1.AsClicked = false; + this.uButton1.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("uButton1.BackgroundImage"))); + this.uButton1.EnableGroup = false; + this.uButton1.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(45)))), ((int)(((byte)(155)))), ((int)(((byte)(214))))); + this.uButton1.FlatAppearance.BorderSize = 0; + this.uButton1.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.uButton1.Font = new System.Drawing.Font("宋体", 12F); + this.uButton1.ForeColor = System.Drawing.Color.Black; + this.uButton1.Location = new System.Drawing.Point(233, 9); + this.uButton1.Name = "uButton1"; + this.uButton1.PlaySound = false; + this.uButton1.SelfControlEnable = false; + this.uButton1.Size = new System.Drawing.Size(80, 30); + this.uButton1.SoundType = WinFormControl.SoundType.Click; + this.uButton1.TabIndex = 5; + this.uButton1.Text = "退格"; + this.uButton1.UseVisualStyleBackColor = true; + this.uButton1.WithStataHode = false; + this.uButton1.Click += new System.EventHandler(this.uButton1_Click); + // + // searchBtn + // + this.searchBtn.AsClicked = false; + this.searchBtn.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("searchBtn.BackgroundImage"))); + this.searchBtn.EnableGroup = false; + this.searchBtn.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(45)))), ((int)(((byte)(155)))), ((int)(((byte)(214))))); + this.searchBtn.FlatAppearance.BorderSize = 0; + this.searchBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.searchBtn.Font = new System.Drawing.Font("宋体", 12F); + this.searchBtn.ForeColor = System.Drawing.Color.Black; + this.searchBtn.Location = new System.Drawing.Point(340, 9); + this.searchBtn.Name = "searchBtn"; + this.searchBtn.PlaySound = false; + this.searchBtn.SelfControlEnable = false; + this.searchBtn.Size = new System.Drawing.Size(80, 30); + this.searchBtn.SoundType = WinFormControl.SoundType.Click; + this.searchBtn.TabIndex = 6; + this.searchBtn.Text = "检索"; + this.searchBtn.UseVisualStyleBackColor = true; + this.searchBtn.WithStataHode = false; + this.searchBtn.Click += new System.EventHandler(this.searchBtn_Click); + // + // panel1 + // + this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.panel1.Controls.Add(this.textBox1); + this.panel1.Controls.Add(this.searchBtn); + this.panel1.Controls.Add(this.flowLayoutPanel2); + this.panel1.Controls.Add(this.uButton1); + this.panel1.Controls.Add(this.flowLayoutPanel3); + this.panel1.Controls.Add(this.flowLayoutPanel4); + this.panel1.Location = new System.Drawing.Point(2, 286); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(1000, 238); + this.panel1.TabIndex = 7; + // + // SelectCustomerDialog + // + 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(1005, 536); + this.Controls.Add(this.panel1); + this.Controls.Add(this.flowLayoutPanel1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.Name = "SelectCustomerDialog"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "选择客户"; + this.panel1.ResumeLayout(false); + this.panel1.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; + private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel2; + private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel3; + private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel4; + private System.Windows.Forms.TextBox textBox1; + private WinFormControl.UButton uButton1; + private WinFormControl.UButton searchBtn; + private System.Windows.Forms.Panel panel1; + } +} \ No newline at end of file diff --git a/ButcherFactory.Form/Dialogs/SelectCustomerDialog.cs b/ButcherFactory.Form/Dialogs/SelectCustomerDialog.cs new file mode 100644 index 0000000..e00a854 --- /dev/null +++ b/ButcherFactory.Form/Dialogs/SelectCustomerDialog.cs @@ -0,0 +1,82 @@ +using ButcherFactory.BO.LocalBL; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using WinFormControl; + +namespace ButcherFactory.Dialogs +{ + public partial class SelectCustomerDialog : Form + { + public Tuple Result; + public SelectCustomerDialog() + { + InitializeComponent(); + InitKeyBoard(); + } + + void InitKeyBoard() + { + var chars = new char[][] { + new char[] { 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P' }, + new char[] { 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L' }, + new char[] { 'Z', 'X', 'C', 'V', 'B', 'N', 'M' } }; + var panel = new FlowLayoutPanel[] { flowLayoutPanel2, flowLayoutPanel3, flowLayoutPanel4 }; + var idx = 0; + foreach (var v in chars) + { + foreach (var c in v) + { + var btn = new UButton() { Width = 80, Height = 50, Text = c.ToString(), Font = new Font("宋体", 15), Margin = new Padding(10) }; + btn.Click += CharClick; + panel[idx].Controls.Add(btn); + } + idx++; + } + } + + void CharClick(object sender, EventArgs e) + { + textBox1.Text += ((UButton)sender).Text; + } + + private void uButton1_Click(object sender, EventArgs e) + { + if (textBox1.Text.Length > 0) + textBox1.Text = textBox1.Text.Substring(0, textBox1.Text.Length - 1); + } + + void InitCustomerBtn() + { + flowLayoutPanel1.Controls.Clear(); + if (string.IsNullOrEmpty(textBox1.Text)) + return; + var customers = DialogBL.GetCustomerList(textBox1.Text.ToLower()); + foreach (var item in customers) + { + var btn = new UButton() { Width = 100, Height = 60, Text = item.StringExt1.ToString(), Tag = item.LongExt1, Font = new Font("宋体", 10), Margin = new Padding(12) }; + btn.Click += CustomerClick; + flowLayoutPanel1.Controls.Add(btn); + } + } + + void CustomerClick(object sender, EventArgs e) + { + var btn = sender as UButton; + Result = new Tuple(btn.Text, Convert.ToInt64(btn.Tag)); + DialogResult = DialogResult.OK; + this.Close(); + } + + private void searchBtn_Click(object sender, EventArgs e) + { + InitCustomerBtn(); + } + } +} diff --git a/ButcherFactory.Form/Dialogs/SelectCustomerDialog.resx b/ButcherFactory.Form/Dialogs/SelectCustomerDialog.resx new file mode 100644 index 0000000..b153618 --- /dev/null +++ b/ButcherFactory.Form/Dialogs/SelectCustomerDialog.resx @@ -0,0 +1,137 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + + iVBORw0KGgoAAAANSUhEUgAAAGAAAAAwCAIAAABhdOiYAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + wwAADsMBx2+oZAAAAHNJREFUaEPt0AENACAMwDAkowVB14aDz0CTKui5b1gICoKCoCAoCAqCgqAgKAgK + goKgICgICoKCoCAoCAqCgqAgKAgKgoKgICgICoKCoCAoCAqCgqAgKAgKgoKgICgICoKCoCAoCAqCgqAg + KAgKgoKg1ZsPvpCB0hBohjQAAAAASUVORK5CYII= + + + + + iVBORw0KGgoAAAANSUhEUgAAAGAAAAAwCAIAAABhdOiYAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + wwAADsMBx2+oZAAAAHNJREFUaEPt0AENACAMwDAkowVB14aDz0CTKui5b1gICoKCoCAoCAqCgqAgKAgK + goKgICgICoKCoCAoCAqCgqAgKAgKgoKgICgICoKCoCAoCAqCgqAgKAgKgoKgICgICoKCoCAoCAqCgqAg + KAgKgoKg1ZsPvpCB0hBohjQAAAAASUVORK5CYII= + + + \ No newline at end of file diff --git a/ButcherFactory.Form/Dialogs/SelectDeliverGoodsLineDialog.Designer.cs b/ButcherFactory.Form/Dialogs/SelectDeliverGoodsLineDialog.Designer.cs new file mode 100644 index 0000000..bf8b61e --- /dev/null +++ b/ButcherFactory.Form/Dialogs/SelectDeliverGoodsLineDialog.Designer.cs @@ -0,0 +1,66 @@ +namespace ButcherFactory.Dialogs +{ + partial class SelectDeliverGoodsLineDialog + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.tabControl1 = new System.Windows.Forms.TabControl(); + this.SuspendLayout(); + // + // tabControl1 + // + this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill; + this.tabControl1.ItemSize = new System.Drawing.Size(0, 60); + this.tabControl1.Location = new System.Drawing.Point(0, 0); + this.tabControl1.Multiline = true; + this.tabControl1.Name = "tabControl1"; + this.tabControl1.Padding = new System.Drawing.Point(20, 3); + this.tabControl1.SelectedIndex = 0; + this.tabControl1.Size = new System.Drawing.Size(1005, 536); + this.tabControl1.TabIndex = 0; + // + // SelectDeliverGoodsLineDialog + // + 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(1005, 536); + this.Controls.Add(this.tabControl1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.Name = "SelectDeliverGoodsLineDialog"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "送货线路"; + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.TabControl tabControl1; + + } +} \ No newline at end of file diff --git a/ButcherFactory.Form/Dialogs/SelectDeliverGoodsLineDialog.cs b/ButcherFactory.Form/Dialogs/SelectDeliverGoodsLineDialog.cs new file mode 100644 index 0000000..129c604 --- /dev/null +++ b/ButcherFactory.Form/Dialogs/SelectDeliverGoodsLineDialog.cs @@ -0,0 +1,62 @@ +using ButcherFactory.BO; +using ButcherFactory.BO.LocalBL; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using WinFormControl; + +namespace ButcherFactory.Dialogs +{ + public partial class SelectDeliverGoodsLineDialog : Form + { + public Tuple Result; + + IEnumerable list; + public SelectDeliverGoodsLineDialog() + { + InitializeComponent(); + list = DialogBL.GetDeliverGoodsLineList(); + tabControl1.Selected += tabControl_Selected; + foreach (var c in list.GroupBy(x => x.StringExt2)) + { + tabControl1.TabPages.Add(c.Key); + } + if (tabControl1.TabPages.Count > 0) + AddButtons(tabControl1.TabPages[0]); + } + + void tabControl_Selected(object sender, TabControlEventArgs e) + { + if (tabControl1.SelectedTab.Controls.Count == 0) + AddButtons(tabControl1.SelectedTab); + } + + private void AddButtons(TabPage tabPage) + { + tabPage.BackColor = Color.White; + var flw = new FlowLayoutPanel() { Dock = DockStyle.Fill, AutoScroll = true }; + var arr = list.Where(x => x.StringExt2 == tabPage.Text); + foreach (var item in arr) + { + var btn = new UButton() { Width = 100, Height = 60, Text = item.StringExt1.ToString(), Tag = item.LongExt1, Font = new Font("宋体", 10), Margin = new Padding(12) }; + btn.Click += btnClick; + flw.Controls.Add(btn); + } + tabPage.Controls.Add(flw); + } + + private void btnClick(object sender, EventArgs e) + { + var btn = sender as UButton; + Result = new Tuple(btn.Text, Convert.ToInt64(btn.Tag)); + DialogResult = DialogResult.OK; + this.Close(); + } + } +} diff --git a/ButcherFactory.Form/Dialogs/SelectDeliverGoodsLineDialog.resx b/ButcherFactory.Form/Dialogs/SelectDeliverGoodsLineDialog.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/ButcherFactory.Form/Dialogs/SelectDeliverGoodsLineDialog.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ButcherFactory.Form/Dialogs/SelectStoreDialog.Designer.cs b/ButcherFactory.Form/Dialogs/SelectStoreDialog.Designer.cs new file mode 100644 index 0000000..f81f06a --- /dev/null +++ b/ButcherFactory.Form/Dialogs/SelectStoreDialog.Designer.cs @@ -0,0 +1,49 @@ +namespace ButcherFactory.Dialogs +{ + partial class SelectStoreDialog + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.SuspendLayout(); + // + // SelectStoreDialog + // + 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(1005, 536); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.Name = "SelectStoreDialog"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "仓库"; + this.ResumeLayout(false); + + } + + #endregion + } +} \ No newline at end of file diff --git a/ButcherFactory.Form/Dialogs/SelectStoreDialog.cs b/ButcherFactory.Form/Dialogs/SelectStoreDialog.cs new file mode 100644 index 0000000..1ba30be --- /dev/null +++ b/ButcherFactory.Form/Dialogs/SelectStoreDialog.cs @@ -0,0 +1,40 @@ +using ButcherFactory.BO.LocalBL; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using WinFormControl; + +namespace ButcherFactory.Dialogs +{ + public partial class SelectStoreDialog : Form + { + public Tuple Result; + public SelectStoreDialog() + { + InitializeComponent(); + var stores = DialogBL.GetStoreList(); + var flw = new FlowLayoutPanel() { Dock = DockStyle.Fill }; + foreach (var item in stores) + { + var btn = new UButton() { Width = 100, Height = 60, Text = item.StringExt1.ToString(), Tag = item.LongExt1, Font = new Font("宋体", 10), Margin = new Padding(12) }; + btn.Click += BtnClick; + flw.Controls.Add(btn); + } + this.Controls.Add(flw); + } + + private void BtnClick(object sender, EventArgs e) + { + var btn = sender as UButton; + Result = new Tuple(btn.Text, Convert.ToInt64(btn.Tag)); + DialogResult = DialogResult.OK; + this.Close(); + } + } +} diff --git a/ButcherFactory.Form/Dialogs/SelectStoreDialog.resx b/ButcherFactory.Form/Dialogs/SelectStoreDialog.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/ButcherFactory.Form/Dialogs/SelectStoreDialog.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ButcherFactory.Form/Dialogs/WeightRecordDialog.Designer.cs b/ButcherFactory.Form/Dialogs/WeightRecordDialog.Designer.cs new file mode 100644 index 0000000..8681aaa --- /dev/null +++ b/ButcherFactory.Form/Dialogs/WeightRecordDialog.Designer.cs @@ -0,0 +1,176 @@ +namespace ButcherFactory.Dialogs +{ + partial class WeightRecordDialog + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle(); + this.uDataGridView1 = new WinFormControl.UDataGridView(); + this.R_BarCode = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.R_Goods_Code = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.R_Goods_Name = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.R_InStoreWeight = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.R_Weight = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.R_DiffWeight = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.R_Time = new System.Windows.Forms.DataGridViewTextBoxColumn(); + ((System.ComponentModel.ISupportInitialize)(this.uDataGridView1)).BeginInit(); + this.SuspendLayout(); + // + // uDataGridView1 + // + this.uDataGridView1.AllowUserToAddRows = false; + this.uDataGridView1.AllowUserToDeleteRows = false; + this.uDataGridView1.AllowUserToResizeColumns = false; + this.uDataGridView1.AllowUserToResizeRows = false; + dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); + this.uDataGridView1.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1; + this.uDataGridView1.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.uDataGridView1.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.uDataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2; + this.uDataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.uDataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.R_BarCode, + this.R_Goods_Code, + this.R_Goods_Name, + this.R_InStoreWeight, + this.R_Weight, + this.R_DiffWeight, + this.R_Time}); + this.uDataGridView1.Location = new System.Drawing.Point(21, 22); + this.uDataGridView1.MultiSelect = false; + this.uDataGridView1.Name = "uDataGridView1"; + this.uDataGridView1.ReadOnly = true; + this.uDataGridView1.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.uDataGridView1.RowsDefaultCellStyle = dataGridViewCellStyle6; + this.uDataGridView1.RowTemplate.Height = 23; + this.uDataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; + this.uDataGridView1.Size = new System.Drawing.Size(782, 470); + this.uDataGridView1.TabIndex = 0; + // + // R_BarCode + // + this.R_BarCode.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells; + this.R_BarCode.DataPropertyName = "BarCode"; + this.R_BarCode.HeaderText = "存货条码"; + this.R_BarCode.MinimumWidth = 100; + this.R_BarCode.Name = "R_BarCode"; + this.R_BarCode.ReadOnly = true; + // + // R_Goods_Code + // + this.R_Goods_Code.DataPropertyName = "Goods_Code"; + this.R_Goods_Code.HeaderText = "产品编码"; + this.R_Goods_Code.Name = "R_Goods_Code"; + this.R_Goods_Code.ReadOnly = true; + // + // R_Goods_Name + // + this.R_Goods_Name.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells; + this.R_Goods_Name.DataPropertyName = "Goods_Name"; + this.R_Goods_Name.HeaderText = "产品名称"; + this.R_Goods_Name.MinimumWidth = 100; + this.R_Goods_Name.Name = "R_Goods_Name"; + this.R_Goods_Name.ReadOnly = true; + // + // R_InStoreWeight + // + this.R_InStoreWeight.DataPropertyName = "InStoreWeight"; + dataGridViewCellStyle3.Format = "#0.######"; + this.R_InStoreWeight.DefaultCellStyle = dataGridViewCellStyle3; + this.R_InStoreWeight.HeaderText = "入库重量"; + this.R_InStoreWeight.Name = "R_InStoreWeight"; + this.R_InStoreWeight.ReadOnly = true; + // + // R_Weight + // + this.R_Weight.DataPropertyName = "Weight"; + dataGridViewCellStyle4.Format = "#0.######"; + this.R_Weight.DefaultCellStyle = dataGridViewCellStyle4; + this.R_Weight.HeaderText = "重量"; + this.R_Weight.Name = "R_Weight"; + this.R_Weight.ReadOnly = true; + // + // R_DiffWeight + // + this.R_DiffWeight.DataPropertyName = "DiffWeight"; + dataGridViewCellStyle5.Format = "#0.######"; + this.R_DiffWeight.DefaultCellStyle = dataGridViewCellStyle5; + this.R_DiffWeight.HeaderText = "差异"; + this.R_DiffWeight.Name = "R_DiffWeight"; + this.R_DiffWeight.ReadOnly = true; + // + // R_Time + // + this.R_Time.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells; + this.R_Time.DataPropertyName = "Time"; + this.R_Time.HeaderText = "时间"; + this.R_Time.MinimumWidth = 120; + this.R_Time.Name = "R_Time"; + this.R_Time.ReadOnly = true; + this.R_Time.Width = 120; + // + // WeightRecordDialog + // + 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(832, 519); + this.Controls.Add(this.uDataGridView1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.Name = "WeightRecordDialog"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "称重记录"; + ((System.ComponentModel.ISupportInitialize)(this.uDataGridView1)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + + private WinFormControl.UDataGridView uDataGridView1; + private System.Windows.Forms.DataGridViewTextBoxColumn R_BarCode; + private System.Windows.Forms.DataGridViewTextBoxColumn R_Goods_Code; + private System.Windows.Forms.DataGridViewTextBoxColumn R_Goods_Name; + private System.Windows.Forms.DataGridViewTextBoxColumn R_InStoreWeight; + private System.Windows.Forms.DataGridViewTextBoxColumn R_Weight; + private System.Windows.Forms.DataGridViewTextBoxColumn R_DiffWeight; + private System.Windows.Forms.DataGridViewTextBoxColumn R_Time; + } +} \ No newline at end of file diff --git a/ButcherFactory.Form/Dialogs/WeightRecordDialog.cs b/ButcherFactory.Form/Dialogs/WeightRecordDialog.cs new file mode 100644 index 0000000..3e4d769 --- /dev/null +++ b/ButcherFactory.Form/Dialogs/WeightRecordDialog.cs @@ -0,0 +1,25 @@ +using ButcherFactory.BO.LocalBL; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace ButcherFactory.Dialogs +{ + public partial class WeightRecordDialog : Form + { + public WeightRecordDialog(long detailID) + { + InitializeComponent(); + uDataGridView1.BorderStyle = BorderStyle.FixedSingle; + var list = CarcassSaleOutBL.GetWeightRecord(detailID); + uDataGridView1.DataSource = list; + uDataGridView1.Refresh(); + } + } +} diff --git a/ButcherFactory.Form/Dialogs/WeightRecordDialog.resx b/ButcherFactory.Form/Dialogs/WeightRecordDialog.resx new file mode 100644 index 0000000..0e12117 --- /dev/null +++ b/ButcherFactory.Form/Dialogs/WeightRecordDialog.resx @@ -0,0 +1,141 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + \ No newline at end of file diff --git a/ButcherFactory.Form/SegmentProduction_/SegmentProductionForm.cs b/ButcherFactory.Form/SegmentProduction_/SegmentProductionForm.cs index 1f9e75b..4043ccb 100644 --- a/ButcherFactory.Form/SegmentProduction_/SegmentProductionForm.cs +++ b/ButcherFactory.Form/SegmentProduction_/SegmentProductionForm.cs @@ -98,7 +98,7 @@ namespace ButcherFactory.SegmentProduction_ BaseInfoSyncRpc.SyncBaseInfo(); BaseInfoSyncRpc.SyncBaseInfo(); } - productBatchSelect.EBindComboBox(x => x.Date == DateTime.Today, 3, "Date"); + productBatchSelect.EBindComboBox(x => x.Date == DateTime.Today, 6, "Date"); var config = XmlUtil.DeserializeFromFile(); workUnitSelect.EBindComboBox(x => x.ID == config.WorkUnitID); diff --git a/ButcherFactory.Login/Login.xaml.cs b/ButcherFactory.Login/Login.xaml.cs index e6b7c78..86f04ea 100644 --- a/ButcherFactory.Login/Login.xaml.cs +++ b/ButcherFactory.Login/Login.xaml.cs @@ -16,7 +16,7 @@ namespace ButcherFactory.Login { InitializeComponent(); #if DEBUG - pwdInput.Password = "123"; + pwdInput.Password = "bwp2017"; #endif try @@ -44,15 +44,16 @@ namespace ButcherFactory.Login LoginUtil.InitRpcFacade(); if (LoginUtil.TestConnection(1000)) { - await Task.Factory.StartNew(() => LoginUtil.Login(username, pwd)); + await Task.Factory.StartNew(() => LoginUtil.Login(username, pwd, AppContext.ConnectInfo.ServerMode)); } else { + if (AppContext.ConnectInfo.ServerMode == 1) + throw new Exception("网络错误"); if (AppContext.Worker.Name != username || string.Join("", LoginUtil.EncodePwd(pwd)) != string.Join("", AppContext.Worker.Password)) throw new Exception("离线时只能使用上次登录信息登录"); } - var form = FormUtil.CreateFrom(); if (form == null) throw new Exception("权限不符"); diff --git a/ButcherFactory.Tools/MainWindow.xaml b/ButcherFactory.Tools/MainWindow.xaml index e7d9f75..b2b1a33 100644 --- a/ButcherFactory.Tools/MainWindow.xaml +++ b/ButcherFactory.Tools/MainWindow.xaml @@ -1,14 +1,16 @@  + Title="BWP_Tools" Height="380" Width="525" ResizeMode="NoResize" >