index.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991
  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((options) => {
  236. curPlan.value = store.planDetails;
  237. normalStatus.value = true;
  238. console.log(curPlan.value)
  239. if (options != null) {
  240. console.log(options)
  241. console.log("999")
  242. keywords.value = options.param1
  243. if (store.planDetails.isAmend == 1 || store.planDetails.isWasteRecycling == 1) {
  244. normalStatus.value = false;
  245. }
  246. }
  247. //废品回用的领料部门如果是当前工段,也要可以开始新批次
  248. //查找当前计划单下的批次废品回用是当前工段
  249. getAbnormalityLot({
  250. productionPlanDetailId: store.planDetails.id,
  251. requisitionDepartmentId: store.curDeptDetails.deptId
  252. }).then(res => {
  253. wasteRecyclingList.value = res.rows
  254. if (store.planDetails.requisitionDepartmentId == store.curDeptDetails.deptId ||
  255. wasteRecyclingList.value.length > 0) {
  256. bottomStatus.value = true;
  257. store.isPreProcess = true;
  258. } else {
  259. bottomStatus.value = false;
  260. store.isPreProcess = false;
  261. }
  262. })
  263. console.log(wasteRecyclingList.value.length)
  264. })
  265. // 页面下拉刷新操作
  266. onPullDownRefresh(() => {
  267. uni.stopPullDownRefresh();
  268. reflush();
  269. })
  270. onShow(() => {
  271. reflush();
  272. })
  273. ;
  274. function reflush() {
  275. init(store.planDetails.id);
  276. }
  277. function handleShowTurnoverApplication(data) {
  278. console.log(data)
  279. //如果这批废了,则不能周转申请
  280. if (data.isWaste == 1) {
  281. uni.showToast({
  282. icon: 'none',
  283. title: '此批已废,不能申请周转',
  284. duration: 2000
  285. })
  286. } else {
  287. isTakeStock().then(response => {
  288. if (response.data) {
  289. uni.showToast({
  290. icon: 'none',
  291. title: '正在盘点,不能申请周转',
  292. duration: 2000
  293. })
  294. } else {
  295. let _data = data ?? {}
  296. carrierFinishedCheck(data).then(res => {
  297. if (res.code === 200) {
  298. // 调用子组件中的方法
  299. turnoverApplicationDialog.value.open(_data)
  300. } else {
  301. uni.showToast({
  302. icon: 'none',
  303. title: res.msg
  304. })
  305. }
  306. })
  307. }
  308. })
  309. }
  310. }
  311. function handleStartNewBatch() {
  312. store.normalStatus = normalStatus.value;
  313. // console.log(normalStatus.value)
  314. uni.navigateTo({
  315. url: "/pages/addNewBatch/index"
  316. })
  317. }
  318. function init(id) {
  319. uni.showLoading({
  320. title: '加载中'
  321. });
  322. let reqData = {
  323. productionPlanDetailId: id,
  324. deptId: store.curDeptDetails.deptId,
  325. keywords: keywords.value
  326. };
  327. // console.log(normalStatus.value)
  328. getDayWorkList(reqData).then(res => {
  329. console.log(res.data)
  330. if (res.code == 200) {
  331. res.data.forEach(item => {
  332. let quantitySum = 0;
  333. item.dayworkItemList.forEach(info => {
  334. if (info.status < 4 && item.currentProcess.processStepNumber == info
  335. .processStepNumber) {
  336. quantitySum += info.qualifiedNum;
  337. }
  338. });
  339. item.totalQuantity = quantitySum;
  340. });
  341. tempList.value = res.data
  342. // console.log(res)
  343. if (normalStatus.value) {
  344. listData.value = res.data.filter(item => {
  345. return item.isWasteRecycling == 0 && item.isAmend == 0;
  346. });
  347. } else {
  348. listData.value = res.data.filter(item => {
  349. return item.isWasteRecycling == 1 || item.isAmend == 1;
  350. })
  351. }
  352. // 20240614 分批投产数量不按照上到序的完成数量来。
  353. // for (let i = 0; i < listData.value.length; i++) {
  354. // if (listData.value[i].prevProcess) {
  355. // let sum = 0;
  356. // for (let j = 0; j < listData.value[i].dayworkItemList.length; j++) {
  357. // if (listData.value[i].dayworkItemList[j].processId == listData.value[i]
  358. // .prevProcess
  359. // .id && (listData.value[i].dayworkItemList[j].status == 2 || listData
  360. // .value[i]
  361. // .dayworkItemList[j].status == 3)) {
  362. // sum += listData.value[i].dayworkItemList[j].qualifiedNum;
  363. // }
  364. // }
  365. // listData.value[i].processQualifiedNum = sum;
  366. // }
  367. // }
  368. }
  369. uni.hideLoading();
  370. })
  371. }
  372. function handleSearch() {
  373. init(store.planDetails.id);
  374. }
  375. function handleToreportingForWork(item) {
  376. store.dayworkInfo = item
  377. uni.navigateTo({
  378. url: "/pages/reportingForWork/index"
  379. })
  380. }
  381. function handleClickProcessList(item) {
  382. let curProcessAfterList = [];
  383. console.log("工序列表", item)
  384. currentDaywork.value = item
  385. editStatus.value = false
  386. // if (item.isWasteRecycling == 1 || item.isAmend == 1) {
  387. // editStatus.value = true
  388. // } else {
  389. // editStatus.value = false
  390. // }
  391. let nextIndex = 0;
  392. for (let i = 0; i < item.processSequence.length; i++) {
  393. if (item.nextProcess) {
  394. if (item.nextProcess.processStepNumber == item.processSequence[i].processStepNumber) {
  395. nextIndex = i;
  396. }
  397. } else {
  398. nextIndex = item.processSequence.length
  399. }
  400. }
  401. for (let i = 0; i < item.processSequence.length; i++) {
  402. if (i >= nextIndex) {
  403. curProcessAfterList.push(item.processSequence[i]);
  404. }
  405. }
  406. if (item.status == 3) {
  407. curProcessAfterList.splice(0, 1)
  408. }
  409. console.log(curProcessAfterList)
  410. curProcessAfte.value = curProcessAfterList;
  411. showRight.value.open();
  412. }
  413. function handleSearchCode() {
  414. // console.log(normalStatus.value)
  415. selectProduction.value.open(normalStatus.value);
  416. }
  417. function switchChange(event) {
  418. console.log(event)
  419. //异常批
  420. if (normalStatus.value) {
  421. listData.value = tempList.value.filter(item => {
  422. return item.isWasteRecycling == 1 || item.isAmend == 1;
  423. });
  424. normalStatus.value = false
  425. } else {
  426. listData.value = tempList.value.filter(item => {
  427. return item.isWasteRecycling == 0 && item.isAmend == 0;
  428. });
  429. normalStatus.value = true
  430. }
  431. }
  432. //H5扫码器回调
  433. function onDecodeHandler(data) {
  434. showQrCodeReader.value = false;
  435. console.log(data);
  436. let vehicleObj = {
  437. carrierCode: data
  438. };
  439. if (!vehicleObj.carrierCode || vehicleObj.carrierCode == "") {
  440. uni.showToast({
  441. icon: "none",
  442. title: "请扫载具码",
  443. duration: 1000
  444. })
  445. return;
  446. }
  447. showDaywork({
  448. carrierId: '0', // 不传递箱子id
  449. carrierCode: vehicleObj.carrierCode,
  450. status: 7
  451. }).then(response => {
  452. if (response.code == 200) {
  453. console.log(response)
  454. console.log(response.data[0].productionPlanDetailId)
  455. console.log(store.planDetails.id)
  456. console.log(response.data[0].deptId !== store.curDeptDetails.deptId)
  457. if (response.data[0].deptId !== store.curDeptDetails.deptId) {
  458. uni.showToast({
  459. icon: 'none',
  460. title: '该批次不在当前工段',
  461. duration: 2000
  462. })
  463. return
  464. }
  465. if (response.data[0].productionPlanDetailId == store.planDetails.id) {
  466. console.log(response.data)
  467. lotDialog.value.open(response.data);
  468. } else {
  469. uni.showToast({
  470. icon: 'none',
  471. title: '该批次不在此计划单内',
  472. duration: 2000
  473. })
  474. }
  475. } else {
  476. uni.showToast({
  477. icon: 'none',
  478. title: response.msg,
  479. duration: 2000
  480. })
  481. }
  482. })
  483. }
  484. //H5扫码器关闭
  485. function qrReaderClose() {
  486. showQrCodeReader.value = false;
  487. }
  488. function handleScanCode() {
  489. showQrCodeReader.value = true;
  490. // // 引入原生插件
  491. // const mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module");
  492. // if (mpaasScanModule) {
  493. // // 调用插件的 mpaasScan 方法
  494. // mpaasScanModule.mpaasScan({
  495. // // 扫码识别类型,参数可多选,qrCode、barCode,
  496. // // 如不设置,默认识别所有扫码类型,可能有些许影响识别效率
  497. // scanType: ["qrCode", "barCode"],
  498. // // 是否隐藏相册,默认false不隐藏
  499. // hideAlbum: false,
  500. // },
  501. // (ret) => {
  502. // console.log(ret);
  503. // /* 原有代码,之前二维码中存的信息比较多,用一个JSON格式存储。
  504. // let vehicleObj = JSON.parse(ret.resp_result);
  505. // if (!vehicleObj.carrierId || vehicleObj.carrierId == "") {
  506. // uni.showToast({
  507. // icon: "none",
  508. // title: "请扫载具码",
  509. // duration: 1000
  510. // })
  511. // return;
  512. // }
  513. // */
  514. // let vehicleObj = {
  515. // carrierCode: ret.resp_result
  516. // };
  517. // if (!vehicleObj.carrierCode || vehicleObj.carrierCode == "") {
  518. // uni.showToast({
  519. // icon: "none",
  520. // title: "请扫载具码",
  521. // duration: 1000
  522. // })
  523. // return;
  524. // }
  525. // showDaywork({
  526. // carrierId: '0', // 不传递箱子id
  527. // carrierCode: vehicleObj.carrierCode,
  528. // status: 7
  529. // }).then(response => {
  530. // if (response.code == 200) {
  531. // console.log(response)
  532. // console.log(response.data[0].productionPlanDetailId)
  533. // console.log(store.planDetails.id)
  534. // console.log(response.data[0].deptId !== store.curDeptDetails.deptId)
  535. // if (response.data[0].deptId !== store.curDeptDetails.deptId) {
  536. // uni.showToast({
  537. // icon: 'none',
  538. // title: '该批次不在当前工段',
  539. // duration: 2000
  540. // })
  541. // return
  542. // }
  543. // if (response.data[0].productionPlanDetailId == store.planDetails.id) {
  544. // console.log(response.data)
  545. // lotDialog.value.open(response.data);
  546. // } else {
  547. // uni.showToast({
  548. // icon: 'none',
  549. // title: '该批次不在此计划单内',
  550. // duration: 2000
  551. // })
  552. // }
  553. // } else {
  554. // uni.showToast({
  555. // icon: 'none',
  556. // title: response.msg,
  557. // duration: 2000
  558. // })
  559. // }
  560. // })
  561. // }
  562. // );
  563. // } else {
  564. // // 测试时用
  565. // showDaywork({
  566. // carrierId: '1780467398971187210',
  567. // carrierCode: '',
  568. // status: 7
  569. // }).then(response => {
  570. // if (response.code == 200) {
  571. // console.log(response)
  572. // console.log(response.data[0].productionPlanDetailId)
  573. // console.log(store.planDetails.id)
  574. // console.log(response.data[0].deptId !== store.curDeptDetails.deptId)
  575. // if (response.data[0].deptId !== store.curDeptDetails.deptId) {
  576. // uni.showToast({
  577. // icon: 'none',
  578. // title: '该批次已转至其他工段',
  579. // duration: 2000
  580. // })
  581. // return
  582. // }
  583. // if (response.data[0].productionPlanDetailId == store.planDetails.id) {
  584. // console.log(response.data)
  585. // lotDialog.value.open(response.data);
  586. // } else {
  587. // uni.showToast({
  588. // icon: 'none',
  589. // title: '该批次不在此计划单内',
  590. // duration: 2000
  591. // })
  592. // }
  593. // } else {
  594. // uni.showToast({
  595. // icon: 'none',
  596. // title: response.msg,
  597. // duration: 2000
  598. // })
  599. // }
  600. // })
  601. // }
  602. }
  603. function handleAddDaywork(data) {
  604. isMaskShow.value = true; // 显示遮罩层
  605. uni.showLoading({
  606. title: '加载中'
  607. });
  608. console.log(data)
  609. let reqParam = [];
  610. for (var i = 0; i < data.length; i++) {
  611. reqParam.push(data[i].daywork)
  612. }
  613. console.log(data)
  614. data.forEach(item => {
  615. item.isSort = 0,
  616. item.tenantId = !store.tenantId ? store.userInfo.tenantId : store.tenantId
  617. })
  618. showDayworkSave(data).then(res => {
  619. isMaskShow.value = false;
  620. uni.hideLoading();
  621. console.log(res)
  622. init(store.planDetails.id);
  623. })
  624. }
  625. function handleDoIt(data) {
  626. handleAddDaywork(data);
  627. }
  628. function handleOpenDrawing() {
  629. console.log(currentDaywork.value, "444")
  630. var filteredProcess = currentDaywork.value.processSequence.filter(item => item.processStepNumber == currentDaywork
  631. .value.currentProcess.processStepNumber);
  632. // 检查 filteredProcess 是否有元素,并选择第一个元素
  633. if (filteredProcess.length > 0) {
  634. var firstMatch = filteredProcess[0]; // 获取第一个匹配的对象
  635. // 对 technologicalProcessDetailId 进行URL编码
  636. var encodedId = encodeURIComponent(currentDaywork.value.productId);
  637. var enTechnologicalProcessId = encodeURIComponent(currentDaywork.value.technologicalProcessId);
  638. var enprocessCode = encodeURIComponent(firstMatch.processCode);
  639. var encodeCode = encodeURIComponent(currentDaywork.value.lotCode);
  640. var enProcessAlias = encodeURIComponent(firstMatch.processAlias);
  641. var enIsWasteRecycling = encodeURIComponent(currentDaywork.value.isWasteRecycling);
  642. var enIsAmend = encodeURIComponent(currentDaywork.value.isAmend);
  643. // 构建查询参数字符串
  644. var queryParam =
  645. `param1=${encodedId}&param2=${encodeCode}&param3=${enprocessCode}&param4=${enTechnologicalProcessId}&param5=${enProcessAlias}&param6=${enIsWasteRecycling}&param7=${enIsAmend}`;
  646. // 使用模板字符串构建完整的URL
  647. var navigateUrl = `/pages/drawingMenu/index?${queryParam}`;
  648. // 导航到指定页面
  649. uni.navigateTo({
  650. url: navigateUrl
  651. });
  652. } else {
  653. console.log('No process matched the current process step number.');
  654. }
  655. }
  656. function handleDoTurnoverAfter() {
  657. reflush();
  658. }
  659. function handleCancelTurnover(data) {
  660. isTakeStock().then(response => {
  661. if (response.data) {
  662. uni.showToast({
  663. icon: 'none',
  664. title: '正在盘点,不能取消周转',
  665. duration: 2000
  666. })
  667. } else {
  668. isMaskShow.value = true; // 显示遮罩层
  669. uni.showLoading({
  670. title: '加载中'
  671. });
  672. turnoverDelete(data).then(res => {
  673. isMaskShow.value = false
  674. if (res.code == 200) {
  675. uni.showToast({
  676. icon: "success",
  677. title: "取消成功",
  678. duration: 2000
  679. })
  680. isLoding.value = false;
  681. setTimeout(() => {
  682. init(store.planDetails.id);
  683. }, 1000);
  684. } else {
  685. uni.showToast({
  686. icon: "none",
  687. title: "取消失败",
  688. duration: 2000
  689. })
  690. isLoding.value = false;
  691. setTimeout(() => {
  692. init(store.planDetails.id);
  693. }, 1000);
  694. }
  695. })
  696. }
  697. })
  698. }
  699. </script>
  700. <style lang="scss">
  701. $nav-height: 60rpx;
  702. .mask {
  703. position: fixed;
  704. top: 0;
  705. left: 0;
  706. right: 0;
  707. bottom: 0;
  708. background-color: rgba(0, 0, 0, 0.5);
  709. z-index: 5;
  710. display: flex;
  711. justify-content: center;
  712. align-items: center;
  713. }
  714. .mask .loading-text {
  715. color: #fff;
  716. font-size: 36rpx;
  717. }
  718. .box-bg {
  719. width: 94%;
  720. background-color: #F5F5F5;
  721. padding: 5rpx 16rpx;
  722. justify-content: space-around;
  723. align-items: center;
  724. margin: 24rpx auto 0;
  725. .input-view {
  726. width: 100%;
  727. flex: 4;
  728. background-color: #f8f8f8;
  729. height: $nav-height;
  730. border: 1rpx solid #999;
  731. border-radius: 15rpx;
  732. padding: 0 15rpx;
  733. flex-wrap: nowrap;
  734. margin: 0 10rpx 0;
  735. line-height: $nav-height;
  736. .input-uni-icon {
  737. line-height: $nav-height;
  738. }
  739. .nav-bar-input {
  740. width: 80%;
  741. height: $nav-height;
  742. line-height: $nav-height;
  743. padding: 0 5rpx;
  744. background-color: #f8f8f8;
  745. }
  746. }
  747. .search {
  748. width: 20%;
  749. text-align: center;
  750. color: #808080;
  751. }
  752. }
  753. .list-title {
  754. width: 100%;
  755. margin-top: 16rpx;
  756. height: 64rpx;
  757. line-height: 64rpx;
  758. align-items: center;
  759. margin-left: 32rpx;
  760. .label {
  761. font-size: 32rpx;
  762. margin-right: 24rpx;
  763. }
  764. .icon-gear {
  765. font-size: 56rpx;
  766. }
  767. }
  768. .switch {
  769. margin-top: -8rpx;
  770. transform: scale(0.7);
  771. }
  772. .scroll-container {
  773. width: 92%;
  774. margin: 24rpx auto 0 auto;
  775. height: calc(90% - 100rpx);
  776. overflow: auto;
  777. }
  778. .list-item {
  779. background-color: #fff;
  780. position: relative;
  781. padding: 16rpx;
  782. padding-bottom: 24rpx;
  783. margin-bottom: 24rpx;
  784. border-radius: 24rpx;
  785. .title-container {
  786. margin-top: 8rpx;
  787. margin-bottom: 16rpx;
  788. .title {
  789. height: 48rpx;
  790. align-items: center;
  791. .label {
  792. font-size: 32rpx;
  793. font-weight: bold;
  794. &.code {
  795. margin-left: 8rpx;
  796. }
  797. }
  798. }
  799. .tag {
  800. border: 1px solid #1CE5B0;
  801. background-color: #F6FFFD;
  802. padding: 8rpx;
  803. border-radius: 8rpx;
  804. .label {
  805. color: #1CE5B0;
  806. font-size: 24rpx;
  807. }
  808. &.finished {
  809. border: 1px solid #BBBBBB;
  810. background-color: #F5F5F5;
  811. .label {
  812. color: #BBBBBB;
  813. }
  814. }
  815. &.turnover {
  816. border: 1px solid #FF7901;
  817. background-color: #F6FFFD;
  818. .label {
  819. color: #FF7901;
  820. }
  821. }
  822. }
  823. }
  824. .item-info {
  825. margin-bottom: 8rpx;
  826. .label {
  827. font-size: 28rpx;
  828. width: 220rpx;
  829. color: #808080;
  830. &.right {
  831. flex: 1;
  832. color: #000000;
  833. }
  834. }
  835. }
  836. .status-btn {
  837. justify-content: flex-end;
  838. align-items: center;
  839. .turnover-tag {
  840. padding-right: 12rpx;
  841. padding-left: 12rpx;
  842. border-radius: 8rpx;
  843. border: 1rpx solid #FF7901;
  844. background-color: #FF7901;
  845. font-size: 28rpx;
  846. color: #FFFFFF;
  847. }
  848. .reporting-tag {
  849. padding-right: 12rpx;
  850. padding-left: 12rpx;
  851. border-radius: 8rpx;
  852. margin-left: 16rpx;
  853. border: 1rpx solid #1684fc;
  854. background-color: #1684fc;
  855. font-size: 28rpx;
  856. color: #FFFFFF;
  857. }
  858. }
  859. }
  860. .bottom {
  861. height: 10%;
  862. position: fixed;
  863. right: 0;
  864. bottom: 0;
  865. left: 0;
  866. height: 100rpx;
  867. border-top: 1px solid #999999;
  868. padding: 16rpx 32rpx;
  869. align-items: center;
  870. background-color: #fff;
  871. justify-content: space-evenly;
  872. .start-batch-btn {
  873. flex: 1;
  874. height: 80rpx;
  875. line-height: 80rpx;
  876. border-radius: 8rpx;
  877. color: #FFFFFF;
  878. font-size: 28rpx;
  879. }
  880. .view-end-btn {
  881. flex: 1;
  882. height: 80rpx;
  883. line-height: 80rpx;
  884. border-radius: 8rpx;
  885. color: #FFFFFF;
  886. font-size: 28rpx;
  887. }
  888. }
  889. .mask {
  890. position: fixed;
  891. top: 0;
  892. left: 0;
  893. right: 0;
  894. bottom: 0;
  895. background-color: rgba(0, 0, 0, 0.5);
  896. z-index: 2000;
  897. display: flex;
  898. justify-content: center;
  899. align-items: center;
  900. }
  901. .mask .loading-text {
  902. color: #fff;
  903. font-size: 36rpx;
  904. }
  905. </style>