MES:
采购订单绑定销售订单完善:根据条码数量判断绑定数量等
master
xs 3 months ago
parent bd11b2eec2
commit a1bf717d40

@ -306,7 +306,7 @@ public class MesApiController extends BaseController {
*/
@GetMapping(value = "/printProductBarcodes/{barcodeIds}")
public AjaxResult printProductBarcodes(@PathVariable Long[] barcodeIds) {
return success(mesBaseBarcodeInfoService.printBarcodes(barcodeIds, MesConstants.MES_BARCODE_TYPE_PRODUCT));
return success(mesBaseBarcodeInfoService.printBarcodes(barcodeIds, MesConstants.MES_BARCODE_TYPE_PRODUCT,false));
}

@ -124,10 +124,22 @@ public class MesBaseBarcodeInfoController extends BaseController
* @return
*/
@GetMapping(value = "/printBarcodes/{barcodeIds}")
@RequiresPermissions("mes:barcode:printBarcodes")
@RequiresPermissions("mes:barcode:printBarcode")
public AjaxResult printBarcodes(@PathVariable Long[] barcodeIds)
{
return success(mesBaseBarcodeInfoService.printBarcodes(barcodeIds,MesConstants.MES_BARCODE_TYPE_RAW));
return success(mesBaseBarcodeInfoService.printBarcodes(barcodeIds,MesConstants.MES_BARCODE_TYPE_RAW,false));
}
/**
*
* @param barcodeIds
* @return
*/
@GetMapping(value = "/reprintBarcodes/{barcodeIds}")
@RequiresPermissions("mes:barcode:reprint")
public AjaxResult reprintBarcodes(@PathVariable Long[] barcodeIds)
{
return success(mesBaseBarcodeInfoService.printBarcodes(barcodeIds,MesConstants.MES_BARCODE_TYPE_RAW,true));
}
/**
@ -207,7 +219,7 @@ public class MesBaseBarcodeInfoController extends BaseController
@RequiresPermissions("mes:barcode:printProductBarcodes")
public AjaxResult printProductBarcodes(@PathVariable Long[] barcodeIds)
{
return success(mesBaseBarcodeInfoService.printBarcodes(barcodeIds, MesConstants.MES_BARCODE_TYPE_PRODUCT));
return success(mesBaseBarcodeInfoService.printBarcodes(barcodeIds, MesConstants.MES_BARCODE_TYPE_PRODUCT,false));
}

@ -49,7 +49,7 @@ public class MesPurchaseOrderController extends BaseController
public TableDataInfo list(MesPurchaseOrder mesPurchaseOrder)
{
startPage();
List<MesPurchaseOrder> list = mesPurchaseOrderService.selectMesPurchaseOrderList(mesPurchaseOrder);
List<MesPurchaseOrder> list = mesPurchaseOrderService.selectMesPurchaseOrderJoinList(mesPurchaseOrder);
return getDataTable(list);
}
@ -118,7 +118,7 @@ public class MesPurchaseOrderController extends BaseController
public TableDataInfo getSaleOrders(MesSaleOrder querySaleOrder)
{
startPage();
List<MesSaleOrder> list = mesSaleOrderService.selectMesSaleOrderList(querySaleOrder);
List<MesSaleOrder> list = mesSaleOrderService.selectMesSaleOrderJoinMaterialList(querySaleOrder);
return getDataTable(list);
}
@ -200,4 +200,16 @@ public class MesPurchaseOrderController extends BaseController
return toAjax(mesPurchaseOrderService.removeSalesBindPurchase(saleOrderId, purchaseOrderIds));
}
/**
*
*/
@RequiresPermissions("mes:purchaseOrder:bind")
@Log(title = "采购订单板顶信息", businessType = BusinessType.DELETE)
@GetMapping("/deleteOrderBind/{orderBindIds}")
public AjaxResult deleteOrderBind(@PathVariable Long[] orderBindIds)
{
return toAjax(mesPurchaseOrderService.deleteMesOrderBindByOrderBindIds(orderBindIds));
}
}

