Browse Source

追溯打印

master
luanhui 8 years ago
parent
commit
2fa91ccb41
9 changed files with 102 additions and 152 deletions
  1. +4
    -4
      BO/Utils/AfterLoginUtil.cs
  2. +8
    -0
      ButcherManageClient/Login.cs
  3. +25
    -51
      ButcherManageClient/SettingForm.Designer.cs
  4. +1
    -2
      ButcherManageClient/SettingForm.cs
  5. BIN
      Setup/Release/Setup.msi
  6. BIN
      Setup/Release/setup.exe
  7. +13
    -55
      WeighAndGrading/DataViewForm.cs
  8. +15
    -40
      WeighAndGrading/GradeFrom.cs
  9. +36
    -0
      WeighAndGrading/WeightGradePrint.cs

+ 4
- 4
BO/Utils/AfterLoginUtil.cs View File

@ -21,15 +21,15 @@ namespace BO.Utils
#if DEBUG
static List<Tuple<string, string>> roleToAssemblies = new List<Tuple<string, string>>(){new Tuple<string,string>("排宰员",@"C:\BwpB3Project\src\B3ButcherManageClient\ButcherOrder\bin\Debug\ButcherOrder"),
new Tuple<string,string>("过磅员",@"C:\B3\src\B3ButcherManageClient\ButcherWeight\bin\Debug\ButcherWeight"),
new Tuple<string,string>("验质员",@"C:\BwpB3Project\src\B3ButcherManageClient\QualityAndOrder\bin\Debug\QualityAndOrder"),
new Tuple<string,string>("验质员",@"C:\B3\src\B3ButcherManageClient\QualityAndOrder\bin\Debug\QualityAndOrder"),
new Tuple<string,string>("定级员",@"C:\B3\src\B3ButcherManageClient\WeighAndGrading\bin\Debug\WeighAndGrading"),
new Tuple<string,string>("窒晕员",@"C:\BwpB3Project\src\B3ButcherManageClient\OrderConfirm\bin\Debug\OrderConfirm"),
new Tuple<string,string>("窒晕员",@"C:\B3\src\B3ButcherManageClient\OrderConfirm\bin\Debug\OrderConfirm"),
new Tuple<string,string>("胴体白条出入库",@"C:\B3\src\B3ButcherManageClient\TrunksIousOutInStore\bin\Debug\TrunksIousOutInStore"),
new Tuple<string,string>("掉猪处理员",@"C:\BwpB3Project\src\B3ButcherManageClient\DropPigReOrder\bin\Debug\DropPigReOrder"),
new Tuple<string,string>("掉猪处理员",@"C:\B3\src\B3ButcherManageClient\DropPigReOrder\bin\Debug\DropPigReOrder"),
new Tuple<string,string>("配货员",@"D:\BWP\BWPB3\src\B3ButcherManageClient\Distribution\bin\Debug\Distribution"),
new Tuple<string,string>("分割称重",@"C:\B3\src\B3ButcherManageClient\SegmentationWeight\bin\Debug\SegmentationWeight"),
new Tuple<string,string>("分割入库",@"C:\B3\src\B3ButcherManageClient\SegmentationInStore\bin\Debug\SegmentationInStore"),
new Tuple<string,string>("定级校验",@"C:\BwpB3Project\src\B3ButcherManageClient\WeighAndGrading\bin\Debug\WeighAndGrading"),
new Tuple<string,string>("定级校验",@"C:\B3\src\B3ButcherManageClient\WeighAndGrading\bin\Debug\WeighAndGrading"),
};
#else
static List<Tuple<string, string>> roleToAssemblies = new List<Tuple<string, string>>()


+ 8
- 0
ButcherManageClient/Login.cs View File

