private LabelExternal GetExternal(List <FNLABELEntity> labels, List <LineEntity> lines) { LabelExternal le = new LabelExternal(); le.TicketNo = labels[0].TICKET_NO; le.BucketNo = labels[0].BUCKET_NO; le.ItemCode = labels[0].ZAIKEY; string itemCode = GetItemName(le.ItemCode); le.ItemName = itemCode; le.ColorCode = labels[0].COLOR_CODE; le.Unit = (labels[0].MASTER_UNIT_WEIGHT * 1000).ToString("F4"); le.CustomerCode = labels[0].CUSTOMER_CODE; le.CustomerName = labels[0].CUSTOMER_NAME1; le.UserName = labels[0].USERNAME; decimal count = 0, weight = 0; foreach (FNLABELEntity label in labels) { count += label.RETRIEVAL_QTY; weight += label.RETRIEVAL_WEIGHT; } le.Count = count.ToString("F0"); le.Weight = weight.ToString(); for (int i = 0; lines.Count > 0 && i < 7; i++) { le.AddDetails(lines[0].Line, lines[0].Count.ToString("F0"), lines[0].Weight.ToString(), lines[0].RetrievalNo, lines[0].SerialNo.ToString("F0"), lines[0].NecessaryQty.ToString("F0")); lines.RemoveAt(0); } return(le); }
private void PrintExternal(List <FNLABELEntity> labels) { List <LineEntity> lines = new List <LineEntity>(); LineEntity line = new LineEntity(); for (int i = 0; i < labels.Count; i++) { if (i == 0) { line.Line = labels[i].LINE; line.Count = labels[i].RETRIEVAL_QTY; line.Weight = labels[i].RETRIEVAL_WEIGHT; line.RetrievalNo = labels[i].RETRIEVAL_NO.Trim(); line.SerialNo = labels[i].SERIAL_NO; line.NecessaryQty = labels[i].NECESSARY_QTY; lines.Add(line); } else { if (line.Line == labels[i].LINE) { line.Count += labels[i].RETRIEVAL_QTY; line.Weight += labels[i].RETRIEVAL_WEIGHT; } else { line = new LineEntity(); line.Line = labels[i].LINE; line.Count = labels[i].RETRIEVAL_QTY; line.Weight = labels[i].RETRIEVAL_WEIGHT; line.RetrievalNo = labels[i].RETRIEVAL_NO.Trim(); line.SerialNo = labels[i].SERIAL_NO; line.NecessaryQty = labels[i].NECESSARY_QTY; lines.Add(line); } } string date = (labels[i].START_DATE.Length == 8 ? labels[i].START_DATE.Insert(4, "/").Insert(7, "/") : labels[i].START_DATE) + (labels[i].START_TIMING_FLAG == "1" ? "AM" : labels[i].START_TIMING_FLAG == "2" ? "PM" : ""); line.LineDetail.Add(new LineDetailEntity(date, labels[i].RETRIEVAL_QTY, labels[i].RETRIEVAL_WEIGHT, labels[i].RETRIEVAL_NO.Trim(), labels[i].SERIAL_NO, labels[i].NECESSARY_QTY)); } List <LabelExternal> les = new List <LabelExternal>(); while (lines.Count > 0) { LabelExternal le = GetExternal(labels, lines); les.Add(le); } foreach (LabelExternal le in les) { pc.DoPrint(GetPrintName(labels[0].PRINTER_NO), le); } }