mes:
原材料条码:采购新增和无采购订单新增优化
master
xs 9 months ago
parent 9281bfd6a6
commit bab182edef

@ -158,6 +158,9 @@ public class MesBaseBarcodeInfo extends BaseEntity
private BigDecimal dispatchAmount;//派工数量
private String barcodeTypeStr;//物料类型多个string,例如 1,9
public String getPrintFlag() {
return printFlag;
}
@ -491,6 +494,14 @@ public class MesBaseBarcodeInfo extends BaseEntity
this.dispatchAmount = dispatchAmount;
}
public String getBarcodeTypeStr() {
return barcodeTypeStr;
}
public void setBarcodeTypeStr(String barcodeTypeStr) {
this.barcodeTypeStr = barcodeTypeStr;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

@ -28,6 +28,10 @@ public class MesConstants {
* :
*/
public static final String MES_BARCODE_TYPE_BACKPLATE = "4";
/**
* :
*/
public static final String MES_BARCODE_TYPE_RAW_REGULAR = "9";
/** 条码批次标识0-否 */
public static final String NOT_IS_BATCH = "0";

@ -259,4 +259,16 @@ public class MesBaseBarcodeInfoController extends BaseController
}
/**
*
*/
@RequiresPermissions("mes:barcode:regularAdd")
@Log(title = "条码信息", businessType = BusinessType.INSERT)
@PostMapping(value="/addRegularBarcode")
public AjaxResult addRegularBarcode(@RequestBody MesBaseBarcodeInfo mesBaseBarcodeInfo)
{
return toAjax(mesBaseBarcodeInfoService.generateRegularRawBarcode(mesBaseBarcodeInfo));
}
}

