生产:
增加销售订单分摊易耗品物料使用情况的说明
master
xs 2 days ago
parent 0fb9042920
commit 13deb8d814

@ -149,6 +149,7 @@ public class MesBaseMaterialInfo extends BaseEntity
private String selectType;//3是选择实际生产的物料信息需要过滤是到511仓库的物料 private String selectType;//3是选择实际生产的物料信息需要过滤是到511仓库的物料
private BigDecimal stockAmount;//实际总库存
public Long getPurchasePriceUnitId() { public Long getPurchasePriceUnitId() {
return purchasePriceUnitId; return purchasePriceUnitId;
@ -458,6 +459,14 @@ public class MesBaseMaterialInfo extends BaseEntity
this.selectType = selectType; this.selectType = selectType;
} }
public BigDecimal getStockAmount() {
return stockAmount;
}
public void setStockAmount(BigDecimal stockAmount) {
this.stockAmount = stockAmount;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

@ -163,4 +163,9 @@ public enum BusinessType
* *
*/ */
PAUSE, PAUSE,
/**
* 使
*/
USE,
} }

@ -0,0 +1,105 @@
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.MesAlarmInfo;
import com.hw.mes.service.IMesAlarmInfoService;
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 xins
* @date 2024-11-21
*/
@RestController
@RequestMapping("/alarmInfo")
public class MesAlarmInfoController extends BaseController
{
@Autowired
private IMesAlarmInfoService mesAlarmInfoService;
/**
*
*/
@RequiresPermissions("mes:alarmInfo:list")
@GetMapping("/list")
public TableDataInfo list(MesAlarmInfo mesAlarmInfo)
{
startPage();
List<MesAlarmInfo> list = mesAlarmInfoService.selectMesAlarmInfoList(mesAlarmInfo);
return getDataTable(list);
}
/**
*
*/
@RequiresPermissions("mes:alarmInfo:export")
@Log(title = "生产告警信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, MesAlarmInfo mesAlarmInfo)
{
List<MesAlarmInfo> list = mesAlarmInfoService.selectMesAlarmInfoList(mesAlarmInfo);
ExcelUtil<MesAlarmInfo> util = new ExcelUtil<MesAlarmInfo>(MesAlarmInfo.class);
util.exportExcel(response, list, "生产告警信息数据");
}
/**
*
*/
@RequiresPermissions("mes:alarmInfo:query")
@GetMapping(value = "/{alarmInfoId}")
public AjaxResult getInfo(@PathVariable("alarmInfoId") Long alarmInfoId)
{
return success(mesAlarmInfoService.selectMesAlarmInfoByAlarmInfoId(alarmInfoId));
}
/**
*
*/
@RequiresPermissions("mes:alarmInfo:add")
@Log(title = "生产告警信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody MesAlarmInfo mesAlarmInfo)
{
return toAjax(mesAlarmInfoService.insertMesAlarmInfo(mesAlarmInfo));
}
/**
*
*/
@RequiresPermissions("mes:alarmInfo:edit")
@Log(title = "生产告警信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody MesAlarmInfo mesAlarmInfo)
{
return toAjax(mesAlarmInfoService.updateMesAlarmInfo(mesAlarmInfo));
}
/**
*
*/
@RequiresPermissions("mes:alarmInfo:remove")
@Log(title = "生产告警信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{alarmInfoIds}")
public AjaxResult remove(@PathVariable Long[] alarmInfoIds)
{
return toAjax(mesAlarmInfoService.deleteMesAlarmInfoByAlarmInfoIds(alarmInfoIds));
}
}

@ -6,9 +6,11 @@ import javax.servlet.http.HttpServletResponse;
import com.hw.common.core.domain.R; import com.hw.common.core.domain.R;
import com.hw.common.security.annotation.InnerAuth; import com.hw.common.security.annotation.InnerAuth;
import com.hw.mes.api.domain.MesBaseBarcodeInfo; import com.hw.mes.api.domain.MesBaseBarcodeInfo;
import com.hw.mes.api.domain.MesBaseMaterialInfo;
import com.hw.mes.api.domain.MesOrderBind; import com.hw.mes.api.domain.MesOrderBind;
import com.hw.mes.api.domain.MesSaleOrderRelate; import com.hw.mes.api.domain.MesSaleOrderRelate;
import com.hw.mes.api.domain.vo.MesSaleOrderTransferVo; import com.hw.mes.api.domain.vo.MesSaleOrderTransferVo;
import com.hw.mes.domain.MesSaleOrderMaterial;
import com.hw.mes.service.IMesOrderBindService; import com.hw.mes.service.IMesOrderBindService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
@ -117,6 +119,39 @@ public class MesSaleOrderController extends BaseController {
@RequiresPermissions("mes:saleOrder:used")
@GetMapping("/selectMaterialOutstockUsedInfos")
public TableDataInfo selectMaterialOutstockUsedInfos(MesSaleOrderMaterial mesSaleOrderMaterial) {
startPage();
List<MesSaleOrderMaterial> list = mesSaleOrderService.selectSaleOrderMaterialUsedInfos(mesSaleOrderMaterial);
return getDataTable(list);
}
/**
*
*/
@RequiresPermissions("mes:saleOrder:used")
@Log(title = "销售订单物料使用", businessType = BusinessType.USE)
@PostMapping("/updateMesSaleOrderMaterials")
public AjaxResult updateMesSaleOrderMaterials(@RequestBody List<MesSaleOrderMaterial> mesSaleOrderMaterialList) {
return toAjax(mesSaleOrderService.updateMesSaleOrderMaterials(mesSaleOrderMaterialList));
}
/**
* 使
*/
@RequiresPermissions("mes:saleOrder:used")
@Log(title = "销售订单物料使用", businessType = BusinessType.EXPORT)
@PostMapping("/exportSaleOrderMaterials")
public void exportSaleOrderMaterials(HttpServletResponse response, MesSaleOrderMaterial mesSaleOrderMaterial)
{
List<MesSaleOrderMaterial> list = mesSaleOrderService.selectMesSaleOrderMaterialList(mesSaleOrderMaterial);
ExcelUtil<MesSaleOrderMaterial> util = new ExcelUtil<MesSaleOrderMaterial>(MesSaleOrderMaterial.class);
util.exportExcel(response, list, "销售订单使用物料情况数据");
}
/** /**
* *
*/ */

@ -0,0 +1,114 @@
package com.hw.mes.domain;
import java.util.List;
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_alarm_info
*
* @author xins
* @date 2024-11-21
*/
public class MesAlarmInfo extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键标识 */
private Long alarmInfoId;
/** 报警类型(1库存报警) */
@Excel(name = "报警类型(1库存报警)")
private String alarmInfoType;
/** 处理状态(0未处理 1已处理) */
@Excel(name = "处理状态(0未处理 1已处理)")
private String handleStatus;
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date createDate;
/** 最后更新时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "最后更新时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date updateDate;
/** 库存告警信息明细信息 */
private List<MesStockAlarmDetail> mesStockAlarmDetailList;
public void setAlarmInfoId(Long alarmInfoId)
{
this.alarmInfoId = alarmInfoId;
}
public Long getAlarmInfoId()
{
return alarmInfoId;
}
public void setAlarmInfoType(String alarmInfoType)
{
this.alarmInfoType = alarmInfoType;
}
public String getAlarmInfoType()
{
return alarmInfoType;
}
public void setHandleStatus(String handleStatus)
{
this.handleStatus = handleStatus;
}
public String getHandleStatus()
{
return handleStatus;
}
public void setCreateDate(Date createDate)
{
this.createDate = createDate;
}
public Date getCreateDate()
{
return createDate;
}
public void setUpdateDate(Date updateDate)
{
this.updateDate = updateDate;
}
public Date getUpdateDate()
{
return updateDate;
}
public List<MesStockAlarmDetail> getMesStockAlarmDetailList()
{
return mesStockAlarmDetailList;
}
public void setMesStockAlarmDetailList(List<MesStockAlarmDetail> mesStockAlarmDetailList)
{
this.mesStockAlarmDetailList = mesStockAlarmDetailList;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("alarmInfoId", getAlarmInfoId())
.append("alarmInfoType", getAlarmInfoType())
.append("handleStatus", getHandleStatus())
.append("createBy", getCreateBy())
.append("createDate", getCreateDate())
.append("updateBy", getUpdateBy())
.append("updateDate", getUpdateDate())
.append("mesStockAlarmDetailList", getMesStockAlarmDetailList())
.toString();
}
}

@ -0,0 +1,185 @@
package com.hw.mes.domain;
import java.math.BigDecimal;
import java.math.RoundingMode;
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_sale_order_material
*
* @author xins
* @date 2024-11-21
*/
public class MesSaleOrderMaterial extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键标识 */
private Long saleOrderMaterialId;
/** 销售订单编号 */
@Excel(name = "销售订单编号")
private String saleorderCode;
/** 物料ID */
// @Excel(name = "物料ID")
private Long materialId;
/** 物料编码 */
@Excel(name = "物料编码")
private String materialCode;
/** 物料名称 */
@Excel(name = "物料名称")
private String materialName;
/** 物料规格 */
@Excel(name = "物料规格")
private String materialSpec;
/** 出库数量 */
// @Excel(name = "出库数量")
private BigDecimal outstockAmount;
/** 分摊使用的数量 */
@Excel(name = "使用数量")
private BigDecimal usedAmount;
private BigDecimal realOutstockAmount;//实际出库数量
private BigDecimal totalUsedAmount;//总共分摊使用数量
private BigDecimal oriUsedAmount;//修改前的原分摊使用数量
private int index;//序号
public void setSaleOrderMaterialId(Long saleOrderMaterialId)
{
this.saleOrderMaterialId = saleOrderMaterialId;
}
public Long getSaleOrderMaterialId()
{
return saleOrderMaterialId;
}
public void setSaleorderCode(String saleorderCode)
{
this.saleorderCode = saleorderCode;
}
public String getSaleorderCode()
{
return saleorderCode;
}
public void setMaterialId(Long materialId)
{
this.materialId = materialId;
}
public Long getMaterialId()
{
return materialId;
}
public void setMaterialCode(String materialCode)
{
this.materialCode = materialCode;
}
public String getMaterialCode()
{
return materialCode;
}
public void setMaterialName(String materialName)
{
this.materialName = materialName;
}
public String getMaterialName()
{
return materialName;
}
public void setMaterialSpec(String materialSpec)
{
this.materialSpec = materialSpec;
}
public String getMaterialSpec()
{
return materialSpec;
}
public void setOutstockAmount(BigDecimal outstockAmount)
{
this.outstockAmount = outstockAmount;
}
public BigDecimal getOutstockAmount()
{
return outstockAmount;
}
public void setUsedAmount(BigDecimal usedAmount)
{
usedAmount = usedAmount == null ? BigDecimal.ZERO : usedAmount;
usedAmount = usedAmount.setScale(2, RoundingMode.HALF_UP);
this.usedAmount = usedAmount;
}
public BigDecimal getUsedAmount()
{
return usedAmount;
}
public BigDecimal getRealOutstockAmount() {
return realOutstockAmount;
}
public void setRealOutstockAmount(BigDecimal realOutstockAmount) {
this.realOutstockAmount = realOutstockAmount;
}
public BigDecimal getTotalUsedAmount() {
return totalUsedAmount;
}
public void setTotalUsedAmount(BigDecimal totalUsedAmount) {
this.totalUsedAmount = totalUsedAmount;
}
public BigDecimal getOriUsedAmount() {
return oriUsedAmount;
}
public void setOriUsedAmount(BigDecimal oriUsedAmount) {
this.oriUsedAmount = oriUsedAmount;
}
public int getIndex() {
return index;
}
public void setIndex(int index) {
this.index = index;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("saleOrderMaterialId", getSaleOrderMaterialId())
.append("saleorderCode", getSaleorderCode())
.append("materialId", getMaterialId())
.append("materialCode", getMaterialCode())
.append("materialName", getMaterialName())
.append("materialSpec", getMaterialSpec())
.append("outstockAmount", getOutstockAmount())
.append("usedAmount", getUsedAmount())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

@ -0,0 +1,170 @@
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_stock_alarm_detail
*
* @author xins
* @date 2024-11-21
*/
public class MesStockAlarmDetail extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键标识 */
private Long stockAlarmDetailId;
/** 报警信息ID */
@Excel(name = "报警信息ID")
private Long alarmInfoId;
/** 物料ID */
@Excel(name = "物料ID")
private Long materialId;
/** 物料编码 */
@Excel(name = "物料编码")
private String materialCode;
/** 物料名称 */
@Excel(name = "物料名称")
private String materialName;
/** 物料规格 */
@Excel(name = "物料规格")
private String materialSpec;
/** 安全库存数量;仓库存放的总数量 */
@Excel(name = "安全库存数量;仓库存放的总数量")
private BigDecimal safeStockAmount;
/** 库存数量;手动冻结的,暂时可不用 */
@Excel(name = "库存数量;手动冻结的,暂时可不用")
private BigDecimal stockAmount;
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date createDate;
/** 最后更新时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "最后更新时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date updateDate;
public void setStockAlarmDetailId(Long stockAlarmDetailId)
{
this.stockAlarmDetailId = stockAlarmDetailId;
}
public Long getStockAlarmDetailId()
{
return stockAlarmDetailId;
}
public void setAlarmInfoId(Long alarmInfoId)
{
this.alarmInfoId = alarmInfoId;
}
public Long getAlarmInfoId()
{
return alarmInfoId;
}
public void setMaterialId(Long materialId)
{
this.materialId = materialId;
}
public Long getMaterialId()
{
return materialId;
}
public void setMaterialCode(String materialCode)
{
this.materialCode = materialCode;
}
public String getMaterialCode()
{
return materialCode;
}
public void setMaterialName(String materialName)
{
this.materialName = materialName;
}
public String getMaterialName()
{
return materialName;
}
public void setMaterialSpec(String materialSpec)
{
this.materialSpec = materialSpec;
}
public String getMaterialSpec()
{
return materialSpec;
}
public void setSafeStockAmount(BigDecimal safeStockAmount)
{
this.safeStockAmount = safeStockAmount;
}
public BigDecimal getSafeStockAmount()
{
return safeStockAmount;
}
public void setStockAmount(BigDecimal stockAmount)
{
this.stockAmount = stockAmount;
}
public BigDecimal getStockAmount()
{
return stockAmount;
}
public void setCreateDate(Date createDate)
{
this.createDate = createDate;
}
public Date getCreateDate()
{
return createDate;
}
public void setUpdateDate(Date updateDate)
{
this.updateDate = updateDate;
}
public Date getUpdateDate()
{
return updateDate;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("stockAlarmDetailId", getStockAlarmDetailId())
.append("alarmInfoId", getAlarmInfoId())
.append("materialId", getMaterialId())
.append("materialCode", getMaterialCode())
.append("materialName", getMaterialName())
.append("materialSpec", getMaterialSpec())
.append("safeStockAmount", getSafeStockAmount())
.append("stockAmount", getStockAmount())
.append("createBy", getCreateBy())
.append("createDate", getCreateDate())
.append("updateBy", getUpdateBy())
.append("updateDate", getUpdateDate())
.toString();
}
}

@ -0,0 +1,87 @@
package com.hw.mes.mapper;
import java.util.List;
import com.hw.mes.domain.MesAlarmInfo;
import com.hw.mes.domain.MesStockAlarmDetail;
/**
* Mapper
*
* @author xins
* @date 2024-11-21
*/
public interface MesAlarmInfoMapper
{
/**
*
*
* @param alarmInfoId
* @return
*/
public MesAlarmInfo selectMesAlarmInfoByAlarmInfoId(Long alarmInfoId);
/**
*
*
* @param mesAlarmInfo
* @return
*/
public List<MesAlarmInfo> selectMesAlarmInfoList(MesAlarmInfo mesAlarmInfo);
/**
*
*
* @param mesAlarmInfo
* @return
*/
public int insertMesAlarmInfo(MesAlarmInfo mesAlarmInfo);
/**
*
*
* @param mesAlarmInfo
* @return
*/
public int updateMesAlarmInfo(MesAlarmInfo mesAlarmInfo);
/**
*
*
* @param alarmInfoId
* @return
*/
public int deleteMesAlarmInfoByAlarmInfoId(Long alarmInfoId);
/**
*
*
* @param alarmInfoIds
* @return
*/
public int deleteMesAlarmInfoByAlarmInfoIds(Long[] alarmInfoIds);
/**
*
*
* @param alarmInfoIds
* @return
*/
public int deleteMesStockAlarmDetailByAlarmInfoIds(Long[] alarmInfoIds);
/**
*
*
* @param mesStockAlarmDetailList
* @return
*/
public int batchMesStockAlarmDetail(List<MesStockAlarmDetail> mesStockAlarmDetailList);
/**
*
*
* @param alarmInfoId ID
* @return
*/
public int deleteMesStockAlarmDetailByAlarmInfoId(Long alarmInfoId);
}

@ -94,4 +94,15 @@ public interface MesBaseMaterialInfoMapper
* @return * @return
*/ */
public MesBaseMaterialInfo selectMesBaseMaterialInfoByErpId(Long erpId); public MesBaseMaterialInfo selectMesBaseMaterialInfoByErpId(Long erpId);
/**
*
*
* @param mesBaseMaterialInfo
* @return
*/
public List<MesBaseMaterialInfo> selectMaterialInfoStockInfos(MesBaseMaterialInfo mesBaseMaterialInfo);
} }

@ -0,0 +1,82 @@
package com.hw.mes.mapper;
import java.util.List;
import com.hw.mes.domain.MesSaleOrderMaterial;
/**
* 使Mapper
*
* @author xins
* @date 2024-11-21
*/
public interface MesSaleOrderMaterialMapper
{
/**
* 使
*
* @param saleOrderMaterialId 使
* @return 使
*/
public MesSaleOrderMaterial selectMesSaleOrderMaterialBySaleOrderMaterialId(Long saleOrderMaterialId);
/**
* 使
*
* @param mesSaleOrderMaterial 使
* @return 使
*/
public List<MesSaleOrderMaterial> selectMesSaleOrderMaterialList(MesSaleOrderMaterial mesSaleOrderMaterial);
/**
* 使
*
* @param mesSaleOrderMaterial 使
* @return
*/
public int insertMesSaleOrderMaterial(MesSaleOrderMaterial mesSaleOrderMaterial);
/**
* 使
*
* @param mesSaleOrderMaterial 使
* @return
*/
public int updateMesSaleOrderMaterial(MesSaleOrderMaterial mesSaleOrderMaterial);
/**
* 使
*
* @param saleOrderMaterialId 使
* @return
*/
public int deleteMesSaleOrderMaterialBySaleOrderMaterialId(Long saleOrderMaterialId);
/**
* 使
*
* @param saleOrderMaterialIds
* @return
*/
public int deleteMesSaleOrderMaterialBySaleOrderMaterialIds(Long[] saleOrderMaterialIds);
/**
* 使
*
* @param mesSaleOrderMaterialList 使
* @return
*/
public int batchMesSaleOrderMaterial(List<MesSaleOrderMaterial> mesSaleOrderMaterialList);
/**
* 使
*
* @param mesSaleOrderMaterial 使
* @return 使
*/
public List<MesSaleOrderMaterial> selectSaleOrderMaterialUsedInfos(MesSaleOrderMaterial mesSaleOrderMaterial);
}

@ -0,0 +1,61 @@
package com.hw.mes.service;
import java.util.List;
import com.hw.mes.domain.MesAlarmInfo;
/**
* Service
*
* @author xins
* @date 2024-11-21
*/
public interface IMesAlarmInfoService
{
/**
*
*
* @param alarmInfoId
* @return
*/
public MesAlarmInfo selectMesAlarmInfoByAlarmInfoId(Long alarmInfoId);
/**
*
*
* @param mesAlarmInfo
* @return
*/
public List<MesAlarmInfo> selectMesAlarmInfoList(MesAlarmInfo mesAlarmInfo);
/**
*
*
* @param mesAlarmInfo
* @return
*/
public int insertMesAlarmInfo(MesAlarmInfo mesAlarmInfo);
/**
*
*
* @param mesAlarmInfo
* @return
*/
public int updateMesAlarmInfo(MesAlarmInfo mesAlarmInfo);
/**
*
*
* @param alarmInfoIds
* @return
*/
public int deleteMesAlarmInfoByAlarmInfoIds(Long[] alarmInfoIds);
/**
*
*
* @param alarmInfoId
* @return
*/
public int deleteMesAlarmInfoByAlarmInfoId(Long alarmInfoId);
}

@ -0,0 +1,61 @@
package com.hw.mes.service;
import java.util.List;
import com.hw.mes.domain.MesSaleOrderMaterial;
/**
* 使Service
*
* @author xins
* @date 2024-11-21
*/
public interface IMesSaleOrderMaterialService
{
/**
* 使
*
* @param saleOrderMaterialId 使
* @return 使
*/
public MesSaleOrderMaterial selectMesSaleOrderMaterialBySaleOrderMaterialId(Long saleOrderMaterialId);
/**
* 使
*
* @param mesSaleOrderMaterial 使
* @return 使
*/
public List<MesSaleOrderMaterial> selectMesSaleOrderMaterialList(MesSaleOrderMaterial mesSaleOrderMaterial);
/**
* 使
*
* @param mesSaleOrderMaterial 使
* @return
*/
public int insertMesSaleOrderMaterial(MesSaleOrderMaterial mesSaleOrderMaterial);
/**
* 使
*
* @param mesSaleOrderMaterial 使
* @return
*/
public int updateMesSaleOrderMaterial(MesSaleOrderMaterial mesSaleOrderMaterial);
/**
* 使
*
* @param saleOrderMaterialIds 使
* @return
*/
public int deleteMesSaleOrderMaterialBySaleOrderMaterialIds(Long[] saleOrderMaterialIds);
/**
* 使
*
* @param saleOrderMaterialId 使
* @return
*/
public int deleteMesSaleOrderMaterialBySaleOrderMaterialId(Long saleOrderMaterialId);
}

@ -3,9 +3,12 @@ package com.hw.mes.service;
import java.util.List; import java.util.List;
import com.hw.mes.api.domain.MesBaseBarcodeInfo; import com.hw.mes.api.domain.MesBaseBarcodeInfo;
import com.hw.mes.api.domain.MesBaseMaterialInfo;
import com.hw.mes.api.domain.MesSaleOrderRelate; import com.hw.mes.api.domain.MesSaleOrderRelate;
import com.hw.mes.api.domain.vo.MesSaleOrderTransferVo; import com.hw.mes.api.domain.vo.MesSaleOrderTransferVo;
import com.hw.mes.domain.MesSaleOrder; import com.hw.mes.domain.MesSaleOrder;
import com.hw.mes.domain.MesSaleOrderMaterial;
import org.springframework.transaction.annotation.Transactional;
/** /**
* Service * Service
@ -98,4 +101,24 @@ public interface IMesSaleOrderService
* @return * @return
*/ */
public List<MesSaleOrderRelate> selectMesSaleOrderRelateJoinProductList(MesSaleOrderRelate mesSaleOrderRelate); public List<MesSaleOrderRelate> selectMesSaleOrderRelateJoinProductList(MesSaleOrderRelate mesSaleOrderRelate);
/**
* 使
* @return
*/
public List<MesSaleOrderMaterial> selectSaleOrderMaterialUsedInfos(MesSaleOrderMaterial mesSaleOrderMaterial);
/**
* 使
*
* @return
*/
public List<MesSaleOrderMaterial> selectMesSaleOrderMaterialList(MesSaleOrderMaterial mesSaleOrderMaterial);
/**
* 使
* @param mesSaleOrderMaterialList
* @return
*/
public int updateMesSaleOrderMaterials(List<MesSaleOrderMaterial> mesSaleOrderMaterialList);
} }

