index.vue 26 KB

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