@ -57,6 +57,7 @@ namespace ButcherManageClient
{
await Task.Factory.StartNew(() => RpcFacade.Login(username, pwd));
LoginRpcUtil.FillUserEmpInfo(username, ButcherAppContext.Context.UserConfig);
ButcherAppContext.Context.UrlConfig.OutAddress = GetOutAddress();
ButcherAppContext.Context.Save();
ButcherAppContext.Context.UserConfig.Connection = true;
}
@ -71,6 +72,7 @@ namespace ButcherManageClient
var form = AfterLoginUtil.CreateForm(ButcherAppContext.Context.UserConfig.Role);
// var form = AfterLoginUtil.CreateForm("分割入库");
// var form = AfterLoginUtil.CreateForm("分割称重");
// var form = AfterLoginUtil.CreateForm("定级员");
if (form == null)
throw new Exception("权限不符");
form.FormClosing += delegate { SubFormClosing(); };
@ -78,6 +80,12 @@ namespace ButcherManageClient
Hide();
}
private string GetOutAddress()
{
const string wpfUserMethod = "/MainSystem/B3ClientService/Rpcs/BaseInfoRpc/GetTraceOutAddress";
return RpcFacade.Call<string>(wpfUserMethod);
}
void SubFormClosing()
{
foreach (Form form in Application.OpenForms)


+ 25
- 51
ButcherManageClient/SettingForm.Designer.cs View File

@ -30,19 +30,17 @@
{
this.cancelBtn = new System.Windows.Forms.Button();
this.saveBtn = new System.Windows.Forms.Button();
this.uTextBoxWithPad1 = new BWP.WinFormControl.UTextBoxWithPad();
this.label1 = new System.Windows.Forms.Label();
this.offlineSqlConInput = new BWP.WinFormControl.UTextBoxWithPad();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.txtOutAddress = new System.Windows.Forms.TextBox();
this.btnUpdate = new System.Windows.Forms.Button();
this.uTextBoxWithPad1 = new System.Windows.Forms.TextBox();
this.offlineSqlConInput = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// cancelBtn
//
this.cancelBtn.Font = new System.Drawing.Font("宋体", 20F);
this.cancelBtn.Location = new System.Drawing.Point(236, 245);
this.cancelBtn.Location = new System.Drawing.Point(402, 183);
this.cancelBtn.Name = "cancelBtn";
this.cancelBtn.Size = new System.Drawing.Size(81, 53);
this.cancelBtn.TabIndex = 7;
@ -53,7 +51,7 @@
// saveBtn
//
this.saveBtn.Font = new System.Drawing.Font("宋体", 20F);
this.saveBtn.Location = new System.Drawing.Point(95, 245);
this.saveBtn.Location = new System.Drawing.Point(255, 183);
this.saveBtn.Name = "saveBtn";
this.saveBtn.Size = new System.Drawing.Size(81, 53);
this.saveBtn.TabIndex = 6;
@ -61,15 +59,6 @@
this.saveBtn.UseVisualStyleBackColor = true;
this.saveBtn.Click += new System.EventHandler(this.saveBtn_Click);
//
// uTextBoxWithPad1
//
this.uTextBoxWithPad1.Font = new System.Drawing.Font("宋体", 15F);
this.uTextBoxWithPad1.Location = new System.Drawing.Point(140, 41);
this.uTextBoxWithPad1.Name = "uTextBoxWithPad1";
this.uTextBoxWithPad1.Size = new System.Drawing.Size(363, 30);
this.uTextBoxWithPad1.TabIndex = 5;
this.uTextBoxWithPad1.Type = BWP.WinFormControl.UTextBoxWithPad.TextBoxType.Normal;
//
// label1
//
this.label1.AutoSize = true;
@ -80,15 +69,6 @@
this.label1.TabIndex = 4;
this.label1.Text = "服务器地址:";
//
// offlineSqlConInput
//
this.offlineSqlConInput.Font = new System.Drawing.Font("宋体", 15F);
this.offlineSqlConInput.Location = new System.Drawing.Point(140, 106);
this.offlineSqlConInput.Name = "offlineSqlConInput";
this.offlineSqlConInput.Size = new System.Drawing.Size(363, 30);
this.offlineSqlConInput.TabIndex = 9;
this.offlineSqlConInput.Type = BWP.WinFormControl.UTextBoxWithPad.TextBoxType.Normal;
//
// label2
//
this.label2.AutoSize = true;
@ -99,28 +79,10 @@
this.label2.TabIndex = 8;
this.label2.Text = "离线数据库:";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Font = new System.Drawing.Font("宋体", 15F);
this.label3.Location = new System.Drawing.Point(38, 170);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(109, 20);
this.label3.TabIndex = 8;
this.label3.Text = "外网地址:";
//
// txtOutAddress
//
this.txtOutAddress.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtOutAddress.Location = new System.Drawing.Point(140, 170);
this.txtOutAddress.Name = "txtOutAddress";
this.txtOutAddress.Size = new System.Drawing.Size(363, 26);
this.txtOutAddress.TabIndex = 10;
//
// btnUpdate
//
this.btnUpdate.Font = new System.Drawing.Font("宋体", 20F);
this.btnUpdate.Location = new System.Drawing.Point(390, 245);
this.btnUpdate.Location = new System.Drawing.Point(550, 183);
this.btnUpdate.Name = "btnUpdate";
this.btnUpdate.Size = new System.Drawing.Size(81, 53);
this.btnUpdate.TabIndex = 6;
@ -128,20 +90,34 @@
this.btnUpdate.UseVisualStyleBackColor = true;
this.btnUpdate.Click += new System.EventHandler(this.btnUpdate_Click);
//
// uTextBoxWithPad1
//
this.uTextBoxWithPad1.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uTextBoxWithPad1.Location = new System.Drawing.Point(140, 43);
this.uTextBoxWithPad1.Name = "uTextBoxWithPad1";
this.uTextBoxWithPad1.Size = new System.Drawing.Size(706, 29);
this.uTextBoxWithPad1.TabIndex = 11;
//
// offlineSqlConInput
//
this.offlineSqlConInput.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.offlineSqlConInput.Location = new System.Drawing.Point(140, 107);
this.offlineSqlConInput.Name = "offlineSqlConInput";
this.offlineSqlConInput.Size = new System.Drawing.Size(706, 29);
this.offlineSqlConInput.TabIndex = 11;
//
// SettingForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(533, 355);
this.ClientSize = new System.Drawing.Size(872, 284);
this.ControlBox = false;
this.Controls.Add(this.txtOutAddress);
this.Controls.Add(this.offlineSqlConInput);
this.Controls.Add(this.label3);
this.Controls.Add(this.uTextBoxWithPad1);
this.Controls.Add(this.label2);
this.Controls.Add(this.cancelBtn);
this.Controls.Add(this.btnUpdate);
this.Controls.Add(this.saveBtn);
this.Controls.Add(this.uTextBoxWithPad1);
this.Controls.Add(this.label1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Name = "SettingForm";
@ -155,12 +131,10 @@
private System.Windows.Forms.Button cancelBtn;
private System.Windows.Forms.Button saveBtn;
private BWP.WinFormControl.UTextBoxWithPad uTextBoxWithPad1;
private System.Windows.Forms.Label label1;
private BWP.WinFormControl.UTextBoxWithPad offlineSqlConInput;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox txtOutAddress;
private System.Windows.Forms.Button btnUpdate;
private System.Windows.Forms.TextBox uTextBoxWithPad1;
private System.Windows.Forms.TextBox offlineSqlConInput;
}
}

+ 1
- 2
ButcherManageClient/SettingForm.cs View File

@ -26,7 +26,6 @@ namespace ButcherManageClient
InitializeComponent();
uTextBoxWithPad1.Text = ButcherAppContext.Context.UrlConfig.ServerUrl;
offlineSqlConInput.Text = ButcherAppContext.Context.UrlConfig.OfflineSqlConnection;
txtOutAddress.Text = ButcherAppContext.Context.UrlConfig.OutAddress;
if (string.IsNullOrEmpty(offlineSqlConInput.Text))
offlineSqlConInput.Text = "Server=localhost;Database=LocalClientService;Integrated Security=true;Language=Simplified Chinese;";
mInited = rpcFacadeInited;
@ -44,7 +43,7 @@ namespace ButcherManageClient
throw new Exception("请先设置服务器地址");
ButcherAppContext.Context.UrlConfig.ServerUrl = uri;
ButcherAppContext.Context.UrlConfig.OfflineSqlConnection = offlineSqlConInput.Text.Trim();
ButcherAppContext.Context.UrlConfig.OutAddress = txtOutAddress.Text.Trim();
ButcherAppContext.Context.Save();
if (mInited)


BIN
Setup/Release/Setup.msi View File


BIN
Setup/Release/setup.exe View File


+ 13
- 55
WeighAndGrading/DataViewForm.cs View File

@ -150,7 +150,8 @@ namespace WeighAndGrading
if (modifyDetail == null)
{
StartPrintEntity(tech, null);
//不需要打码
//StartPrintNewEntity(tech);
}
else
{
@ -165,6 +166,7 @@ namespace WeighAndGrading
}
}
void UpdateDetial(GradeAndWeight_Detail detail, CTuple<long, string, short, string> btnTag)
{
detail.Livestock_ID = btnTag.Item1;
@ -412,70 +414,26 @@ namespace WeighAndGrading
}
historyGrid.Refresh();
}
void StartPrintEntity(string gongyijibie, int? index)
private void printBtn_Click(object sender, EventArgs e)
{
if (!isPrintCheckBox.Checked)
{
return;
}
if (string.IsNullOrWhiteSpace(gongyijibie))
if (modifyDetail == null)
{
return;
}
var entity = CreatePrintEntity(gongyijibie, index);
WeightGradePrint.Print(entity);
StartPrintExistEntity(modifyDetail);
cancelBtn_Click(sender, EventArgs.Empty);
}
PrintEntity CreatePrintEntity(string jibie, int? index)
void StartPrintExistEntity(GradeAndWeight_Detail modifyDetail)
{
string goodsName;
if (jibie == "烫褪")
{
goodsName = "dpbt"; //"带皮白条";
}
else
{
goodsName = "qpbt"; //"去皮白条";
}
var entity = new PrintEntity();
entity.AccountingUnit_Name = "青岛万福集团股份有限公司";
entity.Goods_Name = goodsName;
entity.Date = DateTime.Today;
entity.Checker = "";
entity.StoreCondition = "0-4℃";
entity.Place = "青岛莱西市";
entity.TelNumber = "0532-88488888";
int maxindex;
if (index == null)
if (string.IsNullOrWhiteSpace(modifyDetail.Technics_Name))
{
maxindex = LocalGradeAndWeightBL.GetTodayTotalCount(butcherTimeInput.Date.Value);
maxindex++;
return;
}
else
var entity = WeightGradePrint.CreatePrintEntity(butcherTimeInput.Date.Value, modifyDetail.Technics_Name, modifyDetail.BarCode);
if (isPrintCheckBox.Checked)
{
maxindex = index.Value;
WeightGradePrint.Print(entity);
}
string indexCode = maxindex.ToString("D6");
entity.BarCode = string.Format("WF{0}{1:00000}", DateTime.Today.ToString("yyyyMMdd"), indexCode);
// entity._2DQRCode = string.Format(ButcherAppContext.Context.UrlConfig.OutAddress+"?code={0}&name={1}", entity.BarCode, goodsName);
entity._2DQRCode = string.Format(ButcherAppContext.Context.UrlConfig.OutAddress + "?code={0}", entity.BarCode);
return entity;
}
private void printBtn_Click(object sender, EventArgs e)
{
if (modifyDetail == null)
{
return;
}
StartPrintEntity(modifyDetail.Technics_Name, modifyDetail.Index);
cancelBtn_Click(sender, EventArgs.Empty);
}
private void historyGrid_CellClick(object sender, DataGridViewCellEventArgs e)


