Browse Source

调整。

master
yibo 7 years ago
parent
commit
f6905566f5
3 changed files with 41 additions and 102 deletions
  1. +19
    -0
      ButcherWeight/WeightForm.cs
  2. +4
    -12
      SegmentationWeight/SegmentationWeightForm.cs
  3. +18
    -90
      SegmentationWeight/SegmentationWeightPrint.cs

+ 19
- 0
ButcherWeight/WeightForm.cs View File

@ -49,6 +49,7 @@ namespace ButcherWeight
uDatePicker1.Date = DateTime.Today; uDatePicker1.Date = DateTime.Today;
supplierSelect.Init("BaseInfoRpc/GetSupplierList"); supplierSelect.Init("BaseInfoRpc/GetSupplierList");
purchaseTypeSelect.Init("BaseInfoRpc/GetPurchaseTypeList"); purchaseTypeSelect.Init("BaseInfoRpc/GetPurchaseTypeList");
purchaseTypeSelect.SelectedIndexChanged += PurchaseTypeSelectIndexChange;
carSelect.Init("BaseInfoRpc/GetCarList"); carSelect.Init("BaseInfoRpc/GetCarList");
liveVarietiesSelect.Init("BaseInfoRpc/GetLiveVarietiesList"); liveVarietiesSelect.Init("BaseInfoRpc/GetLiveVarietiesList");
employeeSelect.Init("BaseInfoRpc/GetEmployeeList"); employeeSelect.Init("BaseInfoRpc/GetEmployeeList");
@ -79,6 +80,24 @@ namespace ButcherWeight
}; };
} }
private void PurchaseTypeSelectIndexChange(object sender, EventArgs e)
{
var selectObj = purchaseTypeSelect.SelectedItem as WordPair;
if (selectObj.DisplayName == "社会")
{
penMoneyInput.Text = string.Empty;
penWeightInput.Text = string.Empty;
penPriceInput.Text = string.Empty;
penMoneyInput.ReadOnly = true;
penWeightInput.ReadOnly = true;
}
else
{
penMoneyInput.ReadOnly = false;
penWeightInput.ReadOnly = false;
}
}
private void WeightForm_Load(object sender, EventArgs e) private void WeightForm_Load(object sender, EventArgs e)
{ {
BindWeightBill(); BindWeightBill();


+ 4
- 12
SegmentationWeight/SegmentationWeightForm.cs View File

@ -679,7 +679,7 @@ namespace SegmentationWeight
entity.Goods_Name = record.Goods_Name; entity.Goods_Name = record.Goods_Name;
entity.Date = DateTime.Today; entity.Date = DateTime.Today;
entity.Checker = "001"; entity.Checker = "001";
entity.StoreCondition = "0-4℃ 4日";
entity.StoreCondition = "0-4℃";
entity.Place = "青岛莱西市珠海路5号"; entity.Place = "青岛莱西市珠海路5号";
entity.TelNumber = "0532-88488888"; entity.TelNumber = "0532-88488888";
entity.BarCode = record.BarCode; entity.BarCode = record.BarCode;
@ -867,17 +867,9 @@ namespace SegmentationWeight
private void PrintEnd(string barcode) private void PrintEnd(string barcode)
{ {
var entity = new PrintEntity();
entity.Weight = mWeightRecords.Sum(x => x.Weight).ToString();
entity.Number = mWeightRecords.Count.ToString();
entity.BarCode = barcode;
entity.AccountingUnit_Name = "青岛万福集团股份有限公司";
#if DEBUG
SegmentationWeightPrint.PrintEnd(entity);
#endif
#if !DEBUG
SegmentationWeightPrint.PrintEndHTML(entity);
#endif
var list = mWeightRecords.GroupBy(x => x.Goods_Name).Select(x => new PrintEntity { Goods_Name = x.Key, Weight = x.Sum(y => y.Weight).ToString("F"), Number = x.Count().ToString() }).ToList();
list.Add(new PrintEntity { Goods_Name = "合计", Weight = mWeightRecords.Sum(x => x.Weight).ToString("F"), Number = mWeightRecords.Count().ToString() });
SegmentationWeightPrint.PrintEndHTML(list, barcode);
} }
private string GetEndBarCode() private string GetEndBarCode()


+ 18
- 90
SegmentationWeight/SegmentationWeightPrint.cs View File

@ -9,53 +9,6 @@ namespace SegmentationWeight
{ {
public class SegmentationWeightPrint public class SegmentationWeightPrint
{ {
public static void PrintEnd(PrintEntity entity)
{
PrintAPI.B_GetUSBBufferLen();
PrintAPI.B_EnumUSB(new byte[128]);
PrintAPI.B_CreateUSBPort(1);
PrintAPI.B_Prn_Text_TrueType(110, 26, 31, "宋体", 1, 700, 0, 0, 0, "C1", entity.AccountingUnit_Name);
PrintAPI.B_Prn_Text_TrueType(42, 120, 27, "宋体", 1, 400, 0, 0, 0, "C4", string.Format("总重量:{0}", entity.Weight));
PrintAPI.B_Prn_Text_TrueType(42, 200, 27, "宋体", 1, 400, 0, 0, 0, "C6", string.Format("总数量:{0}", entity.Number));
PrintAPI.B_Prn_Barcode(42, 320, 0, "1", 3, 22, 35, 'N', entity.BarCode);
PrintAPI.B_Prn_Text_TrueType(173, 360, 25, "宋体", 1, 500, 0, 0, 0, "C9", entity.BarCode);
PrintAPI.B_Bar2d_QR(430, 105, 2, 6, 'M', 'A', 0, 0, 0, entity.BarCode);
PrintAPI.B_Set_Direction('B');
PrintAPI.B_Print_Out(1);
PrintAPI.B_ClosePrn();
}
public static void Print(PrintEntity entity)
{
PrintAPI.B_GetUSBBufferLen();
PrintAPI.B_EnumUSB(new byte[128]);
PrintAPI.B_CreateUSBPort(1);
PrintAPI.B_Prn_Text_TrueType(110, 26, 31, "宋体", 1, 700, 0, 0, 0, "C1", entity.AccountingUnit_Name);
PrintAPI.B_Prn_Text_TrueType(42, 70, 31, "黑体", 1, 400, 0, 0, 0, "C2", string.Format("产品重量:{0}",entity.Weight));
PrintAPI.B_Prn_Text_TrueType(300, 70, 31, "黑体", 1, 700, 0, 0, 0, "C3", entity.Goods_Name);
PrintAPI.B_Prn_Text_TrueType(42, 120, 23, "宋体", 1, 400, 0, 0, 0, "C4", string.Format("生产日期:{0}", entity.Date.ToString("yyyy/MM/dd")));
PrintAPI.B_Prn_Text_TrueType(42, 160, 23, "宋体", 1, 400, 0, 0, 0, "C5", string.Format("检 验 员:{0}", entity.Checker));
PrintAPI.B_Prn_Text_TrueType(42, 200, 23, "宋体", 1, 400, 0, 0, 0, "C6", string.Format("保 质 期:{0}", entity.StoreCondition));
PrintAPI.B_Prn_Text_TrueType(42, 240, 23, "宋体", 1, 400, 0, 0, 0, "C7", string.Format("电话:{0}", entity.TelNumber));
PrintAPI.B_Prn_Text_TrueType(42, 280, 23, "宋体", 1, 400, 0, 0, 0, "C8", string.Format("产地:{0}", entity.Place));
PrintAPI.B_Prn_Barcode(30, 320, 0, "1", 3, 22, 35, 'N', entity.BarCode);
PrintAPI.B_Prn_Text_TrueType(173, 360, 25, "宋体", 1, 500, 0, 0, 0, "C9", entity.BarCode);
PrintAPI.B_Bar2d_QR(430, 105, 2, 6, 'M', 'A', 0, 0, 0, entity._2DQRCode);
PrintAPI.B_Set_Direction('B');
PrintAPI.B_Print_Out(1);
PrintAPI.B_ClosePrn();
}
public static void PrintByHTML(PrintEntity entity) public static void PrintByHTML(PrintEntity entity)
{ {
var dic = new Dictionary<string, string>(); var dic = new Dictionary<string, string>();
@ -71,54 +24,29 @@ namespace SegmentationWeight
BwpClientPrint.BwpClientWebPrint.Print("SegmentationWeightPrint.html", dic); BwpClientPrint.BwpClientWebPrint.Print("SegmentationWeightPrint.html", dic);
} }
public static void PrintEndHTML(PrintEntity entity)
public static void PrintEndHTML(List<PrintEntity> list, string code)
{ {
string firstRow = "<tr><td><span>{0}:</span></td><td>{1}</td><td>{2}</td><td rowspan='{3}' style='width:120px'><img src='$ImageUrl' style='width:120px;height:120px;margin-top:-5px;'/></td></tr>";
string template = "<tr><td><span>{0}:</span></td><td>{1}</td><td>{2}</td></tr>";
var builder = new StringBuilder();
bool first = true;
foreach (var item in list)
{
if (first)
{
builder.Append(string.Format(firstRow, item.Goods_Name, item.Number, item.Weight, list.Count));
first = false;
}
else
builder.Append(string.Format(template, item.Goods_Name, item.Number, item.Weight));
}
var dic = new Dictionary<string, string>(); var dic = new Dictionary<string, string>();
dic.Add("$Weight", entity.Weight);
dic.Add("$Number", entity.Number);
BwpClientPrint.BwpClientWebPrint.Create2DPic(entity.BarCode.Replace("A26091201", ""), "ImageUrl.png", 120);
dic.Add("$tableContent", builder.ToString());
BwpClientPrint.BwpClientWebPrint.Create2DPic(code.Replace("A26091201", ""), "ImageUrl.png", 120);
dic.Add("$ImageUrl", "ImageUrl.png"); dic.Add("$ImageUrl", "ImageUrl.png");
dic.Add("$DateTime", DateTime.Now.ToString("yyyy/MM/dd HH:ss"));
BwpClientPrint.BwpClientWebPrint.Print("SegmentationWeightPrintEnd.html", dic); BwpClientPrint.BwpClientWebPrint.Print("SegmentationWeightPrintEnd.html", dic);
} }
public static void PrintEnd5050(PrintEntity entity)
{
PrintAPI.B_GetUSBBufferLen();
PrintAPI.B_EnumUSB(new byte[128]);
PrintAPI.B_CreateUSBPort(1);
PrintAPI.B_Prn_Text_TrueType(40, 25, 31, "宋体", 1, 700, 0, 0, 0, "C1", "万福");
PrintAPI.B_Prn_Text_TrueType(40, 60, 27, "宋体", 1, 400, 0, 0, 0, "C4", string.Format("总重量:{0}", entity.Weight));
PrintAPI.B_Prn_Text_TrueType(40, 95, 27, "宋体", 1, 400, 0, 0, 0, "C6", string.Format("总数量:{0}", entity.Number));
PrintAPI.B_Prn_Barcode(10, 320, 0, "1", 3, 22, 35, 'N', entity.BarCode.Replace("A26091201", ""));
PrintAPI.B_Prn_Text_TrueType(40, 400, 25, "宋体", 1, 500, 0, 0, 0, "C9", entity.BarCode.Replace("A26091201", ""));
PrintAPI.B_Bar2d_QR(40, 130, 2, 6, 'M', 'A', 0, 0, 0, entity.BarCode.Replace("A26091201", ""));
PrintAPI.B_Set_Direction('B');
PrintAPI.B_Print_Out(1);
PrintAPI.B_ClosePrn();
}
public static void Print5050(PrintEntity entity)
{
PrintAPI.B_GetUSBBufferLen();
PrintAPI.B_EnumUSB(new byte[128]);
PrintAPI.B_CreateUSBPort(1);
PrintAPI.B_Prn_Text_TrueType(40, 26, 31, "黑体", 1, 700, 0, 0, 0, "C1", entity.Goods_Name);
PrintAPI.B_Prn_Text_TrueType(40, 70, 31, "黑体", 1, 400, 0, 0, 0, "C2", string.Format("产品重量:{0}", entity.Weight));
PrintAPI.B_Prn_Barcode(10, 320, 0, "1", 3, 22, 35, 'N', entity.BarCode.Replace("A26091201",""));
PrintAPI.B_Prn_Text_TrueType(40, 360, 25, "宋体", 1, 500, 0, 0, 0, "C9", entity.BarCode.Replace("A26091201", ""));
PrintAPI.B_Bar2d_QR(40, 105, 2, 6, 'M', 'A', 0, 0, 0, entity._2DQRCode.Replace("A26091201", ""));
PrintAPI.B_Set_Direction('B');
PrintAPI.B_Print_Out(1);
PrintAPI.B_ClosePrn();
}
} }
public class PrintEntity public class PrintEntity
{ {


Loading…
Cancel
Save