private void PrintOilSample(object obj) { if (OilSampleEntrySelectedItem == null) { return; } if (string.IsNullOrEmpty(OilSamplePrintConfig.PrinterName) || OilSamplePrintConfig.TemplateFileName == null) { MessageBox.Show("请选择模板和打印机"); return; } if (OilSampleEntrySelectedItem.CurrencyPrintCount <= 0 || OilSampleEntrySelectedItem.CurrencyPrintCount > 4) { MessageBox.Show("一次最大打印张数为4"); return; } var batchNo = new PrintService().BarTenderOilSamplePrint(OilSamplePrintConfig, OilSampleEntrySelectedItem); //var batchNo = "p020340"; if (!string.IsNullOrEmpty(batchNo)) { var log = new OilSampleFlowPrintLogModel { FormsonId = OilSampleEntrySelectedItem.Id, Title = OilSampleFlowSelectedItem.Title, FormmainId = OilSampleEntrySelectedItem.FormmainId, TypeId = OilSamplePrintConfig.TemplateTypeId, TypeDesc = OilSamplePrintConfig.TemplateTypeName, BatchNo = batchNo, PrintCount = OilSampleEntrySelectedItem.CurrencyPrintCount, PrintedCount = OilSampleEntrySelectedItem.PrintedCount + OilSampleEntrySelectedItem.CurrencyPrintCount, EntryId = OilSampleEntrySelectedItem.EntryId }; OilSampleEntrySelectedItem.PrintedCount = log.PrintedCount; OilSampleEntrySelectedItem.CurrencyPrintCount = OilSampleEntrySelectedItem.PrintTotalCount - log.PrintedCount; // 写日志 int id = _oilSampleService.InsertOilSampleFlowLog(log); if (id > 0) { log.Id = id; OilSampleFlowLogs.Insert(0, log); MessageBox.Show("打印成功"); } else { MessageBox.Show("插入日志数据失败,请联系管理员"); } } else { MessageBox.Show($"打印失败"); } }
public bool UpdateOilSampleFlowLog(OilSampleFlowPrintLogModel model) { string sql = @" update SROilSampleFlowPrintLog set PrintedCount= @PrintedCount where Id=@Id "; using (var connection = SqlDb.UpdateConnectionOa) { return(connection.Execute(sql, model) > 0); } }
public bool InsertOilSampleFlowLog2(OilSampleFlowPrintLogModel model) { string sql = @" insert into SROilSampleFlowPrintLog(FormsonId,FormmainId,Title,TypeId,TypeDesc,PrintCount,BatchNo,PrintedCount,EntryId) values(@FormsonId,@FormmainId,@Title,@TypeId,@TypeDesc,@PrintCount,@BatchNo,@PrintedCount,@EntryId) ; "; using (var connection = SqlDb.UpdateConnectionOa) { return(connection.Execute(sql, model) > 0); } }
public int InsertOilSampleFlowLog(OilSampleFlowPrintLogModel model) { string sql = @" insert into SROilSampleFlowPrintLog(FormsonId,FormmainId,Title,TypeId,TypeDesc,PrintCount,BatchNo,PrintedCount,EntryId) values(@FormsonId,@FormmainId,@Title,@TypeId,@TypeDesc,@PrintCount,@BatchNo,@PrintedCount,@EntryId) ; select SCOPE_IDENTITY() as Id; "; using (var connection = SqlDb.UpdateConnectionOa) { return(Convert.ToInt32(connection.ExecuteScalar(sql, model))); } }
private void PrintExpress(object obj) { if (OilSampleFlowSelectedItem == null) { return; } if (string.IsNullOrEmpty(ExpressPrintConfig.PrinterName) || ExpressPrintConfig.TemplateSelectedItem == null) { MessageBox.Show("请选择模板和打印机"); return; } var printResult = new PrintService().BarTenderExpressPrint(ExpressPrintConfig, OilSampleFlowSelectedItem.Id); //bool printResult = true; if (printResult) { var log = new OilSampleFlowPrintLogModel { FormsonId = 0, Title = OilSampleFlowSelectedItem.Title, FormmainId = OilSampleFlowSelectedItem.Id, TypeId = ExpressPrintConfig.TemplateTypeId, TypeDesc = ExpressPrintConfig.TemplateTypeName, BatchNo = "0", PrintCount = 1, PrintedCount = OilSampleFlowSelectedItem.ExpressPrintedCount + 1, EntryId = 0 }; OilSampleFlowSelectedItem.ExpressPrintedCount = log.PrintedCount; // 写日志 int id = _oilSampleService.InsertOilSampleFlowLog(log); if (id > 0) { log.Id = id; OilSampleFlowLogs.Insert(0, log); MessageBox.Show("打印成功"); } else { MessageBox.Show("插入日志数据失败,请联系管理员"); } } else { MessageBox.Show($"打印失败"); } }
public void WithParam(OilSampleFlowPrintLogModel entry, Action <int, OilSampleFlowPrintLogModel> callBack) { OilSampleFlowPrintLog = entry; _callBack = callBack; }