index.vue 26 KB

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