diff --git a/hw-common/hw-common-core/src/main/java/com/hw/common/core/constant/MesConstants.java b/hw-common/hw-common-core/src/main/java/com/hw/common/core/constant/MesConstants.java index 5a53bd82..51943122 100644 --- a/hw-common/hw-common-core/src/main/java/com/hw/common/core/constant/MesConstants.java +++ b/hw-common/hw-common-core/src/main/java/com/hw/common/core/constant/MesConstants.java @@ -120,7 +120,7 @@ public class MesConstants { public static final String MES_PRODUCT_ORDER_INTERNAL = "2";//对内生产 - /**物料信息绑定标识,是否需要采购订单明细绑定销售订单*/ + /**物料信息常备物料标识,是否需要采购订单明细绑定销售订单*/ public static final String MES_MATERIAL_BIND_FLAG_YES = "1";//是 public static final String MES_MATERIAL_BIND_FLAG_NO = "0";//否 diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/controller/MesBaseBarcodeInfoController.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/controller/MesBaseBarcodeInfoController.java index a1936df2..5b07334c 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/controller/MesBaseBarcodeInfoController.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/controller/MesBaseBarcodeInfoController.java @@ -7,6 +7,7 @@ import com.hw.common.core.constant.MesConstants; import com.hw.common.security.annotation.InnerAuth; 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.service.IMesBaseMaterialInfoService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; @@ -148,7 +149,7 @@ public class MesBaseBarcodeInfoController extends BaseController /** * 内部生产新增原材料条码信息 */ - @RequiresPermissions("mes:barcode:add") + @RequiresPermissions("mes:barcode:internalAdd") @Log(title = "条码信息", businessType = BusinessType.INSERT) @PostMapping(value="/addInternalBarcode") public AjaxResult addInternalBarcode(@RequestBody MesBaseBarcodeInfo mesBaseBarcodeInfo) @@ -242,4 +243,20 @@ public class MesBaseBarcodeInfoController extends BaseController return toAjax(mesBaseBarcodeInfoService.insertMesBaseBarcodeInfo(mesBaseBarcodeInfo)); } + + + + + /** + * 无采购订单新增原材料条码信息 + */ + @RequiresPermissions("mes:barcode:internalAdd") + @Log(title = "条码信息", businessType = BusinessType.INSERT) + @PostMapping(value="/addNoPurchaseBarcode") + public AjaxResult addNoPurchaseBarcode(@RequestBody MesBaseBarcodeInfo mesBaseBarcodeInfo) + { + return toAjax(mesBaseBarcodeInfoService.generateNoPurchaseRawBarcode(mesBaseBarcodeInfo)); + } + + } diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/mapper/MesBaseBarcodeInfoMapper.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/mapper/MesBaseBarcodeInfoMapper.java index f6cefe17..3f2cd63a 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/mapper/MesBaseBarcodeInfoMapper.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/mapper/MesBaseBarcodeInfoMapper.java @@ -99,5 +99,11 @@ public interface MesBaseBarcodeInfoMapper public MesBaseBarcodeInfo selectMesBaseBarcodeInfoJoinByBarcodeId(Long barcodeId); + /** + * 批量插入条码信息 + * @param mesBaseBarcodeInfos + * @return + */ + public int batchMesBaseBarcodeInfo(List mesBaseBarcodeInfos); } diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/mapper/MesProductPlanDetailMapper.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/mapper/MesProductPlanDetailMapper.java index 9907b9aa..499a9f9a 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/mapper/MesProductPlanDetailMapper.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/mapper/MesProductPlanDetailMapper.java @@ -76,4 +76,14 @@ public interface MesProductPlanDetailMapper * @return 生产计划明细 */ public MesProductPlanDetail selectNewestMesProductPlanDetailJoin(MesProductPlanDetail mesProductPlanDetail); + + /** + * 查询生产计划明细 + * + * @param planDetailCode 生产计划明细编号 + * @return 生产计划明细 + */ + public MesProductPlanDetail selectMesProductPlanDetailByPlanDetailCode(String planDetailCode); + + } diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/IMesBaseBarcodeInfoService.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/IMesBaseBarcodeInfoService.java index 68ca72bb..29efad25 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/IMesBaseBarcodeInfoService.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/IMesBaseBarcodeInfoService.java @@ -47,6 +47,12 @@ public interface IMesBaseBarcodeInfoService */ public int insertMesBaseBarcodeInfo(MesBaseBarcodeInfo mesBaseBarcodeInfo); + /** + * 无采购订单生成条码信息 + * @param mesBaseBarcodeInfo + */ + public int generateNoPurchaseRawBarcode(MesBaseBarcodeInfo mesBaseBarcodeInfo); + /** * 修改条码信息 * diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesBaseBarcodeInfoServiceImpl.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesBaseBarcodeInfoServiceImpl.java index 48a06aae..21d32075 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesBaseBarcodeInfoServiceImpl.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesBaseBarcodeInfoServiceImpl.java @@ -65,6 +65,9 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService @Autowired private MesProductPlanMapper mesProductPlanMapper; + @Autowired + private MesProductPlanDetailMapper mesProductPlanDetailMapper; + /** * 查询条码信息 * @@ -140,12 +143,12 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService } if (mesBaseMaterialInfo.getBindFlag() == null) { throw new ServiceException("请先设置此物料信息[物料编码:" + mesBaseBarcodeInfo.getMaterialCode() - + ",物料名称:" + mesBaseBarcodeInfo.getMaterialName() + "]的绑定标识"); + + ",物料名称:" + mesBaseBarcodeInfo.getMaterialName() + "]的常备物料标识"); } - //如果物料信息需要绑定,则判断是否有绑定的信息 + //如果物料信息为非常备物料,则判断是否有绑定的信息 BigDecimal barcodeAmount = mesBaseBarcodeInfo.getBarcodeAmount(); - if (mesBaseMaterialInfo.getBindFlag().equals(MesConstants.MES_MATERIAL_BIND_FLAG_YES)) { + if (mesBaseMaterialInfo.getBindFlag().equals(MesConstants.MES_MATERIAL_BIND_FLAG_NO)) { MesOrderBind queryOrderBind = new MesOrderBind(); queryOrderBind.setPurchaseOrderId(purchaseOrderId); List mesOrderBinds = mesOrderBindMapper.selectMesOrderBindList(queryOrderBind); @@ -187,6 +190,32 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService } + /** + * 无采购订单生成条码信息 + * @param mesBaseBarcodeInfo + */ + @Override + public int generateNoPurchaseRawBarcode(MesBaseBarcodeInfo mesBaseBarcodeInfo) { + Date currentDate = new Date(); + String userName = SecurityUtils.getUsername(); + + BigDecimal barcodeAmount = mesBaseBarcodeInfo.getBarcodeAmount(); + + List toInsertedBarcodeInfos = new ArrayList<>(); + MesBaseBarcodeInfo toInsertedBarcodeInfo; + String batchCode = Seq.getId(Seq.mesBatchCodeSeqType, Seq.mesBatchCodeCode); + for (long i = 0; i < barcodeAmount.intValue(); i++) { + // 生成数量条的不同条码内容 + toInsertedBarcodeInfo = getInsertedBarcodeInfo(mesBaseBarcodeInfo, batchCode, userName, currentDate); + toInsertedBarcodeInfo.setSafeFlag(MesConstants.MES_ORDER_BIND_SAFE_FLAG_YES); + toInsertedBarcodeInfos.add(toInsertedBarcodeInfo); + } + + return mesBaseBarcodeInfoMapper.batchMesBaseBarcodeInfo(toInsertedBarcodeInfos); + + } + + public void generateProductBarcode(MesBaseBarcodeInfo mesBaseBarcodeInfo) { String planCode = mesBaseBarcodeInfo.getPlanCode(); String planDetailCode = mesBaseBarcodeInfo.getPlanDetailCode(); @@ -199,11 +228,22 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService throw new ServiceException("此计划明细已经生成条码,不能重复生成"); } + MesProductPlanDetail mesProductPlanDetail = mesProductPlanDetailMapper.selectMesProductPlanDetailByPlanDetailCode(planDetailCode); + if (mesProductPlanDetail == null) { + throw new ServiceException("此生产任务明细不存在"); + } + + if (!mesProductPlanDetail.getPlanDetailStatus().equals(MesConstants.MES_PRODUCT_PLAN_DETAIL_STATUS_FINISH) && + !mesProductPlanDetail.getPlanDetailStatus().equals(MesConstants.MES_PRODUCT_PLAN_DETAIL_STATUS_ABNORMAL_FINISH)) { + throw new ServiceException("此生产任务明细还未完成,不能打印条码"); + } + MesProductPlan productPlan = mesProductPlanMapper.selectOnlyMesProductPlanByPlanCode(planCode); - if(productPlan == null){ + if (productPlan == null) { throw new ServiceException("此生产任务不存在"); } + Date currentDate = new Date(); String barcode = Seq.getId(Seq.mesCompBarcodeSeqType, Seq.mesCompBarcodeCode); mesBaseBarcodeInfo.setBatchCode(barcode);// 成品的批次代码 == 条码内容 diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesProductPlanServiceImpl.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesProductPlanServiceImpl.java index 25f2bc3f..92cbd47d 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesProductPlanServiceImpl.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesProductPlanServiceImpl.java @@ -354,6 +354,11 @@ public class MesProductPlanServiceImpl implements IMesProductPlanService { } } + String barcodeType = baseBarcodeInfo.getBarcodeType(); + if(!barcodeType.equals(MesConstants.MES_BARCODE_TYPE_RAW)){ + throw new ServiceException("此条码为非原材料条码"); + } + String userName = SecurityUtils.getUsername(); Date currentDate = new Date(); MesMaterialCheckResult mesMaterialCheckResult = mesMaterialCheckResultMapper. diff --git a/hw-modules/hw-mes/src/main/resources/mapper/mes/MesBaseBarcodeInfoMapper.xml b/hw-modules/hw-mes/src/main/resources/mapper/mes/MesBaseBarcodeInfoMapper.xml index 765450ba..4a28148a 100644 --- a/hw-modules/hw-mes/src/main/resources/mapper/mes/MesBaseBarcodeInfoMapper.xml +++ b/hw-modules/hw-mes/src/main/resources/mapper/mes/MesBaseBarcodeInfoMapper.xml @@ -348,4 +348,14 @@ left join qms_check_result qcr on bbi.batch_code = qcr.material_batch where bbi.barcode_id = #{barcodeId} + + + + + INSERT INTO mes_base_barcode_info (batch_flag,barcode_type,barcode_info,batch_code,material_id,manufacturer_id,amount,purchase_order_id,po_no,production_date,accepted_date,last_outstock_date,plan_code,plan_detail_code,safe_flag,sale_order_id,saleorder_code,project_no,serial_number,remark,bind_status,update_by,update_time) VALUES + + ( #{item.batchFlag}, #{item.barcodeType}, #{item.barcodeInfo}, #{item.batchCode}, #{item.materialId}, #{item.manufacturerId}, #{item.amount}, #{item.purchaseOrderId}, #{item.poNo}, #{item.productionDate}, #{item.acceptedDate}, #{item.lastOutstockDate}, #{item.planCode},#{item.planDetailCode}, #{item.safeFlag},#{item.saleOrderId}, #{item.saleorderCode},#{item.projectNo}, #{item.serialNumber},#{item.remark}, #{item.bindStatus},#{item.updateBy}, #{item.updateTime}) + + + diff --git a/hw-modules/hw-mes/src/main/resources/mapper/mes/MesProductPlanDetailMapper.xml b/hw-modules/hw-mes/src/main/resources/mapper/mes/MesProductPlanDetailMapper.xml index 80791ecc..4b687410 100644 --- a/hw-modules/hw-mes/src/main/resources/mapper/mes/MesProductPlanDetailMapper.xml +++ b/hw-modules/hw-mes/src/main/resources/mapper/mes/MesProductPlanDetailMapper.xml @@ -149,4 +149,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" order by mppd.plan_detail_id desc limit 1 + + + diff --git a/hw-ui/src/api/mes/barcode.js b/hw-ui/src/api/mes/barcode.js index 31f616e6..706a6012 100644 --- a/hw-ui/src/api/mes/barcode.js +++ b/hw-ui/src/api/mes/barcode.js @@ -127,3 +127,14 @@ export function addProductBarcode(data) { data: data }) } + + + +// 无采购订单新增原材料条码信息 +export function addNoPurchaseBarcode(data) { + return request({ + url: '/mes/barcode/addNoPurchaseBarcode', + method: 'post', + data: data + }) +} diff --git a/hw-ui/src/views/mes/barcode/endProductIndex.vue b/hw-ui/src/views/mes/barcode/endProductIndex.vue index f5e2f462..28ccf670 100644 --- a/hw-ui/src/views/mes/barcode/endProductIndex.vue +++ b/hw-ui/src/views/mes/barcode/endProductIndex.vue @@ -208,7 +208,7 @@ @@ -341,11 +341,12 @@ export default { batchPrintBtnDisabled: false, }; }, - created() { + mounted() { this.addBarcodeBtnVisible = false; this.getData(); this.getList(); }, + props: { defineData: { type: Object, diff --git a/hw-ui/src/views/mes/barcode/index.vue b/hw-ui/src/views/mes/barcode/index.vue index 2c11c861..8121bd45 100644 --- a/hw-ui/src/views/mes/barcode/index.vue +++ b/hw-ui/src/views/mes/barcode/index.vue @@ -57,23 +57,22 @@ icon="el-icon-plus" size="mini" @click="handleInternalAdd" - v-hasPermi="['mes:barcode:add']" + v-hasPermi="['mes:barcode:internalAdd']" >生产新增 - - - - - - - - - - - - + + 无采购订单新增 + + - + + + + + + + + + + + + + + + + + + + + + + + + {{ dict.label }} + + + + + + + + + + + + + 批次数量 + + + + + + + + + + 条码数量 + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -409,15 +500,17 @@ import { listBarcode, getBarcode, delBarcode, addBarcode, updateBarcode, printBarcodes, getMaterialInfoByErpId, selectProductBarcodeInfoByBarcodeInfo, - addInternalBarcode, regenerateBarcode + addInternalBarcode, regenerateBarcode,addNoPurchaseBarcode } from "@/api/mes/barcode"; import addPurchaseOrder from '@//views/mes/purchaseOrder/addPurchaseOrder.vue'; +import selectMaterial from '@//views/mes/materialinfo/selectMaterial.vue'; export default { name: "Barcode", dicts: ['bind_status', 'active_flag', 'barcode_type', 'mes_safe_flag', 'mes_print_flag'], components: { - 'add-purchaseOrder': addPurchaseOrder + 'add-purchaseOrder': addPurchaseOrder, + 'select-material': selectMaterial }, data() { return { @@ -440,6 +533,9 @@ export default { barcodeList: [], // 是否显示采购订单弹出层 purchaseOrderOpen: false, + + //是否显示选择物料弹出层 + selectMaterialVisible:false, // 弹出层标题 title: "", // 是否显示弹出层 @@ -489,6 +585,9 @@ export default { amount: [ {required: true, message: "批次数量不能为空", trigger: "change"} ], + barcodeAmount: [ + {required: true, message: "条码数量不能为空", trigger: "change"} + ], barcodeType: [ {required: true, message: "条码类型不能为空", trigger: "change"} ], @@ -553,6 +652,25 @@ export default { ], }, + noPurchaseOpen: false, + // 对内条码表单参数 + noPurchaseForm: {}, + // 表单校验 + noPurchaseRules: { + batchFlag: [ + {required: true, message: "批次标识不能为空", trigger: "blur"} + ], + amount: [ + {required: true, message: "批次数量不能为空", trigger: "change"} + ], + barcodeAmount: [ + {required: true, message: "条码数量不能为空", trigger: "change"} + ], + materialCode: [ + {required: true, message: "物料不能为空", trigger: "blur"} + ], + }, + batchPrintBtnDisabled: false }; }, @@ -821,6 +939,10 @@ export default { }, selectProductBarcodeInfoByBarcodeInfo() { + if(this.internalForm.productBarcode == null || this.internalForm.productBarcode === ''){ + return; + } + selectProductBarcodeInfoByBarcodeInfo(this.internalForm.productBarcode).then(response => { if (response.data == null) { this.$modal.msgError("成品信息不存在"); @@ -859,6 +981,90 @@ export default { this.resetInternal(); }, + + // 表单重置 + resetNoPurchase() { + this.noPurchaseForm = { + 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("noPurchaseForm"); + }, + + /** 无采购订单新增按钮操作 */ + handleNoPurchaseAdd() { + this.reset(); + this.noPurchaseOpen = true; + this.title = "添加原材料条码信息"; + }, + + 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; + } + + this.selectMaterialVisible = false; + + }, + + + /** 无采购订单新增提交按钮 */ + submitNoPurchaseAddForm() { + this.$refs["noPurchaseForm"].validate(valid => { + if (valid) { + addNoPurchaseBarcode(this.noPurchaseForm).then(response => { + this.$modal.msgSuccess("新增成功"); + this.noPurchaseOpen = false; + this.getList(); + }); + + } + }); + }, + } }; diff --git a/hw-ui/src/views/mes/materialinfo/selectMaterial.vue b/hw-ui/src/views/mes/materialinfo/selectMaterial.vue new file mode 100644 index 00000000..54394ed7 --- /dev/null +++ b/hw-ui/src/views/mes/materialinfo/selectMaterial.vue @@ -0,0 +1,187 @@ + + +