diff --git a/hw-api/hw-api-mes/src/main/java/com/hw/mes/api/domain/MesBaseMaterialInfo.java b/hw-api/hw-api-mes/src/main/java/com/hw/mes/api/domain/MesBaseMaterialInfo.java index e47ef66..3c21d83 100644 --- a/hw-api/hw-api-mes/src/main/java/com/hw/mes/api/domain/MesBaseMaterialInfo.java +++ b/hw-api/hw-api-mes/src/main/java/com/hw/mes/api/domain/MesBaseMaterialInfo.java @@ -149,6 +149,7 @@ public class MesBaseMaterialInfo extends BaseEntity private String selectType;//3是选择实际生产的物料信息,需要过滤是到511仓库的物料 + private BigDecimal stockAmount;//实际总库存 public Long getPurchasePriceUnitId() { return purchasePriceUnitId; @@ -458,6 +459,14 @@ public class MesBaseMaterialInfo extends BaseEntity this.selectType = selectType; } + public BigDecimal getStockAmount() { + return stockAmount; + } + + public void setStockAmount(BigDecimal stockAmount) { + this.stockAmount = stockAmount; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) diff --git a/hw-common/hw-common-log/src/main/java/com/hw/common/log/enums/BusinessType.java b/hw-common/hw-common-log/src/main/java/com/hw/common/log/enums/BusinessType.java index 7e9c8fc..8c818d6 100644 --- a/hw-common/hw-common-log/src/main/java/com/hw/common/log/enums/BusinessType.java +++ b/hw-common/hw-common-log/src/main/java/com/hw/common/log/enums/BusinessType.java @@ -163,4 +163,9 @@ public enum BusinessType * 暂停 */ PAUSE, + + /** + * 使用 + */ + USE, } diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/controller/MesAlarmInfoController.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/controller/MesAlarmInfoController.java new file mode 100644 index 0000000..07f176f --- /dev/null +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/controller/MesAlarmInfoController.java @@ -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 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 list = mesAlarmInfoService.selectMesAlarmInfoList(mesAlarmInfo); + ExcelUtil util = new ExcelUtil(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)); + } +} diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/controller/MesSaleOrderController.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/controller/MesSaleOrderController.java index 99b2001..7125a83 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/controller/MesSaleOrderController.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/controller/MesSaleOrderController.java @@ -6,9 +6,11 @@ import javax.servlet.http.HttpServletResponse; import com.hw.common.core.domain.R; import com.hw.common.security.annotation.InnerAuth; 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.MesSaleOrderRelate; import com.hw.mes.api.domain.vo.MesSaleOrderTransferVo; +import com.hw.mes.domain.MesSaleOrderMaterial; import com.hw.mes.service.IMesOrderBindService; import org.springframework.beans.factory.annotation.Autowired; 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 list = mesSaleOrderService.selectSaleOrderMaterialUsedInfos(mesSaleOrderMaterial); + return getDataTable(list); + } + + /** + * 修改销售订单信息 + */ + @RequiresPermissions("mes:saleOrder:used") + @Log(title = "销售订单物料使用", businessType = BusinessType.USE) + @PostMapping("/updateMesSaleOrderMaterials") + public AjaxResult updateMesSaleOrderMaterials(@RequestBody List 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 list = mesSaleOrderService.selectMesSaleOrderMaterialList(mesSaleOrderMaterial); + ExcelUtil util = new ExcelUtil(MesSaleOrderMaterial.class); + util.exportExcel(response, list, "销售订单使用物料情况数据"); + } + + /** * 库存转销售订单 */ diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/MesAlarmInfo.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/MesAlarmInfo.java new file mode 100644 index 0000000..4a24e71 --- /dev/null +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/MesAlarmInfo.java @@ -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 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 getMesStockAlarmDetailList() + { + return mesStockAlarmDetailList; + } + + public void setMesStockAlarmDetailList(List 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(); + } +} diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/MesSaleOrderMaterial.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/MesSaleOrderMaterial.java new file mode 100644 index 0000000..c76cca6 --- /dev/null +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/MesSaleOrderMaterial.java @@ -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(); + } +} diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/MesStockAlarmDetail.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/MesStockAlarmDetail.java new file mode 100644 index 0000000..78e52c7 --- /dev/null +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/MesStockAlarmDetail.java @@ -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(); + } +} diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/mapper/MesAlarmInfoMapper.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/mapper/MesAlarmInfoMapper.java new file mode 100644 index 0000000..27fd88c --- /dev/null +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/mapper/MesAlarmInfoMapper.java @@ -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 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 mesStockAlarmDetailList); + + + /** + * 通过生产告警信息主键删除库存告警信息明细信息 + * + * @param alarmInfoId 生产告警信息ID + * @return 结果 + */ + public int deleteMesStockAlarmDetailByAlarmInfoId(Long alarmInfoId); +} diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/mapper/MesBaseMaterialInfoMapper.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/mapper/MesBaseMaterialInfoMapper.java index d35be6a..002e5c4 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/mapper/MesBaseMaterialInfoMapper.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/mapper/MesBaseMaterialInfoMapper.java @@ -94,4 +94,15 @@ public interface MesBaseMaterialInfoMapper * @return 物料信息 */ public MesBaseMaterialInfo selectMesBaseMaterialInfoByErpId(Long erpId); + + + /** + * 查询物料信息及其库存信息 + * + * @param mesBaseMaterialInfo 物料信息 + * @return 物料信息集合 + */ + public List selectMaterialInfoStockInfos(MesBaseMaterialInfo mesBaseMaterialInfo); + + } diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/mapper/MesSaleOrderMaterialMapper.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/mapper/MesSaleOrderMaterialMapper.java new file mode 100644 index 0000000..78251bf --- /dev/null +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/mapper/MesSaleOrderMaterialMapper.java @@ -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 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 mesSaleOrderMaterialList); + + + /** + * 查询销售订单易耗品使用物料情况列表 + * + * @param mesSaleOrderMaterial 销售订单使用物料情况 + * @return 销售订单使用物料情况集合 + */ + public List selectSaleOrderMaterialUsedInfos(MesSaleOrderMaterial mesSaleOrderMaterial); + + + +} diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/IMesAlarmInfoService.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/IMesAlarmInfoService.java new file mode 100644 index 0000000..168b4ef --- /dev/null +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/IMesAlarmInfoService.java @@ -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 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); +} diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/IMesSaleOrderMaterialService.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/IMesSaleOrderMaterialService.java new file mode 100644 index 0000000..39164ae --- /dev/null +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/IMesSaleOrderMaterialService.java @@ -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 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); +} diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/IMesSaleOrderService.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/IMesSaleOrderService.java index cf873a4..88d9703 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/IMesSaleOrderService.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/IMesSaleOrderService.java @@ -3,9 +3,12 @@ package com.hw.mes.service; import java.util.List; 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.vo.MesSaleOrderTransferVo; import com.hw.mes.domain.MesSaleOrder; +import com.hw.mes.domain.MesSaleOrderMaterial; +import org.springframework.transaction.annotation.Transactional; /** * 销售订单信息Service接口 @@ -98,4 +101,24 @@ public interface IMesSaleOrderService * @return */ public List selectMesSaleOrderRelateJoinProductList(MesSaleOrderRelate mesSaleOrderRelate); + + /** + * 获取易耗品物料的出库数量和分摊使用数量情况 + * @return + */ + public List selectSaleOrderMaterialUsedInfos(MesSaleOrderMaterial mesSaleOrderMaterial); + + /** + * 获取易耗品物料的分摊使用数量情况 + * + * @return + */ + public List selectMesSaleOrderMaterialList(MesSaleOrderMaterial mesSaleOrderMaterial); + + /** + * 更新销售订单分摊使用物料信息 + * @param mesSaleOrderMaterialList + * @return + */ + public int updateMesSaleOrderMaterials(List mesSaleOrderMaterialList); } diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesAlarmInfoServiceImpl.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesAlarmInfoServiceImpl.java new file mode 100644 index 0000000..afa1f51 --- /dev/null +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesAlarmInfoServiceImpl.java @@ -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 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 mesStockAlarmDetailList = mesAlarmInfo.getMesStockAlarmDetailList(); + Long alarmInfoId = mesAlarmInfo.getAlarmInfoId(); + if (StringUtils.isNotNull(mesStockAlarmDetailList)) + { + List list = new ArrayList(); + for (MesStockAlarmDetail mesStockAlarmDetail : mesStockAlarmDetailList) + { + mesStockAlarmDetail.setAlarmInfoId(alarmInfoId); + list.add(mesStockAlarmDetail); + } + if (list.size() > 0) + { + mesAlarmInfoMapper.batchMesStockAlarmDetail(list); + } + } + } +} diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesBaseMaterialInfoServiceImpl.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesBaseMaterialInfoServiceImpl.java index 420c56b..f597d18 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesBaseMaterialInfoServiceImpl.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesBaseMaterialInfoServiceImpl.java @@ -3,11 +3,15 @@ package com.hw.mes.service.impl; import java.math.BigDecimal; import java.util.List; +import com.github.pagehelper.PageHelper; 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.sql.SqlUtil; 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.mes.mapper.MesBaseBarcodeInfoMapper; 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.api.domain.MesBaseMaterialInfo; import com.hw.mes.service.IMesBaseMaterialInfoService; +import org.springframework.transaction.annotation.Transactional; /** * 物料信息Service业务层处理 @@ -173,4 +178,38 @@ public class MesBaseMaterialInfoServiceImpl implements IMesBaseMaterialInfoServi public MesBaseMaterialInfo selectMesBaseMaterialInfoByErpId(Long 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 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()); + } + + + } } diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesSaleOrderMaterialServiceImpl.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesSaleOrderMaterialServiceImpl.java new file mode 100644 index 0000000..8011d7e --- /dev/null +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesSaleOrderMaterialServiceImpl.java @@ -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 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); + } +} diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesSaleOrderServiceImpl.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesSaleOrderServiceImpl.java index ebc515c..4242491 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesSaleOrderServiceImpl.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesSaleOrderServiceImpl.java @@ -5,20 +5,20 @@ import java.util.ArrayList; import java.util.Date; import java.util.List; +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.security.utils.SecurityUtils; 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.vo.MesBaseBarcodeInfoTransferVo; import com.hw.mes.api.domain.vo.MesSaleOrderTransferVo; import com.hw.mes.domain.MesMaterialBom; -import com.hw.mes.mapper.MesBaseBarcodeInfoMapper; -import com.hw.mes.mapper.MesMaterialBomMapper; -import com.hw.mes.mapper.MesSaleOrderRelateMapper; +import com.hw.mes.domain.MesSaleOrderMaterial; +import com.hw.mes.mapper.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import com.hw.mes.mapper.MesSaleOrderMapper; import com.hw.mes.domain.MesSaleOrder; import com.hw.mes.service.IMesSaleOrderService; import org.springframework.transaction.annotation.Transactional; @@ -43,6 +43,12 @@ public class MesSaleOrderServiceImpl implements IMesSaleOrderService { @Autowired private MesMaterialBomMapper mesMaterialBomMapper; + @Autowired + private MesBaseMaterialInfoMapper mesBaseMaterialInfoMapper; + + @Autowired + private MesSaleOrderMaterialMapper mesSaleOrderMaterialMapper; + /** * 查询销售订单信息 * @@ -234,12 +240,85 @@ public class MesSaleOrderServiceImpl implements IMesSaleOrderService { /** * 获取销售订单关联信息表,join product + * * @param mesSaleOrderRelate * @return */ @Override - public List selectMesSaleOrderRelateJoinProductList(MesSaleOrderRelate mesSaleOrderRelate){ + public List selectMesSaleOrderRelateJoinProductList(MesSaleOrderRelate mesSaleOrderRelate) { return mesSaleOrderRelateMapper.selectMesSaleOrderRelateJoinProductList(mesSaleOrderRelate); } + + /** + * 获取易耗品物料的出库数量和分摊使用数量情况 + * + * @return + */ + @Override + public List selectSaleOrderMaterialUsedInfos(MesSaleOrderMaterial mesSaleOrderMaterial) { + List 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 selectMesSaleOrderMaterialList(MesSaleOrderMaterial mesSaleOrderMaterial) { + List 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 mesSaleOrderMaterialList) { + List toInsertedMesSaleOrderMaterialList = new ArrayList<>(); +// List 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; + } + } diff --git a/hw-modules/hw-mes/src/main/resources/mapper/mes/MesAlarmInfoMapper.xml b/hw-modules/hw-mes/src/main/resources/mapper/mes/MesAlarmInfoMapper.xml new file mode 100644 index 0000000..53b5a40 --- /dev/null +++ b/hw-modules/hw-mes/src/main/resources/mapper/mes/MesAlarmInfoMapper.xml @@ -0,0 +1,119 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select alarm_info_id, alarm_info_type, handle_status, create_by, create_date, update_by, update_date from mes_alarm_info + + + + + + + + insert into mes_alarm_info + + alarm_info_type, + handle_status, + create_by, + create_date, + update_by, + update_date, + + + #{alarmInfoType}, + #{handleStatus}, + #{createBy}, + #{createDate}, + #{updateBy}, + #{updateDate}, + + + + + update mes_alarm_info + + alarm_info_type = #{alarmInfoType}, + handle_status = #{handleStatus}, + create_by = #{createBy}, + create_date = #{createDate}, + update_by = #{updateBy}, + update_date = #{updateDate}, + + where alarm_info_id = #{alarmInfoId} + + + + delete from mes_alarm_info where alarm_info_id = #{alarmInfoId} + + + + delete from mes_alarm_info where alarm_info_id in + + #{alarmInfoId} + + + + + delete from mes_stock_alarm_detail where alarm_info_id in + + #{alarmInfoId} + + + + + delete from mes_stock_alarm_detail where alarm_info_id = #{alarmInfoId} + + + + 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 + + ( #{item.stockAlarmDetailId}, #{item.alarmInfoId}, #{item.materialId}, #{item.materialCode}, #{item.materialName}, #{item.materialSpec}, #{item.safeStockAmount}, #{item.stockAmount}, #{item.createBy}, #{item.createDate}, #{item.updateBy}, #{item.updateDate}) + + + \ No newline at end of file diff --git a/hw-modules/hw-mes/src/main/resources/mapper/mes/MesBaseMaterialInfoMapper.xml b/hw-modules/hw-mes/src/main/resources/mapper/mes/MesBaseMaterialInfoMapper.xml index 263c7f3..944582b 100644 --- a/hw-modules/hw-mes/src/main/resources/mapper/mes/MesBaseMaterialInfoMapper.xml +++ b/hw-modules/hw-mes/src/main/resources/mapper/mes/MesBaseMaterialInfoMapper.xml @@ -44,6 +44,11 @@ + + + + + @@ -371,4 +376,28 @@ where bmi.material_code = #{materialCode} limit 1 + + + + + + + + + + + + diff --git a/hw-modules/hw-mes/src/main/resources/mapper/mes/MesSaleOrderMapper.xml b/hw-modules/hw-mes/src/main/resources/mapper/mes/MesSaleOrderMapper.xml index ac50833..27f17bb 100644 --- a/hw-modules/hw-mes/src/main/resources/mapper/mes/MesSaleOrderMapper.xml +++ b/hw-modules/hw-mes/src/main/resources/mapper/mes/MesSaleOrderMapper.xml @@ -272,7 +272,7 @@ and not exists (select 1 from mes_sale_order_relate msor where mso.sale_order_id = msor.relate_sale_order_id) and exists (select 1 from mes_material_bom mmb where mmb.erp_material_id=mso.material_id and mmb.material_bom_id in (${parentIds})) - order by mso.erp_modify_date desc + order by mso.saleorder_code,mso.erp_modify_date desc diff --git a/hw-modules/hw-mes/src/main/resources/mapper/mes/MesSaleOrderMaterialMapper.xml b/hw-modules/hw-mes/src/main/resources/mapper/mes/MesSaleOrderMaterialMapper.xml new file mode 100644 index 0000000..f4103b9 --- /dev/null +++ b/hw-modules/hw-mes/src/main/resources/mapper/mes/MesSaleOrderMaterialMapper.xml @@ -0,0 +1,137 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + + + + + + insert into mes_sale_order_material + + saleorder_code, + material_id, + material_code, + material_name, + material_spec, + real_outstock_amount, + used_amount, + create_by, + create_time, + update_by, + update_time, + + + #{saleorderCode}, + #{materialId}, + #{materialCode}, + #{materialName}, + #{materialSpec}, + #{outstockAmount}, + #{usedAmount}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update mes_sale_order_material + + saleorder_code = #{saleorderCode}, + material_id = #{materialId}, + material_code = #{materialCode}, + material_name = #{materialName}, + material_spec = #{materialSpec}, + real_outstock_amount = #{realOutstockAmount}, + used_amount = #{usedAmount}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where sale_order_material_id = #{saleOrderMaterialId} + + + + delete from mes_sale_order_material where sale_order_material_id = #{saleOrderMaterialId} + + + + delete from mes_sale_order_material where sale_order_material_id in + + #{saleOrderMaterialId} + + + + + + + + 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 + + ( #{item.saleOrderMaterialId}, #{item.saleorderCode}, #{item.materialId}, #{item.materialCode}, #{item.materialName}, #{item.materialSpec}, #{item.outstockAmount}, #{item.usedAmount}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime}) + + + + + + + \ No newline at end of file diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsRawOutstockServiceImpl.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsRawOutstockServiceImpl.java index 8af42df..e9f6a3b 100644 --- a/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsRawOutstockServiceImpl.java +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsRawOutstockServiceImpl.java @@ -247,7 +247,6 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService { throw new ServiceException("请输入审核意见"); } wmsRawOutstocks.forEach(wmsRawOutstock -> { - //todo:批次码 Long stockTotalId = wmsRawOutstock.getStockTotalId(); BigDecimal planAmount = wmsRawOutstock.getOutstockAmount(); WmsStockTotal wmsStockTotal = wmsStockTotalMapper.selectWmsStockTotalByStockTotalId(stockTotalId); diff --git a/hw-ui/src/api/mes/saleOrder.js b/hw-ui/src/api/mes/saleOrder.js index 0dbac69..9667337 100644 --- a/hw-ui/src/api/mes/saleOrder.js +++ b/hw-ui/src/api/mes/saleOrder.js @@ -63,3 +63,32 @@ export function selectSaleOrderRelates(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 + }) +} diff --git a/hw-ui/src/api/mes/saleOrderMaterial.js b/hw-ui/src/api/mes/saleOrderMaterial.js new file mode 100644 index 0000000..0de6a72 --- /dev/null +++ b/hw-ui/src/api/mes/saleOrderMaterial.js @@ -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' + }) +} diff --git a/hw-ui/src/router/index.js b/hw-ui/src/router/index.js index 07d4a63..ef3f742 100644 --- a/hw-ui/src/router/index.js +++ b/hw-ui/src/router/index.js @@ -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', component: Layout, diff --git a/hw-ui/src/views/mes/productOrder/index.vue b/hw-ui/src/views/mes/productOrder/index.vue index da16ae3..8f1c122 100644 --- a/hw-ui/src/views/mes/productOrder/index.vue +++ b/hw-ui/src/views/mes/productOrder/index.vue @@ -1084,8 +1084,8 @@ export default { let selectedRow = this.$refs.productOrderRef.selectedRow; this.form.preOrderId = selectedRow.productOrderId; this.form.preOrderCode = selectedRow.orderCode; - if (selectedRow.planBeginTime != null && this.form.planBeginTime == null) { - const date = new Date(selectedRow.planBeginTime); + if (selectedRow.planEndTime != null && selectedRow.planEndTime !=='') { + const date = new Date(selectedRow.planEndTime); date.setDate(date.getDate() + 1) this.form.planBeginTime = parseTime(date, '{y}-{m}-{d} {h}:{i}:{s}'); } @@ -1309,6 +1309,19 @@ export default { this.submitLoading = false; 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) { updateProductOrder(this.form).then(response => { this.$modal.msgSuccess("修改成功"); diff --git a/hw-ui/src/views/mes/saleOrder/index.vue b/hw-ui/src/views/mes/saleOrder/index.vue index 375dc4a..15329ff 100644 --- a/hw-ui/src/views/mes/saleOrder/index.vue +++ b/hw-ui/src/views/mes/saleOrder/index.vue @@ -118,122 +118,142 @@ - - 同步 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + 物料使用情况导出 + + + 同步 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -641,9 +661,23 @@ export default { }).then(() => { this.$modal.msgSuccess("执行成功"); }).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`) + } + } }; diff --git a/hw-ui/src/views/mes/saleOrderMaterial/index.vue b/hw-ui/src/views/mes/saleOrderMaterial/index.vue new file mode 100644 index 0000000..d7d7b8f --- /dev/null +++ b/hw-ui/src/views/mes/saleOrderMaterial/index.vue @@ -0,0 +1,356 @@ + + +