printUtils.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. import moment from 'moment'
  2. export function getServerPrintData(printRow) {
  3. let {
  4. printFormat, //格式 //备注
  5. } = printRow;
  6. let result = [];
  7. if (printFormat == 3) {//英文版
  8. result = printEN(printRow)
  9. } else {
  10. result = printCN(printRow)
  11. }
  12. return result
  13. }
  14. function printEN(printRow) {
  15. let {
  16. id, //id
  17. qrCode, //序号
  18. canisterNum, //筒数
  19. grossWeight, //毛重
  20. suttle, //净重
  21. productSpecifications, //规格
  22. productColor, //色泽
  23. lotNum, //批次
  24. boxNum, //箱号
  25. } = printRow;
  26. let res = []
  27. res.push({
  28. key1: 'GRADE:',
  29. key2: productSpecifications,
  30. })
  31. res.push({
  32. key1: 'LOT NO.:',
  33. key2: qrCode,
  34. })
  35. res.push({
  36. key1: 'COLOR NO.:',
  37. key2: productColor + ' ' + lotNum,
  38. })
  39. res.push({
  40. key1: 'CONE NO.:',
  41. key2: canisterNum,
  42. })
  43. res.push({
  44. key1: 'NET WEIGHT:',
  45. key2: suttle,
  46. })
  47. res.push({
  48. key1: 'GROSS WEIGHT:',
  49. key2: grossWeight,
  50. })
  51. res.push({
  52. key1: 'CARTON NO:',
  53. key2: boxNum,
  54. })
  55. return res
  56. }
  57. function printCN(printRow) {
  58. let {
  59. qrCode,//序号
  60. machineTool,//机台
  61. boxWeight,//箱重-车重
  62. canisterweight,//筒重
  63. canisterNum,//筒数
  64. grossWeight,//毛重
  65. suttle,//净重
  66. workShifts,//班次
  67. tubeColor,//管色
  68. boxOrderNum, //生成的随机码
  69. myNO,//箱号
  70. productionDate, //日期
  71. printFormat, //格式
  72. productName, //产品名
  73. productSpecifications, //规格
  74. productColor, //色泽
  75. lotNum, //批次
  76. levels,//等级
  77. directionOfTwist,//捻向
  78. directionOfTwistLabel,
  79. qrCodeData,
  80. boxNum,//箱号
  81. packaging
  82. } = printRow;
  83. let res = [];
  84. res.push({
  85. key1: '品种',
  86. key2: productName,
  87. key3: '规格',
  88. key4: productSpecifications
  89. })
  90. res.push({
  91. key1: '批号',
  92. key2: lotNum,
  93. key3: '色号',
  94. key4: productColor
  95. })
  96. res.push({
  97. key1: '等级',
  98. key2: levels,
  99. key3: '箱号',
  100. key4: qrCode,
  101. key5: boxNum
  102. })
  103. res.push({
  104. key1: '筒数',
  105. key2: canisterNum + ' ' + tubeColor,
  106. key3: '捻向',
  107. key4: directionOfTwistLabel
  108. })
  109. res.push({
  110. key1: '班次',
  111. key2: workShifts + ' ' + machineTool,
  112. key3: '日期',
  113. key4: moment(new Date(productionDate)).format('YYYY-MM-DD')
  114. })
  115. res.push({
  116. key1: '毛重',
  117. key2: grossWeight,
  118. key3: '净重',
  119. key4: suttle
  120. })
  121. return res
  122. }