//bighai.wang 2009/03/03 发料物料标签打印 public UserControl.Messages PrintMaterialLot(string printer, List <string> materialLot) { UserControl.Messages messages = new UserControl.Messages(); string varName = string.Empty; string templatePath = string.Empty; string fileName = string.Empty; try { try { SystemSettingFacade parameter = new SystemSettingFacade(); fileName = parameter.GetGetParameterFileName("TemplateFileName", "MATERIALTYPE"); //templatePath = System.Environment.CurrentDirectory+"\\" + fileName; varName = parameter.GetGetParameterFileName("VarName", "MATERIALTYPE"); this.PrePrint(); _CodeSoftFacade.OpenTemplateMaterialLot(printer, fileName, varName); } catch (System.Exception ex) { messages.Add(new UserControl.Message(UserControl.MessageType.Error, ex.Message)); return(messages); } //批量打印前生成文本文件 string strBatchDataFile = string.Empty; if (_IsBatchPrint) { strBatchDataFile = CreateFile(); } for (int i = 0; i < materialLot.Count; i++) { LabelPrintVars labelPrintVars = new LabelPrintVars(); string[] vars = new string[0]; if (messages.IsSuccess()) { try { //要传给Codesoft的数组,字段顺序不能修改 vars = this.GetPrintVarsMaterialLot(materialLot[i]); //批量打印前的写文件 if (_IsBatchPrint) { string[] printVars = ProcessVars(vars, labelPrintVars); WriteFile(strBatchDataFile, printVars); } //直接打印 //else //{ _CodeSoftFacade.LabelPrintVars = labelPrintVars; _CodeSoftFacade.Print(vars, varName, fileName); //} } catch (System.Exception ex) { messages.Add(new UserControl.Message(UserControl.MessageType.Error, ex.Message)); return(messages); } } } //messages.Add(new UserControl.Message(UserControl.MessageType.Success, "$Success_Print_Label")); } finally { } return(messages); }