index.vue 26 KB

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