index.vue 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107
  1. <template>
  2. <view class="uni-column" style="height: 100%; background-color: #f5f5f5;position: fixed;left: 0;right: 0;">
  3. <view class="box-bg uni-row">
  4. <view class="input-view uni-row">
  5. <uni-icons class="input-uni-icon" type="search" size="18" color="#999" />
  6. <input class="nav-bar-input" type="text" v-model="keywords" placeholder="请输入批次号/箱号" />
  7. </view>
  8. <view class="search" @click="handleSearch">
  9. 搜索
  10. </view>
  11. </view>
  12. <view class="list-title uni-row">
  13. <text class="label">是否正常批次</text>
  14. <text>{{ normalStatus ? '是' : '否' }}</text>
  15. <switch class="switch" :checked="normalStatus" @change="switchChange" color="rgba(103, 195, 55, 1.0)" />
  16. </view>
  17. <view v-if="listData.length == 0" style="color: #999;margin: 50% auto;">
  18. <text>暂无批次</text>
  19. </view>
  20. <view v-else class="scroll-container" style="margin-bottom:130px">
  21. <!-- 批次列表 -->
  22. <view v-for="(item, index) in listData" :key="index" class="list-item" @click="checkStatus(item)">
  23. <!-- @click="handleToreportingForWork(item)" -->
  24. <view class="title-container uni-row" style="justify-content: flex-start;">
  25. <view class="title uni-row">
  26. <text class="label">批次号:</text>
  27. <text class="label code">{{ item['lotCode'] }}</text>
  28. </view>
  29. <view class=" uni-row" style="margin-left: 16rpx;">
  30. <view v-if="item['status'] == 1" class="tag"><text class="label">进行中</text></view>
  31. <view v-else-if="item['status'] == 3" class="tag turnover "><text class="label">待领取</text>
  32. </view>
  33. <view v-else-if="item['status'] == 2" class="tag turnover "><text class="label">待周转</text>
  34. </view>
  35. <view v-else-if="item['status'] == 0" class="tag finished "><text class="label">未开始</text>
  36. </view>
  37. <view v-else-if="item['status'] == 4" type="default finished" class="tag finished"><text
  38. class="label">已完成</text></view>
  39. </view>
  40. </view>
  41. <view class="item-info uni-row">
  42. <text class="label">产品描述</text>
  43. <text class="label right">{{ curPlan['productDescription'] }}</text>
  44. </view>
  45. <view class="item-info uni-row">
  46. <text class="label">材质</text>
  47. <text
  48. class="label right">{{ item['furnaceNoInfo'] ? item['furnaceNoInfo'].firstTechnicalRequirement + ";" + item['furnaceNoInfo'].secondTechnicalRequirement : '-' }}</text>
  49. </view>
  50. <view class="item-info uni-row">
  51. <text class="label">原材料厂家</text>
  52. <text class="label right">{{ item['furnaceNoInfo'] ? item['furnaceNoInfo'].factory : '-' }}</text>
  53. </view>
  54. <view class="item-info uni-row">
  55. <text class="label">箱号</text>
  56. <text class="label right">{{ item['carrierName'] ? item['carrierName'] : '-' }}</text>
  57. </view>
  58. <!-- <view class="item-info uni-row">
  59. <text class="label">总工时</text>
  60. <text class="label right">{{ item['totalWorkingHours']}}</text>
  61. </view> -->
  62. <view class="item-info uni-row">
  63. <text class="label">投入数</text>
  64. <text
  65. class="label right">{{item.prevProcess == null ? item['productionQuantity'] : item['processQualifiedNum']}}</text>
  66. </view>
  67. <view class="item-info uni-row">
  68. <text class="label">上道工序</text>
  69. <text class="label right">{{ item.prevProcess ? item['prevProcess'].processAlias : '-'}}</text>
  70. </view>
  71. <view class="item-info uni-row">
  72. <text class="label">当前工序</text>
  73. <!-- <text
  74. class="label right">{{ item.currentProcess ? item.prevProcess && item['currentProcess'].processAlias == item['prevProcess'].processAlias ? '-' : item['currentProcess'].processAlias : '-'}}</text> -->
  75. <text class="label right">{{ item.currentProcess ?item['currentProcess'].processAlias : '-'}}</text>
  76. </view>
  77. <view class="item-info uni-row">
  78. <text class="label">下道工序</text>
  79. <view class="label right uni-row">{{ item.nextProcess ? item['nextProcess'].processAlias : '-' }}
  80. (<view style="color: #1684fc;" @click.stop="handleClickProcessList(item)">&nbsp;工艺列表&nbsp;
  81. </view>)
  82. </view>
  83. </view>
  84. <!-- <view class="item-info uni-row">
  85. <text class="label">设备</text>
  86. <text class="label right">{{ curPlan['equipmentName'] }}</text>
  87. </view> -->
  88. <view v-if="notPreProcess" class="item-info uni-row">
  89. <text class="label">所在区域</text>
  90. <text class="label right">{{ item['place'] ? item['place'] : '-' }}</text>
  91. </view>
  92. <view class="status-btn uni-row">
  93. <view v-if="item.dayworkItemList[0].status < 3" class=" uni-row">
  94. <button class="reporting-tag" size="mini"
  95. @click.stop="handleToreportingForWork(item)">开始报工</button>
  96. <!-- <button class="reporting-tag" size="mini" @click="handleToreportingForWork">去报工</button> -->
  97. </view>
  98. <view v-if="item['status'] == 2" class=" uni-row">
  99. <button class="turnover-tag" size="mini"
  100. @click.stop="handleShowTurnoverApplication(item)">周转申请</button>
  101. <!-- <button class="reporting-tag" size="mini" @click="handleToreportingForWork">去报工</button> -->
  102. </view>
  103. <view v-else-if="item['status'] == 3" class=" uni-row">
  104. <button class="turnover-tag" size="mini" @click.stop="handleCancelTurnover(item)"
  105. style="background-color: rgba(255, 85, 85, 1);">取消周转</button>
  106. </view>
  107. </view>
  108. </view>
  109. </view>
  110. <!-- 抽屉 -->
  111. <uni-drawer ref="showRight" mode="right" :mask-click="true" style="height: 100%;">
  112. <view style="text-align: center; font-size: 48rpx; padding: 48rpx 0 24rpx 0;margin-top: 20px;">工艺列表</view>
  113. <view style="font-size: 24rpx;text-align: center;color: red; margin-bottom: 16rpx;">
  114. 仅显示当前工序后面工艺
  115. </view>
  116. <view><button v-if="!editStatus" class="start-batch-btn" style="margin-bottom: 16rpx;" type="primary"
  117. @click="handleOpenDrawing">查看本工序图纸</button></view>
  118. <scroll-view scroll-y="true" style="height: 70%;" @touchmove.stop>
  119. <view v-for="(item,index) in curProcessAfte" :key="index"
  120. style="padding: 8rpx 5% 8rpx 14%; border-top: 1px solid #cccccc">
  121. <text>{{ index + 1 }}.{{item.processAlias}}</text>
  122. </view>
  123. </scroll-view>
  124. <!-- <view><button v-if="!editStatus" class="view-end-btn" style="margin-top: 20rpx;" type="primary"
  125. @click="handleOpenDrawing">查看本工序图纸</button></view> -->
  126. </uni-drawer>
  127. <!-- <view v-if="bottomStatus" class="bottom uni-row">
  128. <button class="start-batch-btn" type="primary" @click="handleStartNewBatch">开始新批次</button>
  129. </view>
  130. <view v-if="!bottomStatus" class="bottom uni-row">
  131. <button class="start-batch-btn" type="primary" @click="handleScanCode">扫一扫开始新批次</button>
  132. </view> -->
  133. <view class="bottom uni-row">
  134. <button class="start-batch-btn" style="margin-right: 10rpx;" type="primary"
  135. @click="handleScanCode">扫码开始批次</button>
  136. <button class="start-batch-btn" type="primary" @click="handleSearchCode">查箱号</button>
  137. </view>
  138. <dialog-lot ref="lotDialog" @submit="handleDoIt" />
  139. <dialog-turnoverApplication ref="turnoverApplicationDialog" @reflushDaywork="handleDoTurnoverAfter" />
  140. <dialog-selectProduction ref="selectProduction"></dialog-selectProduction>
  141. <dialog-selectEquipment ref='selectEquipment'
  142. @handleAddDayWorkItem='handleAddEquipment'></dialog-selectEquipment>
  143. <QrScanner v-if="showQrCodeReader" @decode="onDecodeHandler" @close="qrReaderClose" />
  144. </view>
  145. </template>
  146. <script setup>
  147. import {
  148. normalizeProps,
  149. reactive,
  150. onMounted,
  151. getCurrentInstance,
  152. ref
  153. } from 'vue'
  154. import {
  155. onLoad,
  156. onReady,
  157. onUnload,
  158. onShow,
  159. onPullDownRefresh
  160. } from '@dcloudio/uni-app'
  161. import QrScanner from '../vueQrCode/index.vue'
  162. import {
  163. getDayWorkList,
  164. showDaywork,
  165. // showDayworkSave,
  166. turnoverDelete
  167. } from '@/api/business/dayWork.js'
  168. import {
  169. getAbnormalityLot
  170. } from '@/api/business/lot.js'
  171. import {
  172. carrierFinishedCheck
  173. } from '@/api/business/carrier.js'
  174. import {
  175. addEquipmentInfo
  176. } from '@/api/business/dayWorkItem.js'
  177. import {
  178. isTakeStock
  179. } from '@/api/business/taksStackLot.js'
  180. import {
  181. store
  182. } from '@/store/index.js'
  183. import {
  184. toHHmmss
  185. } from '@/utils/common.js'
  186. import {
  187. getSortingDayworkItem,
  188. showDayworkSave
  189. } from '@/api/business/sortDaywork.js'
  190. const turnoverApplicationDialog = ref(null)
  191. const selectProduction = ref(null)
  192. const lotDialog = ref(null)
  193. const listData = ref([])
  194. const curPlan = ref(null)
  195. const bizDayworkObj = ref({})
  196. const bottomStatus = ref(false) // 底部按钮显示
  197. const paging = ref();
  198. const reqParam = ref(null);
  199. const normalStatus = ref(true)
  200. const isLoading = ref(false);
  201. const curDayworkItem = ref({}) // 当前报工记录,回显是否显示取消周转的状态
  202. const keywords = ref(null)
  203. const selectEquipment = ref(null) // 组件
  204. const tempList = ref([])
  205. const wasteRecyclingList = ref([]) //废品回用批次
  206. // 在数据中定义一个变量来控制遮罩层的显示
  207. const isMaskShow = ref(false);
  208. const currentDaywork = ref({})
  209. const notPreProcess = ref(true)
  210. const curProcessAfte = ref([])
  211. const showRight = ref(null) // 抽屉
  212. const editStatus = ref(false)
  213. const showQrCodeReader = ref(false);
  214. onLoad((options) => {
  215. curPlan.value = store.planDetails;
  216. normalStatus.value = true;
  217. console.log(store.planDetails)
  218. if (options != null) {
  219. console.log(options)
  220. console.log("999")
  221. keywords.value = options.param1
  222. if (store.planDetails.isAmend == 1 || store.planDetails.isWasteRecycling == 1) {
  223. normalStatus.value = false;
  224. }
  225. }
  226. console.log(curPlan.value)
  227. //废品回用的领料部门如果是当前工段,也要可以开始新批次
  228. //查找当前计划单下的批次废品回用是当前工段
  229. getAbnormalityLot({
  230. productionPlanDetailId: store.planDetails.id,
  231. requisitionDepartmentId: store.curDeptDetails.deptId
  232. }).then(res => {
  233. wasteRecyclingList.value = res.rows
  234. console.log(wasteRecyclingList.value.length)
  235. if (store.planDetails.requisitionDepartmentId == store.curDeptDetails.deptId ||
  236. wasteRecyclingList.value.length > 0) {
  237. bottomStatus.value = true;
  238. store.isPreProcess = true;
  239. } else {
  240. bottomStatus.value = false;
  241. store.isPreProcess = false;
  242. }
  243. })
  244. console.log(wasteRecyclingList.value.length)
  245. })
  246. /**
  247. * 监听下拉刷新
  248. */
  249. onPullDownRefresh(() => {
  250. uni.stopPullDownRefresh();
  251. reflush();
  252. // normalStatus.value = true;
  253. // let reqData = {
  254. // productionPlanDetailId: store.planDetails.id,
  255. // deptId: store.curDeptDetails.deptId,
  256. // keywords: keywords.value
  257. // };
  258. // getDayWorkList(reqData).then(res => {
  259. // if (res.code == 200) {
  260. // tempList.value = res.data
  261. // if (normalStatus.value) {
  262. // listData.value = res.data.filter(item => {
  263. // return item.isWasteRecycling == 0 && item.isAmend == 0;
  264. // });
  265. // } else {
  266. // listData.value = res.data.filter(item => {
  267. // return item.isWasteRecycling == 1 || item.isAmend == 1;
  268. // })
  269. // }
  270. // for (let i = 0; i < listData.value.length; i++) {
  271. // if (listData.value[i].prevProcess) {
  272. // let sum = 0;
  273. // for (let j = 0; j < listData.value[i].dayworkItemList.length; j++) {
  274. // if (listData.value[i].dayworkItemList[j].processId == listData.value[i]
  275. // .prevProcess
  276. // .id && (listData.value[i].dayworkItemList[j].status == 2 || listData.value[
  277. // i]
  278. // .dayworkItemList[j].status == 3)) {
  279. // sum += listData.value[i].dayworkItemList[j].qualifiedNum;
  280. // }
  281. // }
  282. // listData.value[i].processQualifiedNum = sum;
  283. // }
  284. // }
  285. // }
  286. // uni.stopPullDownRefresh();
  287. // })
  288. })
  289. onShow(() => {
  290. reflush();
  291. })
  292. function handleOpenDrawing() {
  293. console.log(currentDaywork.value, "444")
  294. var filteredProcess = currentDaywork.value.processSequence.filter(item => item.processStepNumber == currentDaywork
  295. .value.currentProcess.processStepNumber);
  296. // 检查 filteredProcess 是否有元素,并选择第一个元素
  297. if (filteredProcess.length > 0) {
  298. var firstMatch = filteredProcess[0]; // 获取第一个匹配的对象
  299. // 对 technologicalProcessDetailId 进行URL编码
  300. var encodedId = encodeURIComponent(currentDaywork.value.productId);
  301. var enTechnologicalProcessId = encodeURIComponent(currentDaywork.value.technologicalProcessId);
  302. var enprocessCode = encodeURIComponent(firstMatch.processCode);
  303. var encodeCode = encodeURIComponent(currentDaywork.value.lotCode);
  304. var enProcessAlias = encodeURIComponent(firstMatch.processAlias);
  305. var enIsWasteRecycling = encodeURIComponent(currentDaywork.value.isWasteRecycling);
  306. var enIsAmend = encodeURIComponent(currentDaywork.value.isAmend);
  307. // 构建查询参数字符串
  308. var queryParam =
  309. `param1=${encodedId}&param2=${encodeCode}&param3=${enprocessCode}&param4=${enTechnologicalProcessId}&param5=${enProcessAlias}&param6=${enIsWasteRecycling}&param7=${enIsAmend}`;
  310. // 使用模板字符串构建完整的URL
  311. var navigateUrl = `/pages/drawingMenu/index?${queryParam}`;
  312. // 导航到指定页面
  313. uni.navigateTo({
  314. url: navigateUrl
  315. });
  316. } else {
  317. console.log('No process matched the current process step number.');
  318. }
  319. }
  320. function reflush() {
  321. // normalStatus.value = true;
  322. init(store.planDetails.id);
  323. }
  324. function handleShowTurnoverApplication(data) {
  325. isTakeStock().then(response => {
  326. if (response.data) {
  327. uni.showToast({
  328. icon: 'none',
  329. title: '正在盘点,不能申请周转',
  330. duration: 2000
  331. })
  332. } else {
  333. let _data = data ?? {}
  334. carrierFinishedCheck(data).then(res => {
  335. if (res.code === 200) {
  336. // 调用子组件中的方法
  337. turnoverApplicationDialog.value.open(_data)
  338. } else {
  339. uni.showToast({
  340. icon: 'none',
  341. title: res.msg
  342. })
  343. }
  344. })
  345. }
  346. })
  347. // .catch(err => {
  348. // uri.showToast({
  349. // icon: "fail",
  350. // title: "网络请求失败。"
  351. // })
  352. // })
  353. }
  354. function handleStartNewBatch() {
  355. store.normalStatus = normalStatus.value;
  356. // console.log(normalStatus.value)
  357. uni.navigateTo({
  358. url: "/pages/addNewBatch/index"
  359. })
  360. }
  361. function init(id) {
  362. uni.showLoading({
  363. title: '加载中'
  364. });
  365. let reqData = {
  366. productionPlanDetailId: id,
  367. deptId: store.curDeptDetails.deptId,
  368. keywords: keywords.value
  369. };
  370. // normalStatus.value = true;
  371. getDayWorkList(reqData).then(res => {
  372. if (res.code == 200) {
  373. console.log(res)
  374. tempList.value = res.data
  375. if (normalStatus.value) {
  376. listData.value = res.data.filter(item => {
  377. return item.isWasteRecycling == 0 && item.isAmend == 0;
  378. });
  379. } else {
  380. listData.value = res.data.filter(item => {
  381. return item.isWasteRecycling == 1 || item.isAmend == 1;
  382. })
  383. }
  384. // listData.value = res.data.filter(item => {
  385. // return item.isWasteRecycling == 0 && item.isAmend == 0;
  386. // });
  387. /* 0531 */
  388. // for (let i = 0; i < listData.value.length; i++) {
  389. // if (listData.value[i].prevProcess) {
  390. // let sum = 0;
  391. // for (let j = 0; j < listData.value[i].dayworkItemList.length; j++) {
  392. // if (listData.value[i].dayworkItemList[j].processId == listData.value[i].prevProcess
  393. // .id && (listData.value[i].dayworkItemList[j].status == 2 || listData.value[i]
  394. // .dayworkItemList[j].status == 3)) {
  395. // sum += listData.value[i].dayworkItemList[j].qualifiedNum;
  396. // }
  397. // }
  398. // listData.value[i].processQualifiedNum = sum;
  399. // }
  400. // }
  401. }
  402. uni.hideLoading();
  403. })
  404. }
  405. function handleSearch() {
  406. init(store.planDetails.id);
  407. }
  408. function checkStatus(item) {
  409. if (item.dayworkItemList[0].status < 3) {
  410. return
  411. } else {
  412. handleToreportingForWork(item)
  413. }
  414. }
  415. function handleToreportingForWork(item) {
  416. store.dayworkInfo = item
  417. console.log(store.dayworkInfo)
  418. // if (item.dayworkItemList[0].status == 0) {
  419. // return
  420. // }
  421. uni.$once("formBack", () => handleSearch())
  422. if (item.dayworkItemList[0].equipmentDetailId == 0) {
  423. selectEquipment.value.open(null);
  424. } else {
  425. uni.navigateTo({
  426. url: "/pages/sorting/form",
  427. success: function(res) {
  428. // 通过eventChannel向被打开页面传送数据
  429. res.eventChannel.emit('acceptDataFromOpenerPage', {
  430. data: item
  431. })
  432. }
  433. })
  434. }
  435. }
  436. //选择设备
  437. function handleAddEquipment(data) {
  438. let dayworkItem = store.dayworkInfo.dayworkItemList[0]
  439. store.dayworkInfo.dayworkItemList[0].equipmentDetailId = data.equipmentDetailId
  440. store.dayworkInfo.dayworkItemList[0].equipmentDetailCode = data.equipmentDetailCode
  441. dayworkItem.equipmentDetailId = data.equipmentDetailId
  442. dayworkItem.equipmentDetailCode = data.equipmentDetailCode
  443. //保存
  444. addEquipmentInfo(dayworkItem).then(res => {
  445. if (res.code == 200) {
  446. uni.navigateTo({
  447. url: "/pages/sorting/form",
  448. success: function(res) {
  449. // 通过eventChannel向被打开页面传送数据
  450. res.eventChannel.emit('acceptDataFromOpenerPage', {
  451. data: store.dayworkInfo
  452. })
  453. }
  454. })
  455. }
  456. })
  457. }
  458. function handleClickProcessList(item) {
  459. let curProcessAfterList = [];
  460. console.log(item)
  461. currentDaywork.value = item
  462. editStatus.value = false
  463. // if (item.isWasteRecycling == 1 || item.isAmend == 1) {
  464. // editStatus.value = true
  465. // } else {
  466. // editStatus.value = false
  467. // }
  468. let nextIndex = 0;
  469. for (let i = 0; i < item.processSequence.length; i++) {
  470. console.log(item.nextProcess, "next")
  471. if (item.nextProcess) {
  472. if (item.nextProcess.processStepNumber == item.processSequence[i].processStepNumber) {
  473. nextIndex = i;
  474. }
  475. } else {
  476. nextIndex = item.processSequence.length
  477. }
  478. }
  479. for (let i = 0; i < item.processSequence.length; i++) {
  480. if (i >= nextIndex) {
  481. curProcessAfterList.push(item.processSequence[i]);
  482. }
  483. }
  484. if (item.status == 3) {
  485. curProcessAfterList.splice(0, 1)
  486. }
  487. console.log(curProcessAfterList)
  488. curProcessAfte.value = curProcessAfterList;
  489. showRight.value.open();
  490. }
  491. function handleSearchCode() {
  492. selectProduction.value.open(normalStatus.value);
  493. }
  494. // function switchChange(event) {
  495. // //异常批
  496. // if (event.detail.value) {
  497. // listData.value = tempList.value.filter(item => {
  498. // return item.isWasteRecycling == 1 || item.isAmend == 1;
  499. // });
  500. // normalStatus.value = 1
  501. // } else {
  502. // listData.value = tempList.value.filter(item => {
  503. // return item.isWasteRecycling == 0 && item.isAmend == 0;
  504. // });
  505. // normalStatus.value = 0
  506. // }
  507. // }
  508. /*
  509. function handleScanCode() {
  510. // 引入原生插件
  511. const mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module");
  512. // const mpaasScanModule = null
  513. if (mpaasScanModule) {
  514. // 调用插件的 mpaasScan 方法
  515. mpaasScanModule.mpaasScan({
  516. // 扫码识别类型,参数可多选,qrCode、barCode,
  517. // 如不设置,默认识别所有扫码类型,可能有些许影响识别效率
  518. scanType: ["qrCode", "barCode"],
  519. // 是否隐藏相册,默认false不隐藏
  520. hideAlbum: false,
  521. },
  522. (ret) => {
  523. console.log(ret);
  524. let vehicleObj = JSON.parse(ret.resp_result);
  525. if (!vehicleObj.carrierId || vehicleObj.carrierId == "") {
  526. uni.showToast({
  527. icon: "none",
  528. title: "请扫载具码",
  529. duration: 1000
  530. })
  531. return;
  532. }
  533. showDaywork({
  534. carrierId: vehicleObj.carrierId,
  535. status: 7
  536. }).then(response => {
  537. if (response.code == 200) {
  538. // console.log(response)
  539. // console.log(response.data[0].productionPlanDetailId)
  540. // console.log(store.planDetails.id)
  541. if (response.data[0].deptId !== store.curDeptDetails.deptId) {
  542. uni.showToast({
  543. icon: 'none',
  544. title: '该批次不在当前工段',
  545. duration: 2000
  546. })
  547. return
  548. }
  549. if (response.data[0].productionPlanDetailId == store.planDetails.id) {
  550. // console.log(response.data)
  551. lotDialog.value.open(response.data);
  552. } else {
  553. uni.showToast({
  554. icon: 'none',
  555. title: '该批次不在此计划单内',
  556. duration: 2000
  557. })
  558. }
  559. } else {
  560. uni.showToast({
  561. icon: 'none',
  562. title: response.msg,
  563. duration: 2000
  564. })
  565. }
  566. })
  567. }
  568. );
  569. } else {
  570. // 测试时用
  571. showDaywork({
  572. carrierId: '1770342949090017283',
  573. status: 7
  574. }).then(response => {
  575. if (response.code == 200) {
  576. if (response.data[0].deptId !== store.curDeptDetails.deptId) {
  577. uni.showToast({
  578. icon: 'none',
  579. title: '该批次不在当前工段',
  580. duration: 2000
  581. })
  582. return
  583. }
  584. if (response.data[0].productionPlanDetailId == store.planDetails.id) {
  585. console.log(response.data)
  586. lotDialog.value.open(response.data);
  587. } else {
  588. uni.showToast({
  589. icon: 'none',
  590. title: '该批次不在此计划单内',
  591. duration: 2000
  592. })
  593. }
  594. } else {
  595. console.log(response)
  596. uni.showToast({
  597. icon: 'none',
  598. title: response.msg,
  599. duration: 2000
  600. })
  601. }
  602. })
  603. }
  604. }
  605. */
  606. //H5扫码器回调
  607. function onDecodeHandler(data) {
  608. showQrCodeReader.value = false;
  609. let vehicleObj = {
  610. carrierCode: data
  611. };
  612. if (!vehicleObj.carrierCode || vehicleObj.carrierCode == "") {
  613. uni.showToast({
  614. icon: "none",
  615. title: "请扫载具码",
  616. duration: 1000
  617. })
  618. return;
  619. }
  620. showDaywork({
  621. carrierCode: vehicleObj.carrierCode,
  622. status: 7
  623. }).then(response => {
  624. if (response.code == 200) {
  625. // console.log(response)
  626. // console.log(response.data[0].productionPlanDetailId)
  627. // console.log(store.planDetails.id)
  628. if (response.data[0].deptId !== store.curDeptDetails.deptId) {
  629. uni.showToast({
  630. icon: 'none',
  631. title: '该批次不在当前工段',
  632. duration: 2000
  633. })
  634. return
  635. }
  636. if (response.data[0].productionPlanDetailId == store.planDetails.id) {
  637. // console.log(response.data)
  638. lotDialog.value.open(response.data);
  639. } else {
  640. uni.showToast({
  641. icon: 'none',
  642. title: '该批次不在此计划单内',
  643. duration: 2000
  644. })
  645. }
  646. } else {
  647. uni.showToast({
  648. icon: 'none',
  649. title: response.msg,
  650. duration: 2000
  651. })
  652. }
  653. })
  654. }
  655. //H5扫码器关闭
  656. function qrReaderClose() {
  657. showQrCodeReader.value = false;
  658. }
  659. function handleScanCode() {
  660. showQrCodeReader.value = true;
  661. // 引入原生插件
  662. // const mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module");
  663. // // const mpaasScanModule = null
  664. // if (mpaasScanModule) {
  665. // // 调用插件的 mpaasScan 方法
  666. // mpaasScanModule.mpaasScan({
  667. // // 扫码识别类型,参数可多选,qrCode、barCode,
  668. // // 如不设置,默认识别所有扫码类型,可能有些许影响识别效率
  669. // scanType: ["qrCode", "barCode"],
  670. // // 是否隐藏相册,默认false不隐藏
  671. // hideAlbum: false,
  672. // },
  673. // (ret) => {
  674. // console.log(ret);
  675. // let vehicleObj = {
  676. // carrierCode: ret.resp_result
  677. // };
  678. // if (!vehicleObj.carrierCode || vehicleObj.carrierCode == "") {
  679. // uni.showToast({
  680. // icon: "none",
  681. // title: "请扫载具码",
  682. // duration: 1000
  683. // })
  684. // return;
  685. // }
  686. // showDaywork({
  687. // carrierCode: vehicleObj.carrierCode,
  688. // status: 7
  689. // }).then(response => {
  690. // if (response.code == 200) {
  691. // // console.log(response)
  692. // // console.log(response.data[0].productionPlanDetailId)
  693. // // console.log(store.planDetails.id)
  694. // if (response.data[0].deptId !== store.curDeptDetails.deptId) {
  695. // uni.showToast({
  696. // icon: 'none',
  697. // title: '该批次不在当前工段',
  698. // duration: 2000
  699. // })
  700. // return
  701. // }
  702. // if (response.data[0].productionPlanDetailId == store.planDetails.id) {
  703. // // console.log(response.data)
  704. // lotDialog.value.open(response.data);
  705. // } else {
  706. // uni.showToast({
  707. // icon: 'none',
  708. // title: '该批次不在此计划单内',
  709. // duration: 2000
  710. // })
  711. // }
  712. // } else {
  713. // uni.showToast({
  714. // icon: 'none',
  715. // title: response.msg,
  716. // duration: 2000
  717. // })
  718. // }
  719. // })
  720. // }
  721. // );
  722. // } else {
  723. // // 测试时用
  724. // showDaywork({
  725. // carrierCode: '000075',
  726. // status: 7
  727. // }).then(response => {
  728. // if (response.code == 200) {
  729. // if (response.data[0].deptId !== store.curDeptDetails.deptId) {
  730. // uni.showToast({
  731. // icon: 'none',
  732. // title: '该批次不在当前工段',
  733. // duration: 2000
  734. // })
  735. // return
  736. // }
  737. // if (response.data[0].productionPlanDetailId == store.planDetails.id) {
  738. // console.log(response.data)
  739. // lotDialog.value.open(response.data);
  740. // } else {
  741. // uni.showToast({
  742. // icon: 'none',
  743. // title: '该批次不在此计划单内',
  744. // duration: 2000
  745. // })
  746. // }
  747. // } else {
  748. // console.log(response)
  749. // uni.showToast({
  750. // icon: 'none',
  751. // title: response.msg,
  752. // duration: 2000
  753. // })
  754. // }
  755. // })
  756. // }
  757. }
  758. // function handleScanCode() {
  759. // uni.scanCode({
  760. // onlyFromCamera: true,
  761. // success: function (res) {
  762. // if (res.scanType !== 'QR_CODE') {
  763. // uni.showToast({
  764. // icon: 'none',
  765. // title: '二维码未识别成功',
  766. // duration: 2000
  767. // })
  768. // }
  769. // console.log('条码类型:' + res.scanType);
  770. // console.log('条码内容:' + res.result);
  771. // }
  772. // });
  773. // }
  774. function handleAddDaywork(data) {
  775. console.log(data)
  776. let reqParam = [];
  777. for (var i = 0; i < data.length; i++) {
  778. reqParam.push(data[i].daywork)
  779. }
  780. console.log(data)
  781. data.forEach(item => {
  782. item.isSort = 1,
  783. item.tenantId = !store.tenantId ? store.userInfo.tenantId : store.tenantId
  784. })
  785. showDayworkSave(data).then(res => {
  786. if (res.code == 200) {
  787. console.log(res)
  788. init(store.planDetails.id);
  789. } else {
  790. uni.showToast({
  791. icon: "none",
  792. title: res.msg,
  793. duration: 2000
  794. })
  795. }
  796. })
  797. }
  798. function handleDoIt(data) {
  799. handleAddDaywork(data);
  800. }
  801. function handleDoTurnoverAfter() {
  802. reflush();
  803. }
  804. function switchChange(event) {
  805. console.log(event)
  806. //异常批
  807. if (normalStatus.value) {
  808. listData.value = tempList.value.filter(item => {
  809. return item.isWasteRecycling == 1 || item.isAmend == 1;
  810. });
  811. normalStatus.value = false
  812. } else {
  813. listData.value = tempList.value.filter(item => {
  814. return item.isWasteRecycling == 0 && item.isAmend == 0;
  815. });
  816. normalStatus.value = true
  817. }
  818. console.log(listData.value)
  819. }
  820. function startReport(data) {
  821. getSortingDayworkItem(data).then(res => {
  822. uni.showToast({
  823. icon: "success",
  824. title: "开始成功",
  825. duration: 2000
  826. })
  827. init(store.planDetails.id)
  828. })
  829. }
  830. function handleCancelTurnover(data) {
  831. isTakeStock().then(response => {
  832. if (response.data) {
  833. uni.showToast({
  834. icon: 'none',
  835. title: '正在盘点,不能取消周转',
  836. duration: 2000
  837. })
  838. } else {
  839. turnoverDelete(data).then(res => {
  840. if (res.code == 200) {
  841. uni.showToast({
  842. icon: "success",
  843. title: "取消成功",
  844. duration: 2000
  845. })
  846. setTimeout(() => {
  847. init(store.planDetails.id);
  848. }, 1500);
  849. } else {
  850. uni.showToast({
  851. icon: "none",
  852. title: "取消失败",
  853. duration: 2000
  854. })
  855. setTimeout(() => {
  856. init(store.planDetails.id);
  857. }, 1000);
  858. }
  859. })
  860. }
  861. })
  862. }
  863. </script>
  864. <style lang="scss">
  865. $nav-height: 60rpx;
  866. .box-bg {
  867. width: 94%;
  868. background-color: #F5F5F5;
  869. padding: 5rpx 16rpx;
  870. justify-content: space-around;
  871. align-items: center;
  872. margin: 24rpx auto 0;
  873. .input-view {
  874. width: 100%;
  875. flex: 4;
  876. background-color: #f8f8f8;
  877. height: $nav-height;
  878. border: 1rpx solid #999;
  879. border-radius: 15rpx;
  880. padding: 0 15rpx;
  881. flex-wrap: nowrap;
  882. margin: 0 10rpx 0;
  883. line-height: $nav-height;
  884. .input-uni-icon {
  885. line-height: $nav-height;
  886. }
  887. .nav-bar-input {
  888. width: 80%;
  889. height: $nav-height;
  890. line-height: $nav-height;
  891. padding: 0 5rpx;
  892. background-color: #f8f8f8;
  893. }
  894. }
  895. .search {
  896. width: 20%;
  897. text-align: center;
  898. color: #808080;
  899. }
  900. }
  901. .list-title {
  902. width: 100%;
  903. margin-top: 16rpx;
  904. height: 64rpx;
  905. line-height: 64rpx;
  906. align-items: center;
  907. margin-left: 32rpx;
  908. .label {
  909. font-size: 32rpx;
  910. margin-right: 24rpx;
  911. }
  912. .icon-gear {
  913. font-size: 56rpx;
  914. }
  915. }
  916. .switch {
  917. margin-top: -8rpx;
  918. transform: scale(0.7);
  919. }
  920. .scroll-container {
  921. width: 92%;
  922. margin: 24rpx auto 0 auto;
  923. height: calc(90% - 100rpx);
  924. overflow: auto;
  925. }
  926. .list-item {
  927. background-color: #fff;
  928. position: relative;
  929. padding: 16rpx;
  930. padding-bottom: 24rpx;
  931. margin-bottom: 24rpx;
  932. border-radius: 24rpx;
  933. .title-container {
  934. margin-top: 8rpx;
  935. margin-bottom: 16rpx;
  936. .title {
  937. height: 48rpx;
  938. align-items: center;
  939. .label {
  940. font-size: 32rpx;
  941. font-weight: bold;
  942. &.code {
  943. margin-left: 8rpx;
  944. }
  945. }
  946. }
  947. .tag {
  948. border: 1px solid #1CE5B0;
  949. background-color: #F6FFFD;
  950. padding: 8rpx;
  951. border-radius: 8rpx;
  952. .label {
  953. color: #1CE5B0;
  954. font-size: 24rpx;
  955. }
  956. &.finished {
  957. border: 1px solid #BBBBBB;
  958. background-color: #F5F5F5;
  959. .label {
  960. color: #BBBBBB;
  961. }
  962. }
  963. &.turnover {
  964. border: 1px solid #FF7901;
  965. background-color: #F6FFFD;
  966. .label {
  967. color: #FF7901;
  968. }
  969. }
  970. }
  971. }
  972. .item-info {
  973. margin-bottom: 8rpx;
  974. .label {
  975. font-size: 28rpx;
  976. width: 220rpx;
  977. color: #808080;
  978. &.right {
  979. flex: 1;
  980. color: #000000;
  981. }
  982. }
  983. }
  984. .status-btn {
  985. justify-content: flex-end;
  986. align-items: center;
  987. .turnover-tag {
  988. padding-right: 12rpx;
  989. padding-left: 12rpx;
  990. border-radius: 8rpx;
  991. border: 1rpx solid #FF7901;
  992. background-color: #FF7901;
  993. font-size: 28rpx;
  994. color: #FFFFFF;
  995. }
  996. .reporting-tag {
  997. padding-right: 12rpx;
  998. padding-left: 12rpx;
  999. border-radius: 8rpx;
  1000. margin-left: 16rpx;
  1001. border: 1rpx solid #1684fc;
  1002. background-color: #1684fc;
  1003. font-size: 28rpx;
  1004. color: #FFFFFF;
  1005. }
  1006. }
  1007. }
  1008. .bottom {
  1009. height: 10%;
  1010. position: fixed;
  1011. right: 0;
  1012. bottom: 0;
  1013. left: 0;
  1014. height: 100rpx;
  1015. border-top: 1px solid #999999;
  1016. padding: 16rpx 32rpx;
  1017. align-items: center;
  1018. background-color: #fff;
  1019. justify-content: space-evenly;
  1020. .start-batch-btn {
  1021. flex: 1;
  1022. height: 80rpx;
  1023. line-height: 80rpx;
  1024. border-radius: 8rpx;
  1025. color: #FFFFFF;
  1026. font-size: 28rpx;
  1027. }
  1028. }
  1029. </style>