MES:
1、根据采购订单绑定销售订单的需求修改原材料条码的逻辑
2、根据四楼成品到五楼作为原材料的需求增加对内原材料条码的打印
master
xins 6 months ago
parent 4ecb79a0d2
commit fe63a324d6

@ -62,10 +62,6 @@ public class MesBaseBarcodeInfo extends BaseEntity
@Excel(name = "物料ID")
private Long materialId;
/** 物料名称 */
@Excel(name = "物料名称")
private String materialName;
/** 供应商ID */
@Excel(name = "供应商ID")
private Long manufacturerId;
@ -74,6 +70,8 @@ public class MesBaseBarcodeInfo extends BaseEntity
@Excel(name = "数量")
private BigDecimal amount;
private String productBarcode;
/** 打印机台名称,打印时获取 */
@Excel(name = "打印机台名称,打印时获取")
private String machineName;
@ -82,6 +80,9 @@ public class MesBaseBarcodeInfo extends BaseEntity
@Excel(name = "打印次数")
private Long printNumber;
/**采购订单ID*/
private Long purchaseOrderId;
/** 采购订单号;适合原材料入库时 */
@Excel(name = "采购订单号")
private String poNo;
@ -138,6 +139,25 @@ public class MesBaseBarcodeInfo extends BaseEntity
@Excel(name = "绑定托盘时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date bindTime;
//需要打印的条码数量
private BigDecimal barcodeAmount;
private String materialCode;
/** 物料名称 */
@Excel(name = "物料名称")
private String materialName;
public String getMaterialCode() {
return materialCode;
}
public void setMaterialCode(String materialCode) {
this.materialCode = materialCode;
}
public String getMaterialName() {
return materialName;
}
@ -270,6 +290,15 @@ public class MesBaseBarcodeInfo extends BaseEntity
{
return amount;
}
public String getProductBarcode() {
return productBarcode;
}
public void setProductBarcode(String productBarcode) {
this.productBarcode = productBarcode;
}
public void setMachineName(String machineName)
{
this.machineName = machineName;
@ -279,6 +308,15 @@ public class MesBaseBarcodeInfo extends BaseEntity
{
return machineName;
}
public Long getPurchaseOrderId() {
return purchaseOrderId;
}
public void setPurchaseOrderId(Long purchaseOrderId) {
this.purchaseOrderId = purchaseOrderId;
}
public void setPoNo(String poNo)
{
this.poNo = poNo;
@ -397,6 +435,14 @@ public class MesBaseBarcodeInfo extends BaseEntity
return bindTime;
}
public BigDecimal getBarcodeAmount() {
return barcodeAmount;
}
public void setBarcodeAmount(BigDecimal barcodeAmount) {
this.barcodeAmount = barcodeAmount;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

@ -57,6 +57,10 @@ public class MesBaseMaterialInfo extends BaseEntity
@Excel(name = "批次标识,(0否1是)")
private String batchFlag;
/** 批次数量例如一袋螺丝有60个 */
@Excel(name = "批次数量例如一袋螺丝有60个")
private BigDecimal batchAmount;
/** 计量单位ID;对应FBaseUnitId */
@Excel(name = "计量单位ID;对应FBaseUnitId")
private Long materialUnitId;
@ -81,6 +85,10 @@ public class MesBaseMaterialInfo extends BaseEntity
@Excel(name = "毛重;FGROSSWEIGHT")
private BigDecimal grossWeight;
/** 绑定标识(1是0否),如果需要绑定,则需要将销售订单绑定具体的采购订单明细 */
@Excel(name = "绑定标识(1是0否),如果需要绑定,则需要将销售订单绑定具体的采购订单明细")
private String bindFlag;
/** 所属工厂关联mes_base_factory_info的factory_id */
@Excel(name = "所属工厂关联mes_base_factory_info的factory_id")
private Long factoryId;
@ -206,6 +214,15 @@ public class MesBaseMaterialInfo extends BaseEntity
{
return batchFlag;
}
public BigDecimal getBatchAmount() {
return batchAmount;
}
public void setBatchAmount(BigDecimal batchAmount) {
this.batchAmount = batchAmount;
}
public void setMaterialUnitId(Long materialUnitId)
{
this.materialUnitId = materialUnitId;
@ -260,6 +277,15 @@ public class MesBaseMaterialInfo extends BaseEntity
{
return grossWeight;
}
public String getBindFlag() {
return bindFlag;
}
public void setBindFlag(String bindFlag) {
this.bindFlag = bindFlag;
}
public void setFactoryId(Long factoryId)
{
this.factoryId = factoryId;

@ -82,7 +82,7 @@ public class MesConstants {
/**条码信息绑定状态*/
public static final String MES_BARCODE_BIND_STATUS_BINDING= "1";//绑定
public static final String MES_BARCODE_BIND_STATUS_UNBINDING= "0";//解绑
public static final String MES_ASSIGN_TASK_KEY = "fifth_floor_assign_task";//五楼分配柜体任务到具体工位的key
@ -96,4 +96,10 @@ public class MesConstants {
/**采购订单销售订单绑定安全库存标识*/
public static final String MES_ORDER_BIND_SAFE_FLAG_YES = "1";//是
public static final String MES_ORDER_BIND_SAFE_FLAG_NO = "0";//否
/**生产工单销售类型*/
public static final String MES_PRODUCT_ORDER_SALE = "1";//外部销售
public static final String MES_PRODUCT_ORDER_INTERNAL = "2";//对内生产
}

@ -6,6 +6,7 @@ import javax.servlet.http.HttpServletResponse;
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.service.IMesBaseMaterialInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
@ -37,6 +38,9 @@ public class MesBaseBarcodeInfoController extends BaseController
@Autowired
private IMesBaseBarcodeInfoService mesBaseBarcodeInfoService;
@Autowired
private IMesBaseMaterialInfoService mesBaseMaterialInfoService;
/**
*
*/
@ -118,6 +122,38 @@ public class MesBaseBarcodeInfoController extends BaseController
return success(mesBaseBarcodeInfoService.printBarCode(barcodeIds));
}
/**
*
*/
@RequiresPermissions("mes:barcode:query")
@GetMapping(value = "/getMaterialInfoByErpId/{erpId}")
public AjaxResult getMaterialInfoByErpId(@PathVariable("erpId") Long erpId)
{
return success(mesBaseMaterialInfoService.selectMesBaseMaterialInfoByErpId(erpId));
}
/**
*
*/
@RequiresPermissions("mes:barcode:query")
@GetMapping(value = "/selectProductBarcodeInfoByBarcodeInfo/{barcodeInfo}")
public AjaxResult selectProductBarcodeInfoByBarcodeInfo(@PathVariable("barcodeInfo") String barcodeInfo)
{
return success(mesBaseBarcodeInfoService.selectProductBarcodeInfoByBarcodeInfo(barcodeInfo));
}
/**
*
*/
@RequiresPermissions("mes:barcode:add")
@Log(title = "条码信息", businessType = BusinessType.INSERT)
@PostMapping(value="/addInternalBarcode")
public AjaxResult addInternalBarcode(@RequestBody MesBaseBarcodeInfo mesBaseBarcodeInfo)
{
return toAjax(mesBaseBarcodeInfoService.insertInternalMesBaseBarcode(mesBaseBarcodeInfo));
}
/**
*
@ -139,4 +175,7 @@ public class MesBaseBarcodeInfoController extends BaseController
return success(mesBaseBarcodeInfoService.selectMesBaseBarcodeInfoByBindBarcode(bindBarcode));
}
}

@ -79,4 +79,14 @@ public interface MesBaseBarcodeInfoMapper
* @return
*/
public MesBaseBarcodeInfo selectMesBaseBarcodeInfoByBindBarcode(String bindBarcode);
/**
*
* @param mesBaseBarcodeInfo
* @return
*/
public int selectMesBaseBarcodeInfoCount(MesBaseBarcodeInfo mesBaseBarcodeInfo);
}

@ -80,4 +80,13 @@ public interface MesBaseMaterialInfoMapper
public List<MesBaseMaterialInfo> selectMaterialInfos4AllocationWarehouse(MesBaseMaterialInfo mesBaseMaterialInfo);
/**
*
*
* @param erpId ERP
* @return
*/
public MesBaseMaterialInfo selectMesBaseMaterialInfoByErpId(Long erpId);
}

@ -0,0 +1,61 @@
package com.hw.mes.mapper;
import java.util.List;
import com.hw.mes.domain.MesOrderBind;
/**
* Mapper
*
* @author xins
* @date 2024-05-16
*/
public interface MesOrderBindMapper
{
/**
*
*
* @param orderBindId
* @return
*/
public MesOrderBind selectMesOrderBindByOrderBindId(Long orderBindId);
/**
*
*
* @param mesOrderBind
* @return
*/
public List<MesOrderBind> selectMesOrderBindList(MesOrderBind mesOrderBind);
/**
*
*
* @param mesOrderBind
* @return
*/
public int insertMesOrderBind(MesOrderBind mesOrderBind);
/**
*
*
* @param mesOrderBind
* @return
*/
public int updateMesOrderBind(MesOrderBind mesOrderBind);
/**
*
*
* @param orderBindId
* @return
*/
public int deleteMesOrderBindByOrderBindId(Long orderBindId);
/**
*
*
* @param orderBindIds
* @return
*/
public int deleteMesOrderBindByOrderBindIds(Long[] orderBindIds);
}

@ -5,15 +5,15 @@ import com.hw.mes.domain.MesProductOrder;
/**
* Mapper
*
*
* @author Yinq
* @date 2024-02-20
*/
public interface MesProductOrderMapper
public interface MesProductOrderMapper
{
/**
*
*
*
* @param productOrderId
* @return
*/
@ -21,7 +21,7 @@ public interface MesProductOrderMapper
/**
*
*
*
* @param mesProductOrder
* @return
*/
@ -29,7 +29,7 @@ public interface MesProductOrderMapper
/**
*
*
*
* @param mesProductOrder
* @return
*/
@ -37,7 +37,7 @@ public interface MesProductOrderMapper
/**
*
*
*
* @param mesProductOrder
* @return
*/
@ -45,7 +45,7 @@ public interface MesProductOrderMapper
/**
*
*
*
* @param productOrderId
* @return
*/
@ -53,9 +53,20 @@ public interface MesProductOrderMapper
/**
*
*
*
* @param productOrderIds
* @return
*/
public int deleteMesProductOrderByProductOrderIds(Long[] productOrderIds);
/**
*
*
* @param planCode
* @return
*/
public MesProductOrder selectMesProductOrderByPlanCode(String planCode);
}

@ -2,6 +2,7 @@ package com.hw.mes.service;
import com.hw.mes.api.domain.MesBaseBarcodeInfo;
import com.hw.mes.domain.vo.MesBindBarcodeVo;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@ -93,4 +94,23 @@ public interface IMesBaseBarcodeInfoService
* @return
*/
public MesBaseBarcodeInfo selectMesBaseBarcodeInfoByBindBarcode(String bindBarcode);
/**
*
*
* @param barcodeInfo UID
* @return
*/
public MesBaseBarcodeInfo selectProductBarcodeInfoByBarcodeInfo(String barcodeInfo);
/**
*
* @param mesBaseBarcodeInfo
* @return
*/
public int insertInternalMesBaseBarcode(MesBaseBarcodeInfo mesBaseBarcodeInfo);
}

@ -75,4 +75,16 @@ public interface IMesBaseMaterialInfoService
* @return
*/
public List<MesBaseMaterialInfo> selectMaterialInfos4AllocationWarehouse(MesBaseMaterialInfo mesBaseMaterialInfo);
/**
*
*
* @param erpId ERP
* @return
*/
public MesBaseMaterialInfo selectMesBaseMaterialInfoByErpId(Long erpId);
}

@ -0,0 +1,61 @@
package com.hw.mes.service;
import java.util.List;
import com.hw.mes.domain.MesOrderBind;
/**
* Service
*
* @author xins
* @date 2024-05-16
*/
public interface IMesOrderBindService
{
/**
*
*
* @param orderBindId
* @return
*/
public MesOrderBind selectMesOrderBindByOrderBindId(Long orderBindId);
/**
*
*
* @param mesOrderBind
* @return
*/
public List<MesOrderBind> selectMesOrderBindList(MesOrderBind mesOrderBind);
/**
*
*
* @param mesOrderBind
* @return
*/
public int insertMesOrderBind(MesOrderBind mesOrderBind);
/**
*
*
* @param mesOrderBind
* @return
*/
public int updateMesOrderBind(MesOrderBind mesOrderBind);
/**
*
*
* @param orderBindIds
* @return
*/
public int deleteMesOrderBindByOrderBindIds(Long[] orderBindIds);
/**
*
*
* @param orderBindId
* @return
*/
public int deleteMesOrderBindByOrderBindId(Long orderBindId);
}

@ -13,12 +13,20 @@ import com.hw.common.core.utils.StringUtils;
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.domain.MesBasePalletInfo;
import com.hw.mes.domain.MesOrderBind;
import com.hw.mes.domain.MesProductOrder;
import com.hw.mes.domain.vo.MesBindBarcodeVo;
import com.hw.mes.mapper.MesBasePalletInfoMapper;
import com.hw.mes.mapper.MesOrderBindMapper;
import com.hw.mes.mapper.MesProductOrderMapper;
import com.hw.mes.service.IMesOrderBindService;
import com.hw.printer.api.RemotePrinterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hw.mes.mapper.MesBaseBarcodeInfoMapper;
import com.hw.mes.service.IMesBaseBarcodeInfoService;
import org.springframework.transaction.annotation.Transactional;
/**
* Service
@ -34,6 +42,15 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
@Autowired
private RemotePrinterService remotePrinterService;
@Autowired
private MesOrderBindMapper mesOrderBindMapper;
@Autowired
private MesProductOrderMapper mesProductOrderMapper;
@Autowired
private MesBasePalletInfoMapper mesBasePalletInfoMapper;
/**
*
*
@ -76,28 +93,70 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
* @return
*/
@Override
@Transactional(rollbackFor = Exception.class)
public int insertMesBaseBarcodeInfo(MesBaseBarcodeInfo mesBaseBarcodeInfo) {
Long purchaseOrderId = mesBaseBarcodeInfo.getPurchaseOrderId();
MesBaseBarcodeInfo queryBaseBarcodeInfo = new MesBaseBarcodeInfo();
queryBaseBarcodeInfo.setPurchaseOrderId(purchaseOrderId);
int mesBaseBarcodeInfoCount = mesBaseBarcodeInfoMapper.selectMesBaseBarcodeInfoCount(queryBaseBarcodeInfo);
if (mesBaseBarcodeInfoCount > 0) {
throw new ServiceException("此采购订单已经生成条码,无需重复生成");
}
BigDecimal barcodeAmount = mesBaseBarcodeInfo.getBarcodeAmount();
MesOrderBind queryOrderBind = new MesOrderBind();
queryOrderBind.setPurchaseOrderId(purchaseOrderId);
List<MesOrderBind> mesOrderBinds = mesOrderBindMapper.selectMesOrderBindList(queryOrderBind);
if (mesOrderBinds == null || mesOrderBinds.isEmpty()) {
throw new ServiceException("此采购订单还未绑定销售订单,不能生成条码");
}
BigDecimal totalBindAmount = mesOrderBinds.stream().map(MesOrderBind::getBindAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
if (barcodeAmount.compareTo(totalBindAmount) != 0) {
throw new ServiceException("采购订单还未完全绑定到销售订单");
}
mesBaseBarcodeInfo.setCreateTime(DateUtils.getNowDate());
// 生成原材料条码
if (mesBaseBarcodeInfo.getBarcodeType().equals(MesConstants.MES_BARCODE_TYPE_RAW)) {
//同一批次的批次代码相同
mesBaseBarcodeInfo.setBatchCode(Seq.getId(Seq.mesBatchCodeSeqType, Seq.mesBatchCodeCode));
if (mesBaseBarcodeInfo.getBatchFlag().equals(MesConstants.NOT_IS_BATCH)) {
int frequency = mesBaseBarcodeInfo.getAmount().intValue();
for (int i = 0; i < frequency; i++) {
String batchCode = Seq.getId(Seq.mesBatchCodeSeqType, Seq.mesBatchCodeCode);
MesBaseBarcodeInfo toInsertedBarcodeInfo;
for (MesOrderBind mesOrderBind : mesOrderBinds) {
BigDecimal bindAmount = mesOrderBind.getBindAmount();
for (int i = 0; i < bindAmount.intValue(); i++) {
// 生成数量条的不同条码内容
mesBaseBarcodeInfo.setBarcodeInfo(Seq.getId(Seq.mesBarcodeSeqType, Seq.mesBarcodeCode));
mesBaseBarcodeInfo.setAmount(new BigDecimal(1));
mesBaseBarcodeInfoMapper.insertMesBaseBarcodeInfo(mesBaseBarcodeInfo);
toInsertedBarcodeInfo = new MesBaseBarcodeInfo();
//同一批次的批次代码相同
toInsertedBarcodeInfo.setBatchCode(batchCode);
toInsertedBarcodeInfo.setPurchaseOrderId(purchaseOrderId);
toInsertedBarcodeInfo.setPoNo(mesBaseBarcodeInfo.getPoNo());
toInsertedBarcodeInfo.setBarcodeType(MesConstants.MES_BARCODE_TYPE_RAW);
toInsertedBarcodeInfo.setBarcodeInfo(Seq.getId(Seq.mesBarcodeSeqType, Seq.mesBarcodeCode));
toInsertedBarcodeInfo.setMaterialId(mesBaseBarcodeInfo.getMaterialId());
toInsertedBarcodeInfo.setProductionDate(mesBaseBarcodeInfo.getProductionDate());
toInsertedBarcodeInfo.setLastOutstockDate(mesBaseBarcodeInfo.getLastOutstockDate());
toInsertedBarcodeInfo.setProjectNo(mesBaseBarcodeInfo.getProjectNo());
toInsertedBarcodeInfo.setBatchFlag(mesBaseBarcodeInfo.getBatchFlag());
toInsertedBarcodeInfo.setSaleOrderId(mesOrderBind.getSaleOrderId());
toInsertedBarcodeInfo.setSaleorderCode(mesOrderBind.getSaleOrderCode());
if (mesBaseBarcodeInfo.getBatchFlag().equals(MesConstants.NOT_IS_BATCH)) {
toInsertedBarcodeInfo.setAmount(new BigDecimal(1));
}
if (mesBaseBarcodeInfo.getBatchFlag().equals(MesConstants.IS_BATCH)) {
toInsertedBarcodeInfo.setAmount(mesBaseBarcodeInfo.getAmount());
}
mesBaseBarcodeInfoMapper.insertMesBaseBarcodeInfo(toInsertedBarcodeInfo);
}
}
if (mesBaseBarcodeInfo.getBatchFlag().equals(MesConstants.IS_BATCH)) {
mesBaseBarcodeInfo.setBarcodeInfo(Seq.getId(Seq.mesBarcodeSeqType, Seq.mesBarcodeCode));
mesBaseBarcodeInfoMapper.insertMesBaseBarcodeInfo(mesBaseBarcodeInfo);
}
}
// 生成成品条码
if (mesBaseBarcodeInfo.getBarcodeType().equals(MesConstants.MES_BARCODE_TYPE_PRODUCT)) {
else if (mesBaseBarcodeInfo.getBarcodeType().equals(MesConstants.MES_BARCODE_TYPE_PRODUCT)) {
// 批次代码 == 条码内容
int frequency = mesBaseBarcodeInfo.getAmount().intValue();
for (int i = 0; i < frequency; i++) {
@ -229,10 +288,6 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
}
/**
*
*
@ -243,4 +298,97 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
public MesBaseBarcodeInfo selectMesBaseBarcodeInfoByBindBarcode(String bindBarcode) {
return mesBaseBarcodeInfoMapper.selectMesBaseBarcodeInfoByBindBarcode(bindBarcode);
}
/**
*
*
* @param barcodeInfo
* @return
*/
@Override
public MesBaseBarcodeInfo selectProductBarcodeInfoByBarcodeInfo(String barcodeInfo) {
MesBaseBarcodeInfo productBarcodeInfo = mesBaseBarcodeInfoMapper.selectMesBaseBarcodeInfoByBarcodeInfo(barcodeInfo);
if (productBarcodeInfo == null) {
throw new ServiceException("成品条码信息不存在");
}
String barcodeType = productBarcodeInfo.getBarcodeType();
if (!barcodeType.equals(MesConstants.MES_BARCODE_TYPE_PRODUCT)) {
throw new ServiceException("成品条码信息不存在");
}
String planCode = productBarcodeInfo.getPlanCode();
MesProductOrder productOrder = mesProductOrderMapper.selectMesProductOrderByPlanCode(planCode);
if (productOrder == null) {
throw new ServiceException("无此条码生产工单");
}
if (!productOrder.getSaleType().equals(MesConstants.MES_PRODUCT_ORDER_INTERNAL)) {
throw new ServiceException("此成品非对内生产");
}
return productBarcodeInfo;
}
/**
*
*
* @param mesBaseBarcodeInfo
* @return
*/
@Transactional(rollbackFor = Exception.class)
@Override
public int insertInternalMesBaseBarcode(MesBaseBarcodeInfo mesBaseBarcodeInfo) {
String productBarcode = mesBaseBarcodeInfo.getProductBarcode();
//先判断此成品条码是否有绑定过原材料条码
MesBaseBarcodeInfo queryBarcodeInfo = new MesBaseBarcodeInfo();
queryBarcodeInfo.setProductBarcode(productBarcode);
int bindProductBarcodeCount = mesBaseBarcodeInfoMapper.selectMesBaseBarcodeInfoCount(queryBarcodeInfo);
if (bindProductBarcodeCount > 0) {
throw new ServiceException("此成品条码已经打印过原材料条码,无需重复打印");
}
//先根据之前的成品条码信息获取托盘信息
MesBasePalletInfo queryPalletInfo = new MesBasePalletInfo();
queryPalletInfo.setMaterialBarcode(productBarcode);
List<MesBasePalletInfo> basePalletInfos = mesBasePalletInfoMapper.selectMesBasePalletInfoList(queryPalletInfo);
if (basePalletInfos == null || basePalletInfos.isEmpty()) {
throw new ServiceException("此成品未绑定托盘信息");
}
String userName = SecurityUtils.getUsername();
Date currentDate = DateUtils.getNowDate();
String barcodeInfo = Seq.getId(Seq.mesBarcodeSeqType, Seq.mesBarcodeCode);
//修改托盘信息的绑定关系为当前原材料的
MesBasePalletInfo basePalletInfo = basePalletInfos.get(0);
basePalletInfo.setMaterialBarcode(barcodeInfo);
basePalletInfo.setUpdateBy(userName);
basePalletInfo.setUpdateTime(currentDate);
mesBasePalletInfoMapper.updateMesBasePalletInfo(basePalletInfo);
MesBaseBarcodeInfo productBarcodeInfo = mesBaseBarcodeInfoMapper.selectMesBaseBarcodeInfoByBarcodeInfo(productBarcode);
if(productBarcodeInfo==null){
throw new ServiceException("成品条码不存在");
}
productBarcodeInfo.setPalletInfoCode("");
productBarcodeInfo.setBindStatus(MesConstants.MES_BARCODE_BIND_STATUS_UNBINDING);
productBarcodeInfo.setUpdateTime(currentDate);
productBarcodeInfo.setUpdateBy(userName);
mesBaseBarcodeInfoMapper.updateMesBaseBarcodeInfo(productBarcodeInfo);
mesBaseBarcodeInfo.setBarcodeInfo(barcodeInfo);
mesBaseBarcodeInfo.setBatchCode(barcodeInfo);
mesBaseBarcodeInfo.setBatchFlag(MesConstants.NOT_IS_BATCH);
mesBaseBarcodeInfo.setAmount(BigDecimal.ONE);
mesBaseBarcodeInfo.setBarcodeType(MesConstants.MES_BARCODE_TYPE_RAW);
mesBaseBarcodeInfo.setPalletInfoCode(basePalletInfo.getPalletInfoCode());
mesBaseBarcodeInfo.setCreateTime(currentDate);
mesBaseBarcodeInfo.setCreateBy(userName);
return mesBaseBarcodeInfoMapper.insertMesBaseBarcodeInfo(mesBaseBarcodeInfo);
}
}

@ -122,4 +122,20 @@ public class MesBaseMaterialInfoServiceImpl implements IMesBaseMaterialInfoServi
return mesBaseMaterialInfoMapper.selectMaterialInfos4AllocationWarehouse(mesBaseMaterialInfo);
}
/**
*
*
* @param erpId ERP
* @return
*/
@Override
public MesBaseMaterialInfo selectMesBaseMaterialInfoByErpId(Long erpId)
{
return mesBaseMaterialInfoMapper.selectMesBaseMaterialInfoByErpId(erpId);
}
}

@ -0,0 +1,96 @@
package com.hw.mes.service.impl;
import java.util.List;
import com.hw.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hw.mes.mapper.MesOrderBindMapper;
import com.hw.mes.domain.MesOrderBind;
import com.hw.mes.service.IMesOrderBindService;
/**
* Service
*
* @author xins
* @date 2024-05-16
*/
@Service
public class MesOrderBindServiceImpl implements IMesOrderBindService
{
@Autowired
private MesOrderBindMapper mesOrderBindMapper;
/**
*
*
* @param orderBindId
* @return
*/
@Override
public MesOrderBind selectMesOrderBindByOrderBindId(Long orderBindId)
{
return mesOrderBindMapper.selectMesOrderBindByOrderBindId(orderBindId);
}
/**
*
*
* @param mesOrderBind
* @return
*/
@Override
public List<MesOrderBind> selectMesOrderBindList(MesOrderBind mesOrderBind)
{
return mesOrderBindMapper.selectMesOrderBindList(mesOrderBind);
}
/**
*
*
* @param mesOrderBind
* @return
*/
@Override
public int insertMesOrderBind(MesOrderBind mesOrderBind)
{
mesOrderBind.setCreateTime(DateUtils.getNowDate());
return mesOrderBindMapper.insertMesOrderBind(mesOrderBind);
}
/**
*
*
* @param mesOrderBind
* @return
*/
@Override
public int updateMesOrderBind(MesOrderBind mesOrderBind)
{
mesOrderBind.setUpdateTime(DateUtils.getNowDate());
return mesOrderBindMapper.updateMesOrderBind(mesOrderBind);
}
/**
*
*
* @param orderBindIds
* @return
*/
@Override
public int deleteMesOrderBindByOrderBindIds(Long[] orderBindIds)
{
return mesOrderBindMapper.deleteMesOrderBindByOrderBindIds(orderBindIds);
}
/**
*
*
* @param orderBindId
* @return
*/
@Override
public int deleteMesOrderBindByOrderBindId(Long orderBindId)
{
return mesOrderBindMapper.deleteMesOrderBindByOrderBindId(orderBindId);
}
}

@ -18,8 +18,10 @@
<result property="materialId" column="material_id"/>
<result property="manufacturerId" column="manufacturer_id"/>
<result property="amount" column="amount"/>
<result property="productBarcode" column="product_barcode"/>
<result property="machineName" column="machine_name"/>
<result property="printNumber" column="print_number"/>
<result property="purchaseOrderId" column="purchase_order_id"/>
<result property="poNo" column="po_no"/>
<result property="productionDate" column="production_date"/>
<result property="acceptedDate" column="accepted_date"/>
@ -36,6 +38,7 @@
<result property="bindTime" column="bind_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="materialCode" column="material_code"/>
<result property="materialName" column="material_name"/>
</resultMap>
@ -50,8 +53,10 @@
bbi.pallet_info_code,
bbi.bind_barcode,
bbi.material_id,
bmi.material_code,
bmi.material_name,
bbi.manufacturer_id,
bbi.product_barcode,
bbi.amount,
bbi.machine_name,
bbi.print_number,
@ -110,6 +115,7 @@
<if test="updateBy != null and updateBy != ''">and bbi.update_by = #{updateBy}</if>
<if test="updateTime != null ">and bbi.update_time = #{updateTime}</if>
</where>
order by bbi.barcode_id desc
</select>
<select id="selectMesBaseBarcodeInfoByBarcodeId" parameterType="Long" resultMap="MesBaseBarcodeInfoResult">
@ -132,8 +138,10 @@
<if test="materialId != null">material_id,</if>
<if test="manufacturerId != null">manufacturer_id,</if>
<if test="amount != null">amount,</if>
<if test="productBarcode != null">product_barcode,</if>
<if test="machineName != null">machine_name,</if>
<if test="printNumber != null">print_number,</if>
<if test="purchaseOrderId != null">purchase_order_id,</if>
<if test="poNo != null">po_no,</if>
<if test="productionDate != null">production_date,</if>
<if test="acceptedDate != null">accepted_date,</if>
@ -163,8 +171,10 @@
<if test="materialId != null">#{materialId},</if>
<if test="manufacturerId != null">#{manufacturerId},</if>
<if test="amount != null">#{amount},</if>
<if test="productBarcode != null">#{productBarcode},</if>
<if test="machineName != null">#{machineName},</if>
<if test="printNumber != null">#{printNumber},</if>
<if test="purchaseOrderId != null">#{purchaseOrderId},</if>
<if test="poNo != null">#{poNo},</if>
<if test="productionDate != null">#{productionDate},</if>
<if test="acceptedDate != null">#{acceptedDate},</if>
@ -243,4 +253,50 @@
<include refid="selectMesBaseBarcodeInfoVo"/>
where bbi.bind_barcode = #{bindBarcode} limit 1
</select>
<select id="selectMesBaseBarcodeInfoCount" parameterType="MesBaseBarcodeInfo">
select count(1) from mes_base_barcode_info bbi
<where>
<if test="purchaseOrderId != null ">and bbi.purchase_order_id = #{purchaseOrderId}</if>
<if test="productBarcode != null and productBarcode != ''">and bbi.product_barcode = #{productBarcode}</if>
<if test="printTime != null ">and bbi.print_time = #{printTime}</if>
<if test="printPerson != null and printPerson != ''">and bbi.print_person = #{printPerson}</if>
<if test="printFlag != null and printFlag != ''">and bbi.print_flag = #{printFlag}</if>
<if test="batchFlag != null and batchFlag != ''">and bbi.batch_flag = #{batchFlag}</if>
<if test="barcodeType != null and barcodeType != ''">and bbi.barcode_type = #{barcodeType}</if>
<if test="barcodeInfo != null and barcodeInfo != ''">and bbi.barcode_info = #{barcodeInfo}</if>
<if test="batchCode != null and batchCode != ''">and bbi.batch_code = #{batchCode}</if>
<if test="palletInfoCode != null and palletInfoCode != ''">and bbi.pallet_info_code = #{palletInfoCode}</if>
<if test="materialId != null ">and bbi.material_id = #{materialId}</if>
<if test="manufacturerId != null ">and bbi.manufacturer_id = #{manufacturerId}</if>
<if test="amount != null ">and bbi.amount = #{amount}</if>
<if test="machineName != null and machineName != ''">and bbi.machine_name like concat('%', #{machineName},
'%')
</if>
<if test="printNumber != null ">and bbi.print_number = #{printNumber}</if>
<if test="poNo != null and poNo != ''">and bbi.po_no = #{poNo}</if>
<if test="productionDate != null ">and bbi.production_date = #{productionDate}</if>
<if test="acceptedDate != null ">and bbi.accepted_date = #{acceptedDate}</if>
<if test="lastOutstockDate != null ">and bbi.last_outstock_date = #{lastOutstockDate}</if>
<if test="planCode != null and planCode != ''">and bbi.plan_code = #{planCode}</if>
<if test="planDetailCode != null and planDetailCode != ''">and bbi.plan_detail_code = #{planDetailCode}</if>
<if test="saleOrderId != null ">and bbi.sale_order_id = #{saleOrderId}</if>
<if test="saleorderCode != null and saleorderCode != ''">and bbi.saleorder_code = #{saleorderCode}</if>
<if test="projectNo != null and projectNo != ''">and bbi.project_no = #{projectNo}</if>
<if test="serialNumber != null and serialNumber != ''">and bbi.serial_number = #{serialNumber}</if>
<if test="bindStatus != null and bindStatus != ''">and bbi.bind_status = #{bindStatus}</if>
<if test="bindBy != null and bindBy != ''">and bbi.bind_by = #{bindBy}</if>
<if test="bindTime != null ">and bbi.bind_time = #{bindTime}</if>
<if test="updateBy != null and updateBy != ''">and bbi.update_by = #{updateBy}</if>
<if test="updateTime != null ">and bbi.update_time = #{updateTime}</if>
</where>
</select>
</mapper>

@ -15,12 +15,14 @@
<result property="materialTypeId" column="material_type_id"/>
<result property="materialTypeName" column="material_type_name"/>
<result property="batchFlag" column="batch_flag"/>
<result property="batchAmount" column="batch_amount" />
<result property="materialUnitId" column="material_unit_id"/>
<result property="materialUnit" column="material_unit"/>
<result property="materialMatkl" column="material_matkl"/>
<result property="materialSpec" column="material_spec"/>
<result property="netWeight" column="net_weight"/>
<result property="grossWeight" column="gross_weight"/>
<result property="bindFlag" column="bind_flag" />
<result property="factoryId" column="factory_id"/>
<result property="createOrgId" column="create_org_id"/>
<result property="useOrgId" column="use_org_id"/>
@ -207,6 +209,8 @@
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="approveDate != null">approve_date = #{approveDate},</if>
<if test="erpModifyDate != null">erp_modify_date = #{erpModifyDate},</if>
<if test="bindFlag != null">bind_flag = #{bindFlag},</if>
<if test="batchAmount != null">batch_amount = #{batchAmount},</if>
</trim>
where material_id = #{materialId}
</update>
@ -296,4 +300,31 @@
</select>
<select id="selectMesBaseMaterialInfoByErpId" parameterType="Long" resultMap="MesBaseMaterialInfoResult">
select bmi.material_id,
bmi.erp_id,
bmi.material_code,
bmi.old_material_code,
bmi.material_name,
bmi.material_categories,
bmi.material_subclass,
bmi.material_type_id,
bmi.batch_flag,
bmi.batch_amount,
bmi.material_unit_id,
bmi.material_unit,
bmi.material_matkl,
bmi.material_spec,
bmi.net_weight,
bmi.gross_weight,
bmi.factory_id,
bmi.create_org_id,
bmi.use_org_id,
bmi.prodline_id,
bmi.approve_date,
bmi.erp_modify_date
from mes_base_material_info bmi
where bmi.erp_id = #{erpId} limit 1
</select>
</mapper>

@ -27,6 +27,7 @@
<include refid="selectMesBasePalletInfoVo"/>
<where>
<if test="palletInfoCode != null and palletInfoCode != ''">and pallet_info_code = #{palletInfoCode}</if>
<if test="materialBarcode != null and materialBarcode != ''">and material_barcode = #{materialBarcode}</if>
</where>
</select>

@ -0,0 +1,131 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hw.mes.mapper.MesOrderBindMapper">
<resultMap type="MesOrderBind" id="MesOrderBindResult">
<result property="orderBindId" column="order_bind_id" />
<result property="safeFlag" column="safe_flag" />
<result property="saleOrderId" column="sale_order_id" />
<result property="saleOrderCode" column="sale_order_code" />
<result property="productId" column="product_id" />
<result property="productCode" column="product_code" />
<result property="productName" column="product_name" />
<result property="purchaseOrderId" column="purchase_order_id" />
<result property="poNo" column="po_no" />
<result property="materialId" column="material_id" />
<result property="materialCode" column="material_code" />
<result property="materialName" column="material_name" />
<result property="bindAmount" column="bind_amount" />
<result property="remark" column="remark" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectMesOrderBindVo">
select order_bind_id, safe_flag, sale_order_id, sale_order_code, product_id, product_code, product_name, purchase_order_id, po_no, material_id, material_code, material_name, bind_amount, remark, create_by, create_time, update_by, update_time from mes_order_bind
</sql>
<select id="selectMesOrderBindList" parameterType="MesOrderBind" resultMap="MesOrderBindResult">
<include refid="selectMesOrderBindVo"/>
<where>
<if test="safeFlag != null and safeFlag != ''"> and safe_flag = #{safeFlag}</if>
<if test="saleOrderId != null "> and sale_order_id = #{saleOrderId}</if>
<if test="saleOrderCode != null and saleOrderCode != ''"> and sale_order_code = #{saleOrderCode}</if>
<if test="productId != null "> and product_id = #{productId}</if>
<if test="productCode != null and productCode != ''"> and product_code = #{productCode}</if>
<if test="productName != null and productName != ''"> and product_name like concat('%', #{productName}, '%')</if>
<if test="purchaseOrderId != null "> and purchase_order_id = #{purchaseOrderId}</if>
<if test="poNo != null and poNo != ''"> and po_no = #{poNo}</if>
<if test="materialId != null "> and material_id = #{materialId}</if>
<if test="materialCode != null and materialCode != ''"> and material_code = #{materialCode}</if>
<if test="materialName != null and materialName != ''"> and material_name like concat('%', #{materialName}, '%')</if>
<if test="bindAmount != null "> and bind_amount = #{bindAmount}</if>
</where>
</select>
<select id="selectMesOrderBindByOrderBindId" parameterType="Long" resultMap="MesOrderBindResult">
<include refid="selectMesOrderBindVo"/>
where order_bind_id = #{orderBindId}
</select>
<insert id="insertMesOrderBind" parameterType="MesOrderBind" useGeneratedKeys="true" keyProperty="orderBindId">
insert into mes_order_bind
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="safeFlag != null and safeFlag != ''">safe_flag,</if>
<if test="saleOrderId != null">sale_order_id,</if>
<if test="saleOrderCode != null">sale_order_code,</if>
<if test="productId != null">product_id,</if>
<if test="productCode != null">product_code,</if>
<if test="productName != null">product_name,</if>
<if test="purchaseOrderId != null">purchase_order_id,</if>
<if test="poNo != null">po_no,</if>
<if test="materialId != null">material_id,</if>
<if test="materialCode != null">material_code,</if>
<if test="materialName != null">material_name,</if>
<if test="bindAmount != null">bind_amount,</if>
<if test="remark != null">remark,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="safeFlag != null and safeFlag != ''">#{safeFlag},</if>
<if test="saleOrderId != null">#{saleOrderId},</if>
<if test="saleOrderCode != null">#{saleOrderCode},</if>
<if test="productId != null">#{productId},</if>
<if test="productCode != null">#{productCode},</if>
<if test="productName != null">#{productName},</if>
<if test="purchaseOrderId != null">#{purchaseOrderId},</if>
<if test="poNo != null">#{poNo},</if>
<if test="materialId != null">#{materialId},</if>
<if test="materialCode != null">#{materialCode},</if>
<if test="materialName != null">#{materialName},</if>
<if test="bindAmount != null">#{bindAmount},</if>
<if test="remark != null">#{remark},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateMesOrderBind" parameterType="MesOrderBind">
update mes_order_bind
<trim prefix="SET" suffixOverrides=",">
<if test="safeFlag != null and safeFlag != ''">safe_flag = #{safeFlag},</if>
<if test="saleOrderId != null">sale_order_id = #{saleOrderId},</if>
<if test="saleOrderCode != null">sale_order_code = #{saleOrderCode},</if>
<if test="productId != null">product_id = #{productId},</if>
<if test="productCode != null">product_code = #{productCode},</if>
<if test="productName != null">product_name = #{productName},</if>
<if test="purchaseOrderId != null">purchase_order_id = #{purchaseOrderId},</if>
<if test="poNo != null">po_no = #{poNo},</if>
<if test="materialId != null">material_id = #{materialId},</if>
<if test="materialCode != null">material_code = #{materialCode},</if>
<if test="materialName != null">material_name = #{materialName},</if>
<if test="bindAmount != null">bind_amount = #{bindAmount},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where order_bind_id = #{orderBindId}
</update>
<delete id="deleteMesOrderBindByOrderBindId" parameterType="Long">
delete from mes_order_bind where order_bind_id = #{orderBindId}
</delete>
<delete id="deleteMesOrderBindByOrderBindIds" parameterType="String">
delete from mes_order_bind where order_bind_id in
<foreach item="orderBindId" collection="array" open="(" separator="," close=")">
#{orderBindId}
</foreach>
</delete>
</mapper>

@ -240,4 +240,22 @@
#{productOrderId}
</foreach>
</delete>
<select id="selectMesProductOrderByPlanCode" parameterType="String" resultMap="MesProductOrderResult">
select mpo.product_order_id,mpo.sale_type from mes_product_order mpo
where mpo.order_status not in ('9') and
exists (select 1 from mes_product_plan mpp where mpp.product_order_id=mpo.product_order_id and mpp.plan_code = #{planCode})
limit 1
</select>
</mapper>

@ -50,3 +50,31 @@ export function printBarCode(barcodeId) {
method: 'get'
})
}
// 查询物料信息详细
export function getMaterialInfoByErpId(erpId) {
return request({
url: '/mes/barcode/getMaterialInfoByErpId/' + erpId,
method: 'get'
})
}
// 查询物料信息详细
export function selectProductBarcodeInfoByBarcodeInfo(barcodeInfo) {
return request({
url: '/mes/barcode/selectProductBarcodeInfoByBarcodeInfo/' + barcodeInfo,
method: 'get'
})
}
// 内部生产新增原材料条码信息
export function addInternalBarcode(data) {
return request({
url: '/mes/barcode/addInternalBarcode',
method: 'post',
data: data
})
}

@ -46,9 +46,22 @@
size="mini"
@click="handleAdd"
v-hasPermi="['mes:barcode:add']"
>新增
>采购新增
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleInternalAdd"
v-hasPermi="['mes:barcode:add']"
>生产新增
</el-button>
</el-col>
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="success"-->
@ -96,6 +109,8 @@
</template>
</el-table-column>
<el-table-column label="采购订单号" align="center" prop="poNo" v-if="columns[13].visible" width="100"/>
<el-table-column label="销售订单号" align="center" prop="saleorderCode" v-if="columns[29].visible" width="100"/>
<el-table-column label="批次代码" align="center" prop="batchCode" v-if="columns[6].visible" width="100"/>
<el-table-column label="条码内容" align="center" prop="barcodeInfo" v-if="columns[5].visible" width="100"/>
<el-table-column label="批次标识" align="center" prop="batchFlag" v-if="columns[3].visible">
@ -105,7 +120,7 @@
</el-table-column>
<el-table-column label="物料名称" align="center" prop="materialName" v-if="columns[8].visible" width="100"/>
<el-table-column label="供应商ID" align="center" prop="manufacturerId" v-if="columns[9].visible"/>
<el-table-column label="数量" align="center" prop="amount" v-if="columns[10].visible"/>
<el-table-column label="批次数量" align="center" prop="amount" v-if="columns[10].visible"/>
<el-table-column label="生产日期" align="center" prop="productionDate" width="180" v-if="columns[14].visible">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.productionDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
@ -116,7 +131,8 @@
<span>{{ parseTime(scope.row.acceptedDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="最晚出库日期" align="center" prop="lastOutstockDate" width="180" v-if="columns[16].visible">
<el-table-column label="最晚出库日期" align="center" prop="lastOutstockDate" width="180"
v-if="columns[16].visible">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.lastOutstockDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
@ -156,6 +172,13 @@
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-refresh"
@click="handlePrintBarCode(scope.row)"
>重新生成
</el-button>
<el-button
size="mini"
type="text"
@ -199,17 +222,7 @@
<el-button slot="append" icon="el-icon-search" @click="handlePurchaseOrderAdd"></el-button>
</el-input>
</el-form-item>
<el-form-item label="批次标识" prop="batchFlag">
<el-radio-group v-model="form.batchFlag">
<el-radio
v-for="dict in dict.type.active_flag"
:key="dict.value"
:label="dict.value"
:disabled="batchVisible"
>{{ dict.label }}
</el-radio>
</el-radio-group>
</el-form-item>
<!-- <el-form-item label="条码类型" prop="barcodeType">-->
<!-- <el-radio-group v-model="form.barcodeType">-->
<!-- <el-radio-->
@ -231,14 +244,45 @@
<el-form-item label="物料ID" prop="materialId" v-if="false">
<el-input v-model="form.materialId" placeholder="请输入物料ID"/>
</el-form-item>
<el-form-item label="物料编码" prop="materialCode">
<el-input v-model="form.materialCode" :disabled="true"/>
</el-form-item>
<el-form-item label="物料名称" prop="materialName">
<el-input v-model="form.materialName" placeholder="请输入物料名称" :disabled="true"/>
<el-input v-model="form.materialName" :disabled="true"/>
</el-form-item>
<el-form-item label="批次标识" prop="batchFlag">
<el-radio-group v-model="form.batchFlag" disabled>
<el-radio
v-for="dict in dict.type.active_flag"
:key="dict.value"
:label="dict.value"
>{{ dict.label }}
</el-radio>
</el-radio-group>
</el-form-item>
<!-- <el-form-item label="供应商ID" prop="manufacturerId">-->
<!-- <el-input v-model="form.manufacturerId" placeholder="请输入供应商ID" />-->
<!-- </el-form-item>-->
<el-form-item label="数量" prop="amount">
<el-input-number v-model="form.amount" placeholder="请输入数量"/>
<el-form-item prop="amount" v-if="batchVisible">
<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-form-item>
<el-form-item prop="barcodeAmount">
<span slot="label">
<el-tooltip content="需要打印条码的数量如果需要贴10个条码则需要生成10个" placement="top">
<i class="el-icon-question"></i>
</el-tooltip>
条码数量
</span>
<el-input v-model="form.barcodeAmount" disabled/>
</el-form-item>
<el-form-item label="生产日期" prop="productionDate">
@ -304,13 +348,64 @@
</div>
</el-dialog>
<!-- 添加或修改对内生产的原材料条码信息对话框 -->
<el-dialog :title="title" :visible.sync="internalOpen" width="500px" append-to-body>
<el-form ref="internalForm" :model="internalForm" :rules="internalRules" label-width="100px">
<el-form-item label="成品条码" prop="productBarcode">
<el-input v-model="internalForm.productBarcode" placeholder="请输入或扫描成品条码" class="input-with-select"
@blur="selectProductBarcodeInfoByBarcodeInfo">
<el-button slot="append" icon="el-icon-full-screen"></el-button>
</el-input>
</el-form-item>
<el-form-item label="物料ID" prop="materialId" v-if="false">
<el-input v-model="internalForm.materialId" placeholder="请输入物料ID"/>
</el-form-item>
<el-form-item label="物料编码" prop="materialCode">
<el-input v-model="internalForm.materialCode" disabled/>
</el-form-item>
<el-form-item label="物料名称" prop="materialName">
<el-input v-model="internalForm.materialName" :disabled="true"/>
</el-form-item>
<el-form-item label="生产日期" prop="productionDate">
<el-date-picker clearable
v-model="internalForm.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="internalForm.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="internalForm.remark" type="textarea" placeholder="请输入内容"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitInternalForm"> </el-button>
<el-button @click="cancelInternal"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {listBarcode, getBarcode, delBarcode, addBarcode, updateBarcode, printBarCode} from "@/api/mes/barcode";
import {
listBarcode, getBarcode, delBarcode, addBarcode, updateBarcode,
printBarCode, getMaterialInfoByErpId, selectProductBarcodeInfoByBarcodeInfo,
addInternalBarcode
} from "@/api/mes/barcode";
import addPurchaseOrder from '@//views/mes/purchaseOrder/addPurchaseOrder.vue';
import {getMaterialinfo} from "@//api/mes/materialinfo";
export default {
name: "Barcode",
@ -385,6 +480,9 @@ export default {
batchFlag: [
{required: true, message: "批次标识不能为空", trigger: "change"}
],
amount: [
{required: true, message: "批次数量不能为空", trigger: "change"}
],
barcodeType: [
{required: true, message: "条码类型不能为空", trigger: "change"}
],
@ -422,7 +520,32 @@ export default {
{key: 26, label: `绑定托盘时间`, visible: true},
{key: 27, label: `更新人`, visible: false},
{key: 28, label: `更新时间`, visible: false},
{key: 29, label: `销售订单号`, visible: true},
],
internalOpen: false,
//
internalForm: {},
//
internalRules: {
poNo: [
{required: true, message: "采购订单号不能为空", trigger: "change"}
],
batchFlag: [
{required: true, message: "批次标识不能为空", trigger: "change"}
],
amount: [
{required: true, message: "批次数量不能为空", trigger: "change"}
],
barcodeType: [
{required: true, message: "条码类型不能为空", trigger: "change"}
],
materialId: [
{required: true, message: "物料ID不能为空", trigger: "blur"}
],
},
};
},
created() {
@ -459,14 +582,15 @@ export default {
barcodeId: null,
printTime: null,
printPerson: null,
batchFlag: '1',
batchFlag: null,
barcodeType: '1',
barcodeInfo: null,
batchCode: null,
palletInfoCode: null,
materialId: null,
manufacturerId: null,
amount: 1,
amount: null,
barcodeAmount: null,
machineName: null,
printNumber: null,
poNo: null,
@ -518,16 +642,30 @@ export default {
submitPurchaseOrderForm() {
let selectedRow = this.$refs.purchaseOrderRef.selectedRow;
this.form.barcodeType = '1';//1,2,3,4
this.form.materialId = selectedRow.materialId;
// this.form.materialId = selectedRow.materialId;//ERPID
this.form.materialCode = selectedRow.materialCode;
this.form.materialName = selectedRow.materialName;
this.form.projectNo = selectedRow.projectNo;
this.form.purchaseOrderId = selectedRow.purchaseOrderId;
this.form.poNo = selectedRow.poNo;
this.form.barcodeAmount = selectedRow.orderAmount;
getMaterialinfo(selectedRow.materialId).then(response => {
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.batchVisible = true;
this.form.materialId = response.data.materialId;
if (this.form.batchFlag == "0") {
this.batchVisible = false;
} else {
this.form.amount = response.data.batchAmount;
this.batchVisible = true;
}
} else {
this.batchVisible = false;
this.batchVisible = true;
}
this.purchaseOrderOpen = false;
@ -596,7 +734,94 @@ export default {
this.download('mes/barcode/export', {
...this.queryParams
}, `barcode_${new Date().getTime()}.xlsx`)
}
},
//
resetInternal() {
this.internalForm = {
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("internalForm");
},
/** 内部生产原材料条码新增按钮操作 */
handleInternalAdd() {
this.resetInternal();
this.internalOpen = true;
this.title = "添加原材料条码信息";
},
selectProductBarcodeInfoByBarcodeInfo() {
selectProductBarcodeInfoByBarcodeInfo(this.internalForm.productBarcode).then(response => {
if (response.data == null) {
this.$modal.msgError("成品信息不存在");
return;
}
this.$set(this.internalForm,"materialId",response.data.materialId);
this.$set(this.internalForm,"materialCode",response.data.materialCode);
this.$set(this.internalForm,"materialName",response.data.materialName);
this.$set(this.internalForm,"productionDate",response.data.productionDate);
this.$set(this.internalForm,"saleOrderId",response.data.saleOrderId);
this.$set(this.internalForm,"saleorderCode",response.data.saleorderCode);
});
},
/** 提交按钮 */
submitInternalForm() {
this.$refs["internalForm"].validate(valid => {
if (valid) {
addInternalBarcode(this.internalForm).then(response => {
this.$modal.msgSuccess("新增成功");
this.internalOpen = false;
this.getList();
});
}
});
},
//
cancelInternal() {
this.internalOpen = false;
this.resetInternal();
},
}
};
</script>

@ -42,7 +42,7 @@
highlight-current-row
>
<el-table-column type="selection" width="55" align="center" v-if="false" />
<el-table-column label="主键标识" align="center" prop="purchaseOrderId" v-if="columns[0].visible"/>
<el-table-column label="ID" align="center" prop="purchaseOrderId" v-if="columns[0].visible"/>
<el-table-column label="ERP主键信息" align="center" prop="erpId" v-if="columns[1].visible"/>
<el-table-column label="金蝶ERP订单明细ID" align="center" prop="fentryId" v-if="columns[2].visible"/>
<el-table-column label="采购订单编号" align="center" prop="poNo" v-if="columns[3].visible" width="120" />
@ -173,7 +173,7 @@ export default {
],
},
columns: [
{ key: 0, label: `主键标识`, visible: false },
{ key: 0, label: `主键标识`, visible: true },
{ key: 1, label: `ERP主键信息`, visible: false },
{ key: 2, label: `金蝶ERP订单明细ID`, visible: false },
{ key: 3, label: `采购订单编号`, visible: true },

@ -82,7 +82,7 @@
</template>
<script>
import { listSaleOrder, getSaleOrder, delSaleOrder, addSaleOrder, updateSaleOrder } from "@/api/mes/saleOrder";
import { getSaleOrders } from "@/api/mes/purchaseOrder";
export default {
name: "SaleOrder",
@ -181,7 +181,7 @@ export default {
/** 查询销售订单信息列表 */
getList() {
this.loading = true;
listSaleOrder(this.queryParams).then(response => {
getSaleOrders(this.queryParams).then(response => {
this.saleOrderList = response.rows;
this.total = response.total;
this.loading = false;

Loading…
Cancel
Save