@ -29,6 +29,7 @@ import com.hw.printer.api.domain.vo.PrinterVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hw.mes.service.IMesBaseBarcodeInfoService;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
@ -216,6 +217,30 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
}
/**
*
* @param mesBaseBarcodeInfo
*/
@Override
public int generateRegularRawBarcode(MesBaseBarcodeInfo mesBaseBarcodeInfo) {
Date currentDate = new Date();
String userName = SecurityUtils.getUsername();
String barcodeInfo = Seq.getId(Seq.mesBarcodeSeqType, Seq.mesBarcodeCode);
mesBaseBarcodeInfo.setBarcodeInfo(barcodeInfo);
mesBaseBarcodeInfo.setBatchCode(barcodeInfo);
mesBaseBarcodeInfo.setPrintFlag(MesConstants.MES_BARCODE_PRINT_FLAG_YES);
mesBaseBarcodeInfo.setBatchFlag(MesConstants.IS_BATCH);
mesBaseBarcodeInfo.setBarcodeType(MesConstants.MES_BARCODE_TYPE_RAW_REGULAR);
mesBaseBarcodeInfo.setSafeFlag(MesConstants.MES_ORDER_BIND_SAFE_FLAG_YES);
mesBaseBarcodeInfo.setCreateBy(userName);
mesBaseBarcodeInfo.setCreateTime(currentDate);
return mesBaseBarcodeInfoMapper.insertMesBaseBarcodeInfo(mesBaseBarcodeInfo);
}
public void generateProductBarcode(MesBaseBarcodeInfo mesBaseBarcodeInfo) {
String planCode = mesBaseBarcodeInfo.getPlanCode();
String planDetailCode = mesBaseBarcodeInfo.getPlanDetailCode();
@ -336,147 +361,172 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
* @return
*/
@Override
@Transactional(rollbackFor = Exception.class)
@Transactional
public int printBarcodes(Long[] barcodeIds, String printType) {
//获取条码List
List<List<PrintContentVo>> printContents = new ArrayList<>();
List<MesBaseBarcodeInfo> toUpdatedBaseBarcodeInfos = new ArrayList<>();
for (Long barcodeId : barcodeIds) {
MesBaseBarcodeInfo mesBaseBarcodeInfo = mesBaseBarcodeInfoMapper.selectMesBaseBarcodeInfoJoinByBarcodeId(barcodeId);
String printFlag = mesBaseBarcodeInfo.getPrintFlag();
if (printFlag.equals(MesConstants.MES_BARCODE_PRINT_FLAG_YES)) {
throw new ServiceException("此物料条码[" + mesBaseBarcodeInfo.getBarcodeInfo() + "]已经打印过,不能重复打印");
}
printBarcodesByBarcodeId(barcodeId,printType);
}
// for (MesBaseBarcodeInfo toUpdateMesBaseBarcodeInfo : toUpdatedBaseBarcodeInfos) {
// toUpdateMesBaseBarcodeInfo.setPrintTime(DateUtils.getNowDate());
// toUpdateMesBaseBarcodeInfo.setPrintPerson(SecurityUtils.getUsername());
// toUpdateMesBaseBarcodeInfo.setPrintFlag(MesConstants.MES_BARCODE_PRINT_FLAG_YES);
// toUpdateMesBaseBarcodeInfo.setPrintNumber(1L);
// toUpdateMesBaseBarcodeInfo.setAcceptedDate(DateUtils.getNowDate());
// this.updateMesBaseBarcodeInfo(toUpdateMesBaseBarcodeInfo);
// }
//
// PrinterVo printerVo = new PrinterVo();
// printerVo.setPrintType(printType);
// printerVo.setPrintContents(printContents);
//
// //调用的打印接口
// R<?> printResultR = remotePrinterService.printBarcodes(printerVo, SecurityConstants.INNER);
// if (printResultR.getCode() != Constants.SUCCESS) {//抛出异常,回滚事务
// throw new RuntimeException(printResultR.getMsg());
// }
return toUpdatedBaseBarcodeInfos.size();
}
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void printBarcodesByBarcodeId(Long barcodeId,String printType){
MesBaseBarcodeInfo mesBaseBarcodeInfo = mesBaseBarcodeInfoMapper.selectMesBaseBarcodeInfoJoinByBarcodeId(barcodeId);
String printFlag = mesBaseBarcodeInfo.getPrintFlag();
if (printFlag.equals(MesConstants.MES_BARCODE_PRINT_FLAG_YES)) {
throw new ServiceException("此物料条码[" + mesBaseBarcodeInfo.getBarcodeInfo() + "]已经打印过,不能重复打印");
}
String materialName = mesBaseBarcodeInfo.getMaterialName();
List<PrintContentVo> printContentVos = new ArrayList<>();
String materialName = mesBaseBarcodeInfo.getMaterialName();
List<PrintContentVo> printContentVos = new ArrayList<>();
PrintContentVo printMaterialCode = new PrintContentVo();
printMaterialCode.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_MATERIAL_CODE);
printMaterialCode.setValue(mesBaseBarcodeInfo.getMaterialCode());
printMaterialCode.setType(PrintContentVo.TYPE_TEXT);
PrintContentVo printMaterialCode = new PrintContentVo();
printMaterialCode.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_MATERIAL_CODE);
printMaterialCode.setValue(mesBaseBarcodeInfo.getMaterialCode());
printMaterialCode.setType(PrintContentVo.TYPE_TEXT);
PrintContentVo printPreMaterial = new PrintContentVo();
PrintContentVo printPreMaterial = new PrintContentVo();
// if (mesBaseBarcodeInfo.getBindFlag() == null) {
//
// }
PrintContentVo printSaleOrderCode = new PrintContentVo();
printSaleOrderCode.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_SALE_ORDER_CODE);
printSaleOrderCode.setValue(mesBaseBarcodeInfo.getSaleorderCode());
printSaleOrderCode.setType(PrintContentVo.TYPE_TEXT);
PrintContentVo printBarCode = new PrintContentVo();
printBarCode.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_QRCODE);
printBarCode.setValue(mesBaseBarcodeInfo.getBarcodeInfo());
printBarCode.setType(PrintContentVo.TYPE_QRCODE);
if (printType.equals(PrinterVo.PRINT_TYPE_RAW_LABEL)) {
PrintContentVo printMaterialName = new PrintContentVo();
printMaterialName.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_MATERIAL_NAME);
materialName = materialName.length() <= 10 ? "\n" + materialName : materialName;
printMaterialName.setValue(materialName);
printMaterialName.setType(PrintContentVo.TYPE_TEXT);
PrintContentVo printBatchCode = new PrintContentVo();
printBatchCode.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_BATCH_CODE);
printBatchCode.setValue(mesBaseBarcodeInfo.getBatchCode());
printBatchCode.setType(PrintContentVo.TYPE_TEXT);
PrintContentVo printPoNo = new PrintContentVo();
printPoNo.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_PO_NO);
printPoNo.setValue(mesBaseBarcodeInfo.getPoNo());
printPoNo.setType(PrintContentVo.TYPE_TEXT);
String printPreMaterialKey = mesBaseBarcodeInfo.getBindFlag() != null && mesBaseBarcodeInfo.getBindFlag().equals(MesConstants.MES_MATERIAL_BIND_FLAG_YES)
? PrintContentVo.RAW_MATERIAL_LABEL_KEY_PRE_MATERIAL_YES : PrintContentVo.RAW_MATERIAL_LABEL_KEY_PRE_MATERIAL_NO;
printPreMaterial.setKey(printPreMaterialKey);
printPreMaterial.setType(PrintContentVo.TYPE_CHECKBOX);
PrintContentVo printMaterialSpec = new PrintContentVo();
printMaterialSpec.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_MATERIAL_SPEC);
printMaterialSpec.setValue(mesBaseBarcodeInfo.getMaterialSpec());
printMaterialSpec.setType(PrintContentVo.TYPE_TEXT);
PrintContentVo printQty = new PrintContentVo();
printQty.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_QTY);
DecimalFormat df = new DecimalFormat("#.##");
String formattedNumber = df.format(mesBaseBarcodeInfo.getAmount());
printQty.setValue(formattedNumber);
printQty.setType(PrintContentVo.TYPE_TEXT);
printContentVos.add(printMaterialName);
printContentVos.add(printBatchCode);
printContentVos.add(printPoNo);
printContentVos.add(printMaterialSpec);
printContentVos.add(printQty);
} else if (printType.equals(PrinterVo.PRINT_TYPE_PRODUCT_LABEL)) {
PrintContentVo printMaterialName = new PrintContentVo();
materialName = materialName.length() <= 8 ? "\n" + materialName : materialName;
printMaterialName.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_MATERIAL_NAME);
printMaterialName.setValue(materialName);
printMaterialName.setType(PrintContentVo.TYPE_TEXT);
PrintContentVo printQty = new PrintContentVo();
printQty.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_QTY);
printQty.setValue("1");
printQty.setType(PrintContentVo.TYPE_TEXT);
PrintContentVo printPlanCode = new PrintContentVo();
printPlanCode.setKey(PrintContentVo.PRODUCT_PLAN_CODE);
printPlanCode.setValue(mesBaseBarcodeInfo.getPlanCode());
printPlanCode.setType(PrintContentVo.TYPE_TEXT);
printContentVos.add(printMaterialName);
printContentVos.add(printQty);
printContentVos.add(printPlanCode);
}
printContentVos.add(printMaterialCode);
printContentVos.add(printPreMaterial);
printContentVos.add(printSaleOrderCode);
printContentVos.add(printBarCode);
String checkStatus = mesBaseBarcodeInfo.getCheckStatus() == null ? "" : mesBaseBarcodeInfo.getCheckStatus();
if (checkStatus.equals(QmsConstants.QMS_CHECK_RESULT_CHECK_STATUS_PASS)) {
PrintContentVo printQcResult = new PrintContentVo();
printQcResult.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_QC_RESULT_YES);
printQcResult.setType(PrintContentVo.TYPE_CHECKBOX);
printContentVos.add(printQcResult);
} else if (checkStatus.equals(QmsConstants.QMS_CHECK_RESULT_CHECK_STATUS_FAIL)) {
PrintContentVo printQcResult = new PrintContentVo();
printQcResult.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_QC_RESULT_NO);
printQcResult.setType(PrintContentVo.TYPE_CHECKBOX);
printContentVos.add(printQcResult);
}
printContents.add(printContentVos);
toUpdatedBaseBarcodeInfos.add(mesBaseBarcodeInfo);
PrintContentVo printSaleOrderCode = new PrintContentVo();
printSaleOrderCode.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_SALE_ORDER_CODE);
printSaleOrderCode.setValue(mesBaseBarcodeInfo.getSaleorderCode());
printSaleOrderCode.setType(PrintContentVo.TYPE_TEXT);
PrintContentVo printBarCode = new PrintContentVo();
printBarCode.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_QRCODE);
printBarCode.setValue(mesBaseBarcodeInfo.getBarcodeInfo());
printBarCode.setType(PrintContentVo.TYPE_QRCODE);
if (printType.equals(PrinterVo.PRINT_TYPE_RAW_LABEL)) {
PrintContentVo printMaterialName = new PrintContentVo();
printMaterialName.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_MATERIAL_NAME);
materialName = materialName.length() <= 10 ? "\n" + materialName : materialName;
printMaterialName.setValue(materialName.replaceAll("[\\x00-\\x1F\\x7F-\\x9F]", ""));
printMaterialName.setType(PrintContentVo.TYPE_TEXT);
PrintContentVo printBatchCode = new PrintContentVo();
printBatchCode.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_BATCH_CODE);
printBatchCode.setValue(mesBaseBarcodeInfo.getBatchCode());
printBatchCode.setType(PrintContentVo.TYPE_TEXT);
PrintContentVo printPoNo = new PrintContentVo();
printPoNo.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_PO_NO);
printPoNo.setValue(mesBaseBarcodeInfo.getPoNo());
printPoNo.setType(PrintContentVo.TYPE_TEXT);
String printPreMaterialKey = mesBaseBarcodeInfo.getBindFlag() != null && mesBaseBarcodeInfo.getBindFlag().equals(MesConstants.MES_MATERIAL_BIND_FLAG_YES)
? PrintContentVo.RAW_MATERIAL_LABEL_KEY_PRE_MATERIAL_YES : PrintContentVo.RAW_MATERIAL_LABEL_KEY_PRE_MATERIAL_NO;
printPreMaterial.setKey(printPreMaterialKey);
printPreMaterial.setType(PrintContentVo.TYPE_CHECKBOX);
PrintContentVo printMaterialSpec = new PrintContentVo();
printMaterialSpec.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_MATERIAL_SPEC);
printMaterialSpec.setValue(mesBaseBarcodeInfo.getMaterialSpec().replaceAll("[\\x00-\\x1F\\x7F-\\x9F]", ""));
printMaterialSpec.setType(PrintContentVo.TYPE_TEXT);
PrintContentVo printQty = new PrintContentVo();
printQty.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_QTY);
DecimalFormat df = new DecimalFormat("#.##");
String formattedNumber = df.format(mesBaseBarcodeInfo.getAmount());
printQty.setValue(formattedNumber);
printQty.setType(PrintContentVo.TYPE_TEXT);
printContentVos.add(printMaterialName);
printContentVos.add(printBatchCode);
printContentVos.add(printPoNo);
printContentVos.add(printMaterialSpec);
printContentVos.add(printQty);
} else if (printType.equals(PrinterVo.PRINT_TYPE_PRODUCT_LABEL)) {
PrintContentVo printMaterialName = new PrintContentVo();
materialName = materialName.length() <= 8 ? "\n" + materialName : materialName;
printMaterialName.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_MATERIAL_NAME);
printMaterialName.setValue(materialName);
printMaterialName.setType(PrintContentVo.TYPE_TEXT);
PrintContentVo printQty = new PrintContentVo();
printQty.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_QTY);
printQty.setValue("1");
printQty.setType(PrintContentVo.TYPE_TEXT);
PrintContentVo printPlanCode = new PrintContentVo();
printPlanCode.setKey(PrintContentVo.PRODUCT_PLAN_CODE);
printPlanCode.setValue(mesBaseBarcodeInfo.getPlanCode());
printPlanCode.setType(PrintContentVo.TYPE_TEXT);
printContentVos.add(printMaterialName);
printContentVos.add(printQty);
printContentVos.add(printPlanCode);
}
for (MesBaseBarcodeInfo toUpdateMesBaseBarcodeInfo : toUpdatedBaseBarcodeInfos) {
toUpdateMesBaseBarcodeInfo.setPrintTime(DateUtils.getNowDate());
toUpdateMesBaseBarcodeInfo.setPrintPerson(SecurityUtils.getUsername());
toUpdateMesBaseBarcodeInfo.setPrintFlag(MesConstants.MES_BARCODE_PRINT_FLAG_YES);
toUpdateMesBaseBarcodeInfo.setPrintNumber(1L);
toUpdateMesBaseBarcodeInfo.setAcceptedDate(DateUtils.getNowDate());
this.updateMesBaseBarcodeInfo(toUpdateMesBaseBarcodeInfo);
printContentVos.add(printMaterialCode);
printContentVos.add(printPreMaterial);
printContentVos.add(printSaleOrderCode);
printContentVos.add(printBarCode);
String checkStatus = mesBaseBarcodeInfo.getCheckStatus() == null ? "" : mesBaseBarcodeInfo.getCheckStatus();
if (checkStatus.equals(QmsConstants.QMS_CHECK_RESULT_CHECK_STATUS_PASS)) {
PrintContentVo printQcResult = new PrintContentVo();
printQcResult.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_QC_RESULT_YES);
printQcResult.setType(PrintContentVo.TYPE_CHECKBOX);
printContentVos.add(printQcResult);
} else if (checkStatus.equals(QmsConstants.QMS_CHECK_RESULT_CHECK_STATUS_FAIL)) {
PrintContentVo printQcResult = new PrintContentVo();
printQcResult.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_QC_RESULT_NO);
printQcResult.setType(PrintContentVo.TYPE_CHECKBOX);
printContentVos.add(printQcResult);
}
// printContents.add(printContentVos);
// toUpdatedBaseBarcodeInfos.add(mesBaseBarcodeInfo);
mesBaseBarcodeInfo.setPrintTime(DateUtils.getNowDate());
mesBaseBarcodeInfo.setPrintPerson(SecurityUtils.getUsername());
mesBaseBarcodeInfo.setPrintFlag(MesConstants.MES_BARCODE_PRINT_FLAG_YES);
mesBaseBarcodeInfo.setPrintNumber(1L);
mesBaseBarcodeInfo.setAcceptedDate(DateUtils.getNowDate());
this.updateMesBaseBarcodeInfo(mesBaseBarcodeInfo);
PrinterVo printerVo = new PrinterVo();
printerVo.setPrintType(printType);
printerVo.setPrintContents(printContents);
printerVo.setPrintContentVos(printContentVos);
//调用的打印接口
R<?> printResultR = remotePrinterService.printBarcodes(printerVo, SecurityConstants.INNER);
if (printResultR.getCode() != Constants.SUCCESS) {//抛出异常,回滚事务
if (printResultR.getCode() != Constants.SUCCESS) {
throw new RuntimeException(printResultR.getMsg());
}
return toUpdatedBaseBarcodeInfos.size();
}

