index.vue 31 KB

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