index.vue 29 KB

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