change - 生产工单添加逻辑

master
yinq 1 year ago
parent b7f4e0a1c9
commit 0877bc0c40

@ -15,4 +15,25 @@ public class MesConstants {
public static final String MES_BARCODE_TYPE_PRODUCT = "3";//成品
public static final String MES_BARCODE_TYPE_BACKPLATE = "4";//背板
/** 工单状态0-待发布 */
public static final String UN_PUBLISH = "0";
/** 工单状态0-已发布 */
public static final String PUBLISHED = "1";
/** 工单状态2-已完成 */
public static final String FINISHED = "2";
/** 工单状态3-已开始 */
public static final String BEGIN = "3";
/** 工单状态4-暂停 */
public static final String PAUSE = "4";
/** 工单状态8-已撤回 */
public static final String RECALL = "8";
/** 工单状态9-已删除 */
public static final String DELETE = "9";
}

@ -44,6 +44,15 @@ public class Seq {
// 原材料退库记录标识
public static final String rawReturnCode = "RR";
// 工单编号序列类型
public static final String orderCodeSeqType = "ORDER_CODE";
// 工单编号序列数
private static AtomicInteger orderCodeSeq = new AtomicInteger(1);
// 工单编号记录标识
public static final String orderCodeCode = "OC";
/**
*
@ -111,8 +120,10 @@ public class Seq {
atomicInt = productOutstockSeq;
}else if (rawReturnSeqType.equals(type)) {
atomicInt = rawReturnSeq;
}else if (orderCodeSeqType.equals(type)) {
atomicInt = orderCodeSeq;
}
return getId(atomicInt, 3,code);
return getId(atomicInt, 3, code);
}

@ -103,4 +103,14 @@ public class MesMaterialBomController extends BaseController
{
return toAjax(mesMaterialBomService.deleteMesMaterialBomByMaterialBomIds(materialBomIds));
}
/**
* BOM
*/
@GetMapping(value = "/getMaterialVisionList/{materialId}")
public AjaxResult getMaterialVisionList(@PathVariable("materialId") Long materialId)
{
return success(mesMaterialBomService.getMaterialVisionList(materialId));
}
}

@ -0,0 +1,119 @@
package com.hw.mes.controller;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.hw.common.log.annotation.Log;
import com.hw.common.log.enums.BusinessType;
import com.hw.common.security.annotation.RequiresPermissions;
import com.hw.mes.domain.MesProductOrder;
import com.hw.mes.service.IMesProductOrderService;
import com.hw.common.core.web.controller.BaseController;
import com.hw.common.core.web.domain.AjaxResult;
import com.hw.common.core.utils.poi.ExcelUtil;
import com.hw.common.core.web.page.TableDataInfo;
/**
* Controller
*
* @author Yinq
* @date 2024-02-20
*/
@RestController
@RequestMapping("/productOrder")
public class MesProductOrderController extends BaseController {
@Autowired
private IMesProductOrderService mesProductOrderService;
/**
*
*/
@RequiresPermissions("mes:productOrder:list")
@GetMapping("/list")
public TableDataInfo list(MesProductOrder mesProductOrder) {
startPage();
List<MesProductOrder> list = mesProductOrderService.selectMesProductOrderList(mesProductOrder);
return getDataTable(list);
}
/**
*
*/
@RequiresPermissions("mes:productOrder:export")
@Log(title = "生产工单", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, MesProductOrder mesProductOrder) {
List<MesProductOrder> list = mesProductOrderService.selectMesProductOrderList(mesProductOrder);
ExcelUtil<MesProductOrder> util = new ExcelUtil<MesProductOrder>(MesProductOrder.class);
util.exportExcel(response, list, "生产工单数据");
}
/**
*
*/
@RequiresPermissions("mes:productOrder:query")
@GetMapping(value = "/{productOrderId}")
public AjaxResult getInfo(@PathVariable("productOrderId") Long productOrderId) {
return success(mesProductOrderService.selectMesProductOrderByProductOrderId(productOrderId));
}
/**
*
*/
@RequiresPermissions("mes:productOrder:add")
@Log(title = "生产工单", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody MesProductOrder mesProductOrder) {
return toAjax(mesProductOrderService.insertMesProductOrder(mesProductOrder));
}
/**
*
*/
@RequiresPermissions("mes:productOrder:edit")
@Log(title = "生产工单", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody MesProductOrder mesProductOrder) {
return toAjax(mesProductOrderService.updateMesProductOrder(mesProductOrder));
}
/**
*
*/
@RequiresPermissions("mes:productOrder:remove")
@Log(title = "生产工单", businessType = BusinessType.DELETE)
@DeleteMapping("/{productOrderIds}")
public AjaxResult remove(@PathVariable Long[] productOrderIds) {
return toAjax(mesProductOrderService.deleteMesProductOrderByProductOrderIds(productOrderIds));
}
/**
*
*/
@Log(title = "生产工单", businessType = BusinessType.UPDATE)
@PostMapping("/productOrderLockInventory")
public AjaxResult productOrderLockInventory(@RequestBody MesProductOrder mesProductOrder) {
return toAjax(mesProductOrderService.productOrderLockInventory(mesProductOrder));
}
/**
*
*
* @return orderCode
*/
@GetMapping(value = "/getOrderCode")
public AjaxResult getOrderCode() {
return success(mesProductOrderService.getOrderCode());
}
}

