index.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879
  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. dayWork.value.lotId = batchNoList.value[0].id;
  249. dayWork.value.lotCode = batchNoList.value[0].lotCode;
  250. dayWork.value.technologicalProcessId = batchNoList.value[0].technologicalProcessId;
  251. store.planDetails.technologicalProcessId = batchNoList.value[0].technologicalProcessId;
  252. getProcessInfo(batchNoList.value[0])
  253. //提示当前批次是废品回用
  254. if (batchNoList.value[0].isAmend == 1) {
  255. uni.showToast({
  256. icon: "none",
  257. title: "该批是单批单改",
  258. duration: 2000
  259. })
  260. } else if (batchNoList.value[0].isWasteRecycling == 1) {
  261. uni.showToast({
  262. icon: "none",
  263. title: "该批是废品回用",
  264. duration: 2000
  265. })
  266. }
  267. getFurnaceInfo(batchNoList.value[0])
  268. } else {
  269. uni.showToast({
  270. icon: "none",
  271. title: "没有废品回用或单批单改批次",
  272. duration: 2000
  273. })
  274. }
  275. })
  276. }
  277. }
  278. // function handleCheckBatchNo(item) {
  279. // batchNoCheck.value = item;
  280. // dayWork.value.lotId = item.id;
  281. // }
  282. // function handleDelVehicleNo(index) {
  283. // vehicleList.value.splice(index, 1);
  284. // }
  285. // function handleValidate() {
  286. // if (batchNoCheck.value && vehicleList.value) {
  287. // return true;
  288. // } else {
  289. // return false;
  290. // }
  291. // }
  292. function getFurnaceInfo(data) {
  293. if (data.isWasteRecycling == 0) {
  294. isWasteRecyclingFlag.value = true
  295. let token = 'Bearer ' + getToken();
  296. let header = {
  297. Authorization: token
  298. }
  299. uni.request({
  300. url: path.furnaceNoURL + '/business/furnaceNoInfo/getFurnaceNoInfo',
  301. data: {
  302. productionPlanNo: store.planDetails.productionPlanNo,
  303. lineNumber: store.planDetails.lineNumber
  304. },
  305. method: 'GET',
  306. header,
  307. sslVerify: false,
  308. success: (res) => {
  309. if (res.data.code == 200 && res.data.data.length > 0) {
  310. for (let i = 0; i < res.data.data.length; i++) {
  311. furnaceNumberInfoList.value[i] = {
  312. text: res.data.data[i].furnaceNumber + ' (' + res.data.data[i]
  313. .incomingDate + ')',
  314. // text: '2415800347000 (2024-05-06)',
  315. value: res.data.data[i]
  316. }
  317. }
  318. // basicInfo.value = res.data.data[0];
  319. // dayWork.value.furnaceNoInfo = basicInfo.value;
  320. }
  321. },
  322. fail: (err) => {
  323. console.log(err)
  324. }
  325. })
  326. } else {
  327. isWasteRecyclingFlag.value = false
  328. furnaceInfo.value.furnaceNumber = "废品回用"
  329. furnaceInfo.value.firstTechnicalRequirement = "废品回用"
  330. dayWork.value.furnaceNoInfo = furnaceInfo.value
  331. basicInfo.value = dayWork.value.furnaceNoInfo
  332. }
  333. }
  334. function iconClick() {
  335. checkLotCode(inpValue.value);
  336. }
  337. function checkLotCode(lotCode) {
  338. var lotCodes = lotList.value.map(obj => obj.lotCode)
  339. console.log(lotCodes.includes(lotCode))
  340. console.log(lotCodes)
  341. if (lotCodes.includes(lotCode)) {
  342. for (let i = 0; i < lotList.value.length; i++) {
  343. if (lotList.value[i].lotCode == lotCode) {
  344. batchNoList.value = [lotList.value[i]];
  345. dayWork.value.lotId = lotList.value[i].id;
  346. dayWork.value.lotCode = lotList.value[i].lotCode;
  347. dayWork.value.technologicalProcessId = lotList.value[i].technologicalProcessId;
  348. store.planDetails.technologicalProcessId = lotList.value[i].technologicalProcessId;
  349. if (batchNoList.value[0].isWasteRecycling == 1) {
  350. isWasteRecyclingFlag.value = false
  351. getFurnaceInfo(batchNoList.value[0])
  352. uni.showToast({
  353. icon: "none",
  354. title: "该批次号可用,该批是废品回用",
  355. duration: 2000
  356. })
  357. getProcessInfo(batchNoList.value[0])
  358. } else if (batchNoList.value[0].isAmend == 1) {
  359. isWasteRecyclingFlag.value = true
  360. getFurnaceInfo(batchNoList.value[0])
  361. uni.showToast({
  362. icon: "none",
  363. title: "该批次号可用,该批是单批单改",
  364. duration: 2000
  365. })
  366. getProcessInfo(batchNoList.value[0])
  367. } else {
  368. uni.showToast({
  369. icon: "none",
  370. title: "该批次号可用",
  371. duration: 2000
  372. })
  373. getProcessInfo(batchNoList.value[0])
  374. }
  375. return true;
  376. }
  377. }
  378. } else {
  379. getAbnormalList(lotCode);
  380. }
  381. }
  382. function getAbnormalList(lotCode) {
  383. console.log(store.normalStatus)
  384. if (store.normalStatus) {
  385. getAbnormalityLot({
  386. productionPlanDetailId: store.planDetails.id,
  387. requisitionDepartmentId: store.curDeptDetails.deptId,
  388. flag: true
  389. }).then(res => {
  390. if (res.rows.length > 0) {
  391. var abNormaLotCode = res.rows.map(obj => obj.lotCode)
  392. if (abNormaLotCode.includes(lotCode)) {
  393. uni.showToast({
  394. icon: "none",
  395. title: "该批次号是废品回用或单批单改",
  396. duration: 2000
  397. })
  398. return false;
  399. } else {
  400. uni.showToast({
  401. icon: "none",
  402. title: "该批次号已被使用或不属于该产品",
  403. duration: 2000
  404. })
  405. return false;
  406. }
  407. } else {
  408. uni.showToast({
  409. icon: "none",
  410. title: "该批次号已被使用或不属于该产品",
  411. duration: 2000
  412. })
  413. return false;
  414. }
  415. })
  416. } else {
  417. getLotList({
  418. productionPlanDetailId: store.planDetails.id
  419. }).then(res => {
  420. if (res.rows.length > 0) {
  421. console.log(res.rows)
  422. var normaLotCode = res.rows.map(obj => obj.lotCode)
  423. if (normaLotCode.includes(lotCode)) {
  424. uni.showToast({
  425. icon: "none",
  426. title: "该批次号是正常批",
  427. duration: 2000
  428. })
  429. return false;
  430. } else {
  431. uni.showToast({
  432. icon: "none",
  433. title: "该批次号已被使用或不属于该产品",
  434. duration: 2000
  435. })
  436. return false;
  437. }
  438. } else {
  439. uni.showToast({
  440. icon: "none",
  441. title: "该批次号已被使用或不属于该产品",
  442. duration: 2000
  443. })
  444. return false;
  445. }
  446. })
  447. }
  448. }
  449. function getProcessInfo(data) {
  450. getProcessList({
  451. deptId: store.curDeptDetails.deptId,
  452. }).then(res => {
  453. if (res.code == 200) {
  454. //过滤出工序交集
  455. //因为废品回用对工序进行单独的修改。所以重新查产品的工艺,如果该批不是废品回用,则查产品工序,如果是,则到
  456. //对应表查
  457. //通过批次号查
  458. getProcessListByLot(data).then(response => {
  459. let lotProcessList = response.data
  460. let filteredData = lotProcessList.filter((item1) =>
  461. res.data.some((item2) => item2.processCode === item1.processCode)
  462. );
  463. processList.value = filteredData.map((v, index) => ({
  464. text: v.processAlias,
  465. value: v.technologicalProcessDetailId ? v
  466. .technologicalProcessDetailId : v.id,
  467. processId: v.processId,
  468. processStepNumber: v.processStepNumber,
  469. index: index,
  470. technologicalProcessId: v.technologicalProcessId ? v
  471. .technologicalProcessId : v.lotTechnologicalProcessId
  472. }))
  473. selectedProcess.value = processList.value[0].value;
  474. dayWork.value.processId = processList.value[0].processId;
  475. dayWork.value.technologicalProcessId = processList.value[0].technologicalProcessId
  476. dayWork.value.technologicalProcessDetailId = selectedProcess.value
  477. dayWork.value.processStepNumber = processList.value.findIndex(v => v.value ===
  478. selectedProcess.value) >= 0 ?
  479. processList.value.find(v => v.value === selectedProcess.value).processStepNumber :
  480. null
  481. })
  482. }
  483. })
  484. }
  485. function handleDoLastLot() {
  486. uni.showModal({
  487. title: '提示',
  488. content: '确认是否加工尾批?',
  489. success: function(res) {
  490. if (res.confirm) {
  491. if (lotList.value.some(item => item.isLast == 1)) {
  492. for (let i = 0; i < lotList.value.length; i++) {
  493. if (lotList.value[i].isLast == 1) {
  494. batchNoList.value = [lotList.value[i]];
  495. dayWork.value.lotId = lotList.value[i].id;
  496. dayWork.value.lotCode = lotList.value[i].lotCode;
  497. dayWork.value.isLast = '1';
  498. return;
  499. }
  500. }
  501. } else {
  502. uni.showToast({
  503. icon: 'none',
  504. title: '当前计划尾批已被加工',
  505. duration: 2500
  506. })
  507. }
  508. } else if (res.cancel) {}
  509. }
  510. });
  511. }
  512. function handleConfirmLotCode() {
  513. // 引入原生插件
  514. const mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module");
  515. // 调用插件的 mpaasScan 方法
  516. mpaasScanModule.mpaasScan({
  517. // 扫码识别类型,参数可多选,qrCode、barCode,
  518. // 如不设置,默认识别所有扫码类型,可能有些许影响识别效率
  519. scanType: ["qrCode", "barCode"],
  520. // 是否隐藏相册,默认false不隐藏
  521. hideAlbum: false,
  522. },
  523. (ret) => {
  524. console.log(ret);
  525. // uni.showModal({
  526. // title: "扫码结果",
  527. // // 返回值中,有三个参数 resp_code、resp_message、resp_result
  528. // // resp_code 表示返回结果值,10:用户取消,11:其他错误,1000:成功
  529. // // resp_message 表示返回结果信息
  530. // // resp_result 表示扫码结果,只有成功才会有返回
  531. // content: JSON.stringify(ret),
  532. // showCancel: false,
  533. // confirmText: "确定",
  534. // });
  535. if (ret.resp_result) {
  536. checkLotCode(ret.resp_result);
  537. }
  538. }
  539. );
  540. }
  541. function handleFurnaceNumberChange() {
  542. dayWork.value.furnaceNoInfo = basicInfo.value;
  543. }
  544. function handleProcessChange() {
  545. dayWork.value.technologicalProcessDetailId = selectedProcess.value;
  546. dayWork.value.processId = processList.value.findIndex(v => v.value === selectedProcess.value) >= 0 ? processList
  547. .value.find(v => v.value === selectedProcess.value).processId : null
  548. dayWork.value.processStepNumber = processList.value.findIndex(v => v.value === selectedProcess.value) >= 0 ?
  549. processList.value.find(v => v.value === selectedProcess.value).processStepNumber : null
  550. dayWork.value.technologicalProcessId = batchNoList.value[0].technologicalProcessId;
  551. }
  552. /*
  553. // function handleScanCode() {
  554. // uni.scanCode({
  555. // scanType: ['qrCode'],
  556. // onlyFromCamera: true, // 只允许相机扫码
  557. // autoZoom: false,
  558. // success: function(res) {
  559. // let vehicleObj = JSON.parse(res.result);
  560. // if (!vehicleObj.carrierId || vehicleObj.carrierId == "") {
  561. // uni.showToast({
  562. // icon: "error",
  563. // title: "请扫载具码",
  564. // duration: 1000
  565. // })
  566. // return;
  567. // }
  568. // for (let i = 0; i < vehicleList.value.length; i++) {
  569. // if (vehicleList.value[i].carrierId == vehicleObj.carrierId) {
  570. // uni.showToast({
  571. // icon: "error",
  572. // title: "载具已存在",
  573. // duration: 1000
  574. // })
  575. // return;
  576. // }
  577. // }
  578. // checkCarrier(vehicleObj.carrierId).then(response => {
  579. // if (response.code == 200) {
  580. // vehicleList.value.push(vehicleObj);
  581. // } else {
  582. // uni.showToast({
  583. // icon: 'none',
  584. // title: response.msg
  585. // })
  586. // return;
  587. // }
  588. // })
  589. // }
  590. // });
  591. // }
  592. */
  593. function handleAdd() {
  594. if (selectedProcess.value == null) {
  595. uni.showToast({
  596. icon: 'none',
  597. title: '请选择工序后再开始批次'
  598. })
  599. return;
  600. }
  601. if (dayWork.value.furnaceNoInfo == null) {
  602. uni.showToast({
  603. icon: 'none',
  604. title: '请选择炉号再开始批次'
  605. })
  606. return;
  607. }
  608. dayWork.value.isWasteRecycling = batchNoList.value[0].isWasteRecycling
  609. dayWork.value.isAmend = batchNoList.value[0].isAmend
  610. dayWork.value.fromId = batchNoList.value[0].fromId
  611. dayWork.value.isSuperaddition = batchNoList.value[0].isSuperaddition
  612. dayWork.value.tenantId = !store.tenantId ? store.userInfo.tenantId : store.tenantId
  613. store.furnaceNumberInfo = basicInfo.value;
  614. if (checkLotCode(dayWork.value.lotCode)) {
  615. isTakeStock().then(response => {
  616. if (response.data) {
  617. uni.showToast({
  618. icon: 'none',
  619. title: '正在盘点,不能开始新批次',
  620. duration: 2000
  621. })
  622. } else {
  623. isLoading.value = true; // 显示遮罩层
  624. loading.value = true
  625. uni.showLoading({
  626. title: '加载中'
  627. });
  628. saveDayWork(dayWork.value).then(res => {
  629. isLoading.value = false;
  630. uni.hideLoading();
  631. console.log(res)
  632. if (res.code === 200) {
  633. uni.showToast({
  634. icon: 'success',
  635. title: '添加成功',
  636. duration: 2000
  637. });
  638. // uni.$emit('batchReporting-addBatch');
  639. // uni.$emit('dayworkItemUpdate');
  640. uni.navigateBack({
  641. url: '/pages/batchReporting/index'
  642. })
  643. } else {
  644. uni.showToast({
  645. icon: 'none',
  646. title: res.msg,
  647. duration: 2000
  648. });
  649. }
  650. loading.value = false
  651. uni.hideLoading()
  652. })
  653. }
  654. })
  655. } else {
  656. uni.showToast({
  657. icon: "none",
  658. title: "该批次号已被使用或不属于该产品",
  659. duration: 2000
  660. })
  661. }
  662. }
  663. </script>
  664. <style lang="scss">
  665. .container {
  666. height: 90%;
  667. background-color: #f5f5f5;
  668. padding-bottom: 112rpx;
  669. }
  670. .bottom {
  671. background-color: white;
  672. width: 100%;
  673. position: fixed;
  674. bottom: 0;
  675. align-items: center;
  676. background-color: #ffffff;
  677. padding: 16rpx 0;
  678. .add {
  679. margin: 0 auto;
  680. width: 80%;
  681. height: 80rpx;
  682. }
  683. }
  684. .content {
  685. position: relative;
  686. width: auto;
  687. background-color: rgba(255, 255, 255, 1);
  688. margin: 32rpx;
  689. padding-bottom: 50rpx;
  690. padding-top: 20rpx;
  691. border-radius: 12rpx;
  692. height: 100%;
  693. overflow: auto;
  694. .title {
  695. width: auto;
  696. font-size: 36rpx;
  697. font-weight: bold;
  698. text-align: center;
  699. }
  700. }
  701. .inpAndScan {
  702. justify-content: space-between;
  703. width: calc(88% + 20rpx);
  704. margin: 0 auto;
  705. .inp {
  706. width: calc(100% - 16rpx);
  707. margin: 10rpx auto;
  708. height: 74rpx;
  709. }
  710. .scanLotCode {
  711. border-radius: 6rpx;
  712. border: 1rpx solid rgba(22, 132, 252, 1);
  713. height: 60rpx;
  714. margin: 10rpx;
  715. height: 72rpx;
  716. width: 46%;
  717. text-align: center;
  718. line-height: 72rpx;
  719. background-color: rgba(22, 132, 252, 1);
  720. color: white;
  721. }
  722. }
  723. .batchNo {
  724. // justify-content: flex-start;
  725. // flex-wrap: wrap;
  726. // width: auto;
  727. // height: 320rpx;
  728. // overflow: auto;
  729. // padding-left: calc(100% - 88% - 4rpx - 40rpx);
  730. // margin-bottom: 40rpx;
  731. // border-radius: 6rpx;
  732. justify-content: center;
  733. .batchNo-item {
  734. justify-content: center;
  735. align-items: center;
  736. width: 88%;
  737. margin: 10rpx;
  738. height: 72rpx;
  739. border: 1px solid rgba(213, 213, 213, 1);
  740. border-radius: 6rpx;
  741. }
  742. .batchNoCheck {
  743. color: #FFF;
  744. border: 1rpx solid rgba(22, 132, 252, 1);
  745. background-color: rgba(22, 132, 252, 1);
  746. }
  747. }
  748. .vehicleList {
  749. justify-content: flex-start;
  750. flex-wrap: wrap;
  751. width: auto;
  752. height: 120rpx;
  753. overflow: auto;
  754. padding: 0 80rpx;
  755. .vehicleNo {
  756. padding: 0 10rpx;
  757. margin: 10rpx;
  758. justify-content: space-between;
  759. align-items: center;
  760. width: 230rpx;
  761. height: 60rpx;
  762. border: 1px solid rgba(213, 213, 213, 1);
  763. border-radius: 6rpx;
  764. }
  765. }
  766. .middle {
  767. display: flex;
  768. flex-direction: row;
  769. align-items: center;
  770. justify-content: center
  771. }
  772. .segment {
  773. width: 280rpx;
  774. background-color: rgba(213, 213, 213, 1);
  775. border: 1rpx solid rgba(213, 213, 213, 1);
  776. }
  777. .info {
  778. width: 94%;
  779. justify-content: space-around;
  780. padding: 10rpx;
  781. margin: 0 auto;
  782. label {
  783. flex: 1;
  784. text-combine-upright: all;
  785. margin: 0 30rpx 0 20rpx;
  786. }
  787. text {
  788. flex: 3;
  789. // width: 80%;
  790. }
  791. .data-select {
  792. flex: 3;
  793. width: 80%;
  794. height: 60rpx;
  795. margin-right: 40rpx;
  796. border-radius: 18rpx;
  797. background-color: #FFF;
  798. .data-select-options {
  799. width: 200rpx;
  800. }
  801. }
  802. }
  803. .material {
  804. height: auto;
  805. width: 60%;
  806. }
  807. .selectedProcess {
  808. width: 88%;
  809. margin: 20rpx auto 40rpx;
  810. }
  811. .mask {
  812. position: fixed;
  813. top: 0;
  814. left: 0;
  815. right: 0;
  816. bottom: 0;
  817. background-color: rgba(0, 0, 0, 0.5);
  818. z-index: 2000;
  819. display: flex;
  820. justify-content: center;
  821. align-items: center;
  822. }
  823. .mask .loading-text {
  824. color: #fff;
  825. font-size: 36rpx;
  826. }
  827. </style>