@ -0,0 +1,131 @@
package com.hw.mes.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import com.hw.common.core.utils.StringUtils;
import org.springframework.transaction.annotation.Transactional;
import com.hw.mes.domain.MesStockAlarmDetail;
import com.hw.mes.mapper.MesAlarmInfoMapper;
import com.hw.mes.domain.MesAlarmInfo;
import com.hw.mes.service.IMesAlarmInfoService;
/**
* Service
*
* @author xins
* @date 2024-11-21
*/
@Service
public class MesAlarmInfoServiceImpl implements IMesAlarmInfoService
{
@Autowired
private MesAlarmInfoMapper mesAlarmInfoMapper;
/**
*
*
* @param alarmInfoId
* @return
*/
@Override
public MesAlarmInfo selectMesAlarmInfoByAlarmInfoId(Long alarmInfoId)
{
return mesAlarmInfoMapper.selectMesAlarmInfoByAlarmInfoId(alarmInfoId);
}
/**
*
*
* @param mesAlarmInfo
* @return
*/
@Override
public List<MesAlarmInfo> selectMesAlarmInfoList(MesAlarmInfo mesAlarmInfo)
{
return mesAlarmInfoMapper.selectMesAlarmInfoList(mesAlarmInfo);
}
/**
*
*
* @param mesAlarmInfo
* @return
*/
@Transactional
@Override
public int insertMesAlarmInfo(MesAlarmInfo mesAlarmInfo)
{
int rows = mesAlarmInfoMapper.insertMesAlarmInfo(mesAlarmInfo);
insertMesStockAlarmDetail(mesAlarmInfo);
return rows;
}
/**
*
*
* @param mesAlarmInfo
* @return
*/
@Transactional
@Override
public int updateMesAlarmInfo(MesAlarmInfo mesAlarmInfo)
{
mesAlarmInfoMapper.deleteMesStockAlarmDetailByAlarmInfoId(mesAlarmInfo.getAlarmInfoId());
insertMesStockAlarmDetail(mesAlarmInfo);
return mesAlarmInfoMapper.updateMesAlarmInfo(mesAlarmInfo);
}
/**
*
*
* @param alarmInfoIds
* @return
*/
@Transactional
@Override
public int deleteMesAlarmInfoByAlarmInfoIds(Long[] alarmInfoIds)
{
mesAlarmInfoMapper.deleteMesStockAlarmDetailByAlarmInfoIds(alarmInfoIds);
return mesAlarmInfoMapper.deleteMesAlarmInfoByAlarmInfoIds(alarmInfoIds);
}
/**
*
*
* @param alarmInfoId
* @return
*/
@Transactional
@Override
public int deleteMesAlarmInfoByAlarmInfoId(Long alarmInfoId)
{
mesAlarmInfoMapper.deleteMesStockAlarmDetailByAlarmInfoId(alarmInfoId);
return mesAlarmInfoMapper.deleteMesAlarmInfoByAlarmInfoId(alarmInfoId);
}
/**
*
*
* @param mesAlarmInfo
*/
public void insertMesStockAlarmDetail(MesAlarmInfo mesAlarmInfo)
{
List<MesStockAlarmDetail> mesStockAlarmDetailList = mesAlarmInfo.getMesStockAlarmDetailList();
Long alarmInfoId = mesAlarmInfo.getAlarmInfoId();
if (StringUtils.isNotNull(mesStockAlarmDetailList))
{
List<MesStockAlarmDetail> list = new ArrayList<MesStockAlarmDetail>();
for (MesStockAlarmDetail mesStockAlarmDetail : mesStockAlarmDetailList)
{
mesStockAlarmDetail.setAlarmInfoId(alarmInfoId);
list.add(mesStockAlarmDetail);
}
if (list.size() > 0)
{
mesAlarmInfoMapper.batchMesStockAlarmDetail(list);
}
}
}
}

