index.vue 25 KB

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