index.vue 23 KB

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