@ -3,11 +3,15 @@ package com.hw.mes.service.impl;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.List; import java.util.List;
import com.github.pagehelper.PageHelper;
import com.hw.common.core.constant.MesConstants; import com.hw.common.core.constant.MesConstants;
import com.hw.common.core.exception.ServiceException; import com.hw.common.core.exception.ServiceException;
import com.hw.common.core.utils.DateUtils; import com.hw.common.core.utils.DateUtils;
import com.hw.common.core.utils.StringUtils; import com.hw.common.core.utils.StringUtils;
import com.hw.common.core.utils.sql.SqlUtil;
import com.hw.common.core.utils.uuid.Seq; import com.hw.common.core.utils.uuid.Seq;
import com.hw.common.core.web.page.PageDomain;
import com.hw.common.core.web.page.TableSupport;
import com.hw.common.security.utils.SecurityUtils; import com.hw.common.security.utils.SecurityUtils;
import com.hw.mes.mapper.MesBaseBarcodeInfoMapper; import com.hw.mes.mapper.MesBaseBarcodeInfoMapper;
import com.hw.mes.mapper.MesOrderBindMapper; import com.hw.mes.mapper.MesOrderBindMapper;
@ -16,6 +20,7 @@ import org.springframework.stereotype.Service;
import com.hw.mes.mapper.MesBaseMaterialInfoMapper; import com.hw.mes.mapper.MesBaseMaterialInfoMapper;
import com.hw.mes.api.domain.MesBaseMaterialInfo; import com.hw.mes.api.domain.MesBaseMaterialInfo;
import com.hw.mes.service.IMesBaseMaterialInfoService; import com.hw.mes.service.IMesBaseMaterialInfoService;
import org.springframework.transaction.annotation.Transactional;
/** /**
* Service * Service
@ -173,4 +178,38 @@ public class MesBaseMaterialInfoServiceImpl implements IMesBaseMaterialInfoServi
public MesBaseMaterialInfo selectMesBaseMaterialInfoByErpId(Long erpId) { public MesBaseMaterialInfo selectMesBaseMaterialInfoByErpId(Long erpId) {
return mesBaseMaterialInfoMapper.selectMesBaseMaterialInfoByErpId(erpId); return mesBaseMaterialInfoMapper.selectMesBaseMaterialInfoByErpId(erpId);
} }
@Transactional(rollbackFor = Exception.class)
public void stockAlarm(){
//return list
stockAlarm(1);
}
public void stockAlarm(Integer startRow){
MesBaseMaterialInfo queryMaterialInfo = new MesBaseMaterialInfo();
Integer pageSize = 100;
Integer pageNum = startRow/pageSize+1;
PageHelper.startPage(1, 100, "");
List<MesBaseMaterialInfo> mesBaseMaterialInfoList = mesBaseMaterialInfoMapper.selectMaterialInfoStockInfos(queryMaterialInfo);
for(MesBaseMaterialInfo mesBaseMaterialInfo:mesBaseMaterialInfoList){
BigDecimal safeStockAmount = mesBaseMaterialInfo.getSafeStockAmount();
if(safeStockAmount!=null){
BigDecimal stockAmount = mesBaseMaterialInfo.getStockAmount()==null?BigDecimal.ZERO:mesBaseMaterialInfo.getStockAmount();
//如果库存数量小于安全库存
if(stockAmount.compareTo(safeStockAmount)<1){
}
}
}
//如果返回的数组的数量等于分页数量,则继续获取下一页数据
if (mesBaseMaterialInfoList.size() == pageSize) {
//通过递归同步所有供应商,测试先不用
stockAlarm(startRow + mesBaseMaterialInfoList.size());
}
}
} }

@ -0,0 +1,96 @@
package com.hw.mes.service.impl;
import java.util.List;
import com.hw.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hw.mes.mapper.MesSaleOrderMaterialMapper;
import com.hw.mes.domain.MesSaleOrderMaterial;
import com.hw.mes.service.IMesSaleOrderMaterialService;
/**
* 使Service
*
* @author xins
* @date 2024-11-21
*/
@Service
public class MesSaleOrderMaterialServiceImpl implements IMesSaleOrderMaterialService
{
@Autowired
private MesSaleOrderMaterialMapper mesSaleOrderMaterialMapper;
/**
* 使
*
* @param saleOrderMaterialId 使
* @return 使
*/
@Override
public MesSaleOrderMaterial selectMesSaleOrderMaterialBySaleOrderMaterialId(Long saleOrderMaterialId)
{
return mesSaleOrderMaterialMapper.selectMesSaleOrderMaterialBySaleOrderMaterialId(saleOrderMaterialId);
}
/**
* 使
*
* @param mesSaleOrderMaterial 使
* @return 使
*/
@Override
public List<MesSaleOrderMaterial> selectMesSaleOrderMaterialList(MesSaleOrderMaterial mesSaleOrderMaterial)
{
return mesSaleOrderMaterialMapper.selectMesSaleOrderMaterialList(mesSaleOrderMaterial);
}
/**
* 使
*
* @param mesSaleOrderMaterial 使
* @return
*/
@Override
public int insertMesSaleOrderMaterial(MesSaleOrderMaterial mesSaleOrderMaterial)
{
mesSaleOrderMaterial.setCreateTime(DateUtils.getNowDate());
return mesSaleOrderMaterialMapper.insertMesSaleOrderMaterial(mesSaleOrderMaterial);
}
/**
* 使
*
* @param mesSaleOrderMaterial 使
* @return
*/
@Override
public int updateMesSaleOrderMaterial(MesSaleOrderMaterial mesSaleOrderMaterial)
{
mesSaleOrderMaterial.setUpdateTime(DateUtils.getNowDate());
return mesSaleOrderMaterialMapper.updateMesSaleOrderMaterial(mesSaleOrderMaterial);
}
/**
* 使
*
* @param saleOrderMaterialIds 使
* @return
*/
@Override
public int deleteMesSaleOrderMaterialBySaleOrderMaterialIds(Long[] saleOrderMaterialIds)
{
return mesSaleOrderMaterialMapper.deleteMesSaleOrderMaterialBySaleOrderMaterialIds(saleOrderMaterialIds);
}
/**
* 使
*
* @param saleOrderMaterialId 使
* @return
*/
@Override
public int deleteMesSaleOrderMaterialBySaleOrderMaterialId(Long saleOrderMaterialId)
{
return mesSaleOrderMaterialMapper.deleteMesSaleOrderMaterialBySaleOrderMaterialId(saleOrderMaterialId);
}
}

