index.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859
  1. <template>
  2. <view class='container'>
  3. <view class="content">
  4. <view>
  5. <text class='title'>批次号</text>
  6. <view class="batchNo uni-row">
  7. <view :class="{'batchNo-item':true, 'uni-row': true}" v-for="(item,index) in batchNoList"
  8. :key='index'>
  9. <!-- ,'batchNoCheck':batchNoCheck === item -->
  10. <!-- @click="handleCheckBatchNo(item)" -->
  11. {{ item.lotCode }}{{ item.isLast == 1 ? ' (尾批)': '' }}
  12. </view>
  13. </view>
  14. <view class="inpAndScan">
  15. <uni-easyinput v-if="batchNoList.length > 0" class="inp" suffixIcon="checkmarkempty"
  16. v-model="inpValue" placeholder="可手动修正批次" @iconClick="iconClick"></uni-easyinput>
  17. <view class="uni-row" style="justify-content: space-between;">
  18. <view v-if="batchNoList.length > 0 && curDept" class="scanLotCode" @click="handleDoLastLot">
  19. <text>是否加工尾批</text>
  20. </view>
  21. <view v-if="batchNoList.length > 0" class="scanLotCode" @click="handleConfirmLotCode">
  22. <text>扫码修正批次</text>
  23. </view>
  24. </view>
  25. </view>
  26. </view>
  27. <view class='middle'>
  28. <view class='segment'></view>
  29. <uni-icons type="link" size="30" style="margin: 10rpx; transform: rotate(135deg);"></uni-icons>
  30. <view class='segment'></view>
  31. </view>
  32. <!-- <view>
  33. <text class='title'>扫码绑定载具</text>
  34. <view class="vehicleList uni-row">
  35. <view class="vehicleNo uni-row" v-for="(item,index) in vehicleList">
  36. <text>{{item.carrierCode}}</text>
  37. <text @click="handleDelVehicleNo(index)">×</text>
  38. </view>
  39. </view>
  40. <view>
  41. <button style='background-color: rgba(0, 226, 166,1);
  42. color: white;margin: 20rpx auto;
  43. width: 80%;' @click='handleScanCode'>扫码</button>
  44. </view>
  45. </view> -->
  46. <view class="selectedProcess">
  47. <uni-section title="请选择工序" type="square">
  48. <uni-data-select v-model="selectedProcess" :localdata="processList" :clear="false"
  49. @change="handleProcessChange">
  50. <template v-slot:option="{item }">
  51. <!-- 自定义下拉框每一项的显示内容 -->
  52. <span>{{ (item.index) + 1}}</span>
  53. <span>{{ item.text }}</span>
  54. </template></uni-data-select>
  55. </uni-section>
  56. </view>
  57. <view class='middle'>
  58. <view class='segment'></view>
  59. <uni-icons type="paperclip" size="30" style="margin: 10rpx;"></uni-icons>
  60. <view class='segment'></view>
  61. </view>
  62. <view>
  63. <text class='title' style="margin-bottom: 40rpx;">基础信息</text>
  64. <view class="uni-row info" style="align-items: center;">
  65. <label for="HeatNo">炉号:</label>
  66. <uni-data-select v-if="isWasteRecyclingFlag" id="incomingInfo" class="uni-input data-select"
  67. v-model="basicInfo" :localdata="furnaceNumberInfoList" :clear="false"
  68. @change="handleFurnaceNumberChange"></uni-data-select>
  69. <text id="incomingInfo" v-else class="uni-input">废品回用</text>
  70. </view>
  71. <!-- <view class='segment' style="width: 90%;margin: 20rpx auto;"></view> -->
  72. <view class="uni-row info">
  73. <label for="productionPlanNo">计划单号:</label>
  74. <text id="productionPlanNo"
  75. class="uni-input">{{ basicInfo.productionPlanNo ? basicInfo.productionPlanNo : '-'}}</text>
  76. </view>
  77. <!-- <view class='segment' style="width: 90%;margin: 20rpx auto;"></view> -->
  78. <view class="uni-row info">
  79. <label for="lineNumber">序号:</label>
  80. <text id="lineNumber"
  81. class="uni-input">{{ basicInfo.lineNumber ? basicInfo.lineNumber : '-'}}</text>
  82. </view>
  83. <!-- <view class='segment' style="width: 90%;margin: 20rpx auto;"></view> -->
  84. <view class="uni-row info">
  85. <label for="factory">厂家:</label>
  86. <text id="factory"
  87. class="material uni-input">{{ basicInfo.factory ? basicInfo.factory : '-'}}</text>
  88. </view>
  89. <view class="uni-row info">
  90. <label for="brandNumber">牌号:</label>
  91. <text id="brandNumber"
  92. class="material uni-input">{{ basicInfo.brandNumber ? basicInfo.brandNumber : '-' }}</text>
  93. </view>
  94. <view class="uni-row info">
  95. <label for="spec">规格:</label>
  96. <text id="spec" class="material uni-input">{{ basicInfo.spec ? basicInfo.spec : '-' }}</text>
  97. </view>
  98. <view class="uni-row info">
  99. <label for="shape">形状:</label>
  100. <text id="shape" class="material uni-input">{{ basicInfo.shape ? basicInfo.shape : '-'}}</text>
  101. </view>
  102. <view class="uni-row info">
  103. <label for="diameter">材料直径:</label>
  104. <text id="diameter"
  105. class="material uni-input">{{ basicInfo.diameter ? basicInfo.diameter : '-' }}</text>
  106. </view>
  107. <view class="uni-row info">
  108. <label for="rawMaterialCode">原料编码:</label>
  109. <text id="rawMaterialCode"
  110. class="material uni-input">{{ basicInfo.rawMaterialCode ? basicInfo.rawMaterialCode : '-' }}</text>
  111. </view>
  112. <view class="uni-row info">
  113. <label for="incomingDate">来料日期:</label>
  114. <text id="incomingDate"
  115. class="material uni-input">{{ basicInfo.incomingDate ? basicInfo.incomingDate : '-' }}</text>
  116. </view>
  117. <view class="uni-row info">
  118. <label for="firstTechnicalRequirement">材质1:</label>
  119. <text id="firstTechnicalRequirement"
  120. class="material uni-input">{{ basicInfo.firstTechnicalRequirement ? basicInfo.firstTechnicalRequirement : '-' }}</text>
  121. </view>
  122. <view class="uni-row info">
  123. <label for="secondTechnicalRequirement">材质2:</label>
  124. <text id="secondTechnicalRequirement"
  125. class="material uni-input">{{ basicInfo.secondTechnicalRequirement ? basicInfo.secondTechnicalRequirement : '-' }}</text>
  126. </view>
  127. </view>
  128. </view>
  129. <view class='bottom uni-row'>
  130. <button class='add' type=primary @click='handleAdd'>添加</button>
  131. </view>
  132. </view>
  133. <view
  134. style="background-color: #99999999; z-index: 5; position: absolute; left: 0px; right: 0px; top: 0px; bottom: 0px;"
  135. v-if="loading">
  136. </view>
  137. <QrScanner v-if="showQrCodeReader" @decode="onDecodeHandler" @close="qrReaderClose" />
  138. </template>
  139. <script setup>
  140. import {
  141. ref
  142. } from 'vue'
  143. import {
  144. onLoad,
  145. onReady
  146. } from '@dcloudio/uni-app'
  147. import {
  148. getLotList,
  149. getAbnormalityLot,
  150. getProcessListByLot
  151. } from "@/api/business/lot.js"
  152. import {
  153. saveDayWork
  154. } from '@/api/business/dayWork.js'
  155. import {
  156. store
  157. } from '@/store/index.js'
  158. import {
  159. getCarrierById,
  160. checkCarrier
  161. } from '@/api/business/carrier.js'
  162. import {
  163. isTakeStock
  164. } from '@/api/business/taksStackLot.js'
  165. import {
  166. getFurnaceNoInfo
  167. } from '@/api/p2/furnaceNoInfo.js'
  168. import {
  169. getToken
  170. } from '@/utils/auth'
  171. import {
  172. getProcessList
  173. } from '@/api/business/deptProcess.js'
  174. import QrScanner from '../vueQrCode/index.vue'
  175. import path from '@/api/base/path.js'
  176. const batchNoCheck = ref(null) // 批次号是否选中
  177. const batchNoList = ref([]) // 批次号列表
  178. const showQrCodeReader = ref(false);
  179. const vehicleList = ref([])
  180. const basicInfo = ref({}) // 基础信息对象
  181. const dayWork = ref({})
  182. const furnaceInfo = ref({})
  183. const wasteRecyclingList = ref([]) //废品回用批次
  184. const curPlan = ref({})
  185. const furnaceNumberInfoList = ref([])
  186. const isWasteRecyclingFlag = ref(true)
  187. const emit = defineEmits(['batchReporting-addBatch']);
  188. const inpValue = ref('')
  189. const loading = ref(false)
  190. const curDept = ref(false) //判断当前工段是否是该批次的领料部门
  191. const lotList = ref([])
  192. const selectedProcess = ref(null)
  193. const processList = ref([])
  194. onLoad(() => {
  195. // 处理特殊字符JSON解析失败报错
  196. curPlan.value = store.planDetails;
  197. dayWork.value = {
  198. productionPlanDetailId: curPlan.value.id,
  199. productionPlanId: curPlan.value.productionDetailId,
  200. technologicalProcessId: curPlan.value.technologicalProcessId,
  201. deptId: store.curDeptDetails.deptId
  202. }
  203. init();
  204. })
  205. function init() {
  206. let obj = {}
  207. obj.productionPlanDetailId = store.planDetails.id;
  208. //开始新批次,判断当前工段是否能开始这个批次(领料部门是当前工段的;批次的领料部门是当前工段的)
  209. //当前计划单的领料部门是当前工段
  210. if (store.normalStatus) {
  211. curDept.value = true
  212. //只查不是废品回用的批次
  213. getLotList(obj).then(res => {
  214. lotList.value = res.rows;
  215. if (res.rows.length > 0) {
  216. batchNoList.value = [res.rows[0]];
  217. dayWork.value.lotId = batchNoList.value[0].id;
  218. dayWork.value.lotCode = batchNoList.value[0].lotCode;
  219. dayWork.value.technologicalProcessId = batchNoList.value[0].technologicalProcessId;
  220. store.planDetails.technologicalProcessId = batchNoList.value[0].technologicalProcessId;
  221. getProcessInfo(batchNoList.value[0])
  222. getFurnaceInfo(batchNoList.value[0])
  223. } else {
  224. batchNoList.value = res.rows;
  225. }
  226. })
  227. } else {
  228. //废品回用的批次(领料部门是当前工段)
  229. getAbnormalityLot({
  230. productionPlanDetailId: store.planDetails.id,
  231. requisitionDepartmentId: store.curDeptDetails.deptId,
  232. flag: true
  233. }).then(res => {
  234. wasteRecyclingList.value = res.rows
  235. if (res.rows.length > 0) {
  236. //如果废品回用的批次领料部门是当前计划的领料部门,则加到lotList
  237. lotList.value = res.rows
  238. batchNoList.value = [res.rows[0]];
  239. isWasteRecyclingFlag.value = true
  240. if (batchNoList.value[0].isWasteRecycling == 0) {
  241. isWasteRecyclingFlag.value = false
  242. }
  243. if (batchNoList.value[0].planType == 'HY') {
  244. isWasteRecyclingFlag.value = false
  245. }
  246. dayWork.value.lotId = batchNoList.value[0].id;
  247. dayWork.value.lotCode = batchNoList.value[0].lotCode;
  248. dayWork.value.technologicalProcessId = batchNoList.value[0].technologicalProcessId;
  249. store.planDetails.technologicalProcessId = batchNoList.value[0].technologicalProcessId;
  250. getProcessInfo(batchNoList.value[0])
  251. //提示当前批次是废品回用
  252. if (batchNoList.value[0].isAmend == 1) {
  253. uni.showToast({
  254. icon: "none",
  255. title: "该批是单批单改",
  256. duration: 2000
  257. })
  258. } else if (batchNoList.value[0].isWasteRecycling == 1) {
  259. uni.showToast({
  260. icon: "none",
  261. title: "该批是废品回用",
  262. duration: 2000
  263. })
  264. }
  265. getFurnaceInfo(batchNoList.value[0])
  266. } else {
  267. uni.showToast({
  268. icon: "none",
  269. title: "没有废品回用或单批单改批次",
  270. duration: 2000
  271. })
  272. }
  273. })
  274. }
  275. }
  276. // function handleCheckBatchNo(item) {
  277. // batchNoCheck.value = item;
  278. // dayWork.value.lotId = item.id;
  279. // }
  280. // function handleDelVehicleNo(index) {
  281. // vehicleList.value.splice(index, 1);
  282. // }
  283. // function handleValidate() {
  284. // if (batchNoCheck.value && vehicleList.value) {
  285. // return true;
  286. // } else {
  287. // return false;
  288. // }
  289. // }
  290. function getFurnaceInfo(data) {
  291. if (data.isWasteRecycling == 0 && data.planType != 'HY') {
  292. isWasteRecyclingFlag.value = true
  293. let token = 'Bearer ' + getToken();
  294. let header = {
  295. Authorization: token
  296. }
  297. uni.request({
  298. url: path.furnaceNoURL + '/business/furnaceNoInfo/getFurnaceNoInfo',
  299. data: {
  300. productionPlanNo: store.planDetails.productionPlanNo,
  301. lineNumber: store.planDetails.lineNumber
  302. },
  303. method: 'GET',
  304. header,
  305. sslVerify: false,
  306. success: (res) => {
  307. if (res.data.code == 200 && res.data.data.length > 0) {
  308. for (let i = 0; i < res.data.data.length; i++) {
  309. furnaceNumberInfoList.value[i] = {
  310. text: res.data.data[i].furnaceNumber + ' (' + res.data.data[i]
  311. .incomingDate + ')',
  312. value: res.data.data[i]
  313. }
  314. }
  315. // basicInfo.value = res.data.data[0];
  316. // dayWork.value.furnaceNoInfo = basicInfo.value;
  317. }
  318. },
  319. fail: (err) => {
  320. console.log(err)
  321. }
  322. })
  323. } else {
  324. isWasteRecyclingFlag.value = false
  325. furnaceInfo.value.furnaceNumber = "废品回用"
  326. furnaceInfo.value.firstTechnicalRequirement = "废品回用"
  327. dayWork.value.furnaceNoInfo = furnaceInfo.value
  328. basicInfo.value = dayWork.value.furnaceNoInfo
  329. }
  330. }
  331. function iconClick() {
  332. checkLotCode(inpValue.value);
  333. }
  334. function checkLotCode(lotCode) {
  335. var lotCodes = lotList.value.map(obj => obj.lotCode)
  336. console.log(lotCodes.includes(lotCode))
  337. console.log(lotCodes)
  338. if (lotCodes.includes(lotCode)) {
  339. for (let i = 0; i < lotList.value.length; i++) {
  340. if (lotList.value[i].lotCode == lotCode) {
  341. batchNoList.value = [lotList.value[i]];
  342. dayWork.value.lotId = lotList.value[i].id;
  343. dayWork.value.lotCode = lotList.value[i].lotCode;
  344. dayWork.value.technologicalProcessId = lotList.value[i].technologicalProcessId;
  345. store.planDetails.technologicalProcessId = lotList.value[i].technologicalProcessId;
  346. if (batchNoList.value[0].isWasteRecycling == 1) {
  347. isWasteRecyclingFlag.value = false
  348. getFurnaceInfo(batchNoList.value[0])
  349. uni.showToast({
  350. icon: "none",
  351. title: "该批次号可用,该批是废品回用",
  352. duration: 2000
  353. })
  354. getProcessInfo(batchNoList.value[0])
  355. } else if (batchNoList.value[0].isAmend == 1) {
  356. isWasteRecyclingFlag.value = true
  357. getFurnaceInfo(batchNoList.value[0])
  358. uni.showToast({
  359. icon: "none",
  360. title: "该批次号可用,该批是单批单改",
  361. duration: 2000
  362. })
  363. getProcessInfo(batchNoList.value[0])
  364. } else {
  365. uni.showToast({
  366. icon: "none",
  367. title: "该批次号可用",
  368. duration: 2000
  369. })
  370. getProcessInfo(batchNoList.value[0])
  371. }
  372. return true;
  373. }
  374. }
  375. } else {
  376. getAbnormalList(lotCode);
  377. }
  378. }
  379. function getAbnormalList(lotCode) {
  380. console.log(store.normalStatus)
  381. if (store.normalStatus) {
  382. getAbnormalityLot({
  383. productionPlanDetailId: store.planDetails.id,
  384. requisitionDepartmentId: store.curDeptDetails.deptId,
  385. flag: true
  386. }).then(res => {
  387. if (res.rows.length > 0) {
  388. var abNormaLotCode = res.rows.map(obj => obj.lotCode)
  389. if (abNormaLotCode.includes(lotCode)) {
  390. uni.showToast({
  391. icon: "none",
  392. title: "该批次号是废品回用或单批单改",
  393. duration: 2000
  394. })
  395. return false;
  396. } else {
  397. uni.showToast({
  398. icon: "none",
  399. title: "该批次号已被使用或不属于该产品",
  400. duration: 2000
  401. })
  402. return false;
  403. }
  404. } else {
  405. uni.showToast({
  406. icon: "none",
  407. title: "该批次号已被使用或不属于该产品",
  408. duration: 2000
  409. })
  410. return false;
  411. }
  412. })
  413. } else {
  414. getLotList({
  415. productionPlanDetailId: store.planDetails.id
  416. }).then(res => {
  417. if (res.rows.length > 0) {
  418. console.log(res.rows)
  419. var normaLotCode = res.rows.map(obj => obj.lotCode)
  420. if (normaLotCode.includes(lotCode)) {
  421. uni.showToast({
  422. icon: "none",
  423. title: "该批次号是正常批",
  424. duration: 2000
  425. })
  426. return false;
  427. } else {
  428. uni.showToast({
  429. icon: "none",
  430. title: "该批次号已被使用或不属于该产品",
  431. duration: 2000
  432. })
  433. return false;
  434. }
  435. } else {
  436. uni.showToast({
  437. icon: "none",
  438. title: "该批次号已被使用或不属于该产品",
  439. duration: 2000
  440. })
  441. return false;
  442. }
  443. })
  444. }
  445. }
  446. function getProcessInfo(data) {
  447. getProcessList({
  448. deptId: store.curDeptDetails.deptId,
  449. }).then(res => {
  450. if (res.code == 200) {
  451. //过滤出工序交集
  452. //因为废品回用对工序进行单独的修改。所以重新查产品的工艺,如果该批不是废品回用,则查产品工序,如果是,则到
  453. //对应表查
  454. //通过批次号查
  455. getProcessListByLot(data).then(response => {
  456. let lotProcessList = response.data
  457. let filteredData = lotProcessList.filter((item1) =>
  458. res.data.some((item2) => item2.processCode === item1.processCode)
  459. );
  460. processList.value = filteredData.map((v, index) => ({
  461. text: v.processAlias,
  462. value: v.technologicalProcessDetailId ? v
  463. .technologicalProcessDetailId : v.id,
  464. processId: v.processId,
  465. processStepNumber: v.processStepNumber,
  466. index: index,
  467. technologicalProcessId: v.technologicalProcessId ? v
  468. .technologicalProcessId : v.lotTechnologicalProcessId
  469. }))
  470. selectedProcess.value = processList.value[0].value;
  471. dayWork.value.processId = processList.value[0].processId;
  472. dayWork.value.technologicalProcessId = processList.value[0].technologicalProcessId
  473. dayWork.value.technologicalProcessDetailId = selectedProcess.value
  474. dayWork.value.processStepNumber = processList.value.findIndex(v => v.value ===
  475. selectedProcess.value) >= 0 ?
  476. processList.value.find(v => v.value === selectedProcess.value).processStepNumber :
  477. null
  478. })
  479. }
  480. })
  481. }
  482. function handleDoLastLot() {
  483. uni.showModal({
  484. title: '提示',
  485. content: '确认是否加工尾批?',
  486. success: function(res) {
  487. if (res.confirm) {
  488. if (lotList.value.some(item => item.isLast == 1)) {
  489. for (let i = 0; i < lotList.value.length; i++) {
  490. if (lotList.value[i].isLast == 1) {
  491. batchNoList.value = [lotList.value[i]];
  492. dayWork.value.lotId = lotList.value[i].id;
  493. dayWork.value.lotCode = lotList.value[i].lotCode;
  494. dayWork.value.isLast = '1';
  495. return;
  496. }
  497. }
  498. } else {
  499. uni.showToast({
  500. icon: 'none',
  501. title: '当前计划尾批已被加工',
  502. duration: 2500
  503. })
  504. }
  505. } else if (res.cancel) {}
  506. }
  507. });
  508. }
  509. function qrReaderClose() {
  510. showQrCodeReader.value = false;
  511. }
  512. function onDecodeHandler(ret) {
  513. showQrCodeReader.value = false;
  514. checkLotCode(ret);
  515. }
  516. function handleConfirmLotCode() {
  517. // 引入原生插件
  518. // const mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module");
  519. // // 调用插件的 mpaasScan 方法
  520. // mpaasScanModule.mpaasScan({
  521. // // 扫码识别类型,参数可多选,qrCode、barCode,
  522. // // 如不设置,默认识别所有扫码类型,可能有些许影响识别效率
  523. // scanType: ["qrCode", "barCode"],
  524. // // 是否隐藏相册,默认false不隐藏
  525. // hideAlbum: false,
  526. // },
  527. // (ret) => {
  528. // console.log(ret);
  529. // // uni.showModal({
  530. // // title: "扫码结果",
  531. // // // 返回值中,有三个参数 resp_code、resp_message、resp_result
  532. // // // resp_code 表示返回结果值,10:用户取消,11:其他错误,1000:成功
  533. // // // resp_message 表示返回结果信息
  534. // // // resp_result 表示扫码结果,只有成功才会有返回
  535. // // content: JSON.stringify(ret),
  536. // // showCancel: false,
  537. // // confirmText: "确定",
  538. // // });
  539. // if (ret.resp_result) {
  540. // checkLotCode(ret.resp_result);
  541. // }
  542. // }
  543. // );
  544. showQrCodeReader.value = true;
  545. }
  546. function handleFurnaceNumberChange() {
  547. dayWork.value.furnaceNoInfo = basicInfo.value;
  548. }
  549. function handleProcessChange() {
  550. dayWork.value.technologicalProcessDetailId = selectedProcess.value;
  551. dayWork.value.processId = processList.value.findIndex(v => v.value === selectedProcess.value) >= 0 ? processList
  552. .value.find(v => v.value === selectedProcess.value).processId : null
  553. dayWork.value.processStepNumber = processList.value.findIndex(v => v.value === selectedProcess.value) >= 0 ?
  554. processList.value.find(v => v.value === selectedProcess.value).processStepNumber : null
  555. dayWork.value.technologicalProcessId = batchNoList.value[0].technologicalProcessId;
  556. }
  557. /*
  558. // function handleScanCode() {
  559. // uni.scanCode({
  560. // scanType: ['qrCode'],
  561. // onlyFromCamera: true, // 只允许相机扫码
  562. // autoZoom: false,
  563. // success: function(res) {
  564. // let vehicleObj = JSON.parse(res.result);
  565. // if (!vehicleObj.carrierId || vehicleObj.carrierId == "") {
  566. // uni.showToast({
  567. // icon: "error",
  568. // title: "请扫载具码",
  569. // duration: 1000
  570. // })
  571. // return;
  572. // }
  573. // for (let i = 0; i < vehicleList.value.length; i++) {
  574. // if (vehicleList.value[i].carrierId == vehicleObj.carrierId) {
  575. // uni.showToast({
  576. // icon: "error",
  577. // title: "载具已存在",
  578. // duration: 1000
  579. // })
  580. // return;
  581. // }
  582. // }
  583. // checkCarrier(vehicleObj.carrierId).then(response => {
  584. // if (response.code == 200) {
  585. // vehicleList.value.push(vehicleObj);
  586. // } else {
  587. // uni.showToast({
  588. // icon: 'none',
  589. // title: response.msg
  590. // })
  591. // return;
  592. // }
  593. // })
  594. // }
  595. // });
  596. // }
  597. */
  598. function handleAdd() {
  599. if (selectedProcess.value == null) {
  600. uni.showToast({
  601. icon: 'none',
  602. title: '请选择工序后再开始批次'
  603. })
  604. return;
  605. }
  606. if (dayWork.value.furnaceNoInfo == null) {
  607. uni.showToast({
  608. icon: 'none',
  609. title: '请选择炉号再开始批次'
  610. })
  611. return;
  612. }
  613. dayWork.value.isWasteRecycling = batchNoList.value[0].isWasteRecycling
  614. dayWork.value.isAmend = batchNoList.value[0].isAmend
  615. dayWork.value.fromId = batchNoList.value[0].fromId
  616. dayWork.value.isSuperaddition = batchNoList.value[0].isSuperaddition
  617. dayWork.value.tenantId = !store.tenantId ? store.userInfo.tenantId : store.tenantId
  618. store.furnaceNumberInfo = basicInfo.value;
  619. if (checkLotCode(dayWork.value.lotCode)) {
  620. isTakeStock().then(response => {
  621. if (response.data) {
  622. uni.showToast({
  623. icon: 'none',
  624. title: '正在盘点,不能开始新批次',
  625. duration: 2000
  626. })
  627. } else {
  628. loading.value = true
  629. uni.showLoading({
  630. title: '加载中'
  631. });
  632. saveDayWork(dayWork.value).then(res => {
  633. console.log(res)
  634. if (res.code === 200) {
  635. uni.showToast({
  636. icon: 'success',
  637. title: '添加成功',
  638. duration: 2000
  639. });
  640. // uni.$emit('batchReporting-addBatch');
  641. // uni.$emit('dayworkItemUpdate');
  642. uni.navigateBack({
  643. url: '/pages/batchReporting/index'
  644. })
  645. } else {
  646. uni.showToast({
  647. icon: 'none',
  648. title: res.msg,
  649. duration: 2000
  650. });
  651. }
  652. loading.value = false
  653. uni.hideLoading()
  654. })
  655. }
  656. })
  657. } else {
  658. uni.showToast({
  659. icon: "none",
  660. title: "该批次号已被使用或不属于该产品",
  661. duration: 2000
  662. })
  663. }
  664. }
  665. </script>
  666. <style lang="scss">
  667. .container {
  668. height: 90%;
  669. background-color: #f5f5f5;
  670. padding-bottom: 112rpx;
  671. }
  672. .bottom {
  673. background-color: white;
  674. width: 100%;
  675. position: fixed;
  676. bottom: 0;
  677. align-items: center;
  678. background-color: #ffffff;
  679. padding: 16rpx 0;
  680. .add {
  681. margin: 0 auto;
  682. width: 80%;
  683. height: 80rpx;
  684. }
  685. }
  686. .content {
  687. position: relative;
  688. width: auto;
  689. background-color: rgba(255, 255, 255, 1);
  690. margin: 32rpx;
  691. padding-bottom: 50rpx;
  692. padding-top: 20rpx;
  693. border-radius: 12rpx;
  694. height: 100%;
  695. overflow: auto;
  696. .title {
  697. width: auto;
  698. font-size: 36rpx;
  699. font-weight: bold;
  700. text-align: center;
  701. }
  702. }
  703. .inpAndScan {
  704. justify-content: space-between;
  705. width: calc(88% + 20rpx);
  706. margin: 0 auto;
  707. .inp {
  708. width: calc(100% - 16rpx);
  709. margin: 10rpx auto;
  710. height: 74rpx;
  711. }
  712. .scanLotCode {
  713. border-radius: 6rpx;
  714. border: 1rpx solid rgba(22, 132, 252, 1);
  715. height: 60rpx;
  716. margin: 10rpx;
  717. height: 72rpx;
  718. width: 46%;
  719. text-align: center;
  720. line-height: 72rpx;
  721. background-color: rgba(22, 132, 252, 1);
  722. color: white;
  723. }
  724. }
  725. .batchNo {
  726. // justify-content: flex-start;
  727. // flex-wrap: wrap;
  728. // width: auto;
  729. // height: 320rpx;
  730. // overflow: auto;
  731. // padding-left: calc(100% - 88% - 4rpx - 40rpx);
  732. // margin-bottom: 40rpx;
  733. // border-radius: 6rpx;
  734. justify-content: center;
  735. .batchNo-item {
  736. justify-content: center;
  737. align-items: center;
  738. width: 88%;
  739. margin: 10rpx;
  740. height: 72rpx;
  741. border: 1px solid rgba(213, 213, 213, 1);
  742. border-radius: 6rpx;
  743. }
  744. .batchNoCheck {
  745. color: #FFF;
  746. border: 1rpx solid rgba(22, 132, 252, 1);
  747. background-color: rgba(22, 132, 252, 1);
  748. }
  749. }
  750. .vehicleList {
  751. justify-content: flex-start;
  752. flex-wrap: wrap;
  753. width: auto;
  754. height: 120rpx;
  755. overflow: auto;
  756. padding: 0 80rpx;
  757. .vehicleNo {
  758. padding: 0 10rpx;
  759. margin: 10rpx;
  760. justify-content: space-between;
  761. align-items: center;
  762. width: 230rpx;
  763. height: 60rpx;
  764. border: 1px solid rgba(213, 213, 213, 1);
  765. border-radius: 6rpx;
  766. }
  767. }
  768. .middle {
  769. display: flex;
  770. flex-direction: row;
  771. align-items: center;
  772. justify-content: center
  773. }
  774. .segment {
  775. width: 280rpx;
  776. background-color: rgba(213, 213, 213, 1);
  777. border: 1rpx solid rgba(213, 213, 213, 1);
  778. }
  779. .info {
  780. width: 94%;
  781. justify-content: space-around;
  782. padding: 10rpx;
  783. margin: 0 auto;
  784. label {
  785. flex: 1;
  786. text-combine-upright: all;
  787. margin: 0 30rpx 0 20rpx;
  788. }
  789. text {
  790. flex: 3;
  791. // width: 80%;
  792. }
  793. .data-select {
  794. flex: 3;
  795. width: 80%;
  796. height: 60rpx;
  797. margin-right: 40rpx;
  798. border-radius: 18rpx;
  799. background-color: #FFF;
  800. .data-select-options {
  801. width: 200rpx;
  802. }
  803. }
  804. }
  805. .material {
  806. height: auto;
  807. width: 60%;
  808. }
  809. .selectedProcess {
  810. width: 88%;
  811. margin: 20rpx auto 40rpx;
  812. }
  813. </style>