index.vue 26 KB

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