@ -75,6 +75,19 @@ public class MesMaterialBom extends TreeEntity {
@Excel(name = "物料编号")
private String materialCode;
/**
* &
*/
private String materialNameDesc;
public String getMaterialNameDesc() {
return materialNameDesc;
}
public void setMaterialNameDesc(String materialNameDesc) {
this.materialNameDesc = materialNameDesc;
}
public String getMaterialBomDesc() {
return materialBomDesc;
}

@ -0,0 +1,378 @@
package com.hw.mes.domain;
import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.hw.common.core.annotation.Excel;
import com.hw.common.core.web.domain.BaseEntity;
/**
* mes_product_order
*
* @author Yinq
* @date 2024-02-20
*/
public class MesProductOrder extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
*
*/
private Long productOrderId;
/**
*
*/
@Excel(name = "工单编号")
private String orderCode;
/**
* ID,mes_sale_orderorder_id;
*/
@Excel(name = "销售订单ID")
private Long saleOrderId;
/**
*
*/
@Excel(name = "销售订单编号")
private String saleorderCode;
/**
*
*/
@Excel(name = "销售订单行号")
private String saleorderLinenumber;
/**
*
*/
@Excel(name = "项目编号")
private String projectNo;
/**
* ID,mes_base_material_infomaterial_id;
*/
@Excel(name = "物料ID")
private Long materialId;
/**
* bomIDmes_material_bommaterial_bom_id;bom
*/
@Excel(name = "物料bomID")
private Long materialBomId;
/**
* (1线 2线)
*/
@Excel(name = "派工类型")
private String dispatchType;
/**
* ID线线线线
*/
@Excel(name = "派工ID")
private Long dispatchId;
/**
* ;
*/
@Excel(name = "销售数量")
private BigDecimal saleAmount;
/**
*
*/
@Excel(name = "计划数量")
private BigDecimal planAmount;
/**
* ;线线
*/
@Excel(name = "已派工数量")
private BigDecimal dispatchAmount;
/**
*
*/
@Excel(name = "完成数量")
private BigDecimal completeAmount;
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "发布时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date releaseTime;
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "计划开始时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date planBeginTime;
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "计划结束时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date planEndTime;
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date realBeginTime;
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "完成时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date realEndTime;
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "计划交货日期", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date planDeliveryDate;
/**
* 0-1-2-3-4-8-9-
*/
@Excel(name = "工单状态")
private String orderStatus;
/**
* 1-0-
*/
@Excel(name = "库存锁定标识")
private String stockLockFlag;
/**
* 1=;0=
*/
private String saleOrderFlag;
public Date getPlanDeliveryDate() {
return planDeliveryDate;
}
public void setPlanDeliveryDate(Date planDeliveryDate) {
this.planDeliveryDate = planDeliveryDate;
}
public String getSaleOrderFlag() {
return saleOrderFlag;
}
public void setSaleOrderFlag(String saleOrderFlag) {
this.saleOrderFlag = saleOrderFlag;
}
public void setProductOrderId(Long productOrderId) {
this.productOrderId = productOrderId;
}
public Long getProductOrderId() {
return productOrderId;
}
public void setOrderCode(String orderCode) {
this.orderCode = orderCode;
}
public String getOrderCode() {
return orderCode;
}
public void setSaleOrderId(Long saleOrderId) {
this.saleOrderId = saleOrderId;
}
public Long getSaleOrderId() {
return saleOrderId;
}
public void setSaleorderCode(String saleorderCode) {
this.saleorderCode = saleorderCode;
}
public String getSaleorderCode() {
return saleorderCode;
}
public void setSaleorderLinenumber(String saleorderLinenumber) {
this.saleorderLinenumber = saleorderLinenumber;
}
public String getSaleorderLinenumber() {
return saleorderLinenumber;
}
public void setProjectNo(String projectNo) {
this.projectNo = projectNo;
}
public String getProjectNo() {
return projectNo;
}
public void setMaterialId(Long materialId) {
this.materialId = materialId;
}
public Long getMaterialId() {
return materialId;
}
public void setMaterialBomId(Long materialBomId) {
this.materialBomId = materialBomId;
}
public Long getMaterialBomId() {
return materialBomId;
}
public void setDispatchType(String dispatchType) {
this.dispatchType = dispatchType;
}
public String getDispatchType() {
return dispatchType;
}
public void setDispatchId(Long dispatchId) {
this.dispatchId = dispatchId;
}
public Long getDispatchId() {
return dispatchId;
}
public void setSaleAmount(BigDecimal saleAmount) {
this.saleAmount = saleAmount;
}
public BigDecimal getSaleAmount() {
return saleAmount;
}
public void setPlanAmount(BigDecimal planAmount) {
this.planAmount = planAmount;
}
public BigDecimal getPlanAmount() {
return planAmount;
}
public void setDispatchAmount(BigDecimal dispatchAmount) {
this.dispatchAmount = dispatchAmount;
}
public BigDecimal getDispatchAmount() {
return dispatchAmount;
}
public void setCompleteAmount(BigDecimal completeAmount) {
this.completeAmount = completeAmount;
}
public BigDecimal getCompleteAmount() {
return completeAmount;
}
public void setReleaseTime(Date releaseTime) {
this.releaseTime = releaseTime;
}
public Date getReleaseTime() {
return releaseTime;
}
public void setPlanBeginTime(Date planBeginTime) {
this.planBeginTime = planBeginTime;
}
public Date getPlanBeginTime() {
return planBeginTime;
}
public void setPlanEndTime(Date planEndTime) {
this.planEndTime = planEndTime;
}
public Date getPlanEndTime() {
return planEndTime;
}
public void setRealBeginTime(Date realBeginTime) {
this.realBeginTime = realBeginTime;
}
public Date getRealBeginTime() {
return realBeginTime;
}
public void setRealEndTime(Date realEndTime) {
this.realEndTime = realEndTime;
}
public Date getRealEndTime() {
return realEndTime;
}
public void setOrderStatus(String orderStatus) {
this.orderStatus = orderStatus;
}
public String getOrderStatus() {
return orderStatus;
}
public void setStockLockFlag(String stockLockFlag) {
this.stockLockFlag = stockLockFlag;
}
public String getStockLockFlag() {
return stockLockFlag;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("productOrderId", getProductOrderId())
.append("orderCode", getOrderCode())
.append("saleOrderId", getSaleOrderId())
.append("saleorderCode", getSaleorderCode())
.append("saleorderLinenumber", getSaleorderLinenumber())
.append("projectNo", getProjectNo())
.append("materialId", getMaterialId())
.append("materialBomId", getMaterialBomId())
.append("dispatchType", getDispatchType())
.append("dispatchId", getDispatchId())
.append("saleAmount", getSaleAmount())
.append("planAmount", getPlanAmount())
.append("dispatchAmount", getDispatchAmount())
.append("completeAmount", getCompleteAmount())
.append("releaseTime", getReleaseTime())
.append("planBeginTime", getPlanBeginTime())
.append("planEndTime", getPlanEndTime())
.append("realBeginTime", getRealBeginTime())
.append("realEndTime", getRealEndTime())
.append("orderStatus", getOrderStatus())
.append("stockLockFlag", getStockLockFlag())
.append("remark", getRemark())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

@ -0,0 +1,61 @@
package com.hw.mes.mapper;
import java.util.List;
import com.hw.mes.domain.MesProductOrder;
/**
* Mapper
*
* @author Yinq
* @date 2024-02-20
*/
public interface MesProductOrderMapper
{
/**
*
*
* @param productOrderId
* @return
*/
public MesProductOrder selectMesProductOrderByProductOrderId(Long productOrderId);
/**
*
*
* @param mesProductOrder
* @return
*/
public List<MesProductOrder> selectMesProductOrderList(MesProductOrder mesProductOrder);
/**
*
*
* @param mesProductOrder
* @return
*/
public int insertMesProductOrder(MesProductOrder mesProductOrder);
/**
*
*
* @param mesProductOrder
* @return
*/
public int updateMesProductOrder(MesProductOrder mesProductOrder);
/**
*
*
* @param productOrderId
* @return
*/
public int deleteMesProductOrderByProductOrderId(Long productOrderId);
/**
*
*
* @param productOrderIds
* @return
*/
public int deleteMesProductOrderByProductOrderIds(Long[] productOrderIds);
}

@ -67,4 +67,11 @@ public interface IMesMaterialBomService
* @return BOM
*/
public List<MesMaterialBom> selectMesMaterialBomJoinList(MesMaterialBom mesMaterialBom);
/**
* BOM
* @param materialId
* @return
*/
public List<MesMaterialBom> getMaterialVisionList(Long materialId);
}

@ -0,0 +1,76 @@
package com.hw.mes.service;
import java.util.List;
import com.hw.mes.domain.MesProductOrder;
/**
* Service
*
* @author Yinq
* @date 2024-02-20
*/
public interface IMesProductOrderService
{
/**
*
*
* @param productOrderId
* @return
*/
public MesProductOrder selectMesProductOrderByProductOrderId(Long productOrderId);
/**
*
*
* @param mesProductOrder
* @return
*/
public List<MesProductOrder> selectMesProductOrderList(MesProductOrder mesProductOrder);
/**
*
*
* @param mesProductOrder
* @return
*/
public int insertMesProductOrder(MesProductOrder mesProductOrder);
/**
*
*
* @param mesProductOrder
* @return
*/
public int updateMesProductOrder(MesProductOrder mesProductOrder);
/**
*
*
* @param productOrderIds
* @return
*/
public int deleteMesProductOrderByProductOrderIds(Long[] productOrderIds);
/**
*
*
* @param productOrderId
* @return
*/
public int deleteMesProductOrderByProductOrderId(Long productOrderId);
/**
*
* @return orderCode
*/
public String getOrderCode();
/**
*
*
* @param mesProductOrder
* @return
*/
public int productOrderLockInventory(MesProductOrder mesProductOrder);
}

@ -115,6 +115,18 @@ public class MesMaterialBomServiceImpl implements IMesMaterialBomService
return mesMaterialBomMapper.selectMesMaterialBomJoinList(mesMaterialBom);
}
/**
* BOM
* @param materialId
* @return
*/
@Override
public List<MesMaterialBom> getMaterialVisionList(Long materialId) {
MesMaterialBom materialBom = new MesMaterialBom();
materialBom.setMaterialId(materialId);
return mesMaterialBomMapper.selectMesMaterialBomList(materialBom);
}
/**
* BOM
* @param mesMaterialBom

@ -0,0 +1,159 @@
package com.hw.mes.service.impl;
import java.math.BigDecimal;
import java.util.List;
import com.hw.common.core.constant.MesConstants;
import com.hw.common.core.exception.ServiceException;
import com.hw.common.core.utils.DateUtils;
import com.hw.common.core.utils.StringUtils;
import com.hw.common.core.utils.uuid.Seq;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hw.mes.mapper.MesProductOrderMapper;
import com.hw.mes.domain.MesProductOrder;
import com.hw.mes.service.IMesProductOrderService;
/**
* Service
*
* @author Yinq
* @date 2024-02-20
*/
@Service
public class MesProductOrderServiceImpl implements IMesProductOrderService {
@Autowired
private MesProductOrderMapper mesProductOrderMapper;
/**
*
*
* @param productOrderId
* @return
*/
@Override
public MesProductOrder selectMesProductOrderByProductOrderId(Long productOrderId) {
return mesProductOrderMapper.selectMesProductOrderByProductOrderId(productOrderId);
}
/**
*
*
* @param mesProductOrder
* @return
*/
@Override
public List<MesProductOrder> selectMesProductOrderList(MesProductOrder mesProductOrder) {
return mesProductOrderMapper.selectMesProductOrderList(mesProductOrder);
}
/**
*
*
* @param mesProductOrder
* @return
*/
@Override
public int insertMesProductOrder(MesProductOrder mesProductOrder) {
mesProductOrder.setCreateTime(DateUtils.getNowDate());
//校验是否超出销售数量
if (mesProductOrder.getSaleOrderFlag().equals("1") && StringUtils.isNotNull(mesProductOrder.getSaleOrderId())) {
checkSalesQuantity(mesProductOrder);
}
return mesProductOrderMapper.insertMesProductOrder(mesProductOrder);
}
/**
*
*
* @param mesProductOrder
* @return
*/
@Override
public int updateMesProductOrder(MesProductOrder mesProductOrder) {
mesProductOrder.setUpdateTime(DateUtils.getNowDate());
return mesProductOrderMapper.updateMesProductOrder(mesProductOrder);
}
/**
*
*
* @param productOrderIds
* @return
*/
@Override
public int deleteMesProductOrderByProductOrderIds(Long[] productOrderIds) {
for (Long productOrderId : productOrderIds) {
MesProductOrder mesProductOrder = new MesProductOrder();
mesProductOrder.setProductOrderId(productOrderId);
mesProductOrder.setOrderStatus(MesConstants.DELETE);
mesProductOrderMapper.updateMesProductOrder(mesProductOrder);
}
return 1;
}
/**
*
*
* @param productOrderId
* @return
*/
@Override
public int deleteMesProductOrderByProductOrderId(Long productOrderId) {
MesProductOrder mesProductOrder = new MesProductOrder();
mesProductOrder.setProductOrderId(productOrderId);
mesProductOrder.setOrderStatus(MesConstants.DELETE);
return mesProductOrderMapper.updateMesProductOrder(mesProductOrder);
}
/**
*
*
* @return orderCode
*/
@Override
public String getOrderCode() {
return Seq.getId(Seq.orderCodeSeqType, Seq.orderCodeCode);
}
/**
*
*
* @param mesProductOrder
*/
private void checkSalesQuantity(MesProductOrder mesProductOrder) {
if (StringUtils.isNull(mesProductOrder.getPlanAmount()) || StringUtils.isNull(mesProductOrder.getSaleAmount())) {
return;
}
MesProductOrder productOrder = new MesProductOrder();
mesProductOrder.setSaleOrderId(mesProductOrder.getSaleOrderId());
List<MesProductOrder> mesProductOrders = mesProductOrderMapper.selectMesProductOrderList(productOrder);
BigDecimal sumDecimal = new BigDecimal(0);
if (StringUtils.isNotNull(mesProductOrders)) {
for (MesProductOrder order : mesProductOrders) {
sumDecimal = sumDecimal.add(order.getPlanAmount());
}
}
sumDecimal = sumDecimal.add(mesProductOrder.getPlanAmount());
if (mesProductOrder.getSaleAmount().compareTo(sumDecimal) < 0) {
throw new ServiceException("当前工单计划数量为:" + sumDecimal.longValue() + ",超出该订单销售数量!");
}
}
/**
*
*
* @param mesProductOrder
* @return
*/
@Override
public int productOrderLockInventory(MesProductOrder mesProductOrder) {
MesProductOrder productOrder = mesProductOrderMapper.selectMesProductOrderByProductOrderId(mesProductOrder.getProductOrderId());
if (productOrder.getStockLockFlag().equals("1")) {
throw new ServiceException("该工单库存已锁定!");
}
mesProductOrder.setUpdateTime(DateUtils.getNowDate());
return mesProductOrderMapper.updateMesProductOrder(mesProductOrder);
}
}

