index.vue 27 KB

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