index.vue 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071
  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 v-if="listData.length == 0" style="color: #999;margin: 50% auto;">
  18. <text>暂无批次</text>
  19. </view>
  20. <view v-else class="scroll-container" style="margin-bottom:130px">
  21. <!-- 批次列表 -->
  22. <view 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. var enIsWasteRecycling = encodeURIComponent(currentDaywork.value.isWasteRecycling);
  300. var enIsAmend = encodeURIComponent(currentDaywork.value.isAmend);
  301. // 构建查询参数字符串
  302. var queryParam =
  303. `param1=${encodedId}&param2=${encodeCode}&param3=${enprocessCode}&param4=${enTechnologicalProcessId}&param5=${enProcessAlias}&param6=${enIsWasteRecycling}&param7=${enIsAmend}`;
  304. // 使用模板字符串构建完整的URL
  305. var navigateUrl = `/pages/drawingMenu/index?${queryParam}`;
  306. // 导航到指定页面
  307. uni.navigateTo({
  308. url: navigateUrl
  309. });
  310. } else {
  311. console.log('No process matched the current process step number.');
  312. }
  313. }
  314. function reflush() {
  315. // normalStatus.value = true;
  316. init(store.planDetails.id);
  317. }
  318. function handleShowTurnoverApplication(data) {
  319. isTakeStock().then(response => {
  320. if (response.data) {
  321. uni.showToast({
  322. icon: 'none',
  323. title: '正在盘点,不能申请周转',
  324. duration: 2000
  325. })
  326. } else {
  327. let _data = data ?? {}
  328. carrierFinishedCheck(data).then(res => {
  329. if (res.code === 200) {
  330. // 调用子组件中的方法
  331. turnoverApplicationDialog.value.open(_data)
  332. } else {
  333. uni.showToast({
  334. icon: 'none',
  335. title: res.msg
  336. })
  337. }
  338. })
  339. }
  340. })
  341. // .catch(err => {
  342. // uri.showToast({
  343. // icon: "fail",
  344. // title: "网络请求失败。"
  345. // })
  346. // })
  347. }
  348. function handleStartNewBatch() {
  349. store.normalStatus = normalStatus.value;
  350. // console.log(normalStatus.value)
  351. uni.navigateTo({
  352. url: "/pages/addNewBatch/index"
  353. })
  354. }
  355. function init(id) {
  356. uni.showLoading({
  357. title: '加载中'
  358. });
  359. let reqData = {
  360. productionPlanDetailId: id,
  361. deptId: store.curDeptDetails.deptId,
  362. keywords: keywords.value
  363. };
  364. // normalStatus.value = true;
  365. getDayWorkList(reqData).then(res => {
  366. if (res.code == 200) {
  367. console.log(res)
  368. tempList.value = res.data
  369. if (normalStatus.value) {
  370. listData.value = res.data.filter(item => {
  371. return item.isWasteRecycling == 0 && item.isAmend == 0;
  372. });
  373. } else {
  374. listData.value = res.data.filter(item => {
  375. return item.isWasteRecycling == 1 || item.isAmend == 1;
  376. })
  377. }
  378. // listData.value = res.data.filter(item => {
  379. // return item.isWasteRecycling == 0 && item.isAmend == 0;
  380. // });
  381. /* 0531 */
  382. // for (let i = 0; i < listData.value.length; i++) {
  383. // if (listData.value[i].prevProcess) {
  384. // let sum = 0;
  385. // for (let j = 0; j < listData.value[i].dayworkItemList.length; j++) {
  386. // if (listData.value[i].dayworkItemList[j].processId == listData.value[i].prevProcess
  387. // .id && (listData.value[i].dayworkItemList[j].status == 2 || listData.value[i]
  388. // .dayworkItemList[j].status == 3)) {
  389. // sum += listData.value[i].dayworkItemList[j].qualifiedNum;
  390. // }
  391. // }
  392. // listData.value[i].processQualifiedNum = sum;
  393. // }
  394. // }
  395. }
  396. uni.hideLoading();
  397. })
  398. }
  399. function handleSearch() {
  400. init(store.planDetails.id);
  401. }
  402. function checkStatus(item) {
  403. if (item.dayworkItemList[0].status < 3) {
  404. return
  405. } else {
  406. handleToreportingForWork(item)
  407. }
  408. }
  409. function handleToreportingForWork(item) {
  410. // if (item.dayworkItemList[0].status == 0) {
  411. // return
  412. // }
  413. uni.$once("formBack", () => handleSearch())
  414. uni.navigateTo({
  415. url: "/pages/sorting/form",
  416. success: function(res) {
  417. // 通过eventChannel向被打开页面传送数据
  418. res.eventChannel.emit('acceptDataFromOpenerPage', {
  419. data: item
  420. })
  421. }
  422. })
  423. }
  424. function handleClickProcessList(item) {
  425. let curProcessAfterList = [];
  426. console.log(item)
  427. currentDaywork.value = item
  428. editStatus.value = false
  429. // if (item.isWasteRecycling == 1 || item.isAmend == 1) {
  430. // editStatus.value = true
  431. // } else {
  432. // editStatus.value = false
  433. // }
  434. let nextIndex = 0;
  435. for (let i = 0; i < item.processSequence.length; i++) {
  436. console.log(item.nextProcess, "next")
  437. if (item.nextProcess) {
  438. if (item.nextProcess.processStepNumber == item.processSequence[i].processStepNumber) {
  439. nextIndex = i;
  440. }
  441. } else {
  442. nextIndex = item.processSequence.length
  443. }
  444. }
  445. for (let i = 0; i < item.processSequence.length; i++) {
  446. if (i >= nextIndex) {
  447. curProcessAfterList.push(item.processSequence[i]);
  448. }
  449. }
  450. if (item.status == 3) {
  451. curProcessAfterList.splice(0, 1)
  452. }
  453. console.log(curProcessAfterList)
  454. curProcessAfte.value = curProcessAfterList;
  455. showRight.value.open();
  456. }
  457. function handleSearchCode() {
  458. selectProduction.value.open(normalStatus.value);
  459. }
  460. // function switchChange(event) {
  461. // //异常批
  462. // if (event.detail.value) {
  463. // listData.value = tempList.value.filter(item => {
  464. // return item.isWasteRecycling == 1 || item.isAmend == 1;
  465. // });
  466. // normalStatus.value = 1
  467. // } else {
  468. // listData.value = tempList.value.filter(item => {
  469. // return item.isWasteRecycling == 0 && item.isAmend == 0;
  470. // });
  471. // normalStatus.value = 0
  472. // }
  473. // }
  474. /*
  475. function handleScanCode() {
  476. // 引入原生插件
  477. const mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module");
  478. // const mpaasScanModule = null
  479. if (mpaasScanModule) {
  480. // 调用插件的 mpaasScan 方法
  481. mpaasScanModule.mpaasScan({
  482. // 扫码识别类型,参数可多选,qrCode、barCode,
  483. // 如不设置,默认识别所有扫码类型,可能有些许影响识别效率
  484. scanType: ["qrCode", "barCode"],
  485. // 是否隐藏相册,默认false不隐藏
  486. hideAlbum: false,
  487. },
  488. (ret) => {
  489. console.log(ret);
  490. let vehicleObj = JSON.parse(ret.resp_result);
  491. if (!vehicleObj.carrierId || vehicleObj.carrierId == "") {
  492. uni.showToast({
  493. icon: "none",
  494. title: "请扫载具码",
  495. duration: 1000
  496. })
  497. return;
  498. }
  499. showDaywork({
  500. carrierId: vehicleObj.carrierId,
  501. status: 7
  502. }).then(response => {
  503. if (response.code == 200) {
  504. // console.log(response)
  505. // console.log(response.data[0].productionPlanDetailId)
  506. // console.log(store.planDetails.id)
  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. uni.showToast({
  527. icon: 'none',
  528. title: response.msg,
  529. duration: 2000
  530. })
  531. }
  532. })
  533. }
  534. );
  535. } else {
  536. // 测试时用
  537. showDaywork({
  538. carrierId: '1770342949090017283',
  539. status: 7
  540. }).then(response => {
  541. if (response.code == 200) {
  542. if (response.data[0].deptId !== store.curDeptDetails.deptId) {
  543. uni.showToast({
  544. icon: 'none',
  545. title: '该批次不在当前工段',
  546. duration: 2000
  547. })
  548. return
  549. }
  550. if (response.data[0].productionPlanDetailId == store.planDetails.id) {
  551. console.log(response.data)
  552. lotDialog.value.open(response.data);
  553. } else {
  554. uni.showToast({
  555. icon: 'none',
  556. title: '该批次不在此计划单内',
  557. duration: 2000
  558. })
  559. }
  560. } else {
  561. console.log(response)
  562. uni.showToast({
  563. icon: 'none',
  564. title: response.msg,
  565. duration: 2000
  566. })
  567. }
  568. })
  569. }
  570. }
  571. */
  572. //H5扫码器回调
  573. function onDecodeHandler(data) {
  574. showQrCodeReader.value = false;
  575. let vehicleObj = {
  576. carrierCode: data
  577. };
  578. if (!vehicleObj.carrierCode || vehicleObj.carrierCode == "") {
  579. uni.showToast({
  580. icon: "none",
  581. title: "请扫载具码",
  582. duration: 1000
  583. })
  584. return;
  585. }
  586. showDaywork({
  587. carrierCode: vehicleObj.carrierCode,
  588. status: 7
  589. }).then(response => {
  590. if (response.code == 200) {
  591. // console.log(response)
  592. // console.log(response.data[0].productionPlanDetailId)
  593. // console.log(store.planDetails.id)
  594. if (response.data[0].deptId !== store.curDeptDetails.deptId) {
  595. uni.showToast({
  596. icon: 'none',
  597. title: '该批次不在当前工段',
  598. duration: 2000
  599. })
  600. return
  601. }
  602. if (response.data[0].productionPlanDetailId == store.planDetails.id) {
  603. // console.log(response.data)
  604. lotDialog.value.open(response.data);
  605. } else {
  606. uni.showToast({
  607. icon: 'none',
  608. title: '该批次不在此计划单内',
  609. duration: 2000
  610. })
  611. }
  612. } else {
  613. uni.showToast({
  614. icon: 'none',
  615. title: response.msg,
  616. duration: 2000
  617. })
  618. }
  619. })
  620. }
  621. //H5扫码器关闭
  622. function qrReaderClose() {
  623. showQrCodeReader.value = false;
  624. }
  625. function handleScanCode() {
  626. showQrCodeReader.value = true;
  627. // 引入原生插件
  628. // const mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module");
  629. // // const mpaasScanModule = null
  630. // if (mpaasScanModule) {
  631. // // 调用插件的 mpaasScan 方法
  632. // mpaasScanModule.mpaasScan({
  633. // // 扫码识别类型,参数可多选,qrCode、barCode,
  634. // // 如不设置,默认识别所有扫码类型,可能有些许影响识别效率
  635. // scanType: ["qrCode", "barCode"],
  636. // // 是否隐藏相册,默认false不隐藏
  637. // hideAlbum: false,
  638. // },
  639. // (ret) => {
  640. // console.log(ret);
  641. // let vehicleObj = {
  642. // carrierCode: ret.resp_result
  643. // };
  644. // if (!vehicleObj.carrierCode || vehicleObj.carrierCode == "") {
  645. // uni.showToast({
  646. // icon: "none",
  647. // title: "请扫载具码",
  648. // duration: 1000
  649. // })
  650. // return;
  651. // }
  652. // showDaywork({
  653. // carrierCode: vehicleObj.carrierCode,
  654. // status: 7
  655. // }).then(response => {
  656. // if (response.code == 200) {
  657. // // console.log(response)
  658. // // console.log(response.data[0].productionPlanDetailId)
  659. // // console.log(store.planDetails.id)
  660. // if (response.data[0].deptId !== store.curDeptDetails.deptId) {
  661. // uni.showToast({
  662. // icon: 'none',
  663. // title: '该批次不在当前工段',
  664. // duration: 2000
  665. // })
  666. // return
  667. // }
  668. // if (response.data[0].productionPlanDetailId == store.planDetails.id) {
  669. // // console.log(response.data)
  670. // lotDialog.value.open(response.data);
  671. // } else {
  672. // uni.showToast({
  673. // icon: 'none',
  674. // title: '该批次不在此计划单内',
  675. // duration: 2000
  676. // })
  677. // }
  678. // } else {
  679. // uni.showToast({
  680. // icon: 'none',
  681. // title: response.msg,
  682. // duration: 2000
  683. // })
  684. // }
  685. // })
  686. // }
  687. // );
  688. // } else {
  689. // // 测试时用
  690. // showDaywork({
  691. // carrierCode: '000075',
  692. // status: 7
  693. // }).then(response => {
  694. // if (response.code == 200) {
  695. // if (response.data[0].deptId !== store.curDeptDetails.deptId) {
  696. // uni.showToast({
  697. // icon: 'none',
  698. // title: '该批次不在当前工段',
  699. // duration: 2000
  700. // })
  701. // return
  702. // }
  703. // if (response.data[0].productionPlanDetailId == store.planDetails.id) {
  704. // console.log(response.data)
  705. // lotDialog.value.open(response.data);
  706. // } else {
  707. // uni.showToast({
  708. // icon: 'none',
  709. // title: '该批次不在此计划单内',
  710. // duration: 2000
  711. // })
  712. // }
  713. // } else {
  714. // console.log(response)
  715. // uni.showToast({
  716. // icon: 'none',
  717. // title: response.msg,
  718. // duration: 2000
  719. // })
  720. // }
  721. // })
  722. // }
  723. }
  724. // function handleScanCode() {
  725. // uni.scanCode({
  726. // onlyFromCamera: true,
  727. // success: function (res) {
  728. // if (res.scanType !== 'QR_CODE') {
  729. // uni.showToast({
  730. // icon: 'none',
  731. // title: '二维码未识别成功',
  732. // duration: 2000
  733. // })
  734. // }
  735. // console.log('条码类型:' + res.scanType);
  736. // console.log('条码内容:' + res.result);
  737. // }
  738. // });
  739. // }
  740. function handleAddDaywork(data) {
  741. console.log(data)
  742. let reqParam = [];
  743. for (var i = 0; i < data.length; i++) {
  744. reqParam.push(data[i].daywork)
  745. }
  746. console.log(data)
  747. data.forEach(item => {
  748. item.isSort = 1
  749. })
  750. showDayworkSave(data).then(res => {
  751. if (res.code == 200) {
  752. console.log(res)
  753. init(store.planDetails.id);
  754. } else {
  755. uni.showToast({
  756. icon: "none",
  757. title: res.msg,
  758. duration: 2000
  759. })
  760. }
  761. })
  762. }
  763. function handleDoIt(data) {
  764. handleAddDaywork(data);
  765. }
  766. function handleDoTurnoverAfter() {
  767. reflush();
  768. }
  769. function switchChange(event) {
  770. console.log(event)
  771. //异常批
  772. if (normalStatus.value) {
  773. listData.value = tempList.value.filter(item => {
  774. return item.isWasteRecycling == 1 || item.isAmend == 1;
  775. });
  776. normalStatus.value = false
  777. } else {
  778. listData.value = tempList.value.filter(item => {
  779. return item.isWasteRecycling == 0 && item.isAmend == 0;
  780. });
  781. normalStatus.value = true
  782. }
  783. console.log(listData.value)
  784. }
  785. function startReport(data) {
  786. getSortingDayworkItem(data).then(res => {
  787. uni.showToast({
  788. icon: "success",
  789. title: "开始成功",
  790. duration: 2000
  791. })
  792. init(store.planDetails.id)
  793. })
  794. }
  795. function handleCancelTurnover(data) {
  796. isTakeStock().then(response => {
  797. if (response.data) {
  798. uni.showToast({
  799. icon: 'none',
  800. title: '正在盘点,不能取消周转',
  801. duration: 2000
  802. })
  803. } else {
  804. turnoverDelete(data).then(res => {
  805. if (res.code == 200) {
  806. uni.showToast({
  807. icon: "success",
  808. title: "取消成功",
  809. duration: 2000
  810. })
  811. setTimeout(() => {
  812. init(store.planDetails.id);
  813. }, 1500);
  814. } else {
  815. uni.showToast({
  816. icon: "none",
  817. title: "取消失败",
  818. duration: 2000
  819. })
  820. setTimeout(() => {
  821. init(store.planDetails.id);
  822. }, 1000);
  823. }
  824. })
  825. }
  826. })
  827. }
  828. </script>
  829. <style lang="scss">
  830. $nav-height: 60rpx;
  831. .box-bg {
  832. width: 94%;
  833. background-color: #F5F5F5;
  834. padding: 5rpx 16rpx;
  835. justify-content: space-around;
  836. align-items: center;
  837. margin: 24rpx auto 0;
  838. .input-view {
  839. width: 100%;
  840. flex: 4;
  841. background-color: #f8f8f8;
  842. height: $nav-height;
  843. border: 1rpx solid #999;
  844. border-radius: 15rpx;
  845. padding: 0 15rpx;
  846. flex-wrap: nowrap;
  847. margin: 0 10rpx 0;
  848. line-height: $nav-height;
  849. .input-uni-icon {
  850. line-height: $nav-height;
  851. }
  852. .nav-bar-input {
  853. width: 80%;
  854. height: $nav-height;
  855. line-height: $nav-height;
  856. padding: 0 5rpx;
  857. background-color: #f8f8f8;
  858. }
  859. }
  860. .search {
  861. width: 20%;
  862. text-align: center;
  863. color: #808080;
  864. }
  865. }
  866. .list-title {
  867. width: 100%;
  868. margin-top: 16rpx;
  869. height: 64rpx;
  870. line-height: 64rpx;
  871. align-items: center;
  872. margin-left: 32rpx;
  873. .label {
  874. font-size: 32rpx;
  875. margin-right: 24rpx;
  876. }
  877. .icon-gear {
  878. font-size: 56rpx;
  879. }
  880. }
  881. .switch {
  882. margin-top: -8rpx;
  883. transform: scale(0.7);
  884. }
  885. .scroll-container {
  886. width: 92%;
  887. margin: 24rpx auto 0 auto;
  888. height: calc(90% - 100rpx);
  889. overflow: auto;
  890. }
  891. .list-item {
  892. background-color: #fff;
  893. position: relative;
  894. padding: 16rpx;
  895. padding-bottom: 24rpx;
  896. margin-bottom: 24rpx;
  897. border-radius: 24rpx;
  898. .title-container {
  899. margin-top: 8rpx;
  900. margin-bottom: 16rpx;
  901. .title {
  902. height: 48rpx;
  903. align-items: center;
  904. .label {
  905. font-size: 32rpx;
  906. font-weight: bold;
  907. &.code {
  908. margin-left: 8rpx;
  909. }
  910. }
  911. }
  912. .tag {
  913. border: 1px solid #1CE5B0;
  914. background-color: #F6FFFD;
  915. padding: 8rpx;
  916. border-radius: 8rpx;
  917. .label {
  918. color: #1CE5B0;
  919. font-size: 24rpx;
  920. }
  921. &.finished {
  922. border: 1px solid #BBBBBB;
  923. background-color: #F5F5F5;
  924. .label {
  925. color: #BBBBBB;
  926. }
  927. }
  928. &.turnover {
  929. border: 1px solid #FF7901;
  930. background-color: #F6FFFD;
  931. .label {
  932. color: #FF7901;
  933. }
  934. }
  935. }
  936. }
  937. .item-info {
  938. margin-bottom: 8rpx;
  939. .label {
  940. font-size: 28rpx;
  941. width: 220rpx;
  942. color: #808080;
  943. &.right {
  944. flex: 1;
  945. color: #000000;
  946. }
  947. }
  948. }
  949. .status-btn {
  950. justify-content: flex-end;
  951. align-items: center;
  952. .turnover-tag {
  953. padding-right: 12rpx;
  954. padding-left: 12rpx;
  955. border-radius: 8rpx;
  956. border: 1rpx solid #FF7901;
  957. background-color: #FF7901;
  958. font-size: 28rpx;
  959. color: #FFFFFF;
  960. }
  961. .reporting-tag {
  962. padding-right: 12rpx;
  963. padding-left: 12rpx;
  964. border-radius: 8rpx;
  965. margin-left: 16rpx;
  966. border: 1rpx solid #1684fc;
  967. background-color: #1684fc;
  968. font-size: 28rpx;
  969. color: #FFFFFF;
  970. }
  971. }
  972. }
  973. .bottom {
  974. height: 10%;
  975. position: fixed;
  976. right: 0;
  977. bottom: 0;
  978. left: 0;
  979. height: 100rpx;
  980. border-top: 1px solid #999999;
  981. padding: 16rpx 32rpx;
  982. align-items: center;
  983. background-color: #fff;
  984. justify-content: space-evenly;
  985. .start-batch-btn {
  986. flex: 1;
  987. height: 80rpx;
  988. line-height: 80rpx;
  989. border-radius: 8rpx;
  990. color: #FFFFFF;
  991. font-size: 28rpx;
  992. }
  993. }
  994. </style>