@ -74,6 +74,18 @@
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleRegularAdd"
v-hasPermi="['mes:barcode:regularAdd']"
>固定条码新增
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
@ -257,7 +269,7 @@
</el-form-item>
<el-form-item label="批次标识" prop="batchFlag">
<el-radio-group v-model="form.batchFlag" disabled>
<el-radio-group v-model="form.batchFlag" :disabled="saleBatchFlagDisable">
<el-radio
v-for="dict in dict.type.active_flag"
:key="dict.value"
@ -270,14 +282,14 @@
<!-- <el-form-item label="供应商ID" prop="manufacturerId">-->
<!-- <el-input v-model="form.manufacturerId" placeholder="请输入供应商ID" />-->
<!-- </el-form-item>-->
<el-form-item prop="amount" v-if="batchVisible">
<el-form-item prop="amount" v-if="form.batchFlag===BATCH_FLAG.YES">
<span slot="label">
<el-tooltip content="每个物料条码中包含的数量一袋螺丝有60个" placement="top">
<i class="el-icon-question"></i>
</el-tooltip>
批次数量
</span>
<el-input v-model="form.amount" placeholder="请在物料信息中维护" disabled/>
<el-input v-model="form.amount" placeholder="请在物料信息中维护" :disabled="saleBatchAmountDisabled"/>
</el-form-item>
<el-form-item prop="barcodeAmount">
@ -403,9 +415,6 @@
</el-dialog>
<!-- 无采购订单的原材料条码信息对话框 -->
<el-dialog :title="title" :visible.sync="noPurchaseOpen" width="500px" append-to-body>
<el-form ref="noPurchaseForm" :model="noPurchaseForm" :rules="noPurchaseRules" label-width="100px">
@ -414,7 +423,8 @@
<el-input v-model="noPurchaseForm.materialId" placeholder="请输入物料ID"/>
</el-form-item>
<el-form-item label="物料编码" prop="materialCode">
<el-input v-model="noPurchaseForm.materialCode" suffix-icon="el-icon-search" readonly @click.native="handleSelectMaterial" />
<el-input v-model="noPurchaseForm.materialCode" suffix-icon="el-icon-search" readonly
@click.native="handleSelectMaterial"/>
</el-form-item>
<el-form-item label="物料名称" prop="materialName">
<el-input v-model="noPurchaseForm.materialName" readonly/>
@ -422,7 +432,7 @@
<el-form-item label="批次标识" prop="batchFlag">
<el-radio-group v-model="noPurchaseForm.batchFlag" disabled>
<el-radio-group v-model="noPurchaseForm.batchFlag" :disabled="noPurchaseBatchFlagDisable">
<el-radio
v-for="dict in dict.type.active_flag"
:key="dict.value"
@ -435,14 +445,14 @@
<!-- <el-form-item label="供应商ID" prop="manufacturerId">-->
<!-- <el-input v-model="form.manufacturerId" placeholder="请输入供应商ID" />-->
<!-- </el-form-item>-->
<el-form-item prop="amount" v-if="batchVisible">
<el-form-item prop="amount" v-if="noPurchaseForm.batchFlag==='1'">
<span slot="label">
<el-tooltip content="每个物料条码中包含的数量一袋螺丝有60个" placement="top">
<i class="el-icon-question"></i>
</el-tooltip>
批次数量
</span>
<el-input v-model="noPurchaseForm.amount" placeholder="请在物料信息中维护" disabled/>
<el-input v-model="noPurchaseForm.amount" placeholder="请在物料信息中维护"/>
</el-form-item>
<el-form-item prop="barcodeAmount">
@ -480,11 +490,58 @@
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitNoPurchaseAddForm"> </el-button>
<el-button @click="cancelInternal"> </el-button>
<el-button @click="cancelNoPurchase"> </el-button>
</div>
</el-dialog>
<!-- 固定原材料条码信息对话框 -->
<el-dialog :title="title" :visible.sync="regularOpen" width="500px" append-to-body>
<el-form ref="regularForm" :model="regularForm" :rules="regularRules" label-width="100px">
<el-form-item label="物料ID" prop="materialId" v-if="false">
<el-input v-model="regularForm.materialId" placeholder="请输入物料ID"/>
</el-form-item>
<el-form-item label="物料编码" prop="materialCode">
<el-input v-model="regularForm.materialCode" suffix-icon="el-icon-search" readonly
@click.native="handleSelectMaterial"/>
</el-form-item>
<el-form-item label="物料名称" prop="materialName">
<el-input v-model="regularForm.materialName" readonly/>
</el-form-item>
<el-form-item label="物料规格" prop="materialSpec">
<el-input v-model="regularForm.materialSpec" readonly/>
</el-form-item>
<el-form-item label="生产日期" prop="productionDate">
<el-date-picker clearable
v-model="regularForm.productionDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择生产日期">
</el-date-picker>
</el-form-item>
<el-form-item label="最晚出库日期" prop="lastOutstockDate">
<el-date-picker clearable
v-model="regularForm.lastOutstockDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择最晚出库日期">
</el-date-picker>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="regularForm.remark" type="textarea" placeholder="请输入内容"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitRegularAddForm"> </el-button>
<el-button @click="cancelRegular"> </el-button>
</div>
</el-dialog>
<!-- 选择物料对话框 -->
<el-dialog title="选择物料信息" :visible.sync="selectMaterialVisible" append-to-body>
<select-material ref="selectMaterialRef" v-if="selectMaterialVisible"></select-material>
@ -500,7 +557,7 @@
import {
listBarcode, getBarcode, delBarcode, addBarcode, updateBarcode,
printBarcodes, getMaterialInfoByErpId, selectProductBarcodeInfoByBarcodeInfo,
addInternalBarcode, regenerateBarcode,addNoPurchaseBarcode
addInternalBarcode, regenerateBarcode, addNoPurchaseBarcode, addRegularBarcode
} from "@/api/mes/barcode";
import addPurchaseOrder from '@//views/mes/purchaseOrder/addPurchaseOrder.vue';
import selectMaterial from '@//views/mes/materialinfo/selectMaterial.vue';
@ -525,8 +582,6 @@ export default {
multiple: true,
//
showSearch: true,
//
batchVisible: false,
//
total: 0,
//
@ -535,7 +590,7 @@ export default {
purchaseOrderOpen: false,
//
selectMaterialVisible:false,
selectMaterialVisible: false,
//
title: "",
//
@ -547,7 +602,7 @@ export default {
printTime: null,
printPerson: null,
batchFlag: null,
barcodeType: '1',
barcodeType: "1",
barcodeInfo: null,
batchCode: null,
palletInfoCode: null,
@ -655,6 +710,11 @@ export default {
noPurchaseOpen: false,
//
noPurchaseForm: {},
noPurchaseBatchFlagDisable: true,
noPurchaseBatchAmountDisabled: true,
saleBatchFlagDisable: true,
saleBatchAmountDisabled: true,
//
noPurchaseRules: {
batchFlag: [
@ -666,12 +726,30 @@ export default {
barcodeAmount: [
{required: true, message: "条码数量不能为空", trigger: "change"}
],
materialCode: [
{required: true, message: "物料不能为空", trigger: "blur"}
materialCode11: [
{required: true, message: "物料不能为空", trigger: "change"}
],
},
batchPrintBtnDisabled: false
regularOpen: false,
//
regularForm: {},
//
regularRules: {
materialCode2: [
{
required: true, message: "物料不能为空", trigger: ["blur", "change"]
}
],
},
batchPrintBtnDisabled: false,
BATCH_FLAG: {
YES: '1',
NO: '0'
}
};
},
created() {
@ -776,24 +854,30 @@ export default {
this.form.poNo = selectedRow.poNo;
this.form.barcodeAmount = selectedRow.orderAmount;
this.form.batchFlag = null;
this.form.amount = null;
getMaterialInfoByErpId(selectedRow.materialId).then(response => {
if (response.data == null) {
this.$modal.msgError("物料信息不存在");
return;
}
if (response.data.batchFlag != null) {
this.form.batchFlag = response.data.batchFlag;
this.form.materialId = response.data.materialId;
if (this.form.batchFlag == "0") {
this.batchVisible = false;
} else {
this.saleBatchFlagDisable = true;
if (this.form.batchFlag === this.BATCH_FLAG.YES) {
this.form.amount = response.data.batchAmount;
this.batchVisible = true;
} else {
this.form.amount = 1;
}
} else {
this.batchVisible = true;
this.saleBatchFlagDisable = false;
}
this.saleBatchAmountDisabled = this.form.amount != null && this.form.amount > 0;
this.purchaseOrderOpen = false;
});
},
@ -807,7 +891,7 @@ export default {
/** 打印条码按钮操作 */
handlePrintBarcodes(row) {
const barcodeIds = row.barcodeId || this.ids;
if (barcodeIds == null || barcodeIds == '') {
if (barcodeIds == null || barcodeIds === '') {
this.$modal.msgWarning("请选择要打印的物料条码");
return;
}
@ -939,7 +1023,7 @@ export default {
},
selectProductBarcodeInfoByBarcodeInfo() {
if(this.internalForm.productBarcode == null || this.internalForm.productBarcode === ''){
if (this.internalForm.productBarcode == null || this.internalForm.productBarcode === '') {
return;
}
@ -1021,32 +1105,44 @@ export default {
/** 无采购订单新增按钮操作 */
handleNoPurchaseAdd() {
this.reset();
this.resetNoPurchase();
this.noPurchaseOpen = true;
this.title = "添加原材料条码信息";
},
handleSelectMaterial(){
handleSelectMaterial() {
this.selectMaterialVisible = true;
},
/** 提交选择物料按钮 */
submitSelectMaterialForm() {
let selectedRow = this.$refs.selectMaterialRef.selectedRow;
this.noPurchaseForm.barcodeType = '1';//1,2,3,4
this.noPurchaseForm.materialId = selectedRow.materialId;
this.noPurchaseForm.materialCode = selectedRow.materialCode;
this.noPurchaseForm.materialName = selectedRow.materialName;
this.noPurchaseForm.batchFlag = selectedRow.batchFlag;
if (this.noPurchaseForm.batchFlag === "0") {
this.batchVisible = false;
} else {
this.noPurchaseForm.amount = selectedRow.batchAmount;
this.batchVisible = true;
if (this.noPurchaseOpen) {
let selectedRow = this.$refs.selectMaterialRef.selectedRow;
this.noPurchaseForm.barcodeType = '1';//1,2,3,4
this.noPurchaseForm.materialId = selectedRow.materialId;
this.noPurchaseForm.materialCode = selectedRow.materialCode;
this.noPurchaseForm.materialName = selectedRow.materialName;
this.noPurchaseForm.batchFlag = selectedRow.batchFlag;
if (this.noPurchaseForm.batchFlag == null || this.noPurchaseForm.batchFlag === '') {
this.noPurchaseBatchFlagDisable = false;
} else {
this.noPurchaseBatchFlagDisable = true;
if (this.noPurchaseForm.batchFlag === this.BATCH_FLAG.NO) {
this.noPurchaseForm.amount = 1;
} else if (this.noPurchaseForm.batchFlag === this.BATCH_FLAG.YES) {
this.noPurchaseForm.amount = selectedRow.batchAmount;
}
}
this.noPurchaseBatchAmountDisabled = this.noPurchaseForm.amount != null && this.noPurchaseForm.amount > 0;
this.selectMaterialVisible = false;
} else if (this.regularOpen) {
this.submitRegularSelectMaterialForm();
}
this.selectMaterialVisible = false;
},
@ -1065,6 +1161,93 @@ export default {
});
},
//
cancelNoPurchase() {
this.noPurchaseOpen = false;
this.resetNoPurchase();
},
//
resetRegular() {
this.regularForm = {
barcodeId: null,
printTime: null,
printPerson: null,
batchFlag: null,
barcodeType: '1',
barcodeInfo: null,
batchCode: null,
palletInfoCode: null,
materialId: null,
manufacturerId: null,
amount: null,
barcodeAmount: null,
machineName: null,
printNumber: null,
poNo: null,
productionDate: null,
acceptedDate: null,
lastOutstockDate: null,
planCode: null,
planDetailCode: null,
saleOrderId: null,
saleorderCode: null,
projectNo: null,
serialNumber: null,
remark: null,
bindStatus: null,
bindBy: null,
bindTime: null,
updateBy: null,
updateTime: null
};
this.resetForm("regularForm");
},
/** 固定条码新增按钮操作 */
handleRegularAdd() {
this.resetRegular();
this.regularOpen = true;
this.title = "添加原材料条码信息";
},
/** 提交选择物料按钮 */
submitRegularSelectMaterialForm() {
let selectedRow = this.$refs.selectMaterialRef.selectedRow;
this.regularForm.barcodeType = '9';//1,2,3,4,9
this.regularForm.materialId = selectedRow.materialId;
this.regularForm.materialCode = selectedRow.materialCode;
this.regularForm.materialName = selectedRow.materialName;
this.regularForm.materialSpec = selectedRow.materialSpec;
this.selectMaterialVisible = false;
},
/** 固定条码新增提交按钮 */
submitRegularAddForm() {
this.$refs["regularForm"].validate(valid => {
if (valid) {
addRegularBarcode(this.regularForm).then(response => {
this.$modal.msgSuccess("新增成功");
this.regularOpen = false;
this.getList();
});
}
});
},
//
cancelRegular() {
this.regularOpen = false;
this.resetRegular();
},
}
};
</script>

Loading…
Cancel
Save