From a3b8743a1cdfa7ff3b1910f31746b2f17d2caaab Mon Sep 17 00:00:00 2001 From: Kelvin Date: Thu, 31 Oct 2024 10:25:01 +0800 Subject: [PATCH 1/4] =?UTF-8?q?refactor:=20=E7=94=9F=E6=88=90=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E6=A8=A1=E5=9D=97=EF=BC=8C=E8=BE=BE=E6=A2=A6=E9=80=82?= =?UTF-8?q?=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/WmsBusinessTypeController.java | 104 ++++++ .../ktg/mes/md/domain/WmsBusinessType.java | 339 ++++++++++++++++++ .../mes/md/mapper/WmsBusinessTypeMapper.java | 61 ++++ .../md/service/IWmsBusinessTypeService.java | 61 ++++ .../impl/WmsBusinessTypeServiceImpl.java | 95 +++++ .../mapper/md/WmsBusinessTypeMapper.xml | 181 ++++++++++ 6 files changed, 841 insertions(+) create mode 100644 ktg-mes/src/main/java/com/ktg/mes/md/controller/WmsBusinessTypeController.java create mode 100644 ktg-mes/src/main/java/com/ktg/mes/md/domain/WmsBusinessType.java create mode 100644 ktg-mes/src/main/java/com/ktg/mes/md/mapper/WmsBusinessTypeMapper.java create mode 100644 ktg-mes/src/main/java/com/ktg/mes/md/service/IWmsBusinessTypeService.java create mode 100644 ktg-mes/src/main/java/com/ktg/mes/md/service/impl/WmsBusinessTypeServiceImpl.java create mode 100644 ktg-mes/src/main/resources/mapper/md/WmsBusinessTypeMapper.xml diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/controller/WmsBusinessTypeController.java b/ktg-mes/src/main/java/com/ktg/mes/md/controller/WmsBusinessTypeController.java new file mode 100644 index 0000000..80f2dc4 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/controller/WmsBusinessTypeController.java @@ -0,0 +1,104 @@ +package com.ktg.mes.md.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +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.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.md.domain.WmsBusinessType; +import com.ktg.mes.md.service.IWmsBusinessTypeService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 出入库类型Controller + * + * @author yinjinlu + * @date 2024-10-31 + */ +@RestController +@RequestMapping("/md/TYPE") +public class WmsBusinessTypeController extends BaseController +{ + @Autowired + private IWmsBusinessTypeService wmsBusinessTypeService; + + /** + * 查询出入库类型列表 + */ + @PreAuthorize("@ss.hasPermi('md:TYPE:list')") + @GetMapping("/list") + public TableDataInfo list(WmsBusinessType wmsBusinessType) + { + startPage(); + List list = wmsBusinessTypeService.selectWmsBusinessTypeList(wmsBusinessType); + return getDataTable(list); + } + + /** + * 导出出入库类型列表 + */ + @PreAuthorize("@ss.hasPermi('md:TYPE:export')") + @Log(title = "出入库类型", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, WmsBusinessType wmsBusinessType) + { + List list = wmsBusinessTypeService.selectWmsBusinessTypeList(wmsBusinessType); + ExcelUtil util = new ExcelUtil(WmsBusinessType.class); + util.exportExcel(response, list, "出入库类型数据"); + } + + /** + * 获取出入库类型详细信息 + */ + @PreAuthorize("@ss.hasPermi('md:TYPE:query')") + @GetMapping(value = "/{typeId}") + public AjaxResult getInfo(@PathVariable("typeId") String typeId) + { + return AjaxResult.success(wmsBusinessTypeService.selectWmsBusinessTypeByTypeId(typeId)); + } + + /** + * 新增出入库类型 + */ + @PreAuthorize("@ss.hasPermi('md:TYPE:add')") + @Log(title = "出入库类型", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WmsBusinessType wmsBusinessType) + { + return toAjax(wmsBusinessTypeService.insertWmsBusinessType(wmsBusinessType)); + } + + /** + * 修改出入库类型 + */ + @PreAuthorize("@ss.hasPermi('md:TYPE:edit')") + @Log(title = "出入库类型", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WmsBusinessType wmsBusinessType) + { + return toAjax(wmsBusinessTypeService.updateWmsBusinessType(wmsBusinessType)); + } + + /** + * 删除出入库类型 + */ + @PreAuthorize("@ss.hasPermi('md:TYPE:remove')") + @Log(title = "出入库类型", businessType = BusinessType.DELETE) + @DeleteMapping("/{typeIds}") + public AjaxResult remove(@PathVariable String[] typeIds) + { + return toAjax(wmsBusinessTypeService.deleteWmsBusinessTypeByTypeIds(typeIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/domain/WmsBusinessType.java b/ktg-mes/src/main/java/com/ktg/mes/md/domain/WmsBusinessType.java new file mode 100644 index 0000000..bfc5115 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/domain/WmsBusinessType.java @@ -0,0 +1,339 @@ +package com.ktg.mes.md.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 出入库类型对象 WMS_BUSINESS_TYPE + * + * @author yinjinlu + * @date 2024-10-31 + */ +public class WmsBusinessType extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String typeId; + + /** + * 修改日期 + */ + @Excel(name = "修改日期") + private String modifyDate; + + /** + * 激活标识(0激活1冻结) + */ + @Excel(name = "激活标识(0激活1冻结)") + private String isActive; + + /** + * 删除标识(0未删除1删除) + */ + @Excel(name = "删除标识(0未删除1删除)") + private String isDelete; + + /** + * 类型编码 + */ + @Excel(name = "类型编码") + private String code; + + /** + * 类型名称 + */ + @Excel(name = "类型名称") + private String name; + + /** + * 业务标识:1入库;2出库; + */ + @Excel(name = "业务标识:1入库;2出库;") + private String flag; + + /** 业务分类:01-采购入库 02-生产入库 03-生产退料 04-委外入库 05-委外退料 06-销售退货 07-调拨入库 08-盘盈入库 09-其它入库 + 61-生产领料 62-销售出库 63-采购退料 64-委外发料 65-生产补料 67-调拨出库 68-盘盈出库 69-其他出库 */ + @Excel(name = "业务分类:01-采购入库 02-生产入库 03-生产退料 04-委外入库 05-委外退料 06-销售退货 07-调拨入库 08-盘盈入库 09-其它入库 61-生产领料 62-销售出库 63-采购退料 64-委外发料 65-生产补料 67-调拨出库 68-盘盈出库 69-其他出库") + private String type; + + /** 是否默认:0否;1是 */ + @Excel(name = "是否默认:0否;1是") + private String isDefault; + + /** 是否全局应用:0否;1是 */ + @Excel(name = "是否全局应用:0否;1是") + private String isGlobal; + + /** 是否需要上架:0否;1是 */ + @Excel(name = "是否需要上架:0否;1是") + private String isNeedUp; + + /** 质检类型:0-不质检,1-先质检后上架,2-先上架后质检 */ + @Excel(name = "质检类型:0-不质检,1-先质检后上架,2-先上架后质检 ") + private String qualityType; + + /** 是否出库复核:0否;1是 */ + @Excel(name = "是否出库复核:0否;1是") + private String isOutboundReview; + + /** 波次策略 */ + @Excel(name = "波次策略") + private String waveStrategy; + + /** 是否允许多次收发:0否;1是 */ + @Excel(name = "是否允许多次收发:0否;1是") + private String isMultipleAllowed; + + /** 是否允许不足量完成任务:0否;1是 */ + @Excel(name = "是否允许不足量完成任务:0否;1是") + private String isShortageAllowed; + + /** 是否允许超量收发:0否;1是 */ + @Excel(name = "是否允许超量收发:0否;1是") + private String isExcessAllowed; + + /** 是否整单过账:0否;1是 */ + @Excel(name = "是否整单过账:0否;1是") + private String isWholeOrderPost; + + /** 是否允许手工新建:0否;1是 */ + @Excel(name = "是否允许手工新建:0否;1是") + private String isManuallyCreate; + + /** 是否无任务作业:0否;1是 */ + @Excel(name = "是否无任务作业:0否;1是") + private String isNoTask; + + /** 是否允许负库存:0否;1是 */ + @Excel(name = "是否允许负库存:0否;1是") + private String isNegativeInv; + + /** 是否安全库存检查:0否;1是 */ + @Excel(name = "是否安全库存检查:0否;1是") + private String isCheckSafetyStock; + + /** 是否记录入库时间:0否;1是 */ + @Excel(name = "是否记录入库时间:0否;1是") + private String isRecordInboundTime; + + public void setTypeId(String typeId) { + this.typeId = typeId; + } + + public String getTypeId() { + return typeId; + } + + public void setModifyDate(String modifyDate) { + this.modifyDate = modifyDate; + } + + public String getModifyDate() { + return modifyDate; + } + + public void setIsActive(String isActive) { + this.isActive = isActive; + } + + public String getIsActive() { + return isActive; + } + + public void setIsDelete(String isDelete) { + this.isDelete = isDelete; + } + + public String getIsDelete() { + return isDelete; + } + + public void setCode(String code) { + this.code = code; + } + + public String getCode() { + return code; + } + + public void setName(String name) { + this.name = name; + } + + public String getName() { + return name; + } + + public void setFlag(String flag) { + this.flag = flag; + } + + public String getFlag() { + return flag; + } + + public void setType(String type) { + this.type = type; + } + + public String getType() { + return type; + } + + public void setIsDefault(String isDefault) { + this.isDefault = isDefault; + } + + public String getIsDefault() { + return isDefault; + } + + public void setIsGlobal(String isGlobal) { + this.isGlobal = isGlobal; + } + + public String getIsGlobal() { + return isGlobal; + } + + public void setIsNeedUp(String isNeedUp) { + this.isNeedUp = isNeedUp; + } + + public String getIsNeedUp() { + return isNeedUp; + } + + public void setQualityType(String qualityType) { + this.qualityType = qualityType; + } + + public String getQualityType() { + return qualityType; + } + + public void setIsOutboundReview(String isOutboundReview) { + this.isOutboundReview = isOutboundReview; + } + + public String getIsOutboundReview() { + return isOutboundReview; + } + + public void setWaveStrategy(String waveStrategy) { + this.waveStrategy = waveStrategy; + } + + public String getWaveStrategy() { + return waveStrategy; + } + + public void setIsMultipleAllowed(String isMultipleAllowed) { + this.isMultipleAllowed = isMultipleAllowed; + } + + public String getIsMultipleAllowed() { + return isMultipleAllowed; + } + + public void setIsShortageAllowed(String isShortageAllowed) { + this.isShortageAllowed = isShortageAllowed; + } + + public String getIsShortageAllowed() { + return isShortageAllowed; + } + + public void setIsExcessAllowed(String isExcessAllowed) { + this.isExcessAllowed = isExcessAllowed; + } + + public String getIsExcessAllowed() { + return isExcessAllowed; + } + + public void setIsWholeOrderPost(String isWholeOrderPost) { + this.isWholeOrderPost = isWholeOrderPost; + } + + public String getIsWholeOrderPost() { + return isWholeOrderPost; + } + + public void setIsManuallyCreate(String isManuallyCreate) { + this.isManuallyCreate = isManuallyCreate; + } + + public String getIsManuallyCreate() { + return isManuallyCreate; + } + + public void setIsNoTask(String isNoTask) { + this.isNoTask = isNoTask; + } + + public String getIsNoTask() { + return isNoTask; + } + + public void setIsNegativeInv(String isNegativeInv) { + this.isNegativeInv = isNegativeInv; + } + + public String getIsNegativeInv() { + return isNegativeInv; + } + + public void setIsCheckSafetyStock(String isCheckSafetyStock) { + this.isCheckSafetyStock = isCheckSafetyStock; + } + + public String getIsCheckSafetyStock() { + return isCheckSafetyStock; + } + + public void setIsRecordInboundTime(String isRecordInboundTime) { + this.isRecordInboundTime = isRecordInboundTime; + } + + public String getIsRecordInboundTime() { + return isRecordInboundTime; + } + + @Override + public String toString() { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("typeId", getTypeId()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("modifyDate", getModifyDate()) + .append("isActive", getIsActive()) + .append("isDelete", getIsDelete()) + .append("code", getCode()) + .append("name", getName()) + .append("flag", getFlag()) + .append("type", getType()) + .append("isDefault", getIsDefault()) + .append("isGlobal", getIsGlobal()) + .append("isNeedUp", getIsNeedUp()) + .append("qualityType", getQualityType()) + .append("isOutboundReview", getIsOutboundReview()) + .append("waveStrategy", getWaveStrategy()) + .append("isMultipleAllowed", getIsMultipleAllowed()) + .append("isShortageAllowed", getIsShortageAllowed()) + .append("isExcessAllowed", getIsExcessAllowed()) + .append("isWholeOrderPost", getIsWholeOrderPost()) + .append("isManuallyCreate", getIsManuallyCreate()) + .append("isNoTask", getIsNoTask()) + .append("isNegativeInv", getIsNegativeInv()) + .append("isCheckSafetyStock", getIsCheckSafetyStock()) + .append("isRecordInboundTime", getIsRecordInboundTime()) + .append("remark", getRemark()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/mapper/WmsBusinessTypeMapper.java b/ktg-mes/src/main/java/com/ktg/mes/md/mapper/WmsBusinessTypeMapper.java new file mode 100644 index 0000000..788a112 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/mapper/WmsBusinessTypeMapper.java @@ -0,0 +1,61 @@ +package com.ktg.mes.md.mapper; + +import java.util.List; +import com.ktg.mes.md.domain.WmsBusinessType; + +/** + * 出入库类型Mapper接口 + * + * @author yinjinlu + * @date 2024-10-31 + */ +public interface WmsBusinessTypeMapper +{ + /** + * 查询出入库类型 + * + * @param typeId 出入库类型主键 + * @return 出入库类型 + */ + public WmsBusinessType selectWmsBusinessTypeByTypeId(String typeId); + + /** + * 查询出入库类型列表 + * + * @param wmsBusinessType 出入库类型 + * @return 出入库类型集合 + */ + public List selectWmsBusinessTypeList(WmsBusinessType wmsBusinessType); + + /** + * 新增出入库类型 + * + * @param wmsBusinessType 出入库类型 + * @return 结果 + */ + public int insertWmsBusinessType(WmsBusinessType wmsBusinessType); + + /** + * 修改出入库类型 + * + * @param wmsBusinessType 出入库类型 + * @return 结果 + */ + public int updateWmsBusinessType(WmsBusinessType wmsBusinessType); + + /** + * 删除出入库类型 + * + * @param typeId 出入库类型主键 + * @return 结果 + */ + public int deleteWmsBusinessTypeByTypeId(String typeId); + + /** + * 批量删除出入库类型 + * + * @param typeIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteWmsBusinessTypeByTypeIds(String[] typeIds); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/service/IWmsBusinessTypeService.java b/ktg-mes/src/main/java/com/ktg/mes/md/service/IWmsBusinessTypeService.java new file mode 100644 index 0000000..b9f18a7 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/service/IWmsBusinessTypeService.java @@ -0,0 +1,61 @@ +package com.ktg.mes.md.service; + +import java.util.List; +import com.ktg.mes.md.domain.WmsBusinessType; + +/** + * 出入库类型Service接口 + * + * @author yinjinlu + * @date 2024-10-31 + */ +public interface IWmsBusinessTypeService +{ + /** + * 查询出入库类型 + * + * @param typeId 出入库类型主键 + * @return 出入库类型 + */ + public WmsBusinessType selectWmsBusinessTypeByTypeId(String typeId); + + /** + * 查询出入库类型列表 + * + * @param wmsBusinessType 出入库类型 + * @return 出入库类型集合 + */ + public List selectWmsBusinessTypeList(WmsBusinessType wmsBusinessType); + + /** + * 新增出入库类型 + * + * @param wmsBusinessType 出入库类型 + * @return 结果 + */ + public int insertWmsBusinessType(WmsBusinessType wmsBusinessType); + + /** + * 修改出入库类型 + * + * @param wmsBusinessType 出入库类型 + * @return 结果 + */ + public int updateWmsBusinessType(WmsBusinessType wmsBusinessType); + + /** + * 批量删除出入库类型 + * + * @param typeIds 需要删除的出入库类型主键集合 + * @return 结果 + */ + public int deleteWmsBusinessTypeByTypeIds(String[] typeIds); + + /** + * 删除出入库类型信息 + * + * @param typeId 出入库类型主键 + * @return 结果 + */ + public int deleteWmsBusinessTypeByTypeId(String typeId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/WmsBusinessTypeServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/WmsBusinessTypeServiceImpl.java new file mode 100644 index 0000000..04848df --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/WmsBusinessTypeServiceImpl.java @@ -0,0 +1,95 @@ +package com.ktg.mes.md.service.impl; + +import java.util.List; +import com.ktg.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.md.mapper.WmsBusinessTypeMapper; +import com.ktg.mes.md.domain.WmsBusinessType; +import com.ktg.mes.md.service.IWmsBusinessTypeService; + +/** + * 出入库类型Service业务层处理 + * + * @author yinjinlu + * @date 2024-10-31 + */ +@Service +public class WmsBusinessTypeServiceImpl implements IWmsBusinessTypeService +{ + @Autowired + private WmsBusinessTypeMapper wmsBusinessTypeMapper; + + /** + * 查询出入库类型 + * + * @param typeId 出入库类型主键 + * @return 出入库类型 + */ + @Override + public WmsBusinessType selectWmsBusinessTypeByTypeId(String typeId) + { + return wmsBusinessTypeMapper.selectWmsBusinessTypeByTypeId(typeId); + } + + /** + * 查询出入库类型列表 + * + * @param wmsBusinessType 出入库类型 + * @return 出入库类型 + */ + @Override + public List selectWmsBusinessTypeList(WmsBusinessType wmsBusinessType) + { + return wmsBusinessTypeMapper.selectWmsBusinessTypeList(wmsBusinessType); + } + + /** + * 新增出入库类型 + * + * @param wmsBusinessType 出入库类型 + * @return 结果 + */ + @Override + public int insertWmsBusinessType(WmsBusinessType wmsBusinessType) + { + wmsBusinessType.setCreateTime(DateUtils.getNowDate()); + return wmsBusinessTypeMapper.insertWmsBusinessType(wmsBusinessType); + } + + /** + * 修改出入库类型 + * + * @param wmsBusinessType 出入库类型 + * @return 结果 + */ + @Override + public int updateWmsBusinessType(WmsBusinessType wmsBusinessType) + { + return wmsBusinessTypeMapper.updateWmsBusinessType(wmsBusinessType); + } + + /** + * 批量删除出入库类型 + * + * @param typeIds 需要删除的出入库类型主键 + * @return 结果 + */ + @Override + public int deleteWmsBusinessTypeByTypeIds(String[] typeIds) + { + return wmsBusinessTypeMapper.deleteWmsBusinessTypeByTypeIds(typeIds); + } + + /** + * 删除出入库类型信息 + * + * @param typeId 出入库类型主键 + * @return 结果 + */ + @Override + public int deleteWmsBusinessTypeByTypeId(String typeId) + { + return wmsBusinessTypeMapper.deleteWmsBusinessTypeByTypeId(typeId); + } +} diff --git a/ktg-mes/src/main/resources/mapper/md/WmsBusinessTypeMapper.xml b/ktg-mes/src/main/resources/mapper/md/WmsBusinessTypeMapper.xml new file mode 100644 index 0000000..c898f1b --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/md/WmsBusinessTypeMapper.xml @@ -0,0 +1,181 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select TYPE_ID, CREATE_BY, CREATE_TIME, UPDATE_BY, MODIFY_DATE, IS_ACTIVE, IS_DELETE, CODE, NAME, FLAG, TYPE, IS_DEFAULT, IS_GLOBAL, IS_NEED_UP, QUALITY_TYPE, IS_OUTBOUND_REVIEW, WAVE_STRATEGY, IS_MULTIPLE_ALLOWED, IS_SHORTAGE_ALLOWED, IS_EXCESS_ALLOWED, IS_WHOLE_ORDER_POST, IS_MANUALLY_CREATE, IS_NO_TASK, IS_NEGATIVE_INV, IS_CHECK_SAFETY_STOCK, IS_RECORD_INBOUND_TIME, REMARK from WMS_BUSINESS_TYPE + + + + + + + + insert into WMS_BUSINESS_TYPE + + CREATE_BY, + CREATE_TIME, + UPDATE_BY, + MODIFY_DATE, + IS_ACTIVE, + IS_DELETE, + CODE, + NAME, + FLAG, + TYPE, + IS_DEFAULT, + IS_GLOBAL, + IS_NEED_UP, + QUALITY_TYPE, + IS_OUTBOUND_REVIEW, + WAVE_STRATEGY, + IS_MULTIPLE_ALLOWED, + IS_SHORTAGE_ALLOWED, + IS_EXCESS_ALLOWED, + IS_WHOLE_ORDER_POST, + IS_MANUALLY_CREATE, + IS_NO_TASK, + IS_NEGATIVE_INV, + IS_CHECK_SAFETY_STOCK, + IS_RECORD_INBOUND_TIME, + REMARK, + + + #{createBy}, + #{createTime}, + #{updateBy}, + #{modifyDate}, + #{isActive}, + #{isDelete}, + #{code}, + #{name}, + #{flag}, + #{type}, + #{isDefault}, + #{isGlobal}, + #{isNeedUp}, + #{qualityType}, + #{isOutboundReview}, + #{waveStrategy}, + #{isMultipleAllowed}, + #{isShortageAllowed}, + #{isExcessAllowed}, + #{isWholeOrderPost}, + #{isManuallyCreate}, + #{isNoTask}, + #{isNegativeInv}, + #{isCheckSafetyStock}, + #{isRecordInboundTime}, + #{remark}, + + + + + update WMS_BUSINESS_TYPE + + CREATE_BY = #{createBy}, + CREATE_TIME = #{createTime}, + UPDATE_BY = #{updateBy}, + MODIFY_DATE = #{modifyDate}, + IS_ACTIVE = #{isActive}, + IS_DELETE = #{isDelete}, + CODE = #{code}, + NAME = #{name}, + FLAG = #{flag}, + TYPE = #{type}, + IS_DEFAULT = #{isDefault}, + IS_GLOBAL = #{isGlobal}, + IS_NEED_UP = #{isNeedUp}, + QUALITY_TYPE = #{qualityType}, + IS_OUTBOUND_REVIEW = #{isOutboundReview}, + WAVE_STRATEGY = #{waveStrategy}, + IS_MULTIPLE_ALLOWED = #{isMultipleAllowed}, + IS_SHORTAGE_ALLOWED = #{isShortageAllowed}, + IS_EXCESS_ALLOWED = #{isExcessAllowed}, + IS_WHOLE_ORDER_POST = #{isWholeOrderPost}, + IS_MANUALLY_CREATE = #{isManuallyCreate}, + IS_NO_TASK = #{isNoTask}, + IS_NEGATIVE_INV = #{isNegativeInv}, + IS_CHECK_SAFETY_STOCK = #{isCheckSafetyStock}, + IS_RECORD_INBOUND_TIME = #{isRecordInboundTime}, + REMARK = #{remark}, + + where TYPE_ID = #{typeId} + + + + delete from WMS_BUSINESS_TYPE where TYPE_ID = #{typeId} + + + + delete from WMS_BUSINESS_TYPE where TYPE_ID in + + #{typeId} + + + \ No newline at end of file From bbe7262a03e2a12edebe6e6cb295fffcb18ef962 Mon Sep 17 00:00:00 2001 From: Kelvin Date: Thu, 31 Oct 2024 10:48:08 +0800 Subject: [PATCH 2/4] =?UTF-8?q?refactor:=20=E5=87=BA=E5=85=A5=E5=BA=93?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=EF=BC=8C=E4=BF=AE=E6=94=B9=E4=B8=BA=E8=BD=AF?= =?UTF-8?q?=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/md/WmsBusinessTypeMapper.xml | 172 +++++++++++------- 1 file changed, 108 insertions(+), 64 deletions(-) diff --git a/ktg-mes/src/main/resources/mapper/md/WmsBusinessTypeMapper.xml b/ktg-mes/src/main/resources/mapper/md/WmsBusinessTypeMapper.xml index c898f1b..8f14512 100644 --- a/ktg-mes/src/main/resources/mapper/md/WmsBusinessTypeMapper.xml +++ b/ktg-mes/src/main/resources/mapper/md/WmsBusinessTypeMapper.xml @@ -1,80 +1,123 @@ + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - select TYPE_ID, CREATE_BY, CREATE_TIME, UPDATE_BY, MODIFY_DATE, IS_ACTIVE, IS_DELETE, CODE, NAME, FLAG, TYPE, IS_DEFAULT, IS_GLOBAL, IS_NEED_UP, QUALITY_TYPE, IS_OUTBOUND_REVIEW, WAVE_STRATEGY, IS_MULTIPLE_ALLOWED, IS_SHORTAGE_ALLOWED, IS_EXCESS_ALLOWED, IS_WHOLE_ORDER_POST, IS_MANUALLY_CREATE, IS_NO_TASK, IS_NEGATIVE_INV, IS_CHECK_SAFETY_STOCK, IS_RECORD_INBOUND_TIME, REMARK from WMS_BUSINESS_TYPE + select TYPE_ID, + CREATE_BY, + CREATE_TIME, + UPDATE_BY, + MODIFY_DATE, + IS_ACTIVE, + IS_DELETE, + CODE, + NAME, + FLAG, + TYPE, + IS_DEFAULT, + IS_GLOBAL, + IS_NEED_UP, + QUALITY_TYPE, + IS_OUTBOUND_REVIEW, + WAVE_STRATEGY, + IS_MULTIPLE_ALLOWED, + IS_SHORTAGE_ALLOWED, + IS_EXCESS_ALLOWED, + IS_WHOLE_ORDER_POST, + IS_MANUALLY_CREATE, + IS_NO_TASK, + IS_NEGATIVE_INV, + IS_CHECK_SAFETY_STOCK, + IS_RECORD_INBOUND_TIME, + REMARK + from WMS_BUSINESS_TYPE + where IS_DELETE = 0 - + - + insert into WMS_BUSINESS_TYPE @@ -104,7 +147,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" IS_CHECK_SAFETY_STOCK, IS_RECORD_INBOUND_TIME, REMARK, - + #{createBy}, #{createTime}, @@ -132,7 +175,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{isCheckSafetyStock}, #{isRecordInboundTime}, #{remark}, - + @@ -169,11 +212,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - delete from WMS_BUSINESS_TYPE where TYPE_ID = #{typeId} + update from WMS_BUSINESS_TYPE + where TYPE_ID = #{typeId} - delete from WMS_BUSINESS_TYPE where TYPE_ID in + update WMS_BUSINESS_TYPE set IS_DELETE = 1 where TYPE_ID in #{typeId} From 6d0a945aafa837d24f9555d3c4a1f5c3f9d3da3e Mon Sep 17 00:00:00 2001 From: Kelvin Date: Thu, 31 Oct 2024 14:12:13 +0800 Subject: [PATCH 3/4] =?UTF-8?q?refactor:=20=E5=88=86=E9=A1=B5=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=EF=BC=8C=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ktg-admin/src/main/resources/application.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ktg-admin/src/main/resources/application.yml b/ktg-admin/src/main/resources/application.yml index c080d41..bb9acb2 100644 --- a/ktg-admin/src/main/resources/application.yml +++ b/ktg-admin/src/main/resources/application.yml @@ -103,7 +103,7 @@ mybatis: # PageHelper分页插件 pagehelper: -# helperDialect: mysql + helperDialect: oracle supportMethodsArguments: true params: count=countSql From 6673efa2c02a9a33e63ad27488da89756d8037c5 Mon Sep 17 00:00:00 2001 From: star <2755454208@qq.com> Date: Thu, 31 Oct 2024 17:53:46 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E5=B7=A5=E8=A3=85=E5=AE=9A=E6=A3=80?= =?UTF-8?q?=E5=A2=9E=E5=88=A0=E6=94=B9=E6=9F=A5=E6=8E=A5=E5=8F=A3=E3=80=81?= =?UTF-8?q?=E5=AE=9A=E6=A3=80=E6=A8=A1=E5=9E=8B=E6=9F=A5=E8=AF=A2=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/InventoryTaskController.java | 95 ++++++ .../com/ktg/mes/qc/domain/InventoryTask.java | 288 ++++++++++++++++++ .../mes/qc/mapper/InventoryTaskMapper.java | 57 ++++ .../ktg/mes/qc/mapper/QcTemplateMapper.java | 8 + .../mes/qc/service/InventoryTaskService.java | 57 ++++ .../impl/InventoryTaskServiceImpl.java | 109 +++++++ .../mapper/qc/InventoryTaskMapper.xml | 127 ++++++++ .../resources/mapper/qc/QcTemplateMapper.xml | 3 + 8 files changed, 744 insertions(+) create mode 100644 ktg-mes/src/main/java/com/ktg/mes/qc/controller/InventoryTaskController.java create mode 100644 ktg-mes/src/main/java/com/ktg/mes/qc/domain/InventoryTask.java create mode 100644 ktg-mes/src/main/java/com/ktg/mes/qc/mapper/InventoryTaskMapper.java create mode 100644 ktg-mes/src/main/java/com/ktg/mes/qc/service/InventoryTaskService.java create mode 100644 ktg-mes/src/main/java/com/ktg/mes/qc/service/impl/InventoryTaskServiceImpl.java create mode 100644 ktg-mes/src/main/resources/mapper/qc/InventoryTaskMapper.xml diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/controller/InventoryTaskController.java b/ktg-mes/src/main/java/com/ktg/mes/qc/controller/InventoryTaskController.java new file mode 100644 index 0000000..dfd417c --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/controller/InventoryTaskController.java @@ -0,0 +1,95 @@ +package com.ktg.mes.qc.controller; + +import com.ktg.common.annotation.Log; +import com.ktg.common.constant.UserConstants; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.core.page.TableDataInfo; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.qc.domain.InventoryTask; +import com.ktg.mes.qc.domain.QcDefect; +import com.ktg.mes.qc.service.InventoryTaskService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +import static com.ktg.common.utils.PageUtils.startPage; + +/** + * 常见缺陷Controller + * + * @author yinjinlu + * @date 2022-05-19 + */ +@RestController +@RequestMapping("InventoryTaskController") +public class InventoryTaskController extends BaseController { + @Autowired + private InventoryTaskService inventoryTaskService; + + /** + * 查询定检任务列表 + */ + @GetMapping("/list") + public TableDataInfo list(InventoryTask inventoryTask) { + startPage(); + List list = inventoryTaskService.getList(inventoryTask); + return getDataTable(list); + } + + /** + * 修改任务 + */ + @PreAuthorize("@ss.hasPermi('mes:qc:qcdefect:edit')") + @Log(title = "定检任务", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody InventoryTask inventoryTask) + { + return toAjax(inventoryTaskService.updateInventoryTask(inventoryTask)); + } + + /** + * 新增计划 + */ + @PreAuthorize("@ss.hasPermi('mes:qc:qcdefect:add')") + @Log(title = "定检任务", businessType = BusinessType.INSERT) + @PostMapping("/save") + public AjaxResult add(@RequestBody InventoryTask inventoryTask) + { + return toAjax(inventoryTaskService.insertInventoryTask(inventoryTask)); + } + + /** + * 获取定检任务详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:qc:qcindex:query')") + @GetMapping(value = "/{wmsInventoryID}") + public AjaxResult getInfo(@PathVariable("wmsInventoryID") Long wmsInventoryID) + { + return AjaxResult.success(inventoryTaskService.selectInventoryTaskById(wmsInventoryID)); + } + + /** + * 删除 + */ + @PreAuthorize("@ss.hasPermi('mes:qc:qcdefect:remove')") + @Log(title = "定检任务", businessType = BusinessType.DELETE) + @DeleteMapping("/{wmsInventoryID}") + public AjaxResult remove(@PathVariable Long wmsInventoryID) + { + return toAjax(inventoryTaskService.delById(wmsInventoryID)); + } + + /** + * 批量删除 + */ + @PreAuthorize("@ss.hasPermi('mes:qc:qcdefect:remove')") + @Log(title = "定检任务", businessType = BusinessType.DELETE) + @DeleteMapping("del/{wmsInventoryIDs}") + public AjaxResult remove(@PathVariable Long[] wmsInventoryIDs) + { + return toAjax(inventoryTaskService.delByIds(wmsInventoryIDs)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/domain/InventoryTask.java b/ktg-mes/src/main/java/com/ktg/mes/qc/domain/InventoryTask.java new file mode 100644 index 0000000..bec6c63 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/domain/InventoryTask.java @@ -0,0 +1,288 @@ +package com.ktg.mes.qc.domain; + +import com.ktg.common.core.domain.BaseEntity; + +import java.sql.Timestamp; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; + +/** + * 工装定检对象对象 qc_defect + * + */ +public class InventoryTask extends BaseEntity { + private static final long serialVersionUID = 1L; + //id + private Long wmsInventoryID; + //编码 + private String wmsInventoryCode; + //名称 + private String name; + //分类Id + private String uomId; + //分类名称 + private String uomName; + //物料Id名称 + private String productId; + //物料名称 + private String productName; + //点检模型 + private String mrlModel; + //点检模型名称 + private String mrlModelName; + //点检周期 + private String mrlPeriod; + //计划规则 + private String planPeriod; + //开始时间 + private Timestamp startTime; + //结束时间 + private Timestamp finishTime; + //上次检测时间 + private Timestamp superiorTime; + //下次检测时间 + private Timestamp belowTime; + //工装定检预警 + private String mrlWarning; + //是否完成 + private String updatebby; + //是否删除 + private int isDelete; + //是否激活 + private int isActive; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + + + + + + + +// 其他 getter 和 setter 也需要相应地调整 + + + public String getMrlModel() { + return mrlModel; + } + + public void setMrlModel(String mrlModel) { + this.mrlModel = mrlModel; + } + + public String getMrlPeriod() { + return mrlPeriod; + } + + public void setMrlPeriod(String mrlPeriod) { + this.mrlPeriod = mrlPeriod; + } + + public String getPlanPeriod() { + return planPeriod; + } + + public void setPlanPeriod(String planPeriod) { + this.planPeriod = planPeriod; + } + + public Timestamp getStartTime() { + return startTime; + } + + public void setStartTime(String startTime) { + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); + try { + Date parsedDate = format.parse(startTime); + this.startTime = new Timestamp(parsedDate.getTime()); + } catch (ParseException e) { + e.printStackTrace(); + } + } + + public Timestamp getFinishTime() { + return finishTime; + } + + public void setFinishTime(String finishTime) { + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); + try { + Date parsedDate = format.parse(finishTime); + this.finishTime = new Timestamp(parsedDate.getTime()); + } catch (ParseException e) { + e.printStackTrace(); // 或记录日志,抛出自定义异常等 + } + } + + public Timestamp getSuperiorTime() { + return superiorTime; + } + + public void setSuperiorTime(String superiorTime) { + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); + try { + Date parsedDate = format.parse(superiorTime); + this.superiorTime = new Timestamp(parsedDate.getTime()); + } catch (ParseException e) { + e.printStackTrace(); // 或记录日志,抛出自定义异常等 + } + + } + + public Timestamp getBelowTime() { + return belowTime; + } + + public void setBelowTime(String belowTime) { + System.out.println(belowTime); + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); + try { + Date parsedDate = format.parse(belowTime); + this.belowTime = new Timestamp(parsedDate.getTime()); + } catch (ParseException e) { + e.printStackTrace(); // 或记录日志,抛出自定义异常等 + } + } + + public String getMrlWarning() { + return mrlWarning; + } + + public void setMrlWarning(String mrlWarning) { + this.mrlWarning = mrlWarning; + } + + public String getUpdatebby() { + return updatebby; + } + + public void setUpdatebby(String updatebby) { + this.updatebby = updatebby; + } + + public int getIsDelete() { + return isDelete; + } + + public void setIsDelete(int isDelete) { + this.isDelete = isDelete; + } + + public int getIsActive() { + return isActive; + } + + public void setIsActive(int isActive) { + this.isActive = isActive; + } + + + + + + public String getMrlModelName() { + return mrlModelName; + } + + public void setMrlModelName(String mrlModelName) { + this.mrlModelName = mrlModelName; + } + + + public Long getWmsInventoryID() { + return wmsInventoryID; + } + + public void setWmsInventoryID(Long wmsInventoryID) { + this.wmsInventoryID = wmsInventoryID; + } + + public String getWmsInventoryCode() { + return wmsInventoryCode; + } + + public void setWmsInventoryCode(String wmsInventoryCode) { + this.wmsInventoryCode = wmsInventoryCode; + } + + public String getUomId() { + return uomId; + } + + public void setUomId(String uomId) { + this.uomId = uomId; + } + + public String getUomName() { + return uomName; + } + + public void setUomName(String uomName) { + this.uomName = uomName; + } + + public String getProductId() { + return productId; + } + + public void setProductId(String productId) { + this.productId = productId; + } + + public String getProductName() { + return productName; + } + + public void setProductName(String productName) { + this.productName = productName; + } + + public void setStartTime(Timestamp startTime) { + this.startTime = startTime; + } + + public void setFinishTime(Timestamp finishTime) { + this.finishTime = finishTime; + } + + public void setSuperiorTime(Timestamp superiorTime) { + this.superiorTime = superiorTime; + } + + public void setBelowTime(Timestamp belowTime) { + this.belowTime = belowTime; + } + + @Override + public String toString() { + return "InventoryTask{" + + "wmsInventoryID=" + wmsInventoryID + + ", wmsInventoryCode='" + wmsInventoryCode + '\'' + + ", name='" + name + '\'' + + ", uomId='" + uomId + '\'' + + ", uomName='" + uomName + '\'' + + ", productId='" + productId + '\'' + + ", productName='" + productName + '\'' + + ", mrlModel='" + mrlModel + '\'' + + ", mrlModelName='" + mrlModelName + '\'' + + ", mrlPeriod='" + mrlPeriod + '\'' + + ", planPeriod='" + planPeriod + '\'' + + ", startTime=" + startTime + + ", finishTime=" + finishTime + + ", superiorTime=" + superiorTime + + ", belowTime=" + belowTime + + ", mrlWarning='" + mrlWarning + '\'' + + ", updatebby='" + updatebby + '\'' + + ", isDelete=" + isDelete + + ", isActive=" + isActive + + '}'; + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/mapper/InventoryTaskMapper.java b/ktg-mes/src/main/java/com/ktg/mes/qc/mapper/InventoryTaskMapper.java new file mode 100644 index 0000000..d2c4bb0 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/mapper/InventoryTaskMapper.java @@ -0,0 +1,57 @@ +package com.ktg.mes.qc.mapper; + +import com.ktg.mes.qc.domain.InventoryTask; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 工装定检Mapper接口 + * + */ +public interface InventoryTaskMapper { + + /** + * 查询工装定检任务 + * + * @param id 工装定检主键 + * @return 工装定检 + */ + public InventoryTask selectInventoryTaskById(@Param("Id") Long id); + + /** + * 查询工装定检任务集合 + * + * @param inventoryTask 工装定检对象 + * @return 工装定检集合 + */ + List getList(InventoryTask inventoryTask); + + /** + * 新增工装定检任务 + * @param inventoryTask + * @return + */ + public int insertInventoryTask(InventoryTask inventoryTask); + + /** + * 修改工装定检任务 + * @param inventoryTask + * @return + */ + public int updateInventoryTask(InventoryTask inventoryTask); + + /** + * 删除工装定检任务 + * @param id + * @return + */ + public int delById(@Param("Id") Long id); + + /** + * 批量删除工装定检任务 + * @param ids + * @return + */ + public int delByIds(@Param("list") Long[] ids); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/mapper/QcTemplateMapper.java b/ktg-mes/src/main/java/com/ktg/mes/qc/mapper/QcTemplateMapper.java index e8109b8..5dabcf1 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/qc/mapper/QcTemplateMapper.java +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/mapper/QcTemplateMapper.java @@ -4,6 +4,7 @@ import java.util.List; import com.ktg.mes.qc.domain.QcMobParam; import com.ktg.mes.qc.domain.QcTemplate; +import org.apache.ibatis.annotations.Select; /** * 检测模板Mapper接口 @@ -13,6 +14,13 @@ import com.ktg.mes.qc.domain.QcTemplate; */ public interface QcTemplateMapper { + /** + * 查询检测模板 + * + * @return 检测模板 + */ + public List getAll(); + /** * 查询检测模板 * diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/service/InventoryTaskService.java b/ktg-mes/src/main/java/com/ktg/mes/qc/service/InventoryTaskService.java new file mode 100644 index 0000000..6007320 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/service/InventoryTaskService.java @@ -0,0 +1,57 @@ +package com.ktg.mes.qc.service; + +import com.ktg.mes.qc.domain.InventoryTask; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 工装定检Service接口 + * + */ +public interface InventoryTaskService { + + /** + * 查询工装定检任务 + * + * @param id 工装定检主键 + * @return 工装定检 + */ + public InventoryTask selectInventoryTaskById(@Param("Id") Long id); + + /** + * 查询工装定检任务集合 + * + * @param id 工装定检对象 + * @return 工装定检集合 + */ + List getList(InventoryTask inventoryTask); + + /** + * 新增工装定检任务 + * @param inventoryTask + * @return + */ + public int insertInventoryTask(InventoryTask inventoryTask); + + /** + * 修改工装定检任务 + * @param inventoryTask + * @return + */ + public int updateInventoryTask(InventoryTask inventoryTask); + + /** + * 删除工装定检任务 + * @param id + * @return + */ + public int delById(Long id); + + /** + * 批量删除工装定检任务 + * @param ids + * @return + */ + public int delByIds(Long[] ids); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/qc/service/impl/InventoryTaskServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/qc/service/impl/InventoryTaskServiceImpl.java new file mode 100644 index 0000000..53f5d53 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/qc/service/impl/InventoryTaskServiceImpl.java @@ -0,0 +1,109 @@ +package com.ktg.mes.qc.service.impl; + +import com.ktg.common.utils.DateUtils; +import com.ktg.mes.md.domain.MdItem; +import com.ktg.mes.md.mapper.MdItemMapper; +import com.ktg.mes.qc.domain.InventoryTask; +import com.ktg.mes.qc.domain.QcTemplate; +import com.ktg.mes.qc.mapper.InventoryTaskMapper; +import com.ktg.mes.qc.mapper.QcDefectRecordMapper; +import com.ktg.mes.qc.mapper.QcTemplateMapper; +import com.ktg.mes.qc.service.InventoryTaskService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.sql.Timestamp; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; + +import static com.ktg.common.utils.SecurityUtils.getUsername; + +/** + * 工装定检Service业务层处理 + * + */ +@Service +public class InventoryTaskServiceImpl implements InventoryTaskService { + + @Autowired + private InventoryTaskMapper inventoryTaskMapper; + + @Autowired + private MdItemMapper mdItemMapper; + + @Autowired + private QcTemplateMapper qcTemplateMapper; + + @Override + public InventoryTask selectInventoryTaskById(Long id) { + InventoryTask inventoryTask = inventoryTaskMapper.selectInventoryTaskById(id); + QcTemplate qcTemplate = qcTemplateMapper.selectQcTemplateByTemplateId(Long.parseLong(inventoryTask.getMrlModel())); + inventoryTask.setMrlModelName(qcTemplate.getTemplateName()); + MdItem mdItem = mdItemMapper.selectMdItemById(Long.parseLong(inventoryTask.getProductId())); + inventoryTask.setProductName(mdItem.getItemName()); + inventoryTask.setUomName(mdItem.getItemTypeName()); + return inventoryTask; + } + + @Override + public List getList(InventoryTask inventoryTask) { + List list = inventoryTaskMapper.getList(inventoryTask); + List qcTemplates = qcTemplateMapper.getAll(); + for (InventoryTask task : list) { + for (QcTemplate qcTemplate : qcTemplates) { + if (Long.parseLong(task.getMrlModel()) == qcTemplate.getTemplateId()) + task.setMrlModelName(qcTemplate.getTemplateName()); + } + } + List mdItems = mdItemMapper.selectMdItemAll(); + for (InventoryTask task : list) { + for (MdItem mdItem : mdItems) { + if (Long.parseLong(task.getProductId()) == mdItem.getItemId()) { + task.setProductName(mdItem.getItemName()); + task.setUomName(mdItem.getItemTypeName()); + } + } + } + return list; + } + + @Override + public int insertInventoryTask(InventoryTask inventoryTask) { + String s = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); + inventoryTask.setCreateBy(getUsername()); + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); + try { + Date parsedDate = format.parse(s); + inventoryTask.setCreateTime(parsedDate); + } catch (ParseException e) { + e.printStackTrace(); // 或记录日志,抛出自定义异常等 + } + return inventoryTaskMapper.insertInventoryTask(inventoryTask); + } + + @Override + public int updateInventoryTask(InventoryTask inventoryTask) { +// String s = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); +// inventoryTask.setUpdatebby(getUsername()); +// SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); +// try { +// Date parsedDate = format.parse(s); +// inventoryTask.setUpdateTime(parsedDate); +// } catch (ParseException e) { +// e.printStackTrace(); // 或记录日志,抛出自定义异常等 +// } + return inventoryTaskMapper.updateInventoryTask(inventoryTask); + } + + @Override + public int delById(Long id) { + return inventoryTaskMapper.delById(id); + } + + @Override + public int delByIds(Long[] ids) { + return inventoryTaskMapper.delByIds(ids); + } +} diff --git a/ktg-mes/src/main/resources/mapper/qc/InventoryTaskMapper.xml b/ktg-mes/src/main/resources/mapper/qc/InventoryTaskMapper.xml new file mode 100644 index 0000000..a926a0d --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/qc/InventoryTaskMapper.xml @@ -0,0 +1,127 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select WMS_INVENTORY_ID,WMS_UNVENTORY_CODE,M_UOM_ID,NAME,MRL_MODEL,M_PRODUCT_ID,MRL_PERIOD,PLAN_PERIOD,START_TIME,FINISH_TIME ,REMARK,create_by,create_time,update_by,update_time,SUPERIOR_TIME,BELOW_TIME,MRL_WARNING from WMS_INVENTORY + + + insert into wms_inventory + + WMS_UNVENTORY_CODE, + NAME , + M_UOM_ID, + M_PRODUCT_ID, + MRL_MODEL, + MRL_PERIOD, + PLAN_PERIOD, + START_TIME, + FINISH_TIME, + SUPERIOR_TIME, + BELOW_TIME, + MRL_WARNING, + create_by, + create_time, + update_by, + update_time, + + + #{wmsInventoryCode}, + #{name}, + #{uomId}, + #{productId}, + #{mrlModel}, + #{mrlPeriod}, + #{planPeriod}, + #{startTime}, + #{finishTime}, + #{superiorTime}, + #{belowTime}, + #{mrlWarning}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + update wms_inventory + + WMS_UNVENTORY_CODE = #{wmsInventoryCode}, + m_uom_id = #{uomId}, + m_product_id = #{productId}, + name = #{name}, + mrl_model = #{mrlModel}, + mrl_period = #{mrlPeriod}, + plan_period = #{planPeriod}, + start_time = #{startTime}, + finish_time = #{finishTime}, + superior_time = #{superiorTime}, + below_time = #{belowTime}, + mrl_warning = #{mrlWarning}, + updatebby = #{updatebby}, + is_delete = #{isDelete}, + is_active = #{isActive}, + create_by=#{createBy}, + create_time=#{createTime}, + update_by=#{updateBy}, + update_by=#{updateTime}, + + where wms_inventory_id = #{wmsInventoryID} + + + + update wms_inventory set is_delete = 1 where WMS_INVENTORY_ID = #{Id} + + + update wms_inventory + set is_delete = 1 + where wms_inventory_id in + + #{id} + + + + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/qc/QcTemplateMapper.xml b/ktg-mes/src/main/resources/mapper/qc/QcTemplateMapper.xml index 7c53bc2..6b54df2 100644 --- a/ktg-mes/src/main/resources/mapper/qc/QcTemplateMapper.xml +++ b/ktg-mes/src/main/resources/mapper/qc/QcTemplateMapper.xml @@ -62,6 +62,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and t.qc_types like concat('%',#{qcType},'%') limit 1 + insert into qc_template