index.vue 32 KB

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