@ -22,6 +22,7 @@
<result property="updateTime" column="update_time"/>
<result property="materialCode" column="material_code"/>
<result property="materialBomDesc" column="material_bom_desc"/>
<result property="materialNameDesc" column="materialNameDesc"/>
</resultMap>
<sql id="selectMesMaterialBomVo">
@ -40,7 +41,8 @@
create_by,
create_time,
update_by,
update_time
update_time,
CONCAT(material_name, '-', material_bom_desc) materialNameDesc
from mes_material_bom
</sql>
@ -60,6 +62,7 @@
<if test="projectId != null ">and project_id = #{projectId}</if>
<if test="activeFlag != null and activeFlag != ''">and active_flag = #{activeFlag}</if>
</where>
order by material_id, create_time desc
</select>
<select id="selectMesMaterialBomByMaterialBomId" parameterType="Long" resultMap="MesMaterialBomResult">

@ -0,0 +1,217 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hw.mes.mapper.MesProductOrderMapper">
<resultMap type="MesProductOrder" id="MesProductOrderResult">
<result property="productOrderId" column="product_order_id"/>
<result property="orderCode" column="order_code"/>
<result property="saleOrderId" column="sale_order_id"/>
<result property="saleorderCode" column="saleorder_code"/>
<result property="saleorderLinenumber" column="saleorder_linenumber"/>
<result property="projectNo" column="project_no"/>
<result property="materialId" column="material_id"/>
<result property="materialBomId" column="material_bom_id"/>
<result property="dispatchType" column="dispatch_type"/>
<result property="dispatchId" column="dispatch_id"/>
<result property="saleAmount" column="sale_amount"/>
<result property="planAmount" column="plan_amount"/>
<result property="dispatchAmount" column="dispatch_amount"/>
<result property="completeAmount" column="complete_amount"/>
<result property="releaseTime" column="release_time"/>
<result property="planBeginTime" column="plan_begin_time"/>
<result property="planEndTime" column="plan_end_time"/>
<result property="realBeginTime" column="real_begin_time"/>
<result property="realEndTime" column="real_end_time"/>
<result property="orderStatus" column="order_status"/>
<result property="stockLockFlag" column="stock_lock_flag"/>
<result property="remark" column="remark"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="saleOrderFlag" column="sale_order_flag"/>
<result property="planDeliveryDate" column="plan_delivery_date"/>
</resultMap>
<sql id="selectMesProductOrderVo">
select product_order_id,
order_code,
sale_order_id,
saleorder_code,
saleorder_linenumber,
project_no,
material_id,
material_bom_id,
dispatch_type,
dispatch_id,
sale_amount,
plan_amount,
dispatch_amount,
complete_amount,
release_time,
plan_begin_time,
plan_end_time,
real_begin_time,
real_end_time,
order_status,
stock_lock_flag,
sale_order_flag,
plan_delivery_date,
remark,
create_by,
create_time,
update_by,
update_time
from mes_product_order
</sql>
<select id="selectMesProductOrderList" parameterType="MesProductOrder" resultMap="MesProductOrderResult">
<include refid="selectMesProductOrderVo"/>
<where>
<if test="orderCode != null and orderCode != ''">and order_code = #{orderCode}</if>
<if test="saleOrderId != null ">and sale_order_id = #{saleOrderId}</if>
<if test="saleorderCode != null and saleorderCode != ''">and saleorder_code = #{saleorderCode}</if>
<if test="saleorderLinenumber != null and saleorderLinenumber != ''">and saleorder_linenumber =
#{saleorderLinenumber}
</if>
<if test="projectNo != null and projectNo != ''">and project_no = #{projectNo}</if>
<if test="materialId != null ">and material_id = #{materialId}</if>
<if test="materialBomId != null ">and material_bom_id = #{materialBomId}</if>
<if test="dispatchType != null and dispatchType != ''">and dispatch_type = #{dispatchType}</if>
<if test="dispatchId != null ">and dispatch_id = #{dispatchId}</if>
<if test="saleAmount != null ">and sale_amount = #{saleAmount}</if>
<if test="planAmount != null ">and plan_amount = #{planAmount}</if>
<if test="dispatchAmount != null ">and dispatch_amount = #{dispatchAmount}</if>
<if test="completeAmount != null ">and complete_amount = #{completeAmount}</if>
<if test="releaseTime != null ">and release_time = #{releaseTime}</if>
<if test="planBeginTime != null ">and plan_begin_time = #{planBeginTime}</if>
<if test="planEndTime != null ">and plan_end_time = #{planEndTime}</if>
<if test="realBeginTime != null ">and real_begin_time = #{realBeginTime}</if>
<if test="realEndTime != null ">and real_end_time = #{realEndTime}</if>
<if test="orderStatus != null and orderStatus != ''">and order_status = #{orderStatus}</if>
<if test="stockLockFlag != null and stockLockFlag != ''">and stock_lock_flag = #{stockLockFlag}</if>
<if test="saleOrderFlag != null and saleOrderFlag != ''">and sale_order_flag = #{saleOrderFlag}</if>
<if test="createBy != null and createBy != ''">and create_by = #{createBy}</if>
<if test="createTime != null ">and create_time = #{createTime}</if>
<if test="updateBy != null and updateBy != ''">and update_by = #{updateBy}</if>
<if test="updateTime != null ">and update_time = #{updateTime}</if>
</where>
</select>
<select id="selectMesProductOrderByProductOrderId" parameterType="Long" resultMap="MesProductOrderResult">
<include refid="selectMesProductOrderVo"/>
where product_order_id = #{productOrderId}
</select>
<insert id="insertMesProductOrder" parameterType="MesProductOrder" useGeneratedKeys="true"
keyProperty="productOrderId">
insert into mes_product_order
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="orderCode != null and orderCode != ''">order_code,</if>
<if test="saleOrderId != null">sale_order_id,</if>
<if test="saleorderCode != null and saleorderCode != ''">saleorder_code,</if>
<if test="saleorderLinenumber != null">saleorder_linenumber,</if>
<if test="projectNo != null">project_no,</if>
<if test="materialId != null">material_id,</if>
<if test="materialBomId != null">material_bom_id,</if>
<if test="dispatchType != null and dispatchType != ''">dispatch_type,</if>
<if test="dispatchId != null">dispatch_id,</if>
<if test="saleAmount != null">sale_amount,</if>
<if test="planAmount != null">plan_amount,</if>
<if test="dispatchAmount != null">dispatch_amount,</if>
<if test="completeAmount != null">complete_amount,</if>
<if test="releaseTime != null">release_time,</if>
<if test="planBeginTime != null">plan_begin_time,</if>
<if test="planEndTime != null">plan_end_time,</if>
<if test="realBeginTime != null">real_begin_time,</if>
<if test="realEndTime != null">real_end_time,</if>
<if test="orderStatus != null and orderStatus != ''">order_status,</if>
<if test="stockLockFlag != null and stockLockFlag != ''">stock_lock_flag,</if>
<if test="saleOrderFlag != null and saleOrderFlag != ''">sale_order_flag,</if>
<if test="remark != null">remark,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="planDeliveryDate != null">plan_delivery_date,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="orderCode != null and orderCode != ''">#{orderCode},</if>
<if test="saleOrderId != null">#{saleOrderId},</if>
<if test="saleorderCode != null and saleorderCode != ''">#{saleorderCode},</if>
<if test="saleorderLinenumber != null">#{saleorderLinenumber},</if>
<if test="projectNo != null">#{projectNo},</if>
<if test="materialId != null">#{materialId},</if>
<if test="materialBomId != null">#{materialBomId},</if>
<if test="dispatchType != null and dispatchType != ''">#{dispatchType},</if>
<if test="dispatchId != null">#{dispatchId},</if>
<if test="saleAmount != null">#{saleAmount},</if>
<if test="planAmount != null">#{planAmount},</if>
<if test="dispatchAmount != null">#{dispatchAmount},</if>
<if test="completeAmount != null">#{completeAmount},</if>
<if test="releaseTime != null">#{releaseTime},</if>
<if test="planBeginTime != null">#{planBeginTime},</if>
<if test="planEndTime != null">#{planEndTime},</if>
<if test="realBeginTime != null">#{realBeginTime},</if>
<if test="realEndTime != null">#{realEndTime},</if>
<if test="orderStatus != null and orderStatus != ''">#{orderStatus},</if>
<if test="stockLockFlag != null and stockLockFlag != ''">#{stockLockFlag},</if>
<if test="saleOrderFlag != null and saleOrderFlag != ''">#{saleOrderFlag},</if>
<if test="remark != null">#{remark},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="planDeliveryDate != null">#{planDeliveryDate},</if>
</trim>
</insert>
<update id="updateMesProductOrder" parameterType="MesProductOrder">
update mes_product_order
<trim prefix="SET" suffixOverrides=",">
<if test="orderCode != null and orderCode != ''">order_code = #{orderCode},</if>
<if test="saleOrderId != null">sale_order_id = #{saleOrderId},</if>
<if test="saleorderCode != null and saleorderCode != ''">saleorder_code = #{saleorderCode},</if>
<if test="saleorderLinenumber != null">saleorder_linenumber = #{saleorderLinenumber},</if>
<if test="projectNo != null">project_no = #{projectNo},</if>
<if test="materialId != null">material_id = #{materialId},</if>
<if test="materialBomId != null">material_bom_id = #{materialBomId},</if>
<if test="dispatchType != null and dispatchType != ''">dispatch_type = #{dispatchType},</if>
<if test="dispatchId != null">dispatch_id = #{dispatchId},</if>
<if test="saleAmount != null">sale_amount = #{saleAmount},</if>
<if test="planAmount != null">plan_amount = #{planAmount},</if>
<if test="dispatchAmount != null">dispatch_amount = #{dispatchAmount},</if>
<if test="completeAmount != null">complete_amount = #{completeAmount},</if>
<if test="releaseTime != null">release_time = #{releaseTime},</if>
<if test="planBeginTime != null">plan_begin_time = #{planBeginTime},</if>
<if test="planEndTime != null">plan_end_time = #{planEndTime},</if>
<if test="realBeginTime != null">real_begin_time = #{realBeginTime},</if>
<if test="realEndTime != null">real_end_time = #{realEndTime},</if>
<if test="orderStatus != null and orderStatus != ''">order_status = #{orderStatus},</if>
<if test="stockLockFlag != null and stockLockFlag != ''">stock_lock_flag = #{stockLockFlag},</if>
<if test="saleOrderFlag != null and saleOrderFlag != ''">sale_order_flag = #{saleOrderFlag},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="planDeliveryDate != null">plan_delivery_date = #{planDeliveryDate},</if>
</trim>
where product_order_id = #{productOrderId}
</update>
<delete id="deleteMesProductOrderByProductOrderId" parameterType="Long">
delete
from mes_product_order
where product_order_id = #{productOrderId}
</delete>
<delete id="deleteMesProductOrderByProductOrderIds" parameterType="String">
delete from mes_product_order where product_order_id in
<foreach item="productOrderId" collection="array" open="(" separator="," close=")">
#{productOrderId}
</foreach>
</delete>
</mapper>

