index.vue 26 KB

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