index.vue 29 KB

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