testing_out.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760
  1. <template>
  2. <view class="nvue-page-root">
  3. <view class="head">
  4. <view class="header-wrap">
  5. <view class="index-header">
  6. <uni-icons class="fanhui" custom-prefix="iconfont" type="icon-fanhui"
  7. @click="leftClick"></uni-icons>
  8. <view class="input-wrap">
  9. <text class="iconfont">出库</text>
  10. </view>
  11. <view class="map-wrap">
  12. <!-- <uni-icons class="lanya" custom-prefix="iconfont" type="icon-lanya"></uni-icons> -->
  13. </view>
  14. </view>
  15. </view>
  16. <view class="blank"></view>
  17. </view>
  18. <view class="uni-common-mt" style="padding: 5px;">
  19. <view class="uni-input-wrapper" style="margin: 5px auto;">
  20. <text class="uni-form-item__title" style="width: 25%;">出库批次: </text>
  21. <select-lay :zindex="9" class="uni-input" :value="batch" name="batch" placeholder="请选择出库批次"
  22. :options="batchList" @selectitem="selectBatch">
  23. </select-lay>
  24. </view>
  25. <view class="uni-input-wrapper" style="margin: 5px auto;">
  26. <text class="uni-form-item__title" style="width: 25%;">出库货物: </text>
  27. <select-lay :zindex="8" class="uni-input" :value="product_sn" name="product_sn" placeholder="请选择出库货物"
  28. :options="productList" @selectitem="selectProduct">
  29. </select-lay>
  30. </view>
  31. <view class="uni-input-wrapper" style="margin: 5px auto;">
  32. <text class="uni-form-item__title" style="width: 25%;">包装印刷</text>
  33. <select-lay :zindex="7" style="width: 75%;" :value="printed" name="printed" placeholder="请选择包装印刷"
  34. :options="printedList" @selectitem="printedChange">
  35. </select-lay>
  36. </view>
  37. <view class="uni-input-wrapper" style="margin: 5px auto;">
  38. <text class="uni-form-item__title" style="width: 25%;">生产线</text>
  39. <select-lay :zindex="6" style="width: 75%;" :value="production_line" name="production_line"
  40. placeholder="请选择生产线" :options="production_lineList" @selectitem="production_lineChange">
  41. </select-lay>
  42. </view>
  43. <view class="uni-input-wrapper" style="margin: 5px auto;">
  44. <text class="uni-form-item__title" style="width: 25%;">托盘码: </text>
  45. <select-lay :zindex="5" class="uni-input" :value="container_code" name="container_code" placeholder=""
  46. :options="containercodeList" @selectitem="selectContainerCode">
  47. </select-lay>
  48. </view>
  49. <view class="uni-input-wrapper" style="margin: 5px auto;">
  50. <text class="uni-form-item__title" style="width: 25%;">出库吨数:</text>
  51. <input class="uni-input" :value="weight" disabled="true" />
  52. </view>
  53. <view class="uni-form-item uni-column">
  54. <!-- <view class="uni-input-wrapper" style="margin: 5px auto;">
  55. <text class="uni-form-item__title" style="width: 25%;">货物</text>
  56. <input class="uni-input" :value="container_code" />
  57. </view> -->
  58. <!-- <view class="uni-padding-wrap uni-common-mt">
  59. <button type="primary" @click="SelectProduct()">选择货物</button>
  60. </view> -->
  61. <view style="min-height:300px;overflow-y:auto;max-height:300px">
  62. <view class="cart-list">
  63. <!-- 滑动操作分区 -->
  64. <uni-swipe-action>
  65. <!-- 滑动操作项 -->
  66. <uni-swipe-action-item v-for="(item,index) in tableData" :key="index" class="cart-swipe">
  67. <!-- 商品信息 -->
  68. <view class="goods" style="border:1px solid #ccc">
  69. <view class="meta" style="padding-bottom:15px;">
  70. <view class="name">{{item.product_name}}-{{item.printed}}-{{item.production_line}}</view>
  71. <view class="specs">{{item.batch}}-{{item.container_code}}</view>
  72. <view class="status_view"></view>
  73. </view>
  74. <!-- 商品数量 -->
  75. <view class="weightGroup">
  76. <text class="text_1">重量</text>
  77. <text class="inputs">{{item.weight}}</text>
  78. <text class="text">吨</text>
  79. </view>
  80. </view>
  81. </uni-swipe-action-item>
  82. </uni-swipe-action>
  83. </view>
  84. </view>
  85. <view class="uni-input-wrapper button-sp-area">
  86. <button type="primary" plain="true" @click="SelectProductAll()">出库</button>
  87. <button type="primary" plain="true" @click="OutPlan()">出库单</button>
  88. </view>
  89. </view>
  90. </view>
  91. <!-- 提示窗示例 -->
  92. <uni-popup ref="deleteDialog" type="dialog">
  93. <uni-popup-dialog type="info" cancelText="取消" confirmText="确定" title="提示" :content="del_tips"
  94. @confirm="dialogConfirm" @close="dialogClose"></uni-popup-dialog>
  95. </uni-popup>
  96. </view>
  97. </template>
  98. <script>
  99. let _this = null;
  100. import {
  101. mapGetters,
  102. mapActions
  103. } from 'vuex';
  104. import {
  105. GET_INFODATA,
  106. GET_CONNECTBLEDATA
  107. } from "@/store/gettersType.js";
  108. import {
  109. SET_CONNECTBLEDATA
  110. } from '@/store/actionsType.js';
  111. // #ifdef APP-PLUS
  112. const modal = uni.requireNativePlugin('modal');
  113. // #endif
  114. let reqRootUrl = plus.storage.getItem("reqRootUrl");
  115. let rData = [];
  116. const SpeechTTS = uni.requireNativePlugin('MT-TTS-Speech');
  117. export default {
  118. data() {
  119. return {
  120. printedList: [],
  121. printed: "",
  122. production_lineList: [],
  123. production_line: "一期",
  124. batchList: [],
  125. productList: [],
  126. product_sn: "",
  127. container_code: "",
  128. containercodeList: [],
  129. batch: "",
  130. weight: "0.05",
  131. product_name: "",
  132. del_tips: "",
  133. tableData: [],
  134. }
  135. },
  136. computed: {
  137. ...mapGetters([GET_INFODATA, GET_CONNECTBLEDATA]),
  138. },
  139. methods: {
  140. onUnload() {
  141. SpeechTTS.destroy();
  142. },
  143. speak_init() {
  144. // console.log('>> TTS:init...')
  145. SpeechTTS.init((callback) => {
  146. // SpeechTTS.setEngine("com.iflytek.speechcloud"); // 设置引擎
  147. SpeechTTS.setEngine("com.google.android.tts"); // 设置引擎
  148. // console.log('>> tts: init success');
  149. SpeechTTS.setPitch(50); // 设置语调 setPitch(num) 0-100, 默认 50
  150. SpeechTTS.setSpeed(65); // 设置语速 setSpeed(num) 0-100, 默认 50
  151. });
  152. SpeechTTS.onDone((res) => {
  153. // console.log(">> tts: play end " + res)
  154. });
  155. },
  156. leftClick: function() {
  157. setTimeout(() => {
  158. uni.vibrateShort();
  159. uni.navigateTo({
  160. // url: '/pages/sample/tts',
  161. url: '/pages/sample/main',
  162. })
  163. }, 30);
  164. },
  165. onLoad() {
  166. _this = this;
  167. },
  168. onShow() {
  169. uni.hideKeyboard();
  170. setTimeout(() => {
  171. this.getList();
  172. this.PrintedGet();
  173. this.speak_init();
  174. this.CateGet();
  175. }, 500);
  176. },
  177. OutPlan() {
  178. setTimeout(() => {
  179. uni.vibrateShort();
  180. uni.navigateTo({
  181. // url: '/pages/sample/tts',
  182. url: '/pages/sample/out_plan',
  183. })
  184. }, 500);
  185. },
  186. ProductionLineGet() {
  187. uni.request({
  188. url: reqRootUrl + '/wms/api',
  189. method: 'POST',
  190. headers: {
  191. 'Content-Type': 'application/json'
  192. },
  193. data: JSON.stringify({
  194. "method": "ProductionLineGet",
  195. "param": {
  196. "disable": false,
  197. }
  198. }),
  199. success: (ret) => {
  200. if (ret.data.ret === "ok") {
  201. let rows = ret.data.data;
  202. for (var i = 0; i < rows.length; i++) {
  203. this.production_lineList.push({
  204. label: rows[i].name,
  205. value: rows[i].name
  206. })
  207. }
  208. }
  209. },
  210. fail: (err) => {
  211. // console.log('request fail', err);
  212. },
  213. complete: () => {
  214. // console.log('complete');
  215. }
  216. })
  217. },
  218. PrintedGet() {
  219. uni.request({
  220. url: reqRootUrl + '/wms/api',
  221. method: 'POST',
  222. headers: {
  223. 'Content-Type': 'application/json'
  224. },
  225. data: JSON.stringify({
  226. "method": "PrintedGet",
  227. "param": {
  228. "disable": false,
  229. }
  230. }),
  231. success: (ret) => {
  232. if (ret.data.ret === "ok") {
  233. let rows = ret.data.data;
  234. for (var i = 0; i < rows.length; i++) {
  235. this.printedList.push({
  236. label: rows[i].name,
  237. value: rows[i].name
  238. })
  239. }
  240. }
  241. },
  242. fail: (err) => {
  243. // console.log('request fail', err);
  244. },
  245. complete: () => {
  246. // console.log('complete');
  247. }
  248. })
  249. },
  250. SelectProductAll() {
  251. if (_this.isEmpty(_this.batch)) {
  252. _this.alertInfo("请选择出库批次")
  253. return
  254. }
  255. if (_this.isEmpty(_this.product_name)) {
  256. _this.alertInfo("请选择出库货物")
  257. return
  258. }
  259. if (_this.isEmpty(_this.weight)) {
  260. _this.alertInfo("请选择出库重量")
  261. return
  262. }
  263. if (_this.isEmpty(_this.tableData)) {
  264. _this.alertInfo("所选批次货物为空")
  265. return
  266. }
  267. this.del_tips = "确定出库批次为" + _this.batch + "的货物" + _this.product_name + _this.weight + "吨?";
  268. this.$refs.deleteDialog.open()
  269. },
  270. printedChange(index, item) {
  271. if (index >= 0) {
  272. this.printed = item.value;
  273. _this.getList()
  274. }
  275. },
  276. production_lineChange(index, item) {
  277. if (index >= 0) {
  278. this.production_line = item.value;
  279. _this.getList()
  280. }
  281. },
  282. tmp_weight: function(event) {
  283. this.weight = event.detail.value;
  284. _this.getList()
  285. },
  286. selectBatch(index, item) {
  287. if (index >= 0) {
  288. this.batch = item.value;
  289. _this.getList()
  290. } else {
  291. this.batch = ""
  292. }
  293. },
  294. selectProduct(index, item) {
  295. if (index >= 0) {
  296. this.product_sn = item.value;
  297. this.product_name = item.label;
  298. _this.getList()
  299. } else {
  300. this.product_sn = ""
  301. this.product_name = ""
  302. }
  303. },
  304. selectContainerCode(index, item) {
  305. if (index >= 0) {
  306. this.container_code = item.value;
  307. _this.getList()
  308. } else {
  309. _this.getList()
  310. this.container_code = ""
  311. }
  312. },
  313. CateGet() {
  314. uni.request({
  315. url: reqRootUrl + '/wms/api',
  316. method: 'POST',
  317. headers: {
  318. 'Content-Type': 'application/json'
  319. },
  320. data: JSON.stringify({
  321. "method": "ProductGetFilter",
  322. "param": {
  323. "disable": false,
  324. }
  325. }),
  326. success: (ret) => {
  327. if (ret.data.ret === "ok") {
  328. this.productList = [];
  329. let rows = ret.data.data;
  330. for (var i = 0; i < rows.length; i++) {
  331. this.productList.push({
  332. label: rows[i].name,
  333. value: rows[i].sn
  334. })
  335. }
  336. }
  337. },
  338. fail: (err) => {
  339. // console.log('request fail', err);
  340. },
  341. complete: () => {
  342. // console.log('complete');
  343. }
  344. })
  345. uni.request({
  346. url: reqRootUrl + '/wms/api',
  347. method: 'POST',
  348. headers: {
  349. 'Content-Type': 'application/json'
  350. },
  351. data: JSON.stringify({
  352. "method": "BatchGet",
  353. "param": {
  354. "disable": false,
  355. }
  356. }),
  357. success: (ret) => {
  358. if (ret.data.ret === "ok") {
  359. this.batchList = [];
  360. let rows = ret.data.data;
  361. for (var i = 0; i < rows.length; i++) {
  362. this.batchList.push({
  363. label: rows[i].name,
  364. value: rows[i].name
  365. })
  366. }
  367. }
  368. },
  369. fail: (err) => {
  370. // console.log('request fail', err);
  371. },
  372. complete: () => {
  373. // console.log('complete');
  374. }
  375. })
  376. },
  377. dialogConfirm() {
  378. setTimeout(() => {
  379. uni.request({
  380. url: reqRootUrl + '/wms/api',
  381. method: 'POST',
  382. headers: {
  383. 'Content-Type': 'application/json'
  384. },
  385. data: JSON.stringify({
  386. "method": "OutCacheAdd",
  387. "param": {
  388. "batch": _this.batch,
  389. "product_sn": _this.product_sn,
  390. "weight": _this.weight,
  391. "plan_date": new Date().getTime(),
  392. "types": "出库",
  393. "printed": _this.printed,
  394. "production_line": _this.production_line,
  395. "container_code": _this.container_code,
  396. }
  397. }),
  398. success: (ret) => {
  399. _this.alertInfo("添加出库成功!")
  400. _this.batch = "";
  401. _this.container_code = "";
  402. _this.product_sn = "";
  403. _this.getList()
  404. //处理成功逻辑
  405. },
  406. fail: (err) => {
  407. // console.log('request fail', err);
  408. },
  409. complete: () => {
  410. // console.log('complete');
  411. }
  412. })
  413. // 关闭窗口后,恢复默认内容
  414. this.$refs.deleteDialog.close()
  415. }, 30)
  416. },
  417. dialogClose() {
  418. _this.getList();
  419. },
  420. getList() {
  421. _this.$forceUpdate()
  422. rData = [];
  423. _this.tableData = [];
  424. uni.request({
  425. url: reqRootUrl + '/wms/api',
  426. method: 'POST',
  427. headers: {
  428. 'Content-Type': 'application/json'
  429. },
  430. data: JSON.stringify({
  431. "method": "InventoryDetailQuery",
  432. "param": {
  433. "batch": _this.batch,
  434. "product_sn": _this.product_sn,
  435. "printed": _this.printed,
  436. "production_line": _this.production_line,
  437. "container_code": _this.container_code,
  438. }
  439. }),
  440. success: (ret) => {
  441. if (ret.data.data != null) {
  442. let rows = ret.data.data;
  443. if (rows.length > 1) {
  444. _this.containercodeList = [];
  445. for (var i = 0; i < rows.length; i++) {
  446. _this.containercodeList.push({
  447. label: rows[i]["container_code"],
  448. value: rows[i]["container_code"],
  449. })
  450. }
  451. }
  452. for (var i = 0; i < rows.length; i++) {
  453. rows[i]["weight"] = parseFloat(rows[i]["weight"]) / 1000
  454. rows[i]["product_name"] = rows[i]["product_sn.product_sn_look.name"]
  455. }
  456. _this.tableData = rows;
  457. rData = rows;
  458. } else {
  459. rData = [];
  460. _this.tableData = [];
  461. }
  462. },
  463. fail: (err) => {
  464. // console.log('request fail', err);
  465. },
  466. complete: () => {
  467. // console.log('complete');
  468. }
  469. })
  470. },
  471. isEmpty: function(obj) {
  472. return typeof obj === undefined || obj == null || obj === "" || obj ===
  473. "000000000000000000000000" ||
  474. obj.length === 0;
  475. },
  476. alertInfo(str) {
  477. SpeechTTS.speak({
  478. text: str,
  479. });
  480. modal.toast({
  481. message: str,
  482. duration: 6,
  483. });
  484. },
  485. },
  486. }
  487. </script>
  488. <style scoped>
  489. .nvue-page-root {
  490. background-color: #F8F8F8;
  491. padding-bottom: 0px;
  492. }
  493. .uni-form-item__title {
  494. margin: 5px auto;
  495. }
  496. .uni-input-wrapper {
  497. /* #ifndef APP-NVUE */
  498. display: flex;
  499. /* #endif */
  500. flex-direction: row;
  501. flex-wrap: nowrap;
  502. background-color: #FFFFFF;
  503. }
  504. .uni-input {
  505. height: 28px;
  506. line-height: 28px;
  507. font-size: 15px;
  508. padding: 1px;
  509. flex: 1;
  510. border-radius: 5px;
  511. border: 1px solid #cfdadd;
  512. background-color: #FFFFFF;
  513. }
  514. .mini-btn {
  515. height: 30px;
  516. padding-left: 1px;
  517. padding-right: 1px;
  518. }
  519. .uni-eye-active {
  520. color: #007AFF;
  521. }
  522. .table-title {
  523. background-color: aliceblue;
  524. font-weight: 700;
  525. margin-top: 10px;
  526. height: 40px;
  527. }
  528. .table-data {
  529. background-color: aliceblue;
  530. font-weight: 700;
  531. margin-top: 1px;
  532. height: 40px;
  533. }
  534. .tab-tr {
  535. width: 25%;
  536. line-height: 50px;
  537. border-right: 1px solid #ccc;
  538. margin: auto;
  539. text-align: center;
  540. }
  541. .tab-tr-end {
  542. width: 25%;
  543. line-height: 50px;
  544. border-right: 0px solid #ccc;
  545. margin: auto;
  546. text-align: center;
  547. }
  548. </style>
  549. <style lang="scss">
  550. $color-base: #0039a6;
  551. $words-color-base: #333333;
  552. $words-color-light: #999999;
  553. .header-wrap {
  554. width: 100%;
  555. position: fixed;
  556. top: 0;
  557. z-index: 999;
  558. .index-header {
  559. height: 88upx;
  560. line-height: 88upx;
  561. padding: 0 30upx;
  562. padding-top: 40upx;
  563. background-color: $color-base;
  564. font-Size: 28upx;
  565. color: #fff;
  566. display: flex;
  567. align-items: center;
  568. justify-content: space-between;
  569. .fanhui {
  570. color: #fff !important;
  571. font-size: 28px;
  572. padding-top: 5px;
  573. font-weight: 700;
  574. }
  575. .lanya {
  576. color: #fff !important;
  577. font-size: 28px;
  578. padding-top: 5px;
  579. }
  580. .map-wrap {
  581. padding-top: 5px;
  582. }
  583. }
  584. }
  585. .blank {
  586. height: 126upx;
  587. }
  588. // 购物车列表
  589. .cart-list {
  590. padding: 0 5rpx;
  591. // 购物车商品
  592. .goods {
  593. display: flex;
  594. padding: 5rpx;
  595. border-radius: 10rpx;
  596. background-color: #fff;
  597. position: relative;
  598. .meta {
  599. // border:1px solid red;
  600. flex: 1;
  601. display: flex;
  602. flex-direction: column;
  603. justify-content: space-between;
  604. margin-left: 5rpx;
  605. }
  606. .name {
  607. height: 72rpx;
  608. font-size: 18px;
  609. color: #000000;
  610. }
  611. .specs {
  612. line-height: 2;
  613. padding: 0 15rpx;
  614. font-size: 16px;
  615. align-self: flex-start;
  616. border-radius: 4rpx;
  617. color: #888;
  618. background-color: #f7f7f8;
  619. }
  620. .status_view {
  621. line-height: 1;
  622. font-size: 18px;
  623. color: #444;
  624. margin-bottom: 2rpx;
  625. color: #000000;
  626. padding-top: 5px;
  627. }
  628. // 商品数量
  629. .numGroup {
  630. // border: 1px solid green;
  631. position: absolute;
  632. bottom: 70rpx;
  633. right: 5rpx;
  634. display: flex;
  635. justify-content: space-between;
  636. align-items: center;
  637. width: 120px;
  638. height: 48rpx;
  639. .text_1 {
  640. // border: 1px solid red;
  641. width: 150px;
  642. height: 100%;
  643. padding: 0 5rpx;
  644. font-size: 15px;
  645. color: #444;
  646. }
  647. .text {
  648. height: 100%;
  649. padding: 0 5rpx;
  650. font-size: 32rpx;
  651. color: #444;
  652. }
  653. .inputs {
  654. // border: 1px solid blue;
  655. height: 100%;
  656. padding-bottom: 10px;
  657. text-align: center;
  658. border-radius: 4rpx;
  659. font-size: 20px;
  660. color: #ff0000;
  661. // background-color: #f6f6f6;
  662. }
  663. }
  664. // 商品数量
  665. .weightGroup {
  666. // border: 1px solid green;
  667. position: absolute;
  668. bottom: 20rpx;
  669. right: 5rpx;
  670. display: flex;
  671. justify-content: space-between;
  672. align-items: center;
  673. width: 120px;
  674. height: 48rpx;
  675. .text_1 {
  676. // border: 1px solid red;
  677. width: 50px;
  678. height: 100%;
  679. padding: 0 5rpx;
  680. font-size: 15px;
  681. color: #444;
  682. }
  683. .text {
  684. height: 100%;
  685. padding: 0 5rpx;
  686. font-size: 32rpx;
  687. color: #444;
  688. }
  689. .inputs {
  690. // border: 1px solid blue;
  691. height: 100%;
  692. padding-bottom: 10px;
  693. text-align: center;
  694. border-radius: 4rpx;
  695. font-size: 20px;
  696. color: #ff0000;
  697. // background-color: #f6f6f6;
  698. }
  699. }
  700. }
  701. .cart-swipe {
  702. display: block;
  703. margin: 20rpx 0;
  704. }
  705. }
  706. </style>