mes:
原材料条码:合并条码修改功能完成
master
xs 5 months ago
parent 57cb7848e0
commit ee0c2c36f9

@ -196,6 +196,8 @@ public class MesBaseBarcodeInfo extends BaseEntity
private Long materialBomId;
private String rawFlag;
public String getLocationCode() {
return locationCode;
@ -629,6 +631,15 @@ public class MesBaseBarcodeInfo extends BaseEntity
this.materialBomId = materialBomId;
}
public String getRawFlag() {
return rawFlag;
}
public void setRawFlag(String rawFlag) {
this.rawFlag = rawFlag;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

@ -10,29 +10,38 @@ import java.util.Date;
/**
* mes_sale_order_relate
*
*
* @author xins
* @date 2024-09-09
*/
public class MesSaleOrderRelate extends BaseEntity
{
public class MesSaleOrderRelate extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 主键 */
/**
*
*/
private Long saleOrderRelateId;
/** 销售订单ID */
/**
* ID
*/
@Excel(name = "销售订单ID")
private Long saleOrderId;
/** 条码信息 */
/**
*
*/
private String barcodeInfo;
/** 采购订单绑定销售订单ID */
/**
* ID
*/
private Long orderBindId;
/** 关联销售订单ID */
/**
* ID
*/
@Excel(name = "关联销售订单ID")
private Long relateSaleOrderId;
@ -44,10 +53,14 @@ public class MesSaleOrderRelate extends BaseEntity
private Long productId;
/** 采购订单ID */
/**
* ID
*/
private Long purchaseOrderId;
/** 关联销售订单的数量,有可能小于原销售订单的订单数量 */
/**
*
*/
@Excel(name = "关联销售订单的数量,有可能小于原销售订单的订单数量")
private BigDecimal relateSaleOrderAmount;
@ -73,25 +86,24 @@ public class MesSaleOrderRelate extends BaseEntity
private int index;
/**采购数量*/
/**
*
*/
private BigDecimal orderAmount;
public void setSaleOrderRelateId(Long saleOrderRelateId)
{
public void setSaleOrderRelateId(Long saleOrderRelateId) {
this.saleOrderRelateId = saleOrderRelateId;
}
public Long getSaleOrderRelateId()
{
public Long getSaleOrderRelateId() {
return saleOrderRelateId;
}
public void setSaleOrderId(Long saleOrderId)
{
public void setSaleOrderId(Long saleOrderId) {
this.saleOrderId = saleOrderId;
}
public Long getSaleOrderId()
{
public Long getSaleOrderId() {
return saleOrderId;
}
@ -127,8 +139,7 @@ public class MesSaleOrderRelate extends BaseEntity
this.orderBindId = orderBindId;
}
public void setRelateSaleOrderId(Long relateSaleOrderId)
{
public void setRelateSaleOrderId(Long relateSaleOrderId) {
this.relateSaleOrderId = relateSaleOrderId;
}
@ -156,8 +167,7 @@ public class MesSaleOrderRelate extends BaseEntity
this.purchaseOrderId = purchaseOrderId;
}
public Long getRelateSaleOrderId()
{
public Long getRelateSaleOrderId() {
return relateSaleOrderId;
}
@ -249,13 +259,17 @@ public class MesSaleOrderRelate extends BaseEntity
this.orderAmount = orderAmount;
}
public String getBindIndex() {
return virtualMaterialId + "-" + materialId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("saleOrderRelateId", getSaleOrderRelateId())
.append("saleOrderId", getSaleOrderId())
.append("relateSaleOrderId", getRelateSaleOrderId())
.append("relateSaleOrderAmout", getRelateSaleOrderAmount())
.toString();
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("saleOrderRelateId", getSaleOrderRelateId())
.append("saleOrderId", getSaleOrderId())
.append("relateSaleOrderId", getRelateSaleOrderId())
.append("relateSaleOrderAmout", getRelateSaleOrderAmount())
.toString();
}
}

@ -195,6 +195,7 @@ public class MesConstants {
/**
*
*/
public static final String MES_BARCODE_SINGLE_FLAG_NO = "0";//否
public static final String MES_BARCODE_SINGLE_FLAG_YES = "1";//是
public static final String MES_BARCODE_SINGLE_FLAG_INTERNAL = "2";//对内

@ -373,6 +373,17 @@ public class MesBaseBarcodeInfoController extends BaseController
return toAjax(mesBaseBarcodeInfoService.generateMergeRawBarcode(mesBaseBarcodeInfo));
}
/**
*
*/
@RequiresPermissions("mes:barcode:edit")
@Log(title = "条码信息", businessType = BusinessType.UPDATE)
@PostMapping("/mergeUpdate")
public AjaxResult mergeUpdate(@RequestBody MesBaseBarcodeInfo mesBaseBarcodeInfo)
{
return toAjax(mesBaseBarcodeInfoService.updateMergeRawBarcode(mesBaseBarcodeInfo));
}
/**

@ -286,6 +286,8 @@ public class MesPurchaseOrder extends BaseEntity {
private String singleFlag;
private Long erpMaterialId;
public Long getSerialNumber() {
return serialNumber;
@ -727,6 +729,14 @@ public class MesPurchaseOrder extends BaseEntity {
this.singleFlag = singleFlag;
}
public Long getErpMaterialId() {
return erpMaterialId;
}
public void setErpMaterialId(Long erpMaterialId) {
this.erpMaterialId = erpMaterialId;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

@ -232,4 +232,12 @@ public interface IMesBaseBarcodeInfoService {
* @return
*/
public MesBaseBarcodeInfo getBarcodeInfoByBindBarcode(String bindBarcode);
/**
*
*
* @param mesBaseBarcodeInfo
*/
public int updateMergeRawBarcode(MesBaseBarcodeInfo mesBaseBarcodeInfo);
}

@ -28,9 +28,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
/**
@ -561,6 +559,10 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
*/
@Override
public int updateMesBaseBarcodeInfo(MesBaseBarcodeInfo mesBaseBarcodeInfo) {
MesBaseBarcodeInfo dbBaseBarcodeInfo = mesBaseBarcodeInfoMapper.selectMesBaseBarcodeInfoByBarcodeId(mesBaseBarcodeInfo.getBarcodeId());
if (StringUtils.isNotEmpty(dbBaseBarcodeInfo.getPrintFlag()) && dbBaseBarcodeInfo.getPrintFlag().equals(MesConstants.MES_BARCODE_PRINT_FLAG_YES)) {
throw new ServiceException("此条码已经打印,不能修改");
}
mesBaseBarcodeInfo.setUpdateBy(SecurityUtils.getUsername());
mesBaseBarcodeInfo.setUpdateTime(DateUtils.getNowDate());
return mesBaseBarcodeInfoMapper.updateMesBaseBarcodeInfo(mesBaseBarcodeInfo);
@ -721,7 +723,7 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
PrintContentVo printMaterialSpec = new PrintContentVo();
printMaterialSpec.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_MATERIAL_SPEC);
if(StringUtils.isNotEmpty(mesBaseBarcodeInfo.getBarcodeSpec())) {
if (StringUtils.isNotEmpty(mesBaseBarcodeInfo.getBarcodeSpec())) {
printMaterialSpec.setValue(mesBaseBarcodeInfo.getBarcodeSpec().replaceAll("[\\x00-\\x1F\\x7F-\\x9F]", ""));
}
printMaterialSpec.setType(PrintContentVo.TYPE_TEXT);
@ -1606,6 +1608,220 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
}
/**
*
*
* @param mesBaseBarcodeInfo
*/
@Override
@Transactional(rollbackFor = Exception.class)
public int updateMergeRawBarcode(MesBaseBarcodeInfo mesBaseBarcodeInfo) {
Date currentDate = new Date();
String userName = SecurityUtils.getUsername();
String barcodeInfo = mesBaseBarcodeInfo.getBarcodeInfo();
//修改后的合并信息
List<MesSaleOrderRelate> mesSaleOrderRelateList = mesBaseBarcodeInfo.getMesSaleOrderRelateList();
//数据库中的合并信息
MesSaleOrderRelate querySaleOrderRelateByBarcodeInfo = new MesSaleOrderRelate();
querySaleOrderRelateByBarcodeInfo.setBarcodeInfo(barcodeInfo);
List<MesSaleOrderRelate> dbMesSaleOrderRelateList = mesSaleOrderRelateMapper.selectMesSaleOrderRelateList(querySaleOrderRelateByBarcodeInfo);
// 将两个列表的 id 转换为 HashSet
HashSet<String> set1Ids = mesSaleOrderRelateList.stream()
.map(MesSaleOrderRelate::getBindIndex)
.collect(Collectors.toCollection(HashSet::new));
HashSet<String> set2Ids = dbMesSaleOrderRelateList.stream()
.map(MesSaleOrderRelate::getBindIndex)
.collect(Collectors.toCollection(HashSet::new));
// 计算交集
set1Ids.retainAll(set2Ids);
// 从 dbMesSaleOrderRelateList 中移除交集部分 (移除后就是删除的信息)
dbMesSaleOrderRelateList.removeIf(item -> set1Ids.contains(item.getBindIndex()));
// 从 mesSaleOrderRelateList 中移除交集部分(移除后就是要增加信息)
mesSaleOrderRelateList.removeIf(item -> set1Ids.contains(item.getBindIndex()));
//获取此条码信息物料信息的bom信息
MesMaterialBom queryVirtualMaterialBom = new MesMaterialBom();
queryVirtualMaterialBom.setParentId(0L);
queryVirtualMaterialBom.setMaterialId(mesBaseBarcodeInfo.getMaterialId());
List<MesMaterialBom> virtualMaterialBoms = mesMaterialBomMapper.selectMesMaterialBomList(queryVirtualMaterialBom);
if (virtualMaterialBoms == null || virtualMaterialBoms.isEmpty()) {
throw new ServiceException("此条码物料信息生产bom有误");
}
if (virtualMaterialBoms.size() > 2) {
throw new ServiceException("此条码的物料信息生产bom多于1个");
}
MesMaterialBom virtualMaterialBom = virtualMaterialBoms.get(0);
//删除绑定信息
this.handleToDeletedMesSaleOrderRelates(dbMesSaleOrderRelateList, mesBaseBarcodeInfo, virtualMaterialBom,
userName, currentDate);
//新增的绑定信息
StringBuilder errorMsgBuilder = this.handleInsertSaleOrderRelates(mesSaleOrderRelateList,mesBaseBarcodeInfo, virtualMaterialBom, userName, currentDate);
if (errorMsgBuilder.length() > 0) {
throw new ServiceException(errorMsgBuilder.toString());
}
//生成条码
mesBaseBarcodeInfo.setUpdateBy(userName);
mesBaseBarcodeInfo.setUpdateTime(currentDate);
mesBaseBarcodeInfoMapper.updateMesBaseBarcodeInfo(mesBaseBarcodeInfo);
return 1;
}
public void handleToDeletedMesSaleOrderRelates(List<MesSaleOrderRelate> toDeteledSaleOrderList, MesBaseBarcodeInfo mesBaseBarcodeInfo,
MesMaterialBom virtualMaterialBom, String userName, Date currentDate) {
for (MesSaleOrderRelate toDeletedSaleOrderRelate : toDeteledSaleOrderList) {
Long relateSaleOrderId = toDeletedSaleOrderRelate.getRelateSaleOrderId();
MesSaleOrder saleOrder = mesSaleOrderMapper.selectMesSaleOrderBySaleOrderId(relateSaleOrderId);
Long erpMaterialId = saleOrder.getMaterialId();
//获取销售订单的物料parent是条码信息虚拟物料ID的bom信息
MesMaterialBom queryMaterialBom = new MesMaterialBom();
queryMaterialBom.setErpMaterialId(erpMaterialId);
queryMaterialBom.setParentId(virtualMaterialBom.getMaterialBomId());
List<MesMaterialBom> mesMaterialBoms = mesMaterialBomMapper.selectMesMaterialBomList(queryMaterialBom);
if (mesMaterialBoms == null || mesMaterialBoms.isEmpty()) {
throw new ServiceException("删除的物料信息生产bom有误");
}
if (mesMaterialBoms.size() > 2) {
throw new ServiceException("删除的物料信息生产bom多于1个");
}
MesMaterialBom mesMaterialBom = mesMaterialBoms.get(0);
mesMaterialBom.setParentId(0L);
mesMaterialBom.setAncestors("0");
mesMaterialBom.setUpdateTime(currentDate);
mesMaterialBom.setUpdateBy(userName);
mesMaterialBomMapper.updateMesMaterialBom(mesMaterialBom);
Long orderBindId = toDeletedSaleOrderRelate.getOrderBindId();
MesOrderBind dbOrderBind = mesOrderBindMapper.selectMesOrderBindByOrderBindId(orderBindId);
//更新采购订单和销售订单绑定信息的条码数量
dbOrderBind.setBarcodeAmount(dbOrderBind.getBarcodeAmount().subtract(BigDecimal.ONE));
dbOrderBind.setUpdateTime(currentDate);
dbOrderBind.setUpdateBy(userName);
mesOrderBindMapper.updateMesOrderBind(dbOrderBind);
mesSaleOrderRelateMapper.deleteMesSaleOrderRelateBySaleOrderRelateId(toDeletedSaleOrderRelate.getSaleOrderRelateId());
}
}
public StringBuilder handleInsertSaleOrderRelates(List<MesSaleOrderRelate> toInsertedSaleOrderRelateList,MesBaseBarcodeInfo baseBarcodeInfo,
MesMaterialBom virtualMaterialBom, String userName, Date currentDate) {
StringBuilder errorMsgBuilder = new StringBuilder();
List<MesMaterialBom> toUpdatedMaterialBoms = new ArrayList<>();
for (MesSaleOrderRelate mesSaleOrderRelate : toInsertedSaleOrderRelateList) {
if (mesSaleOrderRelate.getOrderAmount() == null || mesSaleOrderRelate.getOrderAmount().compareTo(BigDecimal.ONE) != 0) {
throw new ServiceException("请选择采购数量为1的采购订单信息");
}
Long orderBindId = mesSaleOrderRelate.getOrderBindId();
MesOrderBind dbOrderBind = mesOrderBindMapper.selectMesOrderBindByOrderBindId(orderBindId);
if (dbOrderBind.getBindAmount().compareTo(BigDecimal.ONE) != 0) {
errorMsgBuilder.append(String.format("序号%s订单绑定数量需要为1", mesSaleOrderRelate.getIndex()));
}
if (dbOrderBind.getBarcodeAmount().compareTo(BigDecimal.ONE) >= 0) {
errorMsgBuilder.append(String.format("序号%s已经生成条码不能再次选择", mesSaleOrderRelate.getIndex()));
}
Long relateSaleOrderId = mesSaleOrderRelate.getRelateSaleOrderId();
MesSaleOrderRelate querySaleOrderRelate = new MesSaleOrderRelate();
querySaleOrderRelate.setRelateSaleOrderId(relateSaleOrderId);
List<MesSaleOrderRelate> mesSaleOrderRelates = mesSaleOrderRelateMapper.selectMesSaleOrderRelateList(querySaleOrderRelate);
//把之前的barcodeinfo关联的排除掉
if (mesSaleOrderRelates != null && !mesSaleOrderRelates.isEmpty()) {
errorMsgBuilder.append(String.format("序号%s销售订单已经合并关联过", mesSaleOrderRelate.getIndex()));
}
MesSaleOrder saleOrder = mesSaleOrderMapper.selectMesSaleOrderBySaleOrderId(relateSaleOrderId);
BigDecimal saleOrderAmount = saleOrder.getOrderAmount();
BigDecimal availableAmount = mesSaleOrderRelate.getRelateSaleOrderAmount();
if (availableAmount.compareTo(BigDecimal.ONE) != 0) {
errorMsgBuilder.append(String.format("序号%s需要选择可用数量为1的信息", mesSaleOrderRelate.getIndex()));
}
if (!saleOrder.getIsRelease().equals(MesConstants.MES_SALE_ORDER_IS_RELEASE_TO_PUBLISH)) {
errorMsgBuilder.append(String.format("序号%s销售订单已经发布生产任务不能合并", mesSaleOrderRelate.getIndex()));
}
if (saleOrderAmount.compareTo(availableAmount) != 0) {
errorMsgBuilder.append(String.format("序号%s需要选择销售订单数量为1的信息", mesSaleOrderRelate.getIndex()));
}
//purchaseorder可以不用判断主要看生成条码的数量
Long erpMaterialId = saleOrder.getMaterialId();
MesMaterialBom queryMaterialBom = new MesMaterialBom();
queryMaterialBom.setErpMaterialId(erpMaterialId);
queryMaterialBom.setActiveFlag(MesConstants.MES_MATERIAL_BOM_ACTIVE_FLAG_NORMAL);
queryMaterialBom.setParentId(0L);
List<MesMaterialBom> mesMaterialBoms = mesMaterialBomMapper.selectMesMaterialBomList(queryMaterialBom);
if (mesMaterialBoms == null || mesMaterialBoms.isEmpty()) {
errorMsgBuilder.append("序号").append(mesSaleOrderRelate.getIndex()).append("销售订单成品没有配置bom信息[成品编号:")
.append(mesSaleOrderRelate.getProductCode()).append("成品名称:").append(mesSaleOrderRelate.getProductName())
.append("成品规格").append(mesSaleOrderRelate.getProductSpec()).append("; ");
} else if (mesMaterialBoms.size() > 1) {
errorMsgBuilder.append("序号").append(mesSaleOrderRelate.getIndex()).append("销售订单成品配置bom信息多余一条[成品编号:")
.append(mesSaleOrderRelate.getProductCode()).append("成品名称:").append(mesSaleOrderRelate.getProductName())
.append("成品规格").append(mesSaleOrderRelate.getProductSpec()).append("; ");
} else {
MesMaterialBom mesMaterialBom = mesMaterialBoms.get(0);
toUpdatedMaterialBoms.add(mesMaterialBom);
}
//更新采购订单和销售订单绑定信息的条码数量
dbOrderBind.setBarcodeAmount(dbOrderBind.getBarcodeAmount().add(availableAmount));
dbOrderBind.setUpdateTime(currentDate);
dbOrderBind.setUpdateBy(userName);
mesOrderBindMapper.updateMesOrderBind(dbOrderBind);
}
//将新增的采购订单对应销售订单的成品bom信息的parentid改为此条码信息虚拟物料ID
toUpdatedMaterialBoms.forEach(umb -> {
umb.setParentId(virtualMaterialBom.getMaterialBomId());
umb.setAncestors(umb.getAncestors() + "," + umb.getParentId());
umb.setTopFlag(MesConstants.MES_MATERIAL_BOM_TOP_FLAG_NO);
umb.setUpdateBy(userName);
umb.setUpdateTime(currentDate);
mesMaterialBomMapper.updateMesMaterialBom(umb);
});
toInsertedSaleOrderRelateList.forEach(msor -> {
msor.setSaleOrderId(baseBarcodeInfo.getSaleOrderId());
msor.setBarcodeInfo(baseBarcodeInfo.getBarcodeInfo());
msor.setVirtualMaterialId(baseBarcodeInfo.getMaterialId());
});
mesSaleOrderRelateMapper.batchMesSaleOrderRelate(toInsertedSaleOrderRelateList);
return errorMsgBuilder;
}
// public MesPurchaseOrder insertVirtualPurchaseOrder(Long materialId, String barcodeInfo, BigDecimal sumOrderAmount,
// List<MesPurchaseOrderRelate> mesPurchaseOrderRelates,String userName, Date currentDate) {
// MesPurchaseOrder virtualPurchaseOrder = new MesPurchaseOrder();

@ -148,7 +148,7 @@ public class MesPurchaseOrderServiceImpl implements IMesPurchaseOrderService {
@Override
@Transactional(rollbackFor = Exception.class)
public int bindOrder(MesPurchaseOrder mesPurchaseOrder) {
Long erpMaterialId = mesPurchaseOrder.getMaterialId();
Long erpMaterialId = mesPurchaseOrder.getErpMaterialId();
MesBaseMaterialInfo mesBaseMaterialInfo = mesBaseMaterialInfoMapper.selectMesBaseMaterialInfoByErpId(erpMaterialId);
if (mesBaseMaterialInfo == null) {
throw new ServiceException("物料信息不存在");

@ -110,7 +110,7 @@
<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="bindBarcode != null and bindBarcode != ''">and bbi.bind_barcode = #{bindBarcode}</if>
<if test="rawFlag != null and rawFlag != ''">and bbi.single_flag in ('0','3')</if>
<if test="materialId != null ">and bbi.material_id = #{materialId}</if>
<if test="materialCode != null and materialCode != '' ">and bmi.material_code like concat('%', #{materialCode},

@ -44,7 +44,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="saleBindAmount" column="sale_bind_amount" />
<result property="safeAmount" column="safe_amount" />
<result property="barcodeAmount" column="barcode_amount" />
<result property="erpMaterialId" column="erp_material_id"/>
<result property="batchFlag" column="batch_flag" />
<result property="batchAmount" column="batch_amount" />
<result property="mesMaterialId" column="mes_material_id" />
@ -128,7 +128,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="selectMesPurchaseOrderByPurchaseOrderId" parameterType="Long" resultMap="MesPurchaseOrderMesOrderBindResult">
select a.purchase_order_id, a.po_no, a.document_status, a.material_id,
select a.purchase_order_id, a.po_no, a.document_status, mbmi1.material_id,a.material_id as erp_material_id,
a.material_code, a.material_name, a.order_amount, a.complete_amount, a.approve_date,a.specification_parameter,
a.erp_modify_date, a.plan_delivery_date, a.order_status, a.complete_date,
a.is_flag, a.src_bill_no,
@ -142,6 +142,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
from mes_purchase_order a
left join mes_order_bind b on b.purchase_order_id = a.purchase_order_id
left join mes_base_material_info mbmi on b.product_id=mbmi.erp_id
left join mes_base_material_info mbmi1 on a.material_id = mbmi1.erp_id
where a.purchase_order_id = #{purchaseOrderId}
</select>

@ -29,7 +29,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectMesSaleOrderRelateList" parameterType="MesSaleOrderRelate" resultMap="MesSaleOrderRelateResult">
<include refid="selectMesSaleOrderRelateVo"/>
<where>
<where>
<if test="barcodeInfo != null and barcodeInfo != '' "> and barcode_info = #{barcodeInfo}</if>
<if test="saleOrderId != null "> and sale_order_id = #{saleOrderId}</if>
<if test="relateSaleOrderId != null "> and relate_sale_order_id = #{relateSaleOrderId}</if>
<if test="purchaseOrderId != null "> and purchase_order_id = #{purchaseOrderId}</if>

@ -177,3 +177,13 @@ export function mergeAddBarcode(data) {
data: data
})
}
// 修改合并采购订单新增原材料条码信息
export function mergeUpdateBarcode(data) {
return request({
url: '/mes/barcode/mergeUpdate',
method: 'post',
data: data
})
}

@ -10,7 +10,7 @@
/>
</el-form-item>
<el-form-item label="销售订单号" prop="saleorderCode">
<el-inputs
<el-input
v-model="queryParams.saleorderCode"
placeholder="请输入销售订单号"
clearable
@ -230,7 +230,7 @@
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-if="((scope.row.printFlag !==PRINT_FLAG.YES && scope.row.singleFlag!==SINGLE_FLAG.MERGE) || scope.row.singleFlag===SINGLE_FLAG.MERGE) &&scope.row.barcodeType === BARCODE_TYPE.RAW"
v-if="scope.row.printFlag !==PRINT_FLAG.YES &&scope.row.barcodeType === BARCODE_TYPE.RAW"
v-hasPermi="['mes:barcode:edit']"
>编辑
</el-button>
@ -392,7 +392,7 @@
<el-dialog title="选择采购订单信息" :visible.sync="purchaseOrderOpen" append-to-body>
<select-orderBind ref="purchaseOrderRef" v-if="purchaseOrderOpen" :defineData="barcodeData"></select-orderBind>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitPurchaseOrderForm"> </el-button>
<el-button type="primary" @click="submitPurchaseOrderForm"> </el-button>
<el-button @click="purchaseOrderOpen = false"> </el-button>
</div>
</el-dialog>
@ -602,8 +602,8 @@
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="销售订单" prop="saleOrderCode">
<el-input v-model="materialRelateForm.saleOrderCode" disabled/>
<el-form-item label="销售订单" prop="saleorderCode">
<el-input v-model="materialRelateForm.saleorderCode" disabled/>
</el-form-item>
</el-col>
</el-row>
@ -673,7 +673,7 @@ import {
listBarcode, getBarcode, delBarcode, addBarcode, reprintBarcodes,
printBarcodes, getMaterialInfoByErpId, selectProductBarcodeInfoByBarcodeInfo,
addInternalBarcode, regenerateBarcode, checkRawStock, addNoPurchaseBarcode, addRegularBarcode,
mergeAddBarcode,
mergeAddBarcode,mergeUpdateBarcode
} from "@/api/mes/barcode";
import {checkWarehouseMaterials} from "@/api/wms/wmswarehouse";
@ -754,6 +754,7 @@ export default {
bindTime: null,
updateBy: null,
updateTime: null,
rawFlag: '1'
},
//
form: {},
@ -1052,7 +1053,7 @@ export default {
return;
}
if (firstRowSaleOrderCode !== this.materialRelateForm.saleOrderCode) {
if (firstRowSaleOrderCode !== this.materialRelateForm.saleorderCode) {
this.$modal.msgError("已选择销售订单号为:" + firstRowSaleOrderCode + ",本次选择销售订单号与此不同");
return;
}
@ -1227,7 +1228,7 @@ export default {
if (!this.materialRelateForm.mesSaleOrderRelateList || this.materialRelateForm.mesSaleOrderRelateList.length <= 0) {
this.materialRelateForm.poNo = null;
this.materialRelateForm.saleOrderCode = null;
this.materialRelateForm.saleorderCode = null;
}
@ -1319,7 +1320,13 @@ export default {
this.resetRelate();
getBarcode(barcodeId).then(response => {
this.materialRelateForm = response.data
this.materialRelateForm.barcodeAmount=1;
let mesSaleOrderRelateList = this.materialRelateForm.mesSaleOrderRelateList;
if (mesSaleOrderRelateList !== null && mesSaleOrderRelateList.length > 0) {
let mesSaleOrderRelate = mesSaleOrderRelateList[0];
this.materialRelateForm.saleorderCode = mesSaleOrderRelate.relateSaleOrderCode;
}
this.materialRelateForm.barcodeAmount = 1;
this.materialRelateOpen = true;
this.materialRelateTitle = "修改合并原材料条码信息";
});
@ -1334,7 +1341,6 @@ export default {
}
},
/** 提交按钮 */
submitForm() {
@ -1768,13 +1774,24 @@ export default {
this.$modal.msgError("请选择至少2条采购信息");
return;
}
mergeAddBarcode(this.materialRelateForm).then(response => {
this.$modal.msgSuccess("新增成功");
this.materialRelateOpen = false;
this.getList();
}).finally(e => {
this.submitLoading = false;
});
if(this.materialRelateForm.barcodeId && this.materialRelateForm.barcodeId!=''){
mergeUpdateBarcode(this.materialRelateForm).then(response => {
this.$modal.msgSuccess("修改成功");
this.materialRelateOpen = false;
this.getList();
}).finally(e => {
this.submitLoading = false;
});
}else{
mergeAddBarcode(this.materialRelateForm).then(response => {
this.$modal.msgSuccess("新增成功");
this.materialRelateOpen = false;
this.getList();
}).finally(e => {
this.submitLoading = false;
});
}
}
});

@ -302,7 +302,6 @@ export default {
return;
}
this.form.mesOrderBindList = this.mesOrderBindList;
if (this.form.purchaseOrderId != null) {
bindOrder(this.form).then(response => {
@ -326,6 +325,9 @@ export default {
obj.safeFlag = "";
obj.saleOrderId = "";
obj.saleOrderCode = "";
obj.materialId = this.form.materialId;
obj.materialCode = this.form.materialCode;
obj.materialName = this.form.materialName;
obj.productId = "";
obj.productCode = "";
obj.productName = "";
@ -391,7 +393,7 @@ export default {
this.editedRow.saleOrderCode = selectedRow.saleorderCode;
this.editedRow.productCode = selectedRow.materialCode;
this.editedRow.productName = selectedRow.materialName;
this.editedRow.productId = selectedRow.erpMaterialId;
this.editedRow.productId = selectedRow.materialId;
this.saleOrderOpen = false;
},

Loading…
Cancel
Save