index.vue 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098
  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
  54. class="label right">{{ item['furnaceNoInfo'] ? (item['furnaceNoInfo'].factory === "" ? "-" : item['furnaceNoInfo'].factory) : "-" }}</text>
  55. </view>
  56. <view class="item-info uni-row">
  57. <text class="label">箱号</text>
  58. <text class="label right">{{ item['carrierName'] ? item['carrierName'] : '-' }}</text>
  59. </view>
  60. <!-- <view class="item-info uni-row">
  61. <text class="label">总工时</text>
  62. <text class="label right">{{ item['totalWorkingHours']}}</text>
  63. </view> -->
  64. <view class="item-info uni-row">
  65. <text class="label">投入数</text>
  66. <text
  67. class="label right">{{item.prevProcess == null ? item['productionQuantity'] : item['processQualifiedNum']}}</text>
  68. </view>
  69. <view class="item-info uni-row">
  70. <text class="label">已完成工序</text>
  71. <text class="label right">{{ item.prevProcess ? item['prevProcess'].processAlias : '-'}}</text>
  72. </view>
  73. <view class="item-info uni-row">
  74. <text class="label">待加工工序</text>
  75. <!-- <text
  76. class="label right">{{ item.currentProcess ? item.prevProcess && item['currentProcess'].processAlias == item['prevProcess'].processAlias ? '-' : item['currentProcess'].processAlias : '-'}}</text> -->
  77. <text class="label right">{{ item.currentProcess ?item['currentProcess'].processAlias : '-'}}</text>
  78. </view>
  79. <view class="item-info uni-row">
  80. <text class="label">下道工序</text>
  81. <view class="label right uni-row">{{ item.nextProcess ? item['nextProcess'].processAlias : '-' }}
  82. (<view style="color: #1684fc;" @click.stop="handleClickProcessList(item)">&nbsp;工艺列表&nbsp;
  83. </view>)
  84. </view>
  85. </view>
  86. <!-- <view class="item-info uni-row">
  87. <text class="label">设备</text>
  88. <text class="label right">{{ curPlan['equipmentName'] }}</text>
  89. </view> -->
  90. <view v-if="notPreProcess" class="item-info uni-row">
  91. <text class="label">所在区域</text>
  92. <text class="label right">{{ getPlaceText(item) }}</text>
  93. </view>
  94. <view class="status-btn uni-row">
  95. <view v-if="item.dayworkItemList[0].status < 3" class=" uni-row">
  96. <button class="reporting-tag" size="mini"
  97. @click.stop="handleToreportingForWork(item)">开始报工</button>
  98. <!-- <button class="reporting-tag" size="mini" @click="handleToreportingForWork">去报工</button> -->
  99. </view>
  100. <view v-if="item['status'] == 2" class=" uni-row">
  101. <button class="turnover-tag" size="mini"
  102. @click.stop="handleShowTurnoverApplication(item)">周转申请</button>
  103. <!-- <button class="reporting-tag" size="mini" @click="handleToreportingForWork">去报工</button> -->
  104. </view>
  105. <view v-else-if="item['status'] == 3" class=" uni-row">
  106. <button class="turnover-tag" size="mini" @click.stop="handleCancelTurnover(item)"
  107. style="background-color: rgba(255, 85, 85, 1);">取消周转</button>
  108. </view>
  109. </view>
  110. </view>
  111. </view>
  112. <!-- 抽屉 -->
  113. <uni-drawer ref="showRight" mode="right" :mask-click="true">
  114. <view style="text-align: center; font-size: 48rpx; padding: 48rpx 0 24rpx 0;">工艺列表</view>
  115. <view style="font-size: 24rpx;text-align: center;color: red; margin-bottom: 16rpx;">
  116. 仅显示当前工序后面工艺
  117. </view>
  118. <scroll-view scroll-y="true" style="height: 80%;" @touchmove.stop>
  119. <view v-for="(item,index) in curProcessAfte" :key="index"
  120. style="padding: 8rpx 5% 8rpx 14%; border-top: 1px solid #cccccc">
  121. <text>{{ index + 1 }}.{{item.processAlias}}</text>
  122. </view>
  123. </scroll-view>
  124. <view><button v-if="!editStatus" class="start-batch-btn" style="margin-bottom: 10rpx;" type="primary"
  125. @click="handleOpenDrawing">查看本工序图纸</button></view>
  126. </uni-drawer>
  127. <!--<view v-if="!bottomStatus" class="bottom uni-row">
  128. <button class="start-batch-btn" type="primary" @click="handleScanCode">扫一扫开始新批次</button>
  129. </view> -->
  130. <view class="bottom uni-row">
  131. <button v-if="bottomStatus" class="start-batch-btn" style="margin-right: 10rpx;" type="primary"
  132. @click="handleStartNewBatch">开始新批次</button>
  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. console.log("888")
  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. isLoading.value = true
  423. uni.showLoading({
  424. title: '加载中'
  425. });
  426. store.dayworkInfo = item
  427. console.log(store.dayworkInfo)
  428. console.log(isLoading.value)
  429. // if (item.dayworkItemList[0].status == 0) {
  430. // return
  431. // }
  432. uni.$once("formBack", () => handleSearch())
  433. if (item.dayworkItemList[0].equipmentDetailId == 0) {
  434. isLoading.value = false;
  435. uni.hideLoading();
  436. console.log(isLoading.value)
  437. selectEquipment.value.open(null);
  438. } else {
  439. isLoading.value = false;
  440. uni.hideLoading();
  441. uni.navigateTo({
  442. url: "/pages/sorting/form",
  443. success: function(res) {
  444. // 通过eventChannel向被打开页面传送数据
  445. res.eventChannel.emit('acceptDataFromOpenerPage', {
  446. data: item
  447. })
  448. }
  449. })
  450. }
  451. }
  452. //选择设备
  453. function handleAddEquipment(data) {
  454. isLoading.value = true
  455. uni.showLoading({
  456. title: '加载中'
  457. });
  458. let dayworkItem = store.dayworkInfo.dayworkItemList[0]
  459. store.dayworkInfo.dayworkItemList[0].equipmentDetailId = data.equipmentDetailId
  460. store.dayworkInfo.dayworkItemList[0].equipmentDetailCode = data.equipmentDetailCode
  461. dayworkItem.equipmentDetailId = data.equipmentDetailId
  462. dayworkItem.equipmentDetailCode = data.equipmentDetailCode
  463. //保存
  464. addEquipmentInfo(dayworkItem).then(res => {
  465. isLoading.value = false;
  466. uni.hideLoading();
  467. if (res.code == 200) {
  468. uni.navigateTo({
  469. url: "/pages/sorting/form",
  470. success: function(res) {
  471. // 通过eventChannel向被打开页面传送数据
  472. res.eventChannel.emit('acceptDataFromOpenerPage', {
  473. data: store.dayworkInfo
  474. })
  475. }
  476. })
  477. }
  478. })
  479. }
  480. function handleClickProcessList(item) {
  481. let curProcessAfterList = [];
  482. console.log(item)
  483. currentDaywork.value = item
  484. editStatus.value = false
  485. //20241220单批单改也要查看图纸
  486. // if (item.isWasteRecycling == 1 || item.isAmend == 1) {
  487. // editStatus.value = true
  488. // } else {
  489. // editStatus.value = false
  490. // }
  491. let nextIndex = 0;
  492. for (let i = 0; i < item.processSequence.length; i++) {
  493. console.log(item.nextProcess, "next")
  494. if (item.nextProcess) {
  495. if (item.nextProcess.processStepNumber == item.processSequence[i].processStepNumber) {
  496. nextIndex = i;
  497. }
  498. } else {
  499. nextIndex = item.processSequence.length
  500. }
  501. }
  502. for (let i = 0; i < item.processSequence.length; i++) {
  503. if (i >= nextIndex) {
  504. curProcessAfterList.push(item.processSequence[i]);
  505. }
  506. }
  507. if (item.status == 3) {
  508. curProcessAfterList.splice(0, 1)
  509. }
  510. console.log(curProcessAfterList)
  511. curProcessAfte.value = curProcessAfterList;
  512. showRight.value.open();
  513. }
  514. function handleSearchCode() {
  515. selectProduction.value.open(normalStatus.value);
  516. }
  517. // function switchChange(event) {
  518. // //异常批
  519. // if (event.detail.value) {
  520. // listData.value = tempList.value.filter(item => {
  521. // return item.isWasteRecycling == 1 || item.isAmend == 1;
  522. // });
  523. // normalStatus.value = 1
  524. // } else {
  525. // listData.value = tempList.value.filter(item => {
  526. // return item.isWasteRecycling == 0 && item.isAmend == 0;
  527. // });
  528. // normalStatus.value = 0
  529. // }
  530. // }
  531. /*
  532. function handleScanCode() {
  533. // 引入原生插件
  534. const mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module");
  535. // const mpaasScanModule = null
  536. if (mpaasScanModule) {
  537. // 调用插件的 mpaasScan 方法
  538. mpaasScanModule.mpaasScan({
  539. // 扫码识别类型,参数可多选,qrCode、barCode,
  540. // 如不设置,默认识别所有扫码类型,可能有些许影响识别效率
  541. scanType: ["qrCode", "barCode"],
  542. // 是否隐藏相册,默认false不隐藏
  543. hideAlbum: false,
  544. },
  545. (ret) => {
  546. console.log(ret);
  547. let vehicleObj = JSON.parse(ret.resp_result);
  548. if (!vehicleObj.carrierId || vehicleObj.carrierId == "") {
  549. uni.showToast({
  550. icon: "none",
  551. title: "请扫载具码",
  552. duration: 1000
  553. })
  554. return;
  555. }
  556. showDaywork({
  557. carrierId: vehicleObj.carrierId,
  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. if (response.data[0].deptId !== store.curDeptDetails.deptId) {
  565. uni.showToast({
  566. icon: 'none',
  567. title: '该批次不在当前工段',
  568. duration: 2000
  569. })
  570. return
  571. }
  572. if (response.data[0].productionPlanDetailId == store.planDetails.id) {
  573. // console.log(response.data)
  574. lotDialog.value.open(response.data);
  575. } else {
  576. uni.showToast({
  577. icon: 'none',
  578. title: '该批次不在此计划单内',
  579. duration: 2000
  580. })
  581. }
  582. } else {
  583. uni.showToast({
  584. icon: 'none',
  585. title: response.msg,
  586. duration: 2000
  587. })
  588. }
  589. })
  590. }
  591. );
  592. } else {
  593. // 测试时用
  594. showDaywork({
  595. carrierId: '1770342949090017283',
  596. status: 7
  597. }).then(response => {
  598. if (response.code == 200) {
  599. if (response.data[0].deptId !== store.curDeptDetails.deptId) {
  600. uni.showToast({
  601. icon: 'none',
  602. title: '该批次不在当前工段',
  603. duration: 2000
  604. })
  605. return
  606. }
  607. if (response.data[0].productionPlanDetailId == store.planDetails.id) {
  608. console.log(response.data)
  609. lotDialog.value.open(response.data);
  610. } else {
  611. uni.showToast({
  612. icon: 'none',
  613. title: '该批次不在此计划单内',
  614. duration: 2000
  615. })
  616. }
  617. } else {
  618. console.log(response)
  619. uni.showToast({
  620. icon: 'none',
  621. title: response.msg,
  622. duration: 2000
  623. })
  624. }
  625. })
  626. }
  627. }
  628. */
  629. function handleScanCode() {
  630. // 引入原生插件
  631. const mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module");
  632. // const mpaasScanModule = null
  633. if (mpaasScanModule) {
  634. // 调用插件的 mpaasScan 方法
  635. mpaasScanModule.mpaasScan({
  636. // 扫码识别类型,参数可多选,qrCode、barCode,
  637. // 如不设置,默认识别所有扫码类型,可能有些许影响识别效率
  638. scanType: ["qrCode", "barCode"],
  639. // 是否隐藏相册,默认false不隐藏
  640. hideAlbum: false,
  641. },
  642. (ret) => {
  643. console.log(ret);
  644. let vehicleObj = {
  645. carrierCode: ret.resp_result
  646. };
  647. if (!vehicleObj.carrierCode || vehicleObj.carrierCode == "") {
  648. uni.showToast({
  649. icon: "none",
  650. title: "请扫载具码",
  651. duration: 1000
  652. })
  653. return;
  654. }
  655. showDaywork({
  656. carrierCode: vehicleObj.carrierCode,
  657. status: 7
  658. }).then(response => {
  659. if (response.code == 200) {
  660. // console.log(response)
  661. // console.log(response.data[0].productionPlanDetailId)
  662. // console.log(store.planDetails.id)
  663. if (response.data[0].deptId !== store.curDeptDetails.deptId) {
  664. uni.showToast({
  665. icon: 'none',
  666. title: '该批次不在当前工段',
  667. duration: 2000
  668. })
  669. return
  670. }
  671. if (response.data[0].productionPlanDetailId == store.planDetails.id) {
  672. // console.log(response.data)
  673. lotDialog.value.open(response.data);
  674. } else {
  675. uni.showToast({
  676. icon: 'none',
  677. title: '该批次不在此计划单内',
  678. duration: 2000
  679. })
  680. }
  681. } else {
  682. uni.showToast({
  683. icon: 'none',
  684. title: response.msg,
  685. duration: 2000
  686. })
  687. }
  688. })
  689. }
  690. );
  691. } else {
  692. // 测试时用
  693. showDaywork({
  694. carrierCode: '000075',
  695. status: 7
  696. }).then(response => {
  697. if (response.code == 200) {
  698. if (response.data[0].deptId !== store.curDeptDetails.deptId) {
  699. uni.showToast({
  700. icon: 'none',
  701. title: '该批次不在当前工段',
  702. duration: 2000
  703. })
  704. return
  705. }
  706. if (response.data[0].productionPlanDetailId == store.planDetails.id) {
  707. console.log(response.data)
  708. lotDialog.value.open(response.data);
  709. } else {
  710. uni.showToast({
  711. icon: 'none',
  712. title: '该批次不在此计划单内',
  713. duration: 2000
  714. })
  715. }
  716. } else {
  717. console.log(response)
  718. uni.showToast({
  719. icon: 'none',
  720. title: response.msg,
  721. duration: 2000
  722. })
  723. }
  724. })
  725. }
  726. }
  727. // function handleScanCode() {
  728. // uni.scanCode({
  729. // onlyFromCamera: true,
  730. // success: function (res) {
  731. // if (res.scanType !== 'QR_CODE') {
  732. // uni.showToast({
  733. // icon: 'none',
  734. // title: '二维码未识别成功',
  735. // duration: 2000
  736. // })
  737. // }
  738. // console.log('条码类型:' + res.scanType);
  739. // console.log('条码内容:' + res.result);
  740. // }
  741. // });
  742. // }
  743. function handleAddDaywork(data) {
  744. isLoading.value = true; // 显示遮罩层
  745. uni.showLoading({
  746. title: '加载中'
  747. })
  748. console.log(data)
  749. let reqParam = [];
  750. for (var i = 0; i < data.length; i++) {
  751. reqParam.push(data[i].daywork)
  752. }
  753. console.log(data)
  754. data.forEach(item => {
  755. item.isSort = 1
  756. item.tenantId = !store.tenantId ? store.userInfo.tenantId : store.tenantId
  757. })
  758. showDayworkSave(data).then(res => {
  759. isLoading.value = false;
  760. uni.hideLoading();
  761. if (res.code == 200) {
  762. console.log(res)
  763. init(store.planDetails.id);
  764. } else {
  765. uni.showToast({
  766. icon: "none",
  767. title: res.msg,
  768. duration: 2000
  769. })
  770. }
  771. })
  772. }
  773. function handleDoIt(data) {
  774. handleAddDaywork(data);
  775. }
  776. function handleDoTurnoverAfter() {
  777. reflush();
  778. }
  779. function switchChange(event) {
  780. console.log(event)
  781. //异常批
  782. if (normalStatus.value) {
  783. listData.value = tempList.value.filter(item => {
  784. return item.isWasteRecycling == 1 || item.isAmend == 1;
  785. });
  786. normalStatus.value = false
  787. } else {
  788. listData.value = tempList.value.filter(item => {
  789. return item.isWasteRecycling == 0 && item.isAmend == 0;
  790. });
  791. normalStatus.value = true
  792. }
  793. console.log(listData.value)
  794. }
  795. function startReport(data) {
  796. getSortingDayworkItem(data).then(res => {
  797. uni.showToast({
  798. icon: "success",
  799. title: "开始成功",
  800. duration: 2000
  801. })
  802. init(store.planDetails.id)
  803. })
  804. }
  805. function handleCancelTurnover(data) {
  806. isTakeStock().then(response => {
  807. if (response.data) {
  808. uni.showToast({
  809. icon: 'none',
  810. title: '正在盘点,不能取消周转',
  811. duration: 2000
  812. })
  813. } else {
  814. turnoverDelete(data).then(res => {
  815. if (res.code == 200) {
  816. uni.showToast({
  817. icon: "success",
  818. title: "取消成功",
  819. duration: 2000
  820. })
  821. setTimeout(() => {
  822. init(store.planDetails.id);
  823. }, 1500);
  824. } else {
  825. uni.showToast({
  826. icon: "none",
  827. title: "取消失败",
  828. duration: 2000
  829. })
  830. setTimeout(() => {
  831. init(store.planDetails.id);
  832. }, 1000);
  833. }
  834. })
  835. }
  836. })
  837. }
  838. </script>
  839. <style lang="scss">
  840. $nav-height: 60rpx;
  841. .box-bg {
  842. width: 94%;
  843. background-color: #F5F5F5;
  844. padding: 5rpx 16rpx;
  845. justify-content: space-around;
  846. align-items: center;
  847. margin: 24rpx auto 0;
  848. .input-view {
  849. width: 100%;
  850. flex: 4;
  851. background-color: #f8f8f8;
  852. height: $nav-height;
  853. border: 1rpx solid #999;
  854. border-radius: 15rpx;
  855. padding: 0 15rpx;
  856. flex-wrap: nowrap;
  857. margin: 0 10rpx 0;
  858. line-height: $nav-height;
  859. .input-uni-icon {
  860. line-height: $nav-height;
  861. }
  862. .nav-bar-input {
  863. width: 80%;
  864. height: $nav-height;
  865. line-height: $nav-height;
  866. padding: 0 5rpx;
  867. background-color: #f8f8f8;
  868. }
  869. }
  870. .search {
  871. width: 20%;
  872. text-align: center;
  873. color: #808080;
  874. }
  875. }
  876. .list-title {
  877. width: 100%;
  878. margin-top: 16rpx;
  879. height: 64rpx;
  880. line-height: 64rpx;
  881. align-items: center;
  882. margin-left: 32rpx;
  883. .label {
  884. font-size: 32rpx;
  885. margin-right: 24rpx;
  886. }
  887. .icon-gear {
  888. font-size: 56rpx;
  889. }
  890. }
  891. .switch {
  892. margin-top: -8rpx;
  893. transform: scale(0.7);
  894. }
  895. .scroll-container {
  896. width: 92%;
  897. margin: 24rpx auto 0 auto;
  898. height: calc(90% - 100rpx);
  899. overflow: auto;
  900. }
  901. .list-item {
  902. background-color: #fff;
  903. position: relative;
  904. padding: 16rpx;
  905. padding-bottom: 24rpx;
  906. margin-bottom: 24rpx;
  907. border-radius: 24rpx;
  908. .title-container {
  909. margin-top: 8rpx;
  910. margin-bottom: 16rpx;
  911. .title {
  912. height: 48rpx;
  913. align-items: center;
  914. .label {
  915. font-size: 32rpx;
  916. font-weight: bold;
  917. &.code {
  918. margin-left: 8rpx;
  919. }
  920. }
  921. }
  922. .tag {
  923. border: 1px solid #1CE5B0;
  924. background-color: #F6FFFD;
  925. padding: 8rpx;
  926. border-radius: 8rpx;
  927. .label {
  928. color: #1CE5B0;
  929. font-size: 24rpx;
  930. }
  931. &.finished {
  932. border: 1px solid #BBBBBB;
  933. background-color: #F5F5F5;
  934. .label {
  935. color: #BBBBBB;
  936. }
  937. }
  938. &.turnover {
  939. border: 1px solid #FF7901;
  940. background-color: #F6FFFD;
  941. .label {
  942. color: #FF7901;
  943. }
  944. }
  945. }
  946. }
  947. .item-info {
  948. margin-bottom: 8rpx;
  949. .label {
  950. font-size: 28rpx;
  951. width: 220rpx;
  952. color: #808080;
  953. &.right {
  954. flex: 1;
  955. color: #000000;
  956. }
  957. }
  958. }
  959. .status-btn {
  960. justify-content: flex-end;
  961. align-items: center;
  962. .turnover-tag {
  963. padding-right: 12rpx;
  964. padding-left: 12rpx;
  965. border-radius: 8rpx;
  966. border: 1rpx solid #FF7901;
  967. background-color: #FF7901;
  968. font-size: 28rpx;
  969. color: #FFFFFF;
  970. }
  971. .reporting-tag {
  972. padding-right: 12rpx;
  973. padding-left: 12rpx;
  974. border-radius: 8rpx;
  975. margin-left: 16rpx;
  976. border: 1rpx solid #1684fc;
  977. background-color: #1684fc;
  978. font-size: 28rpx;
  979. color: #FFFFFF;
  980. }
  981. }
  982. }
  983. .bottom {
  984. height: 10%;
  985. position: fixed;
  986. right: 0;
  987. bottom: 0;
  988. left: 0;
  989. height: 100rpx;
  990. border-top: 1px solid #999999;
  991. padding: 16rpx 32rpx;
  992. align-items: center;
  993. background-color: #fff;
  994. justify-content: space-evenly;
  995. .start-batch-btn {
  996. flex: 1;
  997. height: 80rpx;
  998. line-height: 80rpx;
  999. border-radius: 8rpx;
  1000. color: #FFFFFF;
  1001. font-size: 28rpx;
  1002. }
  1003. }
  1004. .mask {
  1005. position: fixed;
  1006. top: 0;
  1007. left: 0;
  1008. right: 0;
  1009. bottom: 0;
  1010. background-color: rgba(0, 0, 0, 0.5);
  1011. z-index: 2000;
  1012. display: flex;
  1013. justify-content: center;
  1014. align-items: center;
  1015. }
  1016. .mask .loading-text {
  1017. color: #fff;
  1018. font-size: 36rpx;
  1019. }
  1020. </style>