@ -1,6 +1,8 @@
package com.hw.mes.domain;
import java.math.BigDecimal;
import java.util.Objects;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.hw.common.core.annotation.Excel;
@ -12,179 +14,194 @@ import com.hw.common.core.web.domain.BaseEntity;
* @author xins
* @date 2024-05-16
*/
public class MesOrderBind extends BaseEntity
{
public class MesOrderBind extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 主键标识 */
/**
*
*/
private Long orderBindId;
/** 安全库存标识(1是0否) */
/**
* (10)
*/
@Excel(name = "安全库存标识(1是0否)")
private String safeFlag;
/** 销售订单ID;对应FID */
/**
* ID;FID
*/
@Excel(name = "销售订单ID;对应FID")
private Long saleOrderId;
/** 销售订单编号 */
/**
*
*/
@Excel(name = "销售订单编号")
private String saleOrderCode;
/** ERP成品ID */
/**
* ERPID
*/
@Excel(name = "ERP成品ID")
private Long productId;
/** 成品编号 */
/**
*
*/
@Excel(name = "成品编号")
private String productCode;
/** 成品名称 */
/**
*
*/
@Excel(name = "成品名称")
private String productName;
/** 采购订单ID */
/**
* ID
*/
@Excel(name = "采购订单ID")
private Long purchaseOrderId;
/** 采购订单编号 */
/**
*
*/
@Excel(name = "采购订单编号")
private String poNo;
/** ERP物料ID */
/**
* ERPID
*/
@Excel(name = "ERP物料ID")
private Long materialId;
/** 物料编号 */
/**
*
*/
@Excel(name = "物料编号")
private String materialCode;
/** 物料名称 */
/**
*
*/
@Excel(name = "物料名称")
private String materialName;
/** 绑定数量 */
/**
*
*/
@Excel(name = "绑定数量")
private BigDecimal bindAmount;
/**绑定条码数量*/
/**
*
*/
private BigDecimal barcodeAmount;
public void setOrderBindId(Long orderBindId)
{
private String productSpec;
public void setOrderBindId(Long orderBindId) {
this.orderBindId = orderBindId;
}
public Long getOrderBindId()
{
public Long getOrderBindId() {
return orderBindId;
}
public void setSafeFlag(String safeFlag)
{
public void setSafeFlag(String safeFlag) {
this.safeFlag = safeFlag;
}
public String getSafeFlag()
{
public String getSafeFlag() {
return safeFlag;
}
public void setSaleOrderId(Long saleOrderId)
{
public void setSaleOrderId(Long saleOrderId) {
this.saleOrderId = saleOrderId;
}
public Long getSaleOrderId()
{
public Long getSaleOrderId() {
return saleOrderId;
}
public void setSaleOrderCode(String saleOrderCode)
{
public void setSaleOrderCode(String saleOrderCode) {
this.saleOrderCode = saleOrderCode;
}
public String getSaleOrderCode()
{
public String getSaleOrderCode() {
return saleOrderCode;
}
public void setProductId(Long productId)
{
public void setProductId(Long productId) {
this.productId = productId;
}
public Long getProductId()
{
public Long getProductId() {
return productId;
}
public void setProductCode(String productCode)
{
public void setProductCode(String productCode) {
this.productCode = productCode;
}
public String getProductCode()
{
public String getProductCode() {
return productCode;
}
public void setProductName(String productName)
{
public void setProductName(String productName) {
this.productName = productName;
}
public String getProductName()
{
public String getProductName() {
return productName;
}
public void setPurchaseOrderId(Long purchaseOrderId)
{
public void setPurchaseOrderId(Long purchaseOrderId) {
this.purchaseOrderId = purchaseOrderId;
}
public Long getPurchaseOrderId()
{
public Long getPurchaseOrderId() {
return purchaseOrderId;
}
public void setPoNo(String poNo)
{
public void setPoNo(String poNo) {
this.poNo = poNo;
}
public String getPoNo()
{
public String getPoNo() {
return poNo;
}
public void setMaterialId(Long materialId)
{
public void setMaterialId(Long materialId) {
this.materialId = materialId;
}
public Long getMaterialId()
{
public Long getMaterialId() {
return materialId;
}
public void setMaterialCode(String materialCode)
{
public void setMaterialCode(String materialCode) {
this.materialCode = materialCode;
}
public String getMaterialCode()
{
public String getMaterialCode() {
return materialCode;
}
public void setMaterialName(String materialName)
{
public void setMaterialName(String materialName) {
this.materialName = materialName;
}
public String getMaterialName()
{
public String getMaterialName() {
return materialName;
}
public void setBindAmount(BigDecimal bindAmount)
{
public void setBindAmount(BigDecimal bindAmount) {
this.bindAmount = bindAmount;
}
public BigDecimal getBindAmount()
{
public BigDecimal getBindAmount() {
return bindAmount;
}
@ -196,9 +213,17 @@ public class MesOrderBind extends BaseEntity
this.barcodeAmount = barcodeAmount;
}
public String getProductSpec() {
return productSpec;
}
public void setProductSpec(String productSpec) {
this.productSpec = productSpec;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("orderBindId", getOrderBindId())
.append("safeFlag", getSafeFlag())
.append("saleOrderId", getSaleOrderId())
@ -219,4 +244,17 @@ public class MesOrderBind extends BaseEntity
.append("updateTime", getUpdateTime())
.toString();
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
MesOrderBind that = (MesOrderBind) o;
return Objects.equals(orderBindId, that.orderBindId) && barcodeAmount.compareTo(that.barcodeAmount) == 0;
}
@Override
public int hashCode() {
return Objects.hash(orderBindId, barcodeAmount);
}
}

@ -59,27 +59,27 @@ public class MesPurchaseOrder extends BaseEntity {
private BigDecimal completeAmount;
/** 审核日期;对应FApproveDate */
@JsonFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss")
@Excel(name = "审核日期;对应FApproveDate", width = 30, dateFormat = "yyyy-MM-dd")
private Date approveDate;
/** ERP最后修改日期;对应FModifyDate */
@JsonFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss")
@Excel(name = "ERP最后修改日期;对应FModifyDate", width = 30, dateFormat = "yyyy-MM-dd")
private Date erpModifyDate;
/** 计划交货日期;对应FDeliveryDate */
@JsonFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss")
@Excel(name = "计划交货日期;对应FDeliveryDate", width = 30, dateFormat = "yyyy-MM-dd")
private Date planDeliveryDate;
/** 计划开始日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss")
@Excel(name = "计划开始日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date beginDate;
/** 计划结束日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss")
@Excel(name = "计划结束日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date endDate;
@ -88,7 +88,7 @@ public class MesPurchaseOrder extends BaseEntity {
private String orderStatus;
/** 完成日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss")
@Excel(name = "完成日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date completeDate;
@ -176,6 +176,9 @@ public class MesPurchaseOrder extends BaseEntity {
private long mesMaterialId;//物料信息表的物料ID主键
private String alwaysFlag;
public Long getSerialNumber() {
return serialNumber;
}
@ -549,6 +552,14 @@ public class MesPurchaseOrder extends BaseEntity {
this.mesMaterialId = mesMaterialId;
}
public String getAlwaysFlag() {
return alwaysFlag;
}
public void setAlwaysFlag(String alwaysFlag) {
this.alwaysFlag = alwaysFlag;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

@ -166,6 +166,11 @@ public class MesSaleOrder extends BaseEntity {
*/
private String materialModel;
private String materialSpec;
private Long erpMaterialId;
public String getMaterialModel() {
return materialModel;
}
@ -358,6 +363,22 @@ public class MesSaleOrder extends BaseEntity {
return isFlag;
}
public String getMaterialSpec() {
return materialSpec;
}
public void setMaterialSpec(String materialSpec) {
this.materialSpec = materialSpec;
}
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)

@ -0,0 +1,54 @@
package com.hw.mes.domain.vo;
import com.hw.mes.domain.MesOrderBind;
import com.hw.mes.domain.MesProductPlan;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.List;
/**
* @Description: VO
* @ClassName: MesOrderBindVo
* @Author : xins
* @Date :2024-08-14 13:46
* @Version :1.0
*/
@Data
public class MesOrderBindVo {
//物料ERPID
@NotNull(message = "物料ERPId必须输入")
private Long erpMaterialId;
//采购订单ID
@NotNull(message = "采购订单Id必须输入")
private Long purchaseOrderId;
//订单计划数量
@NotNull(message = "订单计划数量不能为空")
private BigDecimal orderAmount;
//物料编码
@NotEmpty(message = "物料编码不能为空")
private String materialCode;
//物料名称
@NotEmpty(message = "物料名称不能为空")
private String materialName;
//采购订单号
@NotEmpty(message = "采购订单号不能为空")
private String poNo;
//保存的订单绑定信息
@NotNull(message = "绑定信息不能为空")
private List<MesOrderBind> mesOrderBindList;
//待删除的订单绑定ID
private Long[] toDeletedOrderBindIds;
}

@ -109,4 +109,11 @@ public interface MesPurchaseOrderMapper
*/
List<MesPurchaseOrder> selectPurchaseOrderBindList(MesPurchaseOrder mesPurchaseOrder);
/**
* ,join material
* @param mesPurchaseOrder
* @return
*/
List<MesPurchaseOrder> selectMesPurchaseOrderJoinList(MesPurchaseOrder mesPurchaseOrder);
}

@ -105,10 +105,12 @@ public interface IMesBaseBarcodeInfoService
*
*
* @param barcodeIds
* @param printType 1 3
* @param printType 1 3
* @param reprintFlag (1)
* @return
*/
public int printBarcodes(Long[] barcodeIds,String printType);
public int printBarcodes(Long[] barcodeIds, String printType,boolean reprintFlag);
/**
* ()

@ -27,6 +27,14 @@ public interface IMesPurchaseOrderService
*/
public List<MesPurchaseOrder> selectMesPurchaseOrderList(MesPurchaseOrder mesPurchaseOrder);
/**
* ,Join material
*
* @param mesPurchaseOrder
* @return
*/
public List<MesPurchaseOrder> selectMesPurchaseOrderJoinList(MesPurchaseOrder mesPurchaseOrder);
/**
*
*
@ -113,4 +121,12 @@ public interface IMesPurchaseOrderService
* @return
*/
public List<MesPurchaseOrder> selectPurchaseOrderBindList(MesPurchaseOrder mesPurchaseOrder);
/**
*
*
* @param orderBindIds
* @return
*/
public int deleteMesOrderBindByOrderBindIds(Long[] orderBindIds);
}

@ -584,18 +584,19 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
*
*
* @param barcodeIds
* @param printType 1 3
* @param printType 1 3
* @param reprintFlag (1)
* @return
*/
@Override
@Transactional
public int printBarcodes(Long[] barcodeIds, String printType) {
public int printBarcodes(Long[] barcodeIds, String printType, boolean reprintFlag) {
//获取条码List
List<List<PrintContentVo>> printContents = new ArrayList<>();
List<MesBaseBarcodeInfo> toUpdatedBaseBarcodeInfos = new ArrayList<>();
// List<List<PrintContentVo>> printContents = new ArrayList<>();
// List<MesBaseBarcodeInfo> toUpdatedBaseBarcodeInfos = new ArrayList<>();
for (Long barcodeId : barcodeIds) {
printBarcodesByBarcodeId(barcodeId, printType);
printBarcodesByBarcodeId(barcodeId, printType, reprintFlag);
}
// for (MesBaseBarcodeInfo toUpdateMesBaseBarcodeInfo : toUpdatedBaseBarcodeInfos) {
@ -617,17 +618,19 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
// throw new RuntimeException(printResultR.getMsg());
// }
return toUpdatedBaseBarcodeInfos.size();
return 1;
}
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void printBarcodesByBarcodeId(Long barcodeId, String printType) {
public void printBarcodesByBarcodeId(Long barcodeId, String printType, boolean reprintFlag) {
MesBaseBarcodeInfo mesBaseBarcodeInfo = mesBaseBarcodeInfoMapper.selectMesBaseBarcodeInfoJoinByBarcodeId(barcodeId);
String printFlag = mesBaseBarcodeInfo.getPrintFlag();
if (printFlag.equals(MesConstants.MES_BARCODE_PRINT_FLAG_YES)) {
throw new ServiceException("此物料条码[" + mesBaseBarcodeInfo.getBarcodeInfo() + "]已经打印过,不能重复打印");
if (!reprintFlag) {
String printFlag = mesBaseBarcodeInfo.getPrintFlag();
if (printFlag.equals(MesConstants.MES_BARCODE_PRINT_FLAG_YES)) {
throw new ServiceException("此物料条码[" + mesBaseBarcodeInfo.getBarcodeInfo() + "]已经打印过,不能重复打印");
}
}
String materialName = mesBaseBarcodeInfo.getMaterialName();
@ -740,7 +743,7 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
mesBaseBarcodeInfo.setPrintTime(DateUtils.getNowDate());
mesBaseBarcodeInfo.setPrintPerson(SecurityUtils.getUsername());
mesBaseBarcodeInfo.setPrintFlag(MesConstants.MES_BARCODE_PRINT_FLAG_YES);
mesBaseBarcodeInfo.setPrintNumber(1L);
mesBaseBarcodeInfo.setPrintNumber(mesBaseBarcodeInfo.getPrintNumber() == null ? 1L : mesBaseBarcodeInfo.getPrintNumber() + 1);
mesBaseBarcodeInfo.setAcceptedDate(DateUtils.getNowDate());
this.updateMesBaseBarcodeInfo(mesBaseBarcodeInfo);

@ -4,6 +4,7 @@ import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
import com.hw.common.core.constant.MesConstants;
import com.hw.common.core.exception.ServiceException;
@ -14,6 +15,7 @@ import com.hw.mes.api.domain.MesBaseBarcodeInfo;
import com.hw.mes.api.domain.MesBaseMaterialInfo;
import com.hw.mes.domain.MesOrderBind;
import com.hw.mes.domain.MesSaleOrder;
import com.hw.mes.domain.vo.MesOrderBindVo;
import com.hw.mes.mapper.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -66,6 +68,21 @@ public class MesPurchaseOrderServiceImpl implements IMesPurchaseOrderService {
return mesPurchaseOrderMapper.selectMesPurchaseOrderList(mesPurchaseOrder);
}
/**
* ,Join material
*
* @param mesPurchaseOrder
* @return
*/
@Override
public List<MesPurchaseOrder> selectMesPurchaseOrderJoinList(MesPurchaseOrder mesPurchaseOrder) {
mesPurchaseOrder.setMaterialSpec(StringUtils.isNotEmpty(mesPurchaseOrder.getMaterialSpec())
? mesPurchaseOrder.getMaterialSpec().replaceAll("\\s+", "") : "");
mesPurchaseOrder.setSpecificationParameter(StringUtils.isNotEmpty(mesPurchaseOrder.getSpecificationParameter())
? mesPurchaseOrder.getSpecificationParameter().replaceAll("\\s+", "") : "");
return mesPurchaseOrderMapper.selectMesPurchaseOrderJoinList(mesPurchaseOrder);
}
/**
*
*
@ -120,7 +137,7 @@ public class MesPurchaseOrderServiceImpl implements IMesPurchaseOrderService {
* @return
*/
@Override
@Transactional
@Transactional(rollbackFor = Exception.class)
public int bindOrder(MesPurchaseOrder mesPurchaseOrder) {
Long erpMaterialId = mesPurchaseOrder.getMaterialId();
MesBaseMaterialInfo mesBaseMaterialInfo = mesBaseMaterialInfoMapper.selectMesBaseMaterialInfoByErpId(erpMaterialId);
@ -137,15 +154,9 @@ public class MesPurchaseOrderServiceImpl implements IMesPurchaseOrderService {
}
Long purchaseOrderId = mesPurchaseOrder.getPurchaseOrderId();
MesBaseBarcodeInfo queryBaseBarcodeInfo = new MesBaseBarcodeInfo();
queryBaseBarcodeInfo.setPurchaseOrderId(purchaseOrderId);
int mesBaseBarcodeInfoCount = mesBaseBarcodeInfoMapper.selectMesBaseBarcodeInfoCount(queryBaseBarcodeInfo);
if (mesBaseBarcodeInfoCount > 0) {
throw new ServiceException("此采购订单已经生成条码,不能再绑定");
}
mesPurchaseOrderMapper.deleteMesOrderBindByPurchaseOrderId(mesPurchaseOrder.getPurchaseOrderId());
MesOrderBind queryOrderBind = new MesOrderBind();
queryOrderBind.setPurchaseOrderId(purchaseOrderId);
List<MesOrderBind> dbMesOrderBinds = mesOrderBindMapper.selectMesOrderBindList(queryOrderBind);
Date currentDate = new Date();
String userName = SecurityUtils.getUsername();
@ -155,8 +166,46 @@ public class MesPurchaseOrderServiceImpl implements IMesPurchaseOrderService {
String poNo = mesPurchaseOrder.getPoNo();
BigDecimal orderAmount = mesPurchaseOrder.getOrderAmount();
List<MesOrderBind> orderBinds = mesPurchaseOrder.getMesOrderBindList();
List<MesOrderBind> toUpdatedOrderBinds = orderBinds.stream().filter(ob ->
ob.getOrderBindId() != null).collect(Collectors.toList());
List<MesOrderBind> toInsertedOrderBinds = orderBinds.stream().filter(ob ->
ob.getOrderBindId() == null).collect(Collectors.toList());
/**判断两个数据库的list和前端提交的list是否相同根据orderbindid和barcodeamount判断*/
boolean areEqual =
(dbMesOrderBinds != null && toUpdatedOrderBinds != null) &&
dbMesOrderBinds.size() == toUpdatedOrderBinds.size() &&
dbMesOrderBinds.containsAll(toUpdatedOrderBinds) &&
toUpdatedOrderBinds.containsAll(dbMesOrderBinds);
if (!areEqual) {
throw new ServiceException("订单绑定数据有变化,请重新绑定");
}
/**
*
*/
BigDecimal totalBindAmount = BigDecimal.ZERO;
for (MesOrderBind orderBind : orderBinds) {
for (MesOrderBind toUpdatedOrderBind : toUpdatedOrderBinds) {
BigDecimal bindAmount = toUpdatedOrderBind.getBindAmount() == null ?
BigDecimal.ZERO : toUpdatedOrderBind.getBindAmount();
if (bindAmount.compareTo(BigDecimal.ZERO) <= 0) {
throw new ServiceException("绑定数量需大于0");
}
if (bindAmount.compareTo(toUpdatedOrderBind.getBarcodeAmount()) < 0) {
throw new ServiceException("绑定数量不能小于已经生成的条码数量");
}
toUpdatedOrderBind.setUpdateTime(currentDate);
toUpdatedOrderBind.setUpdateBy(userName);
totalBindAmount = totalBindAmount.add(bindAmount);
mesOrderBindMapper.updateMesOrderBind(toUpdatedOrderBind);
}
/**
*
*/
for (MesOrderBind orderBind : toInsertedOrderBinds) {
if (StringUtils.isEmpty(orderBind.getSafeFlag())) {
throw new ServiceException("请全部选择安全标识");
}
@ -176,21 +225,20 @@ public class MesPurchaseOrderServiceImpl implements IMesPurchaseOrderService {
throw new ServiceException("绑定数量需大于0");
}
orderBind.setPurchaseOrderId(purchaseOrderId);
orderBind.setPoNo(poNo);
orderBind.setCreateTime(currentDate);
orderBind.setCreateBy(userName);
orderBind.setMaterialId(erpMaterialId);
orderBind.setMaterialCode(materialCode);
orderBind.setMaterialName(materialName);
orderBind.setPoNo(poNo);
totalBindAmount = totalBindAmount.add(bindAmount);
}
if (totalBindAmount.compareTo(orderAmount) > 0) {
throw new ServiceException("总绑定数量" + totalBindAmount + "不能大于订单计划数量" + orderAmount);
throw new ServiceException("现总绑定数量为" + totalBindAmount + ",不能大于订单计划数量" + orderAmount);
}
return mesPurchaseOrderMapper.batchMesOrderBind(orderBinds);
if (toInsertedOrderBinds != null && !toInsertedOrderBinds.isEmpty()) {
mesPurchaseOrderMapper.batchMesOrderBind(toInsertedOrderBinds);
}
return 1;
}
@ -215,6 +263,7 @@ public class MesPurchaseOrderServiceImpl implements IMesPurchaseOrderService {
/**
*
*
* @param mesPurchaseOrder
* @return
*/
@ -225,6 +274,7 @@ public class MesPurchaseOrderServiceImpl implements IMesPurchaseOrderService {
/**
* List
*
* @param mesPurchaseOrder
* @return
*/
@ -236,6 +286,7 @@ public class MesPurchaseOrderServiceImpl implements IMesPurchaseOrderService {
/**
*
*
* @param purchaseOrderList
* @return
*/
@ -243,7 +294,7 @@ public class MesPurchaseOrderServiceImpl implements IMesPurchaseOrderService {
@Transactional(rollbackFor = ServiceException.class)
public int saveSalesBindPurchase(List<MesPurchaseOrder> purchaseOrderList) {
Long saleOrderId = purchaseOrderList.get(0).getSaleOrderId();
if (StringUtils.isNull(saleOrderId)){
if (StringUtils.isNull(saleOrderId)) {
return 0;
}
//校验数据
@ -262,7 +313,7 @@ public class MesPurchaseOrderServiceImpl implements IMesPurchaseOrderService {
selectOrderBind.setSaleOrderId(saleOrderId);
selectOrderBind.setPurchaseOrderId(purchaseOrderId);
List<MesOrderBind> bindList = mesOrderBindMapper.selectMesOrderBindList(selectOrderBind);
if (bindList.size() == 0){
if (bindList.size() == 0) {
MesOrderBind orderBind = new MesOrderBind();
MesPurchaseOrder mesPurchaseOrder = mesPurchaseOrderMapper.selectMesPurchaseOrderByPurchaseOrderId(purchaseOrderId);
Long materialId = mesPurchaseOrder.getMaterialId();
@ -329,7 +380,7 @@ public class MesPurchaseOrderServiceImpl implements IMesPurchaseOrderService {
selectOrderBind.setSaleOrderId(saleOrderId);
selectOrderBind.setPurchaseOrderId(purchaseOrderId);
List<MesOrderBind> bindList = mesOrderBindMapper.selectMesOrderBindList(selectOrderBind);
if (bindList.size() > 0){
if (bindList.size() > 0) {
list.add(bindList.get(0).getOrderBindId());
}
}
@ -350,4 +401,21 @@ public class MesPurchaseOrderServiceImpl implements IMesPurchaseOrderService {
}
/**
*
*
* @param orderBindIds
* @return
*/
@Override
public int deleteMesOrderBindByOrderBindIds(Long[] orderBindIds) {
for (Long orderBindId : orderBindIds) {
MesOrderBind mesOrderBind = mesOrderBindMapper.selectMesOrderBindByOrderBindId(orderBindId);
if (mesOrderBind.getBarcodeAmount() != null && mesOrderBind.getBarcodeAmount().compareTo(BigDecimal.ONE) >= 0) {
throw new ServiceException("已经生成条码数量的不能删除");
}
}
return mesOrderBindMapper.deleteMesOrderBindByOrderBindIds(orderBindIds);
}
}

@ -2,6 +2,7 @@ package com.hw.mes.service.impl;
import java.util.List;
import com.hw.common.core.utils.DateUtils;
import com.hw.common.core.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hw.mes.mapper.MesSaleOrderMapper;
@ -105,6 +106,8 @@ public class MesSaleOrderServiceImpl implements IMesSaleOrderService
@Override
public List<MesSaleOrder> selectMesSaleOrderJoinMaterialList(MesSaleOrder mesSaleOrder)
{
mesSaleOrder.setMaterialSpec(StringUtils.isNotEmpty(mesSaleOrder.getMaterialSpec())
? mesSaleOrder.getMaterialSpec().replaceAll("\\s+", "") : "");
return mesSaleOrderMapper.selectMesSaleOrderJoinMaterialList(mesSaleOrder);
}
}

@ -50,6 +50,7 @@ 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" />
</resultMap>
<resultMap id="MesPurchaseOrderMesOrderBindResult" type="MesPurchaseOrder" extends="MesPurchaseOrderResult">
@ -64,6 +65,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="productId" column="sub_product_id" />
<result property="productCode" column="sub_product_code" />
<result property="productName" column="sub_product_name" />
<result property="purchaseOrderId" column="sub_purchase_order_id" />
<result property="poNo" column="sub_po_no" />
<result property="materialId" column="sub_material_id" />
@ -75,6 +77,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="createTime" column="sub_create_time" />
<result property="updateBy" column="sub_update_by" />
<result property="updateTime" column="sub_update_time" />
<result property="productSpec" column="sub_product_spec" />
<result property="barcodeAmount" column="sub_barcode_amount" />
</resultMap>
@ -109,10 +113,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="selectMesPurchaseOrderByPurchaseOrderId" parameterType="Long" resultMap="MesPurchaseOrderMesOrderBindResult">
select a.purchase_order_id, a.erp_id, a.fentry_id, a.po_no, a.document_status, a.material_id, a.material_code, a.material_name, a.order_amount, a.complete_amount, a.approve_date, a.erp_modify_date, a.plan_delivery_date, a.begin_date, a.end_date, a.order_status, a.complete_date, a.is_flag, a.unit_id, a.stock_unit_id, a.price_unit_id, a.aux_prop_id, a.src_bill_no, a.purchase_org_id, a.tond_base, a.supplier_id, a.remark, a.create_by, a.create_time, a.update_by, a.update_time,
b.order_bind_id as sub_order_bind_id, b.safe_flag as sub_safe_flag, b.sale_order_id as sub_sale_order_id, b.sale_order_code as sub_sale_order_code, b.product_id as sub_product_id, b.product_code as sub_product_code, b.product_name as sub_product_name, b.purchase_order_id as sub_purchase_order_id, b.po_no as sub_po_no, b.material_id as sub_material_id, b.material_code as sub_material_code, b.material_name as sub_material_name, b.bind_amount as sub_bind_amount, b.remark as sub_remark, b.create_by as sub_create_by, b.create_time as sub_create_time, b.update_by as sub_update_by, b.update_time as sub_update_time
select a.purchase_order_id, a.po_no, a.document_status, a.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,
a.purchase_org_id, a.tond_base, a.supplier_id,a.create_by, a.create_time, a.update_by, a.update_time,
b.order_bind_id as sub_order_bind_id, b.safe_flag as sub_safe_flag, b.sale_order_id as sub_sale_order_id,
b.sale_order_code as sub_sale_order_code, b.product_id as sub_product_id,
mbmi.material_code as sub_product_code, mbmi.material_name as sub_product_name, mbmi.material_spec as sub_product_spec,
b.purchase_order_id as sub_purchase_order_id, b.po_no as sub_po_no,
b.material_id as sub_material_id, b.material_code as sub_material_code,
b.material_name as sub_material_name, b.bind_amount as sub_bind_amount, b.barcode_amount as sub_barcode_amount
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
where a.purchase_order_id = #{purchaseOrderId}
</select>
@ -337,4 +351,41 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
order by mpo.erp_modify_date desc,mpo.po_no ,mpo.material_name
</select>
<select id="selectMesPurchaseOrderJoinList" parameterType="MesPurchaseOrder" resultMap="MesPurchaseOrderResult">
select mpo.purchase_order_id, mpo.erp_id, mpo.fentry_id, mpo.po_no, mpo.document_status, mpo.material_id,
mpo.order_amount, mpo.complete_amount, mpo.approve_date,
mpo.erp_modify_date, mpo.plan_delivery_date, mpo.begin_date, mpo.end_date, mpo.order_status,
mpo.complete_date, mpo.specification_parameter, mpo.src_bill_no, mpo.purchase_org_id, mpo.tond_base,
mbmi.material_code,mbmi.material_name,mbmi.material_spec,mbmi.always_flag
from mes_purchase_order mpo left join mes_base_material_info mbmi on mpo.material_id =mbmi.erp_id
<where>
<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="specificationParameter != null and specificationParameter != '' ">and replace(mpo.specification_parameter,' ','') like concat('%', #{specificationParameter},
'%')</if>
<if test="orderStatus != null and orderStatus != ''"> and mpo.order_status = #{orderStatus}</if>
<if test="alwaysFlag != null and alwaysFlag != ''"> and mbmi.always_flag = #{alwaysFlag}</if>
<if test="orderAmount != null "> and mpo.order_amount = #{orderAmount}</if>
<if test="completeAmount != null "> and mpo.complete_amount = #{completeAmount}</if>
<if test="approveDate != null "> and mpo.approve_date = #{approveDate}</if>
<if test="erpModifyDate != null "> and mpo.erp_modify_date = #{erpModifyDate}</if>
<if test="planDeliveryDate != null "> and mpo.plan_delivery_date = #{planDeliveryDate}</if>
<if test="beginDate != null "> and mpo.begin_date = #{beginDate}</if>
<if test="endDate != null "> and mpo.end_date = #{endDate}</if>
<if test="completeDate != null "> and mpo.complete_date = #{completeDate}</if>
<if test="isFlag != null and isFlag != ''"> and mpo.is_flag = #{isFlag}</if>
<if test="srcBillNo != null and srcBillNo != ''"> and mpo.src_bill_no like concat('%', #{srcBillNo}, '%')</if>
<if test="tondBase != null and tondBase != ''"> and mpo.tond_base like concat('%', #{tondBase}, '%')</if>
</where>
</select>
</mapper>

@ -34,6 +34,8 @@
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="materialModel" column="material_model"/>
<result property="materialSpec" column="material_spec"/>
<result property="erpMaterialId" column="erp_material_id"/>
</resultMap>
<sql id="selectMesSaleOrderVo">
@ -225,9 +227,11 @@
select mso.sale_order_id,
mso.saleorder_code,
mso.document_status,
mso.material_id as erp_material_id,
mbmi.material_id,
mso.material_code,
mso.material_name,
mbmi.material_code,
mbmi.material_name,
mbmi.material_spec,
mso.order_amount,
mso.complete_amount,
mso.release_qty,
@ -238,11 +242,15 @@
mso.complete_date
from mes_sale_order mso left join mes_base_material_info mbmi on mso.material_id = mbmi.erp_id
<where>
<if test="saleorderCode != null and saleorderCode != ''">and mso.saleorder_code = #{saleorderCode}</if>
<if test="materialCode != null and materialCode != ''">and mso.material_code = #{materialCode}</if>
<if test="materialName != null and materialName != ''">and mso.material_name like concat('%', #{materialName},
<if test="saleorderCode != null and saleorderCode != ''">and mso.saleorder_code like concat('%', #{saleorderCode},
'%')</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>
</where>
</select>

@ -158,3 +158,12 @@ export function addRegularBarcode(data) {
data: data
})
}
// 打印原材料条码
export function reprintBarcodes(barcodeIds) {
return request({
url: '/mes/barcode/reprintBarcodes/' + barcodeIds,
method: 'get'
})
}

@ -66,6 +66,13 @@ export function bindOrder(data) {
}
// 删除绑定的采购订单信息
export function deleteOrderBind(orderBindIds) {
return request({
url: '/mes/purchaseOrder/deleteOrderBind/'+orderBindIds,
method: 'get'
})
}
// 查询采购订单信息详细,校验是否需要绑定
export function getCheckedPurchaseOrder(purchaseOrderId) {

@ -297,13 +297,13 @@ export const dynamicRoutes = [
],
},
{
path: '/mes/product-order',
path: '/mes/purchase-order',
component: Layout,
hidden: true,
permissions: ['mes:productOrder:bind'],
permissions: ['mes:purchaseOrder:bind'],
children: [
{
path: 'bind/:purchaseOrderId(\\d+)',
path: 'bind/:purchaseOrderId(\\d+)/:materialSpec',
component: () => import('@/views/mes/purchaseOrder/bindOrder'),
name: 'orderBind',
meta: { title: '订单信息绑定', activeMenu: '/mes/purchaseOrder' }

@ -1,8 +1,5 @@
<template>
<div class="app-container">
<el-form ref="form" :model="form" label-width="110px">
<el-row>
<el-col :span="12">
@ -17,8 +14,6 @@
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="物料编码" prop="materialCode">
@ -32,6 +27,19 @@
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="物料规格" prop="materialSpec">
<el-input v-model="form.materialSpec" disabled/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="规格参数" prop="specificationParameter">
<el-input v-model="form.specificationParameter" disabled/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="审核日期" prop="approveDate">
@ -50,7 +58,7 @@
<el-col :span="12">
<el-form-item label="订单状态" prop="orderStatus">
<template slot-scope="scope">
<dict-tag :options="dict.type.order_status" :value="form.orderStatus"/>
<dict-tag :options="dict.type.mes_purchase_order_status" :value="form.orderStatus"/>
</template>
</el-form-item>
</el-col>
@ -91,7 +99,8 @@
<el-table-column label="序号" align="center" prop="index" width="50"/>
<el-table-column label="安全库存标识" prop="safeFlag" width="150">
<template slot-scope="scope">
<el-radio-group v-model="scope.row.safeFlag" @input="changeSafeFlag(scope.row)">
<el-radio-group v-model="scope.row.safeFlag" @input="changeSafeFlag(scope.row)"
:disabled="scope.row.orderBindId">
<el-radio
v-for="dict in dict.type.mes_safe_flag"
:key="dict.value"
@ -104,19 +113,17 @@
<el-table-column label="销售订单" prop="saleOrderCode">
<template slot-scope="scope">
<el-input v-model="scope.row.saleOrderCode" placeholder="请点击右侧选择销售订单" readonly>
<el-button slot="append" icon="el-icon-search" @click="handleSaleOrderAdd(scope.row)"></el-button>
<el-button slot="append" icon="el-icon-search"
v-if="!scope.row.orderBindId && scope.row.safeFlag=== SAFE_FLAG.NO"
@click="handleSaleOrderAdd(scope.row)"></el-button>
</el-input>
</template>
</el-table-column>
<el-table-column label="成品编码" prop="productCode" width="150">
<template slot-scope="scope">
<el-input v-model="scope.row.productCode" readonly/>
</template>
</el-table-column>
<el-table-column label="成品名称" prop="productName" width="150">
<template slot-scope="scope">
<el-input v-model="scope.row.productName" readonly/>
</template>
</el-table-column>
<el-table-column label="成品规格" prop="productSpec" width="150">
</el-table-column>
<el-table-column label="绑定数量" prop="bindAmount" width="260">
<template slot-scope="scope">
@ -124,6 +131,8 @@
</el-input-number>
</template>
</el-table-column>
<el-table-column label="条码数量" prop="barcodeAmount" width="150">
</el-table-column>
</el-table>
</el-form>
<div slot="footer" class="dialog-footer">
@ -146,7 +155,7 @@
</template>
<script>
import {getPurchaseOrder, bindOrder} from "@/api/mes/purchaseOrder";
import {getPurchaseOrder, bindOrder, deleteOrderBind} from "@/api/mes/purchaseOrder";
import selectSaleOrder from '@//views/mes/purchaseOrder/selectSaleOrder.vue';
@ -163,6 +172,7 @@ export default {
loading: true,
//
ids: [],
indexes: [],
//
checkedMesOrderBind: [],
//
@ -226,26 +236,80 @@ export default {
],
},
saleOrderOpen: false
saleOrderOpen: false,
SAFE_FLAG: {
YES: '1',
NO: '0'
}
};
},
created() {
const purchaseOrderId = this.$route.params && this.$route.params.purchaseOrderId;
getPurchaseOrder(purchaseOrderId).then(response => {
this.form = response.data;
this.mesOrderBindList = response.data.mesOrderBindList;
});
activated() {
this.getPurchaseOrder();
},
methods: {
getPurchaseOrder() {
const purchaseOrderId = this.$route.params && this.$route.params.purchaseOrderId;
const materialSpec = this.$route.params && this.$route.params.materialSpec;
getPurchaseOrder(purchaseOrderId).then(response => {
this.form = response.data;
this.form.materialSpec = materialSpec;
this.mesOrderBindList = response.data.mesOrderBindList;
});
},
isPositiveInteger(value) {
// 使
return /^[0-9]\d*$/.test(value);
},
/** 提交按钮 */
submitForm() {
this.loading = true;
let totalBindAmount = 0;
for (let i = 0; i < this.mesOrderBindList.length; i++) {
let mob = this.mesOrderBindList[i];
let bindAmount = mob.bindAmount ? parseInt(mob.bindAmount) : 0;
let barcodeAmount = mob.barcodeAmount ? parseInt(mob.barcodeAmount) : 0;
if (!mob.safeFlag) {
this.$modal.msgError("序号为" + (i + 1) + ",请选择安全标识");
return;
}
if (mob.safeFlag === this.SAFE_FLAG.NO && !mob.saleOrderId) {
this.$modal.msgError("序号为" + (i + 1) + ",请选择销售订单");
return;
}
if (!this.isPositiveInteger(bindAmount) || bindAmount <= 0) {
this.$modal.msgError("序号为" + (i + 1) + ",绑定数量须为大于等于0的正整数");
return;
}
if (bindAmount < barcodeAmount) {
this.$modal.msgError("序号为" + (i + 1) + ",绑定数量不能小于条码数量");
return;
}
totalBindAmount = totalBindAmount + bindAmount;
}
if (totalBindAmount > this.form.orderAmount) {
this.$modal.msgError("现总绑定数量为" + totalBindAmount + ",不能大于订单计划数量" + this.form.orderAmount);
return;
}
this.form.mesOrderBindList = this.mesOrderBindList;
if (this.form.purchaseOrderId != null) {
bindOrder(this.form).then(response => {
this.$modal.msgSuccess("绑定成功");
this.close();
}).catch(error => {
this.getPurchaseOrder();
});
}
@ -266,24 +330,40 @@ export default {
obj.productCode = "";
obj.productName = "";
obj.bindAmount = "";
obj.barcodeAmount = 0;
obj.remark = "";
this.mesOrderBindList.push(obj);
},
/** 采购销售订单绑定信息;销售订单绑定采购订单明细信息删除按钮操作 */
handleDeleteMesOrderBind() {
if (this.checkedMesOrderBind.length == 0) {
if (this.checkedMesOrderBind.length === 0) {
this.$modal.msgError("请先选择要删除的采购订单绑定信息");
} else {
const mesOrderBindList = this.mesOrderBindList;
const checkedMesOrderBind = this.checkedMesOrderBind;
this.mesOrderBindList = mesOrderBindList.filter(function (item) {
return checkedMesOrderBind.indexOf(item.index) == -1
let ids = this.ids;
ids = ids.filter(item => item != null && item !== '')
this.$modal.confirm('是否确认删除序号为"' + this.indexes + '"的数据项?').then(function () {
if (ids.length > 0) {
return deleteOrderBind(ids);
}
}).then(() => {
this.$modal.msgSuccess("删除成功");
const mesOrderBindList = this.mesOrderBindList;
const checkedMesOrderBind = this.checkedMesOrderBind;
this.mesOrderBindList = mesOrderBindList.filter(function (item) {
return checkedMesOrderBind.indexOf(item.index) == -1
});
}).catch(() => {
});
}
},
/** 复选框选中数据 */
handleMesOrderBindSelectionChange(selection) {
this.checkedMesOrderBind = selection.map(item => item.index)
this.ids = selection.map(item => item.orderBindId)
this.indexes = selection.map(item => item.index)
},
@ -296,17 +376,40 @@ export default {
/** 提交选择销售订单信息按钮 */
submitSaleOrderForm() {
let selectedRow = this.$refs.saleOrderRef.selectedRow;
let filteredWithIndex = this.mesOrderBindList
.filter(item => item.saleOrderId === selectedRow.saleOrderId)
.map((item, newIndex) => ({value: item, originalIndex: this.mesOrderBindList.indexOf(item)})); //
// let sameSaleOrder = this.mesOrderBindList.filter(item => item.saleOrderId === selectedRow.saleOrderId)
if (filteredWithIndex && filteredWithIndex.length > 0) {
this.$modal.msgError("序号为" + (filteredWithIndex[0].originalIndex + 1) + "已经选择此销售订单");
return;
}
this.editedRow.saleOrderId = selectedRow.saleOrderId;
this.editedRow.saleOrderCode = selectedRow.saleorderCode;
this.editedRow.productCode = selectedRow.materialCode;
this.editedRow.productName = selectedRow.materialName;
this.editedRow.productId = selectedRow.materialId;
this.editedRow.productId = selectedRow.erpMaterialId;
this.saleOrderOpen = false;
},
changeSafeFlag(row) {
if (row.safeFlag == "1") {
if (row.safeFlag === this.SAFE_FLAG.YES) {
let filteredWithIndex = this.mesOrderBindList
.filter(item => item.safeFlag === this.SAFE_FLAG.YES && item.index!== row.index)
.map((item, newIndex) => ({value: item, originalIndex: this.mesOrderBindList.indexOf(item)})); //
// let sameSaleOrder = this.mesOrderBindList.filter(item => item.saleOrderId === selectedRow.saleOrderId)
if (filteredWithIndex && filteredWithIndex.length > 0) {
row.safeFlag = this.SAFE_FLAG.NO;
this.$modal.msgError("序号为" + (filteredWithIndex[0].originalIndex + 1) + "已经选择安全库存");
return;
}
row.saleOrderId = "";
row.saleOrderCode = "";
row.productCode = "";

@ -26,6 +26,36 @@
/>
</el-form-item>
<el-form-item label="物料规格" prop="materialSpec">
<el-input
v-model="queryParams.materialSpec"
placeholder="请输入物料规格"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="规格参数" prop="specificationParameter">
<el-input
v-model="queryParams.specificationParameter"
placeholder="请输入规格参数"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="常备物料" 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="订单状态" prop="orderStatus">
<el-select v-model="queryParams.orderStatus" placeholder="请选择订单状态" clearable>
<el-option
@ -37,22 +67,7 @@
</el-select>
</el-form-item>
<el-form-item label="源单编号" prop="srcBillNo">
<el-input
v-model="queryParams.srcBillNo"
placeholder="请输入源单编号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="京源项目" prop="tondBase">
<el-input
v-model="queryParams.tondBase"
placeholder="请输入京源项目"
clearable
@keyup.enter.native="handleQuery"
/>
</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>
@ -62,47 +77,55 @@
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="info"
type="primary"
plain
icon="el-icon-upload2"
size="mini"
@click="handleImport"
>采购申请单导入</el-button>
>采购申请单导入
</el-button>
</el-col>
</el-row>
<el-table v-loading="loading" :data="purchaseOrderList" @selection-change="handleSelectionChange">
<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="orderAmount" />
<el-table-column label="审核日期" align="center" prop="approveDate" width="180">
<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" width="200"/>
<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="orderStatus">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.approveDate, '{y}-{m}-{d}') }}</span>
<dict-tag :options="dict.type.mes_purchase_order_status" :value="scope.row.orderStatus"/>
</template>
</el-table-column>
<el-table-column label="ERP最后修改日期" align="center" prop="erpModifyDate" width="180">
<el-table-column label="订单数量" align="center" prop="orderAmount"/>
<el-table-column label="完成数量" align="center" prop="completeAmount"/>
<el-table-column label="审核日期" align="center" prop="approveDate">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.erpModifyDate, '{y}-{m}-{d}') }}</span>
<span>{{ parseTime(scope.row.approveDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="计划交货日期" align="center" prop="planDeliveryDate" width="180">
<el-table-column label="ERP最后修改日期" align="center" prop="erpModifyDate">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.planDeliveryDate, '{y}-{m}-{d}') }}</span>
<span>{{ parseTime(scope.row.erpModifyDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="订单状态" align="center" prop="orderStatus">
<el-table-column label="计划交货日期" align="center" prop="planDeliveryDate">
<template slot-scope="scope">
<dict-tag :options="dict.type.mes_purchase_order_status" :value="scope.row.orderStatus"/>
<span>{{ parseTime(scope.row.planDeliveryDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="完成日期" align="center" prop="completeDate" width="180">
<el-table-column label="完成日期" align="center" prop="completeDate">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.completeDate, '{y}-{m}-{d}') }}</span>
<span>{{ parseTime(scope.row.completeDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="源单编号" align="center" prop="srcBillNo" />
<el-table-column label="京源项目" align="center" prop="tondBase" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
@ -110,8 +133,10 @@
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['mes:purchaseOrder:edit']"
>绑定</el-button>
v-hasPermi="['mes:purchaseOrder:bind']"
v-if="scope.row.alwaysFlag === ALWAYS_FLAG.NO"
>绑定
</el-button>
</template>
</el-table-column>
</el-table>
@ -140,11 +165,11 @@
<i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处<em>点击上传</em></div>
<div class="el-upload__tip text-center" slot="tip">
<!-- <div class="el-upload__tip" slot="tip">-->
<!-- <el-checkbox v-model="upload.updateSupport" /> 是否更新已经存在的用户数据-->
<!-- </div>-->
<!-- <div class="el-upload__tip" slot="tip">-->
<!-- <el-checkbox v-model="upload.updateSupport" /> 是否更新已经存在的用户数据-->
<!-- </div>-->
<span>仅允许导入xlsxlsx格式文件</span>
<!-- <el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;" @click="importTemplate"></el-link>-->
<!-- <el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;" @click="importTemplate"></el-link>-->
</div>
</el-upload>
<div slot="footer" class="dialog-footer">
@ -156,13 +181,19 @@
</template>
<script>
import { listPurchaseOrder, getPurchaseOrder, delPurchaseOrder, addPurchaseOrder, updatePurchaseOrder } from "@/api/mes/purchaseOrder";
import {
listPurchaseOrder,
getPurchaseOrder,
delPurchaseOrder,
addPurchaseOrder,
updatePurchaseOrder
} from "@/api/mes/purchaseOrder";
import router from "@/router";
import {getToken} from "@/utils/auth";
export default {
name: "PurchaseOrder",
dicts: ['active_flag', 'mes_purchase_order_status', 'document_status','mes_safe_flag'],
dicts: ['active_flag', 'mes_purchase_order_status', 'document_status', 'mes_safe_flag','mes_material_bind_flag'],
data() {
return {
//
@ -198,6 +229,9 @@ export default {
materialId: null,
materialCode: null,
materialName: null,
materialSpec: null,
specificationParameter: null,
alwaysFlag: null,
orderAmount: null,
completeAmount: null,
approveDate: null,
@ -229,21 +263,26 @@ export default {
//
updateSupport: 0,
//
headers: { Authorization: "Bearer " + getToken() },
headers: {Authorization: "Bearer " + getToken()},
//
url: process.env.VUE_APP_BASE_API + "/mes/import/purchaseRequisitionImportData"
},
//
rules: {
materialCode: [
{ required: true, message: "物料编码;对应FMaterialId.FNumber不能为空", trigger: "blur" }
{required: true, message: "物料编码;对应FMaterialId.FNumber不能为空", trigger: "blur"}
],
orderAmount: [
{ required: true, message: "订单计划数量;对应FQty不能为空", trigger: "blur" }
{required: true, message: "订单计划数量;对应FQty不能为空", trigger: "blur"}
],
isFlag: [
{ required: true, message: "是否标识1-是0-否不能为空", trigger: "change" }
{required: true, message: "是否标识1-是0-否不能为空", trigger: "change"}
],
},
ALWAYS_FLAG: {
YES: "1",
NO: "0"
}
};
},
@ -316,7 +355,7 @@ export default {
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.purchaseOrderId)
this.single = selection.length!==1
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 导入按钮操作 */
@ -326,8 +365,7 @@ export default {
},
/** 下载模板操作 */
importTemplate() {
this.download('system/user/importTemplate', {
}, `template_${new Date().getTime()}.xlsx`)
this.download('system/user/importTemplate', {}, `template_${new Date().getTime()}.xlsx`)
},
//
handleFileUploadProgress(event, file, fileList) {
@ -338,7 +376,7 @@ export default {
this.upload.open = false;
this.upload.isUploading = false;
this.$refs.upload.clearFiles();
this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", { dangerouslyUseHTMLString: true });
this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", {dangerouslyUseHTMLString: true});
this.getList();
},
//
@ -354,9 +392,11 @@ export default {
/** 修改按钮操作 */
handleUpdate(row) {
const purchaseOrderId = row.purchaseOrderId;
const materialSpec = row.materialSpec;
const poNo = row.poNo;
const params = {queryParams: this.queryParams};
this.$tab.openPage("订单绑定[" + poNo + "]", '/mes/product-order/bind/' + purchaseOrderId, params);
const params = {queryParams: this.queryParams ,t: Date.now()};
this.$tab.openPage("订单绑定[" + poNo + "]", '/mes/purchase-order/bind/' + purchaseOrderId +'/'+materialSpec, params);
},
/** 提交按钮 */
submitForm() {
@ -382,15 +422,16 @@ export default {
/** 删除按钮操作 */
handleDelete(row) {
const purchaseOrderIds = row.purchaseOrderId || this.ids;
this.$modal.confirm('是否确认删除采购订单信息编号为"' + purchaseOrderIds + '"的数据项?').then(function() {
this.$modal.confirm('是否确认删除采购订单信息编号为"' + purchaseOrderIds + '"的数据项?').then(function () {
return delPurchaseOrder(purchaseOrderIds);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
}).catch(() => {
});
},
/** 采购销售订单绑定信息;销售订单绑定采购订单明细信息序号 */
rowMesOrderBindIndex({ row, rowIndex }) {
rowMesOrderBindIndex({row, rowIndex}) {
row.index = rowIndex + 1;
},
/** 采购销售订单绑定信息;销售订单绑定采购订单明细信息添加按钮操作 */
@ -411,7 +452,7 @@ export default {
} else {
const mesOrderBindList = this.mesOrderBindList;
const checkedMesOrderBind = this.checkedMesOrderBind;
this.mesOrderBindList = mesOrderBindList.filter(function(item) {
this.mesOrderBindList = mesOrderBindList.filter(function (item) {
return checkedMesOrderBind.indexOf(item.index) == -1
});
}
@ -428,7 +469,7 @@ export default {
},
handleSaleOrderAdd(){
handleSaleOrderAdd() {
}

@ -1,6 +1,6 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="98px">
<el-form-item label="销售订单编号" prop="saleorderCode">
<el-input
v-model="queryParams.saleorderCode"
@ -9,16 +9,6 @@
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="单据状态" prop="documentStatus">
<el-select v-model="queryParams.documentStatus" placeholder="请选择单据状态" clearable>
<el-option
v-for="dict in dict.type.document_status"
: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"
@ -35,17 +25,15 @@
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="是否已下达计划" prop="isRelease">
<el-select v-model="queryParams.isRelease" placeholder="请选择是否已下达计划" clearable>
<el-option
v-for="dict in dict.type.is_release"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
<el-form-item label="物料规格" prop="materialSpec">
<el-input
v-model="queryParams.materialSpec"
placeholder="请输入物料规格"
clearable
@keyup.enter.native="handleQuery"
/>
</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>
@ -59,14 +47,11 @@
<el-table-column label="销售订单编号" align="center" prop="saleorderCode" v-if="columns[3].visible"/>
<el-table-column label="物料编码" align="center" prop="materialCode" v-if="columns[9].visible"/>
<el-table-column label="物料名称" align="center" prop="materialName" v-if="columns[10].visible"/>
<el-table-column label="订单计划数量" align="center" prop="orderAmount" v-if="columns[12].visible"/>
<el-table-column label="物料规格" align="center" prop="materialSpec"/>
<el-table-column label="订单数量" align="center" prop="orderAmount" v-if="columns[12].visible"/>
<el-table-column label="完成数量" align="center" prop="completeAmount" v-if="columns[13].visible"/>
<el-table-column label="已发布数量" align="center" prop="releaseQty" v-if="columns[14].visible"/>
<el-table-column label="是否已下达计划" align="center" prop="isRelease" v-if="columns[15].visible" >
<template slot-scope="scope">
<dict-tag :options="dict.type.is_release" :value="scope.row.isRelease"/>
</template>
</el-table-column>
</el-table>
@ -82,7 +67,7 @@
</template>
<script>
import { getSaleOrders } from "@/api/mes/purchaseOrder";
import {getSaleOrders} from "@/api/mes/purchaseOrder";
export default {
name: "SaleOrder",
@ -121,6 +106,7 @@ export default {
materialId: null,
materialCode: null,
materialName: null,
materialSpec: null,
matkl: null,
orderAmount: null,
completeAmount: null,
@ -139,38 +125,38 @@ export default {
//
rules: {
isFlag: [
{ required: true, message: "是否标识1-是0-否不能为空", trigger: "blur" }
{required: true, message: "是否标识1-是0-否不能为空", trigger: "blur"}
],
},
columns: [
{ key: 0, label: `主键标识`, visible: true },
{ key: 1, label: `ERP主键`, visible: true },
{ key: 2, label: `ERP订单明细ID`, visible: true },
{ key: 3, label: `销售订单编号`, visible: true },
{ key: 4, label: `销售订单行号`, visible: true },
{ key: 5, label: `单据状态`, visible: true },
{ key: 6, label: `所属工厂`, visible: true },
{ key: 7, label: `所属产线`, visible: true },
{ key: 8, label: `物料ID`, visible: true },
{ key: 9, label: `物料编码`, visible: true },
{ key: 10, label: `物料名称`, visible: true },
{ key: 11, label: `物料组`, visible: true },
{ key: 12, label: `订单计划数量`, visible: true },
{ key: 13, label: `完成数量`, visible: true },
{ key: 14, label: `已发布数量`, visible: true },
{ key: 15, label: `是否已下达计划`, visible: true },
{ key: 16, label: `审核日期`, visible: true },
{ key: 17, label: `ERP最后修改日期`, visible: true },
{ key: 18, label: `计划交货日期`, visible: true },
{ key: 19, label: `计划开始日期`, visible: true },
{ key: 20, label: `计划结束日期`, visible: true },
{ key: 21, label: `完成日期`, visible: true },
{ key: 22, label: `是否标识1-是0-否`, visible: true },
{ key: 23, label: `备注`, visible: true },
{ key: 24, label: `创建人`, visible: true },
{ key: 25, label: `创建时间`, visible: true },
{ key: 26, label: `更新人`, visible: true },
{ key: 27, label: `更新时间`, visible: true },
{key: 0, label: `主键标识`, visible: true},
{key: 1, label: `ERP主键`, visible: true},
{key: 2, label: `ERP订单明细ID`, visible: true},
{key: 3, label: `销售订单编号`, visible: true},
{key: 4, label: `销售订单行号`, visible: true},
{key: 5, label: `单据状态`, visible: true},
{key: 6, label: `所属工厂`, visible: true},
{key: 7, label: `所属产线`, visible: true},
{key: 8, label: `物料ID`, visible: true},
{key: 9, label: `物料编码`, visible: true},
{key: 10, label: `物料名称`, visible: true},
{key: 11, label: `物料组`, visible: true},
{key: 12, label: `订单计划数量`, visible: true},
{key: 13, label: `完成数量`, visible: true},
{key: 14, label: `已发布数量`, visible: true},
{key: 15, label: `是否已下达计划`, visible: true},
{key: 16, label: `审核日期`, visible: true},
{key: 17, label: `ERP最后修改日期`, visible: true},
{key: 18, label: `计划交货日期`, visible: true},
{key: 19, label: `计划开始日期`, visible: true},
{key: 20, label: `计划结束日期`, visible: true},
{key: 21, label: `完成日期`, visible: true},
{key: 22, label: `是否标识1-是0-否`, visible: true},
{key: 23, label: `备注`, visible: true},
{key: 24, label: `创建人`, visible: true},
{key: 25, label: `创建时间`, visible: true},
{key: 26, label: `更新人`, visible: true},
{key: 27, label: `更新时间`, visible: true},
],
};
},

Loading…
Cancel
Save