MES:
原材料条码增加合并新增条码
master
xs 9 months ago
parent 2ea9a7d01a
commit 6764028e17

@ -192,6 +192,7 @@ public class MesBaseBarcodeInfo extends BaseEntity
private List<MesSaleOrderRelate> mesSaleOrderRelateList;
private Long orderBindId;
public String getLocationCode() {
@ -610,6 +611,14 @@ public class MesBaseBarcodeInfo extends BaseEntity
this.mesSaleOrderRelateList = mesSaleOrderRelateList;
}
public Long getOrderBindId() {
return orderBindId;
}
public void setOrderBindId(Long orderBindId) {
this.orderBindId = orderBindId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

@ -36,8 +36,12 @@ public class MesSaleOrderRelate extends BaseEntity
@Excel(name = "关联销售订单ID")
private Long relateSaleOrderId;
private String relateSaleOrderCode;
private Long materialId;
private Long productId;
/** 采购订单ID */
private Long purchaseOrderId;
@ -45,12 +49,19 @@ public class MesSaleOrderRelate extends BaseEntity
@Excel(name = "关联销售订单的数量,有可能小于原销售订单的订单数量")
private BigDecimal relateSaleOrderAmount;
private String materialCode;
private String materialName;
private String materialSpec;
private String productCode;
private String productName;
private String productSpec;
/**
*
*/
@ -58,6 +69,9 @@ public class MesSaleOrderRelate extends BaseEntity
private int index;
/**采购数量*/
private BigDecimal orderAmount;
public void setSaleOrderRelateId(Long saleOrderRelateId)
{
this.saleOrderRelateId = saleOrderRelateId;
@ -77,6 +91,14 @@ public class MesSaleOrderRelate extends BaseEntity
return saleOrderId;
}
public String getRelateSaleOrderCode() {
return relateSaleOrderCode;
}
public void setRelateSaleOrderCode(String relateSaleOrderCode) {
this.relateSaleOrderCode = relateSaleOrderCode;
}
public String getBarcodeInfo() {
return barcodeInfo;
}
@ -106,6 +128,14 @@ public class MesSaleOrderRelate extends BaseEntity
this.materialId = materialId;
}
public Long getProductId() {
return productId;
}
public void setProductId(Long productId) {
this.productId = productId;
}
public Long getPurchaseOrderId() {
return purchaseOrderId;
}
@ -127,6 +157,30 @@ public class MesSaleOrderRelate extends BaseEntity
this.relateSaleOrderAmount = relateSaleOrderAmount;
}
public String getMaterialCode() {
return materialCode;
}
public void setMaterialCode(String materialCode) {
this.materialCode = materialCode;
}
public String getMaterialName() {
return materialName;
}
public void setMaterialName(String materialName) {
this.materialName = materialName;
}
public String getMaterialSpec() {
return materialSpec;
}
public void setMaterialSpec(String materialSpec) {
this.materialSpec = materialSpec;
}
public String getProductCode() {
return productCode;
}
@ -167,6 +221,14 @@ public class MesSaleOrderRelate extends BaseEntity
this.index = index;
}
public BigDecimal getOrderAmount() {
return orderAmount;
}
public void setOrderAmount(BigDecimal orderAmount) {
this.orderAmount = orderAmount;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

@ -183,6 +183,8 @@ public class MesConstants {
public static final String MES_BARCODE_SINGLE_FLAG_YES = "1";//是
public static final String MES_BARCODE_SINGLE_FLAG_INTERNAL = "2";//对内
public static final String MES_BARCODE_SINGLE_FLAG_MERGE = "3";//合并
/**
*
*/

@ -26,6 +26,8 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
public static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
public static String YYYYMMDD = "yyyyMMdd";
private static String[] parsePatterns = {
"yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM",
"yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm", "yyyy/MM",

@ -9,14 +9,14 @@ public class Main {
public static void main(String[] args) {
// Press Alt+Enter with your caret at the highlighted text to see how
// IntelliJ IDEA suggests fixing it.
System.out.printf("Hello and welcome!");
// System.out.printf("Hello and welcome!");
// Press Shift+F10 or click the green arrow button in the gutter to run the code.
for (int i = 1; i <= 5; i++) {
// Press Shift+F9 to start debugging your code. We have set one breakpoint
// for you, but you can always add more by pressing Ctrl+F8.
System.out.println("i = " + i);
// System.out.println("i = " + i);
}
List<Long> dd = new ArrayList<Long>();
@ -29,6 +29,6 @@ public class Main {
Long[] dd1 = new Long[2];
dd1[0] = 1L;
dd1[1] = 2L;
System.out.println(builder.toString());
// System.out.println(builder.toString());
}
}

@ -222,14 +222,14 @@ public class MesPurchaseOrderController extends BaseController
/**
*
* ,Join order_bind
*/
// @RequiresPermissions("mes:purchaseOrder:list")
@GetMapping("/getOrderBinds")
public TableDataInfo getOrderBinds(MesOrderBind mesOrderBind)
@GetMapping("/getPurchaseOrdersWithBind")
public TableDataInfo getPurchaseOrdersWithBind(MesPurchaseOrder mesPurchaseOrder)
{
startPage();
List<MesOrderBind> list = mesOrderBindService.selectMesOrderBindJoinList(mesOrderBind);
List<MesPurchaseOrder> list = mesPurchaseOrderService.selectPurchaseOrderJoinList(mesPurchaseOrder);
return getDataTable(list);
}

@ -266,6 +266,26 @@ public class MesPurchaseOrder extends BaseEntity {
private String alwaysFlag;
private Long productId;
private String productCode;
private String productName;
private String productSpec;
private String safeFlag;
private String saleOrderCode;
private BigDecimal bindAmount;
private BigDecimal saleOrderAmount;
private String mergeFlag;
private String singleFlag;
public Long getSerialNumber() {
return serialNumber;
@ -627,6 +647,86 @@ public class MesPurchaseOrder extends BaseEntity {
this.alwaysFlag = alwaysFlag;
}
public Long getProductId() {
return productId;
}
public void setProductId(Long productId) {
this.productId = productId;
}
public String getProductCode() {
return productCode;
}
public void setProductCode(String productCode) {
this.productCode = productCode;
}
public String getProductName() {
return productName;
}
public void setProductName(String productName) {
this.productName = productName;
}
public String getProductSpec() {
return productSpec;
}
public void setProductSpec(String productSpec) {
this.productSpec = productSpec;
}
public String getSafeFlag() {
return safeFlag;
}
public void setSafeFlag(String safeFlag) {
this.safeFlag = safeFlag;
}
public String getSaleOrderCode() {
return saleOrderCode;
}
public void setSaleOrderCode(String saleOrderCode) {
this.saleOrderCode = saleOrderCode;
}
public BigDecimal getBindAmount() {
return bindAmount;
}
public void setBindAmount(BigDecimal bindAmount) {
this.bindAmount = bindAmount;
}
public BigDecimal getSaleOrderAmount() {
return saleOrderAmount;
}
public void setSaleOrderAmount(BigDecimal saleOrderAmount) {
this.saleOrderAmount = saleOrderAmount;
}
public String getMergeFlag() {
return mergeFlag;
}
public void setMergeFlag(String mergeFlag) {
this.mergeFlag = mergeFlag;
}
public String getSingleFlag() {
return singleFlag;
}
public void setSingleFlag(String singleFlag) {
this.singleFlag = singleFlag;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

@ -125,4 +125,12 @@ public interface MesPurchaseOrderMapper
*/
public MesPurchaseOrder unbindPurchaseOrderListByPurchaseAndSaleOrderId(@Param("purchaseOrderId") Long purchaseOrderId,
@Param("saleOrderId") Long saleOrderId);
/**
* ,join order_bind
* @param mesPurchaseOrder
* @return
*/
public List<MesPurchaseOrder> selectPurchaseOrderJoinList(MesPurchaseOrder mesPurchaseOrder);
}

@ -66,4 +66,13 @@ public interface MesSaleOrderRelateMapper
* @return
*/
public int batchMesSaleOrderRelate(List<MesSaleOrderRelate> mesSaleOrderRelateList);
/**
* ,join material
*
* @param mesSaleOrderRelate
* @return
*/
public List<MesSaleOrderRelate> selectMesSaleOrderRelateJoinList(MesSaleOrderRelate mesSaleOrderRelate);
}

@ -134,4 +134,13 @@ public interface IMesPurchaseOrderService
* @return
*/
public int deleteMesOrderBindByOrderBindIds(Long[] orderBindIds);
/**
* join order bind
*
* @param mesPurchaseOrder
* @return
*/
public List<MesPurchaseOrder> selectPurchaseOrderJoinList(MesPurchaseOrder mesPurchaseOrder);
}

@ -109,7 +109,15 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
*/
@Override
public MesBaseBarcodeInfo selectMesBaseBarcodeInfoByBarcodeId(Long barcodeId) {
return mesBaseBarcodeInfoMapper.selectMesBaseBarcodeInfoByBarcodeId(barcodeId);
MesBaseBarcodeInfo mesBaseBarcodeInfo = mesBaseBarcodeInfoMapper.selectMesBaseBarcodeInfoByBarcodeId(barcodeId);
if(mesBaseBarcodeInfo.getSingleFlag().equals(MesConstants.MES_BARCODE_SINGLE_FLAG_MERGE)){
MesSaleOrderRelate querySaleOrderRelate = new MesSaleOrderRelate();
querySaleOrderRelate.setBarcodeInfo(mesBaseBarcodeInfo.getBarcodeInfo());
List<MesSaleOrderRelate> mesSaleOrderRelates = mesSaleOrderRelateMapper.selectMesSaleOrderRelateJoinList(querySaleOrderRelate);
mesBaseBarcodeInfo.setMesSaleOrderRelateList(mesSaleOrderRelates);
}
return mesBaseBarcodeInfo;
}
/**
@ -167,53 +175,54 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
+ ",物料名称:" + mesBaseBarcodeInfo.getMaterialName() + "]的常备物料标识");
}
//判断选择的采购订单信息,是否已经合并过
MesSaleOrderRelate querySaleOrderRelate = new MesSaleOrderRelate();
querySaleOrderRelate.setPurchaseOrderId(purchaseOrderId);
List<MesSaleOrderRelate> saleOrderRelates = mesSaleOrderRelateMapper.selectMesSaleOrderRelateList(querySaleOrderRelate);
if (saleOrderRelates != null && !saleOrderRelates.isEmpty()) {
throw new ServiceException("选择的采购订单信息已经合并过,不能再选择");
}
//如果物料信息为非常备物料,则判断是否有绑定的信息
BigDecimal barcodeAmount = mesBaseBarcodeInfo.getBarcodeAmount();
BigDecimal barcodeAmount = mesBaseBarcodeInfo.getBarcodeAmount();//要生成的条码数量
String poNo = StringUtils.isEmpty(mesBaseBarcodeInfo.getPoNo()) ? "0" : mesBaseBarcodeInfo.getPoNo();
String batchCode = this.getRawBatchCode(poNo);
if (!mesBaseMaterialInfo.getAlwaysFlag().equals(MesConstants.MES_MATERIAL_ALWAYS_FLAG_YES)) {
MesOrderBind queryOrderBind = new MesOrderBind();
queryOrderBind.setPurchaseOrderId(purchaseOrderId);
List<MesOrderBind> mesOrderBinds = mesOrderBindMapper.selectMesOrderBindList(queryOrderBind);
if (mesOrderBinds == null || mesOrderBinds.isEmpty()) {
throw new ServiceException("此采购订单还未绑定销售订单,不能生成条码");
Long orderBindId = mesBaseBarcodeInfo.getOrderBindId();
if (orderBindId == null) {
throw new ServiceException("请选择绑定销售订单信息的采购订单");
}
BigDecimal totalBindAmount = mesOrderBinds.stream().map(MesOrderBind::getBindAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal totalBarcodeAmount = mesOrderBinds.stream().map(MesOrderBind::getBarcodeAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
if (totalBindAmount.subtract(totalBarcodeAmount).compareTo(barcodeAmount) != 0) {
throw new ServiceException("采购订单绑定数据有变化,请重新选择采购订单绑定");
}
String batchCode = Seq.getId(Seq.mesBatchCodeSeqType, Seq.mesBatchCodeCode);
MesBaseBarcodeInfo toInsertedBarcodeInfo;
for (MesOrderBind mesOrderBind : mesOrderBinds) {
MesOrderBind mesOrderBind = mesOrderBindMapper.selectMesOrderBindByOrderBindId(orderBindId);
BigDecimal bindAmount = mesOrderBind.getBindAmount();
BigDecimal bindBarcodeAmount = mesOrderBind.getBarcodeAmount();
BigDecimal canBindAmount = bindAmount.subtract(bindBarcodeAmount);
BigDecimal bindBarcodeAmount = mesOrderBind.getBarcodeAmount();//已经生成的条码数量
BigDecimal availableAmount = bindAmount.subtract(bindBarcodeAmount);
if (barcodeAmount.compareTo(availableAmount) > 0) {
throw new ServiceException("条码数量不能大于可用数量");
}
if (canBindAmount.compareTo(BigDecimal.ONE) >= 0) {
for (int i = 0; i < canBindAmount.intValue(); i++) {
// 生成数量条的不同条码内容
MesBaseBarcodeInfo toInsertedBarcodeInfo;
for (long i = 0; i < barcodeAmount.intValue(); i++) {
// 生成条码数量的不同条码内容
toInsertedBarcodeInfo = getInsertedBarcodeInfo(mesBaseBarcodeInfo, Seq.getId(Seq.mesBarcodeSeqType, Seq.mesBarcodeCode), batchCode, userName, currentDate);
toInsertedBarcodeInfo.setSaleOrderId(mesOrderBind.getSaleOrderId());
toInsertedBarcodeInfo.setSaleorderCode(mesOrderBind.getSaleOrderCode());
toInsertedBarcodeInfo.setSafeFlag(mesOrderBind.getSafeFlag());
toInsertedBarcodeInfo.setSafeFlag(MesConstants.MES_ORDER_BIND_SAFE_FLAG_NO);
mesBaseBarcodeInfoMapper.insertMesBaseBarcodeInfo(toInsertedBarcodeInfo);
}
//更新订单绑定的条码已绑定数量
mesOrderBind.setBarcodeAmount(bindAmount);
mesOrderBind.setBarcodeAmount(bindBarcodeAmount.add(barcodeAmount));
mesOrderBind.setUpdateBy(userName);
mesOrderBind.setUpdateTime(currentDate);
mesOrderBindMapper.updateMesOrderBind(mesOrderBind);
}
}
} else {
MesBaseBarcodeInfo toInsertedBarcodeInfo;
String batchCode = Seq.getId(Seq.mesBatchCodeSeqType, Seq.mesBatchCodeCode);
for (long i = 0; i < barcodeAmount.intValue(); i++) {
// 生成条码数量的不同条码内容
toInsertedBarcodeInfo = getInsertedBarcodeInfo(mesBaseBarcodeInfo, Seq.getId(Seq.mesBarcodeSeqType, Seq.mesBarcodeCode), batchCode, userName, currentDate);
@ -258,7 +267,8 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
List<MesBaseBarcodeInfo> toInsertedBarcodeInfos = new ArrayList<>();
MesBaseBarcodeInfo toInsertedBarcodeInfo;
String batchCode = Seq.getId(Seq.mesBatchCodeSeqType, Seq.mesBatchCodeCode);
// String batchCode = Seq.getId(Seq.mesBatchCodeSeqType, Seq.mesBatchCodeCode);
String batchCode = this.getRawBatchCode("0");
for (long i = 0; i < barcodeAmount.intValue(); i++) {
// 生成数量条的不同条码内容
toInsertedBarcodeInfo = getInsertedBarcodeInfo(mesBaseBarcodeInfo, Seq.getId(Seq.mesBarcodeSeqType, Seq.mesBarcodeCode), batchCode, userName, currentDate);
@ -529,6 +539,7 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
toInsertedBarcodeInfo.setAmount(mesBaseBarcodeInfo.getAmount());
}
toInsertedBarcodeInfo.setRemark(mesBaseBarcodeInfo.getRemark());
toInsertedBarcodeInfo.setCreateBy(userName);
toInsertedBarcodeInfo.setCreateTime(currentDate);
@ -1146,13 +1157,16 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
StringBuilder errorMsgBuilder = new StringBuilder();
for (MesSaleOrderRelate mesSaleOrderRelate : mesSaleOrderRelateList) {
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.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()));
if (dbOrderBind.getBarcodeAmount().compareTo(BigDecimal.ONE) >= 0) {
errorMsgBuilder.append(String.format("序号%s已经生成条码不能再次选择", mesSaleOrderRelate.getIndex()));
}
Long relateSaleOrderId = mesSaleOrderRelate.getRelateSaleOrderId();
@ -1160,7 +1174,7 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
querySaleOrderRelate.setRelateSaleOrderId(relateSaleOrderId);
List<MesSaleOrderRelate> mesSaleOrderRelates = mesSaleOrderRelateMapper.selectMesSaleOrderRelateList(querySaleOrderRelate);
if (mesSaleOrderRelates != null && !mesSaleOrderRelates.isEmpty()) {
errorMsgBuilder.append(String.format("序号%s销售订单已经关联过;", mesSaleOrderRelate.getIndex()));
errorMsgBuilder.append(String.format("序号%s销售订单已经关联过", mesSaleOrderRelate.getIndex()));
}
MesSaleOrder saleOrder = mesSaleOrderMapper.selectMesSaleOrderBySaleOrderId(relateSaleOrderId);
@ -1168,17 +1182,19 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
BigDecimal availableAmount = mesSaleOrderRelate.getRelateSaleOrderAmount();
if (availableAmount.compareTo(BigDecimal.ONE) != 0) {
errorMsgBuilder.append(String.format("序号%s需要选择可用数量为1的信息;", mesSaleOrderRelate.getIndex()));
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()));
errorMsgBuilder.append(String.format("序号%s销售订单已经发布工单不能合并", mesSaleOrderRelate.getIndex()));
}
if (saleOrderAmount.compareTo(availableAmount) != 0) {
errorMsgBuilder.append(String.format("序号%s需要选择销售订单数量为1的信息;", mesSaleOrderRelate.getIndex()));
errorMsgBuilder.append(String.format("序号%s需要选择销售订单数量为1的信息", mesSaleOrderRelate.getIndex()));
}
//purchaseorder可以不用判断主要看生成条码的数量
Long erpMaterialId = saleOrder.getMaterialId();
MesMaterialBom queryMaterialBom = new MesMaterialBom();
queryMaterialBom.setErpMaterialId(erpMaterialId);
@ -1188,13 +1204,23 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
if (mesMaterialBoms == null || mesMaterialBoms.isEmpty()) {
errorMsgBuilder.append("序号").append(mesSaleOrderRelate.getIndex()).append("销售订单成品没有配置bom信息[成品编号:")
.append(mesSaleOrderRelate.getProductCode()).append("成品名称:").append(mesSaleOrderRelate.getProductName())
.append("成品规格").append(mesSaleOrderRelate.getProductSpec());
.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("成品规格").append(mesSaleOrderRelate.getProductSpec()).append("; ");
} else {
MesMaterialBom mesMaterialBom = mesMaterialBoms.get(0);
//判断所选物料是否在销售订单的成品bom中在绑定时判断
// MesMaterialBom queryChildBom = new MesMaterialBom();
// queryChildBom.setAncestors();
// queryChildBom.setMaterialId(mesSaleOrderRelate.getMaterialId());
// List<MesMaterialBom> childBoms = mesMaterialBomMapper.selectMesMaterialBomList(queryChildBom);
// if(childBoms==null || childBoms.isEmpty()){
// throw new ServiceException("选择的物料信息");
// }
toUpdatedMaterialBoms.add(mesMaterialBom);
}
@ -1222,7 +1248,9 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
this.insertVirtualMaterialBom(materialId, barcodeInfo, toUpdatedMaterialBoms, userName, currentDate);
//生成条码
String batchCode = Seq.getId(Seq.mesBatchCodeSeqType, Seq.mesBatchCodeCode);
// String batchCode = Seq.getId(Seq.mesBatchCodeSeqType, Seq.mesBatchCodeCode);
String poNo = StringUtils.isEmpty(mesBaseBarcodeInfo.getPoNo()) ? "0" : mesBaseBarcodeInfo.getPoNo();
String batchCode = this.getRawBatchCode(poNo);
mesBaseBarcodeInfo.setBatchFlag(MesConstants.NOT_IS_BATCH);
MesBaseBarcodeInfo toInsertedBarcodeInfo = getInsertedBarcodeInfo(mesBaseBarcodeInfo, barcodeInfo, batchCode, userName, currentDate);
toInsertedBarcodeInfo.setPurchaseOrderId(-1L);
@ -1230,6 +1258,7 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
toInsertedBarcodeInfo.setSaleOrderId(virtualSaleOrder.getSaleOrderId());
toInsertedBarcodeInfo.setSaleorderCode(virtualSaleOrder.getSaleorderCode());
toInsertedBarcodeInfo.setSafeFlag(MesConstants.MES_ORDER_BIND_SAFE_FLAG_NO);
toInsertedBarcodeInfo.setSingleFlag(MesConstants.MES_BARCODE_SINGLE_FLAG_MERGE);
// toInsertedBarcodeInfo.setBarcodeSpec(materialCodes.toString());
mesBaseBarcodeInfoMapper.insertMesBaseBarcodeInfo(toInsertedBarcodeInfo);
@ -1330,6 +1359,18 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
}
/**
*
*
* @return
*/
public String getRawBatchCode(String poNo) {
StringBuilder batchCodeBuilder = new StringBuilder();
String today = DateUtils.parseDateToStr(DateUtils.YYYYMMDD, new Date());
batchCodeBuilder.append("D").append(today).append("P").append(poNo);
return batchCodeBuilder.toString();
}
// public MesPurchaseOrder insertVirtualPurchaseOrder(Long materialId, String barcodeInfo, BigDecimal sumOrderAmount,
// List<MesPurchaseOrderRelate> mesPurchaseOrderRelates,String userName, Date currentDate) {
// MesPurchaseOrder virtualPurchaseOrder = new MesPurchaseOrder();

@ -424,4 +424,20 @@ public class MesPurchaseOrderServiceImpl implements IMesPurchaseOrderService {
return mesOrderBindMapper.deleteMesOrderBindByOrderBindIds(orderBindIds);
}
/**
* join order bind
*
* @param mesPurchaseOrder
* @return
*/
@Override
public List<MesPurchaseOrder> selectPurchaseOrderJoinList(MesPurchaseOrder mesPurchaseOrder) {
mesPurchaseOrder.setMaterialSpec(StringUtils.isNotEmpty(mesPurchaseOrder.getMaterialSpec())
? mesPurchaseOrder.getMaterialSpec().replaceAll("\\s+", "") : "");
mesPurchaseOrder.setProductSpec(StringUtils.isNotEmpty(mesPurchaseOrder.getProductSpec())
? mesPurchaseOrder.getProductSpec().replaceAll("\\s+", "") : "");
return mesPurchaseOrderMapper.selectPurchaseOrderJoinList(mesPurchaseOrder);
}
}

@ -52,8 +52,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="orderBindBarcodeAmount" column="order_bind_barcode_amount" />
<result property="safeBindBarcodeAmount" column="safe_bind_barcode_amount" />
<result property="alwaysFlag" column="always_flag" />
<result property="productId" column="product_id" />
<result property="productCode" column="product_code" />
<result property="productName" column="product_name" />
<result property="productSpec" column="product_spec" />
<result property="safeFlag" column="safe_flag" />
<result property="saleOrderId" column="sale_order_id" />
<result property="saleOrderCode" column="sale_order_code" />
<result property="bindAmount" column="bind_amount" />
<result property="saleOrderAmount" column="sale_order_amount" />
</resultMap>
<resultMap id="MesPurchaseOrderMesOrderBindResult" type="MesPurchaseOrder" extends="MesPurchaseOrderResult">
<collection property="mesOrderBindList" notNullColumn="sub_order_bind_id" javaType="java.util.List" resultMap="MesOrderBindResult" />
</resultMap>
@ -425,4 +439,38 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
order by mpo.erp_modify_date desc
</select>
<select id="selectPurchaseOrderJoinList" parameterType="MesPurchaseOrder" resultMap="MesPurchaseOrderResult">
select mpo.purchase_order_id,mpo.po_no,mpo.order_amount,
mob.order_bind_id, mob.safe_flag, mob.sale_order_id, mob.sale_order_code,
mob.bind_amount, mob.barcode_amount,mpo.specification_parameter,
mob.product_id,pbmi.material_code as product_code,pbmi.material_name as product_name,pbmi.material_spec as product_spec,
mob.material_id,
mbmi.always_flag,mbmi.material_code,mbmi.material_name,mbmi.material_spec,mbmi.batch_flag,mbmi.batch_amount,
mso.order_amount as sale_order_amount
from mes_purchase_order mpo left join mes_order_bind mob on mpo.purchase_order_id = mob.purchase_order_id
left join mes_base_material_info pbmi on mob.product_id=pbmi.material_id
left join mes_base_material_info mbmi on mob.material_id=mbmi.material_id
left join mes_sale_order mso on mob.sale_order_id = mso.sale_order_id
<where>
<if test="mergeFlag != null and mergeFlag != ''"> and mob.bind_amount=1 and mob.barcode_amount=0 and mpo.order_amount=1 and mso.order_amount=1</if>
<if test="singleFlag != null and singleFlag != ''"> and (mob.bind_amount &gt; mob.barcode_amount or mbmi.always_flag='1')</if>
<if test="safeFlag != null and safeFlag != ''"> and mob.safe_flag = #{safeFlag}</if>
<if test="alwaysFlag != null and alwaysFlag != ''"> and mbmi.always_flag = #{alwaysFlag}</if>
<if test="saleOrderCode != null and saleOrderCode != ''"> and mob.sale_order_code like concat('%', #{saleOrderCode}, '%')</if>
<if test="productCode != null and productCode != ''"> and pbmi.material_code like concat('%', #{productCode}, '%')</if>
<if test="productName != null and productName != ''"> and pbmi.material_name like concat('%', #{productName}, '%')</if>
<if test="poNo != null and poNo != ''"> and mpo.po_no like concat('%', #{poNo}, '%')</if>
<if test="materialCode != null and materialCode != ''"> and mbmi.material_code = like concat('%', #{materialCode}, '%')</if>
<if test="materialName != null and materialName != ''"> and mbmi.material_name like concat('%', #{materialName}, '%')</if>
<if test="materialSpec != null and materialSpec != ''">and replace(mbmi.material_spec,' ','') like concat('%', #{materialSpec},
'%')</if>
<if test="productSpec != null and productSpec != ''">and replace(pbmi.material_spec,' ','') like concat('%', #{productSpec},
'%')</if>
</where>
order by mpo.po_no
</select>
</mapper>

@ -251,8 +251,9 @@
mso.erp_modify_date,
mso.begin_date,
mso.end_date,
mso.complete_date
from mes_sale_order mso left join mes_base_material_info mbmi on mso.material_id = mbmi.erp_id
mso.complete_date,
mso.sale_order_classfication
from mes_sale_order mso left join mes_base_material_info mbmi on (mso.material_id = mbmi.erp_id and mso.sale_order_classfication='1') or (mso.material_id = mbmi.material_id and mso.sale_order_classfication='2')
<where>
<if test="saleorderCode != null and saleorderCode != ''">and mso.saleorder_code like concat('%', #{saleorderCode},
'%')</if>
@ -264,6 +265,7 @@
<if test="materialSpec != null and materialSpec != '' ">and replace(mbmi.material_spec,' ','') like concat('%', #{materialSpec},
'%')</if>
<if test="isRelease != null and isRelease != ''">and mso.is_release = #{isRelease}</if>
<if test="saleOrderClassfication != null and saleOrderClassfication != ''">and mso.sale_order_classfication = #{saleOrderClassfication}</if>
</where>
order by mso.erp_modify_date desc
</select>

@ -10,9 +10,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="barcodeInfo" column="barcode_info" />
<result property="orderBindId" column="order_bind_id" />
<result property="relateSaleOrderId" column="relate_sale_order_id" />
<result property="relateSaleOrderCode" column="relate_sale_order_code" />
<result property="materialId" column="material_id" />
<result property="purchaseOrderId" column="purchase_order_id" />
<result property="relateSaleOrderAmount" column="relate_sale_order_amount" />
<result property="productId" column="product_id" />
<result property="materialCode" column="material_code" />
<result property="materialName" column="material_name" />
<result property="materialSpec" column="material_spec" />
</resultMap>
<sql id="selectMesSaleOrderRelateVo">
@ -24,6 +30,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<where>
<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>
<if test="relateSaleOrderAmount != null "> and relate_sale_order_amount = #{relateSaleOrderAmount}</if>
</where>
</select>
@ -40,7 +47,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="barcodeInfo != null">barcode_info,</if>
<if test="orderBindId != null">order_bind_id,</if>
<if test="relateSaleOrderId != null">relate_sale_order_id,</if>
<if test="relateSaleOrderCode != null">relate_sale_order_code,</if>
<if test="materialId != null">material_id,</if>
<if test="productId != null">product_id,</if>
<if test="purchaseOrderId != null">purchase_order_id,</if>
<if test="relateSaleOrderAmount != null">relate_sale_order_amount,</if>
</trim>
@ -49,7 +58,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="barcodeInfo != null">#{barcodeInfo},</if>
<if test="orderBindId != null">#{orderBindId},</if>
<if test="relateSaleOrderId != null">#{relateSaleOrderId},</if>
<if test="relateSaleOrderCode != null">#{relateSaleOrderCode},</if>
<if test="materialId != null">#{materialId},</if>
<if test="productId != null">#{productId},</if>
<if test="purchaseOrderId != null">#{purchaseOrderId},</if>
<if test="relateSaleOrderAmount != null">#{relateSaleOrderAmount},</if>
</trim>
@ -78,9 +89,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<insert id="batchMesSaleOrderRelate">
insert into mes_sale_order_relate( sale_order_id, barcode_info,order_bind_id,relate_sale_order_id,material_id, purchase_order_id,relate_sale_order_amount) values
insert into mes_sale_order_relate( sale_order_id, barcode_info,order_bind_id,relate_sale_order_id,relate_sale_order_code,material_id, product_id,purchase_order_id,relate_sale_order_amount) values
<foreach item="item" index="index" collection="list" separator=",">
( #{item.saleOrderId}, #{item.barcodeInfo}, #{item.orderBindId}, #{item.relateSaleOrderId}, #{item.materialId},#{item.purchaseOrderId}, #{item.relateSaleOrderAmount})
( #{item.saleOrderId}, #{item.barcodeInfo}, #{item.orderBindId}, #{item.relateSaleOrderId}, #{item.relateSaleOrderCode}, #{item.materialId},#{item.productId},#{item.purchaseOrderId}, #{item.relateSaleOrderAmount})
</foreach>
</insert>
<select id="selectMesSaleOrderRelateJoinList" parameterType="MesSaleOrderRelate" resultMap="MesSaleOrderRelateResult">
select msor.sale_order_relate_id, msor.sale_order_id,msor.barcode_info, msor.order_bind_id,msor.relate_sale_order_id,msor.relate_sale_order_code,
msor.material_id, msor.relate_sale_order_amount,msor.purchase_order_id,msor.product_id,
mbmi.material_code,mbmi.material_name,mbmi.material_spec
from mes_sale_order_relate msor
left join mes_base_material_info mbmi on msor.material_id=mbmi.material_id
<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>
<if test="relateSaleOrderAmount != null "> and relate_sale_order_amount = #{relateSaleOrderAmount}</if>
</where>
</select>
</mapper>

@ -168,8 +168,6 @@ public class WmsWarehouseMaterialServiceImpl implements IWmsWarehouseMaterialSer
}
}
});
if (errorMsgBuilder.length() > 0) {

@ -130,10 +130,10 @@ export function selectPurchaseOrderBindList(query) {
// 获取销售订单已绑定采购订单List,for 新增原材料条码
export function getOrderBinds(query) {
// 获取采购订单信息join order_bind,for 新增原材料条码
export function getPurchaseOrdersWithBind(query) {
return request({
url: '/mes/purchaseOrder/getOrderBinds',
url: '/mes/purchaseOrder/getPurchaseOrdersWithBind',
method: 'get',
params: query
})

@ -225,6 +225,16 @@
</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-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-hasPermi="['mes:barcode:edit']"
>编辑
</el-button>
<el-button
size="mini"
type="text"
@ -292,7 +302,7 @@
<el-form-item label="批次标识" prop="batchFlag">
<el-radio-group v-model="form.batchFlag" :disabled="saleBatchFlagDisable">
<el-radio
v-for="dict in dict.type.active_flag"
v-for="dict in dict.type.mes_material_batch_flag"
:key="dict.value"
:label="dict.value"
>{{ dict.label }}
@ -320,10 +330,8 @@
</el-tooltip>
条码数量
</span>
<el-input v-model="form.barcodeAmount" disabled/>
<span v-if="form.currentOrderBindAmount!==0 || form.currentSafeBindAmount !==0"><b>订单条码数量:</b>{{
form.currentOrderBindAmount
}} <b>安全库存条码数量:</b>{{ form.currentSafeBindAmount }}</span>
<el-input v-model="form.barcodeAmount"/>
<span><b>可用数量:</b>{{ form.availableBindAmount }} </span>
</el-form-item>
<el-form-item label="生产日期" prop="productionDate">
@ -605,7 +613,7 @@
<el-table :data="materialRelateForm.mesSaleOrderRelateList" :row-class-name="rowMesBaseMaterialRelateIndex"
@selection-change="handleMesBaseMaterialRelateSelectionChange" ref="mesBaseMaterialRelate">
<el-table-column label="序号" align="center" prop="index"/>
<el-table-column label="采购订单" align="center" prop="purchaseOrderId" v-if="false"/>
<el-table-column label="采购订单" align="center" prop="purchaseOrderId"/>
<el-table-column label="物料编码" align="center" prop="materialCode"/>
<el-table-column label="物料名称" align="center" prop="materialName"/>
<el-table-column label="物料规格" align="center" prop="materialSpec"/>
@ -617,7 +625,7 @@
size="mini"
type="text"
icon="el-icon-delete"
@click="regenerateBarcode(scope.row)"
@click="handleDeletePurchaseOrder(scope.row)"
>删除
</el-button>
</template>
@ -672,11 +680,12 @@ import {checkWarehouseMaterials} from "@/api/wms/wmswarehouse";
import selectOrderBind from '@//views/mes/purchaseOrder/selectOrderBind.vue';
import selectMaterial from '@//views/mes/materialinfo/selectMaterial.vue';
import {getMaterialinfo} from "@/api/mes/materialinfo";
export default {
name: "Barcode",
dicts: ['bind_status', 'active_flag', 'barcode_type', 'mes_safe_flag', 'mes_print_flag'],
dicts: ['bind_status', 'active_flag', 'barcode_type', 'mes_safe_flag', 'mes_print_flag', 'mes_material_batch_flag'],
components: {
'select-orderBind': selectOrderBind,
'select-material': selectMaterial
@ -756,9 +765,6 @@ export default {
batchFlag: [
{required: true, message: "批次标识不能为空", trigger: "change"}
],
amount: [
{required: true, message: "批次数量不能为空", trigger: "change"}
],
barcodeAmount: [
{required: true, message: "条码数量不能为空", trigger: "change"}
],
@ -818,9 +824,6 @@ export default {
batchFlag: [
{required: true, message: "批次标识不能为空", trigger: "change"}
],
amount: [
{required: true, message: "批次数量不能为空", trigger: "change"}
],
barcodeType: [
{required: true, message: "条码类型不能为空", trigger: "change"}
],
@ -893,9 +896,6 @@ export default {
batchFlag: [
{required: true, message: "批次标识不能为空", trigger: "change"}
],
amount: [
{required: true, message: "批次数量不能为空", trigger: "change"}
],
barcodeType: [
{required: true, message: "条码类型不能为空", trigger: "change"}
],
@ -904,6 +904,23 @@ export default {
],
},
PRINT_FLAG: {
YES: "1",
NO: "0"
},
SINGLE_FLAG: {
NO: "0",
YES: "1",
INTERNAL: "2",
MERGE: "3"
},
BARCODE_TYPE: {
RAW: "1",
REGULAR: "9"
},
};
},
created() {
@ -971,7 +988,7 @@ export default {
bindTime: null,
updateBy: null,
updateTime: null,
currentOrderBindAmount: 0,
availableBindAmount: 0,
currentSafeBindAmount: 0
};
this.resetForm("form");
@ -1000,6 +1017,7 @@ export default {
},
/** 新增采购订单按钮操作 */
handlePurchaseOrderAdd() {
this.barcodeData = {mergeFlag: null};
this.purchaseOrderOpen = true;
},
@ -1103,9 +1121,8 @@ export default {
return formItem.relateSaleOrderId === item.saleOrderId;
});
if(filterSaleOrderIdMaterialRelateList!=null && filterSaleOrderIdMaterialRelateList.length >0){
if (filterSaleOrderIdMaterialRelateList != null && filterSaleOrderIdMaterialRelateList.length > 0) {
let errorMsg = "选择的信息跟已经选择的销售订单号明细相同.";
alert(JSON.stringify(filterSaleOrderIdMaterialRelateList))
for (let ssoid of filterSaleOrderIdMaterialRelateList) {
errorMsg += "销售订单号:" + ssoid.saleOrderCode + ",成品编码:" + ssoid.productCode + ",成品名称:" + ssoid.productName + ",成品规格:" + ssoid.productSpec + ";";
}
@ -1120,18 +1137,19 @@ export default {
index: item.index,
orderBindId: item.orderBindId,
relateSaleOrderId: item.saleOrderId,
saleOrderCode:item.saleOrderCode,
relateSaleOrderCode: item.saleOrderCode,
productId: item.productId,
productCode:item.productCode,
productName:item.productName,
productSpec:item.productSpec,
productCode: item.productCode,
productName: item.productName,
productSpec: item.productSpec,
purchaseOrderId: item.purchaseOrderId,
materialId: item.materialId,
materialCode:item.materialCode,
materialName:item.materialName,
materialSpec:item.materialSpec,
specificationParameter:item.specificationParameter,
relateSaleOrderAmount: item.relateSaleOrderAmount
materialCode: item.materialCode,
materialName: item.materialName,
materialSpec: item.materialSpec,
specificationParameter: item.specificationParameter,
relateSaleOrderAmount: item.relateSaleOrderAmount,
orderAmount: item.orderAmount
};
this.materialRelateForm.mesSaleOrderRelateList.push(mesSaleOrderRelate);
@ -1147,6 +1165,13 @@ export default {
// alert(JSON.stringify(selectedRows));
} else {
this.submitSingleSelectPurchaseOrder();
}
},
submitSingleSelectPurchaseOrder() {
let selectedRow = this.$refs.purchaseOrderRef.selectedRow;
this.form.batchFlag = null;
this.form.amount = null;
@ -1158,22 +1183,13 @@ export default {
this.form.projectNo = null;
this.form.purchaseOrderId = null;
//
this.form.currentOrderBindAmount = null;
//
this.form.currentSafeBindAmount = null;
this.form.availableBindAmount = null;
//
this.form.barcodeAmount = null;
this.form.poNo = null;
this.form.orderBindId = null;
let currentOrderBindAmount = parseInt(selectedRow.orderBindAmount) - parseInt(selectedRow.orderBarcodeAmount);
let currentSafeBindAmount = parseInt(selectedRow.safeBindAmount) - parseInt(selectedRow.safeBarcodeAmount)
let canBindAmount = currentOrderBindAmount + currentSafeBindAmount;
if (selectedRow.mesMaterialId === null || selectedRow.mesMaterialId === '' || selectedRow.mesMaterialId === 0) {
this.$modal.msgError("物料信息不存在");
return;
}
if (canBindAmount <= 0) {
if (selectedRow.relateSaleOrderAmount == null || selectedRow.relateSaleOrderAmount === '' || parseInt(selectedRow.relateSaleOrderAmount) <= 0) {
this.$modal.msgError("无可生成条码数量");
return;
}
@ -1181,49 +1197,51 @@ export default {
this.$set(this.form, "poNo", selectedRow.poNo);
this.form.barcodeType = '1';//1,2,3,4
// this.form.materialId = selectedRow.materialId;//ERPID
this.form.materialId = selectedRow.mesMaterialId;//ID
// this.form.materialId = selectedRow.materialId;//ERPID
this.form.materialId = selectedRow.materialId;//ID
this.form.materialCode = selectedRow.materialCode;
this.form.materialName = selectedRow.materialName;
this.form.materialSpec = selectedRow.materialSpec;
this.form.projectNo = selectedRow.projectNo;
this.form.purchaseOrderId = selectedRow.purchaseOrderId;
this.form.barcodeSpec = selectedRow.specificationParameter;
//
this.form.currentOrderBindAmount = currentOrderBindAmount;
//
this.form.currentSafeBindAmount = currentSafeBindAmount;
//
this.form.barcodeAmount = canBindAmount;
//
this.form.availableBindAmount = parseInt(selectedRow.relateSaleOrderAmount);
this.form.orderBindId = selectedRow.orderBindId;
//
this.form.barcodeAmount = null;
if (selectedRow.batchFlag != null && selectedRow.batchFlag !== '') {
this.saleBatchFlagDisable = true;
this.form.batchFlag = selectedRow.batchFlag;
if (this.form.batchFlag === this.BATCH_FLAG.YES) {
this.form.amount = selectedRow.batchAmount;
} else {
this.form.amount = 1;
}
} else {
this.saleBatchFlagDisable = false;
}
getMaterialInfoByErpId(selectedRow.materialId).then(response => {
if (response.data == null) {
this.$modal.msgError("物料信息不存在");
return;
}
this.saleBatchFlagDisable = !!this.form.batchFlag;
this.purchaseOrderOpen = false;
},
handleDeletePurchaseOrder(row) {
const mesSaleOrderRelateList = this.materialRelateForm.mesSaleOrderRelateList;
this.materialRelateForm.mesSaleOrderRelateList = mesSaleOrderRelateList.filter(function (item) {
return row.index !== item.index
});
if (!this.materialRelateForm.mesSaleOrderRelateList || this.materialRelateForm.mesSaleOrderRelateList.length <= 0) {
this.materialRelateForm.poNo = null;
this.materialRelateForm.saleOrderCode = null;
}
// if (this.checkedDmsBillsMaintDetailProject.length == 0) {
// this.$modal.msgError(";");
// } else {
// const dmsBillsMaintDetailProjectList = this.dmsBillsMaintDetailProjectList;
// const checkedDmsBillsMaintDetailProject = this.checkedDmsBillsMaintDetailProject;
// this.dmsBillsMaintDetailProjectList = dmsBillsMaintDetailProjectList.filter(function(item) {
// return checkedDmsBillsMaintDetailProject.indexOf(item.index) == -1
// });
// }
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
@ -1231,6 +1249,7 @@ export default {
this.title = "添加原材料条码信息";
},
/** 打印条码按钮操作 */
handlePrintBarcodes(row) {
this.loading = true;
@ -1295,10 +1314,22 @@ export default {
/** 修改按钮操作 */
handleUpdate(row) {
if (row.singleFlag === this.SINGLE_FLAG.MERGE) {
this.resetRelate();
} else {
if (row.purchaseOrderId === 0) {
this.resetNoPurchase();
} else {
this.reset();
const barcodeId = row.barcodeId || this.ids
}
}
const barcodeId = row.barcodeId;
getBarcode(barcodeId).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改原材料条码信息";
});
@ -1697,7 +1728,7 @@ export default {
bindTime: null,
updateBy: null,
updateTime: null,
currentOrderBindAmount: 0,
availableBindAmount: 0,
currentSafeBindAmount: 0,
mesSaleOrderRelateList: []
};
@ -1731,7 +1762,10 @@ export default {
this.$refs["materialRelateForm"].validate(valid => {
if (valid) {
this.submitLoading = true;
alert(JSON.stringify(this.materialRelateForm.mesSaleOrderRelateList))
if (this.materialRelateForm.mesSaleOrderRelateList.length <= 1) {
this.$modal.msgError("请选择至少2条采购信息");
return;
}
mergeAddBarcode(this.materialRelateForm).then(response => {
this.$modal.msgSuccess("新增成功");
this.materialRelateOpen = false;

@ -42,7 +42,18 @@
/>
</el-form-item>
<el-form-item label="可用标识" v-if="defineData.mergeFlag">
<el-form-item label="常备物料" v-if="!queryParams.mergeFlag" clearable prop="alwaysFlag">
<el-select v-model="queryParams.alwaysFlag" placeholder="请选择常备物料标识" clearable>
<el-option
v-for="dict in dict.type.mes_material_bind_flag"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="可用标识" v-if="queryParams.mergeFlag" prop="mergeFlag">
<el-radio-group v-model="queryParams.mergeFlag">
<el-radio label="1" value="1" >
@ -53,7 +64,7 @@
</el-radio-group>
</el-form-item>
<el-form-item label="可用标识" v-if="!defineData.mergeFlag">
<el-form-item label="可用标识" v-if="!queryParams.mergeFlag" prop="singleFlag">
<el-radio-group v-model="queryParams.singleFlag">
<el-radio label="1" value="1" >
@ -65,6 +76,7 @@
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
@ -82,19 +94,26 @@
highlight-current-row
>
<el-table-column type="selection" align="center" v-if="selectionVisible"/>
<el-table-column label="采购订单ID" align="center" prop="purchaseOrderId" />
<el-table-column label="采购订单" align="center" prop="poNo" />
<el-table-column label="物料编码" align="center" prop="materialCode" />
<el-table-column label="物料名称" align="center" prop="materialName" />
<el-table-column label="物料规格" align="center" prop="materialSpec"/>
<el-table-column label="规格参数" align="center" prop="specificationParameter"/>
<el-table-column label="常备物料" align="center" prop="alwaysFlag">
<template slot-scope="scope">
<dict-tag :options="dict.type.mes_material_bind_flag" :value="scope.row.alwaysFlag"/>
</template>
</el-table-column>
<!-- <el-table-column label="绑定数量" align="center" prop="bindAmount" />-->
<!-- <el-table-column label="条码数量" align="center" prop="barcodeAmount" />-->
<el-table-column label="采购数量" align="center" prop="orderAmount" />
<el-table-column label="可用数量" align="center" prop="relateSaleOrderAmount" />
<el-table-column label="销售订单" align="center" prop="saleOrderCode" />
<el-table-column label="销售数量" align="center" prop="saleOrderAmount" />
<el-table-column label="成品编码" align="center" prop="productCode" />
<el-table-column label="成品名称" align="center" prop="productName" />
<el-table-column label="成品规格" align="center" prop="productSpec"/>
<el-table-column label="销售数量" align="center" prop="saleOrderAmount" />
</el-table>
<pagination
@ -110,12 +129,12 @@
<script>
import {
getOrderBinds
getPurchaseOrdersWithBind
} from "@//api/mes/purchaseOrder";
export default {
name: "OrderBind",
dicts: ['active_flag', 'order_status', 'document_status'],
dicts: ['active_flag', 'order_status', 'document_status','mes_material_bind_flag'],
props: {
defineData: {
type: Object,
@ -167,7 +186,8 @@ export default {
completeDate: null,
isFlag: null,
mergeFlag: null,
singleFlag: null
singleFlag: null,
alwaysFlag:""
},
//
form: {},
@ -208,7 +228,11 @@ export default {
{key: 21, label: `更新人`, visible: false},
{key: 22, label: `更新时间`, visible: false},
],
selectedRows:[]
selectedRows:[],
ALWAYS_FLAG:{
YES:"1",
NO:"0"
}
};
},
created() {
@ -232,9 +256,12 @@ export default {
/** 查询采购订单信息列表 */
getList() {
this.loading = true;
getOrderBinds(this.queryParams).then(response => {
getPurchaseOrdersWithBind(this.queryParams).then(response => {
response.rows.forEach(e => {
if(e.orderBindId){
e.relateSaleOrderAmount = parseInt(e.bindAmount - e.barcodeAmount);
}
});
this.orderBindList = response.rows;

@ -10,6 +10,17 @@
/>
</el-form-item>
<el-form-item label="订单类型" prop="saleOrderClassfication">
<el-select v-model="queryParams.saleOrderClassfication" placeholder="请选择订单类型" clearable>
<el-option
v-for="dict in dict.type.mes_sale_order_classfication"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="物料编码" prop="materialCode">
<el-input
v-model="queryParams.materialCode"
@ -113,6 +124,11 @@
<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="saleorderCode" v-if="columns[3].visible"/>
<el-table-column label="订单类型" align="center" prop="saleOrderClassfication">
<template slot-scope="scope">
<dict-tag :options="dict.type.mes_sale_order_classfication" :value="scope.row.saleOrderClassfication"/>
</template>
</el-table-column>
<el-table-column label="销售订单行号" align="center" prop="saleorderLinenumber" v-if="columns[4].visible"/>
<el-table-column label="单据状态" align="center" prop="documentStatus" v-if="columns[5].visible" >
<template slot-scope="scope">
@ -331,7 +347,7 @@ import { listSaleOrder, getSaleOrder, delSaleOrder, addSaleOrder, updateSaleOrde
export default {
name: "SaleOrder",
dicts: ['document_status', 'is_release','mes_sale_order_is_release'],
dicts: ['document_status', 'is_release','mes_sale_order_is_release','mes_sale_order_classfication'],
data() {
return {
//
@ -378,6 +394,7 @@ export default {
endDate: null,
completeDate: null,
isFlag: null,
saleOrderClassfication:null,
},
//
form: {},

Loading…
Cancel
Save