index.vue 27 KB

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