| @ -0,0 +1,70 @@ | |||||
| using Forks.EnterpriseServices.DomainObjects2; | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Linq; | |||||
| using System.Text; | |||||
| using System.Threading.Tasks; | |||||
| namespace ButcherFactory.BO | |||||
| { | |||||
| public class StockUpEntity | |||||
| { | |||||
| public DateTime Date { get; set; } | |||||
| public long DeliverGoodsLine_ID { get; set; } | |||||
| public string DeliverGoodsLine_Name { get; set; } | |||||
| public long? SequenceNumber { get; set; } | |||||
| public long Goods_ID { get; set; } | |||||
| public string Goods_Name { get; set; } | |||||
| public string Goods_Spec { get; set; } | |||||
| public string Goods_Code { get; set; } | |||||
| public decimal? SecondNumber { get; set; } | |||||
| public decimal? UnitNum { get; set; } | |||||
| public decimal? SSecondNumber { get; set; } | |||||
| public decimal? SUnitNum { get; set; } | |||||
| public decimal? Rate { get; set; } | |||||
| public bool Finishd | |||||
| { | |||||
| get { return (UnitNum ?? 0) <= (SUnitNum ?? 0); } | |||||
| } | |||||
| } | |||||
| public class StockUpDetail | |||||
| { | |||||
| public long ID { get; set; } | |||||
| public DateTime Date { get; set; } | |||||
| public long DeliverGoodsLine_ID { get; set; } | |||||
| public string DeliverGoodsLine_Name { get; set; } | |||||
| public string BarCode { get; set; } | |||||
| [NonDmoProperty] | |||||
| public string ShortCode | |||||
| { | |||||
| get | |||||
| { | |||||
| if (string.IsNullOrEmpty(BarCode)) | |||||
| return null; | |||||
| if (BarCode.Contains("260912011")) | |||||
| return BarCode.Replace("260912011", ""); | |||||
| return BarCode; | |||||
| } | |||||
| } | |||||
| public long Goods_ID { get; set; } | |||||
| public string Goods_Code { get; set; } | |||||
| public string Goods_Spec { get; set; } | |||||
| public string Goods_Name { get; set; } | |||||
| public long SaleOutStoreID { get; set; } | |||||
| public decimal? SecondNumber { get; set; } | |||||
| public decimal? UnitNumber { get; set; } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,73 @@ | |||||
| 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.Linq; | |||||
| using System.Text; | |||||
| using System.Threading.Tasks; | |||||
| namespace ButcherFactory.BO.LocalBL | |||||
| { | |||||
| public static class SegmentStockUpBL | |||||
| { | |||||
| const string RpcPath = @"/MainSystem/B3Sale/Rpcs/"; | |||||
| const string MESPath = @"/MainSystem/B3ClientService/Rpcs/"; | |||||
| /// <summary> | |||||
| /// </summary> | |||||
| /// <param name="code"></param> | |||||
| /// <returns>GoodsCode:StringExt1,Weight:DecimalExt1</returns> | |||||
| public static ExtensionObj StockUpScan(string code) | |||||
| { | |||||
| var json = ButcherFactoryUtil.SimpleMESCall<string>(MESPath + "SegmentInStoreRpc/StockUpScan", code); | |||||
| return JsonConvert.DeserializeObject<ExtensionObj>(json); | |||||
| } | |||||
| public static List<StockUpEntity> GetStockUpEntity(DateTime date, string code) | |||||
| { | |||||
| var json = RpcFacade.Call<string>(RpcPath + "SaleOutStoreRpc/GetSaleOutStoreByGoodsCode", date, code); | |||||
| return JsonConvert.DeserializeObject<List<StockUpEntity>>(json); | |||||
| } | |||||
| public static List<StockUpEntity> RefreshList(DateTime date, IEnumerable<long> goodsIDs) | |||||
| { | |||||
| var json = RpcFacade.Call<string>(RpcPath + "SaleOutStoreRpc/GetSaleOutStoreByGoodsIDs", date, JsonConvert.SerializeObject(goodsIDs)); | |||||
| return JsonConvert.DeserializeObject<List<StockUpEntity>>(json); | |||||
| } | |||||
| public static bool CheckBarCodeUsed(string barCode) | |||||
| { | |||||
| return RpcFacade.Call<bool>(RpcPath + "SaleOutStoreRpc/CheckBarCodeUsed",barCode); | |||||
| } | |||||
| public static List<StockUpDetail> GetDetails(DateTime date, long driverLineID, long goodsID) | |||||
| { | |||||
| var json = RpcFacade.Call<string>(RpcPath + "SaleOutStoreRpc/GetStockUpDetails", date, driverLineID, goodsID); | |||||
| return JsonConvert.DeserializeObject<List<StockUpDetail>>(json); | |||||
| } | |||||
| public static void InsertStockUpDetail(StockUpDetail detail) | |||||
| { | |||||
| var min = new MinStockUpDetail() { BarCode = detail.BarCode, SecondNumber = detail.SecondNumber, UnitNumber = detail.UnitNumber }; | |||||
| var json = JsonConvert.SerializeObject(min); | |||||
| var bkJson = RpcFacade.Call<string>(RpcPath + "SaleOutStoreRpc/InsertStockUpDetail", detail.Date, detail.Goods_ID, detail.DeliverGoodsLine_ID, json); | |||||
| if (string.IsNullOrEmpty(bkJson)) | |||||
| throw new Exception("无等待备货信息"); | |||||
| var backInfo = JsonConvert.DeserializeObject<ExtensionObj>(bkJson); | |||||
| detail.SaleOutStoreID = backInfo.LongExt1.Value; | |||||
| detail.ID = backInfo.LongExt2.Value; | |||||
| } | |||||
| class MinStockUpDetail | |||||
| { | |||||
| public string BarCode { get; set; } | |||||
| public decimal? SecondNumber { get; set; } | |||||
| public decimal? UnitNumber { get; set; } | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,454 @@ | |||||
| using ButcherFactory.BO; | |||||
| using ButcherFactory.BO.LocalBL; | |||||
| using ButcherFactory.BO.Utils; | |||||
| using ButcherFactory.CarcassSaleOut_; | |||||
| using ButcherFactory.Controls; | |||||
| using ButcherFactory.Dialogs; | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.ComponentModel; | |||||
| using System.Data; | |||||
| using System.Drawing; | |||||
| using System.Linq; | |||||
| using System.Text; | |||||
| using System.Threading; | |||||
| using System.Threading.Tasks; | |||||
| using System.Windows.Forms; | |||||
| namespace ButcherFactory.CarcassSaleOut2_ | |||||
| { | |||||
| public partial class CarcassSaleOutForm : FormTemplate, IWithRoleForm | |||||
| { | |||||
| #region IWithRoleForm | |||||
| public List<short> RoleName | |||||
| { | |||||
| get { return new List<short> { (short)设备类别.白条发货 }; } | |||||
| } | |||||
| public Form Generate() | |||||
| { | |||||
| return this; | |||||
| } | |||||
| #endregion | |||||
| BindingList<SaleOutStore> saleOutStoreList; | |||||
| BindingList<SaleOutStore_Detail> details; | |||||
| BindingList<CarcassSaleOut_Detail> weightRecord; | |||||
| Thread checkWeight; | |||||
| string strErrorWeight = ""; | |||||
| List<int> errorWeight = new List<int>(); | |||||
| internal DateTime sendTime = DateTime.Today; | |||||
| internal long? deliverGoodsLineID; | |||||
| internal long? customerID; | |||||
| internal int billState; | |||||
| internal long? storeID; | |||||
| long? batchID; | |||||
| bool already = false; | |||||
| bool scanCode = false; | |||||
| public CarcassSaleOutForm() | |||||
| { | |||||
| InitializeComponent(); | |||||
| this.FormClosing += delegate | |||||
| { | |||||
| if (checkWeight != null && checkWeight.IsAlive) | |||||
| checkWeight.Abort(); | |||||
| }; | |||||
| weightControl1.ReceivedValue += weightControl1_ReceivedValue; | |||||
| uScanPanel1.AfterScan += uScanPanel1_AfterScan; | |||||
| productBatchSelect.SelectedIndexChanged += delegate | |||||
| { | |||||
| if (productBatchSelect.SelectedValue == null) | |||||
| batchID = null; | |||||
| else | |||||
| batchID = (long)productBatchSelect.SelectedValue; | |||||
| }; | |||||
| sendGridView.CellFormatting += sendGridView_CellFormatting; | |||||
| } | |||||
| static Image CheckImg = System.Drawing.Image.FromFile("Images\\check.png"); | |||||
| static Image UnCheckImg = System.Drawing.Image.FromFile("Images\\uCheck.png"); | |||||
| void sendGridView_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) | |||||
| { | |||||
| if (e.RowIndex < 0 || e.ColumnIndex != 2) | |||||
| return; | |||||
| var v = (bool)sendGridView.Rows[e.RowIndex].Cells[1].Value; | |||||
| e.Value = v ? CheckImg : UnCheckImg; | |||||
| } | |||||
| protected override void OnLoad(EventArgs e) | |||||
| { | |||||
| base.OnLoad(e); | |||||
| billState = 0; | |||||
| billStateBox.Text = "未审核"; | |||||
| sendDateBox.Text = sendTime.ToString("yyyy-MM-dd"); | |||||
| var config = XmlUtil.DeserializeFromFile<CarcassSaleOutFormConfig>(); | |||||
| if (config.Store_ID.HasValue) | |||||
| { | |||||
| storeBox.Text = config.Store_Name; | |||||
| storeID = config.Store_ID; | |||||
| } | |||||
| if (!string.IsNullOrEmpty(config.Weight)) | |||||
| { | |||||
| strErrorWeight = config.Weight; | |||||
| var arr = strErrorWeight.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).OrderBy(x => x); | |||||
| errorWeight.AddRange(arr); | |||||
| } | |||||
| BindWeightRecord(); | |||||
| BindProductBatch(); | |||||
| } | |||||
| void BindWeightRecord() | |||||
| { | |||||
| weightRecord = CarcassSaleOutBL.GetUnSubmitWeightRecord(); | |||||
| sendGridView.DataSource = weightRecord; | |||||
| sendGridView.Refresh(); | |||||
| } | |||||
| private void BindProductBatch() | |||||
| { | |||||
| var batchs = CarcassSaleOutBL.GetBatchFromEMS(); | |||||
| productBatchSelect.DisplayMember = "Name"; | |||||
| productBatchSelect.ValueMember = "ID"; | |||||
| productBatchSelect.DataSource = batchs; | |||||
| var idx = batchs.FindIndex(x => x.Date == DateTime.Today); | |||||
| if (idx > 0) | |||||
| productBatchSelect.SelectedIndex = idx; | |||||
| productBatchSelect.Refresh(); | |||||
| } | |||||
| static object _lock = new object(); | |||||
| void weightControl1_ReceivedValue(decimal weight) | |||||
| { | |||||
| lock (_lock) | |||||
| { | |||||
| this.Invoke(new Action(() => | |||||
| { | |||||
| var detail = CarcassSaleOutBL.Insert(weight); | |||||
| if (weightRecord.Any()) | |||||
| detail.Idx = weightRecord.Max(x => x.Idx) + 1; | |||||
| else | |||||
| detail.Idx = 1; | |||||
| weightRecord.Insert(0, detail); | |||||
| sendGridView.FirstDisplayedScrollingRowIndex = 0; | |||||
| if (!scanCode) | |||||
| AfterScan("G8536"); | |||||
| else | |||||
| sendGridView.Refresh(); | |||||
| checkWeight = new Thread(new ParameterizedThreadStart(CheckWeight)); | |||||
| checkWeight.Start(weight); | |||||
| })); | |||||
| } | |||||
| } | |||||
| void CheckWeight(object objWeight) | |||||
| { | |||||
| decimal weight = (decimal)objWeight; | |||||
| var first = errorWeight.FirstOrDefault(x => x > weight); | |||||
| if (first != 0) | |||||
| WinFormControl.SoundPalyUtil.PlaySound(string.Format("Sounds\\l{0}.wav", first)); | |||||
| } | |||||
| void uScanPanel1_AfterScan() | |||||
| { | |||||
| var barCode = uScanPanel1.TextBox.Text.Trim(); | |||||
| if (!barCode.StartsWith("G") && weightRecord.Any(x => x.BarCode == barCode)) | |||||
| return; | |||||
| AfterScan(barCode); | |||||
| } | |||||
| void AfterScan(string barCode) | |||||
| { | |||||
| if (string.IsNullOrEmpty(barCode)) | |||||
| throw new Exception("条码错误"); | |||||
| var first = weightRecord.LastOrDefault(x => !x.Filled); | |||||
| if (first == null) | |||||
| return; | |||||
| //throw new Exception("请先过磅"); | |||||
| CarcassSaleOutBL.FillDetail(first, barCode, batchID); | |||||
| WinFormControl.SoundPalyUtil.PlaySound(WinFormControl.SoundType.Click); | |||||
| sendGridView.Refresh(); | |||||
| } | |||||
| private void refreshBtn_Click(object sender, EventArgs e) | |||||
| { | |||||
| already = false; | |||||
| Refersh(); | |||||
| } | |||||
| private void weightRecordBtn_Click(object sender, EventArgs e) | |||||
| { | |||||
| if (orderGridView.CurrentRow == null) | |||||
| throw new Exception("请选择配货明细"); | |||||
| var detail = orderGridView.CurrentRow.DataBoundItem as SaleOutStore_Detail; | |||||
| var dg = new WeightRecordDialog(details.First(x => x.ID == detail.ID), already, batchID); | |||||
| dg.ShowDialog(); | |||||
| if (dg.Changed) | |||||
| BindOrderGrid(detail.SaleOutStore_ID); | |||||
| if (dg.rolBack) | |||||
| BindWeightRecord(); | |||||
| } | |||||
| private void goodsFinishBtn_Click(object sender, EventArgs e) | |||||
| { | |||||
| if (mainGridView.CurrentRow == null) | |||||
| throw new Exception("请选择要配货完成的发货单"); | |||||
| var id = (long)mainGridView.CurrentRow.Cells[0].Value; | |||||
| var ds = CarcassSaleOutBL.GetSaleOutStoreDetailList(id); | |||||
| if (ds.Any(x => x.SSecondNumber == null || x.SSecondNumber == 0)) | |||||
| { | |||||
| if (MessageBox.Show("有未配货的明细,确认配货完成?", "配货完成确认", MessageBoxButtons.OKCancel) != DialogResult.OK) | |||||
| return; | |||||
| } | |||||
| CarcassSaleOutBL.SetGoodsFinish(id); | |||||
| AfterChangeFinishGoods(id); | |||||
| MessageBox.Show("配货完成!"); | |||||
| } | |||||
| private void unFinishBtn_Click(object sender, EventArgs e) | |||||
| { | |||||
| if (mainGridView.CurrentRow == null) | |||||
| throw new Exception("请选择要配货完成的发货单"); | |||||
| var id = (long)mainGridView.CurrentRow.Cells[0].Value; | |||||
| CarcassSaleOutBL.SetGoodsUnFinish(id); | |||||
| AfterChangeFinishGoods(id); | |||||
| MessageBox.Show("撤销成功!"); | |||||
| } | |||||
| private void AfterChangeFinishGoods(long id) | |||||
| { | |||||
| saleOutStoreList.Remove(saleOutStoreList.First(x => x.ID == id)); | |||||
| mainGridView.Refresh(); | |||||
| if (details != null) | |||||
| details.Clear(); | |||||
| orderGridView.Refresh(); | |||||
| billIDLabel.Text = string.Empty; | |||||
| customerLabel.Text = string.Empty; | |||||
| addressLabel.Text = string.Empty; | |||||
| carNumberLabel.Text = string.Empty; | |||||
| } | |||||
| private void commitBtn_Click(object sender, EventArgs e) | |||||
| { | |||||
| if (orderGridView.CurrentRow == null) | |||||
| throw new Exception("请选择配货明细"); | |||||
| var subList = weightRecord.Where(x => x.Selected).ToList(); | |||||
| if (subList.Count() == 0) | |||||
| throw new Exception("没有发货明细"); | |||||
| if (subList.Any(x => !x.Filled)) | |||||
| throw new Exception("有未扫码的明细"); | |||||
| var detailID = (long)orderGridView.CurrentRow.Cells[0].Value; | |||||
| var detail = details.First(x => x.ID == detailID); | |||||
| CarcassSaleOutBL.SubmitDetails(subList, detail); | |||||
| foreach (var item in subList) | |||||
| weightRecord.Remove(item); | |||||
| var idx = weightRecord.Count; | |||||
| foreach (var item in weightRecord) | |||||
| { | |||||
| item.Idx = idx; | |||||
| idx--; | |||||
| } | |||||
| sendGridView.Refresh(); | |||||
| orderGridView.Refresh(); | |||||
| MessageBox.Show("提交成功!"); | |||||
| } | |||||
| private void queryControl_MouseDown(object sender, MouseEventArgs e) | |||||
| { | |||||
| var simpleLbl = sender as Label; | |||||
| switch (simpleLbl.Name) | |||||
| { | |||||
| case "sendDateBox": | |||||
| var cs = new CalendarSelecter(); | |||||
| if (cs.ShowDialog() == true) | |||||
| { | |||||
| sendTime = cs.Result; | |||||
| sendDateBox.Text = sendTime.ToString("yyyy-MM-dd"); | |||||
| } | |||||
| break; | |||||
| case "deliverGoodsLineBox": | |||||
| var dgl = new SelectDeliverGoodsLineDialog(); | |||||
| if (dgl.ShowDialog() == DialogResult.OK) | |||||
| { | |||||
| simpleLbl.Text = dgl.Result.Item1; | |||||
| deliverGoodsLineID = dgl.Result.Item2; | |||||
| } | |||||
| break; | |||||
| case "customerBox": | |||||
| var cb = new SelectCustomerDialog(); | |||||
| if (cb.ShowDialog() == DialogResult.OK) | |||||
| { | |||||
| simpleLbl.Text = cb.Result.Item1; | |||||
| customerID = cb.Result.Item2; | |||||
| } | |||||
| break; | |||||
| case "billStateBox": | |||||
| var bs = new SelectBillStateDialog(); | |||||
| if (bs.ShowDialog() == DialogResult.OK) | |||||
| { | |||||
| simpleLbl.Text = bs.Result.Item1; | |||||
| billState = bs.Result.Item2; | |||||
| } | |||||
| break; | |||||
| case "storeBox": | |||||
| var sb = new SelectStoreDialog(); | |||||
| if (sb.ShowDialog() == DialogResult.OK) | |||||
| { | |||||
| simpleLbl.Text = sb.Result.Item1; | |||||
| storeID = sb.Result.Item2; | |||||
| XmlUtil.SerializerObjToFile(new CarcassSaleOutFormConfig { Weight = strErrorWeight, Store_ID = storeID, Store_Name = simpleLbl.Text }); | |||||
| } | |||||
| break; | |||||
| } | |||||
| } | |||||
| private void clearBtn_Click(object sender, EventArgs e) | |||||
| { | |||||
| billState = 0; | |||||
| billStateBox.Text = "未审核"; | |||||
| sendTime = DateTime.Today; | |||||
| sendDateBox.Text = sendTime.ToString("yyyy-MM-dd"); | |||||
| deliverGoodsLineBox.Text = string.Empty; | |||||
| deliverGoodsLineID = null; | |||||
| customerBox.Text = string.Empty; | |||||
| customerID = null; | |||||
| storeBox.Text = string.Empty; | |||||
| storeID = null; | |||||
| } | |||||
| private void mainGridView_CellClick(object sender, DataGridViewCellEventArgs e) | |||||
| { | |||||
| var id = (long)mainGridView.CurrentRow.Cells[0].Value; | |||||
| var first = saleOutStoreList.First(x => x.ID == id); | |||||
| billIDLabel.Text = id.ToString(); | |||||
| customerLabel.Text = first.Customer_Name; | |||||
| addressLabel.Text = first.Address; | |||||
| carNumberLabel.Text = first.CarNumber; | |||||
| BindOrderGrid(null); | |||||
| } | |||||
| void BindOrderGrid(long? detailID) | |||||
| { | |||||
| var id = long.Parse(billIDLabel.Text); | |||||
| details = CarcassSaleOutBL.GetSaleOutStoreDetailList(id); | |||||
| foreach (var item in details) | |||||
| { | |||||
| item.SaleOutStore_ID = id; | |||||
| item.Customer_Name = customerLabel.Text; | |||||
| } | |||||
| orderGridView.DataSource = details; | |||||
| if (detailID.HasValue) | |||||
| { | |||||
| foreach (DataGridViewRow row in orderGridView.Rows) | |||||
| { | |||||
| if ((long)row.Cells[0].Value == detailID) | |||||
| { | |||||
| row.Selected = true; | |||||
| break; | |||||
| } | |||||
| } | |||||
| } | |||||
| else | |||||
| { | |||||
| if (details.Any()) | |||||
| orderGridView.FirstDisplayedScrollingRowIndex = 0; | |||||
| } | |||||
| orderGridView.Refresh(); | |||||
| } | |||||
| private void alreadyViewBtn_Click(object sender, EventArgs e) | |||||
| { | |||||
| already = true; | |||||
| Refersh(); | |||||
| } | |||||
| void Refersh() | |||||
| { | |||||
| commitBtn.Enabled = !already; | |||||
| goodsFinishBtn.Enabled = !already; | |||||
| unFinishBtn.Enabled = already; | |||||
| if (details != null) | |||||
| { | |||||
| details.Clear(); | |||||
| orderGridView.Refresh(); | |||||
| } | |||||
| saleOutStoreList = CarcassSaleOutBL.GetSaleOutStoreList(sendTime, deliverGoodsLineID, customerID, billState, storeID, already); | |||||
| mainGridView.DataSource = saleOutStoreList; | |||||
| mainGridView.Refresh(); | |||||
| } | |||||
| private void deleteBtn_Click(object sender, EventArgs e) | |||||
| { | |||||
| if (sendGridView.CurrentRow == null) | |||||
| return; | |||||
| var id = (long)sendGridView.CurrentRow.Cells[0].Value; | |||||
| CarcassSaleOutBL.Delete(id); | |||||
| var tag = weightRecord.First(x => x.ID == id); | |||||
| weightRecord.Remove(tag); | |||||
| foreach (var item in weightRecord.Where(x => x.Idx > tag.Idx)) | |||||
| item.Idx -= 1; | |||||
| sendGridView.Refresh(); | |||||
| } | |||||
| private void orderGridView_RowPrePaint(object sender, DataGridViewRowPrePaintEventArgs e) | |||||
| { | |||||
| DataGridViewRow dgrSingle = orderGridView.Rows[e.RowIndex]; | |||||
| var v = (decimal?)dgrSingle.Cells["D_SNumber"].Value; | |||||
| if (v.HasValue && v > 0) | |||||
| { | |||||
| dgrSingle.DefaultCellStyle.BackColor = Color.YellowGreen; | |||||
| } | |||||
| } | |||||
| private void sendGridView_CellClick(object sender, DataGridViewCellEventArgs e) | |||||
| { | |||||
| if (e.RowIndex < 0) | |||||
| return; | |||||
| var id = (long)sendGridView.CurrentRow.Cells[0].Value; | |||||
| var first = weightRecord.First(x => x.ID == id); | |||||
| first.Selected = !first.Selected; | |||||
| sendGridView.Refresh(); | |||||
| } | |||||
| private void halfBtn_Click(object sender, EventArgs e) | |||||
| { | |||||
| SetWeightNumber(0.5m); | |||||
| } | |||||
| private void fullBtn_Click(object sender, EventArgs e) | |||||
| { | |||||
| SetWeightNumber(1); | |||||
| } | |||||
| private void SetWeightNumber(decimal number) | |||||
| { | |||||
| if (sendGridView.CurrentRow == null) | |||||
| return; | |||||
| var id = (long)sendGridView.CurrentRow.Cells[0].Value; | |||||
| CarcassSaleOutBL.UpdateWeightNumber(id, number); | |||||
| var first = weightRecord.First(x => x.ID == id); | |||||
| first.Selected = true; | |||||
| first.Number = number; | |||||
| sendGridView.Refresh(); | |||||
| } | |||||
| private void scanCodeBtn_Click(object sender, EventArgs e) | |||||
| { | |||||
| scanCode = !scanCode; | |||||
| scanCodeBtn.Text = scanCode ? "扫码发货" : "自动发货"; | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,198 @@ | |||||
| <?xml version="1.0" encoding="utf-8"?> | |||||
| <root> | |||||
| <!-- | |||||
| Microsoft ResX Schema | |||||
| Version 2.0 | |||||
| The primary goals of this format is to allow a simple XML format | |||||
| that is mostly human readable. The generation and parsing of the | |||||
| various data types are done through the TypeConverter classes | |||||
| associated with the data types. | |||||
| Example: | |||||
| ... ado.net/XML headers & schema ... | |||||
| <resheader name="resmimetype">text/microsoft-resx</resheader> | |||||
| <resheader name="version">2.0</resheader> | |||||
| <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> | |||||
| <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> | |||||
| <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> | |||||
| <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> | |||||
| <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> | |||||
| <value>[base64 mime encoded serialized .NET Framework object]</value> | |||||
| </data> | |||||
| <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> | |||||
| <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> | |||||
| <comment>This is a comment</comment> | |||||
| </data> | |||||
| There are any number of "resheader" rows that contain simple | |||||
| name/value pairs. | |||||
| Each data row contains a name, and value. The row also contains a | |||||
| type or mimetype. Type corresponds to a .NET class that support | |||||
| text/value conversion through the TypeConverter architecture. | |||||
| Classes that don't support this are serialized and stored with the | |||||
| mimetype set. | |||||
| The mimetype is used for serialized objects, and tells the | |||||
| ResXResourceReader how to depersist the object. This is currently not | |||||
| extensible. For a given mimetype the value must be set accordingly: | |||||
| Note - application/x-microsoft.net.object.binary.base64 is the format | |||||
| that the ResXResourceWriter will generate, however the reader can | |||||
| read any of the formats listed below. | |||||
| mimetype: application/x-microsoft.net.object.binary.base64 | |||||
| value : The object must be serialized with | |||||
| : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter | |||||
| : and then encoded with base64 encoding. | |||||
| mimetype: application/x-microsoft.net.object.soap.base64 | |||||
| value : The object must be serialized with | |||||
| : System.Runtime.Serialization.Formatters.Soap.SoapFormatter | |||||
| : and then encoded with base64 encoding. | |||||
| mimetype: application/x-microsoft.net.object.bytearray.base64 | |||||
| value : The object must be serialized into a byte array | |||||
| : using a System.ComponentModel.TypeConverter | |||||
| : and then encoded with base64 encoding. | |||||
| --> | |||||
| <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> | |||||
| <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> | |||||
| <xsd:element name="root" msdata:IsDataSet="true"> | |||||
| <xsd:complexType> | |||||
| <xsd:choice maxOccurs="unbounded"> | |||||
| <xsd:element name="metadata"> | |||||
| <xsd:complexType> | |||||
| <xsd:sequence> | |||||
| <xsd:element name="value" type="xsd:string" minOccurs="0" /> | |||||
| </xsd:sequence> | |||||
| <xsd:attribute name="name" use="required" type="xsd:string" /> | |||||
| <xsd:attribute name="type" type="xsd:string" /> | |||||
| <xsd:attribute name="mimetype" type="xsd:string" /> | |||||
| <xsd:attribute ref="xml:space" /> | |||||
| </xsd:complexType> | |||||
| </xsd:element> | |||||
| <xsd:element name="assembly"> | |||||
| <xsd:complexType> | |||||
| <xsd:attribute name="alias" type="xsd:string" /> | |||||
| <xsd:attribute name="name" type="xsd:string" /> | |||||
| </xsd:complexType> | |||||
| </xsd:element> | |||||
| <xsd:element name="data"> | |||||
| <xsd:complexType> | |||||
| <xsd:sequence> | |||||
| <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | |||||
| <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> | |||||
| </xsd:sequence> | |||||
| <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> | |||||
| <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> | |||||
| <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> | |||||
| <xsd:attribute ref="xml:space" /> | |||||
| </xsd:complexType> | |||||
| </xsd:element> | |||||
| <xsd:element name="resheader"> | |||||
| <xsd:complexType> | |||||
| <xsd:sequence> | |||||
| <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | |||||
| </xsd:sequence> | |||||
| <xsd:attribute name="name" type="xsd:string" use="required" /> | |||||
| </xsd:complexType> | |||||
| </xsd:element> | |||||
| </xsd:choice> | |||||
| </xsd:complexType> | |||||
| </xsd:element> | |||||
| </xsd:schema> | |||||
| <resheader name="resmimetype"> | |||||
| <value>text/microsoft-resx</value> | |||||
| </resheader> | |||||
| <resheader name="version"> | |||||
| <value>2.0</value> | |||||
| </resheader> | |||||
| <resheader name="reader"> | |||||
| <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | |||||
| </resheader> | |||||
| <resheader name="writer"> | |||||
| <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | |||||
| </resheader> | |||||
| <metadata name="F_ID.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <value>True</value> | |||||
| </metadata> | |||||
| <metadata name="F_Selected.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <value>True</value> | |||||
| </metadata> | |||||
| <metadata name="F_Image.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <value>True</value> | |||||
| </metadata> | |||||
| <metadata name="F_Idx.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <value>True</value> | |||||
| </metadata> | |||||
| <metadata name="F_BarCode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <value>True</value> | |||||
| </metadata> | |||||
| <metadata name="F_GoodsCode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <value>True</value> | |||||
| </metadata> | |||||
| <metadata name="F_Goods_Name.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <value>True</value> | |||||
| </metadata> | |||||
| <metadata name="F_Number.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <value>True</value> | |||||
| </metadata> | |||||
| <metadata name="F_InStoreWeight.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <value>True</value> | |||||
| </metadata> | |||||
| <metadata name="F_Weight.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <value>True</value> | |||||
| </metadata> | |||||
| <metadata name="F_DiffWeight.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <value>True</value> | |||||
| </metadata> | |||||
| <metadata name="F_Time.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <value>True</value> | |||||
| </metadata> | |||||
| <metadata name="D_ID.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <value>True</value> | |||||
| </metadata> | |||||
| <metadata name="D_SaleOutStore_ID.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <value>True</value> | |||||
| </metadata> | |||||
| <metadata name="D_Customer_Name.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <value>True</value> | |||||
| </metadata> | |||||
| <metadata name="D_Goods_Code.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <value>True</value> | |||||
| </metadata> | |||||
| <metadata name="D_Goods_Name.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <value>True</value> | |||||
| </metadata> | |||||
| <metadata name="D_SecondNumber.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <value>True</value> | |||||
| </metadata> | |||||
| <metadata name="D_Number.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <value>True</value> | |||||
| </metadata> | |||||
| <metadata name="D_SSecondNumber.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <value>True</value> | |||||
| </metadata> | |||||
| <metadata name="D_SNumber.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <value>True</value> | |||||
| </metadata> | |||||
| <metadata name="D_DiffNumber.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <value>True</value> | |||||
| </metadata> | |||||
| <metadata name="M_ID.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <value>True</value> | |||||
| </metadata> | |||||
| <metadata name="M_Customer_Name.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <value>True</value> | |||||
| </metadata> | |||||
| <metadata name="M_SendTime.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <value>True</value> | |||||
| </metadata> | |||||
| <metadata name="M_DeliverGoodsLine_Name.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <value>True</value> | |||||
| </metadata> | |||||
| </root> | |||||
| @ -0,0 +1,185 @@ | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.ComponentModel; | |||||
| using System.Drawing; | |||||
| using System.Drawing.Drawing2D; | |||||
| using System.Linq; | |||||
| using System.Text; | |||||
| using System.Threading.Tasks; | |||||
| using System.Windows.Forms; | |||||
| using WinFormControl; | |||||
| namespace ButcherFactory.Controls | |||||
| { | |||||
| class ColorButton : System.Windows.Forms.Button | |||||
| { | |||||
| public ColorButton() | |||||
| { | |||||
| mouseAction = MouseActionType.None; | |||||
| this.SetStyle(ControlStyles.AllPaintingInWmPaint | | |||||
| ControlStyles.DoubleBuffer | | |||||
| ControlStyles.UserPaint, true); | |||||
| this.ForeColor = Color.White; | |||||
| this.BackColor = Color.FromArgb(77, 135, 245); | |||||
| } | |||||
| Color selectedColor = Color.FromArgb(158, 234, 106); | |||||
| [Browsable(true)] | |||||
| public Color SelectedColor | |||||
| { | |||||
| get { return selectedColor; } | |||||
| set { selectedColor = value; } | |||||
| } | |||||
| [DefaultValue(false)] | |||||
| public bool Selected { get; set; } | |||||
| [DefaultValue(false)] | |||||
| public bool EnableGroup { get; set; } | |||||
| [DefaultValue(false)] | |||||
| public bool StateHold { get; set; } | |||||
| [DefaultValue(false)] | |||||
| public bool PlaySound { get; set; } | |||||
| [DefaultValue(false)] | |||||
| public bool SelfControlEnable { get; set; } | |||||
| private int radius=8; | |||||
| [DefaultValue(8)] | |||||
| public int Radius { get { return radius; } set { radius = value; } } | |||||
| private enum MouseActionType | |||||
| { | |||||
| None, | |||||
| Hover, | |||||
| Click | |||||
| } | |||||
| private MouseActionType mouseAction; | |||||
| protected override void OnPaint(PaintEventArgs e) | |||||
| { | |||||
| Graphics g = e.Graphics; | |||||
| var cC = Parent.BackColor; | |||||
| if (cC == Color.Transparent) | |||||
| cC = Color.White; | |||||
| g.Clear(cC); | |||||
| Color clr = Color.FromArgb(180, this.BackColor); | |||||
| if (Selected) | |||||
| clr = SelectedColor; | |||||
| Color from = Color.FromArgb(200, clr); | |||||
| int btnOffset = 0; | |||||
| if (Enabled) | |||||
| { | |||||
| switch (mouseAction) | |||||
| { | |||||
| case MouseActionType.Click: | |||||
| clr = Color.FromArgb(225, clr); | |||||
| btnOffset = 2; | |||||
| break; | |||||
| case MouseActionType.Hover: | |||||
| clr = Color.FromArgb(225, clr); ; | |||||
| break; | |||||
| } | |||||
| } | |||||
| else | |||||
| from = clr = Color.FromArgb(186, 186, 186); | |||||
| g.SmoothingMode = SmoothingMode.AntiAlias; | |||||
| Rectangle rc = new Rectangle(btnOffset, btnOffset, this.ClientSize.Width - btnOffset, this.ClientSize.Height - btnOffset); | |||||
| GraphicsPath path1 = this.GetPath(rc, Radius); | |||||
| LinearGradientBrush br1 = new LinearGradientBrush(rc, from, clr, LinearGradientMode.Vertical); | |||||
| g.FillPath(br1, path1); | |||||
| var textBrush = new SolidBrush(this.ForeColor); | |||||
| StringFormat drawFormat = new StringFormat(); | |||||
| drawFormat.FormatFlags = StringFormatFlags.DisplayFormatControl; | |||||
| drawFormat.LineAlignment = StringAlignment.Center; | |||||
| drawFormat.Alignment = System.Drawing.StringAlignment.Center; | |||||
| g.DrawString(this.Text, this.Font, textBrush, rc, drawFormat); | |||||
| } | |||||
| private GraphicsPath GetPath(Rectangle rc, int r) | |||||
| { | |||||
| int x = rc.X, y = rc.Y, w = rc.Width, h = rc.Height; | |||||
| GraphicsPath path = new GraphicsPath(); | |||||
| path.AddArc(x, y, r, r, 180, 90); //Upper left corner | |||||
| path.AddArc(x + w - r, y, r, r, 270, 90); //Upper right corner | |||||
| path.AddArc(x + w - r, y + h - r, r, r, 0, 90); //Lower right corner | |||||
| path.AddArc(x, y + h - r, r, r, 90, 90); //Lower left corner | |||||
| path.CloseFigure(); | |||||
| return path; | |||||
| } | |||||
| protected override void OnMouseDown(MouseEventArgs e) | |||||
| { | |||||
| if (e.Button == MouseButtons.Left) | |||||
| { | |||||
| this.mouseAction = MouseActionType.Click; | |||||
| this.Invalidate(); | |||||
| } | |||||
| base.OnMouseDown(e); | |||||
| } | |||||
| protected override void OnMouseUp(MouseEventArgs mevent) | |||||
| { | |||||
| this.mouseAction = MouseActionType.None; | |||||
| this.Invalidate(); | |||||
| base.OnMouseUp(mevent); | |||||
| } | |||||
| protected override void OnMouseEnter(EventArgs e) | |||||
| { | |||||
| this.mouseAction = MouseActionType.Hover; | |||||
| this.Invalidate(); | |||||
| base.OnMouseEnter(e); | |||||
| } | |||||
| protected override void OnMouseLeave(EventArgs e) | |||||
| { | |||||
| this.mouseAction = MouseActionType.None; | |||||
| this.Invalidate(); | |||||
| base.OnMouseLeave(e); | |||||
| } | |||||
| protected override void OnClick(EventArgs e) | |||||
| { | |||||
| this.Enabled = false; | |||||
| if (PlaySound) | |||||
| SoundPalyUtil.PlaySound(SoundType.Click); | |||||
| try | |||||
| { | |||||
| base.OnClick(e); | |||||
| if (!SelfControlEnable) | |||||
| this.Enabled = true; | |||||
| } | |||||
| catch | |||||
| { | |||||
| Application.DoEvents(); | |||||
| this.Enabled = true; | |||||
| this.Focus(); | |||||
| throw; | |||||
| } | |||||
| if (EnableGroup) | |||||
| { | |||||
| foreach (var ctl in Parent.Controls) | |||||
| { | |||||
| var btn = ctl as ColorButton; | |||||
| if (btn == null) | |||||
| continue; | |||||
| btn.Selected = btn.Text == this.Text; | |||||
| } | |||||
| } | |||||
| else if (StateHold) | |||||
| Selected = !Selected; | |||||
| Application.DoEvents(); | |||||
| this.Focus(); | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,223 @@ | |||||
| namespace ButcherFactory.Controls | |||||
| { | |||||
| partial class FormTemplate | |||||
| { | |||||
| /// <summary> | |||||
| /// Required designer variable. | |||||
| /// </summary> | |||||
| private System.ComponentModel.IContainer components = null; | |||||
| /// <summary> | |||||
| /// Clean up any resources being used. | |||||
| /// </summary> | |||||
| /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> | |||||
| protected override void Dispose(bool disposing) | |||||
| { | |||||
| if (disposing && (components != null)) | |||||
| { | |||||
| components.Dispose(); | |||||
| } | |||||
| base.Dispose(disposing); | |||||
| } | |||||
| #region Windows Form Designer generated code | |||||
| /// <summary> | |||||
| /// Required method for Designer support - do not modify | |||||
| /// the contents of this method with the code editor. | |||||
| /// </summary> | |||||
| private void InitializeComponent() | |||||
| { | |||||
| this.components = new System.ComponentModel.Container(); | |||||
| this.panel1 = new System.Windows.Forms.Panel(); | |||||
| this.dateLbl = new System.Windows.Forms.Label(); | |||||
| this.closeBtn = new System.Windows.Forms.Panel(); | |||||
| this.panel3 = new System.Windows.Forms.Panel(); | |||||
| this.timeLbl = new System.Windows.Forms.Label(); | |||||
| this.roundPanel2 = new ButcherFactory.Controls.RoundPanel(this.components); | |||||
| this.TitleLbl = new System.Windows.Forms.Label(); | |||||
| this.titlePanel = new System.Windows.Forms.Panel(); | |||||
| this.logoPanel = new System.Windows.Forms.Panel(); | |||||
| this.panel2 = new System.Windows.Forms.Panel(); | |||||
| this.label3 = new System.Windows.Forms.Label(); | |||||
| this.roundPanel1 = new ButcherFactory.Controls.RoundPanel(this.components); | |||||
| this.panel1.SuspendLayout(); | |||||
| this.roundPanel2.SuspendLayout(); | |||||
| this.SuspendLayout(); | |||||
| // | |||||
| // panel1 | |||||
| // | |||||
| this.panel1.BackColor = System.Drawing.Color.Transparent; | |||||
| this.panel1.Controls.Add(this.dateLbl); | |||||
| this.panel1.Controls.Add(this.closeBtn); | |||||
| this.panel1.Controls.Add(this.panel3); | |||||
| this.panel1.Controls.Add(this.timeLbl); | |||||
| this.panel1.Controls.Add(this.roundPanel2); | |||||
| this.panel1.Controls.Add(this.titlePanel); | |||||
| this.panel1.Controls.Add(this.logoPanel); | |||||
| this.panel1.Dock = System.Windows.Forms.DockStyle.Top; | |||||
| this.panel1.Location = new System.Drawing.Point(0, 0); | |||||
| this.panel1.Name = "panel1"; | |||||
| this.panel1.Size = new System.Drawing.Size(1212, 53); | |||||
| this.panel1.TabIndex = 0; | |||||
| // | |||||
| // dateLbl | |||||
| // | |||||
| this.dateLbl.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); | |||||
| this.dateLbl.AutoSize = true; | |||||
| this.dateLbl.BackColor = System.Drawing.Color.Transparent; | |||||
| this.dateLbl.Font = new System.Drawing.Font("黑体", 10F); | |||||
| this.dateLbl.ForeColor = System.Drawing.Color.White; | |||||
| this.dateLbl.Location = new System.Drawing.Point(991, 30); | |||||
| this.dateLbl.Name = "dateLbl"; | |||||
| this.dateLbl.Size = new System.Drawing.Size(154, 14); | |||||
| this.dateLbl.TabIndex = 13; | |||||
| this.dateLbl.Text = "2018年10月29日/星期五"; | |||||
| // | |||||
| // closeBtn | |||||
| // | |||||
| this.closeBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); | |||||
| this.closeBtn.BackgroundImage = global::ButcherFactory.Properties.Resources.closeImg; | |||||
| this.closeBtn.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; | |||||
| this.closeBtn.Location = new System.Drawing.Point(1174, 14); | |||||
| this.closeBtn.Name = "closeBtn"; | |||||
| this.closeBtn.Size = new System.Drawing.Size(30, 26); | |||||
| this.closeBtn.TabIndex = 12; | |||||
| this.closeBtn.Click += new System.EventHandler(this.closeBtn_Click); | |||||
| // | |||||
| // panel3 | |||||
| // | |||||
| this.panel3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); | |||||
| this.panel3.BackColor = System.Drawing.Color.White; | |||||
| this.panel3.Location = new System.Drawing.Point(1157, 5); | |||||
| this.panel3.Name = "panel3"; | |||||
| this.panel3.Size = new System.Drawing.Size(1, 42); | |||||
| this.panel3.TabIndex = 11; | |||||
| // | |||||
| // timeLbl | |||||
| // | |||||
| this.timeLbl.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); | |||||
| this.timeLbl.AutoSize = true; | |||||
| this.timeLbl.BackColor = System.Drawing.Color.Transparent; | |||||
| this.timeLbl.Font = new System.Drawing.Font("黑体", 12F, System.Drawing.FontStyle.Bold); | |||||
| this.timeLbl.ForeColor = System.Drawing.Color.White; | |||||
| this.timeLbl.Location = new System.Drawing.Point(1013, 9); | |||||
| this.timeLbl.Name = "timeLbl"; | |||||
| this.timeLbl.Size = new System.Drawing.Size(112, 16); | |||||
| this.timeLbl.TabIndex = 10; | |||||
| this.timeLbl.Text = "下午:17:20"; | |||||
| // | |||||
| // roundPanel2 | |||||
| // | |||||
| this.roundPanel2._setRoundRadius = 40; | |||||
| this.roundPanel2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(15)))), ((int)(((byte)(70)))), ((int)(((byte)(173))))); | |||||
| this.roundPanel2.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; | |||||
| this.roundPanel2.Controls.Add(this.TitleLbl); | |||||
| this.roundPanel2.Location = new System.Drawing.Point(308, 10); | |||||
| this.roundPanel2.Margin = new System.Windows.Forms.Padding(0); | |||||
| this.roundPanel2.Name = "roundPanel2"; | |||||
| this.roundPanel2.Size = new System.Drawing.Size(97, 37); | |||||
| this.roundPanel2.TabIndex = 9; | |||||
| // | |||||
| // TitleLbl | |||||
| // | |||||
| this.TitleLbl.AutoSize = true; | |||||
| this.TitleLbl.Font = new System.Drawing.Font("黑体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); | |||||
| this.TitleLbl.ForeColor = System.Drawing.Color.White; | |||||
| this.TitleLbl.Location = new System.Drawing.Point(14, 10); | |||||
| this.TitleLbl.Name = "TitleLbl"; | |||||
| this.TitleLbl.Size = new System.Drawing.Size(56, 16); | |||||
| this.TitleLbl.TabIndex = 0; | |||||
| this.TitleLbl.Text = "label1"; | |||||
| // | |||||
| // titlePanel | |||||
| // | |||||
| this.titlePanel.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; | |||||
| this.titlePanel.Location = new System.Drawing.Point(57, 12); | |||||
| this.titlePanel.Name = "titlePanel"; | |||||
| this.titlePanel.Size = new System.Drawing.Size(122, 28); | |||||
| this.titlePanel.TabIndex = 8; | |||||
| // | |||||
| // logoPanel | |||||
| // | |||||
| this.logoPanel.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; | |||||
| this.logoPanel.Location = new System.Drawing.Point(12, 12); | |||||
| this.logoPanel.Name = "logoPanel"; | |||||
| this.logoPanel.Size = new System.Drawing.Size(36, 30); | |||||
| this.logoPanel.TabIndex = 7; | |||||
| // | |||||
| // panel2 | |||||
| // | |||||
| this.panel2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | |||||
| | System.Windows.Forms.AnchorStyles.Right))); | |||||
| this.panel2.BackColor = System.Drawing.Color.White; | |||||
| this.panel2.Location = new System.Drawing.Point(0, 53); | |||||
| this.panel2.Name = "panel2"; | |||||
| this.panel2.Size = new System.Drawing.Size(1212, 1); | |||||
| this.panel2.TabIndex = 1; | |||||
| // | |||||
| // label3 | |||||
| // | |||||
| this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | |||||
| | System.Windows.Forms.AnchorStyles.Right))); | |||||
| this.label3.AutoSize = true; | |||||
| this.label3.BackColor = System.Drawing.Color.Transparent; | |||||
| this.label3.Font = new System.Drawing.Font("黑体", 10F); | |||||
| this.label3.ForeColor = System.Drawing.Color.White; | |||||
| this.label3.Location = new System.Drawing.Point(495, 579); | |||||
| this.label3.Name = "label3"; | |||||
| this.label3.Size = new System.Drawing.Size(231, 14); | |||||
| this.label3.TabIndex = 4; | |||||
| this.label3.Text = "版权归青花瓷(北京)有限公司所有"; | |||||
| // | |||||
| // roundPanel1 | |||||
| // | |||||
| this.roundPanel1._setRoundRadius = 15; | |||||
| this.roundPanel1.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.roundPanel1.BackColor = System.Drawing.Color.White; | |||||
| this.roundPanel1.Location = new System.Drawing.Point(12, 61); | |||||
| this.roundPanel1.Margin = new System.Windows.Forms.Padding(0); | |||||
| this.roundPanel1.Name = "roundPanel1"; | |||||
| this.roundPanel1.Size = new System.Drawing.Size(1187, 510); | |||||
| this.roundPanel1.TabIndex = 2; | |||||
| // | |||||
| // FormTemplate | |||||
| // | |||||
| this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); | |||||
| this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; | |||||
| this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(19)))), ((int)(((byte)(88)))), ((int)(((byte)(217))))); | |||||
| this.ClientSize = new System.Drawing.Size(1212, 600); | |||||
| this.Controls.Add(this.label3); | |||||
| this.Controls.Add(this.roundPanel1); | |||||
| this.Controls.Add(this.panel2); | |||||
| this.Controls.Add(this.panel1); | |||||
| this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; | |||||
| this.Name = "FormTemplate"; | |||||
| this.Text = "FormTemplate"; | |||||
| this.panel1.ResumeLayout(false); | |||||
| this.panel1.PerformLayout(); | |||||
| this.roundPanel2.ResumeLayout(false); | |||||
| this.roundPanel2.PerformLayout(); | |||||
| this.ResumeLayout(false); | |||||
| this.PerformLayout(); | |||||
| } | |||||
| #endregion | |||||
| private System.Windows.Forms.Panel panel1; | |||||
| private RoundPanel roundPanel2; | |||||
| private System.Windows.Forms.Panel titlePanel; | |||||
| private System.Windows.Forms.Panel logoPanel; | |||||
| private System.Windows.Forms.Label dateLbl; | |||||
| private System.Windows.Forms.Panel closeBtn; | |||||
| private System.Windows.Forms.Panel panel3; | |||||
| private System.Windows.Forms.Label timeLbl; | |||||
| private System.Windows.Forms.Panel panel2; | |||||
| private System.Windows.Forms.Label TitleLbl; | |||||
| protected RoundPanel roundPanel1; | |||||
| protected System.Windows.Forms.Label label3; | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,83 @@ | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.ComponentModel; | |||||
| using System.Data; | |||||
| using System.Drawing; | |||||
| using System.Linq; | |||||
| using System.Text; | |||||
| using System.Timers; | |||||
| using System.Windows.Forms; | |||||
| namespace ButcherFactory.Controls | |||||
| { | |||||
| public partial class FormTemplate : Form | |||||
| { | |||||
| System.Timers.Timer timer; | |||||
| public FormTemplate() | |||||
| { | |||||
| InitializeComponent(); | |||||
| if (!DesignMode) | |||||
| { | |||||
| this.FormClosing += delegate | |||||
| { | |||||
| if (timer != null) | |||||
| timer.Dispose(); | |||||
| }; | |||||
| } | |||||
| if (CheckDesingModel.IsDesingMode) | |||||
| return;//如果处于设计模式,返回 | |||||
| this.WindowState = System.Windows.Forms.FormWindowState.Maximized; | |||||
| } | |||||
| protected override void OnLoad(EventArgs e) | |||||
| { | |||||
| base.OnLoad(e); | |||||
| if (!DesignMode) | |||||
| { | |||||
| TitleLbl.Text = Text; | |||||
| logoPanel.BackgroundImage = Image.FromFile("Images\\logo.png"); | |||||
| titlePanel.BackgroundImage = Image.FromFile("Images\\formTitle.png"); | |||||
| timerTick(null, null); | |||||
| timer = new System.Timers.Timer(1000); | |||||
| timer.Elapsed += timerTick; | |||||
| timer.AutoReset = true; | |||||
| timer.Enabled = true; | |||||
| } | |||||
| } | |||||
| private void timerTick(object sender, ElapsedEventArgs e) | |||||
| { | |||||
| var arr = "日一二三四五六"; | |||||
| this.Invoke(new Action(delegate | |||||
| { | |||||
| timeLbl.Text = string.Format("{0} {1:HH:mm}", DateTime.Now.Hour > 12 ? "下午" : "上午", DateTime.Now); | |||||
| dateLbl.Text = string.Format(string.Format("{0:yyyy年MM月dd日}/星期{1}", DateTime.Today, arr[(int)DateTime.Now.DayOfWeek])); | |||||
| })); | |||||
| } | |||||
| private void closeBtn_Click(object sender, EventArgs e) | |||||
| { | |||||
| this.Close(); | |||||
| } | |||||
| } | |||||
| internal class CheckDesingModel | |||||
| { | |||||
| public static bool IsDesingMode | |||||
| { | |||||
| get | |||||
| { | |||||
| bool ReturnFlag = false; | |||||
| if (LicenseManager.UsageMode == LicenseUsageMode.Designtime) | |||||
| ReturnFlag = true; | |||||
| else if (System.Diagnostics.Process.GetCurrentProcess().ProcessName == "devenv") | |||||
| ReturnFlag = true; | |||||
| //if (ReturnFlag) | |||||
| // Msg.Warning("设计模式"); | |||||
| //else Msg.Warning("非设计模式!"); | |||||
| return ReturnFlag; | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,159 @@ | |||||
| <?xml version="1.0" encoding="utf-8"?> | |||||
| <root> | |||||
| <!-- | |||||
| Microsoft ResX Schema | |||||
| Version 2.0 | |||||
| The primary goals of this format is to allow a simple XML format | |||||
| that is mostly human readable. The generation and parsing of the | |||||
| various data types are done through the TypeConverter classes | |||||
| associated with the data types. | |||||
| Example: | |||||
| ... ado.net/XML headers & schema ... | |||||
| <resheader name="resmimetype">text/microsoft-resx</resheader> | |||||
| <resheader name="version">2.0</resheader> | |||||
| <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> | |||||
| <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> | |||||
| <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> | |||||
| <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> | |||||
| <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> | |||||
| <value>[base64 mime encoded serialized .NET Framework object]</value> | |||||
| </data> | |||||
| <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> | |||||
| <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> | |||||
| <comment>This is a comment</comment> | |||||
| </data> | |||||
| There are any number of "resheader" rows that contain simple | |||||
| name/value pairs. | |||||
| Each data row contains a name, and value. The row also contains a | |||||
| type or mimetype. Type corresponds to a .NET class that support | |||||
| text/value conversion through the TypeConverter architecture. | |||||
| Classes that don't support this are serialized and stored with the | |||||
| mimetype set. | |||||
| The mimetype is used for serialized objects, and tells the | |||||
| ResXResourceReader how to depersist the object. This is currently not | |||||
| extensible. For a given mimetype the value must be set accordingly: | |||||
| Note - application/x-microsoft.net.object.binary.base64 is the format | |||||
| that the ResXResourceWriter will generate, however the reader can | |||||
| read any of the formats listed below. | |||||
| mimetype: application/x-microsoft.net.object.binary.base64 | |||||
| value : The object must be serialized with | |||||
| : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter | |||||
| : and then encoded with base64 encoding. | |||||
| mimetype: application/x-microsoft.net.object.soap.base64 | |||||
| value : The object must be serialized with | |||||
| : System.Runtime.Serialization.Formatters.Soap.SoapFormatter | |||||
| : and then encoded with base64 encoding. | |||||
| mimetype: application/x-microsoft.net.object.bytearray.base64 | |||||
| value : The object must be serialized into a byte array | |||||
| : using a System.ComponentModel.TypeConverter | |||||
| : and then encoded with base64 encoding. | |||||
| --> | |||||
| <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> | |||||
| <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> | |||||
| <xsd:element name="root" msdata:IsDataSet="true"> | |||||
| <xsd:complexType> | |||||
| <xsd:choice maxOccurs="unbounded"> | |||||
| <xsd:element name="metadata"> | |||||
| <xsd:complexType> | |||||
| <xsd:sequence> | |||||
| <xsd:element name="value" type="xsd:string" minOccurs="0" /> | |||||
| </xsd:sequence> | |||||
| <xsd:attribute name="name" use="required" type="xsd:string" /> | |||||
| <xsd:attribute name="type" type="xsd:string" /> | |||||
| <xsd:attribute name="mimetype" type="xsd:string" /> | |||||
| <xsd:attribute ref="xml:space" /> | |||||
| </xsd:complexType> | |||||
| </xsd:element> | |||||
| <xsd:element name="assembly"> | |||||
| <xsd:complexType> | |||||
| <xsd:attribute name="alias" type="xsd:string" /> | |||||
| <xsd:attribute name="name" type="xsd:string" /> | |||||
| </xsd:complexType> | |||||
| </xsd:element> | |||||
| <xsd:element name="data"> | |||||
| <xsd:complexType> | |||||
| <xsd:sequence> | |||||
| <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | |||||
| <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> | |||||
| </xsd:sequence> | |||||
| <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> | |||||
| <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> | |||||
| <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> | |||||
| <xsd:attribute ref="xml:space" /> | |||||
| </xsd:complexType> | |||||
| </xsd:element> | |||||
| <xsd:element name="resheader"> | |||||
| <xsd:complexType> | |||||
| <xsd:sequence> | |||||
| <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | |||||
| </xsd:sequence> | |||||
| <xsd:attribute name="name" type="xsd:string" use="required" /> | |||||
| </xsd:complexType> | |||||
| </xsd:element> | |||||
| </xsd:choice> | |||||
| </xsd:complexType> | |||||
| </xsd:element> | |||||
| </xsd:schema> | |||||
| <resheader name="resmimetype"> | |||||
| <value>text/microsoft-resx</value> | |||||
| </resheader> | |||||
| <resheader name="version"> | |||||
| <value>2.0</value> | |||||
| </resheader> | |||||
| <resheader name="reader"> | |||||
| <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | |||||
| </resheader> | |||||
| <resheader name="writer"> | |||||
| <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | |||||
| </resheader> | |||||
| <metadata name="panel1.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <value>True</value> | |||||
| </metadata> | |||||
| <metadata name="dateLbl.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <value>True</value> | |||||
| </metadata> | |||||
| <metadata name="closeBtn.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <value>True</value> | |||||
| </metadata> | |||||
| <metadata name="panel3.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <value>True</value> | |||||
| </metadata> | |||||
| <metadata name="timeLbl.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <value>True</value> | |||||
| </metadata> | |||||
| <metadata name="roundPanel2.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <value>True</value> | |||||
| </metadata> | |||||
| <metadata name="TitleLbl.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <value>True</value> | |||||
| </metadata> | |||||
| <metadata name="titlePanel.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <value>True</value> | |||||
| </metadata> | |||||
| <metadata name="logoPanel.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <value>True</value> | |||||
| </metadata> | |||||
| <metadata name="panel2.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <value>True</value> | |||||
| </metadata> | |||||
| <metadata name="label3.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <value>True</value> | |||||
| </metadata> | |||||
| <metadata name="roundPanel1.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> | |||||
| </root> | |||||
| @ -0,0 +1,81 @@ | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.ComponentModel; | |||||
| using System.Drawing; | |||||
| using System.Drawing.Drawing2D; | |||||
| using System.Linq; | |||||
| using System.Text; | |||||
| using System.Threading.Tasks; | |||||
| using System.Windows.Forms; | |||||
| namespace ButcherFactory.Controls | |||||
| { | |||||
| public class RoundPanel : Panel | |||||
| { | |||||
| public RoundPanel() | |||||
| { | |||||
| this.Padding = new System.Windows.Forms.Padding(0, 0, 0, 0); | |||||
| this.Margin = new System.Windows.Forms.Padding(0, 0, 0, 0); | |||||
| } | |||||
| // 圆角 | |||||
| // =============================================================================================== | |||||
| private int _Radius = 18; // 圆角弧度 | |||||
| /// <summary>圆角弧度(0为不要圆角)</summary> | |||||
| [DefaultValue(18)] | |||||
| [Browsable(true)] | |||||
| [Description("圆角弧度(0为不要圆角)")] | |||||
| public int _setRoundRadius | |||||
| { | |||||
| get | |||||
| { | |||||
| return _Radius; | |||||
| } | |||||
| set | |||||
| { | |||||
| if (value < 0) { _Radius = 0; } | |||||
| else { _Radius = value; } | |||||
| base.Refresh(); | |||||
| } | |||||
| } | |||||
| // 圆角代码 | |||||
| public void Round(System.Drawing.Region region) | |||||
| { | |||||
| System.Drawing.Drawing2D.GraphicsPath oPath = new System.Drawing.Drawing2D.GraphicsPath(); | |||||
| int x = 0; | |||||
| int y = 0; | |||||
| int thisWidth = this.Width; | |||||
| int thisHeight = this.Height; | |||||
| int angle = _Radius; | |||||
| oPath.AddArc(x, y, angle, angle, 180, 90); // 左上角 | |||||
| oPath.AddArc(thisWidth - angle, y, angle, angle, 270, 90); // 右上角 | |||||
| oPath.AddArc(thisWidth - angle, thisHeight - angle, angle, angle, 0, 90); // 右下角 | |||||
| oPath.AddArc(x, thisHeight - angle, angle, angle, 90, 90); // 左下角 | |||||
| oPath.CloseAllFigures(); | |||||
| Region = new System.Drawing.Region(oPath); | |||||
| } | |||||
| public RoundPanel(IContainer container) | |||||
| { | |||||
| container.Add(this); | |||||
| } | |||||
| protected override void OnPaint(System.Windows.Forms.PaintEventArgs pe) | |||||
| { | |||||
| base.OnPaint(pe); | |||||
| pe.Graphics.SmoothingMode = SmoothingMode.AntiAlias; | |||||
| Round(this.Region); // 圆角 | |||||
| } | |||||
| protected override void OnResize(EventArgs eventargs) | |||||
| { | |||||
| base.OnResize(eventargs); | |||||
| base.Refresh(); | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,52 @@ | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Linq; | |||||
| using System.Text; | |||||
| using System.Threading.Tasks; | |||||
| namespace ButcherFactory.Controls | |||||
| { | |||||
| internal class AoHaoSi3000DataFormat : DataFormatBase | |||||
| { | |||||
| public override int DataLength | |||||
| { | |||||
| get { return 10; } | |||||
| } | |||||
| public override char Beginchar | |||||
| { | |||||
| get { return (char)0x80; }//这种数据没有固定的开始标志 | |||||
| } | |||||
| public override char Endchar | |||||
| { | |||||
| get { return (char)0x67; } | |||||
| } | |||||
| public override short Bufsize | |||||
| { | |||||
| get { return 36; } | |||||
| } | |||||
| public override string ParseData(string buf, out bool isStatic) | |||||
| { | |||||
| isStatic = false; | |||||
| return string.Empty; | |||||
| } | |||||
| public override bool ParseAscii(string buf, out string weight, out bool isStatic) | |||||
| { | |||||
| isStatic = true; | |||||
| weight = buf.Replace("kg", "").Replace((char)0x0D, (char)0x20).Replace((char)0x0A, (char)0x20).Replace((char)0x3F, (char)0x20); | |||||
| weight = weight.Trim(); | |||||
| return true; | |||||
| } | |||||
| public override bool ParseAscii(string buf, out string weight, out bool isStatic, out string subStr) | |||||
| { | |||||
| weight = ""; | |||||
| isStatic = false; | |||||
| subStr = ""; | |||||
| return false; | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,70 @@ | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Linq; | |||||
| using System.Text; | |||||
| using System.Threading.Tasks; | |||||
| namespace ButcherFactory.Controls | |||||
| { | |||||
| interface IDataFormat | |||||
| { | |||||
| char Beginchar { get; } | |||||
| char Endchar { get; } | |||||
| short Bufsize { get; } | |||||
| bool ParseAscii(string buf, out string weight, out bool isStatic); | |||||
| bool ParseAscii(string buf, out string weight, out bool isStatic, out string subStr); | |||||
| } | |||||
| internal abstract class DataFormatBase : IDataFormat | |||||
| { | |||||
| public abstract int DataLength | |||||
| { | |||||
| get; | |||||
| } | |||||
| public abstract char Beginchar | |||||
| { | |||||
| get; | |||||
| } | |||||
| public abstract char Endchar | |||||
| { | |||||
| get; | |||||
| } | |||||
| public abstract short Bufsize { get; } | |||||
| public const short BUFSIZE = 36; | |||||
| // 根据开始字符找出 一个完整的数据帧 | |||||
| public string FindDataFrame(string buf, int fSize) | |||||
| { | |||||
| var bufSize = buf.Length; | |||||
| if (fSize > bufSize) | |||||
| { | |||||
| return string.Empty; | |||||
| } | |||||
| int index = buf.IndexOf(Beginchar); // 查找开始字符的索引 | |||||
| if (index < 0 || (index + fSize) > bufSize) | |||||
| { | |||||
| return string.Empty; | |||||
| } | |||||
| string data = buf.Substring(index, fSize); | |||||
| // 检查结束字符 | |||||
| if (data[fSize - 1] != Endchar) | |||||
| { | |||||
| return string.Empty; | |||||
| } | |||||
| return data; | |||||
| } | |||||
| public abstract string ParseData(string buf, out bool isStatic); | |||||
| public abstract bool ParseAscii(string buf, out string weight, out bool isStatic); | |||||
| public abstract bool ParseAscii(string buf, out string weight, out bool isStatic, out string subStr); | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,58 @@ | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Linq; | |||||
| using System.Text; | |||||
| using System.Threading.Tasks; | |||||
| namespace ButcherFactory.Controls | |||||
| { | |||||
| internal class IND560DataFormat : DataFormatBase | |||||
| { | |||||
| public override int DataLength | |||||
| { | |||||
| get { return 10; } | |||||
| } | |||||
| public override char Beginchar | |||||
| { | |||||
| get { return (char)0x80; }//这种数据没有固定的开始标志 | |||||
| } | |||||
| public override char Endchar | |||||
| { | |||||
| get { return (char)0x67; } | |||||
| } | |||||
| public override short Bufsize | |||||
| { | |||||
| get { return 36; } | |||||
| } | |||||
| public override string ParseData(string buf, out bool isStatic) | |||||
| { | |||||
| isStatic = false; | |||||
| return string.Empty; | |||||
| } | |||||
| public override bool ParseAscii(string buf, out string weight, out bool isStatic) | |||||
| { | |||||
| isStatic = true; | |||||
| weight = buf.Replace("kg", "").Replace((char)0x0D, (char)0x20).Replace((char)0x0A, (char)0x20).Replace((char)0x3F, (char)0x20); | |||||
| weight = weight.Trim(); | |||||
| if (weight.Any(x => x == ' ')) | |||||
| { | |||||
| var arr = weight.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); | |||||
| if (arr.Length > 1) | |||||
| weight = arr[1]; | |||||
| } | |||||
| return true; | |||||
| } | |||||
| public override bool ParseAscii(string buf, out string weight, out bool isStatic, out string subStr) | |||||
| { | |||||
| weight = ""; | |||||
| isStatic = false; | |||||
| subStr = ""; | |||||
| return false; | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,121 @@ | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Linq; | |||||
| using System.Text; | |||||
| using System.Threading.Tasks; | |||||
| namespace ButcherFactory.Controls | |||||
| { | |||||
| internal class Xk3124DataFormat : DataFormatBase | |||||
| { | |||||
| public override int DataLength | |||||
| { | |||||
| get { return 17; } | |||||
| } | |||||
| public override char Beginchar | |||||
| { | |||||
| get { return (char)0x02; } | |||||
| } | |||||
| public override char Endchar | |||||
| { | |||||
| get { return (char)0x0D; ; } | |||||
| } | |||||
| public override short Bufsize | |||||
| { | |||||
| get { return 36; } | |||||
| } | |||||
| public override string ParseData(string buf, out bool isStatic) | |||||
| { | |||||
| StringBuilder str = new StringBuilder(); | |||||
| char swa = buf[1]; // 状态字A | |||||
| char swb = buf[2]; // 状态字B | |||||
| int dotIndex = (swa & 0x07) - 2; // 小数点位置 | |||||
| bool isPositive = (((swb >> 1) & 0x01) == 0); // 符号:是否为正数 | |||||
| isStatic = (((swb >> 3) & 0x01) == 0); | |||||
| char[] num = new char[6]; | |||||
| for (int i = 0; i < 6; i++) | |||||
| { | |||||
| num[i] = buf[i + 4]; | |||||
| } | |||||
| if (dotIndex < 0) | |||||
| { // 不考虑精确到十,百位 | |||||
| return str.ToString(); | |||||
| } | |||||
| for (int i = 0; i < 6 - dotIndex; i++) | |||||
| { | |||||
| str.Append(num[i]); | |||||
| } | |||||
| str.Append('.'); | |||||
| for (int i = 0; i < dotIndex; i++) | |||||
| { | |||||
| str.Append(num[6 - dotIndex + i]); | |||||
| } | |||||
| // 去掉空格 | |||||
| string result = str.ToString().Trim(); | |||||
| // 取消前面多余的0 | |||||
| for (int i = 0; i < result.Length; i++) | |||||
| { | |||||
| if (result[i] != '0') | |||||
| { | |||||
| result = result.Substring(i, result.Length - i); | |||||
| break; | |||||
| } | |||||
| } | |||||
| if (result.IndexOf('.') == 0) | |||||
| { | |||||
| result = result.Insert(0, "0"); | |||||
| } | |||||
| if (result.IndexOf('.') == result.Length - 1) | |||||
| { | |||||
| result = result.Remove(result.IndexOf('.'), 1); | |||||
| } | |||||
| if (!isPositive) | |||||
| { // 负数 | |||||
| result = result.Insert(0, "-"); | |||||
| } | |||||
| return result; | |||||
| } | |||||
| public override bool ParseAscii(string buf, out string weight, out bool isStatic) | |||||
| { | |||||
| isStatic = false; | |||||
| weight = FindDataFrame(buf, DataLength); | |||||
| if (string.IsNullOrEmpty(weight)) | |||||
| { | |||||
| return false; | |||||
| } | |||||
| weight = ParseData(weight, out isStatic); | |||||
| return true; | |||||
| } | |||||
| public override bool ParseAscii(string buf, out string weight, out bool isStatic, out string subStr) | |||||
| { | |||||
| weight = ""; | |||||
| isStatic = false; | |||||
| subStr = ""; | |||||
| return false; | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,136 @@ | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Linq; | |||||
| using System.Text; | |||||
| using System.Threading.Tasks; | |||||
| namespace ButcherFactory.Controls | |||||
| { | |||||
| internal class Xk3190A9DataFormat : DataFormatBase | |||||
| { | |||||
| public override int DataLength | |||||
| { | |||||
| get { return 12; } | |||||
| } | |||||
| public override char Beginchar | |||||
| { | |||||
| get { return (char)0x02; } | |||||
| } | |||||
| public override char Endchar | |||||
| { | |||||
| get { return (char)0x03; } | |||||
| } | |||||
| public override short Bufsize | |||||
| { | |||||
| get { return 36; } | |||||
| } | |||||
| public override string ParseData(string buf, out bool isStatic) | |||||
| { | |||||
| string weight; | |||||
| // 小数位数0-4 | |||||
| int dot = (short)(0x0F & buf[8]); | |||||
| weight = buf.Substring(2, 6).Trim(); | |||||
| // insert dot | |||||
| weight = InsertDot(weight, dot); | |||||
| isStatic = true; // 默认 为 稳定 | |||||
| // buffer[1] 符号位 | |||||
| if (buf[1] == '-') | |||||
| { | |||||
| weight = weight.Insert(0, "-"); | |||||
| } | |||||
| return weight; | |||||
| } | |||||
| public override bool ParseAscii(string buf, out string weight, out bool isStatic) | |||||
| { | |||||
| isStatic = false; | |||||
| weight = FindDataFrame(buf, DataLength); | |||||
| if (string.IsNullOrEmpty(weight)) | |||||
| { | |||||
| return false; | |||||
| } | |||||
| weight = ParseData(weight, out isStatic); | |||||
| return true; | |||||
| } | |||||
| private static string InsertDot(string weight, int dotBits) | |||||
| { | |||||
| string str = weight.TrimStart(new[] { | |||||
| '0' | |||||
| }); | |||||
| str = str.Trim(); | |||||
| if (dotBits > 0) | |||||
| { | |||||
| //str = str.Insert(str.Length - dotBits, "."); | |||||
| if (string.IsNullOrEmpty(str)) | |||||
| { | |||||
| str = "0"; | |||||
| str = str.Insert(str.Length, "."); | |||||
| for (int i = 0; i < dotBits; i++) | |||||
| { | |||||
| str = str.Insert(str.Length, "0"); | |||||
| } | |||||
| } | |||||
| else | |||||
| str = str.Insert(str.Length - dotBits, "."); | |||||
| } | |||||
| if (str.IndexOf(".") == 0) | |||||
| { | |||||
| str = str.Insert(0, "0"); | |||||
| } | |||||
| return str; | |||||
| } | |||||
| public override bool ParseAscii(string buf, out string weight, out bool isStatic, out string subStr) | |||||
| { | |||||
| isStatic = false; | |||||
| weight = FindDataFrame(buf, DataLength, out subStr); | |||||
| if (string.IsNullOrEmpty(weight)) | |||||
| { | |||||
| return false; | |||||
| } | |||||
| weight = ParseData(weight, out isStatic); | |||||
| return true; | |||||
| } | |||||
| // 根据开始字符找出 一个完整的数据帧 | |||||
| public string FindDataFrame(string buf, int fSize, out string subStr) | |||||
| { | |||||
| var bufSize = buf.Length; | |||||
| subStr = ""; | |||||
| int index = buf.IndexOf(Beginchar); // 查找开始字符的索引 | |||||
| if (index < 0 || (index + fSize) > bufSize) | |||||
| { | |||||
| return string.Empty; | |||||
| } | |||||
| string data = buf.Substring(index, fSize); | |||||
| subStr = buf.Substring(index + fSize); | |||||
| // 检查结束字符 | |||||
| if (data[fSize - 1] != Endchar) | |||||
| { | |||||
| return string.Empty; | |||||
| } | |||||
| return data; | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,130 @@ | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Linq; | |||||
| using System.Text; | |||||
| using System.Threading.Tasks; | |||||
| namespace ButcherFactory.Controls | |||||
| { | |||||
| internal class Xk3190D10DataFormat : DataFormatBase | |||||
| { | |||||
| public override int DataLength | |||||
| { | |||||
| get { return 12; } | |||||
| } | |||||
| public override char Beginchar | |||||
| { | |||||
| get { return (char)0x02; } | |||||
| } | |||||
| public override char Endchar | |||||
| { | |||||
| get { return (char)0x0D; ; } | |||||
| } | |||||
| public override short Bufsize | |||||
| { | |||||
| get { return 24; } | |||||
| } | |||||
| public override string ParseData(string buf, out bool isStatic) | |||||
| { | |||||
| string weight; | |||||
| // 小数位数0-4 | |||||
| int dot = (short)(0x0F & buf[8]); | |||||
| weight = buf.Substring(2, 6).Trim(); | |||||
| // insert dot | |||||
| weight = InsertDot(weight, dot); | |||||
| isStatic = true; // 默认 为 稳定 | |||||
| // buffer[1] 符号位 | |||||
| if (buf[1] == '-') | |||||
| { | |||||
| weight = weight.Insert(0, "-"); | |||||
| } | |||||
| else | |||||
| { | |||||
| } | |||||
| return weight; | |||||
| } | |||||
| public override bool ParseAscii(string buf, out string weight, out bool isStatic) | |||||
| { | |||||
| isStatic = false; | |||||
| weight = FindDataFrame(buf, DataLength); | |||||
| if (string.IsNullOrEmpty(weight)) | |||||
| { | |||||
| return false; | |||||
| } | |||||
| weight = ParseData(weight, out isStatic); | |||||
| return true; | |||||
| } | |||||
| private static string InsertDot(string weight, int dotBits) | |||||
| { | |||||
| string str = weight.TrimStart(new[] { | |||||
| '0' | |||||
| }); | |||||
| str = str.Trim(); | |||||
| if (dotBits > 0) | |||||
| { | |||||
| //str = str.Insert(str.Length - dotBits, "."); | |||||
| if (string.IsNullOrEmpty(str)) | |||||
| { | |||||
| str = "0"; | |||||
| str = str.Insert(str.Length, "."); | |||||
| for (int i = 0; i < dotBits; i++) | |||||
| { | |||||
| str = str.Insert(str.Length, "0"); | |||||
| } | |||||
| } | |||||
| else | |||||
| str = str.Insert(str.Length - dotBits, "."); | |||||
| } | |||||
| if (str.IndexOf(".") == 0) | |||||
| { | |||||
| str = str.Insert(0, "0"); | |||||
| } | |||||
| return str; | |||||
| } | |||||
| public override bool ParseAscii(string buf, out string weight, out bool isStatic, out string subStr) | |||||
| { | |||||
| isStatic = false; | |||||
| weight = FindDataFrame(buf, DataLength); | |||||
| subStr = ""; | |||||
| if (string.IsNullOrEmpty(weight)) | |||||
| { | |||||
| return false; | |||||
| } | |||||
| weight = ParseData(weight, out isStatic); | |||||
| return true; | |||||
| } | |||||
| #region 1.3 验证int奇数偶数 | |||||
| /// <summary> | |||||
| /// 1.3 验证int奇数偶数 | |||||
| /// </summary> | |||||
| /// <param name="num"></param> | |||||
| /// <returns></returns> | |||||
| public bool isJO(int num) | |||||
| { | |||||
| int a = num % 2; | |||||
| if (a == 0) | |||||
| return true; | |||||
| else | |||||
| return false; | |||||
| } | |||||
| #endregion | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,43 @@ | |||||
| using ButcherFactory.BO.Utils; | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.IO; | |||||
| using System.Linq; | |||||
| using System.Text; | |||||
| using System.Threading.Tasks; | |||||
| namespace ButcherFactory.Controls | |||||
| { | |||||
| public class WeightConfig | |||||
| { | |||||
| public string WeightSet { get; set; } | |||||
| public string ComSet { get; set; } | |||||
| public int? RateSet { get; set; } | |||||
| public int? BitSet { get; set; } | |||||
| public string Format { get; set; } | |||||
| public decimal? Discont { get; set; } | |||||
| public int WeightType { get; set; } | |||||
| public decimal MinWeight { get; set; } | |||||
| public decimal MaxWeight { get; set; } | |||||
| public static WeightConfig Init(string flag) | |||||
| { | |||||
| var path = Path.Combine("Config", flag + "WeightConfig.xml"); | |||||
| return XmlUtil.DeserializeFromFile<WeightConfig>(path); | |||||
| } | |||||
| public void Save(string flag) | |||||
| { | |||||
| var path = Path.Combine("Config", flag + "WeightConfig.xml"); | |||||
| XmlUtil.SerializerObjToFile(this, path); | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,131 @@ | |||||
| namespace ButcherFactory.Controls | |||||
| { | |||||
| partial class WeightControl | |||||
| { | |||||
| /// <summary> | |||||
| /// 必需的设计器变量。 | |||||
| /// </summary> | |||||
| private System.ComponentModel.IContainer components = null; | |||||
| /// <summary> | |||||
| /// 清理所有正在使用的资源。 | |||||
| /// </summary> | |||||
| /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param> | |||||
| protected override void Dispose(bool disposing) | |||||
| { | |||||
| if (disposing && (components != null)) | |||||
| { | |||||
| components.Dispose(); | |||||
| } | |||||
| base.Dispose(disposing); | |||||
| } | |||||
| #region 组件设计器生成的代码 | |||||
| /// <summary> | |||||
| /// 设计器支持所需的方法 - 不要 | |||||
| /// 使用代码编辑器修改此方法的内容。 | |||||
| /// </summary> | |||||
| private void InitializeComponent() | |||||
| { | |||||
| this.components = new System.ComponentModel.Container(); | |||||
| this.roundPanel1 = new ButcherFactory.Controls.RoundPanel(this.components); | |||||
| this.weightSwitch = new ButcherFactory.Controls.ColorButton(); | |||||
| this.settingBtn = new ButcherFactory.Controls.ColorButton(); | |||||
| this.roundPanel2 = new ButcherFactory.Controls.RoundPanel(this.components); | |||||
| this.lblChengZhong = new System.Windows.Forms.Label(); | |||||
| this.roundPanel1.SuspendLayout(); | |||||
| this.roundPanel2.SuspendLayout(); | |||||
| this.SuspendLayout(); | |||||
| // | |||||
| // roundPanel1 | |||||
| // | |||||
| this.roundPanel1._setRoundRadius = 15; | |||||
| this.roundPanel1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; | |||||
| this.roundPanel1.Controls.Add(this.weightSwitch); | |||||
| this.roundPanel1.Controls.Add(this.settingBtn); | |||||
| this.roundPanel1.Controls.Add(this.roundPanel2); | |||||
| this.roundPanel1.Dock = System.Windows.Forms.DockStyle.Fill; | |||||
| this.roundPanel1.Location = new System.Drawing.Point(0, 0); | |||||
| this.roundPanel1.Margin = new System.Windows.Forms.Padding(0); | |||||
| this.roundPanel1.Name = "roundPanel1"; | |||||
| this.roundPanel1.Size = new System.Drawing.Size(262, 74); | |||||
| this.roundPanel1.TabIndex = 0; | |||||
| // | |||||
| // weightSwitch | |||||
| // | |||||
| this.weightSwitch.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(77)))), ((int)(((byte)(135)))), ((int)(((byte)(245))))); | |||||
| this.weightSwitch.Font = new System.Drawing.Font("宋体", 10F); | |||||
| this.weightSwitch.ForeColor = System.Drawing.Color.White; | |||||
| this.weightSwitch.Location = new System.Drawing.Point(167, 40); | |||||
| this.weightSwitch.Name = "weightSwitch"; | |||||
| this.weightSwitch.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(158)))), ((int)(((byte)(234)))), ((int)(((byte)(106))))); | |||||
| this.weightSwitch.Size = new System.Drawing.Size(92, 32); | |||||
| this.weightSwitch.StateHold = true; | |||||
| this.weightSwitch.TabIndex = 2; | |||||
| this.weightSwitch.Text = "启用称重"; | |||||
| this.weightSwitch.UseVisualStyleBackColor = false; | |||||
| this.weightSwitch.Click += new System.EventHandler(this.weightSwitch_Click); | |||||
| // | |||||
| // settingBtn | |||||
| // | |||||
| this.settingBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(144)))), ((int)(((byte)(98)))), ((int)(((byte)(222))))); | |||||
| this.settingBtn.Font = new System.Drawing.Font("宋体", 10F); | |||||
| this.settingBtn.ForeColor = System.Drawing.Color.White; | |||||
| this.settingBtn.Location = new System.Drawing.Point(167, 1); | |||||
| this.settingBtn.Name = "settingBtn"; | |||||
| this.settingBtn.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(158)))), ((int)(((byte)(234)))), ((int)(((byte)(106))))); | |||||
| this.settingBtn.Size = new System.Drawing.Size(92, 32); | |||||
| this.settingBtn.TabIndex = 1; | |||||
| this.settingBtn.Text = "称设置"; | |||||
| this.settingBtn.UseVisualStyleBackColor = false; | |||||
| this.settingBtn.Click += new System.EventHandler(this.settingBtn_Click); | |||||
| // | |||||
| // roundPanel2 | |||||
| // | |||||
| this.roundPanel2._setRoundRadius = 15; | |||||
| this.roundPanel2.BackColor = System.Drawing.Color.Black; | |||||
| this.roundPanel2.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; | |||||
| this.roundPanel2.Controls.Add(this.lblChengZhong); | |||||
| this.roundPanel2.Location = new System.Drawing.Point(0, 0); | |||||
| this.roundPanel2.Margin = new System.Windows.Forms.Padding(0); | |||||
| this.roundPanel2.Name = "roundPanel2"; | |||||
| this.roundPanel2.Size = new System.Drawing.Size(164, 74); | |||||
| this.roundPanel2.TabIndex = 0; | |||||
| // | |||||
| // lblChengZhong | |||||
| // | |||||
| this.lblChengZhong.AutoSize = true; | |||||
| this.lblChengZhong.Font = new System.Drawing.Font("宋体", 25F); | |||||
| this.lblChengZhong.ForeColor = System.Drawing.Color.Red; | |||||
| this.lblChengZhong.Location = new System.Drawing.Point(5, 19); | |||||
| this.lblChengZhong.Margin = new System.Windows.Forms.Padding(0); | |||||
| this.lblChengZhong.Name = "lblChengZhong"; | |||||
| this.lblChengZhong.Size = new System.Drawing.Size(83, 34); | |||||
| this.lblChengZhong.TabIndex = 0; | |||||
| this.lblChengZhong.Text = "0.00"; | |||||
| // | |||||
| // WeightControl | |||||
| // | |||||
| this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); | |||||
| this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; | |||||
| this.BackColor = System.Drawing.Color.Transparent; | |||||
| this.Controls.Add(this.roundPanel1); | |||||
| this.Name = "WeightControl"; | |||||
| this.Size = new System.Drawing.Size(262, 74); | |||||
| this.roundPanel1.ResumeLayout(false); | |||||
| this.roundPanel2.ResumeLayout(false); | |||||
| this.roundPanel2.PerformLayout(); | |||||
| this.ResumeLayout(false); | |||||
| } | |||||
| #endregion | |||||
| private RoundPanel roundPanel1; | |||||
| private RoundPanel roundPanel2; | |||||
| private System.Windows.Forms.Label lblChengZhong; | |||||
| private ColorButton weightSwitch; | |||||
| private ColorButton settingBtn; | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,306 @@ | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.ComponentModel; | |||||
| using System.Drawing; | |||||
| using System.Data; | |||||
| using System.Linq; | |||||
| using System.Text; | |||||
| using System.Threading.Tasks; | |||||
| using System.Windows.Forms; | |||||
| using System.IO.Ports; | |||||
| using System.Threading; | |||||
| using System.Collections.Concurrent; | |||||
| using ButcherFactory.Utils; | |||||
| namespace ButcherFactory.Controls | |||||
| { | |||||
| public partial class WeightControl : UserControl | |||||
| { | |||||
| WeightConfig config; | |||||
| SerialPort weightPort; | |||||
| IDataFormat _dataFormat; | |||||
| Thread _inQueryThread; | |||||
| private bool _mainProcessIsRun; | |||||
| readonly StringBuilder _dataStrBuilder = new StringBuilder(); | |||||
| private bool switchOn; | |||||
| [Browsable(true), Description("称设置标识")] | |||||
| public string WeightFalg { get; set; } | |||||
| [Browsable(true), Description("读取到值的事件")] | |||||
| public event Action<decimal> ReceivedValue; | |||||
| [Browsable(false)] | |||||
| public decimal Weight | |||||
| { | |||||
| get | |||||
| { | |||||
| var v = decimal.Parse(lblChengZhong.Text); | |||||
| if (config != null) | |||||
| v -= (config.Discont ?? 0); | |||||
| return v; | |||||
| } | |||||
| } | |||||
| public WeightControl() | |||||
| { | |||||
| InitializeComponent(); | |||||
| } | |||||
| protected override void OnLoad(EventArgs e) | |||||
| { | |||||
| base.OnLoad(e); | |||||
| var parentForm = ControlsUtil.GetParentFormm(this); | |||||
| if (parentForm != null) | |||||
| { | |||||
| parentForm.FormClosing += delegate | |||||
| { | |||||
| if (_inQueryThread != null && _inQueryThread.IsAlive) | |||||
| { | |||||
| DisableWeight(); | |||||
| } | |||||
| }; | |||||
| } | |||||
| } | |||||
| private void settingBtn_Click(object sender, EventArgs e) | |||||
| { | |||||
| if (new WeightSettingFrom(WeightFalg).ShowDialog() == DialogResult.OK) | |||||
| config = WeightConfig.Init(WeightFalg); | |||||
| } | |||||
| private void weightSwitch_Click(object sender, EventArgs e) | |||||
| { | |||||
| try | |||||
| { | |||||
| if (config == null) | |||||
| { | |||||
| config = WeightConfig.Init(WeightFalg); | |||||
| WeighAvgControl.config = config; | |||||
| } | |||||
| settingBtn.Enabled = switchOn; | |||||
| switchOn = !switchOn; | |||||
| ChangeWeightBtnState(); | |||||
| if (switchOn) | |||||
| { | |||||
| OpenSerialPort(); | |||||
| _mainProcessIsRun = true; | |||||
| ReadData(); | |||||
| } | |||||
| else | |||||
| { | |||||
| DisableWeight(); | |||||
| } | |||||
| } | |||||
| catch | |||||
| { | |||||
| switchOn = !switchOn; | |||||
| settingBtn.Enabled = !switchOn; | |||||
| ChangeWeightBtnState(); | |||||
| throw; | |||||
| } | |||||
| finally | |||||
| { | |||||
| this.Focus(); | |||||
| } | |||||
| } | |||||
| void ChangeWeightBtnState() | |||||
| { | |||||
| if (switchOn) | |||||
| weightSwitch.Text = "停止称重"; | |||||
| else | |||||
| weightSwitch.Text = "启用称重"; | |||||
| } | |||||
| void OpenSerialPort() | |||||
| { | |||||
| if (!switchOn) | |||||
| return; | |||||
| if (config.RateSet == null) | |||||
| throw new Exception("请先配置称相关信息"); | |||||
| weightPort = new SerialPort(); | |||||
| weightPort.PortName = config.ComSet; | |||||
| weightPort.BaudRate = config.RateSet.Value; | |||||
| weightPort.DataBits = config.BitSet.Value; | |||||
| weightPort.ReadBufferSize = 4096 * 100; | |||||
| if (!string.IsNullOrEmpty(config.Format)) | |||||
| format = "{0:{format}}".Replace("{format}", config.Format); | |||||
| switch (config.WeightSet) | |||||
| { | |||||
| case "IND560": | |||||
| _dataFormat = new IND560DataFormat(); | |||||
| break; | |||||
| case "AHS3000": | |||||
| _dataFormat = new AoHaoSi3000DataFormat(); | |||||
| break; | |||||
| case "Xk3124": | |||||
| case "IND231": | |||||
| _dataFormat = new Xk3124DataFormat(); | |||||
| break; | |||||
| case "Xk3190A9": | |||||
| _dataFormat = new Xk3190A9DataFormat(); | |||||
| break; | |||||
| default: | |||||
| _dataFormat = new Xk3190D10DataFormat(); | |||||
| break; | |||||
| } | |||||
| if (!weightPort.IsOpen) | |||||
| { | |||||
| try | |||||
| { | |||||
| weightPort.Open(); | |||||
| } | |||||
| catch (InvalidOperationException) | |||||
| { | |||||
| throw new Exception("指定的端口已打开"); | |||||
| } | |||||
| catch (UnauthorizedAccessException) | |||||
| { | |||||
| throw new Exception("对端口的访问被拒绝"); | |||||
| } | |||||
| } | |||||
| } | |||||
| void ReadData() | |||||
| { | |||||
| _inQueryThread = new Thread(InQuery); | |||||
| _inQueryThread.Start(); | |||||
| } | |||||
| string format = "{0:0.00}"; | |||||
| private void InQuery() | |||||
| { | |||||
| while (_mainProcessIsRun) | |||||
| { | |||||
| int availableCount = weightPort.BytesToRead; | |||||
| if (availableCount == 0) | |||||
| { | |||||
| Thread.Sleep(10); | |||||
| } | |||||
| char[] buffer = new char[availableCount]; | |||||
| weightPort.Read(buffer, 0, availableCount); | |||||
| foreach (var c in buffer) | |||||
| { | |||||
| if (c == _dataFormat.Beginchar) | |||||
| { | |||||
| _dataStrBuilder.Clear(); | |||||
| _dataStrBuilder.Append(c); | |||||
| } | |||||
| else if (c == _dataFormat.Endchar || _dataStrBuilder.Length > _dataFormat.Bufsize) | |||||
| { | |||||
| _dataStrBuilder.Append(c); | |||||
| bool isStatic; | |||||
| string str; | |||||
| if (_dataFormat.ParseAscii(_dataStrBuilder.ToString(), out str, out isStatic)) | |||||
| { | |||||
| if (config.WeightType == 0) | |||||
| { | |||||
| if (string.IsNullOrEmpty(str)) | |||||
| str = "0"; | |||||
| this.Invoke(new Action(delegate() | |||||
| { | |||||
| decimal v = 0; | |||||
| decimal.TryParse(str, out v); | |||||
| lblChengZhong.Text = string.Format(format, v); | |||||
| if (str != "0") | |||||
| { | |||||
| if (ReceivedValue != null) | |||||
| ReceivedValue(v - (config.Discont ?? 0)); | |||||
| } | |||||
| })); | |||||
| } | |||||
| else | |||||
| { | |||||
| decimal num = 0; | |||||
| if (decimal.TryParse(str, out num)) | |||||
| { | |||||
| this.Invoke(new Action(delegate() | |||||
| { | |||||
| lblChengZhong.Text = string.Format(format, num); | |||||
| })); | |||||
| WeighAvgControl.Add(num, isStatic); | |||||
| } | |||||
| if (WeighAvgControl.TryGetValue(out num)) | |||||
| { | |||||
| this.Invoke(new Action(delegate() | |||||
| { | |||||
| if (str != "0") | |||||
| { | |||||
| if (ReceivedValue != null) | |||||
| ReceivedValue(num - (config.Discont ?? 0)); | |||||
| } | |||||
| })); | |||||
| } | |||||
| } | |||||
| } | |||||
| _dataStrBuilder.Clear(); | |||||
| } | |||||
| else | |||||
| { | |||||
| _dataStrBuilder.Append(c); | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| private class WeighAvgControl | |||||
| { | |||||
| public static WeightConfig config; | |||||
| public static bool TryGetValue(out decimal result) | |||||
| { | |||||
| List<Tuple<decimal, bool>> list; | |||||
| if (mWeighList.TryDequeue(out list)) | |||||
| { | |||||
| var r = list.Where(x => x.Item2).Select(x => x.Item1).GroupBy(x => x); | |||||
| var firstOrDefault = r.OrderByDescending(x => x.Count()).FirstOrDefault(); | |||||
| if (firstOrDefault != null) | |||||
| { | |||||
| result = firstOrDefault.Key; | |||||
| return true; | |||||
| } | |||||
| result = 0; | |||||
| return false; | |||||
| } | |||||
| result = 0; | |||||
| return false; | |||||
| } | |||||
| static ConcurrentQueue<List<Tuple<decimal, bool>>> mWeighList = new ConcurrentQueue<List<Tuple<decimal, bool>>>(); | |||||
| static List<Tuple<decimal, bool>> _list = new List<Tuple<decimal, bool>>(); | |||||
| public static void Add(decimal value, bool isStatic) | |||||
| { | |||||
| if (value >= config.MinWeight && value <= config.MaxWeight) | |||||
| { | |||||
| _list.Add(new Tuple<decimal, bool>(value, isStatic)); | |||||
| } | |||||
| else | |||||
| { | |||||
| if (_list.Count > 0) | |||||
| { | |||||
| mWeighList.Enqueue(_list); | |||||
| _list = new List<Tuple<decimal, bool>>(); | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| void DisableWeight() | |||||
| { | |||||
| _mainProcessIsRun = false; | |||||
| lblChengZhong.Text = string.Format(format, 0); | |||||
| format = "{0:0.00}"; | |||||
| Thread.Sleep(10); | |||||
| if (_inQueryThread.IsAlive) | |||||
| { | |||||
| _inQueryThread.Abort(); | |||||
| } | |||||
| if (weightPort.IsOpen) | |||||
| weightPort.Close(); | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,120 @@ | |||||
| <?xml version="1.0" encoding="utf-8"?> | |||||
| <root> | |||||
| <!-- | |||||
| Microsoft ResX Schema | |||||
| Version 2.0 | |||||
| The primary goals of this format is to allow a simple XML format | |||||
| that is mostly human readable. The generation and parsing of the | |||||
| various data types are done through the TypeConverter classes | |||||
| associated with the data types. | |||||
| Example: | |||||
| ... ado.net/XML headers & schema ... | |||||
| <resheader name="resmimetype">text/microsoft-resx</resheader> | |||||
| <resheader name="version">2.0</resheader> | |||||
| <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> | |||||
| <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> | |||||
| <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> | |||||
| <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> | |||||
| <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> | |||||
| <value>[base64 mime encoded serialized .NET Framework object]</value> | |||||
| </data> | |||||
| <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> | |||||
| <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> | |||||
| <comment>This is a comment</comment> | |||||
| </data> | |||||
| There are any number of "resheader" rows that contain simple | |||||
| name/value pairs. | |||||
| Each data row contains a name, and value. The row also contains a | |||||
| type or mimetype. Type corresponds to a .NET class that support | |||||
| text/value conversion through the TypeConverter architecture. | |||||
| Classes that don't support this are serialized and stored with the | |||||
| mimetype set. | |||||
| The mimetype is used for serialized objects, and tells the | |||||
| ResXResourceReader how to depersist the object. This is currently not | |||||
| extensible. For a given mimetype the value must be set accordingly: | |||||
| Note - application/x-microsoft.net.object.binary.base64 is the format | |||||
| that the ResXResourceWriter will generate, however the reader can | |||||
| read any of the formats listed below. | |||||
| mimetype: application/x-microsoft.net.object.binary.base64 | |||||
| value : The object must be serialized with | |||||
| : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter | |||||
| : and then encoded with base64 encoding. | |||||
| mimetype: application/x-microsoft.net.object.soap.base64 | |||||
| value : The object must be serialized with | |||||
| : System.Runtime.Serialization.Formatters.Soap.SoapFormatter | |||||
| : and then encoded with base64 encoding. | |||||
| mimetype: application/x-microsoft.net.object.bytearray.base64 | |||||
| value : The object must be serialized into a byte array | |||||
| : using a System.ComponentModel.TypeConverter | |||||
| : and then encoded with base64 encoding. | |||||
| --> | |||||
| <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> | |||||
| <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> | |||||
| <xsd:element name="root" msdata:IsDataSet="true"> | |||||
| <xsd:complexType> | |||||
| <xsd:choice maxOccurs="unbounded"> | |||||
| <xsd:element name="metadata"> | |||||
| <xsd:complexType> | |||||
| <xsd:sequence> | |||||
| <xsd:element name="value" type="xsd:string" minOccurs="0" /> | |||||
| </xsd:sequence> | |||||
| <xsd:attribute name="name" use="required" type="xsd:string" /> | |||||
| <xsd:attribute name="type" type="xsd:string" /> | |||||
| <xsd:attribute name="mimetype" type="xsd:string" /> | |||||
| <xsd:attribute ref="xml:space" /> | |||||
| </xsd:complexType> | |||||
| </xsd:element> | |||||
| <xsd:element name="assembly"> | |||||
| <xsd:complexType> | |||||
| <xsd:attribute name="alias" type="xsd:string" /> | |||||
| <xsd:attribute name="name" type="xsd:string" /> | |||||
| </xsd:complexType> | |||||
| </xsd:element> | |||||
| <xsd:element name="data"> | |||||
| <xsd:complexType> | |||||
| <xsd:sequence> | |||||
| <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | |||||
| <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> | |||||
| </xsd:sequence> | |||||
| <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> | |||||
| <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> | |||||
| <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> | |||||
| <xsd:attribute ref="xml:space" /> | |||||
| </xsd:complexType> | |||||
| </xsd:element> | |||||
| <xsd:element name="resheader"> | |||||
| <xsd:complexType> | |||||
| <xsd:sequence> | |||||
| <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | |||||
| </xsd:sequence> | |||||
| <xsd:attribute name="name" type="xsd:string" use="required" /> | |||||
| </xsd:complexType> | |||||
| </xsd:element> | |||||
| </xsd:choice> | |||||
| </xsd:complexType> | |||||
| </xsd:element> | |||||
| </xsd:schema> | |||||
| <resheader name="resmimetype"> | |||||
| <value>text/microsoft-resx</value> | |||||
| </resheader> | |||||
| <resheader name="version"> | |||||
| <value>2.0</value> | |||||
| </resheader> | |||||
| <resheader name="reader"> | |||||
| <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | |||||
| </resheader> | |||||
| <resheader name="writer"> | |||||
| <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | |||||
| </resheader> | |||||
| </root> | |||||
| @ -0,0 +1,305 @@ | |||||
| namespace ButcherFactory.Controls | |||||
| { | |||||
| partial class WeightSettingFrom | |||||
| { | |||||
| /// <summary> | |||||
| /// Required designer variable. | |||||
| /// </summary> | |||||
| private System.ComponentModel.IContainer components = null; | |||||
| /// <summary> | |||||
| /// Clean up any resources being used. | |||||
| /// </summary> | |||||
| /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> | |||||
| protected override void Dispose(bool disposing) | |||||
| { | |||||
| if (disposing && (components != null)) | |||||
| { | |||||
| components.Dispose(); | |||||
| } | |||||
| base.Dispose(disposing); | |||||
| } | |||||
| #region Windows Form Designer generated code | |||||
| /// <summary> | |||||
| /// Required method for Designer support - do not modify | |||||
| /// the contents of this method with the code editor. | |||||
| /// </summary> | |||||
| private void InitializeComponent() | |||||
| { | |||||
| this.maxInput = new WinFormControl.UTextBoxWithPad(); | |||||
| this.minInput = new WinFormControl.UTextBoxWithPad(); | |||||
| this.label8 = new WinFormControl.ULabel(); | |||||
| this.weightReadType = new System.Windows.Forms.ComboBox(); | |||||
| this.label7 = new WinFormControl.ULabel(); | |||||
| this.discont = new WinFormControl.UTextBoxWithPad(); | |||||
| this.format = new WinFormControl.UTextBoxWithPad(); | |||||
| this.label6 = new WinFormControl.ULabel(); | |||||
| this.label5 = new WinFormControl.ULabel(); | |||||
| this.bitSet = new System.Windows.Forms.ComboBox(); | |||||
| this.rateSet = new System.Windows.Forms.ComboBox(); | |||||
| this.comSet = new System.Windows.Forms.ComboBox(); | |||||
| this.weightSet = new System.Windows.Forms.ComboBox(); | |||||
| this.label4 = new WinFormControl.ULabel(); | |||||
| this.label3 = new WinFormControl.ULabel(); | |||||
| this.label2 = new WinFormControl.ULabel(); | |||||
| this.label1 = new WinFormControl.ULabel(); | |||||
| this.saveBtn = new ButcherFactory.Controls.ColorButton(); | |||||
| this.closeBtn = new ButcherFactory.Controls.ColorButton(); | |||||
| this.SuspendLayout(); | |||||
| // | |||||
| // maxInput | |||||
| // | |||||
| this.maxInput.Font = new System.Drawing.Font("宋体", 12F); | |||||
| this.maxInput.Location = new System.Drawing.Point(259, 366); | |||||
| this.maxInput.Name = "maxInput"; | |||||
| this.maxInput.Size = new System.Drawing.Size(55, 26); | |||||
| this.maxInput.TabIndex = 84; | |||||
| this.maxInput.Type = WinFormControl.UTextBoxWithPad.TextBoxType.Number; | |||||
| // | |||||
| // minInput | |||||
| // | |||||
| this.minInput.Font = new System.Drawing.Font("宋体", 12F); | |||||
| this.minInput.Location = new System.Drawing.Point(193, 366); | |||||
| this.minInput.Name = "minInput"; | |||||
| this.minInput.Size = new System.Drawing.Size(55, 26); | |||||
| this.minInput.TabIndex = 83; | |||||
| this.minInput.Type = WinFormControl.UTextBoxWithPad.TextBoxType.Number; | |||||
| // | |||||
| // label8 | |||||
| // | |||||
| this.label8.AutoSize = true; | |||||
| this.label8.BackColor = System.Drawing.Color.Transparent; | |||||
| this.label8.Font = new System.Drawing.Font("宋体", 15F); | |||||
| this.label8.Location = new System.Drawing.Point(71, 366); | |||||
| this.label8.Name = "label8"; | |||||
| this.label8.Size = new System.Drawing.Size(109, 20); | |||||
| this.label8.TabIndex = 82; | |||||
| this.label8.Text = "有效区间:"; | |||||
| // | |||||
| // weightReadType | |||||
| // | |||||
| this.weightReadType.Font = new System.Drawing.Font("宋体", 15F); | |||||
| this.weightReadType.FormattingEnabled = true; | |||||
| this.weightReadType.Location = new System.Drawing.Point(193, 319); | |||||
| this.weightReadType.Name = "weightReadType"; | |||||
| this.weightReadType.Size = new System.Drawing.Size(121, 28); | |||||
| this.weightReadType.TabIndex = 81; | |||||
| // | |||||
| // label7 | |||||
| // | |||||
| this.label7.AutoSize = true; | |||||
| this.label7.BackColor = System.Drawing.Color.Transparent; | |||||
| this.label7.Font = new System.Drawing.Font("宋体", 15F); | |||||
| this.label7.Location = new System.Drawing.Point(71, 322); | |||||
| this.label7.Name = "label7"; | |||||
| this.label7.Size = new System.Drawing.Size(109, 20); | |||||
| this.label7.TabIndex = 80; | |||||
| this.label7.Text = "读取方式:"; | |||||
| // | |||||
| // discont | |||||
| // | |||||
| this.discont.Font = new System.Drawing.Font("宋体", 14F); | |||||
| this.discont.Location = new System.Drawing.Point(193, 270); | |||||
| this.discont.Name = "discont"; | |||||
| this.discont.Size = new System.Drawing.Size(121, 29); | |||||
| this.discont.TabIndex = 79; | |||||
| this.discont.Type = WinFormControl.UTextBoxWithPad.TextBoxType.Number; | |||||
| // | |||||
| // format | |||||
| // | |||||
| this.format.Font = new System.Drawing.Font("宋体", 14F); | |||||
| this.format.Location = new System.Drawing.Point(193, 222); | |||||
| this.format.Name = "format"; | |||||
| this.format.Size = new System.Drawing.Size(121, 29); | |||||
| this.format.TabIndex = 78; | |||||
| this.format.Type = WinFormControl.UTextBoxWithPad.TextBoxType.Number; | |||||
| // | |||||
| // label6 | |||||
| // | |||||
| this.label6.AutoSize = true; | |||||
| this.label6.BackColor = System.Drawing.Color.Transparent; | |||||
| this.label6.Font = new System.Drawing.Font("宋体", 15F); | |||||
| this.label6.Location = new System.Drawing.Point(71, 279); | |||||
| this.label6.Name = "label6"; | |||||
| this.label6.Size = new System.Drawing.Size(69, 20); | |||||
| this.label6.TabIndex = 77; | |||||
| this.label6.Text = "扣重:"; | |||||
| // | |||||
| // label5 | |||||
| // | |||||
| this.label5.AutoSize = true; | |||||
| this.label5.BackColor = System.Drawing.Color.Transparent; | |||||
| this.label5.Font = new System.Drawing.Font("宋体", 15F); | |||||
| this.label5.Location = new System.Drawing.Point(71, 228); | |||||
| this.label5.Name = "label5"; | |||||
| this.label5.Size = new System.Drawing.Size(109, 20); | |||||
| this.label5.TabIndex = 76; | |||||
| this.label5.Text = "显示格式:"; | |||||
| // | |||||
| // bitSet | |||||
| // | |||||
| this.bitSet.Font = new System.Drawing.Font("宋体", 15F); | |||||
| this.bitSet.FormattingEnabled = true; | |||||
| this.bitSet.Location = new System.Drawing.Point(193, 175); | |||||
| this.bitSet.Name = "bitSet"; | |||||
| this.bitSet.Size = new System.Drawing.Size(121, 28); | |||||
| this.bitSet.TabIndex = 73; | |||||
| // | |||||
| // rateSet | |||||
| // | |||||
| this.rateSet.Font = new System.Drawing.Font("宋体", 15F); | |||||
| this.rateSet.FormattingEnabled = true; | |||||
| this.rateSet.Location = new System.Drawing.Point(193, 123); | |||||
| this.rateSet.Name = "rateSet"; | |||||
| this.rateSet.Size = new System.Drawing.Size(121, 28); | |||||
| this.rateSet.TabIndex = 74; | |||||
| // | |||||
| // comSet | |||||
| // | |||||
| this.comSet.Font = new System.Drawing.Font("宋体", 15F); | |||||
| this.comSet.FormattingEnabled = true; | |||||
| this.comSet.Location = new System.Drawing.Point(193, 73); | |||||
| this.comSet.Name = "comSet"; | |||||
| this.comSet.Size = new System.Drawing.Size(121, 28); | |||||
| this.comSet.TabIndex = 75; | |||||
| // | |||||
| // weightSet | |||||
| // | |||||
| this.weightSet.Font = new System.Drawing.Font("宋体", 15F); | |||||
| this.weightSet.FormattingEnabled = true; | |||||
| this.weightSet.Location = new System.Drawing.Point(193, 25); | |||||
| this.weightSet.Name = "weightSet"; | |||||
| this.weightSet.Size = new System.Drawing.Size(121, 28); | |||||
| this.weightSet.TabIndex = 72; | |||||
| // | |||||
| // label4 | |||||
| // | |||||
| this.label4.AutoSize = true; | |||||
| this.label4.BackColor = System.Drawing.Color.Transparent; | |||||
| this.label4.Font = new System.Drawing.Font("宋体", 15F); | |||||
| this.label4.Location = new System.Drawing.Point(71, 178); | |||||
| this.label4.Name = "label4"; | |||||
| this.label4.Size = new System.Drawing.Size(89, 20); | |||||
| this.label4.TabIndex = 71; | |||||
| this.label4.Text = "数据位:"; | |||||
| // | |||||
| // label3 | |||||
| // | |||||
| this.label3.AutoSize = true; | |||||
| this.label3.BackColor = System.Drawing.Color.Transparent; | |||||
| this.label3.Font = new System.Drawing.Font("宋体", 15F); | |||||
| this.label3.Location = new System.Drawing.Point(71, 126); | |||||
| this.label3.Name = "label3"; | |||||
| this.label3.Size = new System.Drawing.Size(89, 20); | |||||
| this.label3.TabIndex = 70; | |||||
| this.label3.Text = "波特率:"; | |||||
| // | |||||
| // label2 | |||||
| // | |||||
| this.label2.AutoSize = true; | |||||
| this.label2.BackColor = System.Drawing.Color.Transparent; | |||||
| this.label2.Font = new System.Drawing.Font("宋体", 15F); | |||||
| this.label2.Location = new System.Drawing.Point(71, 76); | |||||
| this.label2.Name = "label2"; | |||||
| this.label2.Size = new System.Drawing.Size(89, 20); | |||||
| this.label2.TabIndex = 69; | |||||
| this.label2.Text = "端口号:"; | |||||
| // | |||||
| // label1 | |||||
| // | |||||
| this.label1.AutoSize = true; | |||||
| this.label1.BackColor = System.Drawing.Color.Transparent; | |||||
| this.label1.Font = new System.Drawing.Font("宋体", 15F); | |||||
| this.label1.Location = new System.Drawing.Point(71, 28); | |||||
| this.label1.Name = "label1"; | |||||
| this.label1.Size = new System.Drawing.Size(89, 20); | |||||
| this.label1.TabIndex = 68; | |||||
| this.label1.Text = "称型号:"; | |||||
| // | |||||
| // saveBtn | |||||
| // | |||||
| this.saveBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(21)))), ((int)(((byte)(198)))), ((int)(((byte)(58))))); | |||||
| this.saveBtn.Font = new System.Drawing.Font("宋体", 12F); | |||||
| this.saveBtn.ForeColor = System.Drawing.Color.White; | |||||
| this.saveBtn.Location = new System.Drawing.Point(95, 426); | |||||
| this.saveBtn.Name = "saveBtn"; | |||||
| this.saveBtn.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(158)))), ((int)(((byte)(234)))), ((int)(((byte)(106))))); | |||||
| this.saveBtn.Size = new System.Drawing.Size(84, 35); | |||||
| this.saveBtn.TabIndex = 85; | |||||
| this.saveBtn.Text = "保存"; | |||||
| this.saveBtn.UseVisualStyleBackColor = false; | |||||
| this.saveBtn.Click += new System.EventHandler(this.saveBtn_Click); | |||||
| // | |||||
| // closeBtn | |||||
| // | |||||
| this.closeBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(25))))); | |||||
| this.closeBtn.Font = new System.Drawing.Font("宋体", 12F); | |||||
| this.closeBtn.ForeColor = System.Drawing.Color.White; | |||||
| this.closeBtn.Location = new System.Drawing.Point(224, 426); | |||||
| this.closeBtn.Name = "closeBtn"; | |||||
| this.closeBtn.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(158)))), ((int)(((byte)(234)))), ((int)(((byte)(106))))); | |||||
| this.closeBtn.Size = new System.Drawing.Size(84, 35); | |||||
| this.closeBtn.TabIndex = 85; | |||||
| this.closeBtn.Text = "关闭"; | |||||
| this.closeBtn.UseVisualStyleBackColor = false; | |||||
| this.closeBtn.Click += new System.EventHandler(this.closeBtn_Click); | |||||
| // | |||||
| // WeightSettingFrom | |||||
| // | |||||
| 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(391, 481); | |||||
| this.ControlBox = false; | |||||
| this.Controls.Add(this.closeBtn); | |||||
| this.Controls.Add(this.saveBtn); | |||||
| this.Controls.Add(this.maxInput); | |||||
| this.Controls.Add(this.minInput); | |||||
| this.Controls.Add(this.label8); | |||||
| this.Controls.Add(this.weightReadType); | |||||
| this.Controls.Add(this.label7); | |||||
| this.Controls.Add(this.discont); | |||||
| this.Controls.Add(this.format); | |||||
| this.Controls.Add(this.label6); | |||||
| this.Controls.Add(this.label5); | |||||
| this.Controls.Add(this.bitSet); | |||||
| this.Controls.Add(this.rateSet); | |||||
| this.Controls.Add(this.comSet); | |||||
| this.Controls.Add(this.weightSet); | |||||
| this.Controls.Add(this.label4); | |||||
| this.Controls.Add(this.label3); | |||||
| this.Controls.Add(this.label2); | |||||
| this.Controls.Add(this.label1); | |||||
| this.Name = "WeightSettingFrom"; | |||||
| this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; | |||||
| this.Text = "称设置"; | |||||
| this.ResumeLayout(false); | |||||
| this.PerformLayout(); | |||||
| } | |||||
| #endregion | |||||
| private WinFormControl.UTextBoxWithPad maxInput; | |||||
| private WinFormControl.UTextBoxWithPad minInput; | |||||
| private WinFormControl.ULabel label8; | |||||
| private System.Windows.Forms.ComboBox weightReadType; | |||||
| private WinFormControl.ULabel label7; | |||||
| private WinFormControl.UTextBoxWithPad discont; | |||||
| private WinFormControl.UTextBoxWithPad format; | |||||
| private WinFormControl.ULabel label6; | |||||
| private WinFormControl.ULabel label5; | |||||
| private System.Windows.Forms.ComboBox bitSet; | |||||
| private System.Windows.Forms.ComboBox rateSet; | |||||
| private System.Windows.Forms.ComboBox comSet; | |||||
| private System.Windows.Forms.ComboBox weightSet; | |||||
| private WinFormControl.ULabel label4; | |||||
| private WinFormControl.ULabel label3; | |||||
| private WinFormControl.ULabel label2; | |||||
| private WinFormControl.ULabel label1; | |||||
| private ColorButton saveBtn; | |||||
| private ColorButton closeBtn; | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,104 @@ | |||||
| 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.Controls | |||||
| { | |||||
| public partial class WeightSettingFrom : Form | |||||
| { | |||||
| List<string> weight = new List<string> { "IND560", "Xk3124", "Xk3190A9", "Xk3190D10", "IND231", "AHS3000" }; | |||||
| List<string> com = new List<string> { "COM1", "COM2", "COM3", "COM4", "COM5" }; | |||||
| List<string> rate = new List<string> { "1200", "2400", "4800", "7200", "9600" }; | |||||
| List<string> bit = new List<string> { "5", "6", "7", "8" }; | |||||
| List<string> weightRead = new List<string> { "稳定读取", "连续发送" }; | |||||
| string _flag; | |||||
| WeightConfig config; | |||||
| public WeightSettingFrom(string flag) | |||||
| { | |||||
| this._flag = flag; | |||||
| InitializeComponent(); | |||||
| weightSet.DataSource = weight; | |||||
| comSet.DataSource = com; | |||||
| rateSet.DataSource = rate; | |||||
| bitSet.DataSource = bit; | |||||
| weightReadType.DataSource = weightRead; | |||||
| config = WeightConfig.Init(flag); | |||||
| if (!string.IsNullOrEmpty(config.WeightSet)) | |||||
| weightSet.SelectedIndex = weight.IndexOf(config.WeightSet); | |||||
| else | |||||
| weightSet.SelectedIndex = 0; | |||||
| if (!string.IsNullOrEmpty(config.ComSet)) | |||||
| comSet.SelectedIndex = com.IndexOf(config.ComSet); | |||||
| else | |||||
| comSet.SelectedIndex = 0; | |||||
| if (config.RateSet.HasValue) | |||||
| rateSet.SelectedIndex = rate.IndexOf(config.RateSet.ToString()); | |||||
| else | |||||
| rateSet.SelectedIndex = 2; | |||||
| if (config.BitSet.HasValue) | |||||
| bitSet.SelectedIndex = bit.IndexOf(config.BitSet.ToString()); | |||||
| else | |||||
| bitSet.SelectedIndex = 3; | |||||
| if (string.IsNullOrEmpty(config.Format)) | |||||
| format.Text = "0.00"; | |||||
| else | |||||
| format.Text = config.Format; | |||||
| if (config.Discont == null) | |||||
| discont.Text = "0.00"; | |||||
| else | |||||
| discont.Text = config.Discont.ToString(); | |||||
| weightReadType.SelectedIndex = config.WeightType; | |||||
| minInput.Text = config.MinWeight.ToString(); | |||||
| maxInput.Text = config.MaxWeight.ToString(); | |||||
| } | |||||
| bool changed; | |||||
| private void saveBtn_Click(object sender, EventArgs e) | |||||
| { | |||||
| config.WeightSet = weight[this.weightSet.SelectedIndex]; | |||||
| config.ComSet = com[this.comSet.SelectedIndex]; | |||||
| config.RateSet = int.Parse(rate[this.rateSet.SelectedIndex]); | |||||
| config.BitSet = int.Parse(bit[this.bitSet.SelectedIndex]); | |||||
| config.Format = format.Text; | |||||
| config.WeightType = weightReadType.SelectedIndex; | |||||
| if (config.WeightType == 1) | |||||
| { | |||||
| decimal min = 0; | |||||
| decimal max = 0; | |||||
| if (!decimal.TryParse(minInput.Text.Trim(), out min)) | |||||
| throw new Exception("连续发送时 必须输入有效区间"); | |||||
| if (!decimal.TryParse(maxInput.Text.Trim(), out max)) | |||||
| throw new Exception("连续发送时 必须输入有效区间"); | |||||
| config.MinWeight = min; | |||||
| config.MaxWeight = max; | |||||
| } | |||||
| if (!string.IsNullOrEmpty(discont.Text)) | |||||
| { | |||||
| decimal v; | |||||
| if (decimal.TryParse(discont.Text, out v)) | |||||
| config.Discont = v; | |||||
| else | |||||
| throw new Exception("扣重格式输入不正确"); | |||||
| } | |||||
| else | |||||
| config.Discont = 0; | |||||
| config.Save(_flag); | |||||
| changed = true; | |||||
| MessageBox.Show("保存成功!"); | |||||
| } | |||||
| private void closeBtn_Click(object sender, EventArgs e) | |||||
| { | |||||
| if (changed) | |||||
| DialogResult = DialogResult.OK; | |||||
| Close(); | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,120 @@ | |||||
| <?xml version="1.0" encoding="utf-8"?> | |||||
| <root> | |||||
| <!-- | |||||
| Microsoft ResX Schema | |||||
| Version 2.0 | |||||
| The primary goals of this format is to allow a simple XML format | |||||
| that is mostly human readable. The generation and parsing of the | |||||
| various data types are done through the TypeConverter classes | |||||
| associated with the data types. | |||||
| Example: | |||||
| ... ado.net/XML headers & schema ... | |||||
| <resheader name="resmimetype">text/microsoft-resx</resheader> | |||||
| <resheader name="version">2.0</resheader> | |||||
| <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> | |||||
| <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> | |||||
| <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> | |||||
| <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> | |||||
| <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> | |||||
| <value>[base64 mime encoded serialized .NET Framework object]</value> | |||||
| </data> | |||||
| <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> | |||||
| <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> | |||||
| <comment>This is a comment</comment> | |||||
| </data> | |||||
| There are any number of "resheader" rows that contain simple | |||||
| name/value pairs. | |||||
| Each data row contains a name, and value. The row also contains a | |||||
| type or mimetype. Type corresponds to a .NET class that support | |||||
| text/value conversion through the TypeConverter architecture. | |||||
| Classes that don't support this are serialized and stored with the | |||||
| mimetype set. | |||||
| The mimetype is used for serialized objects, and tells the | |||||
| ResXResourceReader how to depersist the object. This is currently not | |||||
| extensible. For a given mimetype the value must be set accordingly: | |||||
| Note - application/x-microsoft.net.object.binary.base64 is the format | |||||
| that the ResXResourceWriter will generate, however the reader can | |||||
| read any of the formats listed below. | |||||
| mimetype: application/x-microsoft.net.object.binary.base64 | |||||
| value : The object must be serialized with | |||||
| : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter | |||||
| : and then encoded with base64 encoding. | |||||
| mimetype: application/x-microsoft.net.object.soap.base64 | |||||
| value : The object must be serialized with | |||||
| : System.Runtime.Serialization.Formatters.Soap.SoapFormatter | |||||
| : and then encoded with base64 encoding. | |||||
| mimetype: application/x-microsoft.net.object.bytearray.base64 | |||||
| value : The object must be serialized into a byte array | |||||
| : using a System.ComponentModel.TypeConverter | |||||
| : and then encoded with base64 encoding. | |||||
| --> | |||||
| <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> | |||||
| <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> | |||||
| <xsd:element name="root" msdata:IsDataSet="true"> | |||||
| <xsd:complexType> | |||||
| <xsd:choice maxOccurs="unbounded"> | |||||
| <xsd:element name="metadata"> | |||||
| <xsd:complexType> | |||||
| <xsd:sequence> | |||||
| <xsd:element name="value" type="xsd:string" minOccurs="0" /> | |||||
| </xsd:sequence> | |||||
| <xsd:attribute name="name" use="required" type="xsd:string" /> | |||||
| <xsd:attribute name="type" type="xsd:string" /> | |||||
| <xsd:attribute name="mimetype" type="xsd:string" /> | |||||
| <xsd:attribute ref="xml:space" /> | |||||
| </xsd:complexType> | |||||
| </xsd:element> | |||||
| <xsd:element name="assembly"> | |||||
| <xsd:complexType> | |||||
| <xsd:attribute name="alias" type="xsd:string" /> | |||||
| <xsd:attribute name="name" type="xsd:string" /> | |||||
| </xsd:complexType> | |||||
| </xsd:element> | |||||
| <xsd:element name="data"> | |||||
| <xsd:complexType> | |||||
| <xsd:sequence> | |||||
| <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | |||||
| <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> | |||||
| </xsd:sequence> | |||||
| <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> | |||||
| <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> | |||||
| <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> | |||||
| <xsd:attribute ref="xml:space" /> | |||||
| </xsd:complexType> | |||||
| </xsd:element> | |||||
| <xsd:element name="resheader"> | |||||
| <xsd:complexType> | |||||
| <xsd:sequence> | |||||
| <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | |||||
| </xsd:sequence> | |||||
| <xsd:attribute name="name" type="xsd:string" use="required" /> | |||||
| </xsd:complexType> | |||||
| </xsd:element> | |||||
| </xsd:choice> | |||||
| </xsd:complexType> | |||||
| </xsd:element> | |||||
| </xsd:schema> | |||||
| <resheader name="resmimetype"> | |||||
| <value>text/microsoft-resx</value> | |||||
| </resheader> | |||||
| <resheader name="version"> | |||||
| <value>2.0</value> | |||||
| </resheader> | |||||
| <resheader name="reader"> | |||||
| <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | |||||
| </resheader> | |||||
| <resheader name="writer"> | |||||
| <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | |||||
| </resheader> | |||||
| </root> | |||||
| @ -0,0 +1,73 @@ | |||||
| //------------------------------------------------------------------------------ | |||||
| // <auto-generated> | |||||
| // 此代码由工具生成。 | |||||
| // 运行时版本:4.0.30319.42000 | |||||
| // | |||||
| // 对此文件的更改可能会导致不正确的行为,并且如果 | |||||
| // 重新生成代码,这些更改将会丢失。 | |||||
| // </auto-generated> | |||||
| //------------------------------------------------------------------------------ | |||||
| namespace ButcherFactory.Properties { | |||||
| using System; | |||||
| /// <summary> | |||||
| /// 一个强类型的资源类,用于查找本地化的字符串等。 | |||||
| /// </summary> | |||||
| // 此类是由 StronglyTypedResourceBuilder | |||||
| // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 | |||||
| // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen | |||||
| // (以 /str 作为命令选项),或重新生成 VS 项目。 | |||||
| [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] | |||||
| [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] | |||||
| [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] | |||||
| internal class Resources { | |||||
| private static global::System.Resources.ResourceManager resourceMan; | |||||
| private static global::System.Globalization.CultureInfo resourceCulture; | |||||
| [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] | |||||
| internal Resources() { | |||||
| } | |||||
| /// <summary> | |||||
| /// 返回此类使用的缓存的 ResourceManager 实例。 | |||||
| /// </summary> | |||||
| [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] | |||||
| internal static global::System.Resources.ResourceManager ResourceManager { | |||||
| get { | |||||
| if (object.ReferenceEquals(resourceMan, null)) { | |||||
| global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ButcherFactory.Properties.Resources", typeof(Resources).Assembly); | |||||
| resourceMan = temp; | |||||
| } | |||||
| return resourceMan; | |||||
| } | |||||
| } | |||||
| /// <summary> | |||||
| /// 使用此强类型资源类,为所有资源查找 | |||||
| /// 重写当前线程的 CurrentUICulture 属性。 | |||||
| /// </summary> | |||||
| [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] | |||||
| internal static global::System.Globalization.CultureInfo Culture { | |||||
| get { | |||||
| return resourceCulture; | |||||
| } | |||||
| set { | |||||
| resourceCulture = value; | |||||
| } | |||||
| } | |||||
| /// <summary> | |||||
| /// 查找 System.Drawing.Bitmap 类型的本地化资源。 | |||||
| /// </summary> | |||||
| internal static System.Drawing.Bitmap closeImg { | |||||
| get { | |||||
| object obj = ResourceManager.GetObject("closeImg", resourceCulture); | |||||
| return ((System.Drawing.Bitmap)(obj)); | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,124 @@ | |||||
| <?xml version="1.0" encoding="utf-8"?> | |||||
| <root> | |||||
| <!-- | |||||
| Microsoft ResX Schema | |||||
| Version 2.0 | |||||
| The primary goals of this format is to allow a simple XML format | |||||
| that is mostly human readable. The generation and parsing of the | |||||
| various data types are done through the TypeConverter classes | |||||
| associated with the data types. | |||||
| Example: | |||||
| ... ado.net/XML headers & schema ... | |||||
| <resheader name="resmimetype">text/microsoft-resx</resheader> | |||||
| <resheader name="version">2.0</resheader> | |||||
| <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> | |||||
| <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> | |||||
| <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> | |||||
| <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> | |||||
| <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> | |||||
| <value>[base64 mime encoded serialized .NET Framework object]</value> | |||||
| </data> | |||||
| <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> | |||||
| <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> | |||||
| <comment>This is a comment</comment> | |||||
| </data> | |||||
| There are any number of "resheader" rows that contain simple | |||||
| name/value pairs. | |||||
| Each data row contains a name, and value. The row also contains a | |||||
| type or mimetype. Type corresponds to a .NET class that support | |||||
| text/value conversion through the TypeConverter architecture. | |||||
| Classes that don't support this are serialized and stored with the | |||||
| mimetype set. | |||||
| The mimetype is used for serialized objects, and tells the | |||||
| ResXResourceReader how to depersist the object. This is currently not | |||||
| extensible. For a given mimetype the value must be set accordingly: | |||||
| Note - application/x-microsoft.net.object.binary.base64 is the format | |||||
| that the ResXResourceWriter will generate, however the reader can | |||||
| read any of the formats listed below. | |||||
| mimetype: application/x-microsoft.net.object.binary.base64 | |||||
| value : The object must be serialized with | |||||
| : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter | |||||
| : and then encoded with base64 encoding. | |||||
| mimetype: application/x-microsoft.net.object.soap.base64 | |||||
| value : The object must be serialized with | |||||
| : System.Runtime.Serialization.Formatters.Soap.SoapFormatter | |||||
| : and then encoded with base64 encoding. | |||||
| mimetype: application/x-microsoft.net.object.bytearray.base64 | |||||
| value : The object must be serialized into a byte array | |||||
| : using a System.ComponentModel.TypeConverter | |||||
| : and then encoded with base64 encoding. | |||||
| --> | |||||
| <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> | |||||
| <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> | |||||
| <xsd:element name="root" msdata:IsDataSet="true"> | |||||
| <xsd:complexType> | |||||
| <xsd:choice maxOccurs="unbounded"> | |||||
| <xsd:element name="metadata"> | |||||
| <xsd:complexType> | |||||
| <xsd:sequence> | |||||
| <xsd:element name="value" type="xsd:string" minOccurs="0" /> | |||||
| </xsd:sequence> | |||||
| <xsd:attribute name="name" use="required" type="xsd:string" /> | |||||
| <xsd:attribute name="type" type="xsd:string" /> | |||||
| <xsd:attribute name="mimetype" type="xsd:string" /> | |||||
| <xsd:attribute ref="xml:space" /> | |||||
| </xsd:complexType> | |||||
| </xsd:element> | |||||
| <xsd:element name="assembly"> | |||||
| <xsd:complexType> | |||||
| <xsd:attribute name="alias" type="xsd:string" /> | |||||
| <xsd:attribute name="name" type="xsd:string" /> | |||||
| </xsd:complexType> | |||||
| </xsd:element> | |||||
| <xsd:element name="data"> | |||||
| <xsd:complexType> | |||||
| <xsd:sequence> | |||||
| <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | |||||
| <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> | |||||
| </xsd:sequence> | |||||
| <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> | |||||
| <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> | |||||
| <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> | |||||
| <xsd:attribute ref="xml:space" /> | |||||
| </xsd:complexType> | |||||
| </xsd:element> | |||||
| <xsd:element name="resheader"> | |||||
| <xsd:complexType> | |||||
| <xsd:sequence> | |||||
| <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | |||||
| </xsd:sequence> | |||||
| <xsd:attribute name="name" type="xsd:string" use="required" /> | |||||
| </xsd:complexType> | |||||
| </xsd:element> | |||||
| </xsd:choice> | |||||
| </xsd:complexType> | |||||
| </xsd:element> | |||||
| </xsd:schema> | |||||
| <resheader name="resmimetype"> | |||||
| <value>text/microsoft-resx</value> | |||||
| </resheader> | |||||
| <resheader name="version"> | |||||
| <value>2.0</value> | |||||
| </resheader> | |||||
| <resheader name="reader"> | |||||
| <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | |||||
| </resheader> | |||||
| <resheader name="writer"> | |||||
| <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | |||||
| </resheader> | |||||
| <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> | |||||
| <data name="closeImg" type="System.Resources.ResXFileRef, System.Windows.Forms"> | |||||
| <value>..\Resources\closeImg.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> | |||||
| </data> | |||||
| </root> | |||||
| @ -0,0 +1,633 @@ | |||||
| namespace ButcherFactory.SegmentStockUp_ | |||||
| { | |||||
| partial class SegmentStockUpForm | |||||
| { | |||||
| /// <summary> | |||||
| /// Required designer variable. | |||||
| /// </summary> | |||||
| private System.ComponentModel.IContainer components = null; | |||||
| /// <summary> | |||||
| /// Clean up any resources being used. | |||||
| /// </summary> | |||||
| /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> | |||||
| protected override void Dispose(bool disposing) | |||||
| { | |||||
| if (disposing && (components != null)) | |||||
| { | |||||
| components.Dispose(); | |||||
| } | |||||
| base.Dispose(disposing); | |||||
| } | |||||
| #region Windows Form Designer generated code | |||||
| /// <summary> | |||||
| /// Required method for Designer support - do not modify | |||||
| /// the contents of this method with the code editor. | |||||
| /// </summary> | |||||
| private void InitializeComponent() | |||||
| { | |||||
| System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle(); | |||||
| System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle(); | |||||
| System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle(); | |||||
| System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle(); | |||||
| System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle(); | |||||
| System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle(); | |||||
| System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle(); | |||||
| System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); | |||||
| System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); | |||||
| System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = 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(); | |||||
| this.uScanPanel1 = new WinFormControl.UScanPanel(); | |||||
| this.label1 = new System.Windows.Forms.Label(); | |||||
| this.dataPicker = new System.Windows.Forms.Label(); | |||||
| this.panel4 = new System.Windows.Forms.Panel(); | |||||
| this.goodsLbl = new System.Windows.Forms.Label(); | |||||
| this.driveLineLbl = new System.Windows.Forms.Label(); | |||||
| this.label4 = new System.Windows.Forms.Label(); | |||||
| this.dhNumberLbl = new System.Windows.Forms.Label(); | |||||
| this.panel5 = new System.Windows.Forms.Panel(); | |||||
| this.mainGridView = new WinFormControl.UDataGridView(); | |||||
| this.D_DeliverGoodsLine_ID = new System.Windows.Forms.DataGridViewTextBoxColumn(); | |||||
| this.D_Goods_ID = new System.Windows.Forms.DataGridViewTextBoxColumn(); | |||||
| this.D_Date = new System.Windows.Forms.DataGridViewTextBoxColumn(); | |||||
| this.D_Finishd = new System.Windows.Forms.DataGridViewTextBoxColumn(); | |||||
| this.D_DeliverGoodsLine_Name = new System.Windows.Forms.DataGridViewTextBoxColumn(); | |||||
| this.D_Goods_Name = new System.Windows.Forms.DataGridViewTextBoxColumn(); | |||||
| this.D_Goods_Spec = new System.Windows.Forms.DataGridViewTextBoxColumn(); | |||||
| this.D_SecondNumber = new System.Windows.Forms.DataGridViewTextBoxColumn(); | |||||
| this.D_UnitNum = new System.Windows.Forms.DataGridViewTextBoxColumn(); | |||||
| this.D_SSecondNumber = new System.Windows.Forms.DataGridViewTextBoxColumn(); | |||||
| this.D_SUnitNum = new System.Windows.Forms.DataGridViewTextBoxColumn(); | |||||
| this.label12 = new System.Windows.Forms.Label(); | |||||
| this.panel6 = new System.Windows.Forms.Panel(); | |||||
| this.label13 = new System.Windows.Forms.Label(); | |||||
| this.detailGridView = new WinFormControl.UDataGridView(); | |||||
| this.B_DeliverGoodsLine_Name = new System.Windows.Forms.DataGridViewTextBoxColumn(); | |||||
| this.B_ShortCode = new System.Windows.Forms.DataGridViewTextBoxColumn(); | |||||
| this.B_Goods_Name = new System.Windows.Forms.DataGridViewTextBoxColumn(); | |||||
| this.B_SaleOutStoreID = new System.Windows.Forms.DataGridViewTextBoxColumn(); | |||||
| this.B_SecondNumber = new System.Windows.Forms.DataGridViewTextBoxColumn(); | |||||
| this.B_UnitNumber = new System.Windows.Forms.DataGridViewTextBoxColumn(); | |||||
| this.dhUnitNumLbl = new System.Windows.Forms.Label(); | |||||
| this.label7 = new System.Windows.Forms.Label(); | |||||
| this.bhUnitNumLbl = new System.Windows.Forms.Label(); | |||||
| this.label9 = new System.Windows.Forms.Label(); | |||||
| this.bhNumberLbl = new System.Windows.Forms.Label(); | |||||
| this.label11 = new System.Windows.Forms.Label(); | |||||
| this.panel7 = new System.Windows.Forms.Panel(); | |||||
| this.refresh = new ButcherFactory.Controls.ColorButton(); | |||||
| this.roundPanel1.SuspendLayout(); | |||||
| this.panel5.SuspendLayout(); | |||||
| ((System.ComponentModel.ISupportInitialize)(this.mainGridView)).BeginInit(); | |||||
| this.panel6.SuspendLayout(); | |||||
| ((System.ComponentModel.ISupportInitialize)(this.detailGridView)).BeginInit(); | |||||
| this.panel7.SuspendLayout(); | |||||
| this.SuspendLayout(); | |||||
| // | |||||
| // roundPanel1 | |||||
| // | |||||
| this.roundPanel1.Controls.Add(this.panel7); | |||||
| this.roundPanel1.Controls.Add(this.bhUnitNumLbl); | |||||
| this.roundPanel1.Controls.Add(this.label9); | |||||
| this.roundPanel1.Controls.Add(this.bhNumberLbl); | |||||
| this.roundPanel1.Controls.Add(this.label11); | |||||
| this.roundPanel1.Controls.Add(this.dhUnitNumLbl); | |||||
| this.roundPanel1.Controls.Add(this.label7); | |||||
| this.roundPanel1.Controls.Add(this.panel6); | |||||
| this.roundPanel1.Controls.Add(this.panel5); | |||||
| this.roundPanel1.Controls.Add(this.dhNumberLbl); | |||||
| this.roundPanel1.Controls.Add(this.label4); | |||||
| this.roundPanel1.Controls.Add(this.driveLineLbl); | |||||
| this.roundPanel1.Controls.Add(this.goodsLbl); | |||||
| this.roundPanel1.Controls.Add(this.panel4); | |||||
| this.roundPanel1.Controls.Add(this.dataPicker); | |||||
| this.roundPanel1.Controls.Add(this.uScanPanel1); | |||||
| this.roundPanel1.Controls.Add(this.label1); | |||||
| // | |||||
| // uScanPanel1 | |||||
| // | |||||
| this.uScanPanel1.BackColor = System.Drawing.Color.Transparent; | |||||
| this.uScanPanel1.Location = new System.Drawing.Point(271, 14); | |||||
| this.uScanPanel1.Name = "uScanPanel1"; | |||||
| this.uScanPanel1.Size = new System.Drawing.Size(303, 32); | |||||
| this.uScanPanel1.TabIndex = 0; | |||||
| // | |||||
| // label1 | |||||
| // | |||||
| this.label1.AutoSize = true; | |||||
| this.label1.Font = new System.Drawing.Font("宋体", 14F); | |||||
| this.label1.Location = new System.Drawing.Point(16, 19); | |||||
| this.label1.Name = "label1"; | |||||
| this.label1.Size = new System.Drawing.Size(85, 19); | |||||
| this.label1.TabIndex = 1; | |||||
| this.label1.Text = "发货日期"; | |||||
| // | |||||
| // dataPicker | |||||
| // | |||||
| this.dataPicker.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; | |||||
| this.dataPicker.Font = new System.Drawing.Font("宋体", 14F); | |||||
| this.dataPicker.Location = new System.Drawing.Point(107, 14); | |||||
| this.dataPicker.Name = "dataPicker"; | |||||
| this.dataPicker.Size = new System.Drawing.Size(120, 30); | |||||
| this.dataPicker.TabIndex = 2; | |||||
| this.dataPicker.Text = "2018-08-08"; | |||||
| this.dataPicker.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; | |||||
| this.dataPicker.Click += new System.EventHandler(this.dataPicker_Click); | |||||
| // | |||||
| // panel4 | |||||
| // | |||||
| this.panel4.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | |||||
| | System.Windows.Forms.AnchorStyles.Right))); | |||||
| this.panel4.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(243)))), ((int)(((byte)(243)))), ((int)(((byte)(243))))); | |||||
| this.panel4.Location = new System.Drawing.Point(7, 53); | |||||
| this.panel4.Name = "panel4"; | |||||
| this.panel4.Size = new System.Drawing.Size(1174, 1); | |||||
| this.panel4.TabIndex = 3; | |||||
| // | |||||
| // goodsLbl | |||||
| // | |||||
| this.goodsLbl.AutoSize = true; | |||||
| this.goodsLbl.Font = new System.Drawing.Font("宋体", 14F); | |||||
| this.goodsLbl.ForeColor = System.Drawing.Color.Red; | |||||
| this.goodsLbl.Location = new System.Drawing.Point(273, 63); | |||||
| this.goodsLbl.Name = "goodsLbl"; | |||||
| this.goodsLbl.Size = new System.Drawing.Size(85, 19); | |||||
| this.goodsLbl.TabIndex = 4; | |||||
| this.goodsLbl.Text = "存货名称"; | |||||
| // | |||||
| // driveLineLbl | |||||
| // | |||||
| this.driveLineLbl.AutoSize = true; | |||||
| this.driveLineLbl.Font = new System.Drawing.Font("宋体", 14F); | |||||
| this.driveLineLbl.ForeColor = System.Drawing.Color.Red; | |||||
| this.driveLineLbl.Location = new System.Drawing.Point(16, 63); | |||||
| this.driveLineLbl.Name = "driveLineLbl"; | |||||
| this.driveLineLbl.Size = new System.Drawing.Size(85, 19); | |||||
| this.driveLineLbl.TabIndex = 4; | |||||
| this.driveLineLbl.Text = "送货线路"; | |||||
| // | |||||
| // label4 | |||||
| // | |||||
| this.label4.AutoSize = true; | |||||
| this.label4.Font = new System.Drawing.Font("宋体", 14F); | |||||
| this.label4.Location = new System.Drawing.Point(16, 100); | |||||
| this.label4.Name = "label4"; | |||||
| this.label4.Size = new System.Drawing.Size(85, 19); | |||||
| this.label4.TabIndex = 5; | |||||
| this.label4.Text = "订货数量"; | |||||
| // | |||||
| // dhNumberLbl | |||||
| // | |||||
| this.dhNumberLbl.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; | |||||
| this.dhNumberLbl.Font = new System.Drawing.Font("宋体", 14F); | |||||
| this.dhNumberLbl.ForeColor = System.Drawing.Color.Red; | |||||
| this.dhNumberLbl.Location = new System.Drawing.Point(107, 94); | |||||
| this.dhNumberLbl.Name = "dhNumberLbl"; | |||||
| this.dhNumberLbl.Size = new System.Drawing.Size(120, 30); | |||||
| this.dhNumberLbl.TabIndex = 5; | |||||
| this.dhNumberLbl.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; | |||||
| // | |||||
| // panel5 | |||||
| // | |||||
| this.panel5.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.panel5.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247))))); | |||||
| this.panel5.Controls.Add(this.mainGridView); | |||||
| this.panel5.Controls.Add(this.label12); | |||||
| this.panel5.Location = new System.Drawing.Point(7, 142); | |||||
| this.panel5.Name = "panel5"; | |||||
| this.panel5.Size = new System.Drawing.Size(567, 362); | |||||
| this.panel5.TabIndex = 12; | |||||
| // | |||||
| // mainGridView | |||||
| // | |||||
| this.mainGridView.AllowUserToAddRows = false; | |||||
| this.mainGridView.AllowUserToDeleteRows = false; | |||||
| this.mainGridView.AllowUserToResizeColumns = false; | |||||
| this.mainGridView.AllowUserToResizeRows = false; | |||||
| dataGridViewCellStyle6.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(217)))), ((int)(((byte)(238)))), ((int)(((byte)(255))))); | |||||
| this.mainGridView.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle6; | |||||
| this.mainGridView.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.mainGridView.BackgroundColor = System.Drawing.Color.White; | |||||
| this.mainGridView.BorderStyle = System.Windows.Forms.BorderStyle.None; | |||||
| this.mainGridView.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.None; | |||||
| this.mainGridView.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None; | |||||
| dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; | |||||
| dataGridViewCellStyle7.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(77)))), ((int)(((byte)(135)))), ((int)(((byte)(245))))); | |||||
| dataGridViewCellStyle7.Font = new System.Drawing.Font("宋体", 10F); | |||||
| dataGridViewCellStyle7.ForeColor = System.Drawing.Color.White; | |||||
| dataGridViewCellStyle7.WrapMode = System.Windows.Forms.DataGridViewTriState.True; | |||||
| this.mainGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle7; | |||||
| this.mainGridView.ColumnHeadersHeight = 30; | |||||
| this.mainGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; | |||||
| this.mainGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { | |||||
| this.D_DeliverGoodsLine_ID, | |||||
| this.D_Goods_ID, | |||||
| this.D_Date, | |||||
| this.D_Finishd, | |||||
| this.D_DeliverGoodsLine_Name, | |||||
| this.D_Goods_Name, | |||||
| this.D_Goods_Spec, | |||||
| this.D_SecondNumber, | |||||
| this.D_UnitNum, | |||||
| this.D_SSecondNumber, | |||||
| this.D_SUnitNum}); | |||||
| this.mainGridView.EnableHeadersVisualStyles = false; | |||||
| this.mainGridView.Location = new System.Drawing.Point(11, 31); | |||||
| this.mainGridView.MultiSelect = false; | |||||
| this.mainGridView.Name = "mainGridView"; | |||||
| this.mainGridView.ReadOnly = true; | |||||
| this.mainGridView.RowHeadersVisible = false; | |||||
| dataGridViewCellStyle12.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(234)))), ((int)(((byte)(243)))), ((int)(((byte)(250))))); | |||||
| dataGridViewCellStyle12.Font = new System.Drawing.Font("宋体", 9F); | |||||
| dataGridViewCellStyle12.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(77)))), ((int)(((byte)(135)))), ((int)(((byte)(245))))); | |||||
| this.mainGridView.RowsDefaultCellStyle = dataGridViewCellStyle12; | |||||
| this.mainGridView.RowTemplate.Height = 40; | |||||
| this.mainGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; | |||||
| this.mainGridView.Size = new System.Drawing.Size(545, 320); | |||||
| this.mainGridView.TabIndex = 7; | |||||
| this.mainGridView.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.mainGridView_CellClick); | |||||
| this.mainGridView.RowPrePaint += new System.Windows.Forms.DataGridViewRowPrePaintEventHandler(this.mainGridView_RowPrePaint); | |||||
| // | |||||
| // D_DeliverGoodsLine_ID | |||||
| // | |||||
| this.D_DeliverGoodsLine_ID.DataPropertyName = "DeliverGoodsLine_ID"; | |||||
| this.D_DeliverGoodsLine_ID.HeaderText = "DeliverGoodsLine_ID"; | |||||
| this.D_DeliverGoodsLine_ID.Name = "D_DeliverGoodsLine_ID"; | |||||
| this.D_DeliverGoodsLine_ID.ReadOnly = true; | |||||
| this.D_DeliverGoodsLine_ID.Visible = false; | |||||
| // | |||||
| // D_Goods_ID | |||||
| // | |||||
| this.D_Goods_ID.HeaderText = "Goods_ID"; | |||||
| this.D_Goods_ID.Name = "D_Goods_ID"; | |||||
| this.D_Goods_ID.ReadOnly = true; | |||||
| this.D_Goods_ID.Visible = false; | |||||
| // | |||||
| // D_Date | |||||
| // | |||||
| this.D_Date.HeaderText = "Date"; | |||||
| this.D_Date.Name = "D_Date"; | |||||
| this.D_Date.ReadOnly = true; | |||||
| this.D_Date.Visible = false; | |||||
| // | |||||
| // D_Finishd | |||||
| // | |||||
| this.D_Finishd.DataPropertyName = "Finishd"; | |||||
| this.D_Finishd.HeaderText = "Finishd"; | |||||
| this.D_Finishd.Name = "D_Finishd"; | |||||
| this.D_Finishd.ReadOnly = true; | |||||
| this.D_Finishd.Visible = false; | |||||
| // | |||||
| // D_DeliverGoodsLine_Name | |||||
| // | |||||
| this.D_DeliverGoodsLine_Name.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; | |||||
| this.D_DeliverGoodsLine_Name.DataPropertyName = "DeliverGoodsLine_Name"; | |||||
| this.D_DeliverGoodsLine_Name.HeaderText = "线路名称"; | |||||
| this.D_DeliverGoodsLine_Name.Name = "D_DeliverGoodsLine_Name"; | |||||
| this.D_DeliverGoodsLine_Name.ReadOnly = true; | |||||
| // | |||||
| // D_Goods_Name | |||||
| // | |||||
| this.D_Goods_Name.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells; | |||||
| this.D_Goods_Name.DataPropertyName = "Goods_Name"; | |||||
| this.D_Goods_Name.HeaderText = "产品名称"; | |||||
| this.D_Goods_Name.MinimumWidth = 100; | |||||
| this.D_Goods_Name.Name = "D_Goods_Name"; | |||||
| this.D_Goods_Name.ReadOnly = true; | |||||
| // | |||||
| // D_Goods_Spec | |||||
| // | |||||
| this.D_Goods_Spec.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells; | |||||
| this.D_Goods_Spec.DataPropertyName = "Goods_Spec"; | |||||
| this.D_Goods_Spec.HeaderText = "规格"; | |||||
| this.D_Goods_Spec.MinimumWidth = 90; | |||||
| this.D_Goods_Spec.Name = "D_Goods_Spec"; | |||||
| this.D_Goods_Spec.ReadOnly = true; | |||||
| this.D_Goods_Spec.Width = 90; | |||||
| // | |||||
| // D_SecondNumber | |||||
| // | |||||
| this.D_SecondNumber.DataPropertyName = "SecondNumber"; | |||||
| dataGridViewCellStyle8.Format = "#0.######"; | |||||
| this.D_SecondNumber.DefaultCellStyle = dataGridViewCellStyle8; | |||||
| this.D_SecondNumber.HeaderText = "订货数量"; | |||||
| this.D_SecondNumber.Name = "D_SecondNumber"; | |||||
| this.D_SecondNumber.ReadOnly = true; | |||||
| // | |||||
| // D_UnitNum | |||||
| // | |||||
| this.D_UnitNum.DataPropertyName = "UnitNum"; | |||||
| dataGridViewCellStyle9.Format = "#0.######"; | |||||
| this.D_UnitNum.DefaultCellStyle = dataGridViewCellStyle9; | |||||
| this.D_UnitNum.HeaderText = "订货重量"; | |||||
| this.D_UnitNum.Name = "D_UnitNum"; | |||||
| this.D_UnitNum.ReadOnly = true; | |||||
| // | |||||
| // D_SSecondNumber | |||||
| // | |||||
| this.D_SSecondNumber.DataPropertyName = "SSecondNumber"; | |||||
| dataGridViewCellStyle10.Format = "#0.######"; | |||||
| this.D_SSecondNumber.DefaultCellStyle = dataGridViewCellStyle10; | |||||
| this.D_SSecondNumber.HeaderText = "备货数量"; | |||||
| this.D_SSecondNumber.Name = "D_SSecondNumber"; | |||||
| this.D_SSecondNumber.ReadOnly = true; | |||||
| // | |||||
| // D_SUnitNum | |||||
| // | |||||
| this.D_SUnitNum.DataPropertyName = "SUnitNum"; | |||||
| dataGridViewCellStyle11.Format = "#0.######"; | |||||
| this.D_SUnitNum.DefaultCellStyle = dataGridViewCellStyle11; | |||||
| this.D_SUnitNum.HeaderText = "备货重量"; | |||||
| this.D_SUnitNum.Name = "D_SUnitNum"; | |||||
| this.D_SUnitNum.ReadOnly = true; | |||||
| // | |||||
| // label12 | |||||
| // | |||||
| this.label12.AutoSize = true; | |||||
| this.label12.Font = new System.Drawing.Font("宋体", 10F); | |||||
| this.label12.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(33)))), ((int)(((byte)(99)))), ((int)(((byte)(219))))); | |||||
| this.label12.Location = new System.Drawing.Point(14, 10); | |||||
| this.label12.Name = "label12"; | |||||
| this.label12.Size = new System.Drawing.Size(77, 14); | |||||
| this.label12.TabIndex = 6; | |||||
| this.label12.Text = "销售订货:"; | |||||
| // | |||||
| // panel6 | |||||
| // | |||||
| this.panel6.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | |||||
| | System.Windows.Forms.AnchorStyles.Right))); | |||||
| this.panel6.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247))))); | |||||
| this.panel6.Controls.Add(this.label13); | |||||
| this.panel6.Controls.Add(this.detailGridView); | |||||
| this.panel6.Location = new System.Drawing.Point(580, 142); | |||||
| this.panel6.Name = "panel6"; | |||||
| this.panel6.Size = new System.Drawing.Size(600, 362); | |||||
| this.panel6.TabIndex = 13; | |||||
| // | |||||
| // label13 | |||||
| // | |||||
| this.label13.AutoSize = true; | |||||
| this.label13.Font = new System.Drawing.Font("宋体", 10F); | |||||
| this.label13.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(213)))), ((int)(((byte)(126)))), ((int)(((byte)(51))))); | |||||
| this.label13.Location = new System.Drawing.Point(13, 10); | |||||
| this.label13.Name = "label13"; | |||||
| this.label13.Size = new System.Drawing.Size(77, 14); | |||||
| this.label13.TabIndex = 7; | |||||
| this.label13.Text = "销售订货:"; | |||||
| // | |||||
| // detailGridView | |||||
| // | |||||
| this.detailGridView.AllowUserToAddRows = false; | |||||
| this.detailGridView.AllowUserToDeleteRows = false; | |||||
| this.detailGridView.AllowUserToResizeColumns = false; | |||||
| this.detailGridView.AllowUserToResizeRows = false; | |||||
| dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(254)))), ((int)(((byte)(228)))), ((int)(((byte)(203))))); | |||||
| this.detailGridView.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1; | |||||
| this.detailGridView.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.detailGridView.BackgroundColor = System.Drawing.Color.White; | |||||
| this.detailGridView.BorderStyle = System.Windows.Forms.BorderStyle.None; | |||||
| this.detailGridView.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.None; | |||||
| this.detailGridView.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None; | |||||
| dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; | |||||
| dataGridViewCellStyle2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(236)))), ((int)(((byte)(148)))), ((int)(((byte)(74))))); | |||||
| dataGridViewCellStyle2.Font = new System.Drawing.Font("宋体", 10F); | |||||
| dataGridViewCellStyle2.ForeColor = System.Drawing.Color.White; | |||||
| dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True; | |||||
| this.detailGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2; | |||||
| this.detailGridView.ColumnHeadersHeight = 30; | |||||
| this.detailGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; | |||||
| this.detailGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { | |||||
| this.B_DeliverGoodsLine_Name, | |||||
| this.B_ShortCode, | |||||
| this.B_Goods_Name, | |||||
| this.B_SaleOutStoreID, | |||||
| this.B_SecondNumber, | |||||
| this.B_UnitNumber}); | |||||
| this.detailGridView.EnableHeadersVisualStyles = false; | |||||
| this.detailGridView.Location = new System.Drawing.Point(10, 31); | |||||
| this.detailGridView.MultiSelect = false; | |||||
| this.detailGridView.Name = "detailGridView"; | |||||
| this.detailGridView.ReadOnly = true; | |||||
| this.detailGridView.RowHeadersVisible = false; | |||||
| dataGridViewCellStyle5.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(247)))), ((int)(((byte)(240))))); | |||||
| dataGridViewCellStyle5.Font = new System.Drawing.Font("宋体", 10F); | |||||
| dataGridViewCellStyle5.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(236)))), ((int)(((byte)(148)))), ((int)(((byte)(74))))); | |||||
| this.detailGridView.RowsDefaultCellStyle = dataGridViewCellStyle5; | |||||
| this.detailGridView.RowTemplate.Height = 40; | |||||
| this.detailGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; | |||||
| this.detailGridView.Size = new System.Drawing.Size(580, 320); | |||||
| this.detailGridView.TabIndex = 6; | |||||
| // | |||||
| // B_DeliverGoodsLine_Name | |||||
| // | |||||
| this.B_DeliverGoodsLine_Name.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; | |||||
| this.B_DeliverGoodsLine_Name.DataPropertyName = "DeliverGoodsLine_Name"; | |||||
| this.B_DeliverGoodsLine_Name.HeaderText = "线路名称"; | |||||
| this.B_DeliverGoodsLine_Name.Name = "B_DeliverGoodsLine_Name"; | |||||
| this.B_DeliverGoodsLine_Name.ReadOnly = true; | |||||
| // | |||||
| // B_ShortCode | |||||
| // | |||||
| this.B_ShortCode.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells; | |||||
| this.B_ShortCode.DataPropertyName = "ShortCode"; | |||||
| this.B_ShortCode.HeaderText = "条码"; | |||||
| this.B_ShortCode.MinimumWidth = 90; | |||||
| this.B_ShortCode.Name = "B_ShortCode"; | |||||
| this.B_ShortCode.ReadOnly = true; | |||||
| this.B_ShortCode.Width = 90; | |||||
| // | |||||
| // B_Goods_Name | |||||
| // | |||||
| this.B_Goods_Name.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells; | |||||
| this.B_Goods_Name.DataPropertyName = "Goods_Name"; | |||||
| this.B_Goods_Name.HeaderText = "产品名称"; | |||||
| this.B_Goods_Name.MinimumWidth = 100; | |||||
| this.B_Goods_Name.Name = "B_Goods_Name"; | |||||
| this.B_Goods_Name.ReadOnly = true; | |||||
| // | |||||
| // B_SaleOutStoreID | |||||
| // | |||||
| this.B_SaleOutStoreID.DataPropertyName = "SaleOutStoreID"; | |||||
| this.B_SaleOutStoreID.HeaderText = "销售出库单"; | |||||
| this.B_SaleOutStoreID.Name = "B_SaleOutStoreID"; | |||||
| this.B_SaleOutStoreID.ReadOnly = true; | |||||
| // | |||||
| // B_SecondNumber | |||||
| // | |||||
| this.B_SecondNumber.DataPropertyName = "SecondNumber"; | |||||
| dataGridViewCellStyle3.Format = "#0.######"; | |||||
| this.B_SecondNumber.DefaultCellStyle = dataGridViewCellStyle3; | |||||
| this.B_SecondNumber.HeaderText = "数量"; | |||||
| this.B_SecondNumber.Name = "B_SecondNumber"; | |||||
| this.B_SecondNumber.ReadOnly = true; | |||||
| this.B_SecondNumber.Width = 80; | |||||
| // | |||||
| // B_UnitNumber | |||||
| // | |||||
| this.B_UnitNumber.DataPropertyName = "UnitNumber"; | |||||
| dataGridViewCellStyle4.Format = "#0.######"; | |||||
| this.B_UnitNumber.DefaultCellStyle = dataGridViewCellStyle4; | |||||
| this.B_UnitNumber.HeaderText = "重量"; | |||||
| this.B_UnitNumber.Name = "B_UnitNumber"; | |||||
| this.B_UnitNumber.ReadOnly = true; | |||||
| this.B_UnitNumber.Width = 80; | |||||
| // | |||||
| // dhUnitNumLbl | |||||
| // | |||||
| this.dhUnitNumLbl.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; | |||||
| this.dhUnitNumLbl.Font = new System.Drawing.Font("宋体", 14F); | |||||
| this.dhUnitNumLbl.ForeColor = System.Drawing.Color.Red; | |||||
| this.dhUnitNumLbl.Location = new System.Drawing.Point(366, 94); | |||||
| this.dhUnitNumLbl.Name = "dhUnitNumLbl"; | |||||
| this.dhUnitNumLbl.Size = new System.Drawing.Size(120, 30); | |||||
| this.dhUnitNumLbl.TabIndex = 14; | |||||
| this.dhUnitNumLbl.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; | |||||
| // | |||||
| // label7 | |||||
| // | |||||
| this.label7.AutoSize = true; | |||||
| this.label7.Font = new System.Drawing.Font("宋体", 14F); | |||||
| this.label7.Location = new System.Drawing.Point(273, 100); | |||||
| this.label7.Name = "label7"; | |||||
| this.label7.Size = new System.Drawing.Size(85, 19); | |||||
| this.label7.TabIndex = 15; | |||||
| this.label7.Text = "订货重量"; | |||||
| // | |||||
| // bhUnitNumLbl | |||||
| // | |||||
| this.bhUnitNumLbl.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; | |||||
| this.bhUnitNumLbl.Font = new System.Drawing.Font("宋体", 14F); | |||||
| this.bhUnitNumLbl.ForeColor = System.Drawing.Color.Red; | |||||
| this.bhUnitNumLbl.Location = new System.Drawing.Point(879, 94); | |||||
| this.bhUnitNumLbl.Name = "bhUnitNumLbl"; | |||||
| this.bhUnitNumLbl.Size = new System.Drawing.Size(120, 30); | |||||
| this.bhUnitNumLbl.TabIndex = 18; | |||||
| this.bhUnitNumLbl.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; | |||||
| // | |||||
| // label9 | |||||
| // | |||||
| this.label9.AutoSize = true; | |||||
| this.label9.Font = new System.Drawing.Font("宋体", 14F); | |||||
| this.label9.Location = new System.Drawing.Point(786, 100); | |||||
| this.label9.Name = "label9"; | |||||
| this.label9.Size = new System.Drawing.Size(85, 19); | |||||
| this.label9.TabIndex = 19; | |||||
| this.label9.Text = "备货重量"; | |||||
| // | |||||
| // bhNumberLbl | |||||
| // | |||||
| this.bhNumberLbl.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; | |||||
| this.bhNumberLbl.Font = new System.Drawing.Font("宋体", 14F); | |||||
| this.bhNumberLbl.ForeColor = System.Drawing.Color.Red; | |||||
| this.bhNumberLbl.Location = new System.Drawing.Point(620, 94); | |||||
| this.bhNumberLbl.Name = "bhNumberLbl"; | |||||
| this.bhNumberLbl.Size = new System.Drawing.Size(120, 30); | |||||
| this.bhNumberLbl.TabIndex = 16; | |||||
| this.bhNumberLbl.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; | |||||
| // | |||||
| // label11 | |||||
| // | |||||
| this.label11.AutoSize = true; | |||||
| this.label11.Font = new System.Drawing.Font("宋体", 14F); | |||||
| this.label11.Location = new System.Drawing.Point(529, 100); | |||||
| this.label11.Name = "label11"; | |||||
| this.label11.Size = new System.Drawing.Size(85, 19); | |||||
| this.label11.TabIndex = 17; | |||||
| this.label11.Text = "备货数量"; | |||||
| // | |||||
| // panel7 | |||||
| // | |||||
| this.panel7.Controls.Add(this.refresh); | |||||
| this.panel7.Location = new System.Drawing.Point(824, 5); | |||||
| this.panel7.Name = "panel7"; | |||||
| this.panel7.Size = new System.Drawing.Size(346, 44); | |||||
| this.panel7.TabIndex = 20; | |||||
| // | |||||
| // refresh | |||||
| // | |||||
| this.refresh.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(77)))), ((int)(((byte)(135)))), ((int)(((byte)(245))))); | |||||
| this.refresh.ForeColor = System.Drawing.Color.White; | |||||
| this.refresh.Location = new System.Drawing.Point(55, 4); | |||||
| this.refresh.Name = "refresh"; | |||||
| this.refresh.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(158)))), ((int)(((byte)(234)))), ((int)(((byte)(106))))); | |||||
| this.refresh.Size = new System.Drawing.Size(75, 35); | |||||
| this.refresh.TabIndex = 0; | |||||
| this.refresh.Text = "刷新"; | |||||
| this.refresh.UseVisualStyleBackColor = false; | |||||
| this.refresh.Click += new System.EventHandler(this.refresh_Click); | |||||
| // | |||||
| // SegmentStockUpForm | |||||
| // | |||||
| this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); | |||||
| this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; | |||||
| this.ClientSize = new System.Drawing.Size(1212, 600); | |||||
| this.ImeMode = System.Windows.Forms.ImeMode.Disable; | |||||
| this.KeyPreview = true; | |||||
| this.Name = "SegmentStockUpForm"; | |||||
| this.Text = "销售备货"; | |||||
| this.roundPanel1.ResumeLayout(false); | |||||
| this.roundPanel1.PerformLayout(); | |||||
| this.panel5.ResumeLayout(false); | |||||
| this.panel5.PerformLayout(); | |||||
| ((System.ComponentModel.ISupportInitialize)(this.mainGridView)).EndInit(); | |||||
| this.panel6.ResumeLayout(false); | |||||
| this.panel6.PerformLayout(); | |||||
| ((System.ComponentModel.ISupportInitialize)(this.detailGridView)).EndInit(); | |||||
| this.panel7.ResumeLayout(false); | |||||
| this.ResumeLayout(false); | |||||
| this.PerformLayout(); | |||||
| } | |||||
| #endregion | |||||
| private WinFormControl.UScanPanel uScanPanel1; | |||||
| private System.Windows.Forms.Label dataPicker; | |||||
| private System.Windows.Forms.Label label1; | |||||
| private System.Windows.Forms.Label dhNumberLbl; | |||||
| private System.Windows.Forms.Label label4; | |||||
| private System.Windows.Forms.Label driveLineLbl; | |||||
| private System.Windows.Forms.Label goodsLbl; | |||||
| private System.Windows.Forms.Panel panel4; | |||||
| private System.Windows.Forms.Panel panel5; | |||||
| private System.Windows.Forms.Panel panel6; | |||||
| private System.Windows.Forms.Label label12; | |||||
| private WinFormControl.UDataGridView mainGridView; | |||||
| private System.Windows.Forms.Label label13; | |||||
| private WinFormControl.UDataGridView detailGridView; | |||||
| private System.Windows.Forms.Label bhUnitNumLbl; | |||||
| private System.Windows.Forms.Label label9; | |||||
| private System.Windows.Forms.Label bhNumberLbl; | |||||
| private System.Windows.Forms.Label label11; | |||||
| private System.Windows.Forms.Label dhUnitNumLbl; | |||||
| private System.Windows.Forms.Label label7; | |||||
| private System.Windows.Forms.Panel panel7; | |||||
| private Controls.ColorButton refresh; | |||||
| private System.Windows.Forms.DataGridViewTextBoxColumn D_DeliverGoodsLine_ID; | |||||
| private System.Windows.Forms.DataGridViewTextBoxColumn D_Goods_ID; | |||||
| private System.Windows.Forms.DataGridViewTextBoxColumn D_Date; | |||||
| private System.Windows.Forms.DataGridViewTextBoxColumn D_Finishd; | |||||
| private System.Windows.Forms.DataGridViewTextBoxColumn D_DeliverGoodsLine_Name; | |||||
| private System.Windows.Forms.DataGridViewTextBoxColumn D_Goods_Name; | |||||
| private System.Windows.Forms.DataGridViewTextBoxColumn D_Goods_Spec; | |||||
| private System.Windows.Forms.DataGridViewTextBoxColumn D_SecondNumber; | |||||
| private System.Windows.Forms.DataGridViewTextBoxColumn D_UnitNum; | |||||
| private System.Windows.Forms.DataGridViewTextBoxColumn D_SSecondNumber; | |||||
| private System.Windows.Forms.DataGridViewTextBoxColumn D_SUnitNum; | |||||
| private System.Windows.Forms.DataGridViewTextBoxColumn B_DeliverGoodsLine_Name; | |||||
| private System.Windows.Forms.DataGridViewTextBoxColumn B_ShortCode; | |||||
| private System.Windows.Forms.DataGridViewTextBoxColumn B_Goods_Name; | |||||
| private System.Windows.Forms.DataGridViewTextBoxColumn B_SaleOutStoreID; | |||||
| private System.Windows.Forms.DataGridViewTextBoxColumn B_SecondNumber; | |||||
| private System.Windows.Forms.DataGridViewTextBoxColumn B_UnitNumber; | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,191 @@ | |||||
| using ButcherFactory.BO; | |||||
| using ButcherFactory.BO.LocalBL; | |||||
| using ButcherFactory.BO.Utils; | |||||
| using ButcherFactory.Controls; | |||||
| using ButcherFactory.Dialogs; | |||||
| 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.SegmentStockUp_ | |||||
| { | |||||
| public partial class SegmentStockUpForm : FormTemplate, IWithRoleForm | |||||
| { | |||||
| #region IWithRoleForm | |||||
| public List<short> RoleName | |||||
| { | |||||
| get { return new List<short> { (short)设备类别.销售备货 }; } | |||||
| } | |||||
| public Form Generate() | |||||
| { | |||||
| return this; | |||||
| } | |||||
| #endregion | |||||
| DateTime sendTime = DateTime.Today; | |||||
| List<StockUpEntity> allMain; | |||||
| List<StockUpDetail> allDetail; | |||||
| BindingList<StockUpEntity> mainList; | |||||
| BindingList<StockUpDetail> detailList; | |||||
| public SegmentStockUpForm() | |||||
| { | |||||
| InitializeComponent(); | |||||
| allMain = new List<StockUpEntity>(); | |||||
| allDetail = new List<StockUpDetail>(); | |||||
| dataPicker.Text = sendTime.ToString("yyyy-MM-dd"); | |||||
| uScanPanel1.AfterScan += uScanPanel1_AfterScan; | |||||
| } | |||||
| void uScanPanel1_AfterScan() | |||||
| { | |||||
| var code = uScanPanel1.TextBox.Text; | |||||
| if (string.IsNullOrEmpty(code)) | |||||
| return; | |||||
| if (allDetail.Any(x => x.BarCode == code)) | |||||
| throw new Exception("条码已使用过"); | |||||
| if (SegmentStockUpBL.CheckBarCodeUsed(code)) | |||||
| throw new Exception("条码已使用过"); | |||||
| var info = SegmentStockUpBL.StockUpScan(code); | |||||
| if (info == null) | |||||
| { | |||||
| MessageBox.Show("未发现该条码信息"); | |||||
| return; | |||||
| } | |||||
| if (!allMain.Any(x => x.Goods_Code == info.StringExt1 && x.Date == sendTime)) | |||||
| { | |||||
| var gt = SegmentStockUpBL.GetStockUpEntity(sendTime, info.StringExt1); | |||||
| allMain.AddRange(gt); | |||||
| var first = gt.Where(x => !x.Finishd).OrderBy(x => x.SequenceNumber).FirstOrDefault(); | |||||
| if (first != null) | |||||
| FillAllDetail(sendTime, first.DeliverGoodsLine_ID, first.Goods_ID); | |||||
| else | |||||
| { | |||||
| MessageBox.Show("无待备货出库单"); | |||||
| return; | |||||
| } | |||||
| } | |||||
| InsertDetail(info); | |||||
| } | |||||
| void InsertDetail(ExtensionObj scan) | |||||
| { | |||||
| var first = allMain.Where(x => x.Date == sendTime && x.Goods_Code == scan.StringExt1 && !x.Finishd).OrderBy(x => x.SequenceNumber).FirstOrDefault(); | |||||
| if (first == null) | |||||
| { | |||||
| MessageBox.Show("无待备货出库单"); | |||||
| return; | |||||
| } | |||||
| var detail = new StockUpDetail(); | |||||
| detail.BarCode = uScanPanel1.TextBox.Text; | |||||
| detail.Date = sendTime; | |||||
| detail.DeliverGoodsLine_ID = first.DeliverGoodsLine_ID; | |||||
| detail.DeliverGoodsLine_Name = first.DeliverGoodsLine_Name; | |||||
| detail.Goods_Code = first.Goods_Code; | |||||
| detail.Goods_ID = first.Goods_ID; | |||||
| detail.Goods_Name = first.Goods_Name; | |||||
| detail.Goods_Spec = first.Goods_Spec; | |||||
| detail.UnitNumber = scan.DecimalExt1; | |||||
| if (detail.UnitNumber.HasValue && first.Rate.HasValue) | |||||
| detail.SecondNumber = detail.UnitNumber * first.Rate; | |||||
| SegmentStockUpBL.InsertStockUpDetail(detail); | |||||
| allDetail.Add(detail); | |||||
| first.SSecondNumber = (first.SSecondNumber ?? 0) + (detail.SecondNumber ?? 0); | |||||
| first.SUnitNum = (first.SUnitNum ?? 0) + (detail.UnitNumber ?? 0); | |||||
| BindMainGrid(sendTime, first.Goods_ID); | |||||
| } | |||||
| void FillAllDetail(DateTime date, long driverLineID, long goodsID) | |||||
| { | |||||
| if (allDetail.Any(x => x.Date == date && x.DeliverGoodsLine_ID == driverLineID && x.Goods_ID == goodsID)) | |||||
| return; | |||||
| var n = SegmentStockUpBL.GetDetails(date, driverLineID, goodsID); | |||||
| allDetail.AddRange(n); | |||||
| } | |||||
| void BindMainGrid(DateTime date, long goodsID) | |||||
| { | |||||
| var main = allMain.Where(x => x.Date == date && x.Goods_ID == goodsID).OrderBy(x => x.Finishd).OrderBy(x => x.SequenceNumber); | |||||
| mainList = new BindingList<StockUpEntity>(main.ToList()); | |||||
| mainGridView.DataSource = mainList; | |||||
| mainGridView.Refresh(); | |||||
| BindDetail(main.FirstOrDefault()); | |||||
| } | |||||
| void BindDetail(StockUpEntity first) | |||||
| { | |||||
| if (first != null) | |||||
| { | |||||
| driveLineLbl.Text = first.DeliverGoodsLine_Name; | |||||
| goodsLbl.Text = first.Goods_Name; | |||||
| dhNumberLbl.Text = string.Format("{0:#0.##}", first.SecondNumber); | |||||
| dhUnitNumLbl.Text = string.Format("{0:#0.##}", first.UnitNum); | |||||
| bhNumberLbl.Text = string.Format("{0:#0.##}", first.SSecondNumber); | |||||
| bhUnitNumLbl.Text = string.Format("{0:#0.##}", first.SUnitNum); | |||||
| if (!allDetail.Any(x => x.Date == first.Date && x.DeliverGoodsLine_ID == first.DeliverGoodsLine_ID && x.Goods_ID == first.Goods_ID)) | |||||
| allDetail.AddRange(SegmentStockUpBL.GetDetails(first.Date, first.DeliverGoodsLine_ID, first.Goods_ID)); | |||||
| var detail = allDetail.Where(x => x.Date == first.Date && x.DeliverGoodsLine_ID == first.DeliverGoodsLine_ID && x.Goods_ID == first.Goods_ID).OrderByDescending(x => x.ID); | |||||
| detailList = new BindingList<StockUpDetail>(detail.ToList()); | |||||
| } | |||||
| else | |||||
| { | |||||
| driveLineLbl.Text = string.Empty; | |||||
| goodsLbl.Text = string.Empty; | |||||
| dhNumberLbl.Text = string.Empty; | |||||
| dhUnitNumLbl.Text = string.Empty; | |||||
| bhNumberLbl.Text = string.Empty; | |||||
| bhUnitNumLbl.Text = string.Empty; | |||||
| detailList = new BindingList<StockUpDetail>(); | |||||
| } | |||||
| detailGridView.DataSource = detailList; | |||||
| detailGridView.Refresh(); | |||||
| } | |||||
| private void refresh_Click(object sender, EventArgs e) | |||||
| { | |||||
| if (mainList == null || !mainList.Any()) | |||||
| return; | |||||
| allMain = SegmentStockUpBL.RefreshList(sendTime, allMain.Select(x => x.Goods_ID).Distinct()); | |||||
| allDetail.Clear(); | |||||
| BindMainGrid(sendTime, mainList.First().Goods_ID); | |||||
| } | |||||
| private void dataPicker_Click(object sender, EventArgs e) | |||||
| { | |||||
| var cs = new CalendarSelecter(); | |||||
| if (cs.ShowDialog() == true) | |||||
| { | |||||
| sendTime = cs.Result; | |||||
| dataPicker.Text = sendTime.ToString("yyyy-MM-dd"); | |||||
| } | |||||
| } | |||||
| private void mainGridView_CellClick(object sender, DataGridViewCellEventArgs e) | |||||
| { | |||||
| if (e.RowIndex < 0) | |||||
| return; | |||||
| var item = mainGridView.CurrentRow.DataBoundItem as StockUpEntity; | |||||
| BindDetail(item); | |||||
| } | |||||
| private void mainGridView_RowPrePaint(object sender, DataGridViewRowPrePaintEventArgs e) | |||||
| { | |||||
| DataGridViewRow dgrSingle = mainGridView.Rows[e.RowIndex]; | |||||
| var v = (bool)dgrSingle.Cells["D_Finishd"].Value; | |||||
| if (v) | |||||
| { | |||||
| dgrSingle.DefaultCellStyle.BackColor = Color.YellowGreen; | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,171 @@ | |||||
| <?xml version="1.0" encoding="utf-8"?> | |||||
| <root> | |||||
| <!-- | |||||
| Microsoft ResX Schema | |||||
| Version 2.0 | |||||
| The primary goals of this format is to allow a simple XML format | |||||
| that is mostly human readable. The generation and parsing of the | |||||
| various data types are done through the TypeConverter classes | |||||
| associated with the data types. | |||||
| Example: | |||||
| ... ado.net/XML headers & schema ... | |||||
| <resheader name="resmimetype">text/microsoft-resx</resheader> | |||||
| <resheader name="version">2.0</resheader> | |||||
| <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> | |||||
| <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> | |||||
| <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> | |||||
| <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> | |||||
| <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> | |||||
| <value>[base64 mime encoded serialized .NET Framework object]</value> | |||||
| </data> | |||||
| <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> | |||||
| <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> | |||||
| <comment>This is a comment</comment> | |||||
| </data> | |||||
| There are any number of "resheader" rows that contain simple | |||||
| name/value pairs. | |||||
| Each data row contains a name, and value. The row also contains a | |||||
| type or mimetype. Type corresponds to a .NET class that support | |||||
| text/value conversion through the TypeConverter architecture. | |||||
| Classes that don't support this are serialized and stored with the | |||||
| mimetype set. | |||||
| The mimetype is used for serialized objects, and tells the | |||||
| ResXResourceReader how to depersist the object. This is currently not | |||||
| extensible. For a given mimetype the value must be set accordingly: | |||||
| Note - application/x-microsoft.net.object.binary.base64 is the format | |||||
| that the ResXResourceWriter will generate, however the reader can | |||||
| read any of the formats listed below. | |||||
| mimetype: application/x-microsoft.net.object.binary.base64 | |||||
| value : The object must be serialized with | |||||
| : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter | |||||
| : and then encoded with base64 encoding. | |||||
| mimetype: application/x-microsoft.net.object.soap.base64 | |||||
| value : The object must be serialized with | |||||
| : System.Runtime.Serialization.Formatters.Soap.SoapFormatter | |||||
| : and then encoded with base64 encoding. | |||||
| mimetype: application/x-microsoft.net.object.bytearray.base64 | |||||
| value : The object must be serialized into a byte array | |||||
| : using a System.ComponentModel.TypeConverter | |||||
| : and then encoded with base64 encoding. | |||||
| --> | |||||
| <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> | |||||
| <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> | |||||
| <xsd:element name="root" msdata:IsDataSet="true"> | |||||
| <xsd:complexType> | |||||
| <xsd:choice maxOccurs="unbounded"> | |||||
| <xsd:element name="metadata"> | |||||
| <xsd:complexType> | |||||
| <xsd:sequence> | |||||
| <xsd:element name="value" type="xsd:string" minOccurs="0" /> | |||||
| </xsd:sequence> | |||||
| <xsd:attribute name="name" use="required" type="xsd:string" /> | |||||
| <xsd:attribute name="type" type="xsd:string" /> | |||||
| <xsd:attribute name="mimetype" type="xsd:string" /> | |||||
| <xsd:attribute ref="xml:space" /> | |||||
| </xsd:complexType> | |||||
| </xsd:element> | |||||
| <xsd:element name="assembly"> | |||||
| <xsd:complexType> | |||||
| <xsd:attribute name="alias" type="xsd:string" /> | |||||
| <xsd:attribute name="name" type="xsd:string" /> | |||||
| </xsd:complexType> | |||||
| </xsd:element> | |||||
| <xsd:element name="data"> | |||||
| <xsd:complexType> | |||||
| <xsd:sequence> | |||||
| <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | |||||
| <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> | |||||
| </xsd:sequence> | |||||
| <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> | |||||
| <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> | |||||
| <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> | |||||
| <xsd:attribute ref="xml:space" /> | |||||
| </xsd:complexType> | |||||
| </xsd:element> | |||||
| <xsd:element name="resheader"> | |||||
| <xsd:complexType> | |||||
| <xsd:sequence> | |||||
| <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | |||||
| </xsd:sequence> | |||||
| <xsd:attribute name="name" type="xsd:string" use="required" /> | |||||
| </xsd:complexType> | |||||
| </xsd:element> | |||||
| </xsd:choice> | |||||
| </xsd:complexType> | |||||
| </xsd:element> | |||||
| </xsd:schema> | |||||
| <resheader name="resmimetype"> | |||||
| <value>text/microsoft-resx</value> | |||||
| </resheader> | |||||
| <resheader name="version"> | |||||
| <value>2.0</value> | |||||
| </resheader> | |||||
| <resheader name="reader"> | |||||
| <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | |||||
| </resheader> | |||||
| <resheader name="writer"> | |||||
| <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | |||||
| </resheader> | |||||
| <metadata name="B_DeliverGoodsLine_Name.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <value>True</value> | |||||
| </metadata> | |||||
| <metadata name="B_ShortCode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <value>True</value> | |||||
| </metadata> | |||||
| <metadata name="B_Goods_Name.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <value>True</value> | |||||
| </metadata> | |||||
| <metadata name="B_SaleOutStoreID.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <value>True</value> | |||||
| </metadata> | |||||
| <metadata name="B_SecondNumber.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <value>True</value> | |||||
| </metadata> | |||||
| <metadata name="B_UnitNumber.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <value>True</value> | |||||
| </metadata> | |||||
| <metadata name="D_DeliverGoodsLine_ID.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <value>True</value> | |||||
| </metadata> | |||||
| <metadata name="D_Goods_ID.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <value>True</value> | |||||
| </metadata> | |||||
| <metadata name="D_Date.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <value>True</value> | |||||
| </metadata> | |||||
| <metadata name="D_Finishd.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <value>True</value> | |||||
| </metadata> | |||||
| <metadata name="D_DeliverGoodsLine_Name.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <value>True</value> | |||||
| </metadata> | |||||
| <metadata name="D_Goods_Name.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <value>True</value> | |||||
| </metadata> | |||||
| <metadata name="D_Goods_Spec.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <value>True</value> | |||||
| </metadata> | |||||
| <metadata name="D_SecondNumber.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <value>True</value> | |||||
| </metadata> | |||||
| <metadata name="D_UnitNum.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <value>True</value> | |||||
| </metadata> | |||||
| <metadata name="D_SSecondNumber.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <value>True</value> | |||||
| </metadata> | |||||
| <metadata name="D_SUnitNum.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <value>True</value> | |||||
| </metadata> | |||||
| </root> | |||||