index.vue 29 KB

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