+ 15
- 40
WeighAndGrading/GradeFrom.cs View File

@ -115,7 +115,7 @@ namespace WeighAndGrading
if (modifyDetail == null)
{
var code=StartPrintEntity(tech, null);
var code=StartPrintNewEntity(tech);
AddDetail(livestockTag,code);
}
else
@ -416,61 +416,36 @@ namespace WeighAndGrading
historyGrid.Refresh();
}
string StartPrintEntity(string gongyijibie, int? index)
void StartPrintExistEntity(GradeAndWeight_Detail modifyDetail)
{
if (string.IsNullOrWhiteSpace(gongyijibie))
if (string.IsNullOrWhiteSpace(modifyDetail.Technics_Name))
{
return "";
return;
}
var entity = CreatePrintEntity(gongyijibie, index);
var entity = WeightGradePrint.CreatePrintEntity(butcherTimeInput.Date.Value,modifyDetail.Technics_Name,modifyDetail.BarCode);
if (isPrintCheckBox.Checked)
{
WeightGradePrint.Print(entity);
}
return entity.BarCode;
}
PrintEntity CreatePrintEntity(string jibie, int? index)
{
string goodsName;
if (jibie == "烫褪")
{
goodsName ="dpbt"; //"带皮白条";
}
else
{
goodsName ="qpbt"; //"去皮白条";
}
var entity = new PrintEntity();
entity.AccountingUnit_Name = "青岛万福集团股份有限公司";
entity.Goods_Name = goodsName;
entity.Date = DateTime.Today;
entity.Checker = "";
entity.StoreCondition = "0-4℃";
entity.Place = "青岛莱西市";
entity.TelNumber = "0532-88488888";
int maxindex;
if (index == null)
string StartPrintNewEntity(string gongyijibie)
{
if (string.IsNullOrWhiteSpace(gongyijibie))
{
maxindex = LocalGradeAndWeightBL.GetTodayTotalCount(butcherTimeInput.Date.Value);
maxindex++;
return "";
}
else
var entity = WeightGradePrint.CreatePrintEntity(butcherTimeInput.Date.Value, gongyijibie, "");
if (isPrintCheckBox.Checked)
{
maxindex = index.Value;
WeightGradePrint.Print(entity);
}
return entity.BarCode;
}
string indexCode = maxindex.ToString("D6");
entity.BarCode = string.Format("A26091201{0}{1:00000}", DateTime.Today.ToString("yyyyMMdd"), indexCode);
// entity._2DQRCode = string.Format(ButcherAppContext.Context.UrlConfig.OutAddress+"?code={0}&name={1}", entity.BarCode, goodsName);
entity._2DQRCode = string.Format(ButcherAppContext.Context.UrlConfig.OutAddress+"?code={0}", entity.BarCode);
return entity;
}
private void printBtn_Click(object sender, EventArgs e)
{
@ -478,7 +453,7 @@ namespace WeighAndGrading
{
return;
}
var code=StartPrintEntity(modifyDetail.Technics_Name, modifyDetail.Index);
StartPrintExistEntity(modifyDetail);
cancelBtn_Click(sender, EventArgs.Empty);
}


