index.vue 28 KB

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