group.vue 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350
  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"></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. <input class="uni-input" auto-focus="true" :focus="firstFocus" placeholder="请扫描托盘编号" v-model="viewText"
  21. @input="hideKeyboard" style="font-weight: bold; " />
  22. </view>
  23. <view class="uni-form-item uni-column">
  24. <view class="uni-input-wrapper" style="margin: 5px auto;">
  25. <text class="uni-form-item__title" style="width: 25%;">托盘编号</text>
  26. <input class="uni-input" :value="container_code" disabled="true" />
  27. </view>
  28. <view class="uni-input-wrapper" style="margin: 5px auto;">
  29. <text class="uni-form-item__title" style="width: 25%;">入库口</text>
  30. <select-lay style="width: 75%;" :zindex="zindex4" :value="port_sn" name="port_sn"
  31. placeholder="请选择入库口" :options="portList" @selectitem="selectPort">
  32. </select-lay>
  33. </view>
  34. <view class="uni-input-wrapper" style="margin: 5px auto;">
  35. <text class="uni-form-item__title" style="width: 25%;">选择层</text>
  36. <select-lay style="width: 75%;" :zindex="zindex3" :value="floor" name="floor"
  37. placeholder="请选择层" :options="floorList" @selectitem="selectFloor">
  38. </select-lay>
  39. </view>
  40. <view class="uni-input-wrapper" style="margin: 5px auto;">
  41. <text class="uni-form-item__title" style="width: 25%;">库区</text>
  42. <select-lay style="width: 75%;" :zindex="zindex2" :value="area_sn" name="area_sn"
  43. placeholder="请选择库区" :options="areaList" @selectitem="selectArea">
  44. </select-lay>
  45. </view>
  46. <view class="uni-input-wrapper" style="margin: 5px auto;">
  47. <text class="uni-form-item__title" style="width: 25%;">储位地址</text>
  48. <select-lay style="width: 75%;" :zindex="zindex1" :value="dscAddr" name="dscAddr"
  49. placeholder="请选择储位地址" :options="addrList" @selectitem="selectAddr">
  50. </select-lay>
  51. </view>
  52. <view class="uni-input-wrapper button-sp-area">
  53. <button type="primary" @click="SelectProduct()">选择货物</button>
  54. <button type="primary" @click="SelectHanderProduct()">选择线下货物</button>
  55. </view>
  56. <!-- 优博讯:260px 新大陆:132px-->
  57. <view style="min-height:132px;overflow-y:auto;max-height:132px">
  58. <view class="cart-list">
  59. <!-- 滑动操作分区 -->
  60. <uni-swipe-action>
  61. <!-- 滑动操作项 -->
  62. <uni-swipe-action-item v-for="(item,index) in tableData" :key="index" class="cart-swipe">
  63. <!-- 商品信息 -->
  64. <view class="goods" style="border:1px solid #ccc">
  65. <view class="meta" style="padding-bottom:15px;">
  66. <view class="name" @click="Delete(item)">
  67. 名称:{{item.name}} 型号:{{item.model}}
  68. 品牌:{{item.brand}} 设备编号:{{item.deviceid}}仓库备注:{{item.stock_remark}}
  69. </view>
  70. </view>
  71. <!-- 商品数量 -->
  72. <view class="numGroup" @click="Update(item)">
  73. <text class="text_1">数量</text>
  74. <text class="inputs">{{item.num}}</text>
  75. <text class="text">个</text>
  76. </view>
  77. </view>
  78. </uni-swipe-action-item>
  79. </uni-swipe-action>
  80. </view>
  81. </view>
  82. <view class="uni-input-wrapper button-sp-area">
  83. <button type="primary" plain="true" @click="groupDisk()" :disabled="BtnDisabled">组盘入库</button>
  84. <button type="primary" plain="true" @click="addNilTask()">空托入库</button>
  85. </view>
  86. </view>
  87. </view>
  88. <!-- 提示窗示例 -->
  89. <uni-popup ref="deleteDialog" type="dialog">
  90. <uni-popup-dialog type="info" cancelText="取消" confirmText="确定" title="提示" :content="del_tips"
  91. @confirm="dialogConfirm" @close="dialogClose"></uni-popup-dialog>
  92. </uni-popup>
  93. <!-- 提示窗示例 -->
  94. <uni-popup ref="groupDialog" type="dialog">
  95. <uni-popup-dialog type="info" cancelText="取消" confirmText="确定" title="提示" content="确定组盘?"
  96. @confirm="dialogGroup" @close="dialogClose"></uni-popup-dialog>
  97. </uni-popup>
  98. <uni-popup ref="groupNilDialog" type="dialog">
  99. <uni-popup-dialog type="info" cancelText="取消" confirmText="确定" title="提示" content="确定空托入库?"
  100. @confirm="dialogNilGroup" @close="dialogClose"></uni-popup-dialog>
  101. </uni-popup>
  102. <!-- 引入自定义模态框 -->
  103. <custom-modal :visible="updateModalVisible">
  104. <!-- 模态框的内容 -->
  105. <view>
  106. <text>提示</text>
  107. <view class="uni-input-wrapper" style="margin: 5px auto;">
  108. <text class="uni-form-item__title" style="width: 30%;">名称</text>
  109. <input class="uni-input" :value="name" disabled="true" />
  110. </view>
  111. <view class="uni-input-wrapper" style="margin: 5px auto;">
  112. <text class="uni-form-item__title" style="width: 30%;">型号</text>
  113. <input class="uni-input" :value="model" disabled="true" />
  114. </view>
  115. <view class="uni-input-wrapper" style="margin: 5px auto;">
  116. <text class="uni-form-item__title" style="width: 30%;">品牌</text>
  117. <input class="uni-input" :value="brand" disabled="true" />
  118. </view>
  119. <view class="uni-input-wrapper" style="margin: 5px auto;">
  120. <text class="uni-form-item__title" style="width: 30%;">设备编号</text>
  121. <input class="uni-input" :value="deviceid" disabled="true" />
  122. </view>
  123. <view class="uni-input-wrapper" style="margin: 5px auto;">
  124. <text class="uni-form-item__title" style="width: 30%;">仓库备注</text>
  125. <input class="uni-input" :value="stock_remark" disabled="true" />
  126. </view>
  127. <view class="uni-input-wrapper" style="margin: 5px auto;">
  128. <text class="uni-form-item__title" style="width: 30%;">公司</text>
  129. <select-lay style="width: 75%;" :zindex="3" :value="companyid" name="companyid" placeholder="请选择公司"
  130. :options="companyList" @selectitem="selectCompany">
  131. </select-lay>
  132. </view>
  133. <view class="uni-input-wrapper" style="margin: 5px auto;">
  134. <text class="uni-form-item__title" style="width: 30%;">数量</text>
  135. <input type="number" class="uni-input" :value="num" @input="numChange" />
  136. </view>
  137. <br><br>
  138. <button class="mini-btn" size="mini" @click="closeUpdateModal"
  139. style="width: 50%;float: left;">关闭</button>
  140. <button class="mini-btn" type="primary" size="mini" @click="UpdateProduct"
  141. style="width: 50%;">更新</button>
  142. </view>
  143. </custom-modal>
  144. </view>
  145. </template>
  146. <script>
  147. import CustomModal from "@/components/CustomModal/CustomModal.vue";
  148. let _this = null;
  149. import {
  150. mapGetters,
  151. mapActions
  152. } from 'vuex';
  153. import {
  154. GET_INFODATA,
  155. GET_CONNECTBLEDATA
  156. } from "@/store/gettersType.js";
  157. import {
  158. SET_CONNECTBLEDATA
  159. } from '@/store/actionsType.js';
  160. // #ifdef APP-PLUS
  161. const modal = uni.requireNativePlugin('modal');
  162. const printModule = uni.requireNativePlugin('PrintModuleCPCL');
  163. // #endif
  164. let print;
  165. var reqRootUrl = plus.storage.getItem("reqRootUrl");
  166. const SpeechTTS = uni.requireNativePlugin('MT-TTS-Speech');
  167. export default {
  168. components: {
  169. CustomModal
  170. },
  171. data() {
  172. return {
  173. container_code: "",
  174. del_tips: "",
  175. updateModalVisible: false,
  176. item: {
  177. name: "HM",
  178. mac: "60:6E:41:C3:C8:8C",
  179. },
  180. result: -1,
  181. firstFocus: false,
  182. viewText: "",
  183. tableData: [],
  184. BtnDisabled: false,
  185. warehouse_id: "",
  186. productid: "",
  187. companyid: "",
  188. sn: "",
  189. groupsn: "",
  190. name: "",
  191. model: "",
  192. brand: "",
  193. deviceid: "",
  194. stock_remark: "",
  195. num: 0,
  196. stay_num: 0,
  197. port_sn: "",
  198. portList: [],
  199. dscAddr: "",
  200. addrList: [],
  201. area_sn: "",
  202. areaList: [],
  203. floor: "",
  204. floorList: [
  205. {
  206. label: "1层",
  207. value: "1"
  208. },
  209. {
  210. label: "2层",
  211. value: "2"
  212. },
  213. {
  214. label: "3层",
  215. value: "3"
  216. },
  217. {
  218. label: "4层",
  219. value: "4"
  220. },
  221. {
  222. label: "5层",
  223. value: "5"
  224. },
  225. {
  226. label: "6层",
  227. value: "6"
  228. }
  229. ],
  230. companyList: [{
  231. label: "华力",
  232. value: "6477115e9708e4295690708b"
  233. },
  234. {
  235. label: "西曼克",
  236. value: "6465c853797066b5c4e0ab0e"
  237. }
  238. ],
  239. zindex1: 1,
  240. zindex2: 2,
  241. zindex3: 3,
  242. zindex4: 4
  243. }
  244. },
  245. computed: {
  246. ...mapGetters([GET_INFODATA, GET_CONNECTBLEDATA]),
  247. },
  248. methods: {
  249. onUnload() {
  250. SpeechTTS.destroy();
  251. },
  252. speak_init() {
  253. // console.log('>> TTS:init...')
  254. SpeechTTS.init((callback) => {
  255. // SpeechTTS.setEngine("com.iflytek.speechcloud"); // 设置引擎
  256. SpeechTTS.setEngine("com.google.android.tts"); // 设置引擎
  257. // console.log('>> tts: init success');
  258. SpeechTTS.setPitch(50); // 设置语调 setPitch(num) 0-100, 默认 50
  259. SpeechTTS.setSpeed(65); // 设置语速 setSpeed(num) 0-100, 默认 50
  260. });
  261. SpeechTTS.onDone((res) => {
  262. // console.log(">> tts: play end " + res)
  263. });
  264. },
  265. getUserInfoWareHouse() {
  266. uni.request({
  267. url: reqRootUrl + '/getUserInfoWareHouse',
  268. method: 'POST',
  269. async: false,
  270. success: (ret) => {
  271. _this.warehouse_id = ret.data;
  272. uni.setStorageSync("warehouse_id", ret.data)
  273. },
  274. fail: (err) => {
  275. // console.log('request fail', err);
  276. },
  277. complete: () => {
  278. // console.log('complete');
  279. }
  280. })
  281. },
  282. leftClick: function() {
  283. setTimeout(() => {
  284. uni.navigateBack();
  285. // uni.redirectTo({
  286. // url: '/pages/sample/main',
  287. // })
  288. }, 30);
  289. // this.$emit('change', this.value)
  290. },
  291. CateGet() {
  292. uni.request({
  293. url: reqRootUrl + '/PortQuery',
  294. method: 'POST',
  295. headers: {
  296. 'Content-Type': 'application/json'
  297. },
  298. data: JSON.stringify({
  299. "warehouse_id": _this.warehouse_id,
  300. }),
  301. success: (ret) => {
  302. console.log("ret", ret)
  303. if (ret.statusCode === 200) {
  304. this.portList = [];
  305. let rows = ret.data;
  306. if (!_this.isEmpty(rows)) {
  307. for (var i = 0; i < rows.length; i++) {
  308. let lab = rows[i]["addr"]["f"] + "-" + rows[i]["addr"]["c"] +
  309. "-" + rows[i]["addr"]["r"]
  310. this.portList.push({
  311. label: lab,
  312. value: JSON.stringify(rows[i]["addr"])
  313. })
  314. }
  315. }
  316. }
  317. },
  318. fail: (err) => {
  319. // console.log('request fail', err);
  320. },
  321. complete: () => {
  322. // console.log('complete');
  323. }
  324. })
  325. uni.request({
  326. url: reqRootUrl + '/SpaceQuery',
  327. method: 'POST',
  328. headers: {
  329. 'Content-Type': 'application/json'
  330. },
  331. data: JSON.stringify({
  332. "warehouse_id": _this.warehouse_id,
  333. }),
  334. success: (ret) => {
  335. // console.log("ret", ret)
  336. if (ret.statusCode === 200) {
  337. this.addrList = [];
  338. let rows = ret.data;
  339. // console.log("rows", rows);
  340. if (!_this.isEmpty(rows)) {
  341. for (var i = 0; i < rows.length; i++) {
  342. this.addrList.push({
  343. label: rows[i]["addr_view"],
  344. value: rows[i]["sn"]
  345. })
  346. }
  347. }
  348. }
  349. },
  350. fail: (err) => {
  351. // console.log('request fail', err);
  352. },
  353. complete: () => {
  354. // console.log('complete');
  355. }
  356. })
  357. uni.request({
  358. url: reqRootUrl + '/AreaQuery',
  359. method: 'POST',
  360. headers: {
  361. 'Content-Type': 'application/json'
  362. },
  363. data: JSON.stringify({
  364. "warehouse_id": _this.warehouse_id,
  365. }),
  366. success: (ret) => {
  367. // console.log("ret", ret)
  368. if (ret.statusCode === 200) {
  369. this.areaList = [];
  370. let rows = ret.data;
  371. // console.log("rows", rows);
  372. if (!_this.isEmpty(rows)) {
  373. for (var i = 0; i < rows.length; i++) {
  374. this.areaList.push({
  375. label: rows[i]["name"],
  376. value: rows[i]["sn"]
  377. })
  378. }
  379. }
  380. }
  381. },
  382. fail: (err) => {
  383. // console.log('request fail', err);
  384. },
  385. complete: () => {
  386. // console.log('complete');
  387. }
  388. })
  389. },
  390. selectPort(index, item) {
  391. if (index >= 0) {
  392. _this.port_sn = item.value;
  393. } else {
  394. _this.port_sn = ""
  395. }
  396. },
  397. selectCompany(index, item) {
  398. if (index >= 0) {
  399. _this.companyid = item.value;
  400. } else {
  401. _this.companyid = ""
  402. }
  403. },
  404. selectAddr(index, item) {
  405. if (index >= 0) {
  406. _this.dscAddr = item.value;
  407. } else {
  408. _this.dscAddr = ""
  409. }
  410. },
  411. selectArea(index, item) {
  412. if (index >= 0) {
  413. _this.area_sn = item.value;
  414. } else {
  415. _this.area_sn = ""
  416. }
  417. },
  418. selectFloor(index, item) {
  419. if (index >= 0) {
  420. _this.floor = item.value;
  421. } else {
  422. _this.floor = ""
  423. }
  424. },
  425. rightClick: function() {
  426. setTimeout(() => {
  427. uni.navigateTo({
  428. url: '/pages/sample/richAlert',
  429. })
  430. }, 30);
  431. // this.$emit("rightClick")
  432. },
  433. onLoad() {
  434. _this = this;
  435. _this.firstFocus = true;
  436. _this.getSn()
  437. // 打印相关
  438. /*
  439. setTimeout(() => {
  440. this.$init_bluetooth();
  441. }, 500);
  442. if (this.result !== 0) {
  443. this.closeBT()
  444. setTimeout(() => {
  445. let item = {
  446. name: "HM-A300-E093",
  447. mac: "60:6E:41:34:E0:93",
  448. };
  449. this.confirm_bluetooth(item)
  450. }, 1500);
  451. } else {
  452. // console.log("scssssss")
  453. }
  454. */
  455. },
  456. onShow() {
  457. uni.hideKeyboard();
  458. setTimeout(() => {
  459. this.getUserInfoWareHouse();
  460. }, 300);
  461. setTimeout(() => {
  462. _this.firstFocus = true;
  463. this.getList();
  464. this.speak_init();
  465. this.CateGet();
  466. }, 500);
  467. },
  468. numChange: function(e) {
  469. this.num = e.target.value
  470. },
  471. SelectProduct() {
  472. uni.setStorageSync("source", "group")
  473. setTimeout(() => {
  474. _this.firstFocus = false;
  475. uni.navigateTo({
  476. url: '/pages/sample/select_product',
  477. })
  478. }, 30);
  479. },
  480. SelectHanderProduct() {
  481. uni.setStorageSync("source", "group")
  482. setTimeout(() => {
  483. _this.firstFocus = false;
  484. uni.navigateTo({
  485. url: '/pages/sample/product',
  486. })
  487. }, 30);
  488. },
  489. hideKeyboard: function(event) {
  490. uni.hideKeyboard();
  491. let Value = event.detail.value;
  492. Value = Value.trim();
  493. _this.firstFocus = false;
  494. if (Value !== "" && Value !== null && Value !== undefined) {
  495. uni.request({
  496. url: reqRootUrl + '/CodeGet',
  497. method: 'POST',
  498. headers: {
  499. 'Content-Type': 'application/json'
  500. },
  501. data: JSON.stringify({
  502. "warehouse_id": _this.warehouse_id,
  503. "code": Value,
  504. }),
  505. success: (ret) => {
  506. if (ret.statusCode !== 200) {
  507. _this.alertInfo("托盘码错误,请重新扫描!")
  508. return;
  509. }
  510. _this.tableData = [];
  511. let rows = ret.data;
  512. if (_this.isEmpty(rows)) {
  513. _this.alertInfo("托盘码错误,请重新扫描!")
  514. _this.getSn();
  515. _this.$nextTick(() => {
  516. _this.firstFocus = true;
  517. _this.viewText = "";
  518. _this.container_code = "";
  519. uni.setStorageSync("container_code", "")
  520. })
  521. _this.$forceUpdate()
  522. return
  523. }
  524. // 扫描到的码是托盘码
  525. // 用扫描到的码查询 组盘表托盘管理表
  526. // 优先显示查询到的组盘表的数据
  527. _this.alertInfo("扫码成功!")
  528. _this.BtnDisabled = false;
  529. if (!_this.isEmpty(rows["group_disk"])) {
  530. let disk = [];
  531. for (var a = 0; a < rows["group_disk"].length; a++) {
  532. if (rows["group_disk"][a]["status"] === "status_wait") {
  533. rows["group_disk"][a]["status_view"] = "待组盘"
  534. }
  535. if (rows["group_disk"][a]["status"] === "status_yes") {
  536. _this.BtnDisabled = true
  537. rows["group_disk"][a]["status_view"] = "已组盘"
  538. }
  539. disk.push(rows["group_disk"][a])
  540. }
  541. if (disk.length > 0) {
  542. _this.container_code = disk[0]["container_code"];
  543. uni.setStorageSync("container_code", disk[0]["container_code"])
  544. uni.setStorageSync("receipt_num", disk[0]["receipt_num"])
  545. }
  546. this.tableData = disk;
  547. _this.$nextTick(() => {
  548. _this.firstFocus = true;
  549. _this.viewText = "";
  550. })
  551. }
  552. if (!_this.isEmpty(rows["container_code"])) {
  553. Value = Value.trim()
  554. _this.container_code = Value;
  555. uni.setStorageSync("container_code", Value)
  556. // _this.getSn();
  557. // _this.getList();
  558. _this.$nextTick(() => {
  559. _this.firstFocus = true;
  560. _this.viewText = "";
  561. })
  562. }
  563. },
  564. fail: (err) => {
  565. // console.log('request fail', err);
  566. },
  567. complete: () => {
  568. // console.log('complete');
  569. }
  570. })
  571. }
  572. },
  573. closeUpdateModal() {
  574. _this.zindex1 = 1;
  575. _this.zindex2 = 2;
  576. _this.zindex3 = 3;
  577. _this.zindex4 = 4;
  578. // 关闭模态框
  579. _this.sn = "";
  580. _this.groupsn = "";
  581. _this.productid = "";
  582. _this.companyid = "";
  583. _this.name = "";
  584. _this.model = "";
  585. _this.brand = "";
  586. _this.stock_remark = "";
  587. _this.deviceid = "";
  588. _this.num = 0;
  589. _this.stay_num = 0;
  590. this.updateModalVisible = false;
  591. },
  592. SelectConfirm(item) {
  593. // console.log("item ", item)
  594. },
  595. Delete(item) {
  596. // 出库后 扫码再次组盘的条目 不允许删除和更新数量 allow_updates
  597. if (item["allow_updates"] === false) {
  598. return
  599. }
  600. this.sn = item["sn"]
  601. this.del_tips = "确定删除" + item["name"] + "?";
  602. this.$refs.deleteDialog.open()
  603. },
  604. dialogConfirm() {
  605. setTimeout(() => {
  606. uni.hideLoading()
  607. uni.request({
  608. url: reqRootUrl + '/GroupDiskDelete',
  609. method: 'POST',
  610. async: false,
  611. headers: {
  612. 'Content-Type': 'application/json'
  613. },
  614. data: JSON.stringify({
  615. "sn": _this.sn,
  616. }),
  617. success: (ret) => {
  618. this.$refs.deleteDialog.close()
  619. _this.alertInfo("删除成功!")
  620. _this.getList()
  621. //处理成功逻辑
  622. },
  623. fail: (err) => {
  624. // console.log('request fail', err);
  625. },
  626. complete: () => {
  627. // console.log('complete');
  628. }
  629. })
  630. }, 30)
  631. },
  632. dialogClose() {
  633. _this.getList();
  634. },
  635. Update(item) {
  636. if (item["allow_updates"] === false) {
  637. return
  638. }
  639. _this.sn = item.sn;
  640. _this.groupsn = item.groupsn;
  641. _this.productid = item.productid;
  642. _this.companyid = item.companyid;
  643. _this.name = item.name;
  644. _this.model = item.model;
  645. _this.brand = item.brand;
  646. _this.stock_remark = item.stock_remark;
  647. _this.deviceid = item.deviceid;
  648. _this.num = item.num;
  649. _this.stay_num = item.num;
  650. _this.zindex1 = 0;
  651. _this.zindex2 = 0;
  652. _this.zindex3 = 0;
  653. _this.zindex4 = 0;
  654. _this.updateModalVisible = true;
  655. },
  656. SelectOptions(index, item) {
  657. },
  658. UpdateProduct() {
  659. let data = {};
  660. _this.firstFocus = false;
  661. if (parseFloat(_this.num) > parseFloat(_this.stay_num)) {
  662. _this.alertInfo("请填写正确的数量!")
  663. return
  664. }
  665. setTimeout(() => {
  666. let receiptNum = uni.getStorageSync("receipt_num")
  667. let containerCode = uni.getStorageSync("container_code")
  668. uni.request({
  669. url: reqRootUrl + '/GroupDiskUpdate',
  670. method: 'POST',
  671. async: false,
  672. headers: {
  673. 'Content-Type': 'application/json'
  674. },
  675. data: JSON.stringify({
  676. "sn": _this.sn,
  677. "num": parseFloat(_this.num),
  678. }),
  679. success: (ret) => {
  680. if (ret.statusCode === 200) {
  681. setTimeout(() => {
  682. _this.alertInfo("更新成功!")
  683. _this.$nextTick(() => {
  684. _this.firstFocus = true;
  685. _this.viewText = "";
  686. _this.sn = "";
  687. _this.groupsn = "";
  688. _this.productid = "";
  689. _this.companyid = "";
  690. _this.name = "";
  691. _this.model = "";
  692. _this.brand = "";
  693. _this.stock_remark = "";
  694. _this.deviceid = "";
  695. _this.num = 0;
  696. _this.stay_num = 0;
  697. _this.zindex1 = 1;
  698. _this.zindex2 = 2;
  699. _this.zindex3 = 3;
  700. _this.zindex4 = 4;
  701. // 关闭窗口后,恢复默认内容
  702. console.log("")
  703. _this.updateModalVisible = false;
  704. _this.getList();
  705. })
  706. }, 30);
  707. }
  708. },
  709. fail: (err) => {
  710. // console.log("BBBBBBBBBBBBBB ", err)
  711. // console.log('request fail', err);
  712. },
  713. complete: (DATE) => {
  714. // console.log("BBBBBBBBBBBBBB ", DATE)
  715. // console.log('complete');
  716. }
  717. })
  718. }, 30)
  719. },
  720. getList() {
  721. _this.$forceUpdate()
  722. _this.tableData = [];
  723. let containerCode = uni.getStorageSync("container_code")
  724. let warehouse_id = uni.getStorageSync("warehouse_id")
  725. if (!_this.isEmpty(containerCode) && _this.isEmpty(_this.container_code)) {
  726. _this.container_code = containerCode;
  727. }
  728. if (!_this.isEmpty(warehouse_id) && _this.isEmpty(_this.warehouse_id)) {
  729. _this.warehouse_id = warehouse_id;
  730. }
  731. console.log("containerCode ", containerCode, warehouse_id)
  732. if (_this.isEmpty(containerCode) || _this.isEmpty(_this.warehouse_id)) {
  733. return
  734. }
  735. uni.request({
  736. url: reqRootUrl + '/GroupDiskGetByCode',
  737. method: 'POST',
  738. async: false,
  739. headers: {
  740. 'Content-Type': 'application/json'
  741. },
  742. data: JSON.stringify({
  743. "code": _this.container_code,
  744. "warehouse_id": _this.warehouse_id,
  745. }),
  746. success: (ret) => {
  747. //处理成功逻辑
  748. if (ret.statusCode === 200) {
  749. if (!_this.isEmpty(ret.data)) {
  750. let rows = ret.data
  751. for (var c = 0; c < rows.length; c++) {
  752. if (rows[c]["status"] === "status_yes") {
  753. rows[c]["status_view"] = "已组盘"
  754. } else {
  755. rows[c]["status_view"] = "待组盘"
  756. }
  757. }
  758. _this.tableData = rows
  759. }
  760. }
  761. },
  762. fail: (err) => {
  763. // console.log('request fail', err);
  764. },
  765. complete: () => {
  766. // console.log('complete');
  767. }
  768. })
  769. },
  770. groupDisk: function() {
  771. _this.firstFocus = false;
  772. // console.log("_this.BtnDisabled ", _this.BtnDisabled)
  773. if (_this.BtnDisabled) {
  774. _this.alertInfo("组盘失败,已组盘货物不能再次组盘")
  775. return;
  776. }
  777. if (_this.isEmpty(_this.tableData)) {
  778. _this.alertInfo("组盘失败,货物不能为空")
  779. return;
  780. }
  781. setTimeout(() => {
  782. this.$refs.groupDialog.open()
  783. }, 30)
  784. },
  785. dialogGroup() {
  786. let sns = [];
  787. for (var d = 0; d < _this.tableData.length; d++) {
  788. if (this.tableData[d]["status"] !== "status_wait") {
  789. continue
  790. }
  791. sns.push(this.tableData[d].sn)
  792. }
  793. let receiptNum = uni.getStorageSync("receipt_num")
  794. if (_this.isEmpty(_this.container_code)) {
  795. _this.alertInfo("组盘失败!托盘码不能为空")
  796. return
  797. }
  798. if (_this.isEmpty(_this.port_sn)) {
  799. _this.alertInfo("组盘失败!请选择入库口")
  800. return
  801. }
  802. uni.request({
  803. url: reqRootUrl + '/ReceiptAdd',
  804. method: 'POST',
  805. async: false,
  806. headers: {
  807. 'Content-Type': 'application/json'
  808. },
  809. data: JSON.stringify({
  810. "group_disk_sn_list": sns,
  811. "container_code": _this.container_code,
  812. "receipt_num": receiptNum,
  813. "types": "normal",
  814. "srcAddr": JSON.parse(_this.port_sn),
  815. "areaSn": _this.area_sn,
  816. "dscAddr": _this.dscAddr,
  817. "floor": _this.floor,
  818. }),
  819. success: (ret) => {
  820. _this.alertInfo("操作成功")
  821. _this.$nextTick(() => {
  822. _this.getSn()
  823. _this.firstFocus = false;
  824. _this.firstFocus = true;
  825. _this.viewText = "";
  826. _this.container_code = "";
  827. _this.port_sn = "";
  828. _this.dscAddr = "";
  829. _this.area_sn = "";
  830. _this.floor = "";
  831. uni.setStorageSync("container_code", "")
  832. _this.getList()
  833. })
  834. _this.$forceUpdate()
  835. //_this.handlePrint(receiptNum)
  836. },
  837. fail: (err) => {
  838. // console.log('request fail', err);
  839. },
  840. complete: () => {
  841. // console.log('complete');
  842. }
  843. })
  844. },
  845. in_stock: function(code) {
  846. setTimeout(() => {
  847. uni.navigateTo({
  848. url: '/pages/sample/in_stock',
  849. })
  850. }, 500);
  851. },
  852. addNilTask: function() {
  853. _this.firstFocus = false;
  854. if (_this.isEmpty(_this.container_code)) {
  855. _this.alertInfo("托盘码不能为空")
  856. return;
  857. }
  858. if (_this.isEmpty(_this.port_sn)) {
  859. _this.alertInfo("请选择入库口")
  860. return
  861. }
  862. setTimeout(() => {
  863. this.$refs.groupNilDialog.open()
  864. }, 30)
  865. },
  866. dialogNilGroup() {
  867. if (_this.isEmpty(_this.container_code)) {
  868. _this.alertInfo("入库失败!托盘码不能为空")
  869. return
  870. }
  871. if (_this.isEmpty(_this.port_sn)) {
  872. _this.alertInfo("入库失败!请选择入库口")
  873. return
  874. }
  875. uni.request({
  876. url: reqRootUrl + '/InEmptyStock',
  877. method: 'POST',
  878. async: false,
  879. headers: {
  880. 'Content-Type': 'application/json'
  881. },
  882. data: JSON.stringify({
  883. "dscAddrSn": _this.dscAddr,
  884. "containerCode": _this.container_code,
  885. "areaSn": _this.area_sn,
  886. "portAddr": JSON.parse(_this.port_sn),
  887. "warehouseId": _this.warehouse_id,
  888. "floor": _this.floor,
  889. }),
  890. success: (ret) => {
  891. _this.alertInfo("操作成功")
  892. _this.$nextTick(() => {
  893. _this.getSn()
  894. _this.firstFocus = false;
  895. _this.firstFocus = true;
  896. _this.viewText = "";
  897. _this.container_code = "";
  898. _this.port_sn = "";
  899. _this.dscAddr = "";
  900. _this.area_sn = "";
  901. _this.floor = "";
  902. uni.setStorageSync("container_code", "")
  903. _this.getList()
  904. })
  905. _this.$forceUpdate()
  906. //_this.handlePrint(receiptNum)
  907. },
  908. fail: (err) => {
  909. // console.log('request fail', err);
  910. },
  911. complete: () => {
  912. // console.log('complete');
  913. }
  914. })
  915. },
  916. isEmpty: function(obj) {
  917. return typeof obj === undefined || obj == null || obj === "" || obj ===
  918. "000000000000000000000000" ||
  919. obj.length === 0;
  920. },
  921. alertInfo(str) {
  922. SpeechTTS.speak({
  923. text: str,
  924. });
  925. modal.toast({
  926. message: str,
  927. duration: 6,
  928. });
  929. },
  930. onNavigationBarButtonTap: function(e) {
  931. setTimeout(() => {
  932. uni.navigateTo({
  933. url: '/pages/sample/richAlert',
  934. })
  935. }, 500);
  936. },
  937. // 打印机相关
  938. ...mapActions([SET_CONNECTBLEDATA]),
  939. // 连接打印机
  940. confirm_bluetooth(item) {
  941. // let {
  942. // name,
  943. // mac
  944. // } = item;
  945. uni.showLoading({
  946. title: "连接中...",
  947. mask: true
  948. })
  949. let mac = item.mac;
  950. try {
  951. printModule.connectionBT({
  952. 'address': mac
  953. }, result => {
  954. // console.log("result ",result)
  955. const msg = JSON.stringify(result);
  956. this.result = JSON.parse(msg).result;
  957. modal.toast({
  958. message: msg,
  959. duration: 6
  960. });
  961. uni.hideLoading()
  962. printModule.setDisConnectBTListener((ret) => {
  963. modal.toast({
  964. message: '蓝牙断开',
  965. duration: 6
  966. });
  967. })
  968. })
  969. } catch (e) {
  970. console.log(e)
  971. }
  972. },
  973. //搜索没匹配的蓝牙设备
  974. search_bluetooth(address) {
  975. let _this = this;
  976. //检查蓝牙是否开启
  977. this.$check_bluetooth_open().then(ores => {
  978. if (ores) {
  979. console.log(ores);
  980. //搜索蓝牙
  981. _this.$search_bluetooth().then(bres => {
  982. console.log(bres);
  983. if (bres.code) {
  984. _this.$search_pipei().then(pres => {
  985. console.log(pres);
  986. })
  987. }
  988. })
  989. }
  990. })
  991. },
  992. handlePrint(code) {
  993. printModule.printAreaSize({
  994. 'height': '500',
  995. 'number': '1'
  996. }, result => {})
  997. printModule.printBarCode({
  998. 'x_pos': '10',
  999. 'y_pos': '100',
  1000. 'code_type': '128',
  1001. 'ratio': '1',
  1002. 'height': '250',
  1003. 'width': '2',
  1004. 'rotation': 'BARCODE',
  1005. 'undertext': false,
  1006. 'number': '4',
  1007. 'offset': '5',
  1008. "textAlign": "right",
  1009. 'code_data': code
  1010. });
  1011. printModule.printForm()
  1012. printModule.print()
  1013. },
  1014. closeBT() {
  1015. printModule.closeBT();
  1016. },
  1017. getSn() {
  1018. return;
  1019. let today = new Date();
  1020. let year = today.getFullYear();
  1021. let month = today.getMonth() + 1;
  1022. let date = today.getDate();
  1023. let hours = today.getHours();
  1024. let minutes = today.getMinutes();
  1025. let seconds = today.getSeconds();
  1026. let millisecond = today.getMilliseconds()
  1027. if (month <= 9) {
  1028. month = '0' + month
  1029. }
  1030. if (minutes <= 9) {
  1031. minutes = '0' + minutes;
  1032. }
  1033. if (date <= 9) {
  1034. date = '0' + date;
  1035. }
  1036. if (seconds <= 9) {
  1037. seconds = '0' + seconds;
  1038. }
  1039. let sn = year + '' + month + '' + date + '' + hours + '' + minutes + '' + seconds + '' + millisecond
  1040. uni.removeStorageSync('receipt_num');
  1041. uni.setStorageSync("receipt_num", sn)
  1042. uni.removeStorageSync('container_code');
  1043. console.log("receipt_num ", sn)
  1044. return sn
  1045. },
  1046. formattedDate(d) {
  1047. const date = new Date(d);
  1048. const year = date.getFullYear();
  1049. const month = String(date.getMonth() + 1).padStart(2, '0');
  1050. const day = String(date.getDate()).padStart(2, '0');
  1051. const hours = String(date.getHours()).padStart(2, '0');
  1052. const minutes = String(date.getMinutes()).padStart(2, '0');
  1053. const seconds = String(date.getSeconds()).padStart(2, '0');
  1054. return `${year}-${month}-${day}`;
  1055. },
  1056. },
  1057. }
  1058. </script>
  1059. <style scoped>
  1060. .nvue-page-root {
  1061. background-color: #F8F8F8;
  1062. padding-bottom: 0px;
  1063. }
  1064. .uni-form-item__title {
  1065. margin: 5px auto;
  1066. }
  1067. .uni-input-wrapper {
  1068. /* #ifndef APP-NVUE */
  1069. display: flex;
  1070. /* #endif */
  1071. flex-direction: row;
  1072. flex-wrap: nowrap;
  1073. background-color: #FFFFFF;
  1074. }
  1075. .uni-input {
  1076. height: 28px;
  1077. line-height: 28px;
  1078. font-size: 15px;
  1079. padding: 1px;
  1080. flex: 1;
  1081. border-radius: 5px;
  1082. border: 1px solid #cfdadd;
  1083. background-color: #FFFFFF;
  1084. }
  1085. .mini-btn {
  1086. height: 30px;
  1087. padding-left: 1px;
  1088. padding-right: 1px;
  1089. }
  1090. .uni-eye-active {
  1091. color: #007AFF;
  1092. }
  1093. .table-title {
  1094. background-color: aliceblue;
  1095. font-weight: 700;
  1096. margin-top: 10px;
  1097. height: 40px;
  1098. }
  1099. .table-data {
  1100. background-color: aliceblue;
  1101. font-weight: 700;
  1102. margin-top: 1px;
  1103. height: 40px;
  1104. }
  1105. .tab-tr {
  1106. width: 25%;
  1107. line-height: 50px;
  1108. border-right: 1px solid #ccc;
  1109. margin: auto;
  1110. text-align: center;
  1111. }
  1112. .tab-tr-end {
  1113. width: 25%;
  1114. line-height: 50px;
  1115. border-right: 0px solid #ccc;
  1116. margin: auto;
  1117. text-align: center;
  1118. }
  1119. </style>
  1120. <style lang="scss">
  1121. $color-base: #0039a6;
  1122. $words-color-base: #333333;
  1123. $words-color-light: #999999;
  1124. .header-wrap {
  1125. width: 100%;
  1126. position: fixed;
  1127. top: 0;
  1128. z-index: 999;
  1129. .index-header {
  1130. height: 88upx;
  1131. line-height: 88upx;
  1132. padding: 0 30upx;
  1133. padding-top: 40upx;
  1134. background-color: $color-base;
  1135. font-Size: 28upx;
  1136. color: #fff;
  1137. display: flex;
  1138. align-items: center;
  1139. justify-content: space-between;
  1140. .fanhui {
  1141. color: #fff !important;
  1142. font-size: 28px;
  1143. padding-top: 5px;
  1144. font-weight: 700;
  1145. }
  1146. .lanya {
  1147. color: #fff !important;
  1148. font-size: 28px;
  1149. padding-top: 5px;
  1150. }
  1151. .map-wrap {
  1152. padding-top: 5px;
  1153. }
  1154. }
  1155. }
  1156. .blank {
  1157. height: 126upx;
  1158. }
  1159. // 购物车列表
  1160. .cart-list {
  1161. padding: 0 5rpx;
  1162. // 购物车商品
  1163. .goods {
  1164. display: flex;
  1165. padding: 5rpx;
  1166. border-radius: 10rpx;
  1167. background-color: #fff;
  1168. position: relative;
  1169. .meta {
  1170. // border:1px solid red;
  1171. flex: 1;
  1172. display: flex;
  1173. flex-direction: column;
  1174. justify-content: space-between;
  1175. margin-left: 5rpx;
  1176. }
  1177. .name {
  1178. height: auto;
  1179. font-size: 18px;
  1180. color: #000000;
  1181. }
  1182. .specs {
  1183. line-height: 2;
  1184. padding: 0 15rpx;
  1185. font-size: 16px;
  1186. align-self: flex-start;
  1187. border-radius: 4rpx;
  1188. color: #888;
  1189. background-color: #f7f7f8;
  1190. }
  1191. .status_view {
  1192. line-height: 1;
  1193. font-size: 18px;
  1194. color: #444;
  1195. margin-bottom: 2rpx;
  1196. color: #000000;
  1197. padding-top: 5px;
  1198. }
  1199. // 商品数量
  1200. .numGroup {
  1201. // border: 1px solid green;
  1202. // position: absolute;
  1203. // bottom: 70rpx;
  1204. // right: 5rpx;
  1205. display: flex;
  1206. justify-content: space-between;
  1207. align-items: center;
  1208. // width: 120px;
  1209. height: 48rpx;
  1210. .text_1 {
  1211. // border: 1px solid red;
  1212. width: 50px;
  1213. height: 100%;
  1214. padding: 0 5rpx;
  1215. font-size: 15px;
  1216. color: #444;
  1217. }
  1218. .text {
  1219. height: 100%;
  1220. padding: 0 5rpx;
  1221. font-size: 32rpx;
  1222. color: #444;
  1223. }
  1224. .inputs {
  1225. // border: 1px solid blue;
  1226. height: 100%;
  1227. padding-bottom: 10px;
  1228. text-align: center;
  1229. border-radius: 4rpx;
  1230. font-size: 20px;
  1231. color: #ff0000;
  1232. // background-color: #f6f6f6;
  1233. }
  1234. }
  1235. // 商品数量
  1236. .weightGroup {
  1237. // border: 1px solid green;
  1238. position: absolute;
  1239. bottom: 20rpx;
  1240. right: 5rpx;
  1241. display: flex;
  1242. justify-content: space-between;
  1243. align-items: center;
  1244. width: 120px;
  1245. height: 48rpx;
  1246. .text_1 {
  1247. // border: 1px solid red;
  1248. width: 50px;
  1249. height: 100%;
  1250. padding: 0 5rpx;
  1251. font-size: 15px;
  1252. color: #444;
  1253. }
  1254. .text {
  1255. height: 100%;
  1256. padding: 0 5rpx;
  1257. font-size: 32rpx;
  1258. color: #444;
  1259. }
  1260. .inputs {
  1261. // border: 1px solid blue;
  1262. height: 100%;
  1263. padding-bottom: 10px;
  1264. text-align: center;
  1265. border-radius: 4rpx;
  1266. font-size: 20px;
  1267. color: #ff0000;
  1268. // background-color: #f6f6f6;
  1269. }
  1270. }
  1271. }
  1272. .cart-swipe {
  1273. display: block;
  1274. margin: 20rpx 0;
  1275. }
  1276. }
  1277. </style>