+ 36
- 0
WeighAndGrading/WeightGradePrint.cs View File

@ -4,11 +4,47 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BO.Utils;
using BO.Utils.BillRpc;
namespace WeighAndGrading
{
public static class WeightGradePrint
{
public static PrintEntity CreatePrintEntity(DateTime date, string gongyi, string barcode)
{
string goodsName;
if (gongyi == "烫褪")
{
goodsName = "带皮白条"; //"带皮白条";
}
else
{
goodsName = "带皮白条"; //"去皮白条";
}
var entity = new PrintEntity();
entity.AccountingUnit_Name = "青岛万福集团股份有限公司";
entity.Goods_Name = goodsName;
entity.Date = date;
entity.Checker = "";
entity.StoreCondition = "0-4℃";
entity.Place = "青岛莱西市";
entity.TelNumber = "0532-88488888";
if (string.IsNullOrWhiteSpace(barcode))
{
int maxindex = LocalGradeAndWeightBL.GetTodayTotalCount(date) + 1;
string indexCode = maxindex.ToString("D6");
entity.BarCode = string.Format("A26091201{0}{1:00000}", entity.Date.ToString("yyyyMMdd"), indexCode);
}
else
{
entity.BarCode = barcode;
}
entity._2DQRCode = string.Format(ButcherAppContext.Context.UrlConfig.OutAddress + "?code={0}", entity.BarCode);
return entity;
}
public static void Print(PrintEntity entity)
{
PrintAPI.B_GetUSBBufferLen();


Loading…
Cancel
Save