车间生产:
1、成品条码完善:根据生产计划明细生成条码,并且在完成明细后才能生成
2、四楼装配区域条码枪对接完成,包括扫描物料确认和成品入库功能。
master
xs 5 months ago
parent 737f6762c0
commit 3cc7e0aae9

@ -106,7 +106,7 @@ public class MesConstants {
/**物料信息绑定标识,是否需要采购订单明细绑定销售订单*/
public static final String MES_MATERIAL_BIND_FLAG_YES = "1";//是
public static final String MES_MATERIAL_BIND_FLAG_NO = "0";//否
/**物料条码打印标识*/
public static final String MES_BARCODE_PRINT_FLAG_YES = "1";//是

@ -239,7 +239,7 @@ public class MesBaseBarcodeInfoController extends BaseController
@PostMapping(value="/addProductBarcode")
public AjaxResult addProductBarcode(@RequestBody MesBaseBarcodeInfo mesBaseBarcodeInfo)
{
mesBaseBarcodeInfo.setCreateBy(SecurityUtils.getUsername());
return toAjax(mesBaseBarcodeInfoService.insertMesBaseBarcodeInfo(mesBaseBarcodeInfo));
}
}

@ -17,10 +17,7 @@ import com.hw.common.core.utils.uuid.Seq;
import com.hw.common.security.utils.SecurityUtils;
import com.hw.mes.api.domain.MesBaseBarcodeInfo;
import com.hw.mes.api.domain.MesBaseMaterialInfo;
import com.hw.mes.domain.MesBaseAbandonBarcode;
import com.hw.mes.domain.MesBasePalletInfo;
import com.hw.mes.domain.MesOrderBind;
import com.hw.mes.domain.MesProductOrder;
import com.hw.mes.domain.*;
import com.hw.mes.domain.vo.MesBindBarcodeVo;
import com.hw.mes.mapper.*;
@ -65,6 +62,9 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
@Autowired
private MesBaseAbandonBarcodeMapper mesBaseAbandonBarcodeMapper;
@Autowired
private MesProductPlanMapper mesProductPlanMapper;
/**
*
*
@ -188,30 +188,40 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
public void generateProductBarcode(MesBaseBarcodeInfo mesBaseBarcodeInfo) {
int dispatchAmount = mesBaseBarcodeInfo.getDispatchAmount().intValue();
int generateAmount = mesBaseBarcodeInfo.getAmount().intValue();//获取要生成的条码数量,目前也是派工的数量
String planCode = mesBaseBarcodeInfo.getPlanCode();
String planDetailCode = mesBaseBarcodeInfo.getPlanDetailCode();
MesBaseBarcodeInfo queryBarcodeInfo = new MesBaseBarcodeInfo();
queryBarcodeInfo.setPlanCode(planCode);
queryBarcodeInfo.setPlanDetailCode(planDetailCode);
List<MesBaseBarcodeInfo> mesBaseBarcodeInfos = mesBaseBarcodeInfoMapper.selectMesBaseBarcodeInfoList(queryBarcodeInfo);
int hadGeneratedLabelCount = mesBaseBarcodeInfos == null ? 0 : mesBaseBarcodeInfos.size();//获取已经生成条码的数量
if (generateAmount + hadGeneratedLabelCount > dispatchAmount) {
throw new ServiceException("新增条码数量总数不能大于" + dispatchAmount);
if (mesBaseBarcodeInfos != null && !mesBaseBarcodeInfos.isEmpty()) {
throw new ServiceException("此计划明细已经生成条码,不能重复生成");
}
Date currentDate = new Date();
for (int i = 0; i < generateAmount; i++) {
String barcode = Seq.getId(Seq.mesCompBarcodeSeqType, Seq.mesCompBarcodeCode);
mesBaseBarcodeInfo.setBatchCode(barcode);// 成品的批次代码 == 条码内容
mesBaseBarcodeInfo.setBarcodeInfo(barcode);
mesBaseBarcodeInfo.setAmount(new BigDecimal(1));
mesBaseBarcodeInfo.setCreateTime(currentDate);
mesBaseBarcodeInfo.setBatchFlag(MesConstants.NOT_IS_BATCH);
mesBaseBarcodeInfo.setSafeFlag(MesConstants.MES_ORDER_BIND_SAFE_FLAG_YES);
mesBaseBarcodeInfoMapper.insertMesBaseBarcodeInfo(mesBaseBarcodeInfo);
MesProductPlan productPlan = mesProductPlanMapper.selectOnlyMesProductPlanByPlanCode(planCode);
if(productPlan == null){
throw new ServiceException("此生产任务不存在");
}
Date currentDate = new Date();
String barcode = Seq.getId(Seq.mesCompBarcodeSeqType, Seq.mesCompBarcodeCode);
mesBaseBarcodeInfo.setBatchCode(barcode);// 成品的批次代码 == 条码内容
mesBaseBarcodeInfo.setBarcodeInfo(barcode);
mesBaseBarcodeInfo.setAmount(new BigDecimal(1));
mesBaseBarcodeInfo.setBatchFlag(MesConstants.NOT_IS_BATCH);
mesBaseBarcodeInfo.setSafeFlag(MesConstants.MES_ORDER_BIND_SAFE_FLAG_YES);
mesBaseBarcodeInfo.setMaterialId(productPlan.getMaterialId());
mesBaseBarcodeInfo.setPrintFlag(MesConstants.MES_BARCODE_PRINT_FLAG_NO);
mesBaseBarcodeInfo.setSaleOrderId(productPlan.getSaleOrderId());
mesBaseBarcodeInfo.setSaleorderCode(productPlan.getSaleorderCode());
mesBaseBarcodeInfo.setCreateTime(currentDate);
mesBaseBarcodeInfo.setCreateBy(SecurityUtils.getUsername());
mesBaseBarcodeInfoMapper.insertMesBaseBarcodeInfo(mesBaseBarcodeInfo);
}

@ -345,7 +345,7 @@
<select id="selectOnlyMesProductPlanByPlanCode" parameterType="String" resultMap="MesProductPlanMesProductPlanDetailResult">
<select id="selectOnlyMesProductPlanByPlanCode" parameterType="String" resultMap="MesProductPlanResult">
select a.plan_id,
a.product_order_id,
a.plan_code,
@ -357,6 +357,8 @@
a.last_process_id,
a.station_id,
a.user_id,
a.sale_order_id,
a.saleorder_code,
a.production_time,
a.dispatch_amount,
a.plan_amount,

@ -43,7 +43,7 @@ export function delBarcode(barcodeId) {
})
}
// 打印条码
// 打印原材料条码
export function printBarcodes(barcodeIds) {
return request({
url: '/mes/barcode/printBarcodes/' + barcodeIds,
@ -88,3 +88,42 @@ export function regenerateBarcode(data) {
data: data
})
}
// 打印成品条码
export function printProductBarcodes(barcodeIds) {
return request({
url: '/mes/barcode/printProductBarcodes/' + barcodeIds,
method: 'get'
})
}
// 重新生成成品条码信息,之前的条码作废
export function regenerateProductBarcode(data) {
return request({
url: '/mes/barcode/regenerateProductBarcode',
method: 'post',
data: data
})
}
// 查询成品条码信息列表
export function listProductBarcode(query) {
return request({
url: '/mes/barcode/listProductBarcode',
method: 'get',
params: query
})
}
// 新增成品条码信息
export function addProductBarcode(data) {
return request({
url: '/mes/barcode/addProductBarcode',
method: 'post',
data: data
})
}

@ -0,0 +1,73 @@
export const monitorSerialData = {
data() {
return {
serialPort: null,
reader: null,
decoder: new TextDecoder(),
barcode: '',//临时拼装数据使用
serialData: ''//获得的最终的条码数据
};
},
methods: {
checkSerialConnected() {
if (this.serialPort && this.serialPort.readable) {
console.log("串口当前已连接");
return true;
} else {
console.log("串口未连接或已断开");
return false;
}
},
async connectSerial(callback) {
try {
// 请求串口访问权限
this.serialPort = await navigator.serial.requestPort();
await this.serialPort.open({baudRate: 9600}); // 假设条码枪的波特率为9600
// 设置数据流解码
this.decoder = new TextDecoderStream();
const readableStreamClosed = this.serialPort.readable.pipeTo(this.decoder.writable);
this.reader = this.decoder.readable.getReader();
// 监听串口数据
while (true) {
const {value, done} = await this.reader.read();
if (done) {
this.reader.releaseLock();
break;
}
// console.log("---"+value);
// const data = this.decoder.decode(value);
this.processReceivedData(value,callback);
}
} catch (error) {
console.error('连接或读取串口时发生错误:', error);
}
},
processReceivedData(data,callback) {
// 假设条码数据以回车符或换行符结束
const barcodeEnd = /\r|\n/;
// console.log("---:" + data)
if (barcodeEnd.test(data)) {
const barcode = data.split(barcodeEnd)[0].trim(); // 获取并清理条码数据
console.log('扫描到的条码:', this.barcode + barcode);
this.serialData = this.barcode + barcode;
// 调用传入的函数
if (typeof callback === 'function') {
callback();
}
this.barcode = '';
} else {
this.barcode += data;
}
},
}
};

@ -7,72 +7,65 @@
<div class="chart">
<div class="whiteTable">
<el-table
:cell-style="{textAlign:'center'}"
:data="tableData"
:header-cell-style="{textAlign:'center'}"
:max-height="19.13 * vw"
style="width: 100%"
:cell-style="{textAlign:'center'}"
:data="tableData"
:header-cell-style="{textAlign:'center'}"
:max-height="19.13 * vw"
style="width: 100%"
>
<el-table-column
label="序号"
type="index"
width="50"
label="序号"
type="index"
width="50"
>
</el-table-column>
<el-table-column
label="工单编号"
prop="planCode"
label="工单编号"
prop="planCode"
>
</el-table-column>
<el-table-column
label="物料名称"
prop="materialName"
width="100"
label="物料名称"
prop="materialName"
width="100"
>
</el-table-column>
<el-table-column
label="计划"
prop="planAmount"
width="100"
label="计划"
prop="planAmount"
width="100"
>
</el-table-column>
<el-table-column
label="实际"
prop="completeAmount"
width="100"
label="实际"
prop="completeAmount"
width="100"
>
</el-table-column>
<el-table-column
label="差异"
prop="difference"
width="100"
label="差异"
prop="difference"
width="100"
>
<template slot-scope="scope">
{{ scope.row.planAmount - scope.row.completeAmount }}
</template>
</el-table-column>
<el-table-column
label="交付时间"
prop="planDeliveryDate"
width="150"
label="交付时间"
prop="planDeliveryDate"
width="150"
>
</el-table-column>
<el-table-column
label="操作"
width="120"
label="操作"
width="120"
>
<template slot-scope="scope">
<el-button
size="small"
type="text"
@click="print(scope.row)"
>
条码打印
</el-button>
<el-button
size="small"
type="text"
@click="getDetail(scope)"
size="small"
type="text"
@click="getDetail(scope)"
>
明细
</el-button>
@ -103,86 +96,97 @@
<div class="chart">
<div class="whiteTable">
<el-table
:cell-style="{textAlign:'center'}"
:data="tableData1"
:header-cell-style="{textAlign:'center'}"
:max-height="19.13 * vw"
style="width: 100%"
:cell-style="{textAlign:'center'}"
:data="tableData1"
:header-cell-style="{textAlign:'center'}"
:max-height="19.13 * vw"
style="width: 100%"
>
<el-table-column
label="序号"
type="index"
width="50"
label="序号"
type="index"
width="50"
>
</el-table-column>
<el-table-column
label="工单编号"
prop="planCode"
width="80"
label="工单编号"
prop="planCode"
width="80"
>
</el-table-column>
<el-table-column
label="明细编号"
prop="planDetailCode"
label="明细编号"
prop="planDetailCode"
>
</el-table-column>
<el-table-column
label="开始时间"
prop="realBeginTime"
width="120"
label="开始时间"
prop="realBeginTime"
width="120"
>
</el-table-column>
<el-table-column
label="结束时间"
prop="realEndTime"
width="120"
label="结束时间"
prop="realEndTime"
width="120"
>
</el-table-column>
<el-table-column
label="状态"
prop="createTime"
width="80"
label="状态"
prop="createTime"
width="80"
>
<template slot-scope="scope">
<dict-tag :options="dict.type.mes_plan_detail_status" :value="scope.row.planDetailStatus"/>
</template>
</el-table-column>
<el-table-column
label="操作"
width="160"
label="操作"
width="160"
>
<template slot-scope="scope">
<el-button
v-if="scope.row.planDetailStatus !== '3' && scope.row.planDetailStatus !== '9'"
size="small"
type="text"
@click="planExecute(scope.row)"
v-if="scope.row.planDetailStatus !== '3' && scope.row.planDetailStatus !== '9'"
size="small"
type="text"
@click="planExecute(scope.row)"
>
{{ scope.row.planDetailStatus === '1' ? '开始' : '完成' }}
</el-button>
<el-button
v-if="scope.row.planDetailStatus !== '3' && scope.row.planDetailStatus !== '9'"
size="small"
type="text"
@click="getMaterials(scope) "
v-if="scope.row.planDetailStatus !== '3' && scope.row.planDetailStatus !== '9'"
size="small"
type="text"
@click="getMaterials(scope) "
>
领料
</el-button>
<el-button
@click="handleMaterialConfirmForm(scope)"
size="small"
type="text"
@click="handleMaterialConfirmForm(scope)"
size="small"
type="text"
v-if="scope.row.planDetailStatus === PLAN_DETAIL_STATUS.STARTED"
>
扫描
</el-button>
<el-button
size="small"
type="text"
@click="returnMaterial(scope)"
size="small"
type="text"
@click="returnMaterial(scope)"
v-if="scope.row.planDetailStatus !== PLAN_DETAIL_STATUS.TO_START"
>
退料
</el-button>
<el-button
size="small"
type="text"
@click="print(scope.row)"
v-if="scope.row.planDetailStatus === PLAN_DETAIL_STATUS.FINISHED || scope.row.planDetailStatus === PLAN_DETAIL_STATUS.ABNORMAL_FINISHED"
>
条码
</el-button>
</template>
</el-table-column>
</el-table>
@ -209,16 +213,16 @@
<el-row>
<el-button type="primary">首页</el-button>
<el-button type="success" @click="handleProductInstock"></el-button>
<el-button type="warning" @click="connectSerial"></el-button>
<!--el-button type="warning" @click="connectSerialPort" ref="connectSerialBtn">连接条码枪</el-button-->
<!--el-button type="info">最小化</el-button-->
<el-button type="danger" @click="logout">退</el-button>
</el-row>
</div>
<el-dialog
:visible.sync="dialogVisible"
title="领料"
width="40%">
:visible.sync="dialogVisible"
title="领料"
width="40%">
<el-form ref="form" :model="form" label-width="80px">
<el-form-item label="工单编号">
<el-input v-model="form.planCode" disabled></el-input>
@ -237,65 +241,65 @@
</el-form-item>
</el-form>
<el-table
:cell-style="{textAlign:'center'}"
:data="form.wmsRawOutstockDetailList"
:header-cell-style="{textAlign:'center'}"
max-height="19.13vw"
style="width: 100%"
:cell-style="{textAlign:'center'}"
:data="form.wmsRawOutstockDetailList"
:header-cell-style="{textAlign:'center'}"
max-height="19.13vw"
style="width: 100%"
>
<el-table-column
label="物料编号"
prop="materialCode"
label="物料编号"
prop="materialCode"
>
</el-table-column>
<el-table-column
label="物料名称"
prop="materialName"
label="物料名称"
prop="materialName"
>
</el-table-column>
<el-table-column
label="安全库存"
prop="safeFlag"
label="安全库存"
prop="safeFlag"
>
<template slot-scope="scope">
<dict-tag :options="dict.type.mes_safe_flag" :value="scope.row.safeFlag"/>
</template>
</el-table-column>
<el-table-column
label="可用库存数量"
prop="availableAmount"
label="可用库存数量"
prop="availableAmount"
>
</el-table-column>
<el-table-column
label="占用库存数量"
prop="unavailableAmount"
label="占用库存数量"
prop="unavailableAmount"
>
</el-table-column>
<el-table-column
label="领取数量"
prop="planAmount"
width="120"
label="领取数量"
prop="planAmount"
width="120"
>
<template slot-scope="scope">
<el-input-number
v-model="scope.row.planAmount"
:min="0"
controls-position="right"
style="width: 100%"
v-model="scope.row.planAmount"
:min="0"
controls-position="right"
style="width: 100%"
>
</el-input-number>
</template>
</el-table-column>
<el-table-column
label="操作"
width="160"
label="操作"
width="160"
>
<template slot="header" slot-scope="scope">
<el-input
v-model="searchMaterialValue"
placeholder="输入物料名称搜索"
size="mini"
@change="searchMaterial"/>
v-model="searchMaterialValue"
placeholder="输入物料名称搜索"
size="mini"
@change="searchMaterial"/>
</template>
</el-table-column>
</el-table>
@ -306,8 +310,8 @@
<el-dialog :visible.sync="printModel" title="条码打印" width="80%" class="dialog">
<div >
<PrintPage :defineData="PrintData" />
<div>
<PrintPage :defineData="PrintData"/>
</div>
<div slot="footer" class="dialog-footer">
<el-button @click="printModel = false">关闭</el-button>
@ -316,9 +320,9 @@
<el-dialog
:visible.sync="productInstockVisible"
title="成品入库"
width="40%">
:visible.sync="productInstockVisible"
title="成品入库"
width="40%">
<el-form ref="productInstockForm" :model="productInstockForm" :rules="productInstockRules" label-width="80px">
<el-form-item label="成品条码" prop="materialBarcode">
<el-input v-model="productInstockForm.materialBarcode"></el-input>
@ -332,21 +336,21 @@
<el-dialog
:visible.sync="materialConfirmVisible"
title="确认物料使用"
width="40%">
:visible.sync="materialConfirmVisible"
title="确认物料使用"
width="40%">
<el-form ref="materialConfirmForm" :model="materialConfirmForm" :rules="materialConfirmRules" label-width="80px">
<el-form-item label="计划ID" prop="planId" v-if="false">
<el-input v-model="materialConfirmForm.planId"></el-input>
</el-form-item>
<el-form-item label="明细ID" prop="planDetailId" v-if="false">
<el-input v-model="materialConfirmForm.planDetailId"></el-input>
<el-form-item label="明细编号" prop="planDetailCode">
<el-input v-model="materialConfirmForm.planDetailCode" disabled></el-input>
</el-form-item>
<el-form-item label="物料条码" prop="materialBarcode">
<el-input v-model="materialConfirmForm.materialBarcode"></el-input>
<el-input v-model="materialConfirmForm.materialBarcode" suffix-icon="el-icon-scan"></el-input>
</el-form-item>
<el-form-item label="数量" prop="checkAmount">
<el-input v-model="materialConfirmForm.checkAmount"></el-input>
<el-input v-model="materialConfirmForm.checkAmount" disabled></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
@ -356,34 +360,37 @@
</el-dialog>
<el-dialog :visible.sync="returnModelVisible" title="退料" width="25%">
<el-form ref="returnModelForm" :model="returnModelForm" label-width="80px" :rules="returnModelFormRules">
<el-form-item label="计划编号" >
<el-form-item label="计划编号">
<el-input v-model="returnModelForm.planCode" autocomplete="off" disabled></el-input>
</el-form-item>
<el-form-item label="明细编号" >
<el-form-item label="明细编号">
<el-input v-model="returnModelForm.planDetailCode" autocomplete="off" disabled></el-input>
</el-form-item>
<el-form-item label="成品" >
<el-form-item label="成品">
<el-input v-model="returnModelForm.materialName" autocomplete="off" disabled></el-input>
</el-form-item>
<el-form-item label="物料条码" >
<el-input placeholder="请输入内容" v-model="returnModelForm.materialBarcode" class="input-with-select" @blur="setReturnModelForm">
<el-form-item label="物料条码">
<el-input placeholder="请输入内容" v-model="returnModelForm.materialBarcode" class="input-with-select"
@blur="setReturnModelForm">
<el-button slot="append" icon="el-icon-search"></el-button>
</el-input>
</el-form-item>
<el-form-item label="仓库" >
<el-select v-model="returnModelForm.warehouseId" placeholder="请选择仓库" :disabled="!returnModelForm.materialBarcode">
<el-form-item label="仓库">
<el-select v-model="returnModelForm.warehouseId" placeholder="请选择仓库"
:disabled="!returnModelForm.materialBarcode">
<el-option :label="i.label" :key="i.value" :value="i.value" v-for="i in WarehousesList"></el-option>
</el-select>
</el-form-item>
<el-form-item label="数量" >
<el-input-number v-model="returnModelForm.planAmount" controls-position="right" :min="1" ></el-input-number>
<el-form-item label="数量">
<el-input-number v-model="returnModelForm.planAmount" controls-position="right" :min="1"></el-input-number>
</el-form-item>
<el-form-item label="退库类型" prop="taskType">
<el-select v-model="returnModelForm.taskType" placeholder="请选择退库类型">
<el-option :label="i.label" :key="i.value" :value="i.value" v-for="i in dict.type.wms_raw_return_task_type"></el-option>
<el-option :label="i.label" :key="i.value" :value="i.value"
v-for="i in dict.type.wms_raw_return_task_type"></el-option>
</el-select>
</el-form-item>
<el-form-item label="申请原因" >
<el-form-item label="申请原因">
<el-input type="textarea" v-model="returnModelForm.applyReason" autocomplete="off"></el-input>
</el-form-item>
<el-form-item>
@ -410,29 +417,29 @@ import {
fourthFloorProduceInstock,
scanMaterial2Confirm, applyRawReturn
} from "@/api/board";
import {monitorSerialData} from "@/utils/serial"
const vw = (document.documentElement.clientWidth || document.body.clientWidth) / 100
export default {
name: 'Board1',
dicts: ['mes_plan_detail_status','wms_raw_return_task_type','mes_safe_flag'],
dicts: ['mes_plan_detail_status', 'wms_raw_return_task_type', 'mes_safe_flag'],
mixins: [monitorSerialData],
components: {
Chart,
PrintPage
},
data() {
return {
serialPort: null,
reader: null,
lastScannedBarcode: '',
decoder: new TextDecoder(),
// serialPort: null,
// reader: null,
// decoder: new TextDecoder(),
// barcode: '',
returnModelVisible: false,
returnModelForm:{},
WarehousesList:[],
PrintData:{},
returnModelForm: {},
WarehousesList: [],
PrintData: {},
printModel: false,
nowNum1: 1,
totalNum1: 0,
@ -454,7 +461,7 @@ export default {
},
productInstockRules: {
materialBarcode: [
{ required: true, message: "成品条码不能为空", trigger: "blur" }
{required: true, message: "成品条码不能为空", trigger: "blur"}
],
},
@ -462,26 +469,39 @@ export default {
materialConfirmForm: {
materialBarcode: null,
planId: null,
planDetailId:null,
checkAmount:null
planDetailId: null,
planDetailCode: null,
checkAmount: 1
},
materialConfirmRules: {
materialBarcode: [
{ required: true, message: "物料条码不能为空", trigger: "blur" }
{required: true, message: "物料条码不能为空", trigger: "blur"}
],
checkAmount: [
{ required: true, message: "数量不能为空", trigger: "blur" }
{required: true, message: "数量不能为空", trigger: "blur"}
],
},
returnModelFormRules: {
taskType: [
{ required: true, message: '请选择退库类型', trigger: 'change' }
{required: true, message: '请选择退库类型', trigger: 'change'}
],
},
PLAN_DETAIL_STATUS:{
TO_START : '1',
STARTED : '2',
FINISHED : '3',
ABNORMAL_FINISHED : '9'
}
}
},
created() {
},
mounted() {
this.firstConnectSerial();
// setInterval(() => {
// this.$notify.info({
// title: '',
@ -676,56 +696,63 @@ export default {
methods: {
checkPortConnection(){
checkPortConnection(portName).then((isConnected) => {
if (isConnected) {
console.log('串口已连接并可用.');
} else {
console.log('串口未连接或不可用.');
}
}).catch((error) => {
console.error('检查串口连接时发生错误:', error);
});
},
async connectSerial() {
try {
// 访
this.serialPort = await navigator.serial.requestPort();
await this.serialPort.open({ baudRate: 9600 }); // 9600
//
this.decoder = new TextDecoderStream();
const readableStreamClosed = this.serialPort.readable.pipeTo(this.decoder.writable);
this.reader = this.decoder.readable.getReader();
//
while (true) {
const { value, done } = await this.reader.read();
if (done) {
this.reader.releaseLock();
break;
}
// console.log("---"+value);
// const data = this.decoder.decode(value);
this.processReceivedData(value);
}
} catch (error) {
console.error('连接或读取串口时发生错误:', error);
}
},
processReceivedData(data) {
//
const barcodeEnd = /\r|\n/;
if (barcodeEnd.test(data)) {
const barcode = data.split(barcodeEnd)[0].trim(); //
this.lastScannedBarcode = barcode; //
console.log('扫描到的条码:', barcode);
}
},
// triggerButtonClick() {
// // DOM
// this.$nextTick(() => {
// if (this.$refs.connectSerialBtn) {
// // DOMclick
// this.$refs.connectSerialBtn.handleClick();
// }
// });
// },
// async connectSerial() {
// this.checkPortConnection();
// try {
// // 访
// this.serialPort = await navigator.serial.requestPort();
// await this.serialPort.open({baudRate: 9600}); // 9600
//
// //
// this.decoder = new TextDecoderStream();
// const readableStreamClosed = this.serialPort.readable.pipeTo(this.decoder.writable);
// this.reader = this.decoder.readable.getReader();
//
// //
// while (true) {
// const {value, done} = await this.reader.read();
// if (done) {
// this.reader.releaseLock();
// break;
// }
//
// // console.log("---v" + value);
// // console.log("---d:" + done);
// // const data = this.decoder.decode(value);
// this.processReceivedData(value);
// }
// } catch (error) {
// console.error(':', error);
// }
// },
// processReceivedData(data) {
// //
// const barcodeEnd = /\r|\n/;
// // console.log("---:" + data)
// if (barcodeEnd.test(data)) {
// const barcode = data.split(barcodeEnd)[0].trim(); //
// // console.log(':', this.barcode + barcode);
// if (this.materialConfirmVisible) {
// this.materialConfirmForm.materialBarcode = this.barcode + barcode;
// } else if (this.productInstockVisible) {
// this.productInstockForm.materialBarcode = this.barcode + barcode;
// }
//
// this.barcode = '';
// } else {
// this.barcode += data;
// }
// },
@ -739,7 +766,8 @@ export default {
this.$store.dispatch('LogOut').then(() => {
location.href = '/login?isStationId=true';
})
}).catch(() => {});
}).catch(() => {
});
},
next1() {
this.nowNum1 += 1
@ -780,20 +808,20 @@ export default {
startProductPlanDetail({
planDetailId: e.planDetailId
})
.finally(() => {
this.getDetail({row: {planId: e.planId}})
getProductPlans({pageNum: this.nowNum1, pageSize: 5}).then(e => {
this.tableData = e.rows
this.totalNum1 = Math.ceil(e.total / 5)
.finally(() => {
this.getDetail({row: {planId: e.planId}})
getProductPlans({pageNum: this.nowNum1, pageSize: 5}).then(e => {
this.tableData = e.rows
this.totalNum1 = Math.ceil(e.total / 5)
})
})
})
})
.catch(() => {
this.$message({
type: 'info',
message: '已取消'
});
})
.catch(() => {
this.$message({
type: 'info',
message: '已取消'
});
})
}
if (e.planDetailStatus === '2') {
this.$confirm('是否完成计划', '确认', {
@ -804,20 +832,20 @@ export default {
completeProductPlanDetail({
planDetailId: e.planDetailId
})
.finally(() => {
this.getDetail({row: {planId: e.planId}})
getProductPlans({pageNum: this.nowNum1, pageSize: 5}).then(e => {
this.tableData = e.rows
this.totalNum1 = Math.ceil(e.total / 5)
.finally(() => {
this.getDetail({row: {planId: e.planId}})
getProductPlans({pageNum: this.nowNum1, pageSize: 5}).then(e => {
this.tableData = e.rows
this.totalNum1 = Math.ceil(e.total / 5)
})
})
})
})
.catch(() => {
this.$message({
type: 'info',
message: '已取消'
});
})
.catch(() => {
this.$message({
type: 'info',
message: '已取消'
});
})
}
},
// /
@ -846,12 +874,12 @@ export default {
});
})
})
.catch(() => {
this.$message({
type: 'info',
message: '已取消'
});
})
.catch(() => {
this.$message({
type: 'info',
message: '已取消'
});
})
} else {
this.tableData1 = res.rows
this.totalNum2 = Math.ceil(res.total / 5)
@ -869,7 +897,7 @@ export default {
planId: val.row.planId,
planCode: val.row.planCode,
planDetailCode: val.row.planDetailCode,
saleOrderId : this.saleOrderId,
saleOrderId: this.saleOrderId,
applyReason: '',
taskType: '1',
wmsRawOutstockDetailList: []
@ -941,10 +969,30 @@ export default {
handleProductInstock() {
this.resetProductInstock();
this.productInstockVisible = true;
if (!this.checkSerialConnected()) {
this.$confirm('请连接条码枪', '提示', {
confirmButtonText: '连接',
showClose: true,
// beforeClose:async(action,instance,done)=>{
// if(action==='confirm'){
// }else{
// this.connectSerialPort();
// }
//
// },
showCancelButton: true,
type: 'warning'
}).then(() => {
console.log("dddd")
this.connectSerial(this.setSerialData);
}).catch(() => {
});
}
},
submitProductInstock(){
submitProductInstock() {
this.$refs["productInstockForm"].validate(valid => {
if (valid) {
fourthFloorProduceInstock(this.productInstockForm).then(response => {
@ -955,38 +1003,53 @@ export default {
});
},
cancelProductInstock(){
cancelProductInstock() {
this.productInstockVisible = false;
this.resetProductInstock();
},
//
resetMaterialConfirm() {
this.materialConfirmForm = {
materialBarcode: null,
planId: null,
planDetailId:null,
checkAmount:null
planDetailId: null,
planDetailCode: null,
checkAmount: 1
};
this.resetForm("materialConfirmForm");
},
/** 成品入库按钮操作 */
/** 物料扫描按钮操作 */
handleMaterialConfirmForm(scope) {
this.materialConfirmForm = {
materialBarcode: null,
planId: scope.row.planId,
planDetailId:scope.row.planDetailId,
checkAmount:null
planDetailId: scope.row.planDetailId,
planDetailCode: scope.row.planDetailCode,
checkAmount: 1
};
this.materialConfirmVisible = true;
if (!this.checkSerialConnected()) {
this.$confirm('请连接条码枪', '提示', {
confirmButtonText: '连接',
showClose: true,
showCancelButton: true,
type: 'warning'
}).then(() => {
console.log("dddd")
this.connectSerial(this.setSerialData);
}).catch(() => {
});
}
},
submitMaterialConfirm(){
submitMaterialConfirm() {
this.$refs["materialConfirmForm"].validate(valid => {
if (valid) {
scanMaterial2Confirm(this.materialConfirmForm).then(response => {
@ -997,7 +1060,7 @@ export default {
});
},
cancelMaterialConfirm(){
cancelMaterialConfirm() {
this.materialConfirmVisible = false;
this.resetMaterialConfirm();
},
@ -1006,29 +1069,29 @@ export default {
this.returnModelVisible = true
this.returnModelForm = e.row
},
setReturnModelForm(){
setReturnModelForm() {
getWarehouses({
warehouseFloor:4,
materialBarcode:this.returnModelForm.materialBarcode
}).then(e=>{
this.WarehousesList = e.data.map(v=>{
warehouseFloor: 4,
materialBarcode: this.returnModelForm.materialBarcode
}).then(e => {
this.WarehousesList = e.data.map(v => {
return {
label:v.warehouseName,
value:v.warehouseId,
label: v.warehouseName,
value: v.warehouseId,
}
})
})
},
returnModelConfirm(){
returnModelConfirm() {
this.$refs.returnModelForm.validate((valid) => {
if (valid) {
let data = {}
let keys = ['warehouseId','planCode','planDetailCode','productId','materialBarcode','planAmount','taskType','applyReason']
keys.forEach(v=>{
let keys = ['warehouseId', 'planCode', 'planDetailCode', 'productId', 'materialBarcode', 'planAmount', 'taskType', 'applyReason']
keys.forEach(v => {
data[v] = this.returnModelForm[v]
})
applyRawReturn(data).then(v=>{
if(v.code === 200){
applyRawReturn(data).then(v => {
if (v.code === 200) {
this.$message({
message: '退库成功',
type: 'success'
@ -1040,7 +1103,43 @@ export default {
return false;
}
});
},
firstConnectSerial() {
if (!this.checkSerialConnected()) {
this.$confirm('请连接条码枪', '提示', {
confirmButtonText: '连接',
showClose: true,
// beforeClose:async(action,instance,done)=>{
// if(action==='confirm'){
// }else{
// this.connectSerialPort();
// }
//
// },
showCancelButton: true,
type: 'warning'
}).then(() => {
this.connectSerial(this.setSerialData);
}).catch(() => {
});
}
},
setSerialData() {
// if (!this.checkSerialConnected()) {//
// }
if (this.materialConfirmVisible) {
this.materialConfirmForm.materialBarcode = this.serialData;
} else if (this.productInstockVisible) {
this.productInstockForm.materialBarcode = this.serialData;
}
// console.log(this.serialData)
}
}
}
</script>

@ -1,26 +1,6 @@
<template>
<div class="app-container">
<el-form v-show="showSearch" ref="queryForm" :inline="true" :model="queryParams" label-width="100px" size="small">
<!-- <el-form-item label="批次标识" prop="batchFlag">-->
<!-- <el-select v-model="queryParams.batchFlag" placeholder="请选择批次标识" clearable>-->
<!-- <el-option-->
<!-- v-for="dict in dict.type.active_flag"-->
<!-- :key="dict.value"-->
<!-- :label="dict.label"-->
<!-- :value="dict.value"-->
<!-- />-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<!-- <el-form-item label="条码类型" prop="barcodeType">-->
<!-- <el-select v-model="queryParams.barcodeType" placeholder="请选择条码类型" clearable>-->
<!-- <el-option-->
<!-- v-for="dict in dict.type.barcode_type"-->
<!-- :key="dict.value"-->
<!-- :label="dict.label"-->
<!-- :value="dict.value"-->
<!-- />-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<!--el-form v-show="showSearch" ref="queryForm" :inline="true" :model="queryParams" label-width="100px" size="small">
<el-form-item label="销售订单编号" prop="saleorderCode">
<el-input
v-model="queryParams.saleorderCode"
@ -35,7 +15,7 @@
<el-button icon="el-icon-search" size="mini" type="primary" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
</el-form-->
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
@ -76,6 +56,7 @@
</template>
</el-table-column>
<el-table-column v-if="columns[17].visible" align="center" label="生产计划编号" prop="planCode" width="110"/>
<el-table-column v-if="columns[17].visible" align="center" label="明细编号" prop="planDetailCode" width="110"/>
<el-table-column v-if="columns[20].visible" align="center" label="销售订单编号" prop="saleorderCode" width="110"/>
<el-table-column v-if="columns[13].visible" align="center" label="采购订单号" prop="poNo" width="100"/>
<el-table-column v-if="columns[5].visible" align="center" label="条码内容" prop="barcodeInfo" width="100"/>
@ -96,7 +77,7 @@
<span>{{ parseTime(scope.row.lastOutstockDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column v-if="columns[18].visible" align="center" label="生产计划明细编号" prop="planDetailCode"/>
<el-table-column v-if="columns[18].visible" align="center" label="计划明细编号" prop="planDetailCode"/>
<el-table-column v-if="columns[19].visible" align="center" label="销售订单ID" prop="saleOrderId"/>
<el-table-column v-if="columns[21].visible" align="center" label="项目号" prop="projectNo"/>
<el-table-column v-if="columns[23].visible" align="center" label="备注" prop="remark"/>
@ -139,6 +120,10 @@
<el-input v-model="form.planCode" :disabled = "true">
</el-input>
</el-form-item>
<el-form-item label="计划明细编号" prop="planDetailCode">
<el-input v-model="form.planDetailCode" :disabled = "true">
</el-input>
</el-form-item>
<!-- <el-form-item label="销售订单编号" prop="saleorderCode">-->
<!-- <el-input v-model="form.saleorderCode" :disabled="true" placeholder="请输入销售订单编号"/>-->
<!-- </el-form-item>-->
@ -160,12 +145,12 @@
<!-- <el-form-item label="托盘RFID代码" prop="palletInfoCode">-->
<!-- <el-input v-model="form.palletInfoCode" placeholder="请输入托盘RFID代码" />-->
<!-- </el-form-item>-->
<el-form-item v-if="false" label="物料ID" prop="materialId">
<!--el-form-item v-if="false" label="物料ID" prop="materialId">
<el-input v-model="form.materialId" placeholder="请输入物料ID"/>
</el-form-item>
<el-form-item label="物料名称" prop="materialName">
<el-input v-model="form.materialName" :disabled="true" placeholder="请输入物料名称"/>
</el-form-item>
</el-form-item-->
<!-- <el-form-item label="供应商ID" prop="manufacturerId">-->
<!-- <el-input v-model="form.manufacturerId" placeholder="请输入供应商ID" />-->
<!-- </el-form-item>-->
@ -223,7 +208,7 @@
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
<el-busubmittton @click="cancel"> </el-busubmittton>
</div>
</el-dialog>
@ -380,18 +365,14 @@ export default {
methods: {
getData() {
this.form = {
planId: this.defineData.planId,
planCode: this.defineData.planCode,
saleorderCode: this.defineData.saleorderCode,
materialId: this.defineData.materialId,
materialName: this.defineData.materialName,
planDetailCode: this.defineData.planDetailCode,
batchFlag:'0',
barcodeType:'3',
saleOrderId:null,
amount :this.defineData.dispatchAmount,
dispatchAmount : this.defineData.dispatchAmount,
amount :1,
}
this.queryParams.planCode = this.defineData.planCode;
this.queryParams.planDetailCode = this.defineData.planDetailCode;
},
/** 查询条码信息列表 */
@ -401,9 +382,10 @@ export default {
this.barcodeList = response.rows;
this.total = response.total;
if(this.total && this.total >0){
this.addBarcodeBtnVisible = true;
this.addBarcodeBtnVisible = false;
}else{
this.addBarcodeBtnVisible = true;
this.handleAdd();
}
this.loading = false;
});

Loading…
Cancel
Save