车间生产:
1、4楼激光切割工位板材入库、板材出库条码枪对接完成
master
xs 5 months ago
parent a8a4f9de4d
commit 5c2aea11c3

@ -186,28 +186,12 @@ public class MesProductPlanDetailServiceImpl implements IMesProductPlanDetailSer
throw new ServiceException("此生产计划已结束"); throw new ServiceException("此生产计划已结束");
} }
MesProductOrder productOrder = mesProductOrderMapper.selectMesProductOrderByProductOrderId(dbProductPlan.getProductOrderId());
if(productOrder==null){
throw new ServiceException("无此生产工单");
}
String orderStatus = productOrder.getOrderStatus();
if(!orderStatus.equals(MesConstants.BEGIN) && !orderStatus.equals(MesConstants.PUBLISHED)){
String orderStatusPrompt = MesConstants.ORDER_STATUS_PROMPT_MAP.get(orderStatus);
throw new ServiceException(String.format("此生产工单已经%s,不能开始!", orderStatusPrompt));
}
Date currentDate = new Date(); Date currentDate = new Date();
String userName = SecurityUtils.getUsername(); String userName = SecurityUtils.getUsername();
Long userId = SecurityUtils.getUserId(); Long userId = SecurityUtils.getUserId();
if(orderStatus.equals(MesConstants.PUBLISHED)){ startProductOrder(dbProductPlan,currentDate,userName);
productOrder.setOrderStatus(MesConstants.BEGIN);
productOrder.setRealBeginTime(currentDate);
productOrder.setUpdateBy(userName);
productOrder.setUpdateTime(currentDate);
mesProductOrderMapper.updateMesProductOrder(productOrder);
}
if (planStatus.equals(MesConstants.MES_PRODUCT_PLAN_STATUS_DISPATCHED)) { if (planStatus.equals(MesConstants.MES_PRODUCT_PLAN_STATUS_DISPATCHED)) {
dbProductPlan.setRealBeginTime(currentDate); dbProductPlan.setRealBeginTime(currentDate);
@ -338,7 +322,7 @@ public class MesProductPlanDetailServiceImpl implements IMesProductPlanDetailSer
public MesProductPlanDetail startNextMesProductPlanDetail(MesProductPlanDetail mesProductPlanDetail, String startType) { public MesProductPlanDetail startNextMesProductPlanDetail(MesProductPlanDetail mesProductPlanDetail, String startType) {
//根据planId获取最新一条的生产计划明细 //根据planId获取最新一条的生产计划明细
MesProductPlanDetail newestPlanDetail = mesProductPlanDetailMapper.selectNewestMesProductPlanDetail(mesProductPlanDetail); MesProductPlanDetail newestPlanDetail = mesProductPlanDetailMapper.selectNewestMesProductPlanDetail(mesProductPlanDetail);
//todo:在开始生产计划时,更新生产工单状态、开始时间;
//如果此计划有最新的计划明细 //如果此计划有最新的计划明细
if (newestPlanDetail != null) { if (newestPlanDetail != null) {
String planDetailStatus = newestPlanDetail.getPlanDetailStatus(); String planDetailStatus = newestPlanDetail.getPlanDetailStatus();
@ -384,6 +368,8 @@ public class MesProductPlanDetailServiceImpl implements IMesProductPlanDetailSer
String userName = SecurityUtils.getUsername(); String userName = SecurityUtils.getUsername();
Long userId = SecurityUtils.getUserId(); Long userId = SecurityUtils.getUserId();
startProductOrder(mesProductPlan,currentDate,userName);
if (planStatus.equals(MesConstants.MES_PRODUCT_PLAN_STATUS_DISPATCHED)) {//如果状态是已开始,需要修改计划的状态和开始时间 if (planStatus.equals(MesConstants.MES_PRODUCT_PLAN_STATUS_DISPATCHED)) {//如果状态是已开始,需要修改计划的状态和开始时间
mesProductPlan.setPlanStatus(MesConstants.MES_PRODUCT_PLAN_STATUS_STARTED); mesProductPlan.setPlanStatus(MesConstants.MES_PRODUCT_PLAN_STATUS_STARTED);
mesProductPlan.setRealBeginTime(currentDate); mesProductPlan.setRealBeginTime(currentDate);
@ -409,4 +395,28 @@ public class MesProductPlanDetailServiceImpl implements IMesProductPlanDetailSer
} }
public void startProductOrder(MesProductPlan productPlan,Date currentDate,String userName){
MesProductOrder productOrder = mesProductOrderMapper.selectMesProductOrderByProductOrderId(productPlan.getProductOrderId());
if(productOrder==null){
throw new ServiceException("无此生产工单");
}
String orderStatus = productOrder.getOrderStatus();
if(!orderStatus.equals(MesConstants.BEGIN) && !orderStatus.equals(MesConstants.PUBLISHED)){
String orderStatusPrompt = MesConstants.ORDER_STATUS_PROMPT_MAP.get(orderStatus);
throw new ServiceException(String.format("此生产工单已经%s,不能开始!", orderStatusPrompt));
}
if(orderStatus.equals(MesConstants.PUBLISHED)){
productOrder.setOrderStatus(MesConstants.BEGIN);
productOrder.setRealBeginTime(currentDate);
productOrder.setUpdateBy(userName);
productOrder.setUpdateTime(currentDate);
mesProductOrderMapper.updateMesProductOrder(productOrder);
}
}
} }

@ -136,11 +136,11 @@ public class WmsRawInstockServiceImpl implements IWmsRawInstockService {
String materialBarcode = wmsRawInstockVo.getMaterialBarcode(); String materialBarcode = wmsRawInstockVo.getMaterialBarcode();
R<MesBaseBarcodeInfo> baseBarcodeInfoR = remoteMesService.getBarcode(materialBarcode, SecurityConstants.INNER); R<MesBaseBarcodeInfo> baseBarcodeInfoR = remoteMesService.getBarcode(materialBarcode, SecurityConstants.INNER);
if (baseBarcodeInfoR == null) { if (baseBarcodeInfoR == null) {
throw new ServiceException("物料码有误"); throw new ServiceException("物料码有误");
} }
MesBaseBarcodeInfo baseBarcodeInfo = baseBarcodeInfoR.getData(); MesBaseBarcodeInfo baseBarcodeInfo = baseBarcodeInfoR.getData();
if (baseBarcodeInfo == null) { if (baseBarcodeInfo == null) {
throw new ServiceException("物料码有误"); throw new ServiceException("物料码有误");
} }
String locationCode = wmsRawInstockVo.getLocationCode(); String locationCode = wmsRawInstockVo.getLocationCode();

@ -1000,11 +1000,11 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
String materialBarcode = wmsRawOutstock.getMaterialBarcode(); String materialBarcode = wmsRawOutstock.getMaterialBarcode();
R<MesBaseBarcodeInfo> baseBarcodeInfoR = remoteMesService.getBarcode(materialBarcode, SecurityConstants.INNER); R<MesBaseBarcodeInfo> baseBarcodeInfoR = remoteMesService.getBarcode(materialBarcode, SecurityConstants.INNER);
if (baseBarcodeInfoR == null) { if (baseBarcodeInfoR == null) {
throw new ServiceException("物料码有误"); throw new ServiceException("物料码有误");
} }
MesBaseBarcodeInfo baseBarcodeInfo = baseBarcodeInfoR.getData(); MesBaseBarcodeInfo baseBarcodeInfo = baseBarcodeInfoR.getData();
if (baseBarcodeInfo == null) { if (baseBarcodeInfo == null) {
throw new ServiceException("物料码有误"); throw new ServiceException("物料码有误");
} }
//验证销售订单绑定关系,或者是否安全库存 //验证销售订单绑定关系,或者是否安全库存
@ -1093,7 +1093,7 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
* @param wmsRawOutstock * @param wmsRawOutstock
* @return * @return
*/ */
@Transactional @Transactional(rollbackFor = Exception.class)
@Override @Override
public int directRawOutstock(WmsRawOutstock wmsRawOutstock) { public int directRawOutstock(WmsRawOutstock wmsRawOutstock) {
//出库要求 0申请出库1申请审核出库2直接出库 //出库要求 0申请出库1申请审核出库2直接出库
@ -1105,7 +1105,7 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
} }
R<MesBaseBarcodeInfo> baseBarcodeInfoR = remoteMesService.getBarcode(materialBarcode, SecurityConstants.INNER); R<MesBaseBarcodeInfo> baseBarcodeInfoR = remoteMesService.getBarcode(materialBarcode, SecurityConstants.INNER);
if (baseBarcodeInfoR == null) { if (baseBarcodeInfoR == null) {
throw new ServiceException("物料码有误"); throw new ServiceException("物料码有误");
} }
MesBaseBarcodeInfo baseBarcodeInfo = baseBarcodeInfoR.getData(); MesBaseBarcodeInfo baseBarcodeInfo = baseBarcodeInfoR.getData();
@ -1142,6 +1142,9 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
if (wmsRawStock == null) { if (wmsRawStock == null) {
throw new ServiceException("没找到库存信息"); throw new ServiceException("没找到库存信息");
} else { } else {
if (!locationCode.equals(wmsRawStock.getLocationCode())) {
throw new ServiceException("请核对库位编码");
}
BigDecimal totalAmount = wmsRawStock.getTotalAmount() == null ? BigDecimal.ZERO : wmsRawStock.getTotalAmount(); BigDecimal totalAmount = wmsRawStock.getTotalAmount() == null ? BigDecimal.ZERO : wmsRawStock.getTotalAmount();
BigDecimal updatedTotalAmount = totalAmount.subtract(outstockAmount); BigDecimal updatedTotalAmount = totalAmount.subtract(outstockAmount);
if (updatedTotalAmount.compareTo(BigDecimal.ZERO) < 0) { if (updatedTotalAmount.compareTo(BigDecimal.ZERO) < 0) {

@ -33,7 +33,8 @@
<!-- </el-form-item>--> <!-- </el-form-item>-->
</el-form> </el-form>
<div style="text-align: center"> <div style="text-align: center">
<el-button type="success" @click="handleRawOutstock"></el-button> <el-button type="success" @click="handleRawOutstock" v-if="this.form.planDetailStatus!=null && this.form.planDetailStatus==='已开始'"></el-button>
<el-button type="warning" @click="handleRawOutstock" v-if="this.form.planDetailStatus!=null && this.form.planDetailStatus==='已开始'"></el-button>
<el-button type="primary" @click="accomplishPlan"></el-button> <el-button type="primary" @click="accomplishPlan"></el-button>
</div> </div>
</div> </div>
@ -195,10 +196,12 @@
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="wmsForm" :model="wmsForm" :rules="wmsRules" label-width="80px"> <el-form ref="wmsForm" :model="wmsForm" :rules="wmsRules" label-width="80px">
<el-form-item label="库位编码" prop="locationCode"> <el-form-item label="库位编码" prop="locationCode">
<el-input v-model="wmsForm.locationCode" autocomplete="off"></el-input> <el-input v-model="wmsForm.locationCode" ref="locationCodeRef" autocomplete="off" placeholder="请扫描或输入库位编码"
@focus="handleLocationCodeFocus" @blur="handleLocationCodeBlur" suffix-icon="el-icon-camera"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="物料条码" prop="materialBarcode"> <el-form-item label="物料条码" prop="materialBarcode">
<el-input v-model="wmsForm.materialBarcode" autocomplete="off"></el-input> <el-input v-model="wmsForm.materialBarcode" ref="materialBarcodeRef" autocomplete="off" placeholder="请扫描或输入物料条码"
@focus="handleMaterialBarcodeFocus" @blur="handleMaterialBarcodeBlur" suffix-icon="el-icon-camera"></el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
@ -223,6 +226,8 @@ import {
directRawOutstock, directRawOutstock,
} from "@/api/board"; } from "@/api/board";
import {monitorSerialData} from "@/utils/serial"
const setState = (e) => { const setState = (e) => {
if (e === '1') { if (e === '1') {
return '未开始' return '未开始'
@ -237,6 +242,7 @@ const setState = (e) => {
const vw = (document.documentElement.clientWidth || document.body.clientWidth) / 100 const vw = (document.documentElement.clientWidth || document.body.clientWidth) / 100
export default { export default {
name: 'Board1', name: 'Board1',
mixins: [monitorSerialData],
components: { components: {
Chart Chart
}, },
@ -256,6 +262,9 @@ export default {
locationCode: null, locationCode: null,
materialBarcode: null, materialBarcode: null,
},//使 },//使
loacationCodeFocused: false,
materialBarcodeFocused: false,
// //
wmsRules: { wmsRules: {
locationCode: [ locationCode: [
@ -275,14 +284,16 @@ export default {
} }
}, },
async mounted() { async mounted() {
setInterval(() => { this.firstConnectSerial();
this.$notify.info({
title: '通知', // setInterval(() => {
message: '通知公告', // this.$notify.info({
position: 'bottom-right', // title: '',
duration: 0 // message: '',
}); // position: 'bottom-right',
}, 60 * 1000) // duration: 0
// });
// }, 60 * 1000)
const data = await getProductPlans({pageNum: 1, pageSize: 5}).then(e => { const data = await getProductPlans({pageNum: 1, pageSize: 5}).then(e => {
this.tableData = e.rows this.tableData = e.rows
this.totalNum1 = Math.ceil(e.total / 5) this.totalNum1 = Math.ceil(e.total / 5)
@ -904,6 +915,31 @@ export default {
this.open = true; this.open = true;
this.stockType = "1";// this.stockType = "1";//
this.title = "板材入库"; this.title = "板材入库";
this.dynamicFocus("locationCodeRef");
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(() => {
});
}
},
async dynamicFocus(inputRef) {
await this.$nextTick();
this.$refs[inputRef].focus();
}, },
handleRawOutstock() { handleRawOutstock() {
@ -911,6 +947,26 @@ export default {
this.open = true; this.open = true;
this.stockType = "2";// this.stockType = "2";//
this.title = "板材领料"; this.title = "板材领料";
this.dynamicFocus("locationCodeRef");
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(() => {
});
}
}, },
cancel() { cancel() {
@ -920,13 +976,13 @@ export default {
}, },
submitRawStock() { submitRawStock() {
if (this.stockType == "1") {// if (this.stockType === "1") {//
this.wmsForm.instockAmount = 1; this.wmsForm.instockAmount = 1;
addRawInstock(this.wmsForm).then(response => { addRawInstock(this.wmsForm).then(response => {
this.$modal.msgSuccess("板材入库成功"); this.$modal.msgSuccess("板材入库成功");
this.cancel(); this.cancel();
}); });
} else if (this.stockType == "2") {// } else if (this.stockType === "2") {//
this.wmsForm.outstockAmount = 1; this.wmsForm.outstockAmount = 1;
this.wmsForm.planCode = this.form.planCode; this.wmsForm.planCode = this.form.planCode;
this.wmsForm.planDetailCode = this.form.planDetailCode; this.wmsForm.planDetailCode = this.form.planDetailCode;
@ -937,10 +993,10 @@ export default {
checkSuitableSaleOrderMaterial(this.wmsForm).then(response => { checkSuitableSaleOrderMaterial(this.wmsForm).then(response => {
let returnCode = response.data.code; let returnCode = response.data.code;
let returnMsg = response.data.msg; let returnMsg = response.data.msg;
if (returnCode == this.OUTSTOCKCODE.directOutstockCode) { if (returnCode === this.OUTSTOCKCODE.directOutstockCode) {
this.directRawOutstock(); this.directRawOutstock();
} else if (returnCode == this.OUTSTOCKCODE.confirmOutstockCode) { } else if (returnCode === this.OUTSTOCKCODE.confirmOutstockCode) {
this.$confirm('此库存为安全库存,确认要出安全库存么?有以下销售订单库存可以优先出:'+returnMsg, '提示', { this.$confirm('此库存为安全库存,确认要出安全库存么?有以下销售订单库存可以优先出:' + returnMsg, '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
@ -950,7 +1006,7 @@ export default {
}); });
} else { } else {
this.$modal.msgWarning("请出库:"+returnMsg); this.$modal.msgWarning("请出库:" + returnMsg);
} }
}); });
@ -959,14 +1015,67 @@ export default {
}, },
directRawOutstock() { directRawOutstock() {
directRawOutstock(this.wmsForm).then(response => { directRawOutstock(this.wmsForm).then(response => {
this.$modal.msgSuccess("板材领取成功"); this.$modal.msgSuccess("板材领取成功");
this.cancel(); this.cancel();
}); });
},
handleLocationCodeFocus() {
this.loacationCodeFocused = true;
},
handleLocationCodeBlur() {
this.loacationCodeFocused = false;
},
handleMaterialBarcodeFocus() {
this.materialBarcodeFocused = true;
},
handleMaterialBarcodeBlur() {
this.materialBarcodeFocused = 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.open) {//
if (this.loacationCodeFocused) {
this.wmsForm.locationCode = this.serialData
this.dynamicFocus("materialBarcodeRef");
} else if (this.materialBarcodeFocused) {
this.wmsForm.materialBarcode = this.serialData;
}
}
// console.log(this.serialData)
} }
}, },

Loading…
Cancel
Save