@ -5,20 +5,20 @@ import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import com.hw.common.core.exception.ServiceException;
import com.hw.common.core.utils.DateUtils; import com.hw.common.core.utils.DateUtils;
import com.hw.common.core.utils.StringUtils; import com.hw.common.core.utils.StringUtils;
import com.hw.common.security.utils.SecurityUtils; import com.hw.common.security.utils.SecurityUtils;
import com.hw.mes.api.domain.MesBaseBarcodeInfo; import com.hw.mes.api.domain.MesBaseBarcodeInfo;
import com.hw.mes.api.domain.MesBaseMaterialInfo;
import com.hw.mes.api.domain.MesSaleOrderRelate; import com.hw.mes.api.domain.MesSaleOrderRelate;
import com.hw.mes.api.domain.vo.MesBaseBarcodeInfoTransferVo; import com.hw.mes.api.domain.vo.MesBaseBarcodeInfoTransferVo;
import com.hw.mes.api.domain.vo.MesSaleOrderTransferVo; import com.hw.mes.api.domain.vo.MesSaleOrderTransferVo;
import com.hw.mes.domain.MesMaterialBom; import com.hw.mes.domain.MesMaterialBom;
import com.hw.mes.mapper.MesBaseBarcodeInfoMapper; import com.hw.mes.domain.MesSaleOrderMaterial;
import com.hw.mes.mapper.MesMaterialBomMapper; import com.hw.mes.mapper.*;
import com.hw.mes.mapper.MesSaleOrderRelateMapper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.hw.mes.mapper.MesSaleOrderMapper;
import com.hw.mes.domain.MesSaleOrder; import com.hw.mes.domain.MesSaleOrder;
import com.hw.mes.service.IMesSaleOrderService; import com.hw.mes.service.IMesSaleOrderService;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -43,6 +43,12 @@ public class MesSaleOrderServiceImpl implements IMesSaleOrderService {
@Autowired @Autowired
private MesMaterialBomMapper mesMaterialBomMapper; private MesMaterialBomMapper mesMaterialBomMapper;
@Autowired
private MesBaseMaterialInfoMapper mesBaseMaterialInfoMapper;
@Autowired
private MesSaleOrderMaterialMapper mesSaleOrderMaterialMapper;
/** /**
* *
* *
@ -234,12 +240,85 @@ public class MesSaleOrderServiceImpl implements IMesSaleOrderService {
/** /**
* join product * join product
*
* @param mesSaleOrderRelate * @param mesSaleOrderRelate
* @return * @return
*/ */
@Override @Override
public List<MesSaleOrderRelate> selectMesSaleOrderRelateJoinProductList(MesSaleOrderRelate mesSaleOrderRelate){ public List<MesSaleOrderRelate> selectMesSaleOrderRelateJoinProductList(MesSaleOrderRelate mesSaleOrderRelate) {
return mesSaleOrderRelateMapper.selectMesSaleOrderRelateJoinProductList(mesSaleOrderRelate); return mesSaleOrderRelateMapper.selectMesSaleOrderRelateJoinProductList(mesSaleOrderRelate);
} }
/**
* 使
*
* @return
*/
@Override
public List<MesSaleOrderMaterial> selectSaleOrderMaterialUsedInfos(MesSaleOrderMaterial mesSaleOrderMaterial) {
List<MesSaleOrderMaterial> mesSaleOrderMaterialList = mesSaleOrderMaterialMapper.selectSaleOrderMaterialUsedInfos(mesSaleOrderMaterial);
return mesSaleOrderMaterialList;
//wms_raw_outstock增加了used_amount
//select sum(outstock_amount),sum(used_amount) from wms_raw_outstock wro where material_id=material_id outstock_amount >0 and outstock_amount>used_amount
}
/**
* 使
*
* @return
*/
@Override
public List<MesSaleOrderMaterial> selectMesSaleOrderMaterialList(MesSaleOrderMaterial mesSaleOrderMaterial) {
List<MesSaleOrderMaterial> mesSaleOrderMaterialList = mesSaleOrderMaterialMapper.selectMesSaleOrderMaterialList(mesSaleOrderMaterial);
return mesSaleOrderMaterialList;
//wms_raw_outstock增加了used_amount
//select sum(outstock_amount),sum(used_amount) from wms_raw_outstock wro where material_id=material_id outstock_amount >0 and outstock_amount>used_amount
}
/**
* 使
*
* @param mesSaleOrderMaterialList
* @return
*/
@Transactional(rollbackFor = Exception.class)
@Override
public int updateMesSaleOrderMaterials(List<MesSaleOrderMaterial> mesSaleOrderMaterialList) {
List<MesSaleOrderMaterial> toInsertedMesSaleOrderMaterialList = new ArrayList<>();
// List<MesSaleOrderMaterial> toUpdatedMesSaleOrderMateriaList = new ArrayList<>();
for (MesSaleOrderMaterial mesSaleOrderMaterial : mesSaleOrderMaterialList) {
if (mesSaleOrderMaterial.getUsedAmount() != null && mesSaleOrderMaterial.getUsedAmount().compareTo(BigDecimal.ZERO) > 0) {
BigDecimal realOutstockAmount = mesSaleOrderMaterial.getRealOutstockAmount();
BigDecimal totalUsedAmount = mesSaleOrderMaterial.getTotalUsedAmount()==null?BigDecimal.ZERO:mesSaleOrderMaterial.getTotalUsedAmount();//其他订单已分摊数量
BigDecimal oriUsedAmount = mesSaleOrderMaterial.getOriUsedAmount()==null?BigDecimal.ZERO:mesSaleOrderMaterial.getOriUsedAmount();
BigDecimal usedAmount = mesSaleOrderMaterial.getUsedAmount()==null?BigDecimal.ZERO:mesSaleOrderMaterial.getUsedAmount();
BigDecimal updateAmount = usedAmount.subtract(oriUsedAmount);//修改的数量差
if (updateAmount.compareTo(BigDecimal.ZERO) != 0) {
BigDecimal newTotalUsedAmount = totalUsedAmount.add(usedAmount);
if (realOutstockAmount.compareTo(newTotalUsedAmount) < 0) {
throw new ServiceException("分摊数量总和不能大于出库数量");
}
}
if (mesSaleOrderMaterial.getSaleOrderMaterialId() != null) {
// toUpdatedMesSaleOrderMateriaList.add(mesSaleOrderMaterial);
mesSaleOrderMaterialMapper.updateMesSaleOrderMaterial(mesSaleOrderMaterial);
} else {
toInsertedMesSaleOrderMaterialList.add(mesSaleOrderMaterial);
}
}
}
if (toInsertedMesSaleOrderMaterialList != null && !toInsertedMesSaleOrderMaterialList.isEmpty()) {
mesSaleOrderMaterialMapper.batchMesSaleOrderMaterial(toInsertedMesSaleOrderMaterialList);
}
return 1;
}
} }

