diff --git a/BO/BO.csproj b/BO/BO.csproj index 4ccb602..7bff514 100644 --- a/BO/BO.csproj +++ b/BO/BO.csproj @@ -63,6 +63,7 @@ + diff --git a/BO/BO/Bill/WeightBill/PrintWeightBill.cs b/BO/BO/Bill/WeightBill/PrintWeightBill.cs new file mode 100644 index 0000000..630c572 --- /dev/null +++ b/BO/BO/Bill/WeightBill/PrintWeightBill.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BO.BO +{ + public class PrintWeightBill + { + public long? ID { get; set; } + + public string Supplier_Name { get; set; } + + public DateTime WeighTime { get; set; } + + public string Creator { get; set; } + + public string Employee_Name { get; set; } + + public string Inspector_Name { get; set; } + + public string HogGrade_Name { get; set; } + + public decimal? Weight { get; set; } + + public int? Number { get; set; } + + public string TotalDiscont { get { return string.Format("{0:#0.######}", Details.Sum(x => x.Money ?? 0)); } } + + private List _details = new List(); + public List Details { get { return _details; } set { _details = value; } } + } + + public class PWeightBill_SanctionDetail + { + public string AbnormalItem_Name { get; set; } + + public int? Number { get; set; } + + public decimal? Money { get; set; } + } +} diff --git a/BO/Utils/BillRpc/WeightBillRpc.cs b/BO/Utils/BillRpc/WeightBillRpc.cs index b38e22c..2c8502e 100644 --- a/BO/Utils/BillRpc/WeightBillRpc.cs +++ b/BO/Utils/BillRpc/WeightBillRpc.cs @@ -98,5 +98,13 @@ namespace BO.Utils.BillRpc var json = RpcFacade.Call(method, DateTime.Today); return serializer.Deserialize>>(json); } + + public static PrintWeightBill GetPrintWeightBill(long id) + { + const string method = "/MainSystem/B3ClientService/Rpcs/BillRpc/WeightBillRpc/GetPrintWeightBill"; + var obj = RpcFacade.Call(method, id); + obj = obj.ESerializeDateTime(); + return serializer.Deserialize(obj); + } } } diff --git a/ButcherWeight/ButcherWeight.csproj b/ButcherWeight/ButcherWeight.csproj index b832e73..cc1b577 100644 --- a/ButcherWeight/ButcherWeight.csproj +++ b/ButcherWeight/ButcherWeight.csproj @@ -30,6 +30,10 @@ 4 + + False + ..\..\..\tsref\Debug\BwpClientPrint.dll + False ..\..\..\..\BwpB3Project\tsref\Debug\Forks.EnterpriseServices.dll diff --git a/ButcherWeight/WeightForm.Designer.cs b/ButcherWeight/WeightForm.Designer.cs index 0842664..8a9e5d7 100644 --- a/ButcherWeight/WeightForm.Designer.cs +++ b/ButcherWeight/WeightForm.Designer.cs @@ -135,6 +135,18 @@ this.S_AbnormalItem_Name = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.S_Number = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.billGrid = new System.Windows.Forms.DataGridView(); + this.M_ID = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.M_FinishWeight = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.M_B3ID = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.M_Car_Name = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.M_Supplier_Name = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.M_Employee_Name = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.M_PurchaseType_Name = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.M_Number = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.M_Weight = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.M_HouseNames = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.M_SanctionMoney = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.M_Remark = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.label15 = new System.Windows.Forms.Label(); this.label16 = new System.Windows.Forms.Label(); this.label17 = new System.Windows.Forms.Label(); @@ -149,18 +161,6 @@ this.farmerMenu = new System.Windows.Forms.ContextMenuStrip(this.components); this.farmerDelete = new System.Windows.Forms.ToolStripMenuItem(); this.viewDetailBtn = new System.Windows.Forms.Button(); - this.M_ID = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.M_FinishWeight = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.M_B3ID = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.M_Car_Name = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.M_Supplier_Name = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.M_Employee_Name = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.M_PurchaseType_Name = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.M_Number = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.M_Weight = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.M_HouseNames = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.M_SanctionMoney = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.M_Remark = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.panel1.SuspendLayout(); this.panel2.SuspendLayout(); this.panel3.SuspendLayout(); @@ -246,6 +246,7 @@ this.printBtn.TabIndex = 8; this.printBtn.Text = "打印"; this.printBtn.UseVisualStyleBackColor = true; + this.printBtn.Click += new System.EventHandler(this.printBtn_Click); // // createBtn // @@ -1191,6 +1192,104 @@ this.billGrid.TabIndex = 0; this.billGrid.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.billGrid_CellDoubleClick); // + // M_ID + // + this.M_ID.DataPropertyName = "ID"; + this.M_ID.HeaderText = "ID"; + this.M_ID.Name = "M_ID"; + this.M_ID.ReadOnly = true; + this.M_ID.Visible = false; + // + // M_FinishWeight + // + this.M_FinishWeight.DataPropertyName = "FinishWeight"; + this.M_FinishWeight.HeaderText = "FinishWeight"; + this.M_FinishWeight.Name = "M_FinishWeight"; + this.M_FinishWeight.ReadOnly = true; + this.M_FinishWeight.Visible = false; + // + // M_B3ID + // + this.M_B3ID.DataPropertyName = "B3ID"; + this.M_B3ID.HeaderText = "过磅单号"; + this.M_B3ID.Name = "M_B3ID"; + this.M_B3ID.ReadOnly = true; + // + // M_Car_Name + // + this.M_Car_Name.DataPropertyName = "Car_Name"; + this.M_Car_Name.HeaderText = "车辆"; + this.M_Car_Name.Name = "M_Car_Name"; + this.M_Car_Name.ReadOnly = true; + this.M_Car_Name.Width = 120; + // + // M_Supplier_Name + // + this.M_Supplier_Name.DataPropertyName = "Supplier_Name"; + this.M_Supplier_Name.HeaderText = "供应商"; + this.M_Supplier_Name.Name = "M_Supplier_Name"; + this.M_Supplier_Name.ReadOnly = true; + this.M_Supplier_Name.Width = 120; + // + // M_Employee_Name + // + this.M_Employee_Name.DataPropertyName = "Employee_Name"; + this.M_Employee_Name.HeaderText = "业务员"; + this.M_Employee_Name.Name = "M_Employee_Name"; + this.M_Employee_Name.ReadOnly = true; + this.M_Employee_Name.Width = 110; + // + // M_PurchaseType_Name + // + this.M_PurchaseType_Name.DataPropertyName = "PurchaseType_Name"; + this.M_PurchaseType_Name.HeaderText = "收购类型"; + this.M_PurchaseType_Name.Name = "M_PurchaseType_Name"; + this.M_PurchaseType_Name.ReadOnly = true; + this.M_PurchaseType_Name.Width = 110; + // + // M_Number + // + this.M_Number.DataPropertyName = "Number"; + this.M_Number.HeaderText = "收购头数"; + this.M_Number.Name = "M_Number"; + this.M_Number.ReadOnly = true; + this.M_Number.Width = 110; + // + // M_Weight + // + this.M_Weight.DataPropertyName = "Weight"; + dataGridViewCellStyle19.Format = "#0.######"; + this.M_Weight.DefaultCellStyle = dataGridViewCellStyle19; + this.M_Weight.HeaderText = "收购重量"; + this.M_Weight.Name = "M_Weight"; + this.M_Weight.ReadOnly = true; + this.M_Weight.Width = 120; + // + // M_HouseNames + // + this.M_HouseNames.DataPropertyName = "HouseNames"; + this.M_HouseNames.HeaderText = "圈舍"; + this.M_HouseNames.Name = "M_HouseNames"; + this.M_HouseNames.ReadOnly = true; + this.M_HouseNames.Width = 180; + // + // M_SanctionMoney + // + this.M_SanctionMoney.DataPropertyName = "SanctionMoney"; + dataGridViewCellStyle20.Format = "#0.######"; + this.M_SanctionMoney.DefaultCellStyle = dataGridViewCellStyle20; + this.M_SanctionMoney.HeaderText = "异常明细"; + this.M_SanctionMoney.Name = "M_SanctionMoney"; + this.M_SanctionMoney.ReadOnly = true; + // + // M_Remark + // + this.M_Remark.DataPropertyName = "Remark"; + this.M_Remark.HeaderText = "摘要"; + this.M_Remark.Name = "M_Remark"; + this.M_Remark.ReadOnly = true; + this.M_Remark.Width = 130; + // // label15 // this.label15.AutoSize = true; @@ -1326,104 +1425,6 @@ this.viewDetailBtn.UseVisualStyleBackColor = true; this.viewDetailBtn.Click += new System.EventHandler(this.viewDetailBtn_Click); // - // M_ID - // - this.M_ID.DataPropertyName = "ID"; - this.M_ID.HeaderText = "ID"; - this.M_ID.Name = "M_ID"; - this.M_ID.ReadOnly = true; - this.M_ID.Visible = false; - // - // M_FinishWeight - // - this.M_FinishWeight.DataPropertyName = "FinishWeight"; - this.M_FinishWeight.HeaderText = "FinishWeight"; - this.M_FinishWeight.Name = "M_FinishWeight"; - this.M_FinishWeight.ReadOnly = true; - this.M_FinishWeight.Visible = false; - // - // M_B3ID - // - this.M_B3ID.DataPropertyName = "B3ID"; - this.M_B3ID.HeaderText = "过磅单号"; - this.M_B3ID.Name = "M_B3ID"; - this.M_B3ID.ReadOnly = true; - // - // M_Car_Name - // - this.M_Car_Name.DataPropertyName = "Car_Name"; - this.M_Car_Name.HeaderText = "车辆"; - this.M_Car_Name.Name = "M_Car_Name"; - this.M_Car_Name.ReadOnly = true; - this.M_Car_Name.Width = 120; - // - // M_Supplier_Name - // - this.M_Supplier_Name.DataPropertyName = "Supplier_Name"; - this.M_Supplier_Name.HeaderText = "供应商"; - this.M_Supplier_Name.Name = "M_Supplier_Name"; - this.M_Supplier_Name.ReadOnly = true; - this.M_Supplier_Name.Width = 120; - // - // M_Employee_Name - // - this.M_Employee_Name.DataPropertyName = "Employee_Name"; - this.M_Employee_Name.HeaderText = "业务员"; - this.M_Employee_Name.Name = "M_Employee_Name"; - this.M_Employee_Name.ReadOnly = true; - this.M_Employee_Name.Width = 110; - // - // M_PurchaseType_Name - // - this.M_PurchaseType_Name.DataPropertyName = "PurchaseType_Name"; - this.M_PurchaseType_Name.HeaderText = "收购类型"; - this.M_PurchaseType_Name.Name = "M_PurchaseType_Name"; - this.M_PurchaseType_Name.ReadOnly = true; - this.M_PurchaseType_Name.Width = 110; - // - // M_Number - // - this.M_Number.DataPropertyName = "Number"; - this.M_Number.HeaderText = "收购头数"; - this.M_Number.Name = "M_Number"; - this.M_Number.ReadOnly = true; - this.M_Number.Width = 110; - // - // M_Weight - // - this.M_Weight.DataPropertyName = "Weight"; - dataGridViewCellStyle19.Format = "#0.######"; - this.M_Weight.DefaultCellStyle = dataGridViewCellStyle19; - this.M_Weight.HeaderText = "收购重量"; - this.M_Weight.Name = "M_Weight"; - this.M_Weight.ReadOnly = true; - this.M_Weight.Width = 120; - // - // M_HouseNames - // - this.M_HouseNames.DataPropertyName = "HouseNames"; - this.M_HouseNames.HeaderText = "圈舍"; - this.M_HouseNames.Name = "M_HouseNames"; - this.M_HouseNames.ReadOnly = true; - this.M_HouseNames.Width = 180; - // - // M_SanctionMoney - // - this.M_SanctionMoney.DataPropertyName = "SanctionMoney"; - dataGridViewCellStyle20.Format = "#0.######"; - this.M_SanctionMoney.DefaultCellStyle = dataGridViewCellStyle20; - this.M_SanctionMoney.HeaderText = "异常明细"; - this.M_SanctionMoney.Name = "M_SanctionMoney"; - this.M_SanctionMoney.ReadOnly = true; - // - // M_Remark - // - this.M_Remark.DataPropertyName = "Remark"; - this.M_Remark.HeaderText = "摘要"; - this.M_Remark.Name = "M_Remark"; - this.M_Remark.ReadOnly = true; - this.M_Remark.Width = 130; - // // WeightForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); diff --git a/ButcherWeight/WeightForm.cs b/ButcherWeight/WeightForm.cs index 9ff46b9..1c126be 100644 --- a/ButcherWeight/WeightForm.cs +++ b/ButcherWeight/WeightForm.cs @@ -2,6 +2,7 @@ using BO.Utils; using BO.Utils.BillRpc; using BWP.WinFormControl; +using BwpClientPrint.DocumentRenders; using System; using System.Collections.Generic; using System.ComponentModel; @@ -520,5 +521,14 @@ namespace ButcherWeight else penMoneyInput.Text = "0"; } + + private void printBtn_Click(object sender, EventArgs e) + { + if (Dmo.ID == 0) + throw new Exception("请先保存"); + var entity = WeightBillRpc.GetPrintWeightBill(Dmo.ID); + ClientPrint.BwpClientPrint print = new ClientPrint.BwpClientPrint("WeightBillPrint.xaml", entity, new DocumentRenderer()); + print.PrintDirect(); + } } } \ No newline at end of file