index.vue 27 KB

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