@ -0,0 +1,119 @@
<?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.MesAlarmInfoMapper">
<resultMap type="MesAlarmInfo" id="MesAlarmInfoResult">
<result property="alarmInfoId" column="alarm_info_id" />
<result property="alarmInfoType" column="alarm_info_type" />
<result property="handleStatus" column="handle_status" />
<result property="createBy" column="create_by" />
<result property="createDate" column="create_date" />
<result property="updateBy" column="update_by" />
<result property="updateDate" column="update_date" />
</resultMap>
<resultMap id="MesAlarmInfoMesStockAlarmDetailResult" type="MesAlarmInfo" extends="MesAlarmInfoResult">
<collection property="mesStockAlarmDetailList" notNullColumn="sub_stock_alarm_detail_id" javaType="java.util.List" resultMap="MesStockAlarmDetailResult" />
</resultMap>
<resultMap type="MesStockAlarmDetail" id="MesStockAlarmDetailResult">
<result property="stockAlarmDetailId" column="sub_stock_alarm_detail_id" />
<result property="alarmInfoId" column="sub_alarm_info_id" />
<result property="materialId" column="sub_material_id" />
<result property="materialCode" column="sub_material_code" />
<result property="materialName" column="sub_material_name" />
<result property="materialSpec" column="sub_material_spec" />
<result property="safeStockAmount" column="sub_safe_stock_amount" />
<result property="stockAmount" column="sub_stock_amount" />
<result property="createBy" column="sub_create_by" />
<result property="createDate" column="sub_create_date" />
<result property="updateBy" column="sub_update_by" />
<result property="updateDate" column="sub_update_date" />
</resultMap>
<sql id="selectMesAlarmInfoVo">
select alarm_info_id, alarm_info_type, handle_status, create_by, create_date, update_by, update_date from mes_alarm_info
</sql>
<select id="selectMesAlarmInfoList" parameterType="MesAlarmInfo" resultMap="MesAlarmInfoResult">
<include refid="selectMesAlarmInfoVo"/>
<where>
<if test="alarmInfoType != null and alarmInfoType != ''"> and alarm_info_type = #{alarmInfoType}</if>
<if test="handleStatus != null and handleStatus != ''"> and handle_status = #{handleStatus}</if>
<if test="createDate != null "> and create_date = #{createDate}</if>
<if test="updateDate != null "> and update_date = #{updateDate}</if>
</where>
</select>
<select id="selectMesAlarmInfoByAlarmInfoId" parameterType="Long" resultMap="MesAlarmInfoMesStockAlarmDetailResult">
select a.alarm_info_id, a.alarm_info_type, a.handle_status, a.create_by, a.create_date, a.update_by, a.update_date,
b.stock_alarm_detail_id as sub_stock_alarm_detail_id, b.alarm_info_id as sub_alarm_info_id, b.material_id as sub_material_id, b.material_code as sub_material_code, b.material_name as sub_material_name, b.material_spec as sub_material_spec, b.safe_stock_amount as sub_safe_stock_amount, b.stock_amount as sub_stock_amount, b.create_by as sub_create_by, b.create_date as sub_create_date, b.update_by as sub_update_by, b.update_date as sub_update_date
from mes_alarm_info a
left join mes_stock_alarm_detail b on b.alarm_info_id = a.alarm_info_id
where a.alarm_info_id = #{alarmInfoId}
</select>
<insert id="insertMesAlarmInfo" parameterType="MesAlarmInfo" useGeneratedKeys="true" keyProperty="alarmInfoId">
insert into mes_alarm_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="alarmInfoType != null and alarmInfoType != ''">alarm_info_type,</if>
<if test="handleStatus != null and handleStatus != ''">handle_status,</if>
<if test="createBy != null">create_by,</if>
<if test="createDate != null">create_date,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateDate != null">update_date,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="alarmInfoType != null and alarmInfoType != ''">#{alarmInfoType},</if>
<if test="handleStatus != null and handleStatus != ''">#{handleStatus},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createDate != null">#{createDate},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateDate != null">#{updateDate},</if>
</trim>
</insert>
<update id="updateMesAlarmInfo" parameterType="MesAlarmInfo">
update mes_alarm_info
<trim prefix="SET" suffixOverrides=",">
<if test="alarmInfoType != null and alarmInfoType != ''">alarm_info_type = #{alarmInfoType},</if>
<if test="handleStatus != null and handleStatus != ''">handle_status = #{handleStatus},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createDate != null">create_date = #{createDate},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateDate != null">update_date = #{updateDate},</if>
</trim>
where alarm_info_id = #{alarmInfoId}
</update>
<delete id="deleteMesAlarmInfoByAlarmInfoId" parameterType="Long">
delete from mes_alarm_info where alarm_info_id = #{alarmInfoId}
</delete>
<delete id="deleteMesAlarmInfoByAlarmInfoIds" parameterType="String">
delete from mes_alarm_info where alarm_info_id in
<foreach item="alarmInfoId" collection="array" open="(" separator="," close=")">
#{alarmInfoId}
</foreach>
</delete>
<delete id="deleteMesStockAlarmDetailByAlarmInfoIds" parameterType="String">
delete from mes_stock_alarm_detail where alarm_info_id in
<foreach item="alarmInfoId" collection="array" open="(" separator="," close=")">
#{alarmInfoId}
</foreach>
</delete>
<delete id="deleteMesStockAlarmDetailByAlarmInfoId" parameterType="Long">
delete from mes_stock_alarm_detail where alarm_info_id = #{alarmInfoId}
</delete>
<insert id="batchMesStockAlarmDetail">
insert into mes_stock_alarm_detail( stock_alarm_detail_id, alarm_info_id, material_id, material_code, material_name, material_spec, safe_stock_amount, stock_amount, create_by, create_date, update_by, update_date) values
<foreach item="item" index="index" collection="list" separator=",">
( #{item.stockAlarmDetailId}, #{item.alarmInfoId}, #{item.materialId}, #{item.materialCode}, #{item.materialName}, #{item.materialSpec}, #{item.safeStockAmount}, #{item.stockAmount}, #{item.createBy}, #{item.createDate}, #{item.updateBy}, #{item.updateDate})
</foreach>
</insert>
</mapper>

@ -44,6 +44,11 @@
<result property="lowValueConsumableFlag" column="low_value_consumable_flag"/> <result property="lowValueConsumableFlag" column="low_value_consumable_flag"/>
<result property="warehouseId" column="warehouse_id"/> <result property="warehouseId" column="warehouse_id"/>
<result property="purchasePriceUnitId" column="purchase_price_unit_id"/> <result property="purchasePriceUnitId" column="purchase_price_unit_id"/>
<result property="stockAmount" column="stock_amount"/>
<result property="realOutstockAmount" column="real_outstock_amount"/>
<result property="totalUsedAmount" column="total_used_amount"/>
<result property="ussedAmount" column="used_amount"/>
<result property="saleOrderMaterialId" column="sale_order_material_id"/>
</resultMap> </resultMap>
<sql id="selectMesBaseMaterialInfoVo"> <sql id="selectMesBaseMaterialInfoVo">
@ -371,4 +376,28 @@
<include refid="selectMesBaseMaterialInfoVo"/> <include refid="selectMesBaseMaterialInfoVo"/>
where bmi.material_code = #{materialCode} limit 1 where bmi.material_code = #{materialCode} limit 1
</select> </select>
<select id="selectMaterialInfoStockInfos" parameterType="MesBaseMaterialInfo"
resultMap="MesBaseMaterialInfoResult">
select mbmi.material_id,
mbmi.material_code,
mbmi.material_name,
mbmi.material_spec,
mbmi.safe_stock_amount,
(select sum(total_amount) from wms_stock_total wst where wst.material_id=mbmi.material_id) as stock_amount
from mes_base_material_info mbmi
<where>
<if test="erpId != null ">and erp_id = #{erpId}</if>
</where>
</select>
</mapper> </mapper>

@ -272,7 +272,7 @@
<if test="selectFlag != null and selectFlag != ''">and not exists (select 1 from mes_sale_order_relate msor where mso.sale_order_id = msor.relate_sale_order_id)</if> <if test="selectFlag != null and selectFlag != ''">and not exists (select 1 from mes_sale_order_relate msor where mso.sale_order_id = msor.relate_sale_order_id)</if>
<if test="parentIds != null and parentIds != ''">and exists (select 1 from mes_material_bom mmb where mmb.erp_material_id=mso.material_id and mmb.material_bom_id in (${parentIds}))</if> <if test="parentIds != null and parentIds != ''">and exists (select 1 from mes_material_bom mmb where mmb.erp_material_id=mso.material_id and mmb.material_bom_id in (${parentIds}))</if>
</where> </where>
order by mso.erp_modify_date desc order by mso.saleorder_code,mso.erp_modify_date desc
</select> </select>

@ -0,0 +1,137 @@
<?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.MesSaleOrderMaterialMapper">
<resultMap type="MesSaleOrderMaterial" id="MesSaleOrderMaterialResult">
<result property="saleOrderMaterialId" column="sale_order_material_id" />
<result property="saleorderCode" column="saleorder_code" />
<result property="materialId" column="material_id" />
<result property="materialCode" column="material_code" />
<result property="materialName" column="material_name" />
<result property="materialSpec" column="material_spec" />
<result property="realOutstockAmount" column="real_outstock_amount" />
<result property="usedAmount" column="used_amount" />
<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="totalUsedAmount" column="total_used_amount" />
</resultMap>
<sql id="selectMesSaleOrderMaterialVo">
select sale_order_material_id, saleorder_code, material_id, material_code, material_name, material_spec, real_outstock_amount, used_amount, create_by, create_time, update_by, update_time from mes_sale_order_material
</sql>
<select id="selectMesSaleOrderMaterialList" parameterType="MesSaleOrderMaterial" resultMap="MesSaleOrderMaterialResult">
<include refid="selectMesSaleOrderMaterialVo"/>
<where>
<if test="saleorderCode != null and saleorderCode != ''"> and saleorder_code = #{saleorderCode}</if>
<if test="materialId != null "> and material_id = #{materialId}</if>
<if test="materialCode != null and materialCode != ''"> and material_code = #{materialCode}</if>
<if test="materialName != null and materialName != ''"> and material_name like concat('%', #{materialName}, '%')</if>
<if test="materialSpec != null and materialSpec != ''"> and material_spec = #{materialSpec}</if>
<if test="usedAmount != null "> and used_amount = #{usedAmount}</if>
</where>
order by saleorder_code
</select>
<select id="selectMesSaleOrderMaterialBySaleOrderMaterialId" parameterType="Long" resultMap="MesSaleOrderMaterialResult">
<include refid="selectMesSaleOrderMaterialVo"/>
where sale_order_material_id = #{saleOrderMaterialId}
</select>
<insert id="insertMesSaleOrderMaterial" parameterType="MesSaleOrderMaterial" useGeneratedKeys="true" keyProperty="saleOrderMaterialId">
insert into mes_sale_order_material
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="saleorderCode != null and saleorderCode != ''">saleorder_code,</if>
<if test="materialId != null">material_id,</if>
<if test="materialCode != null and materialCode != ''">material_code,</if>
<if test="materialName != null">material_name,</if>
<if test="materialSpec != null">material_spec,</if>
<if test="realOutstockAmount != null">real_outstock_amount,</if>
<if test="usedAmount != null">used_amount,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null and updateBy != ''">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="saleorderCode != null and saleorderCode != ''">#{saleorderCode},</if>
<if test="materialId != null">#{materialId},</if>
<if test="materialCode != null and materialCode != ''">#{materialCode},</if>
<if test="materialName != null">#{materialName},</if>
<if test="materialSpec != null">#{materialSpec},</if>
<if test="outstockAmount != null">#{outstockAmount},</if>
<if test="usedAmount != null">#{usedAmount},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateMesSaleOrderMaterial" parameterType="MesSaleOrderMaterial">
update mes_sale_order_material
<trim prefix="SET" suffixOverrides=",">
<if test="saleorderCode != null and saleorderCode != ''">saleorder_code = #{saleorderCode},</if>
<if test="materialId != null">material_id = #{materialId},</if>
<if test="materialCode != null and materialCode != ''">material_code = #{materialCode},</if>
<if test="materialName != null">material_name = #{materialName},</if>
<if test="materialSpec != null">material_spec = #{materialSpec},</if>
<if test="realOutstockAmount != null">real_outstock_amount = #{realOutstockAmount},</if>
<if test="usedAmount != null">used_amount = #{usedAmount},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where sale_order_material_id = #{saleOrderMaterialId}
</update>
<delete id="deleteMesSaleOrderMaterialBySaleOrderMaterialId" parameterType="Long">
delete from mes_sale_order_material where sale_order_material_id = #{saleOrderMaterialId}
</delete>
<delete id="deleteMesSaleOrderMaterialBySaleOrderMaterialIds" parameterType="String">
delete from mes_sale_order_material where sale_order_material_id in
<foreach item="saleOrderMaterialId" collection="array" open="(" separator="," close=")">
#{saleOrderMaterialId}
</foreach>
</delete>
<insert id="batchMesSaleOrderMaterial">
insert into mes_sale_order_material( sale_order_material_id, saleorder_code, material_id, material_code, material_name, material_spec, real_outstock_amount, used_amount, create_by, create_time, update_by, update_time) values
<foreach item="item" index="index" collection="list" separator=",">
( #{item.saleOrderMaterialId}, #{item.saleorderCode}, #{item.materialId}, #{item.materialCode}, #{item.materialName}, #{item.materialSpec}, #{item.outstockAmount}, #{item.usedAmount}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime})
</foreach>
</insert>
<select id="selectSaleOrderMaterialUsedInfos" parameterType="MesSaleOrderMaterial"
resultMap="MesSaleOrderMaterialResult">
select mbmi.material_id,
mbmi.material_code,
mbmi.material_name,
mbmi.material_spec,
msom.used_amount,
msom.sale_order_material_id,
msom.saleorder_code,
(select sum(ifnull(real_outstock_amount,0)) from wms_raw_outstock wro where wro.material_id=mbmi.material_id and wro.real_outstock_amount >0) as real_outstock_amount,
(select sum(ifnull(used_amount,0)) from mes_sale_order_material msom where msom.material_id=mbmi.material_id) as total_used_amount
from mes_base_material_info mbmi left join mes_sale_order_material msom on mbmi.material_id=msom.material_id and msom.saleorder_code = #{saleorderCode}
<where>
and mbmi.low_value_consumable_flag = '1'
</where>
</select>
</mapper>

@ -247,7 +247,6 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
throw new ServiceException("请输入审核意见"); throw new ServiceException("请输入审核意见");
} }
wmsRawOutstocks.forEach(wmsRawOutstock -> { wmsRawOutstocks.forEach(wmsRawOutstock -> {
//todo:批次码
Long stockTotalId = wmsRawOutstock.getStockTotalId(); Long stockTotalId = wmsRawOutstock.getStockTotalId();
BigDecimal planAmount = wmsRawOutstock.getOutstockAmount(); BigDecimal planAmount = wmsRawOutstock.getOutstockAmount();
WmsStockTotal wmsStockTotal = wmsStockTotalMapper.selectWmsStockTotalByStockTotalId(stockTotalId); WmsStockTotal wmsStockTotal = wmsStockTotalMapper.selectWmsStockTotalByStockTotalId(stockTotalId);

@ -63,3 +63,32 @@ export function selectSaleOrderRelates(query) {
params: query params: query
}) })
} }
// 查询销售订单分摊使用易耗品物料信息列表
export function selectMaterialOutstockUsedInfos(query) {
return request({
url: '/mes/saleOrder/selectMaterialOutstockUsedInfos',
method: 'get',
params: query
})
}
// 更新销售订单分摊使用物料信息
export function updateMesSaleOrderMaterials(data) {
return request({
url: '/mes/saleOrder/updateMesSaleOrderMaterials',
method: 'post',
data: data
})
}
// 导出销售订单分摊使用物料信息
export function exportSaleOrderMaterials(data) {
return request({
url: '/mes/saleOrder/exportSaleOrderMaterials',
method: 'post',
data: data
})
}

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询销售订单使用物料情况列表
export function listSaleOrderMaterial(query) {
return request({
url: '/mes/saleOrderMaterial/list',
method: 'get',
params: query
})
}
// 查询销售订单使用物料情况详细
export function getSaleOrderMaterial(saleOrderMaterialId) {
return request({
url: '/mes/saleOrderMaterial/' + saleOrderMaterialId,
method: 'get'
})
}
// 新增销售订单使用物料情况
export function addSaleOrderMaterial(data) {
return request({
url: '/mes/saleOrderMaterial',
method: 'post',
data: data
})
}
// 修改销售订单使用物料情况
export function updateSaleOrderMaterial(data) {
return request({
url: '/mes/saleOrderMaterial',
method: 'put',
data: data
})
}
// 删除销售订单使用物料情况
export function delSaleOrderMaterial(saleOrderMaterialId) {
return request({
url: '/mes/saleOrderMaterial/' + saleOrderMaterialId,
method: 'delete'
})
}

