shipmentPage.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789
  1. <template>
  2. <gui-page :custom-header="true" :header-class="['gui-theme-background-color']">
  3. <template #gHeader>
  4. <view style="height:44px;" class="gui-flex gui-nowrap gui-rows gui-align-items-center">
  5. <!-- 使用组件实现返回按钮及返回首页按钮 -->
  6. <text style="font-size:44rpx;" class="gui-header-leader-btns gui-color-white font-icons"
  7. @tap="goHome">&#xe6c5;</text>
  8. <!-- 导航文本此处也可以是其他自定义内容 -->
  9. <text
  10. class="gui-h4 gui-blod gui-flex1 gui-text-center gui-ellipsis gui-color-white gui-primary-text">出货打标签</text>
  11. <!-- 此处加一个右侧展位元素与左侧同宽,实现标题居中 -->
  12. <!-- 实际宽度请根据自己情况设置 -->
  13. <view style="width:40px;" />
  14. <!-- 如果右侧有其他内容可以利用条件编译和定位来实现-->
  15. </view>
  16. </template>
  17. <template #gBody>
  18. <view class="list-content">
  19. <view class="scan">
  20. <view class="scan-card">
  21. <uni-easyinput ref="easyinput" v-model="scanNumber" :input-border="false" :clearable="false"
  22. type="text" focus @focus="handleInputFocus" placeholder="扫描内部标签" @confirm="handleKeydown" />
  23. <text class="font-icons" @click="handleMapass">&#xe6b7;</text>
  24. </view>
  25. </view>
  26. <view class="table-title">
  27. <span>待回签列表</span>
  28. </view>
  29. <view class="custom-table">
  30. <uni-table border stripe empty-text="暂无更多数据">
  31. <!-- 表头行 -->
  32. <uni-tr class="custom-table-head">
  33. <uni-th align="center">内部标签码</uni-th>
  34. </uni-tr>
  35. <!-- 表格数据行 -->
  36. <uni-tr v-for="(item, key) in qrCodeList" :key="key">
  37. <uni-td align="center">{{ item }}</uni-td>
  38. </uni-tr>
  39. </uni-table>
  40. </view>
  41. <view class="card-list-item"
  42. style="margin: 12px 0;display: grid;grid-template-columns: 1fr;grid-template-rows: 1fr;">
  43. <button type="primary" :disabled="btnReadonly" style="width: calc(100% - 8px);margin: 0 4px;"
  44. @click="handleGenerateOuterBoxLabelCode">生成外箱标签码</button>
  45. </view>
  46. </view>
  47. <uni-popup ref="errorTip" type="dialog">
  48. <uni-popup-dialog type="error" cancel-text="关闭" confirm-text="确认" title="提示" :content="errorTipMessage"
  49. @confirm="handleCloseErrorTipsModal" @close="handleCloseErrorTipsModal" />
  50. </uni-popup>
  51. </template>
  52. </gui-page>
  53. </template>
  54. <script>
  55. import {
  56. defineComponent,
  57. onBeforeMount,
  58. onMounted,
  59. ref
  60. } from 'vue'
  61. import {
  62. getFileStorage,
  63. setFileStorage
  64. } from '@/unit/fileStorage.js'
  65. import tsc from '@/unit/CHITEN_SDK_APP/tsc.js'
  66. export default defineComponent({
  67. setup() {
  68. const bluetooth = ref()
  69. const modalForm = ref('')
  70. const errorState = ref(0)
  71. const easyinput = ref()
  72. const errorTip = ref('')
  73. const errorTipMessage = ref('')
  74. const qrCodeList = ref([])
  75. const scanNumber = ref('')
  76. const btnReadonly = ref(true)
  77. const printerData = ref()
  78. const blueConfig = ref({
  79. loopBuffer: 0,
  80. currentTime: 1,
  81. lastData: 0,
  82. onBufferSize: 20,
  83. printerNum: 1,
  84. currentPrint: 1,
  85. isLabelSend: false
  86. })
  87. onBeforeMount(() => {
  88. // #ifdef APP-PLUS
  89. const bluetoothConfig = uni.getStorageSync('bluetoothConfig')
  90. if ([null, '', undefined].includes(bluetoothConfig)) {
  91. bluetooth.value = {
  92. 'isOpenBle': false,
  93. 'deviceId': '',
  94. 'serviceId': '',
  95. 'writeId': '',
  96. 'notifyId': ''
  97. }
  98. setTimeout(() => {
  99. // #ifdef APP-PLUS
  100. plus.device.beep(2)
  101. // #endif
  102. errorTipMessage.value = '蓝牙打印机未连接'
  103. errorState.value = -1
  104. errorTip.value.open()
  105. }, 800)
  106. } else {
  107. bluetooth.value = JSON.parse(bluetoothConfig)
  108. }
  109. // #endif
  110. })
  111. onMounted(() => {
  112. // #ifdef APP-PLUS
  113. getFileStorage('shipmentQrCodeList.txt')
  114. .then(data => {
  115. if (data) {
  116. const jsonData = JSON.parse(data)
  117. if (Object.prototype.toString.call(jsonData) === '[object String]') {
  118. const parseData = JSON.parse(jsonData)
  119. Array.prototype.push.apply(qrCodeList.value, parseData['dataList'])
  120. }
  121. }
  122. })
  123. // #endif
  124. })
  125. // 保存出货标签待回签列表
  126. const saveFileData = function(dataList) {
  127. setFileStorage('shipmentQrCodeList.txt', 0,
  128. JSON.stringify({
  129. dataList
  130. }))
  131. }
  132. // 校验是否可以打印外箱码
  133. const handleValidateOtherBoxPrint = function() {
  134. uni.$reqPost("transferOuterBoxCheckPrint", qrCodeList.value)
  135. .then(({
  136. code,
  137. data,
  138. msg
  139. }) => {
  140. if (code === 0) {
  141. btnReadonly.value = !data;
  142. } else {
  143. // #ifdef APP-PLUS
  144. plus.device.beep(2)
  145. // #endif
  146. errorTipMessage.value = msg
  147. errorTip.value.open()
  148. errorState.value = 0
  149. }
  150. })
  151. }
  152. // 打印内箱码/袋标码
  153. const handlePrinter = async function() {
  154. uni.showToast({
  155. title: '标签打印中,请勿操作',
  156. icon: 'loading',
  157. duration: 10000
  158. })
  159. qrCodeList.value.push(printerData.value.shippingLabelId)
  160. // 校验是否可以打外箱标签码
  161. await handleValidateOtherBoxPrint();
  162. await setInputFocus()
  163. // 打印
  164. await labelInnerTest(printerData.value)
  165. blueConfig.value.currentPrint = 1
  166. blueConfig.value.printNum = 2
  167. const timer = setInterval(() => {
  168. if (blueConfig.value.isLabelSend === false &&
  169. blueConfig.value.currentPrint === 2) {
  170. blueConfig.value.currentPrint += 1
  171. labelExternalTest(printerData.value)
  172. }
  173. if (blueConfig.value.currentPrint === blueConfig
  174. .value.printNum) {
  175. clearInterval(timer);
  176. }
  177. }, 1500)
  178. saveFileData(qrCodeList.value)
  179. }
  180. const handleMapass = function() {
  181. // #ifdef APP-PLUS
  182. const mpaasScanModule = uni.requireNativePlugin('Mpaas-Scan-Module')
  183. mpaasScanModule.mpaasScan({
  184. // 扫码识别类型,参数可多选,qrCode、barCode,不设置,默认识别所有
  185. 'scanType': ['qrCode', 'barCode'],
  186. // 是否隐藏相册,默认false不隐藏
  187. 'hideAlbum': false
  188. },
  189. (ret) => {
  190. if (ret.resp_code === 1000) {
  191. uni.$reqPost('transferTrayCode', {
  192. qrCode: ret.resp_result
  193. })
  194. .then(async ({
  195. code,
  196. data,
  197. msg
  198. }) => {
  199. if (code === 0) {
  200. if (qrCodeList.value.includes(data.shippingLabelId)) {
  201. // #ifdef APP-PLUS
  202. plus.device.beep(2)
  203. // #endif
  204. errorTipMessage.value = "标签码已存在,不允许录入重复标签码"
  205. errorTip.value.open()
  206. errorState.value = 0
  207. } else {
  208. printerData.value = data;
  209. if (data.unboxed * 1 === 1) {
  210. // #ifdef APP-PLUS
  211. plus.device.beep(2)
  212. // #endif
  213. errorTipMessage.value = "已经生成内箱码,是否重新打印内箱码"
  214. errorTip.value.open()
  215. errorState.value = 9
  216. } else {
  217. // 打印内箱码/袋标码
  218. handlePrinter();
  219. }
  220. }
  221. } else {
  222. // #ifdef APP-PLUS
  223. plus.device.beep(2)
  224. // #endif
  225. errorTipMessage.value = msg
  226. errorTip.value.open()
  227. errorState.value = 0
  228. }
  229. })
  230. }
  231. })
  232. // #endif
  233. }
  234. // 扫描完成品标签输入框回车事件
  235. const handleKeydown = function(e) {
  236. uni.$reqPost('transferTrayCode', {
  237. qrCode: e
  238. })
  239. .then(async ({
  240. code,
  241. data,
  242. msg
  243. }) => {
  244. if (code === 0) {
  245. if (qrCodeList.value.includes(data.shippingLabelId)) {
  246. // #ifdef APP-PLUS
  247. plus.device.beep(2)
  248. // #endif
  249. errorTipMessage.value = "标签码已存在,不允许录入重复标签码"
  250. errorTip.value.open()
  251. errorState.value = 0
  252. } else {
  253. printerData.value = data;
  254. if (data.unboxed * 1 === 1) {
  255. // #ifdef APP-PLUS
  256. plus.device.beep(2)
  257. // #endif
  258. errorTipMessage.value = "已经生成内箱码,是否重新打印内箱码"
  259. errorTip.value.open()
  260. errorState.value = 9
  261. } else {
  262. // 打印内箱码/袋标码
  263. handlePrinter();
  264. }
  265. }
  266. } else {
  267. // #ifdef APP-PLUS
  268. plus.device.beep(2)
  269. // #endif
  270. errorTipMessage.value = msg
  271. errorTip.value.open()
  272. errorState.value = 0
  273. }
  274. })
  275. }
  276. const Send = function(buff) {
  277. var currentTime = blueConfig.value.currentTime
  278. var loopBuffer = blueConfig.value.loopBuffer
  279. var lastData = blueConfig.value.lastData
  280. var onBufferSize = blueConfig.value.onBufferSize
  281. var printNum = blueConfig.value.printerNum
  282. var currentPrint = blueConfig.value.currentPrint
  283. var buf
  284. var dataView
  285. if (currentTime < loopBuffer) {
  286. buf = new ArrayBuffer(onBufferSize)
  287. dataView = new DataView(buf)
  288. for (let i = 0; i < onBufferSize; ++i) {
  289. dataView.setUint8(i, buff[(currentTime - 1) * onBufferSize + i])
  290. }
  291. } else {
  292. buf = new ArrayBuffer(lastData)
  293. dataView = new DataView(buf)
  294. for (let i = 0; i < lastData; ++i) {
  295. dataView.setUint8(i, buff[(currentTime - 1) * onBufferSize + i])
  296. }
  297. }
  298. plus.bluetooth.writeBLECharacteristicValue({
  299. deviceId: bluetooth.value.deviceId,
  300. serviceId: bluetooth.value.serviceId,
  301. characteristicId: bluetooth.value.writeId,
  302. value: buf,
  303. success: function(res) {
  304. if (currentPrint <= printNum) {
  305. wx.showToast({
  306. title: '数据打印中',
  307. icon: 'loading'
  308. })
  309. }
  310. // 将complete中处理数据的代码挪过来,增加30ms延迟, 解决蓝牙打印数据传输10007问题
  311. setTimeout(() => {
  312. currentTime += 1
  313. if (currentTime <= loopBuffer) {
  314. blueConfig.value.isLabelSend = true
  315. blueConfig.value.currentTime = currentTime
  316. Send(buff)
  317. }
  318. // end
  319. if (currentTime === loopBuffer) {
  320. blueConfig.value.currentPrint += 1
  321. blueConfig.value.isLabelSend = false
  322. }
  323. }, 10)
  324. },
  325. fail: function(e) {
  326. wx.showToast({
  327. title: '打印第' + currentPrint + '张失败' + 'error: code ' + e
  328. ?.code + ', message ' + e?.message,
  329. icon: 'none',
  330. duration: 4000
  331. })
  332. },
  333. complete: function() {}
  334. })
  335. }
  336. const prepareSend = function(buff) {
  337. var time = blueConfig.value.onBufferSize
  338. var loopBuffer = parseInt(buff.length / time)
  339. var lastData = parseInt(buff.length % time)
  340. blueConfig.value.loopBuffer = loopBuffer + 1
  341. blueConfig.value.lastData = lastData
  342. blueConfig.value.currentTime = 1
  343. Send(buff)
  344. }
  345. const labelInnerTest = function(ret) {
  346. var command = tsc.dlabelPrinter.createNew()
  347. command.setBackFeed(4)
  348. command.setOffset(-2)
  349. // (480 * 200)dots
  350. command.setSize(60, 25)
  351. command.setCls()
  352. command.setGap(6, 2)
  353. command.setSpeed(1.5)
  354. // row1
  355. command.setText(4, 0, '1', 0, 1, 1, '(C)Customer P/N:')
  356. command.setText(172, 0, '1', 0, 1, 1, ret.c)
  357. command.setText(278, 0, '1', 0, 1, 1, '(D)QTY(EA):')
  358. command.setText(378, 0, '1', 0, 1, 1, ret.qty)
  359. // row2
  360. command.setText(4, 20, '1', 0, 1, 1, '(G)LOT NO:')
  361. const strList = ret.lotNo?.split('');
  362. let lotNo = ''
  363. let lotNo2 = ''
  364. if (strList.length > 16) {
  365. lotNo = ret.lotNo?.substring(0, 16)
  366. lotNo2 = ret.lotNo?.substring(16)
  367. command.setText(102, 20, '1', 0, 1, 1, lotNo)
  368. command.setText(102, 40, '1', 0, 1, 1, lotNo2)
  369. } else {
  370. command.setText(102, 20, '1', 0, 1, 1, ret.lotNo)
  371. }
  372. command.setText(270, 20, '1', 0, 1, 1, '(J)ExpDate:')
  373. const timeList = ret.expDate?.split('');
  374. let timeText = ''
  375. let timeText2 = ''
  376. if (timeList.length > 9) {
  377. timeText = ret.expDate?.substring(0, 9)
  378. timeText2 = ret.expDate?.substring(9)
  379. command.setText(380, 20, '1', 0, 1, 1, timeText)
  380. command.setText(380, 40, '1', 0, 1, 1, timeText2)
  381. } else {
  382. command.setText(380, 20, '1', 0, 1, 1, ret.expDate)
  383. }
  384. // row3
  385. command.setText(128, 60, '1', 0, 1, 1, '(E)Manuf:')
  386. command.setText(218, 60, '1', 0, 1, 1, ret.manuf)
  387. command.setText(128, 78, 'TSS24.BF2', 0, 1, 1, '存储条件:')
  388. // let strList2 = []
  389. // let strText = ''
  390. // if (ret.storageEnvironmentName) {
  391. // strList2 = ret.storageEnvironmentName?.split(' ')
  392. // strText = strList2[0] + ' ' + strList2[1]
  393. // } else {
  394. // strText = '';
  395. // }
  396. command.setText(208, 94, 'TSS24.BF2', 0, 1, 1, '温度 ' + ret.temperature)
  397. command.setText(208, 112, 'TSS24.BF2', 0, 1, 1, '湿度 ' + ret.humidity)
  398. // command.setText(208, 94, 'TSS24.BF2', 0, 1, 1, strText)
  399. // row4
  400. command.setQrcode(4, 64, 'H', 4, 'A', ret.lotNo2)
  401. command.setQrcode(318, 54, 'M', 3, 'A', ret.qrCode1)
  402. command.setText(128, 160, '1', 0, 1, 1, 'C.O.O.CN')
  403. command.setText(128, 178, '2', 0, 1, 1, 'ROHS 2.0 HF')
  404. command.setPagePrint()
  405. blueConfig.value.isLabelSend = true
  406. prepareSend(command.getData())
  407. }
  408. const labelExternalTest = function(ret) {
  409. var command = tsc.dlabelPrinter.createNew()
  410. command.setBackFeed(6)
  411. // (640 * 320)dots
  412. command.setSize(80, 40)
  413. command.setCls()
  414. command.setGap(6)
  415. command.setSpeed(1.5)
  416. // row1
  417. command.setText(4, 0, '1', 0, 1, 1, '(A)Cust PO:')
  418. command.setText(120, 0, '1', 0, 1, 1, ret.a)
  419. // row2
  420. command.setText(4, 15, '1', 0, 1, 1, '(C)Customer P/N:')
  421. command.setText(165, 15, '1', 0, 1, 1, ret.c)
  422. command.setText(280, 12, '1', 0, 1, 1, 'C.O.O.CN')
  423. // row3
  424. command.setText(4, 30, '1', 0, 1, 1, '(E)Manuf:')
  425. command.setText(100, 30, '1', 0, 1, 1, ret.manuf)
  426. // command.setText(300, 45, 'TSS24.BF2', 0, 1, 1, '量产模具生产')
  427. // row4
  428. command.setText(4, 45, '1', 0, 1, 1, '(H)Date Code:')
  429. command.setText(140, 45, '1', 0, 1, 1, ret.h)
  430. command.setText(280, 30, '2', 0, 1, 1, 'ROHS 2.0 HF')
  431. // row5
  432. command.setText(4, 60, '1', 0, 1, 1, '(J)ExpDate:')
  433. command.setText(120, 60, '1', 0, 1, 1, ret.expDate)
  434. command.setText(270, 60, '1', 0, 1, 1, '(B)Line NO:')
  435. command.setText(385, 60, '1', 0, 1, 1, ret.b)
  436. // row6
  437. command.setText(4, 75, '1', 0, 1, 1, '(G)LOT NO:')
  438. const strList = ret.lotNo?.split('');
  439. let lotNo = ''
  440. let lotNo2 = ''
  441. if (strList.length > 16) {
  442. lotNo = ret.lotNo?.substring(0, 16)
  443. lotNo2 = ret.lotNo?.substring(16)
  444. command.setText(102, 75, '1', 0, 1, 1, lotNo)
  445. command.setText(102, 90, '1', 0, 1, 1, lotNo2)
  446. } else {
  447. command.setText(102, 75, '1', 0, 1, 1, ret.lotNo)
  448. }
  449. command.setText(270, 75, '1', 0, 1, 1, '(D)QTY(EA):')
  450. command.setText(385, 75, '1', 0, 1, 1, ret.qty)
  451. // row3
  452. // row3
  453. command.setText(90, 110, 'TSS24.BF2', 0, 1, 1, '存储条件:')
  454. // let strList2 = []
  455. // let strText = ''
  456. // if (ret.storageEnvironmentName) {
  457. // strList2 = ret.storageEnvironmentName?.split(' ')
  458. // strText = strList2[0] + ' ' + strList2[1]
  459. // } else {
  460. // strText = '';
  461. // }
  462. command.setText(90, 135, 'TSS24.BF2', 0, 1, 1, '温度 ' + ret.temperature)
  463. command.setText(90, 150, 'TSS24.BF2', 0, 1, 1, '湿度 ' + ret.humidity)
  464. // command.setText(90, 135, 'TSS24.BF2', 0, 1, 1, strText)
  465. command.setText(230, 110, '1', 0, 1, 1, '(F)MPN:')
  466. command.setText(315, 110, '1', 0, 1, 1, ret.f)
  467. command.setText(4, 195, '1', 0, 1, 1, '(K)ERP LOT:')
  468. // QR
  469. command.setQrcode(4, 100, 'Q', 3, 'A', ret.lotNo2)
  470. command.setQrcode(470, 0, 'Q', 3, 'A', ret.qrCode1)
  471. command.setBarCode(4, 210, '39', 50, 1, 0, 1, 2, ret.k)
  472. // row5
  473. command.setText(230, 125, '1', 0, 1, 1, '(I)ManufID:')
  474. command.setText(340, 125, '1', 0, 1, 1, ret.i)
  475. command.setText(230, 140, '1', 0, 1, 1, '(L)ADH:')
  476. command.setText(315, 140, '1', 0, 1, 1, ret.l)
  477. // row5
  478. command.setText(275, 190, 'TSS24.BF2', 0, 1, 1, '原胶LOT NO:')
  479. command.setText(410, 195, '2', 0, 1, 1, ret.rawIncomingReceiptMaterialLots)
  480. // row6
  481. command.setText(275, 230, '1', 0, 1, 1, 'ADHManufDate:')
  482. command.setText(410, 230, '1', 0, 1, 1, ret.rawProduceDate)
  483. command.setText(275, 250, '1', 0, 1, 1, 'ADHExpDate:')
  484. command.setText(400, 250, '1', 0, 1, 1, ret.rawExpirationDate)
  485. command.setPagePrint()
  486. blueConfig.value.isLabelSend = true
  487. prepareSend(command.getData())
  488. }
  489. const labelOuterBoxTest = function(ret) {
  490. var command = tsc.dlabelPrinter.createNew()
  491. command.setBackFeed(6)
  492. command.setSize(100, 100)
  493. command.setCls()
  494. command.setGap(6)
  495. command.setSpeed(1.5)
  496. // row1
  497. command.setText(180, 0, 'TSS24.BF2', 0, 1, 2, '苏州市东苏发五金粘胶制品有限公司')
  498. // command.setText(180, 0, 'TSS24.BF2', 0, 1, 2, ret.customerName)
  499. // row2
  500. command.setText(24, 60, 'TSS24.BF2', 0, 1, 1, '(A)Cust PO:')
  501. command.setText(182, 60, 'TSS24.BF2', 0, 1, 1, ret.a)
  502. command.setText(398, 60, 'TSS24.BF2', 0, 1, 1, '(B)Line NO:')
  503. command.setText(568, 60, 'TSS24.BF2', 0, 1, 1, ret.b)
  504. command.setText(24, 100, 'TSS24.BF2', 0, 1, 1, '(C)Customer P/N:')
  505. command.setText(224, 100, 'TSS24.BF2', 0, 1, 1, ret.c)
  506. command.setText(398, 100, 'TSS24.BF2', 0, 1, 1, '(D)QTY(EA):')
  507. command.setText(568, 100, 'TSS24.BF2', 0, 1, 1, ret.qty)
  508. command.setText(24, 140, 'TSS24.BF2', 0, 1, 1, '(E)Manuf:')
  509. command.setText(132, 140, 'TSS24.BF2', 0, 1, 1, ret.manuf)
  510. command.setText(398, 140, 'TSS24.BF2', 0, 1, 1, '(F)MPN:')
  511. command.setText(478, 140, 'TSS24.BF2', 0, 1, 1, ret.f)
  512. command.setText(24, 180, 'TSS24.BF2', 0, 1, 1, '(I)ManufID:')
  513. command.setText(182, 180, 'TSS24.BF2', 0, 1, 1, ret.i)
  514. command.setText(24, 220, 'TSS24.BF2', 0, 1, 1, '(J)ExpDate:')
  515. command.setText(162, 220, 'TSS24.BF2', 0, 1, 1, ret.expDate)
  516. command.setText(398, 220, 'TSS24.BF2', 0, 1, 1, '(H)Date Code:')
  517. command.setText(578, 220, 'TSS24.BF2', 0, 1, 1, ret.h)
  518. command.setText(24, 260, 'TSS24.BF2', 0, 1, 1, '(L)ADH:')
  519. command.setText(142, 260, 'TSS24.BF2', 0, 1, 1, ret.l)
  520. command.setText(24, 310, 'TSS24.BF2', 0, 1, 1, 'ADH LOT:')
  521. command.setText(142, 310, 'TSS24.BF2', 0, 1, 1, ret.rawBatch)
  522. command.setText(24, 350, 'TSS24.BF2', 0, 1, 1, 'ADHManufDate:')
  523. command.setText(184, 350, 'TSS24.BF2', 0, 1, 1, ret.rawProduceDate)
  524. command.setText(24, 390, 'TSS24.BF2', 0, 1, 1, 'ADHExpDate:')
  525. command.setText(184, 390, 'TSS24.BF2', 0, 1, 1, ret.rawExpirationDate)
  526. command.setText(24, 425, 'TSS24.BF2', 0, 1, 1, '(G)LOT ID:')
  527. command.setText(180, 425, 'TSS24.BF2', 0, 1, 1, '存储条件:')
  528. // let strList = []
  529. // let strText = ''
  530. // if (ret.storageEnvironmentName) {
  531. // strList = ret.storageEnvironmentName?.split(' ')
  532. // strText = strList[0] + ' ' + strList[1]
  533. // } else {
  534. // strText = '';
  535. // }
  536. command.setText(180, 455, 'TSS24.BF2', 0, 1, 1, '温度 ' + ret.temperature)
  537. command.setText(180, 485, 'TSS24.BF2', 0, 1, 1, '湿度 ' + ret.humidity)
  538. command.setQrcode(24, 455, 'H', 5, 'A', ret.lotNo2)
  539. command.setQrcode(498, 530, 'H', 4, 'A', ret.qrCode2)
  540. command.setText(24, 590, 'TSS24.BF2', 0, 1, 1, '(K):ERP LOT:')
  541. command.setBarCode(24, 630, '93', 90, 1, 0, 2, 4, ret.k)
  542. command.setText(498, 460, '3', 0, 1, 1, 'C.O.O.CN')
  543. command.setText(498, 490, '3', 0, 1, 1, 'ROHS 2.0 HF')
  544. command.setPagePrint()
  545. prepareSend(command.getData())
  546. }
  547. const handleGenerateOuterBoxLabelCode = function() {
  548. uni.$reqPost('transferOuterBoxCode', qrCodeList.value)
  549. .then(({
  550. code,
  551. data,
  552. msg
  553. }) => {
  554. if (code === 0) {
  555. uni.showToast({
  556. title: '标签打印中,请勿操作',
  557. icon: 'loading',
  558. duration: 10000
  559. })
  560. qrCodeList.value.length = 0
  561. btnReadonly.value = true
  562. setInputFocus()
  563. labelOuterBoxTest(data)
  564. saveFileData([])
  565. } else {
  566. // #ifdef APP-PLUS
  567. plus.device.beep(2)
  568. // #endif
  569. errorTipMessage.value = msg
  570. errorTip.value.open()
  571. errorState.value = 0
  572. }
  573. })
  574. }
  575. const goHome = function() {
  576. uni.$goHome()
  577. }
  578. const setInputFocus = function() {
  579. scanNumber.value = ''
  580. easyinput.value.onBlur()
  581. easyinput.value.onFocus()
  582. }
  583. // 关闭错误信息弹窗
  584. const handleCloseErrorTipsModal = async function() {
  585. errorTip.value.close()
  586. if (errorState.value === 0) {
  587. await setInputFocus()
  588. } else if (errorState.value === 9) {
  589. // 确认补打
  590. handlePrinter();
  591. }
  592. }
  593. // 禁用软键盘
  594. const handleInputFocus = function() {
  595. // #ifdef APP-PLUS
  596. setTimeout(() => {
  597. uni.hideKeyboard()
  598. }, 100)
  599. // #endif
  600. }
  601. return {
  602. goHome,
  603. btnReadonly,
  604. easyinput,
  605. errorTip,
  606. errorState,
  607. errorTipMessage,
  608. modalForm,
  609. scanNumber,
  610. handleMapass,
  611. handleKeydown,
  612. handleInputFocus,
  613. qrCodeList,
  614. handleCloseErrorTipsModal,
  615. handleGenerateOuterBoxLabelCode
  616. }
  617. }
  618. })
  619. </script>
  620. <style lang="scss" scoped>
  621. .gui-header-leader-btns {
  622. color: black;
  623. font-size: 24px !important;
  624. }
  625. .list-content {
  626. margin-top: 80px;
  627. background-color: #edeeee;
  628. }
  629. .input-200 {
  630. width: 200px;
  631. padding-left: 10px;
  632. }
  633. .font-icons {
  634. width: 40px;
  635. font-size: 20px;
  636. text-align: right;
  637. }
  638. .scan {
  639. height: 45px;
  640. width: calc(100% - 48px);
  641. margin: 12px;
  642. padding: 0 12px;
  643. display: flex;
  644. justify-content: space-between;
  645. align-items: center;
  646. border-radius: 6px;
  647. background-color: white;
  648. .scan-card {
  649. width: 100%;
  650. display: grid;
  651. grid-template-rows: 1fr;
  652. grid-template-columns: 7fr 2fr;
  653. align-items: center;
  654. input {
  655. height: 35px;
  656. line-height: 35px;
  657. }
  658. text {
  659. width: 100%;
  660. text-align: right;
  661. }
  662. }
  663. }
  664. .card-list-flexbox {
  665. width: calc(100vw - 24px);
  666. height: 195px;
  667. margin: 0 12px;
  668. display: flex;
  669. justify-content: center;
  670. flex-direction: column;
  671. align-items: center;
  672. overflow-y: scroll;
  673. .card-list-title {
  674. width: 100%;
  675. height: 35px;
  676. line-height: 35px;
  677. margin: 0 4px 0 4px;
  678. border-radius: 4px 4px 0 0;
  679. text-align: center;
  680. color: white;
  681. background-color: rgba(0, 160, 233, 1.0);
  682. }
  683. .card-list-item,
  684. .card-list-item-operation {
  685. width: 100%;
  686. height: 35px;
  687. margin: 0 4px 3rpx 4px;
  688. border-radius: 4px;
  689. display: flex;
  690. flex-direction: row;
  691. align-items: center;
  692. justify-content: space-between;
  693. background-color: #fff;
  694. uni-text {
  695. font-size: 14px;
  696. height: 50rpx;
  697. text-align: left;
  698. padding: 0 8px;
  699. display: flex;
  700. flex-direction: row;
  701. align-items: center;
  702. }
  703. .text-1 {
  704. flex: 1;
  705. height: 35px;
  706. justify-content: flex-start;
  707. }
  708. .text-2 {
  709. flex: 3;
  710. height: 35px;
  711. justify-content: flex-end;
  712. margin-right: 4px;
  713. padding: 2px 6px;
  714. }
  715. }
  716. }
  717. .table-title {
  718. height: 40px;
  719. line-height: 40px;
  720. margin: 4px 0 -3px 0;
  721. padding: 0 12px;
  722. font-size: 16px;
  723. font-weight: bold;
  724. background-color: white;
  725. }
  726. .custom-table {
  727. height: calc(100vh - 265px);
  728. min-height: 230px;
  729. margin: 5px 0;
  730. overflow-y: scroll;
  731. }
  732. </style>