private LabelDetail GetDetail(FNLABELEntity label, LineEntity line) { LabelDetail ld = new LabelDetail(); ld.TicketNo = label.TICKET_NO; ld.BucketNo = label.BUCKET_NO; ld.ItemCode = label.ZAIKEY; string itemCode = GetItemName(ld.ItemCode); ld.ItemName = itemCode; ld.ColorCode = label.COLOR_CODE; ld.Unit = (label.MASTER_UNIT_WEIGHT * 1000).ToString("F4"); ld.Section = label.SECTION; ld.Line = line.Line; ld.UserName = label.USERNAME; if (label.OPTION_FLAG.Equals("1")) { ld.OptionFlag = "(直行)"; } for (int j = 0; line.LineDetail.Count > 0 && j < 7; j++) { ld.AddDetails(line.LineDetail[0].Date, line.LineDetail[0].Count.ToString("F0"), line.LineDetail[0].Weight.ToString(), line.LineDetail[0].RetrievalNo, line.LineDetail[0].SerialNo.ToString("F0"), line.LineDetail[0].NecessaryQty.ToString("F0")); line.LineDetail.RemoveAt(0); } return(ld); }
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); } }
private void PrintNormal(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 <LabelNormal> lns = new List <LabelNormal>(); List <LabelDetail> lds = new List <LabelDetail>(); foreach (LineEntity l in lines) { decimal count = 0, weight = 0; for (int i = 0; i < l.LineDetail.Count; i++) { count += l.LineDetail[i].Count; weight += l.LineDetail[i].Weight; } while (l.LineDetail.Count > 0) { LabelDetail ld = GetDetail(labels[0], l); ld.Weight = weight.ToString("F4"); ld.Count = count.ToString("F0"); lds.Add(ld); } } while (lines.Count > 0) { LabelNormal ln = GetNormal(labels, lines); lns.Add(ln); } if (GetRetrievalStation(labels[0].RETRIEVAL_STATION).UNIFY_TICKET_PRINTFLG == "1") { foreach (LabelNormal ln in lns) { pc.DoPrint(GetPrintName(labels[0].PRINTER_NO), ln); } } if (GetRetrievalStation(labels[0].RETRIEVAL_STATION).TICKET_PRINTFLG == "1") { foreach (LabelDetail ld in lds) { pc.DoPrint(GetPrintName(labels[0].PRINTER_NO), ld); } } }