@ -239,6 +239,23 @@ export const dynamicRoutes = [
} }
] ]
}, },
{
path: '/mes/sale-order-material',
component: Layout,
hidden: true,
permissions: ['mes:saleOrder:used'],
children: [
{
path: 'index/:saleorderCode',
component: () => import('@/views/mes/saleOrderMaterial/index'),
name: 'MaterialUsed',
meta: { title: '物料使用', activeMenu: '/mes/saleOrderMaterial' }
}
]
},
{ {
path: '/system/wfProcessActivityAuth', path: '/system/wfProcessActivityAuth',
component: Layout, component: Layout,

@ -1084,8 +1084,8 @@ export default {
let selectedRow = this.$refs.productOrderRef.selectedRow; let selectedRow = this.$refs.productOrderRef.selectedRow;
this.form.preOrderId = selectedRow.productOrderId; this.form.preOrderId = selectedRow.productOrderId;
this.form.preOrderCode = selectedRow.orderCode; this.form.preOrderCode = selectedRow.orderCode;
if (selectedRow.planBeginTime != null && this.form.planBeginTime == null) { if (selectedRow.planEndTime != null && selectedRow.planEndTime !=='') {
const date = new Date(selectedRow.planBeginTime); const date = new Date(selectedRow.planEndTime);
date.setDate(date.getDate() + 1) date.setDate(date.getDate() + 1)
this.form.planBeginTime = parseTime(date, '{y}-{m}-{d} {h}:{i}:{s}'); this.form.planBeginTime = parseTime(date, '{y}-{m}-{d} {h}:{i}:{s}');
} }
@ -1309,6 +1309,19 @@ export default {
this.submitLoading = false; this.submitLoading = false;
return this.$modal.msgError("计划数量不能大于销售数量!"); return this.$modal.msgError("计划数量不能大于销售数量!");
} }
if(this.form.planEndTime <= this.form.planBeginTime){
this.submitLoading = false;
return this.$modal.msgError("计划结束时间需大于计划开始时间!");
}
if(this.form.planDeliveryDate <= this.form.planEndTime){
this.submitLoading = false;
return this.$modal.msgError("计划交付时间需大于计划结束时间!");
}
if (this.form.productOrderId != null) { if (this.form.productOrderId != null) {
updateProductOrder(this.form).then(response => { updateProductOrder(this.form).then(response => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功");

@ -118,122 +118,142 @@
</el-col> </el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar--> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar-->
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="syncSaleOrderInfos"
>同步</el-button>
</el-col>
</el-row> <el-col :span="1.5">
<el-button
<el-table v-loading="loading" :data="saleOrderList" @selection-change="handleSelectionChange"> type="primary"
<el-table-column label="主键标识" align="center" prop="saleOrderId" v-if="columns[0].visible"/> plain
<el-table-column label="ERP主键" align="center" prop="erpId" v-if="columns[1].visible"/> icon="el-icon-download"
<el-table-column label="ERP订单明细ID" align="center" prop="fentryId" v-if="columns[2].visible"/> size="mini"
<el-table-column label="销售订单编号" align="center" prop="saleorderCode" v-if="columns[3].visible"/> @click="handleExportSaleOrderMaterial"
<el-table-column label="订单类型" align="center" prop="saleOrderClassfication"> v-hasPermi="['mes:saleOrder:used']"
<template slot-scope="scope"> >物料使用情况导出</el-button>
<dict-tag :options="dict.type.mes_sale_order_classfication" :value="scope.row.saleOrderClassfication"/> </el-col>
</template> <el-col :span="1.5">
</el-table-column> <el-button
<el-table-column label="销售订单行号" align="center" prop="saleorderLinenumber" v-if="columns[4].visible"/> type="warning"
<el-table-column label="单据状态" align="center" prop="documentStatus" v-if="columns[5].visible" > plain
<template slot-scope="scope"> icon="el-icon-download"
<dict-tag :options="dict.type.document_status" :value="scope.row.documentStatus"/> size="mini"
</template> @click="syncSaleOrderInfos"
</el-table-column> >同步</el-button>
<el-table-column label="所属工厂" align="center" prop="factoryId" v-if="columns[6].visible"/> </el-col>
<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-row>
<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 v-loading="loading" :data="saleOrderList" @selection-change="handleSelectionChange">
<el-table-column label="物料规格" align="center" prop="materialSpec"/> <el-table-column label="主键标识" align="center" prop="saleOrderId" v-if="columns[0].visible"/>
<el-table-column label="物料组" align="center" prop="matkl" v-if="columns[11].visible"/> <el-table-column label="ERP主键" align="center" prop="erpId" v-if="columns[1].visible"/>
<el-table-column label="订单数量" align="center" prop="orderAmount" v-if="columns[12].visible"/> <el-table-column label="ERP订单明细ID" align="center" prop="fentryId" v-if="columns[2].visible"/>
<el-table-column label="已发布数量" align="center" prop="releaseQty"/> <el-table-column label="销售订单编号" align="center" prop="saleorderCode" v-if="columns[3].visible"/>
<el-table-column label="完成数量" align="center" prop="completeAmount"/> <el-table-column label="订单类型" align="center" prop="saleOrderClassfication">
<el-table-column label="订单状态" align="center" prop="isRelease"> <template slot-scope="scope">
<template slot-scope="scope"> <dict-tag :options="dict.type.mes_sale_order_classfication" :value="scope.row.saleOrderClassfication"/>
<dict-tag :options="dict.type.mes_sale_order_is_release" :value="scope.row.isRelease"/> </template>
</template> </el-table-column>
</el-table-column> <el-table-column label="销售订单行号" align="center" prop="saleorderLinenumber" v-if="columns[4].visible"/>
<el-table-column label="单据状态" align="center" prop="documentStatus" v-if="columns[5].visible" >
<el-table-column label="开始日期" align="center" prop="beginDate"> <template slot-scope="scope">
<template slot-scope="scope"> <dict-tag :options="dict.type.document_status" :value="scope.row.documentStatus"/>
<span>{{ parseTime(scope.row.beginDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span> </template>
</template> </el-table-column>
</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="结束日期" align="center" prop="endDate"> <el-table-column label="物料ID" align="center" prop="materialId" v-if="columns[8].visible"/>
<template slot-scope="scope"> <el-table-column label="物料编码" align="center" prop="materialCode" v-if="columns[9].visible"/>
<span>{{ parseTime(scope.row.endDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span> <el-table-column label="物料名称" align="center" prop="materialName" v-if="columns[10].visible"/>
</template> <el-table-column label="物料规格" align="center" prop="materialSpec"/>
</el-table-column> <el-table-column label="物料组" align="center" prop="matkl" v-if="columns[11].visible"/>
<el-table-column label="计划交货日期" align="center" prop="planDeliveryDate" v-if="columns[18].visible"> <el-table-column label="订单数量" align="center" prop="orderAmount" v-if="columns[12].visible"/>
<template slot-scope="scope"> <el-table-column label="已发布数量" align="center" prop="releaseQty"/>
<span>{{ parseTime(scope.row.planDeliveryDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span> <el-table-column label="完成数量" align="center" prop="completeAmount"/>
</template> <el-table-column label="订单状态" align="center" prop="isRelease">
</el-table-column> <template slot-scope="scope">
<dict-tag :options="dict.type.mes_sale_order_is_release" :value="scope.row.isRelease"/>
<el-table-column label="审核日期" align="center" prop="approveDate" v-if="columns[16].visible"> </template>
<template slot-scope="scope"> </el-table-column>
<span>{{ parseTime(scope.row.approveDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template> <el-table-column label="开始日期" align="center" prop="beginDate">
</el-table-column> <template slot-scope="scope">
<el-table-column label="ERP最后修改日期" align="center" prop="erpModifyDate" v-if="columns[17].visible"> <span>{{ parseTime(scope.row.beginDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
<template slot-scope="scope"> </template>
<span>{{ parseTime(scope.row.erpModifyDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span> </el-table-column>
</template>
</el-table-column> <el-table-column label="结束日期" align="center" prop="endDate">
<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="remark" v-if="columns[23].visible"/> <el-table-column label="计划交货日期" align="center" prop="planDeliveryDate" v-if="columns[18].visible">
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <template slot-scope="scope">
<template slot-scope="scope"> <span>{{ parseTime(scope.row.planDeliveryDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
<el-button </template>
size="mini" </el-table-column>
type="text"
icon="el-icon-edit" <el-table-column label="审核日期" align="center" prop="approveDate" v-if="columns[16].visible">
@click="handleBindingPurchase(scope.row)" <template slot-scope="scope">
v-hasPermi="['mes:saleOrder:bind']" <span>{{ parseTime(scope.row.approveDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
v-if="scope.row.saleOrderClassfication==='1'" </template>
>绑定</el-button> </el-table-column>
<el-button <el-table-column label="ERP最后修改日期" align="center" prop="erpModifyDate" v-if="columns[17].visible">
size="mini" <template slot-scope="scope">
type="text" <span>{{ parseTime(scope.row.erpModifyDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
icon="el-icon-info" </template>
@click="handleSaleOrderRelates(scope.row)" </el-table-column>
v-hasPermi="['mes:saleOrder:list']"
v-if="scope.row.saleOrderClassfication==='2'"
>详情</el-button>
<el-button
type="text" <el-table-column label="备注" align="center" prop="remark" v-if="columns[23].visible"/>
icon="el-icon-info" <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
size="mini" <template slot-scope="scope">
@click="handleOrderBinds(scope.row)" <el-button
v-hasPermi="['mes:saleOrder:bind']" size="mini"
v-if="scope.row.saleOrderClassfication==='1'" type="text"
>已绑定 icon="el-icon-edit"
</el-button> @click="handleBindingPurchase(scope.row)"
</template> v-hasPermi="['mes:saleOrder:bind']"
</el-table-column> v-if="scope.row.saleOrderClassfication==='1'"
</el-table> >绑定</el-button>
<el-button
<pagination size="mini"
v-show="total>0" type="text"
:total="total" icon="el-icon-info"
:page.sync="queryParams.pageNum" @click="handleSaleOrderRelates(scope.row)"
:limit.sync="queryParams.pageSize" v-hasPermi="['mes:saleOrder:list']"
@pagination="getList" v-if="scope.row.saleOrderClassfication==='2'"
/> >详情</el-button>
<el-button
<!-- 添加或修改销售订单信息对话框 --> type="text"
icon="el-icon-info"
size="mini"
@click="handleOrderBinds(scope.row)"
v-hasPermi="['mes:saleOrder:bind']"
v-if="scope.row.saleOrderClassfication==='1'"
>已绑定
</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleMaterialUsed(scope.row)"
v-hasPermi="['mes:saleOrder:used']"
v-if="scope.row.saleOrderClassfication==='1'"
>物料使用</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-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> <el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="ERP主键" prop="erpId"> <el-form-item label="ERP主键" prop="erpId">
@ -641,9 +661,23 @@ export default {
}).then(() => { }).then(() => {
this.$modal.msgSuccess("执行成功"); this.$modal.msgSuccess("执行成功");
}).catch(() => {}); }).catch(() => {});
} },
handleMaterialUsed(row){
let saleorderCode = row.saleorderCode;
const params = {queryParams: this.queryParams, t: Date.now(),saleorderCode:saleorderCode};
this.$tab.openPage("销售订单[" + saleorderCode + "]", '/mes/sale-order-material/index/' + saleorderCode, params);
},
/** 导出按钮操作 */
handleExportSaleOrderMaterial() {
this.download('mes/saleOrder/exportSaleOrderMaterials', {
...this.queryParams
}, `物料情况使用_${new Date().getTime()}.xlsx`)
}
} }
}; };
</script> </script>

@ -0,0 +1,356 @@
<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="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="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 label="出库数量" prop="outstockAmount">-->
<!-- <el-input-->
<!-- v-model="queryParams.outstockAmount"-->
<!-- placeholder="请输入出库数量"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="分摊使用的数量" prop="usedAmount">-->
<!-- <el-input-->
<!-- v-model="queryParams.usedAmount"-->
<!-- 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:saleOrderMaterial: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:saleOrderMaterial: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:saleOrderMaterial:remove']"-->
<!-- >删除</el-button>-->
<!-- </el-col>-->
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
:loading="submitLoading"
@click="submitForm"
v-hasPermi="['mes:saleOrder:used']"
>保存
</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:used']"
>导出
</el-button>
</el-col>
</el-row>
<el-table v-loading="loading" :data="saleOrderMaterialList" @selection-change="handleSelectionChange">
<!-- <el-table-column type="selection" width="55" align="center" />-->
<!-- <el-table-column label="主键标识" align="center" prop="saleOrderMaterialId" />-->
<!-- <el-table-column label="销售订单编号" align="center" prop="saleorderCode" />-->
<!-- <el-table-column label="物料ID" align="center" prop="materialId" />-->
<el-table-column label="序号" align="center" type="index"/>
<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="realOutstockAmount"/>
<el-table-column label="其他订单分摊数量" align="center" prop="totalUsedAmount"/>
<el-table-column label="此订单分摊数量" align="center" prop="usedAmount">
<template slot-scope="scope">
<el-input-number v-model="scope.row.usedAmount" placeholder="请输入使用数量">
</el-input-number>
</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:saleOrderMaterial:edit']"-->
<!-- >修改</el-button>-->
<!-- <el-button-->
<!-- size="mini"-->
<!-- type="text"-->
<!-- icon="el-icon-delete"-->
<!-- @click="handleDelete(scope.row)"-->
<!-- v-hasPermi="['mes:saleOrderMaterial: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="80px">
<el-form-item label="销售订单编号" prop="saleorderCode">
<el-input v-model="form.saleorderCode" 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="materialSpec">
<el-input v-model="form.materialSpec" type="textarea" placeholder="请输入内容"/>
</el-form-item>
<el-form-item label="出库数量" prop="outstockAmount">
<el-input v-model="form.outstockAmount" placeholder="请输入出库数量"/>
</el-form-item>
<el-form-item label="分摊使用的数量" prop="usedAmount">
<el-input v-model="form.usedAmount" 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 {selectMaterialOutstockUsedInfos,updateMesSaleOrderMaterials} from "@/api/mes/saleOrder";
export default {
name: "SaleOrderMaterial",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
// 使
saleOrderMaterialList: [],
submitLoading:false,
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
saleorderCode: null,
materialId: null,
materialCode: null,
materialName: null,
materialSpec: null,
outstockAmount: null,
usedAmount: null,
},
//
form: {},
//
rules: {
saleorderCode: [
{required: true, message: "销售订单编号不能为空", trigger: "blur"}
],
materialId: [
{required: true, message: "物料ID不能为空", trigger: "blur"}
],
materialCode: [
{required: true, message: "物料编码不能为空", trigger: "blur"}
],
updateBy: [
{required: true, message: "更新人不能为空", trigger: "blur"}
],
}
};
},
created() {
this.getList();
},
methods: {
/** 查询销售订单使用物料情况列表 */
getList() {
this.loading = true;
let saleorderCode = this.$route.query && this.$route.query.saleorderCode;
this.queryParams.saleorderCode = saleorderCode;
selectMaterialOutstockUsedInfos(this.queryParams).then(response => {
response.rows.forEach(e => {
e.oriUsedAmount = e.usedAmount
e.totalUsedAmount = e.totalUsedAmount == null ? 0:e.totalUsedAmount;
e.usedAmount = e.usedAmount == null ? 0:e.usedAmount;
e.totalUsedAmount = e.totalUsedAmount - e.usedAmount;//
e.saleorderCode = saleorderCode
});
this.saleOrderMaterialList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
saleOrderMaterialId: null,
saleorderCode: null,
materialId: null,
materialCode: null,
materialName: null,
materialSpec: null,
outstockAmount: null,
usedAmount: 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.saleOrderMaterialId)
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 提交按钮 */
submitForm() {
this.submitLoading = true;
let errorMsg="";
this.saleOrderMaterialList.forEach((e,index) => {
if(e.usedAmount && e.usedAmount!==null){
let realOutstockAmount = e.realOutstockAmount == null ? 0 :e.realOutstockAmount;
let totalUsedAmount = e.totalUsedAmount == null ? 0 :e.totalUsedAmount;
let usedAmount = e.usedAmount == null ? 0 :e.usedAmount;
let newTotalUsedAmount = totalUsedAmount+usedAmount;
if(realOutstockAmount < newTotalUsedAmount){
errorMsg+="第"+(parseInt(index)+1)+"行,总共分摊数量为"+newTotalUsedAmount+",大于出库数量"+realOutstockAmount+";\n";
}
}
});
if(errorMsg!==""){
this.$modal.msgWarning(errorMsg);
this.submitLoading=false;
return;
}
updateMesSaleOrderMaterials(this.saleOrderMaterialList).then(response => {
this.$modal.msgSuccess("保存成功");
this.submitLoading=false;
this.getList();
});
},
/** 导出按钮操作 */
handleExport() {
let saleorderCode = this.$route.query && this.$route.query.saleorderCode;
this.download('mes/saleOrder/exportSaleOrderMaterials', {
...this.queryParams
}, `物料情况使用_`+saleorderCode+`_${new Date().getTime()}.xlsx`)
}
}
};
</script>
Loading…
Cancel
Save