@ -17,6 +17,14 @@ export function getMaterialBom(materialBomId) {
})
}
// 查询物料BOM版本列表
export function getMaterialVisionList(materialId) {
return request({
url: '/mes/materialBom/getMaterialVisionList/' + materialId,
method: 'get'
})
}
// 新增物料BOM信息
export function addMaterialBom(data) {
return request({

@ -0,0 +1,61 @@
import request from '@/utils/request'
// 查询生产工单列表
export function listProductOrder(query) {
return request({
url: '/mes/productOrder/list',
method: 'get',
params: query
})
}
// 查询生产工单详细
export function getProductOrder(productOrderId) {
return request({
url: '/mes/productOrder/' + productOrderId,
method: 'get'
})
}
// 获取工单编号
export function getOrderCode() {
return request({
url: '/mes/productOrder/getOrderCode',
method: 'get'
})
}
// 新增生产工单
export function addProductOrder(data) {
return request({
url: '/mes/productOrder',
method: 'post',
data: data
})
}
// 修改生产工单
export function updateProductOrder(data) {
return request({
url: '/mes/productOrder',
method: 'put',
data: data
})
}
//锁库存
export function productOrderLockInventory(data) {
return request({
url: '/mes/productOrder/productOrderLockInventory',
method: 'post',
data: data
})
}
// 删除生产工单
export function delProductOrder(productOrderId) {
return request({
url: '/mes/productOrder/' + productOrderId,
method: 'delete'
})
}

@ -0,0 +1,525 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
<el-form-item label="销售订单编号" prop="saleorderCode">
<el-input
v-model="queryParams.saleorderCode"
placeholder="请输入销售订单编号"
clearable
@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="factoryId">-->
<!-- <el-input-->
<!-- v-model="queryParams.factoryId"-->
<!-- placeholder="请输入所属工厂"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="所属产线" prop="prodlineId">-->
<!-- <el-input-->
<!-- v-model="queryParams.prodlineId"-->
<!-- placeholder="请输入所属产线"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<el-form-item label="物料编码" prop="materialCode">
<el-input
v-model="queryParams.materialCode"
placeholder="请输入物料编码"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="物料名称" prop="materialName">
<el-input
v-model="queryParams.materialName"
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>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="primary"-->
<!-- plain-->
<!-- icon="el-icon-plus"-->
<!-- size="mini"-->
<!-- @click="handleAdd"-->
<!-- v-hasPermi="['mes:saleOrder:add']"-->
<!-- >新增</el-button>-->
<!-- </el-col>-->
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="success"-->
<!-- plain-->
<!-- icon="el-icon-edit"-->
<!-- size="mini"-->
<!-- :disabled="single"-->
<!-- @click="handleUpdate"-->
<!-- v-hasPermi="['mes:saleOrder:edit']"-->
<!-- >修改</el-button>-->
<!-- </el-col>-->
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="danger"-->
<!-- plain-->
<!-- icon="el-icon-delete"-->
<!-- size="mini"-->
<!-- :disabled="multiple"-->
<!-- @click="handleDelete"-->
<!-- v-hasPermi="['mes:saleOrder:remove']"-->
<!-- >删除</el-button>-->
<!-- </el-col>-->
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="warning"-->
<!-- plain-->
<!-- icon="el-icon-download"-->
<!-- size="mini"-->
<!-- @click="handleExport"-->
<!-- v-hasPermi="['mes:saleOrder:export']"-->
<!-- >导出</el-button>-->
<!-- </el-col>-->
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="saleOrderList" @selection-change="handleSelectionChange"
@row-click="handleRowClick"
highlight-current-row
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="主键标识" align="center" prop="saleOrderId" v-if="columns[0].visible"/>
<el-table-column label="ERP主键" align="center" prop="erpId" v-if="columns[1].visible"/>
<el-table-column label="ERP订单明细ID" align="center" prop="fentryId" v-if="columns[2].visible"/>
<el-table-column label="销售订单编号" align="center" prop="saleorderCode" width="100" v-if="columns[3].visible"/>
<el-table-column label="销售订单行号" align="center" prop="saleorderLinenumber" width="110" v-if="columns[4].visible"/>
<el-table-column label="单据状态" align="center" prop="documentStatus" v-if="columns[5].visible" >
<template slot-scope="scope">
<dict-tag :options="dict.type.document_status" :value="scope.row.documentStatus"/>
</template>
</el-table-column>
<el-table-column label="所属工厂" align="center" prop="factoryId" v-if="columns[6].visible"/>
<el-table-column label="所属产线" align="center" prop="prodlineId" v-if="columns[7].visible"/>
<el-table-column label="物料ID" align="center" prop="materialId" v-if="columns[8].visible"/>
<el-table-column label="物料编码" align="center" prop="materialCode" width="100" v-if="columns[9].visible"/>
<el-table-column label="物料名称" align="center" prop="materialName" width="100" v-if="columns[10].visible"/>
<el-table-column label="物料组" align="center" prop="matkl" v-if="columns[11].visible"/>
<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-column label="审核日期" align="center" prop="approveDate" width="180" v-if="columns[16].visible">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.approveDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="ERP最后修改日期" align="center" prop="erpModifyDate" width="180" v-if="columns[17].visible">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.erpModifyDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="计划交货日期" align="center" prop="planDeliveryDate" width="180" v-if="columns[18].visible">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.planDeliveryDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="计划开始日期" align="center" prop="beginDate" width="180" v-if="columns[19].visible">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.beginDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="计划结束日期" align="center" prop="endDate" width="180" v-if="columns[20].visible">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.endDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="完成日期" align="center" prop="completeDate" width="180" v-if="columns[21].visible">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.completeDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="是否标识" align="center" prop="isFlag" v-if="columns[22].visible" >
<template slot-scope="scope">
<dict-tag :options="dict.type.active_flag" :value="scope.row.isFlag"/>
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" v-if="columns[23].visible"/>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改销售订单信息对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="ERP主键" prop="erpId">
<el-input v-model="form.erpId" placeholder="请输入ERP主键" />
</el-form-item>
<el-form-item label="ERP订单明细ID" prop="fentryId">
<el-input v-model="form.fentryId" placeholder="请输入ERP订单明细ID" />
</el-form-item>
<el-form-item label="销售订单编号" prop="saleorderCode">
<el-input v-model="form.saleorderCode" placeholder="请输入销售订单编号" />
</el-form-item>
<el-form-item label="销售订单行号" prop="saleorderLinenumber">
<el-input v-model="form.saleorderLinenumber" placeholder="请输入销售订单行号" />
</el-form-item>
<el-form-item label="单据状态" prop="documentStatus">
<el-select v-model="form.documentStatus" placeholder="请选择单据状态">
<el-option
v-for="dict in dict.type.document_status"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="所属工厂" prop="factoryId">
<el-input v-model="form.factoryId" placeholder="请输入所属工厂" />
</el-form-item>
<el-form-item label="所属产线" prop="prodlineId">
<el-input v-model="form.prodlineId" placeholder="请输入所属产线" />
</el-form-item>
<el-form-item label="物料ID" prop="materialId">
<el-input v-model="form.materialId" placeholder="请输入物料ID" />
</el-form-item>
<el-form-item label="物料编码" prop="materialCode">
<el-input v-model="form.materialCode" placeholder="请输入物料编码" />
</el-form-item>
<el-form-item label="物料名称" prop="materialName">
<el-input v-model="form.materialName" placeholder="请输入物料名称" />
</el-form-item>
<el-form-item label="物料组" prop="matkl">
<el-input v-model="form.matkl" placeholder="请输入物料组" />
</el-form-item>
<el-form-item label="订单计划数量" prop="orderAmount">
<el-input v-model="form.orderAmount" placeholder="请输入订单计划数量" />
</el-form-item>
<el-form-item label="完成数量" prop="completeAmount">
<el-input v-model="form.completeAmount" placeholder="请输入完成数量" />
</el-form-item>
<el-form-item label="已发布数量" prop="releaseQty">
<el-input v-model="form.releaseQty" placeholder="请输入已发布数量" />
</el-form-item>
<el-form-item label="是否已下达计划" prop="isRelease">
<el-radio-group v-model="form.isRelease">
<el-radio
v-for="dict in dict.type.is_release"
:key="dict.value"
:label="dict.value"
>{{dict.label}}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="审核日期" prop="approveDate">
<el-date-picker clearable
v-model="form.approveDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择审核日期">
</el-date-picker>
</el-form-item>
<el-form-item label="ERP最后修改日期" prop="erpModifyDate">
<el-date-picker clearable
v-model="form.erpModifyDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择ERP最后修改日期">
</el-date-picker>
</el-form-item>
<el-form-item label="计划交货日期" prop="planDeliveryDate">
<el-date-picker clearable
v-model="form.planDeliveryDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择计划交货日期">
</el-date-picker>
</el-form-item>
<el-form-item label="计划开始日期" prop="beginDate">
<el-date-picker clearable
v-model="form.beginDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择计划开始日期">
</el-date-picker>
</el-form-item>
<el-form-item label="计划结束日期" prop="endDate">
<el-date-picker clearable
v-model="form.endDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择计划结束日期">
</el-date-picker>
</el-form-item>
<el-form-item label="完成日期" prop="completeDate">
<el-date-picker clearable
v-model="form.completeDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择完成日期">
</el-date-picker>
</el-form-item>
<el-form-item label="是否标识" prop="isFlag">
<el-input v-model="form.isFlag" placeholder="请输入是否标识" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listSaleOrder, getSaleOrder, delSaleOrder, addSaleOrder, updateSaleOrder } from "@/api/mes/saleOrder";
export default {
name: "SaleOrder",
dicts: ['document_status', 'is_release', 'active_flag'],
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
saleOrderList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
erpId: null,
fentryId: null,
saleorderCode: null,
saleorderLinenumber: null,
documentStatus: null,
factoryId: null,
prodlineId: null,
materialId: null,
materialCode: null,
materialName: null,
matkl: null,
orderAmount: null,
completeAmount: null,
releaseQty: null,
isRelease: null,
approveDate: null,
erpModifyDate: null,
planDeliveryDate: null,
beginDate: null,
endDate: null,
completeDate: null,
isFlag: null,
},
//
form: {},
//
rules: {
isFlag: [
{ required: true, message: "是否标识不能为空", trigger: "blur" }
],
},
columns: [
{ key: 0, label: `主键标识`, visible: false },
{ key: 1, label: `ERP主键`, visible: false },
{ key: 2, label: `ERP订单明细ID`, visible: false },
{ key: 3, label: `销售订单编号`, visible: true },
{ key: 4, label: `销售订单行号`, visible: true },
{ key: 5, label: `单据状态`, visible: false },
{ key: 6, label: `所属工厂`, visible: false },
{ key: 7, label: `所属产线`, visible: false },
{ key: 8, label: `物料ID`, visible: false },
{ key: 9, label: `物料编码`, visible: true },
{ key: 10, label: `物料名称`, visible: true },
{ key: 11, label: `物料组`, visible: false },
{ key: 12, label: `订单计划数量`, visible: true },
{ key: 13, label: `完成数量`, visible: false },
{ key: 14, label: `已发布数量`, visible: false },
{ key: 15, label: `是否已下达计划`, visible: false },
{ key: 16, label: `审核日期`, visible: false },
{ key: 17, label: `ERP最后修改日期`, visible: false },
{ key: 18, label: `计划交货日期`, visible: true },
{ key: 19, label: `计划开始日期`, visible: true },
{ key: 20, label: `计划结束日期`, visible: true },
{ key: 21, label: `完成日期`, visible: true },
{ key: 22, label: `是否标识`, visible: true },
{ key: 23, label: `备注`, visible: false },
{ key: 24, label: `创建人`, visible: false },
{ key: 25, label: `创建时间`, visible: false },
{ key: 26, label: `更新人`, visible: false },
{ key: 27, label: `更新时间`, visible: false },
],
};
},
created() {
this.getList();
},
methods: {
/** 查询销售订单信息列表 */
getList() {
this.loading = true;
listSaleOrder(this.queryParams).then(response => {
this.saleOrderList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
saleOrderId: null,
erpId: null,
fentryId: null,
saleorderCode: null,
saleorderLinenumber: null,
documentStatus: null,
factoryId: null,
prodlineId: null,
materialId: null,
materialCode: null,
materialName: null,
matkl: null,
orderAmount: null,
completeAmount: null,
releaseQty: null,
isRelease: null,
approveDate: null,
erpModifyDate: null,
planDeliveryDate: null,
beginDate: null,
endDate: null,
completeDate: null,
isFlag: null,
remark: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.saleOrderId)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加销售订单信息";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const saleOrderId = row.saleOrderId || this.ids
getSaleOrder(saleOrderId).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改销售订单信息";
});
},
//
handleRowClick(row) {
this.selectedRow = row
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.saleOrderId != null) {
updateSaleOrder(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addSaleOrder(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const saleOrderIds = row.saleOrderId || this.ids;
this.$modal.confirm('是否确认删除销售订单信息编号为"' + saleOrderIds + '"的数据项?').then(function() {
return delSaleOrder(saleOrderIds);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('mes/saleOrder/export', {
...this.queryParams
}, `saleOrder_${new Date().getTime()}.xlsx`)
}
}
};
</script>

@ -0,0 +1,673 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="工单编号" prop="orderCode">
<el-input
v-model="queryParams.orderCode"
placeholder="请输入工单编号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="销售订单编号" prop="saleorderCode">
<el-input
v-model="queryParams.saleorderCode"
placeholder="请输入销售订单编号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="物料ID" prop="materialId">
<el-input
v-model="queryParams.materialId"
placeholder="请输入物料ID"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="派工类型" prop="dispatchType">
<el-select v-model="queryParams.dispatchType" placeholder="请选择派工类型" clearable>
<el-option
v-for="dict in dict.type.dispatch_type"
: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
v-for="dict in dict.type.plan_status"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<!-- <el-form-item label="库存锁定标识" prop="stockLockFlag">-->
<!-- <el-select v-model="queryParams.stockLockFlag" placeholder="请选择库存锁定标识" clearable>-->
<!-- <el-option-->
<!-- v-for="dict in dict.type.active_flag"-->
<!-- :key="dict.value"-->
<!-- :label="dict.label"-->
<!-- :value="dict.value"-->
<!-- />-->
<!-- </el-select>-->
<!-- </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>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['mes:productOrder:add']"
>销售订单新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleNoOrderAdd"
v-hasPermi="['mes:productOrder:add']"
>无订单新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['mes:productOrder:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['mes:productOrder:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['mes:productOrder:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="productOrderList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="主键标识" align="center" prop="productOrderId" v-if="columns[0].visible"/>
<el-table-column label="工单编号" align="center" prop="orderCode" v-if="columns[1].visible"/>
<el-table-column label="销售订单ID" align="center" prop="saleOrderId" 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="saleorderLinenumber" v-if="columns[4].visible"/>
<el-table-column label="项目编号" align="center" prop="projectNo" v-if="columns[5].visible"/>
<el-table-column label="物料ID" align="center" prop="materialId" v-if="columns[6].visible"/>
<el-table-column label="物料bomID" align="center" prop="materialBomId" v-if="columns[7].visible"/>
<el-table-column label="派工类型" align="center" prop="dispatchType" v-if="columns[8].visible" >
<template slot-scope="scope">
<dict-tag :options="dict.type.dispatch_type" :value="scope.row.dispatchType"/>
</template>
</el-table-column>
<el-table-column label="派工ID" align="center" prop="dispatchId" v-if="columns[9].visible"/>
<el-table-column label="销售数量" align="center" prop="saleAmount" v-if="columns[10].visible"/>
<el-table-column label="计划数量" align="center" prop="planAmount" v-if="columns[11].visible"/>
<el-table-column label="已派工数量" align="center" prop="dispatchAmount" 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="releaseTime" width="180" v-if="columns[14].visible">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.releaseTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="计划交货日期" align="center" prop="planDeliveryDate" width="180" v-if="columns[26].visible">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="计划开始时间" align="center" prop="planBeginTime" width="180" v-if="columns[15].visible">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.planBeginTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="计划结束时间" align="center" prop="planEndTime" width="180" v-if="columns[16].visible">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.planEndTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="开始时间" align="center" prop="realBeginTime" width="180" v-if="columns[17].visible">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.realBeginTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="完成时间" align="center" prop="realEndTime" width="180" v-if="columns[18].visible">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.realEndTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="工单状态" align="center" prop="orderStatus" v-if="columns[19].visible" >
<template slot-scope="scope">
<dict-tag :options="dict.type.plan_status" :value="scope.row.orderStatus"/>
</template>
</el-table-column>
<el-table-column label="库存锁定标识" align="center" prop="stockLockFlag" v-if="columns[20].visible" >
<template slot-scope="scope">
<dict-tag :options="dict.type.active_flag" :value="scope.row.stockLockFlag"/>
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" v-if="columns[21].visible"/>
<el-table-column label="创建人" align="center" prop="createBy" v-if="columns[22].visible"/>
<el-table-column label="创建时间" align="center" prop="createTime" width="180" v-if="columns[23].visible">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="更新人" align="center" prop="updateBy" v-if="columns[24].visible"/>
<el-table-column label="更新时间" align="center" prop="updateTime" width="180" v-if="columns[25].visible">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['mes:productOrder:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleLockInventory(scope.row)"
>锁库存</el-button>
<!-- <el-button-->
<!-- size="mini"-->
<!-- type="text"-->
<!-- icon="el-icon-delete"-->
<!-- @click="handleDelete(scope.row)"-->
<!-- v-hasPermi="['mes:productOrder:remove']"-->
<!-- >删除</el-button>-->
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改生产工单对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="110px">
<el-form-item label="工单编号" prop="orderCode">
<el-input v-model="form.orderCode" placeholder="请输入工单编号" :disabled="true"/>
</el-form-item>
<!-- <el-form-item label="销售订单ID" prop="saleOrderId">-->
<!-- <el-input v-model="form.saleOrderId" placeholder="请输入销售订单ID" />-->
<!-- </el-form-item>-->
<el-form-item label="销售订单编号" prop="saleorderCode">
<el-input v-model="form.saleorderCode" placeholder="请点击右侧检索销售订单编号" readonly>
<el-button slot="append" icon="el-icon-search" @click="handleSaleOrderAdd"></el-button>
</el-input>
</el-form-item>
<el-form-item label="销售订单行号" prop="saleorderLinenumber">
<el-input v-model="form.saleorderLinenumber" placeholder="请输入销售订单行号" :disabled="true"/>
</el-form-item>
<!-- <el-form-item label="项目编号" prop="projectNo">-->
<!-- <el-input v-model="form.projectNo" placeholder="请输入项目编号" />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="物料ID" prop="materialId" >-->
<!-- <el-input v-model="form.materialId" placeholder="请输入物料ID" :disabled="true"/>-->
<!-- </el-form-item>-->
<el-form-item label="物料名称" prop="materialId" >
<el-input v-model="form.materialName" placeholder="请输入物料名称" :disabled="true"/>
</el-form-item>
<el-form-item label="物料BOM" prop="materialBomId">
<el-select v-model="form.materialBomId" placeholder="请选择物料BOM">
<el-option
v-for="item in materialBomList"
:key="item.materialBomId"
:label="item.materialNameDesc"
:value="item.materialBomId"
></el-option>
</el-select>
</el-form-item>
<!-- <el-form-item label="派工类型" prop="dispatchType">-->
<!-- <el-radio-group v-model="form.dispatchType">-->
<!-- <el-radio-->
<!-- v-for="dict in dict.type.dispatch_type"-->
<!-- :key="dict.value"-->
<!-- :label="dict.value"-->
<!-- >{{dict.label}}</el-radio>-->
<!-- </el-radio-group>-->
<!-- </el-form-item>-->
<el-form-item label="工艺路线" prop="dispatchId">
<el-select v-model="form.dispatchId" filterable placeholder="请选择工艺路线" clearable>
<el-option
v-for="item in routeList"
:key="item.routeId"
:label="item.routeName"
:value="item.routeId"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="销售数量" prop="saleAmount">
<el-input-number v-model="form.saleAmount" placeholder="请输入销售数量" :disabled="true"/>
</el-form-item>
<el-form-item label="计划数量" prop="planAmount">
<el-input-number v-model="form.planAmount" placeholder="请输入计划数量" />
</el-form-item>
<!-- <el-form-item label="已派工数量" prop="dispatchAmount">-->
<!-- <el-input-number v-model="form.dispatchAmount" placeholder="请输入已派工数量" />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="完成数量" prop="completeAmount">-->
<!-- <el-input-number v-model="form.completeAmount" placeholder="请输入完成数量" />-->
<!-- </el-form-item>-->
<el-form-item label="计划交货日期" prop="planDeliveryDate">
<el-date-picker clearable
v-model="form.planDeliveryDate"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="请选择计划交货日期">
</el-date-picker>
</el-form-item>
<el-form-item label="计划开始时间" prop="planBeginTime">
<el-date-picker clearable
v-model="form.planBeginTime"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="请选择计划开始时间">
</el-date-picker>
</el-form-item>
<el-form-item label="计划结束时间" prop="planEndTime">
<el-date-picker clearable
v-model="form.planEndTime"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="请选择计划结束时间">
</el-date-picker>
</el-form-item>
<!-- <el-form-item label="工单状态" prop="orderStatus">-->
<!-- <el-select v-model="form.orderStatus" placeholder="请选择工单状态">-->
<!-- <el-option-->
<!-- v-for="dict in dict.type.plan_status"-->
<!-- :key="dict.value"-->
<!-- :label="dict.label"-->
<!-- :value="dict.value"-->
<!-- ></el-option>-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<!-- <el-form-item label="库存锁定标识" prop="stockLockFlag">-->
<!-- <el-radio-group v-model="form.stockLockFlag">-->
<!-- <el-radio-->
<!-- v-for="dict in dict.type.active_flag"-->
<!-- :key="dict.value"-->
<!-- :label="dict.value"-->
<!-- >{{dict.label}}</el-radio>-->
<!-- </el-radio-group>-->
<!-- </el-form-item>-->
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<!-- 添加销售订单信息对话框 -->
<el-dialog title="选择销售订单" :visible.sync="saleOrderOpen" append-to-body>
<add-SaleOrder @selection="handleSelection" ref="saleOrderRef"></add-SaleOrder>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitSaleOrderForm"> </el-button>
<el-button @click="saleOrderOpen = false"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {
listProductOrder,
getProductOrder,
delProductOrder,
addProductOrder,
updateProductOrder,
getOrderCode, productOrderLockInventory
} from "@/api/mes/productOrder";
import addSaleOrder from '@//views/mes/productOrder/addSaleOrder.vue';
import {getMaterialVisionList} from "@//api/mes/materialBom";
import {findRouteList} from "@//api/mes/baseRoute";
export default {
name: "ProductOrder",
dicts: ['active_flag', 'plan_status', 'dispatch_type'],
components: {
'add-SaleOrder': addSaleOrder
},
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
productOrderList: [],
//
title: "",
//
open: false,
//
saleOrderOpen: false,
//
noOrderOpen: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
orderCode: null,
saleOrderId: null,
saleorderCode: null,
saleorderLinenumber: null,
projectNo: null,
materialId: null,
materialBomId: null,
dispatchType: null,
dispatchId: null,
saleAmount: null,
planAmount: null,
dispatchAmount: null,
completeAmount: null,
releaseTime: null,
planDeliveryDate: null,
planBeginTime: null,
planEndTime: null,
realBeginTime: null,
realEndTime: null,
orderStatus: null,
stockLockFlag: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
},
//
form: {},
//
rules: {
orderCode: [
{ required: true, message: "工单编号不能为空", trigger: "blur" }
],
saleOrderId: [
{ required: true, message: "销售订单ID不能为空", trigger: "blur" }
],
saleorderCode: [
{ required: true, message: "销售订单编号不能为空", trigger: "blur" }
],
materialId: [
{ required: true, message: "物料ID不能为空", trigger: "blur" }
],
materialBomId: [
{ required: true, message: "物料bomID不能为空", trigger: "blur" }
],
dispatchType: [
{ required: true, message: "派工类型不能为空", trigger: "change" }
],
dispatchId: [
{ required: true, message: "派工ID不能为空", trigger: "blur" }
],
planAmount: [
{ required: true, message: "计划数量不能为空", trigger: "blur" },
{
validator: (rule, value, callback) => callback(Number(value) >= 1 ? undefined : new Error("计划数量需要大于等于1")),
trigger: "blur"
}
],
},
columns: [
{ key: 0, label: `主键标识`, visible: false },
{ key: 1, label: `工单编号`, visible: true },
{ key: 2, label: `销售订单ID`, visible: true },
{ key: 3, label: `销售订单编号`, visible: true },
{ key: 4, label: `销售订单行号`, visible: true },
{ key: 5, label: `项目编号`, visible: true },
{ key: 6, label: `物料ID`, visible: true },
{ key: 7, label: `物料bomID`, visible: true },
{ key: 8, label: `派工类型`, visible: true },
{ key: 9, label: `派工ID`, 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: `开始时间`, 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: `创建人`, visible: false },
{ key: 23, label: `创建时间`, visible: false },
{ key: 24, label: `更新人`, visible: false },
{ key: 25, label: `更新时间`, visible: false },
{ key: 26, label: `计划交货日期`, visible: true },
],
//BOM
materialBomList: [],
//线
routeList: [],
};
},
created() {
this.getList();
findRouteList().then(response => {
this.routeList = response.data;
})
},
methods: {
/** 查询生产工单列表 */
getList() {
this.loading = true;
listProductOrder(this.queryParams).then(response => {
this.productOrderList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
productOrderId: null,
orderCode: null,
saleOrderId: null,
saleorderCode: null,
saleorderLinenumber: null,
projectNo: null,
materialId: null,
materialBomId: null,
dispatchType: '2',
dispatchId: null,
saleAmount: null,
planAmount: null,
dispatchAmount: null,
completeAmount: null,
releaseTime: null,
planDeliveryDate: null,
planBeginTime: null,
planEndTime: null,
realBeginTime: null,
realEndTime: null,
orderStatus: null,
stockLockFlag: null,
remark: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
};
this.materialBomList = null;
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
/** 新增按钮操作 */
handleSaleOrderAdd() {
this.saleOrderOpen = true;
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.productOrderId)
this.single = selection.length!==1
this.multiple = !selection.length
},
handleSelection(selection) {
this.ids = selection.map(item => item.productOrderId)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 提交物料信息按钮 */
submitSaleOrderForm() {
let selectedRow = this.$refs.saleOrderRef.selectedRow;
this.form.saleOrderId = selectedRow.saleOrderId;
this.form.saleorderCode = selectedRow.saleorderCode;
this.form.saleorderLinenumber = selectedRow.saleorderLinenumber;
this.form.materialId = selectedRow.materialId;
this.form.materialCode = selectedRow.materialCode;
this.form.materialName = selectedRow.materialName;
this.form.saleAmount = selectedRow.orderAmount;
this.form.planBeginTime = selectedRow.beginDate + " 00:00:00";
this.form.planEndTime = selectedRow.endDate + " 00:00:00";
this.form.planDeliveryDate = selectedRow.planDeliveryDate + " 00:00:00";
this.form.saleOrderFlag = '1';
getMaterialVisionList(this.form.materialId).then(response => {
this.materialBomList = response.data
this.form.materialBomId = this.materialBomList[0].materialBomId
})
this.saleOrderOpen = false;
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
getOrderCode().then(response => {
this.form.orderCode = response.msg;
})
this.open = true;
this.title = "添加生产工单";
},
/** 无订单新增按钮操作 */
handleNoOrderAdd() {
this.reset();
this.noOrderOpen = true;
this.title = "添加生产工单";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const productOrderId = row.productOrderId || this.ids
getProductOrder(productOrderId).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改生产工单";
});
},
/** 锁库存 */
handleLockInventory(row) {
this.form.productOrderId = row.productOrderId;
this.form.stockLockFlag = '1';
productOrderLockInventory(this.form).then(response => {
this.$modal.msgSuccess("锁库存成功");
this.getList();
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.productOrderId != null) {
updateProductOrder(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addProductOrder(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const productOrderIds = row.productOrderId || this.ids;
this.$modal.confirm('是否确认删除生产工单编号为"' + productOrderIds + '"的数据项?').then(function() {
return delProductOrder(productOrderIds);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('mes/productOrder/export', {
...this.queryParams
}, `productOrder_${new Date().getTime()}.xlsx`)
}
}
};
</script>

@ -109,7 +109,7 @@
<!-- v-hasPermi="['mes:saleOrder:remove']"-->
<!-- >删除</el-button>-->
<!-- </el-col>-->
<!-- <el-col :span="1.5">-->
<el-col :span="1.5">
<el-button
type="warning"
plain

Loading…
Cancel
Save