index.vue 27 KB

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