index - 副本.vue 32 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148
  1. <template>
  2. <view>
  3. <view class="sticky-box">
  4. <view class="button-group">
  5. <button type="default" @click="reset">取消</button>
  6. <button type="default" @click="navigateToSummary">统计</button>
  7. <!-- <navigator url="/pages/production-replenishment/search" hover-class="navigator-hover"> -->
  8. <button type="default" @click="navigateToSearch">查询</button>
  9. <!-- </navigator> -->
  10. <button type="default" @click="navigateToStage">暂存</button>
  11. <!-- <button type="default" @click="">提交</button> -->
  12. </view>
  13. <uni-easyinput prefixIcon="search" :focus="isFocus" v-model="searchValue" @blur="isFocus = false"
  14. @confirm="scan" @clear="clear" placeholder="请扫描拼件单号">
  15. </uni-easyinput>
  16. </view>
  17. <view class="table-container" style="height: 100vh;">
  18. <scroll-view class="table-content" :style="{'height': clientHeight + 'px'}" scroll-x scroll-y
  19. :scroll-into-view="scrollItem">
  20. <!-- <scroll-view scroll-x="true" class="scroll-view-header"> -->
  21. <view class="table-header">
  22. <view class="table-cell">操作</view>
  23. <view class="table-cell">扫描状态</view>
  24. <view class="table-cell">仓位名称</view>
  25. <view class="table-cellwl">物料编码</view>
  26. <view class="table-cell1">箱号</view>
  27. <view class="table-cell1">实际作业数量</view>
  28. <view class="table-cell1">即时库存数量</view>
  29. <view class="table-cell1">装箱单号</view>
  30. <view class="table-cell">面料订单号</view>
  31. <view class="table-cell">等级</view>
  32. <view class="table-cellph">批号</view>
  33. <view class="table-cell2">工作中心</view>
  34. <view class="table-cell">备注</view>
  35. <view class="table-cell3">单据编号</view>
  36. <view class="table-cell">仓位原件数</view>
  37. <view class="table-cell">发货件数</view>
  38. <view class="table-cell">剩余件数</view>
  39. <view class="table-cell">日期</view>
  40. <view class="table-cell">作业申请人</view>
  41. <view class="table-cell">仓管员</view>
  42. </view>
  43. <!-- </scroll-view> -->
  44. <!-- <scroll-view class="table-content" :style="{'height': clientHeight + 'px'}" scroll-x scroll-y
  45. :scroll-into-view="scrollItem"> -->
  46. <view class="table-row" v-for="(item, index) in indexList" :key="index" :id="'scrollItem-' + index"
  47. :style="getStyle(item.smzt)">
  48. <view class="table-cell"><button type="default" size="mini" @click="edit(item,index)">编辑</button>
  49. </view>
  50. <view class="table-cell">{{ item.smzt? '已扫描' : '未扫描' }}</view>
  51. <view class="table-cell">{{ item["FStockLocId.FF102029.fname"] }}</view>
  52. <view class="table-cellwl" :style="getStyle(item.smzt)">{{ item["FMaterialId.fnumber"] }}</view>
  53. <view class="table-cell1" :style="getStyle(item.smzt)">{{ item["FBOXNO.LT"] }}</view>
  54. <view class="table-cell1" :style="getStyle(item.smzt)">{{ item["FActualQty"] }}</view>
  55. <view class="table-cell1" :style="getStyle(item.smzt)">{{ item["FInventoryQty"] }}</view>
  56. <view class="table-cell1" :style="getStyle(item.smzt)">{{ item["FENCHASENUM.LT"] }}</view>
  57. <view class="table-cell" :style="getStyle(item.smzt)">{{ item["FFabricOrderNo.LT"] }}</view>
  58. <view class="table-cell" :style="getStyle(item.smzt)">{{ item["FAuxPropId.FF101501.FDATAVALUE"] }}
  59. </view>
  60. <view class="table-cellph" :style="getStyle(item.smzt)">{{ item["Flot.FNumber"] }}</view>
  61. <view class="table-cell2" :style="getStyle(item.smzt)">{{ item["FEWorkCenterId.LT.fname"] }}</view>
  62. <view class="table-cell" :style="getStyle(item.smzt)">{{ item["FEntrtyMemo"] }}</view>
  63. <view class="table-cell3" :style="getStyle(item.smzt)">{{ item["FBillNo"] }}</view>
  64. <view class="table-cell" :style="getStyle(item.smzt)">{{ item["quantity"] }}</view>
  65. <view class="table-cell" :style="getStyle(item.smzt)">{{ item["rowCount"] }}</view>
  66. <view class="table-cell" :style="getStyle(item.smzt)">{{ item["quantity"]-item["rowCount"] }}
  67. </view>
  68. <view class="table-cell" :style="getStyle(item.smzt)">{{ item["FDate"].substring(0, 10) }}</view>
  69. <view class="table-cell" :style="getStyle(item.smzt)">{{ item["FApplicantId.fname"] }}</view>
  70. <view class="table-cell" :style="getStyle(item.smzt)">{{ item["FSTOCKERID.fname"] }}</view>
  71. </view>
  72. </scroll-view>
  73. </view>
  74. <view style="height: 200px;touch-action: none;"></view>
  75. <view class="card-bottom" style="">
  76. <view style="margin: 0 auto;">
  77. <view
  78. style="display: flex;flex-direction: row;margin-top: 8px;font-size: 12px;margin-right: 15px;margin-bottom: 8px;">
  79. <view style="margin-right: 15px;">源单明细:{{ indexList.length }}</view>
  80. <view style="margin-right: 15px;">已扫描:{{ indexListLength }}</view>
  81. <view>剩余件数:{{ balance }}</view>
  82. </view>
  83. </view>
  84. </view>
  85. </view>
  86. </template>
  87. <script>
  88. import {
  89. audit,
  90. getInventoryList,
  91. save,
  92. submit
  93. } from '../../api/production_replenishment';
  94. import modal from '../../plugins/modal';
  95. import {
  96. audioUrls,
  97. playVoice
  98. } from '../../utils/audio';
  99. import {
  100. getAuditParam,
  101. getSaveParam,
  102. getSubmitParam
  103. } from '../../utils/params';
  104. import submitHelper from '@/utils/submitHelper'; // 确保路径正确
  105. import {
  106. executeSql
  107. } from '../../utils/database';
  108. export default {
  109. onShow() {
  110. const res = uni.getSystemInfo({
  111. success: (res => {
  112. console.log(res.windowHeight)
  113. if (res.windowHeight < 600) {
  114. this.clientHeight = 580
  115. } else {
  116. this.clientHeight = res.windowHeight - 150;
  117. }
  118. console.log(res.windowHeight)
  119. console.log(this.clientHeight)
  120. // console.log(getApp().globalData.navHeight)
  121. })
  122. });
  123. this.$nextTick(() => {
  124. this.searchValue = ''
  125. this.isFocus = true;
  126. })
  127. },
  128. computed: {
  129. //已扫描数量
  130. indexListLength() {
  131. console.log("执行了计算属性")
  132. console.log(this.indexList.filter(obj => obj.smzt === 1).length)
  133. return this.indexList.filter(obj => obj.smzt === 1).length
  134. },
  135. //剩余数量
  136. indexList2Length() {
  137. let arr1 = this.indexList.filter((item, index, self) => {
  138. return item.smzt == 0
  139. })
  140. console.log(arr1)
  141. return arr1.length
  142. },
  143. //正操作仓位未扫描数量
  144. indexList3Length() {
  145. return this.indexList.filter(item =>
  146. item["FStockLocId.FF102029.fname"] == this.Location && item['smzt'] != 1
  147. ).length
  148. },
  149. },
  150. mounted() {
  151. // 页面加载完成后滚动到目标数据位置
  152. uni.$on('scrollIntoView', (target) => {
  153. this.$nextTick(() => {
  154. // 使用id属性定位
  155. uni.createSelectorQuery().select('#' + target).boundingClientRect().exec((rect) => {
  156. console.log(rect)
  157. uni.pageScrollTo({
  158. scrollTop: rect[0].top - 95,
  159. duration: 0
  160. });
  161. });
  162. });
  163. })
  164. this.$nextTick(() => {
  165. this.searchValue = ''
  166. this.isFocus = true;
  167. })
  168. },
  169. //监听
  170. watch: {
  171. Location(newValue, oldValue) {
  172. console.log(`Location changed from ${oldValue} to ${newValue}`)
  173. this.Location = newValue
  174. // 可以在这里执行相应的操作
  175. },
  176. },
  177. data() {
  178. return {
  179. isFocus: true,
  180. indexList: [],
  181. tableName: "bill",
  182. clientHeight: '',
  183. searchValue: '',
  184. scrollItem: '', // 滚动到的指定元素
  185. color: '',
  186. Location: '', //正操作仓位
  187. uniqueFStockLocId: [],
  188. balance: 0,
  189. isStage: false,
  190. stageIds: [],
  191. stageLists: []
  192. };
  193. },
  194. //获取上一页传过来的参数
  195. onLoad(option) {
  196. uni.$on('item', (data) => {
  197. console.log(data)
  198. let index = data["index"]
  199. if ("NewFENCHASENUM.LT" in data) {
  200. this.indexList[index]["FENCHASENUM.LT"] = data["NewFENCHASENUM.LT"]
  201. }
  202. if (this.indexList[index]["FStockLocId.FF102029.fname"] != data["FStockLocId.FF102029.fname"]) {
  203. const data1 = {
  204. "parameters": [{
  205. "FormId": "STK_Inventory",
  206. "FieldKeys": "fID",
  207. "FilterString": [{
  208. "Left": "",
  209. "FieldName": "FStockLocId.FF102029.FName",
  210. "Compare": "67",
  211. "Value": data["FStockLocId.FF102029.fname"],
  212. "Right": "",
  213. "Logic": 0
  214. },
  215. {
  216. "Left": "",
  217. "FieldName": "FBaseQty",
  218. "Compare": "21",
  219. "Value": "0",
  220. "Right": "",
  221. "Logic": 0
  222. }
  223. ],
  224. }]
  225. }
  226. getInventoryList(JSON.stringify(data1)).then(res => {
  227. // let obj = data1.find(item => item['FStockLocId.FF102029.fname'] === fname);
  228. // if (obj) {
  229. // obj.quantity = res.length; // 更新数量属性
  230. // }
  231. this.indexList[index]["quantity"] = res.length
  232. console.log("修改了原仓位条数", res.length)
  233. this.indexList[index]['FStockLocId.FF102029.fname'] = data[
  234. "FStockLocId.FF102029.fname"]
  235. // 用于记录每个组合的计数
  236. let countMap = {};
  237. // 统计每个组合的行数
  238. this.indexList.forEach(obj => {
  239. // 获取当前对象的组合键
  240. let key = obj.FBillNo + '|' + obj['FStockLocId.FF102029.fname'];
  241. // 如果该组合已经存在于 countMap 中,则增加计数,否则初始化为 1
  242. if (countMap[key]) {
  243. countMap[key]++;
  244. } else {
  245. countMap[key] = 1;
  246. }
  247. });
  248. // 将计数值添加到每个对象中
  249. this.indexList.forEach(obj => {
  250. let key = obj.FBillNo + '|' + obj['FStockLocId.FF102029.fname'];
  251. obj.rowCount = countMap[key];
  252. });
  253. })
  254. }
  255. this.indexList[index]['FInventoryQty'] = data["FInventoryQty"]
  256. this.indexList[index]['FActualQty'] = data["FActualQty"]
  257. this.indexList[index]['Flot.FNumber'] = data["Flot.FNumber"]
  258. this.indexList[index]['FAuxPropId.FF101501.FDATAVALUE'] = data["FAuxPropId.FF101501.FDATAVALUE"]
  259. this.indexList[index]['smzt'] = data["smzt"]
  260. console.log(this.indexList[index])
  261. this.$nextTick(() => {
  262. this.searchValue = ''
  263. this.isFocus = true
  264. })
  265. })
  266. uni.$on('search', (data) => {
  267. console.log(data)
  268. this.indexList = data
  269. this.indexList.forEach(item => {
  270. // item.smzt = 0; // 增加属性 smzt,并设置初始值为0
  271. this.$set(item, 'smzt', 0);
  272. })
  273. // 用于记录每个组合的计数
  274. let countMap = {};
  275. // 统计每个组合的行数
  276. this.indexList.forEach(obj => {
  277. // 获取当前对象的组合键
  278. let key = obj.FBillNo + '|' + obj['FStockLocId.FF102029.fname'];
  279. // 如果该组合已经存在于 countMap 中,则增加计数,否则初始化为 1
  280. if (countMap[key]) {
  281. countMap[key]++;
  282. } else {
  283. countMap[key] = 1;
  284. }
  285. });
  286. // 将计数值添加到每个对象中
  287. this.indexList.forEach(obj => {
  288. let key = obj.FBillNo + '|' + obj['FStockLocId.FF102029.fname'];
  289. // obj.rowCount = countMap[key];
  290. this.$set(obj, 'rowCount', countMap[key])
  291. });
  292. // 1. 提取不同的仓位
  293. this.uniqueFStockLocId = [...new Set(this.indexList.map(obj => obj[
  294. 'FStockLocId.FF102029.fname']))];
  295. console.log(this.uniqueFStockLocId)
  296. // this.processQuantity(this.uniqueFStockLocId[0])
  297. this.updateIndexList(this.indexList)
  298. this.$nextTick(() => {
  299. this.searchValue = ''
  300. this.isFocus = true;
  301. })
  302. console.log(this.stageLists)
  303. })
  304. uni.$on('summary', (data) => {
  305. console.log(data)
  306. this.indexList = data
  307. this.searchValue = ''
  308. this.isFocus = true;
  309. })
  310. uni.$on('stage', (data) => {
  311. console.log(data)
  312. // 处理每个对象
  313. this.stageLists = data.map(item => {
  314. // 解析 data 字段
  315. const parsedData = JSON.parse(item.data);
  316. // 返回处理后的对象
  317. return {
  318. ...item,
  319. data: parsedData
  320. };
  321. });
  322. this.stageIds = data.map(item => item.id)
  323. // this.stageLists = data.map(item => item.data)
  324. console.log(this.stageIds)
  325. console.log(this.stageLists)
  326. // 解析字符串为数组并合并
  327. const combinedArray = this.stageLists
  328. .map(item => item.data) // 解析每个字符串
  329. .flat(); // 合并所有数组
  330. console.log(combinedArray);
  331. this.indexList = combinedArray
  332. // this.indexList = data
  333. this.searchValue = ''
  334. this.isFocus = true;
  335. this.isStage = true
  336. })
  337. this.$nextTick(() => {
  338. console.log('dddd')
  339. this.searchValue = ''
  340. this.isFocus = true;
  341. })
  342. // this.$forceUpdate()
  343. },
  344. methods: {
  345. async updateIndexList(data1) {
  346. try {
  347. // 存储所有的异步操作 promise
  348. let promises = [];
  349. // 遍历 uniqueFStockLocId 数组
  350. for (let fname of this.uniqueFStockLocId) {
  351. const data = {
  352. "parameters": [{
  353. "FormId": "STK_Inventory",
  354. "FieldKeys": "fID",
  355. "FilterString": [{
  356. "Left": "",
  357. "FieldName": "FStockLocId.FF102029.FName",
  358. "Compare": "67",
  359. "Value": fname,
  360. "Right": "",
  361. "Logic": 0
  362. },
  363. {
  364. "Left": "",
  365. "FieldName": "FBaseQty",
  366. "Compare": "21",
  367. "Value": "0",
  368. "Right": "",
  369. "Logic": 0
  370. }
  371. ],
  372. }]
  373. };
  374. // 发起异步请求,并将 promise 存储在数组中
  375. let promise = getInventoryList(JSON.stringify(data)).then(res => {
  376. // let obj = data1.find(item => item['FStockLocId.FF102029.fname'] === fname);
  377. // if (obj) {
  378. // // obj.quantity = res.length; // 更新数量属性
  379. // this.$set(obj, 'quantity', res.length)
  380. // }
  381. let objs = data1.filter(item => item['FStockLocId.FF102029.fname'] === fname);
  382. objs.forEach(obj => {
  383. this.$set(obj, 'quantity', res.length);
  384. });
  385. });
  386. promises.push(promise);
  387. }
  388. // 等待所有异步操作完成
  389. await Promise.all(promises)
  390. console.log(data1)
  391. this.indexList = data1
  392. console.log('indexList updated:', this.indexList);
  393. } catch (error) {
  394. console.error('Error updating indexList:', error);
  395. }
  396. },
  397. scrollToItem(itemId) {
  398. // 设置滚动到的指定元素的 ID
  399. this.scrollItem = itemId;
  400. console.log(this.scrollItem)
  401. },
  402. //取消
  403. reset() {
  404. const self = this
  405. modal.confirm("是否重置?").then(res => {
  406. if (res) {
  407. self.indexList = []
  408. self.balance = 0
  409. self.searchValue = ""
  410. this.isFocus = true
  411. playVoice(audioUrls.successVoiceUrl)
  412. } else {
  413. // 用户点击取消,不执行任何操作
  414. }
  415. })
  416. },
  417. edit(item, index) {
  418. uni.navigateTo({
  419. url: '/pages/production-replenishment/show?item=' + encodeURIComponent(JSON.stringify(
  420. item)) +
  421. '&&index=' + encodeURIComponent(JSON.stringify(index))
  422. });
  423. },
  424. // scrollToItem(id) {
  425. // // 使用id属性定位
  426. // this.$nextTick(() => {
  427. // uni.$emit('scrollIntoView', id);
  428. // })
  429. // },
  430. showDetail(index) {
  431. console.log(index);
  432. let item = this.indexList[index.name]
  433. console.log(item)
  434. uni.navigateTo({
  435. url: '/pages/automatedwarehouse/listshow?Info=' + encodeURIComponent(JSON.stringify(
  436. item))
  437. });
  438. },
  439. focusPoint() {
  440. this.isFocus = false;
  441. this.$nextTick(() => {
  442. this.isFocus = true;
  443. });
  444. },
  445. clear() {
  446. this.focusPoint()
  447. },
  448. //跳转到查询页面
  449. navigateToSearch() {
  450. if (this.indexList.length > 0) {
  451. // this.isRangeSelected = false; // 显示错误提示
  452. playVoice(audioUrls.failVoiceUrl)
  453. uni.showToast({
  454. title: '源单已选择',
  455. duration: 2000,
  456. icon: "error"
  457. });
  458. return;
  459. }
  460. uni.navigateTo({
  461. url: '/pages/production-replenishment/search', //这是你的当前页面地址
  462. });
  463. },
  464. navigateToSummary() {
  465. uni.navigateTo({
  466. url: '/pages/production-replenishment/summary?Info=' + encodeURIComponent(JSON
  467. .stringify(this.indexList)) + '&&stageInfo=' + encodeURIComponent(JSON
  468. .stringify(this.stageLists)), //这是你的当前页面地址
  469. });
  470. },
  471. navigateToStage() {
  472. uni.navigateTo({
  473. url: '/pages/production-replenishment/stage?Info=' + encodeURIComponent(JSON
  474. .stringify(this.indexList)), //这是你的当前页面地址
  475. });
  476. },
  477. searchValueIsEmpty(data) {
  478. console.log(data)
  479. if (data == "" || data == undefined) {
  480. return true
  481. } else {
  482. return false
  483. }
  484. },
  485. checkBarcodeInArray(barcode, arrayOfObjects, propertyName) {
  486. if (arrayOfObjects.findIndex(item => item[propertyName] === barcode) < 0) { //不存在
  487. return true
  488. }
  489. return false
  490. },
  491. areAllDetailsScanned(nowindex) {
  492. if (this.indexList.filter(item =>
  493. item["FBillNo"] == this.indexList[nowindex].FBillNo && item[
  494. 'smzt'] == 0
  495. ).length == 0) {
  496. return true
  497. }
  498. return false
  499. },
  500. showToast() {
  501. uni.showToast({
  502. title: '请扫描条码',
  503. icon: 'none',
  504. duration: 3000
  505. })
  506. },
  507. handlePositionScanCompletion() { //根据仓位扫描的完成情况来处理不同的逻辑
  508. if (this.indexList.filter(item =>
  509. item["FStockLocId.FF102029.fname"] == this.Location && item[
  510. 'smzt'] != 1
  511. ).length == 0) { //该仓位扫描完
  512. playVoice(audioUrls.allSuccessVoiceUrl)
  513. uni.showToast({
  514. title: '该仓位扫描完成',
  515. icon: 'none',
  516. duration: 3000
  517. })
  518. } else { //如果改仓位未扫描完,提示音
  519. playVoice(audioUrls.successVoiceUrl)
  520. uni.showToast({
  521. title: '扫描成功',
  522. icon: 'none',
  523. duration: 3000
  524. })
  525. }
  526. },
  527. handleError(error) {
  528. playVoice(audioUrls.failVoiceUrl)
  529. console.error('操作失败:', error);
  530. modal.confirm(error.message || '操作失败').then(res => {
  531. if (res) {
  532. } else {
  533. // 用户点击取消,不执行任何操作
  534. }
  535. })
  536. // uni.showToast({
  537. // title: error.message || '操作失败',
  538. // duration: 3000,
  539. // icon: "none"
  540. // });
  541. },
  542. async handleSubmit(FID) {
  543. try {
  544. await submitHelper.submit(FID, this.indexList);
  545. this.indexList = this.indexList.filter(item => item.FID !== FID);
  546. console.log(this.indexList)
  547. if (this.isStage == true) {
  548. // 处理每个对象
  549. this.stageLists.forEach(item => {
  550. // 过滤掉 FID 匹配的对象
  551. item.data = item.data.filter(obj => obj.FID !== FID);
  552. // 检查 data 数组是否为空
  553. if (item.data.length === 0) {
  554. console.log("data 数组为空"); //删除暂存
  555. this.deleteStages(item.id)
  556. } else {
  557. console.log("data 数组不为空");
  558. }
  559. })
  560. console.log(this.stageLists)
  561. }
  562. } catch (error) {
  563. this.handleError(error)
  564. }
  565. },
  566. async deleteStages(id) {
  567. let condition = `id = (${id})`
  568. let sql = `delete from ${this.tableName} where ${condition}`
  569. executeSql(sql).then(result => {
  570. console.log('结果:', result);
  571. // this.handleDeleteSuccess()
  572. })
  573. .catch(error => {
  574. console.error('捕获错误:', error); // 输出: 捕获错误: 失败的结果
  575. // this.handleDeleteFail(error)
  576. })
  577. },
  578. // submit(FID) {
  579. // const savaParam = getSaveParam(FID, this.indexList)
  580. // console.log(savaParam)
  581. // let vm = this
  582. // modal.loading("提交中,请耐心等待...")
  583. // save(JSON.stringify(savaParam)).then( //保存
  584. // res => {
  585. // console.log(res)
  586. // if (res.Result.ResponseStatus.IsSuccess == true) {
  587. // const FID = res.Result.NeedReturnData[0]["FID"]
  588. // console.log(FID)
  589. // // const submitParam = vm.getSubmitParam(FID)
  590. // const submitParam = getSubmitParam(FID)
  591. // console.log(submitParam)
  592. // submit(JSON.stringify(submitParam)).then( //提交
  593. // res => {
  594. // console.log(res)
  595. // if (res.Result.ResponseStatus.IsSuccess == true) {
  596. // const Id = res.Result.ResponseStatus.SuccessEntitys[0]["Id"]
  597. // console.log(Id)
  598. // // const auditParam = vm.getAuditParam(Id)
  599. // const auditParam = getAuditParam(Id)
  600. // audit(JSON.stringify(auditParam)).then( //审核
  601. // res => {
  602. // console.log(res)
  603. // modal.closeLoading()
  604. // if (res.Result.ResponseStatus.IsSuccess == true) {
  605. // vm.indexList = vm.indexList.filter(item => item.FID !==
  606. // FID)
  607. // vm.Location = ''
  608. // vm.$nextTick(() => {
  609. // vm.searchValue = ''
  610. // vm.isFocus = true
  611. // })
  612. // uni.showModal({
  613. // title: "提示",
  614. // content: "提交成功",
  615. // showCancel: true,
  616. // success: function(res) {
  617. // if (res.confirm) {
  618. // // vm.submit(FID)
  619. // } else {
  620. // // 执行取消后的操作
  621. // }
  622. // }
  623. // })
  624. // playVoice(audioUrls.successVoiceUrl)
  625. // } else {
  626. // uni.showToast({
  627. // title: res.Result.ResponseStatus.Errors[0]
  628. // .Message,
  629. // duration: 2000,
  630. // icon: "error"
  631. // })
  632. // }
  633. // }
  634. // ).catch(error => {
  635. // // 处理失败的情况
  636. // modal.closeLoading()
  637. // console.error('audit failed:', error);
  638. // uni.showToast({
  639. // title: res.Result.ResponseStatus.Errors[0].Message,
  640. // duration: 3000,
  641. // icon: "none"
  642. // })
  643. // })
  644. // } else {
  645. // modal.closeLoading()
  646. // uni.showToast({
  647. // title: res.Result.ResponseStatus.Errors[0].Message,
  648. // duration: 3000,
  649. // icon: "error"
  650. // })
  651. // }
  652. // }
  653. // ).catch(error => {
  654. // modal.closeLoading()
  655. // uni.showModal({
  656. // title: "提示",
  657. // content: error,
  658. // showCancel: true,
  659. // success: function(res) {
  660. // if (res.confirm) {
  661. // // vm.submit(FID)
  662. // } else {
  663. // // 执行取消后的操作
  664. // }
  665. // }
  666. // })
  667. // // 处理失败的情况
  668. // console.error('Submit failed:', error);
  669. // })
  670. // } else {
  671. // modal.closeLoading()
  672. // uni.showToast({
  673. // title: res.Result.ResponseStatus.Errors[0].Message,
  674. // duration: 3000,
  675. // icon: "error"
  676. // })
  677. // }
  678. // }
  679. // ).catch(error => {
  680. // // 处理失败的情况
  681. // console.error('Sava failed:', error);
  682. // modal.closeLoading()
  683. // uni.showModal({
  684. // title: "提示",
  685. // content: error,
  686. // showCancel: true,
  687. // success: function(res) {
  688. // if (res.confirm) {
  689. // // vm.submit(FID)
  690. // } else {
  691. // // 执行取消后的操作
  692. // }
  693. // }
  694. // })
  695. // })
  696. // },
  697. showModalAndHandleSubmit(nowindex) {
  698. let vm = this
  699. console.log(nowindex)
  700. let bBillNo = this.indexList[nowindex]["FBillNo"]
  701. let FID = this.indexList[nowindex]["FID"]
  702. this.$nextTick(() => {
  703. this.searchValue = ''
  704. this.isFocus = true;
  705. })
  706. playVoice(audioUrls.allSuccessVoiceUrl)
  707. uni.showModal({
  708. title: "提示",
  709. content: "单号(" + bBillNo + ")已扫描完毕,是否提交",
  710. showCancel: true,
  711. success: function(res) {
  712. if (res.confirm) {
  713. // this.submit(FID)
  714. this.handleSubmit(FID)
  715. } else {
  716. // 执行取消后的操作
  717. }
  718. }.bind(this)
  719. })
  720. },
  721. handleScanSuccess(nowindex) {
  722. this.Location = this.indexList[nowindex]["FStockLocId.FF102029.fname"] //切换仓位
  723. this.indexList[nowindex].smzt = 1 //修改数据状态
  724. console.log(this.indexList.filter(obj => obj.smzt === 1).length)
  725. //判断仓位是否全部扫完
  726. let UnscannedNumber = this.indexList.filter(item =>
  727. item["FStockLocId.FF102029.fname"] == this.Location && item['smzt'] != 1
  728. ).length //该仓位未扫描数量
  729. if (UnscannedNumber == 0) {
  730. playVoice(audioUrls.success2VoiceUrl)
  731. }
  732. if (this.areAllDetailsScanned(nowindex)) { //校验单号是否全扫完
  733. // playVoice(audioUrls.allSuccessVoiceUrl)
  734. this.showModalAndHandleSubmit(nowindex)
  735. } else { //单号未全扫完
  736. this.handlePositionScanCompletion()
  737. this.$nextTick(() => {
  738. this.searchValue = ''
  739. this.isFocus = true;
  740. this.scrollToItem("scrollItem-" + nowindex)
  741. })
  742. }
  743. },
  744. scan() {
  745. let vm = this
  746. //校验是否输入条码
  747. if (this.searchValueIsEmpty(this.searchValue)) {
  748. playVoice(audioUrls.failVoiceUrl)
  749. this.showToast()
  750. this.focusPoint()
  751. return
  752. }
  753. // 校验条码是否存在
  754. if (this.checkBarcodeInArray(this.searchValue, this.indexList, "FENCHASENUM.LT")) {
  755. uni.showModal({
  756. title: '提示',
  757. content: "条码:" + vm.searchValue + '不存在',
  758. showCancel: false,
  759. success: function(res) {
  760. if (res.confirm) {
  761. this.focusPoint()
  762. vm.searchValue = ''
  763. return
  764. } else {
  765. // 执行取消后的操作
  766. }
  767. }.bind(this)
  768. })
  769. playVoice(audioUrls.failVoiceUrl)
  770. return
  771. }
  772. //校验条码已扫描
  773. if (this.indexList.findIndex(item => item["FENCHASENUM.LT"] === this.searchValue && item.smzt ==
  774. 1) >= 0) {
  775. uni.showModal({
  776. // title: '提示',
  777. content: "条码:" + vm.searchValue + '已扫描',
  778. showCancel: false,
  779. success: function(res) {
  780. if (res.confirm) {
  781. vm.focusPoint()
  782. vm.searchValue = ''
  783. return
  784. } else {
  785. // 执行取消后的操作
  786. }
  787. }
  788. })
  789. playVoice(audioUrls.failVoiceUrl)
  790. return
  791. }
  792. //条码存在未扫描
  793. let nowlocation = null; //该条码的仓位
  794. let nowindex = null; //该条码的索引
  795. for (let i = 0; i < this.indexList.length; i++) { //获取查询装箱单号对应仓位,并切换当前仓位
  796. if (this.indexList[i]["FENCHASENUM.LT"] === this.searchValue) {
  797. nowlocation = this.indexList[i]["FStockLocId.FF102029.fname"] //当前仓位
  798. nowindex = i //当前索引
  799. this.balance = this.indexList[i]["quantity"] - this.indexList[i]["rowCount"]
  800. break;
  801. }
  802. }
  803. //不是首次扫描
  804. if (this.indexListLength != 0) { //已有操作
  805. let UnscannedNumber = this.indexList.filter(item =>
  806. item["FStockLocId.FF102029.fname"] == this.Location && item['smzt'] != 1
  807. ).length //计算上次操作的仓位未扫描数
  808. if (nowlocation != this.Location && UnscannedNumber != 0) { //仓位不一致并且上个仓位未全扫描
  809. playVoice(audioUrls.successVoiceUrl)
  810. uni.showModal({
  811. title: "提示",
  812. content: "是否切换仓位",
  813. showCancel: true,
  814. success: function(res) {
  815. if (res.confirm) {
  816. vm.handleScanSuccess(nowindex)
  817. } else {
  818. // 执行取消后的操作
  819. vm.$nextTick(() => {
  820. vm.searchValue = ''
  821. vm.isFocus = true;
  822. })
  823. }
  824. }
  825. })
  826. return
  827. } else { //仓位一致或原仓位已扫完,正常扫描,无切换
  828. this.handleScanSuccess(nowindex)
  829. }
  830. } else { //首次扫描
  831. this.handleScanSuccess(nowindex)
  832. }
  833. },
  834. getHeightStyle() {
  835. return 'height:' + this.listHeight + 'px';
  836. },
  837. getStyle(smzt) {
  838. return smzt ? 'background-color: Navy;color:white' : '';
  839. // return 'scrollItem-' + index === this.scrollItem ? 'background-color: blue;color:white' : '';
  840. },
  841. }
  842. };
  843. </script>
  844. <style lang="scss">
  845. .button-group {
  846. display: flex;
  847. justify-content: flex-start;
  848. /* 主轴上左对齐 */
  849. align-items: center;
  850. /* 垂直居中对齐 */
  851. }
  852. .button-group button {
  853. white-space: nowrap;
  854. /* 禁止换行 */
  855. // margin-right: 10px;
  856. }
  857. .button-item {
  858. flex: 1;
  859. text-align: center;
  860. padding: 10px;
  861. font-size: 16px;
  862. background-color: #eee;
  863. }
  864. /* 容器样式 */
  865. .table-container {
  866. width: 100%;
  867. // overflow: hidden;
  868. /* 添加滚动条 */
  869. }
  870. /* 表头样式 */
  871. .table-header {
  872. // background-color: #f0f0f0;
  873. font-weight: bold;
  874. display: flex;
  875. }
  876. /* 表行样式 */
  877. .table-row {
  878. display: flex;
  879. flex-direction: row;
  880. /* 水平布局 */
  881. // border-top: 1px solid #ccc;
  882. }
  883. /* 表内容样式 */
  884. .table-content {
  885. width: 100%;
  886. overflow: auto;
  887. }
  888. /* 单元格样式 */
  889. .table-cell1 {
  890. min-width: 85px;
  891. /* 设置最小宽度 */
  892. display: flex;
  893. justify-content: center;
  894. align-items: center;
  895. padding: 5px;
  896. border: 0.5px solid #ccc;
  897. // text-align: center;
  898. }
  899. /* 单元格样式 */
  900. .table-cell2 {
  901. min-width: 90px;
  902. /* 设置最小宽度 */
  903. display: flex;
  904. justify-content: center;
  905. align-items: center;
  906. padding: 5px;
  907. border: 0.5px solid #ccc;
  908. // text-align: center;
  909. }
  910. /* 单元格样式 */
  911. .table-cell3 {
  912. min-width: 100px;
  913. /* 设置最小宽度 */
  914. display: flex;
  915. justify-content: center;
  916. align-items: center;
  917. padding: 5px;
  918. border: 0.5px solid #ccc;
  919. // text-align: center;
  920. }
  921. /* 单元格样式 */
  922. .table-cell4 {
  923. min-width: 85px;
  924. /* 设置最小宽度 */
  925. flex: 1;
  926. padding: 8px;
  927. border: 0.5px solid #ccc;
  928. text-align: center;
  929. }
  930. /* 单元格样式 */
  931. .table-cell {
  932. min-width: 80px;
  933. padding: 5px;
  934. display: flex;
  935. justify-content: center;
  936. align-items: center;
  937. border: 0.5px solid #ccc;
  938. // text-align: center;
  939. }
  940. /* 单元格样式 */
  941. .table-cellph {
  942. min-width: 310px;
  943. display: flex;
  944. justify-content: center;
  945. align-items: center;
  946. border: 0.5px solid #ccc;
  947. }
  948. /* 单元格样式 */
  949. .table-cellwl {
  950. min-width: 150px;
  951. /* 设置最小宽度 */
  952. display: flex;
  953. justify-content: center;
  954. align-items: center;
  955. border: 0.5px solid #ccc;
  956. // text-align: center;
  957. }
  958. /* 最后一个单元格去掉右边框 */
  959. .table-cell:last-child {
  960. // border-right: none;
  961. }
  962. .example {
  963. padding: 15px;
  964. background-color: #fff;
  965. }
  966. .form-item {
  967. display: flex;
  968. align-items: center;
  969. }
  970. .sticky-box {
  971. /* #ifndef APP-PLUS-NVUE */
  972. // display: flex;
  973. position: -webkit-sticky;
  974. /* #endif */
  975. position: sticky;
  976. top: var(--window-top);
  977. z-index: 99;
  978. flex-direction: row;
  979. margin: 0px;
  980. // padding: 15px 0 15px 0;
  981. background-color: #F4F5F6;
  982. // border-bottom-style: solid;
  983. // border-bottom-color: #E2E2E2;
  984. }
  985. .button {
  986. border-color: #e5e5e5;
  987. border-style: solid;
  988. border-width: 1px;
  989. padding: 4px 8px;
  990. border-radius: 4px;
  991. }
  992. .card-bottom {
  993. touch-action: none;
  994. // height: 60px;
  995. position: fixed;
  996. bottom: 0;
  997. width: 100%;
  998. z-index: 999;
  999. background-color: white;
  1000. border-top: 1px;
  1001. display: flex;
  1002. flex-direction: column;
  1003. }
  1004. .text {
  1005. font-size: 12px;
  1006. color: #666;
  1007. margin-top: 5px;
  1008. }
  1009. .button {
  1010. margin-bottom: 10px;
  1011. }
  1012. .segmented-control {
  1013. margin-bottom: 15px;
  1014. }
  1015. // .button-group {
  1016. // margin-top: 15px;
  1017. // display: flex;
  1018. // justify-content: space-around;
  1019. // }
  1020. .form-item {
  1021. display: flex;
  1022. align-items: center;
  1023. }
  1024. .button {
  1025. display: flex;
  1026. align-items: center;
  1027. height: 35px;
  1028. margin-left: 10px;
  1029. }
  1030. </style>
  1031. <style lang="scss">
  1032. .u-page {
  1033. padding: 0;
  1034. }
  1035. .u-demo-block__title {
  1036. padding: 10px 0 2px 15px;
  1037. }
  1038. .swipe-action {
  1039. &__content {
  1040. padding: 25rpx 0;
  1041. display: flex;
  1042. flex-direction: column; //设置布局方向为竖直
  1043. &__text {
  1044. font-size: 15px;
  1045. color: $u-main-color;
  1046. padding-left: 30rpx;
  1047. }
  1048. }
  1049. }
  1050. .u-swipe-action-item {
  1051. touch-action: none;
  1052. }
  1053. .red {
  1054. color: red;
  1055. }
  1056. .label-picker-container {
  1057. display: flex;
  1058. align-items: center;
  1059. /* 垂直居中对齐 */
  1060. font-size: 12px;
  1061. /* 设置标签的字体大小 */
  1062. }
  1063. </style>