diff --git a/ktg-mes/src/main/java/com/ktg/mes/config/BizConfig.java b/ktg-mes/src/main/java/com/ktg/mes/config/BizConfig.java new file mode 100644 index 0000000..fa39d37 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/config/BizConfig.java @@ -0,0 +1,154 @@ +package com.ktg.mes.config; + +import com.ktg.mes.md.domain.*; +import com.ktg.mes.md.mapper.*; +import com.ktg.mes.wm.domain.WmStorageArea; +import com.ktg.mes.wm.domain.WmStorageLocation; +import com.ktg.mes.wm.mapper.WmStorageAreaMapper; +import com.ktg.mes.wm.mapper.WmStorageLocationMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Configuration; +import org.springframework.scheduling.annotation.EnableScheduling; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.transaction.annotation.Transactional; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.*; + +@Configuration +@EnableScheduling +public class BizConfig { + @Autowired + private WmsInventoryConfigureMapper wmsInventoryConfigureMapper; + + @Autowired + private WmStorageLocationMapper wmStorageLocationMapper; + + @Autowired + private WmStorageAreaMapper wmStorageAreaMapper; + + @Autowired + private BaseKnifeMapper baseKnifeMapper; + + @Autowired + private MdItemMapper mdItemMapper; + + @Autowired + private MdUnitMeasureMapper mdUnitMeasureMapper; + + @Autowired + private WmsInventoryPlanMapper wmsInventoryPlanMapper; + + @Autowired + private WmsInventoryMapper wmsInventoryMapper; + + @Transactional + @Scheduled(fixedDelay = 1000 * 60) + public void configureTasks() { + // 获取当前时间字符串 + Date nowDate = new Date(System.currentTimeMillis()); + String nowDateTimeStr = new SimpleDateFormat("HH:mm").format(nowDate); + + // 判断是否到达目标时间 + if ("00:00".equals(nowDateTimeStr)) { + /* 集合存储物料实体集合 */ + HashMap>> superBaseKnifeListHashMap = new HashMap<>(); + + /* 获得全部日盘且全盘的盘点计划配置 */ + WmsInventoryConfigure wmsInventoryConfigureQuery = new WmsInventoryConfigure(); + wmsInventoryConfigureQuery.setDataType("RP"); + wmsInventoryConfigureQuery.setInventoryType("QP"); + List wmsInventoryConfigureList = wmsInventoryConfigureMapper.selectWmsInventoryConfigureList(wmsInventoryConfigureQuery); + wmsInventoryConfigureList.forEach(wmsInventoryConfigure -> { + /* 开始时间与结束时间 */ + String nowDateStr = new SimpleDateFormat("yyyy-MM-dd").format(nowDate); + Date startTime = nowDate; + Date endTime = nowDate; + + try { + startTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(nowDateStr + " 00:00:00"); + endTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(nowDateStr + " 23:59:59"); + } catch (ParseException ignored) { + } + + /* 构建盘点计划数据 */ + WmsInventoryPlan wmsInventoryPlan = new WmsInventoryPlan(); + wmsInventoryPlan.setWmsInventoryConfigureId(wmsInventoryConfigure.getWmsInventoryConfigureId()); + wmsInventoryPlan.setPlanCode(String.format("%s_%s_%s", wmsInventoryConfigure.getDataType(), wmsInventoryConfigure.getInventoryType(), Long.toString(System.currentTimeMillis(), 32).toUpperCase(Locale.ROOT))); + wmsInventoryPlan.setPlanName(wmsInventoryConfigure.getConfigureName()); + wmsInventoryPlan.setDataType(wmsInventoryConfigure.getDataType()); + wmsInventoryPlan.setmWarehouseId(wmsInventoryConfigure.getmWarehouseId()); + wmsInventoryPlan.setBeginTime(startTime); + wmsInventoryPlan.setEndTime(endTime); + wmsInventoryPlan.setStatus("STATUS_1"); + wmsInventoryPlan.setDescription(String.format("%s自动生成的盘点计划。", new SimpleDateFormat("yyyy年MM月dd日").format(nowDate))); + wmsInventoryPlan.setCreateTime(nowDate); + + /* 保存盘点计划数据 */ + wmsInventoryPlanMapper.insertWmsInventoryPlan(wmsInventoryPlan); + + /* 以新创建的盘点计划ID为主键构建集合 */ + superBaseKnifeListHashMap.computeIfAbsent(wmsInventoryPlan.getWmsStockPlanId(), k -> new HashMap<>()); + + /* 根据仓库ID获取库区列表 */ + WmStorageLocation wmStorageLocationQuery = new WmStorageLocation(); + wmStorageLocationQuery.setWarehouseId(wmsInventoryConfigure.getmWarehouseId()); + List wmStorageLocationList = wmStorageLocationMapper.selectWmStorageLocationList(wmStorageLocationQuery); + wmStorageLocationList.forEach(wmStorageLocation -> { + /* 根据库区ID获取库位列表 */ + WmStorageArea wmStorageAreaQuery = new WmStorageArea(); + wmStorageAreaQuery.setLocationId(wmStorageLocation.getLocationId()); + List wmStorageAreaList = wmStorageAreaMapper.selectWmStorageAreaList(wmStorageAreaQuery); + wmStorageAreaList.forEach(wmStorageArea -> { + /* 根据库位编码获取台账列表 */ + BaseKnife baseKnifeQuery = new BaseKnife(); + baseKnifeQuery.setAreaCode(wmStorageArea.getAreaCode()); + baseKnifeQuery.setKnifeFineState(0); + List baseKnifeList = baseKnifeMapper.selectBaseKnifeList(baseKnifeQuery); + baseKnifeList.forEach(baseKnife -> { + /* 获取无聊信息 */ + MdItem mdItem = mdItemMapper.selectMdItemById(baseKnife.getMbbBdMrlId()); + + /* 获得单位信息 */ + MdUnitMeasure mdUnitMeasure = mdUnitMeasureMapper.selectMdUnitByCode(mdItem.getUnitOfMeasure()); + + /* 根据无聊信息构建无聊信息数 */ + String key = wmsInventoryConfigure.getmWarehouseId().toString() + "-" + + wmStorageArea.getAreaId().toString() + "-" + + baseKnife.getMbbBdMrlId().toString() + "-" + + mdUnitMeasure.getMeasureId().toString(); + + /* 校验是否存在该列表 */ + superBaseKnifeListHashMap.get(wmsInventoryPlan.getWmsStockPlanId()).computeIfAbsent(key, k -> new ArrayList<>()); + + /* 填入数据 */ + superBaseKnifeListHashMap.get(wmsInventoryPlan.getWmsStockPlanId()).get(key).add(baseKnife); + }); + }); + }); + }); + + /* 遍历集合 */ + superBaseKnifeListHashMap.keySet().forEach(key1 -> { + superBaseKnifeListHashMap.get(key1).keySet().forEach(key2 -> { + /* 切割字符串 */ + String[] idStrArray = key2.split("-"); + + /* 构建数据 */ + WmsInventory wmsInventory = new WmsInventory(); + wmsInventory.setWmsStockPlanId(key1); + wmsInventory.setmWarehouseId(Long.valueOf(idStrArray[0])); + wmsInventory.setAreaId(Long.valueOf(idStrArray[1])); + wmsInventory.setMdItemId(Long.valueOf(idStrArray[2])); + wmsInventory.setUnitId(Long.valueOf(idStrArray[3])); + wmsInventory.setSystemCount(superBaseKnifeListHashMap.get(key1).get(key2).size()); + wmsInventory.setCreateTime(nowDate); + + /* 保存数据 */ + wmsInventoryMapper.insertWmsInventory(wmsInventory); + }); + }); + } + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/controller/WmsInventoryController.java b/ktg-mes/src/main/java/com/ktg/mes/md/controller/WmsInventoryController.java new file mode 100644 index 0000000..b0b54f1 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/controller/WmsInventoryController.java @@ -0,0 +1,91 @@ +package com.ktg.mes.md.controller; + +import com.ktg.common.annotation.Log; +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.common.utils.poi.ExcelUtil; +import com.ktg.mes.md.domain.WmsInventory; +import com.ktg.mes.md.service.IWmsInventoryService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + * 盘点Controller + * + * @author yinjinlu + * @date 2024-11-12 + */ +@RestController +@RequestMapping("/md/WMS_INVENTORY") +public class WmsInventoryController extends BaseController { + @Autowired + private IWmsInventoryService wmsInventoryService; + + /** + * 查询盘点列表 + */ + @PreAuthorize("@ss.hasPermi('md:WMS_INVENTORY:list')") + @GetMapping("/list") + public TableDataInfo list(WmsInventory wmsInventory) { + startPage(); + List list = wmsInventoryService.selectWmsInventoryList(wmsInventory); + return getDataTable(list); + } + + /** + * 导出盘点列表 + */ + @PreAuthorize("@ss.hasPermi('md:WMS_INVENTORY:export')") + @Log(title = "盘点", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, WmsInventory wmsInventory) { + List list = wmsInventoryService.selectWmsInventoryList(wmsInventory); + ExcelUtil util = new ExcelUtil(WmsInventory.class); + util.exportExcel(response, list, "盘点数据"); + } + + /** + * 获取盘点详细信息 + */ + @PreAuthorize("@ss.hasPermi('md:WMS_INVENTORY:query')") + @GetMapping(value = "/{wmsInventoryId}") + public AjaxResult getInfo(@PathVariable("wmsInventoryId") Long wmsInventoryId) { + return AjaxResult.success(wmsInventoryService.selectWmsInventoryByWmsInventoryId(wmsInventoryId)); + } + + /** + * 新增盘点 + */ + @PreAuthorize("@ss.hasPermi('md:WMS_INVENTORY:add')") + @Log(title = "盘点", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WmsInventory wmsInventory) { + return toAjax(wmsInventoryService.insertWmsInventory(wmsInventory)); + } + + /** + * 修改盘点 + */ + @PreAuthorize("@ss.hasPermi('md:WMS_INVENTORY:edit')") + @Log(title = "盘点", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WmsInventory wmsInventory) { + return toAjax(wmsInventoryService.updateWmsInventory(wmsInventory)); + } + + /** + * 删除盘点 + */ + @PreAuthorize("@ss.hasPermi('md:WMS_INVENTORY:remove')") + @Log(title = "盘点", businessType = BusinessType.DELETE) + @DeleteMapping("/{wmsInventoryIds}") + public AjaxResult remove(@PathVariable Long[] wmsInventoryIds) { + return toAjax(wmsInventoryService.deleteWmsInventoryByWmsInventoryIds(wmsInventoryIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/controller/WmsInventoryPlanController.java b/ktg-mes/src/main/java/com/ktg/mes/md/controller/WmsInventoryPlanController.java new file mode 100644 index 0000000..82d8214 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/controller/WmsInventoryPlanController.java @@ -0,0 +1,91 @@ +package com.ktg.mes.md.controller; + +import com.ktg.common.annotation.Log; +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.common.utils.poi.ExcelUtil; +import com.ktg.mes.md.domain.WmsInventoryPlan; +import com.ktg.mes.md.service.IWmsInventoryPlanService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + * 盘点计划Controller + * + * @author yinjinlu + * @date 2024-11-12 + */ +@RestController +@RequestMapping("/md/WMS_INVENTORY_PLAN") +public class WmsInventoryPlanController extends BaseController { + @Autowired + private IWmsInventoryPlanService wmsInventoryPlanService; + + /** + * 查询盘点计划列表 + */ + @PreAuthorize("@ss.hasPermi('md:WMS_INVENTORY_PLAN:list')") + @GetMapping("/list") + public TableDataInfo list(WmsInventoryPlan wmsInventoryPlan) { + startPage(); + List list = wmsInventoryPlanService.selectWmsInventoryPlanList(wmsInventoryPlan); + return getDataTable(list); + } + + /** + * 导出盘点计划列表 + */ + @PreAuthorize("@ss.hasPermi('md:WMS_INVENTORY_PLAN:export')") + @Log(title = "盘点计划", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, WmsInventoryPlan wmsInventoryPlan) { + List list = wmsInventoryPlanService.selectWmsInventoryPlanList(wmsInventoryPlan); + ExcelUtil util = new ExcelUtil(WmsInventoryPlan.class); + util.exportExcel(response, list, "盘点计划数据"); + } + + /** + * 获取盘点计划详细信息 + */ + @PreAuthorize("@ss.hasPermi('md:WMS_INVENTORY_PLAN:query')") + @GetMapping(value = "/{wmsStockPlanId}") + public AjaxResult getInfo(@PathVariable("wmsStockPlanId") Long wmsStockPlanId) { + return AjaxResult.success(wmsInventoryPlanService.selectWmsInventoryPlanByWmsStockPlanId(wmsStockPlanId)); + } + + /** + * 新增盘点计划 + */ + @PreAuthorize("@ss.hasPermi('md:WMS_INVENTORY_PLAN:add')") + @Log(title = "盘点计划", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WmsInventoryPlan wmsInventoryPlan) { + return toAjax(wmsInventoryPlanService.insertWmsInventoryPlan(wmsInventoryPlan)); + } + + /** + * 修改盘点计划 + */ + @PreAuthorize("@ss.hasPermi('md:WMS_INVENTORY_PLAN:edit')") + @Log(title = "盘点计划", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WmsInventoryPlan wmsInventoryPlan) { + return toAjax(wmsInventoryPlanService.updateWmsInventoryPlan(wmsInventoryPlan)); + } + + /** + * 删除盘点计划 + */ + @PreAuthorize("@ss.hasPermi('md:WMS_INVENTORY_PLAN:remove')") + @Log(title = "盘点计划", businessType = BusinessType.DELETE) + @DeleteMapping("/{wmsStockPlanIds}") + public AjaxResult remove(@PathVariable Long[] wmsStockPlanIds) { + return toAjax(wmsInventoryPlanService.deleteWmsInventoryPlanByWmsStockPlanIds(wmsStockPlanIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/domain/WmsInventory.java b/ktg-mes/src/main/java/com/ktg/mes/md/domain/WmsInventory.java new file mode 100644 index 0000000..cfd15fd --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/domain/WmsInventory.java @@ -0,0 +1,266 @@ +package com.ktg.mes.md.domain; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +import java.util.Date; + +/** + * 盘点对象 WMS_INVENTORY + * + * @author yinjinlu + * @date 2024-11-12 + */ +public class WmsInventory extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private Long wmsInventoryId; + + /** + * 盘点计划 + */ + @Excel(name = "盘点计划") + private Long wmsStockPlanId; + + /** + * 仓库 + */ + @Excel(name = "仓库") + private Long mWarehouseId; + + /** + * 库位 + */ + @Excel(name = "库位") + private Long areaId; + + /** + * 物料 + */ + @Excel(name = "物料") + private Long mdItemId; + + /** + * 单位 + */ + @Excel(name = "单位") + private Long unitId; + + /** + * 系统库存数 + */ + @Excel(name = "系统库存数") + private Integer systemCount; + + /** + * 盘点数量 + */ + @Excel(name = "盘点数量") + private Integer inventoryCount; + + /** + * 盘点时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "盘点时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date inventoryTime; + + /** + * 复盘数量 + */ + @Excel(name = "复盘数量") + private Integer agCount; + + /** + * 复盘时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "复盘时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date agTime; + + /** + * 差异数量 + */ + @Excel(name = "差异数量") + private Integer diffCount; + + /** + * 预留字段1 + */ + private String attr1; + + /** + * 预留字段2 + */ + private String attr2; + + /** + * 预留字段3 + */ + private String attr3; + + /** + * 预留字段4 + */ + private String attr4; + + public Long getWmsInventoryId() { + return wmsInventoryId; + } + + public void setWmsInventoryId(Long wmsInventoryId) { + this.wmsInventoryId = wmsInventoryId; + } + + public Long getWmsStockPlanId() { + return wmsStockPlanId; + } + + public void setWmsStockPlanId(Long wmsStockPlanId) { + this.wmsStockPlanId = wmsStockPlanId; + } + + public Long getmWarehouseId() { + return mWarehouseId; + } + + public void setmWarehouseId(Long mWarehouseId) { + this.mWarehouseId = mWarehouseId; + } + + public Long getAreaId() { + return areaId; + } + + public void setAreaId(Long areaId) { + this.areaId = areaId; + } + + public Long getMdItemId() { + return mdItemId; + } + + public void setMdItemId(Long mdItemId) { + this.mdItemId = mdItemId; + } + + public Long getUnitId() { + return unitId; + } + + public void setUnitId(Long unitId) { + this.unitId = unitId; + } + + public Integer getSystemCount() { + return systemCount; + } + + public void setSystemCount(Integer systemCount) { + this.systemCount = systemCount; + } + + public Integer getInventoryCount() { + return inventoryCount; + } + + public void setInventoryCount(Integer inventoryCount) { + this.inventoryCount = inventoryCount; + } + + public Date getInventoryTime() { + return inventoryTime; + } + + public void setInventoryTime(Date inventoryTime) { + this.inventoryTime = inventoryTime; + } + + public Integer getAgCount() { + return agCount; + } + + public void setAgCount(Integer agCount) { + this.agCount = agCount; + } + + public Date getAgTime() { + return agTime; + } + + public void setAgTime(Date agTime) { + this.agTime = agTime; + } + + public Integer getDiffCount() { + return diffCount; + } + + public void setDiffCount(Integer diffCount) { + this.diffCount = diffCount; + } + + public String getAttr1() { + return attr1; + } + + public void setAttr1(String attr1) { + this.attr1 = attr1; + } + + public String getAttr2() { + return attr2; + } + + public void setAttr2(String attr2) { + this.attr2 = attr2; + } + + public String getAttr3() { + return attr3; + } + + public void setAttr3(String attr3) { + this.attr3 = attr3; + } + + public String getAttr4() { + return attr4; + } + + public void setAttr4(String attr4) { + this.attr4 = attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("wmsInventoryId", getWmsInventoryId()) + .append("wmsStockPlanId", getWmsStockPlanId()) + .append("mWarehouseId", getmWarehouseId()) + .append("areaId", getAreaId()) + .append("mdItemId", getMdItemId()) + .append("unitId", getUnitId()) + .append("systemCount", getSystemCount()) + .append("inventoryCount", getInventoryCount()) + .append("inventoryTime", getInventoryTime()) + .append("agCount", getAgCount()) + .append("agTime", getAgTime()) + .append("diffCount", getDiffCount()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/domain/WmsInventoryPlan.java b/ktg-mes/src/main/java/com/ktg/mes/md/domain/WmsInventoryPlan.java new file mode 100644 index 0000000..7e95c9a --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/domain/WmsInventoryPlan.java @@ -0,0 +1,251 @@ +package com.ktg.mes.md.domain; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +import java.util.Date; + +/** + * 盘点计划对象 WMS_INVENTORY_PLAN + * + * @author yinjinlu + * @date 2024-11-12 + */ +public class WmsInventoryPlan extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private Long wmsStockPlanId; + + /** + * 盘点计划配置 + */ + @Excel(name = "盘点计划配置") + private Long wmsInventoryConfigureId; + + /** + * 盘点单编码 + */ + @Excel(name = "盘点单编码") + private String planCode; + + /** + * 盘点计划名称 + */ + @Excel(name = "盘点计划名称") + private String planName; + + /** + * 盘点类型 + */ + @Excel(name = "盘点类型") + private String dataType; + + /** + * 盘点仓库ID + */ + @Excel(name = "盘点仓库ID") + private Long mWarehouseId; + + /** + * 开始时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date beginTime; + + /** + * 结束时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "结束时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date endTime; + + /** + * 是否复盘 + */ + @Excel(name = "是否复盘") + private String isag; + + /** + * 单据状态 + */ + @Excel(name = "单据状态") + private String status; + + /** + * 描述 + */ + @Excel(name = "描述") + private String description; + + /** + * 预留字段1 + */ + private String attr1; + + /** + * 预留字段2 + */ + private String attr2; + + /** + * 预留字段3 + */ + private String attr3; + + /** + * 预留字段4 + */ + private String attr4; + + public Long getWmsStockPlanId() { + return wmsStockPlanId; + } + + public void setWmsStockPlanId(Long wmsStockPlanId) { + this.wmsStockPlanId = wmsStockPlanId; + } + + public Long getWmsInventoryConfigureId() { + return wmsInventoryConfigureId; + } + + public void setWmsInventoryConfigureId(Long wmsInventoryConfigureId) { + this.wmsInventoryConfigureId = wmsInventoryConfigureId; + } + + public String getPlanCode() { + return planCode; + } + + public void setPlanCode(String planCode) { + this.planCode = planCode; + } + + public String getPlanName() { + return planName; + } + + public void setPlanName(String planName) { + this.planName = planName; + } + + public String getDataType() { + return dataType; + } + + public void setDataType(String dataType) { + this.dataType = dataType; + } + + public Long getmWarehouseId() { + return mWarehouseId; + } + + public void setmWarehouseId(Long mWarehouseId) { + this.mWarehouseId = mWarehouseId; + } + + public Date getBeginTime() { + return beginTime; + } + + public void setBeginTime(Date beginTime) { + this.beginTime = beginTime; + } + + public Date getEndTime() { + return endTime; + } + + public void setEndTime(Date endTime) { + this.endTime = endTime; + } + + public String getIsag() { + return isag; + } + + public void setIsag(String isag) { + this.isag = isag; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getAttr1() { + return attr1; + } + + public void setAttr1(String attr1) { + this.attr1 = attr1; + } + + public String getAttr2() { + return attr2; + } + + public void setAttr2(String attr2) { + this.attr2 = attr2; + } + + public String getAttr3() { + return attr3; + } + + public void setAttr3(String attr3) { + this.attr3 = attr3; + } + + public String getAttr4() { + return attr4; + } + + public void setAttr4(String attr4) { + this.attr4 = attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("wmsStockPlanId", getWmsStockPlanId()) + .append("wmsInventoryConfigureId", getWmsInventoryConfigureId()) + .append("planCode", getPlanCode()) + .append("planName", getPlanName()) + .append("dataType", getDataType()) + .append("mWarehouseId", getmWarehouseId()) + .append("beginTime", getBeginTime()) + .append("endTime", getEndTime()) + .append("isag", getIsag()) + .append("status", getStatus()) + .append("description", getDescription()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/mapper/WmsInventoryMapper.java b/ktg-mes/src/main/java/com/ktg/mes/md/mapper/WmsInventoryMapper.java new file mode 100644 index 0000000..1267c70 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/mapper/WmsInventoryMapper.java @@ -0,0 +1,61 @@ +package com.ktg.mes.md.mapper; + +import com.ktg.mes.md.domain.WmsInventory; + +import java.util.List; + +/** + * 盘点Mapper接口 + * + * @author yinjinlu + * @date 2024-11-12 + */ +public interface WmsInventoryMapper { + /** + * 查询盘点 + * + * @param wmsInventoryId 盘点主键 + * @return 盘点 + */ + public WmsInventory selectWmsInventoryByWmsInventoryId(Long wmsInventoryId); + + /** + * 查询盘点列表 + * + * @param wmsInventory 盘点 + * @return 盘点集合 + */ + public List selectWmsInventoryList(WmsInventory wmsInventory); + + /** + * 新增盘点 + * + * @param wmsInventory 盘点 + * @return 结果 + */ + public int insertWmsInventory(WmsInventory wmsInventory); + + /** + * 修改盘点 + * + * @param wmsInventory 盘点 + * @return 结果 + */ + public int updateWmsInventory(WmsInventory wmsInventory); + + /** + * 删除盘点 + * + * @param wmsInventoryId 盘点主键 + * @return 结果 + */ + public int deleteWmsInventoryByWmsInventoryId(Long wmsInventoryId); + + /** + * 批量删除盘点 + * + * @param wmsInventoryIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteWmsInventoryByWmsInventoryIds(Long[] wmsInventoryIds); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/mapper/WmsInventoryPlanMapper.java b/ktg-mes/src/main/java/com/ktg/mes/md/mapper/WmsInventoryPlanMapper.java new file mode 100644 index 0000000..da65e5b --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/mapper/WmsInventoryPlanMapper.java @@ -0,0 +1,61 @@ +package com.ktg.mes.md.mapper; + +import com.ktg.mes.md.domain.WmsInventoryPlan; + +import java.util.List; + +/** + * 盘点计划Mapper接口 + * + * @author yinjinlu + * @date 2024-11-12 + */ +public interface WmsInventoryPlanMapper { + /** + * 查询盘点计划 + * + * @param wmsStockPlanId 盘点计划主键 + * @return 盘点计划 + */ + public WmsInventoryPlan selectWmsInventoryPlanByWmsStockPlanId(Long wmsStockPlanId); + + /** + * 查询盘点计划列表 + * + * @param wmsInventoryPlan 盘点计划 + * @return 盘点计划集合 + */ + public List selectWmsInventoryPlanList(WmsInventoryPlan wmsInventoryPlan); + + /** + * 新增盘点计划 + * + * @param wmsInventoryPlan 盘点计划 + * @return 结果 + */ + public int insertWmsInventoryPlan(WmsInventoryPlan wmsInventoryPlan); + + /** + * 修改盘点计划 + * + * @param wmsInventoryPlan 盘点计划 + * @return 结果 + */ + public int updateWmsInventoryPlan(WmsInventoryPlan wmsInventoryPlan); + + /** + * 删除盘点计划 + * + * @param wmsStockPlanId 盘点计划主键 + * @return 结果 + */ + public int deleteWmsInventoryPlanByWmsStockPlanId(Long wmsStockPlanId); + + /** + * 批量删除盘点计划 + * + * @param wmsStockPlanIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteWmsInventoryPlanByWmsStockPlanIds(Long[] wmsStockPlanIds); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/service/IWmsInventoryPlanService.java b/ktg-mes/src/main/java/com/ktg/mes/md/service/IWmsInventoryPlanService.java new file mode 100644 index 0000000..988f3a5 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/service/IWmsInventoryPlanService.java @@ -0,0 +1,61 @@ +package com.ktg.mes.md.service; + +import com.ktg.mes.md.domain.WmsInventoryPlan; + +import java.util.List; + +/** + * 盘点计划Service接口 + * + * @author yinjinlu + * @date 2024-11-12 + */ +public interface IWmsInventoryPlanService { + /** + * 查询盘点计划 + * + * @param wmsStockPlanId 盘点计划主键 + * @return 盘点计划 + */ + public WmsInventoryPlan selectWmsInventoryPlanByWmsStockPlanId(Long wmsStockPlanId); + + /** + * 查询盘点计划列表 + * + * @param wmsInventoryPlan 盘点计划 + * @return 盘点计划集合 + */ + public List selectWmsInventoryPlanList(WmsInventoryPlan wmsInventoryPlan); + + /** + * 新增盘点计划 + * + * @param wmsInventoryPlan 盘点计划 + * @return 结果 + */ + public int insertWmsInventoryPlan(WmsInventoryPlan wmsInventoryPlan); + + /** + * 修改盘点计划 + * + * @param wmsInventoryPlan 盘点计划 + * @return 结果 + */ + public int updateWmsInventoryPlan(WmsInventoryPlan wmsInventoryPlan); + + /** + * 批量删除盘点计划 + * + * @param wmsStockPlanIds 需要删除的盘点计划主键集合 + * @return 结果 + */ + public int deleteWmsInventoryPlanByWmsStockPlanIds(Long[] wmsStockPlanIds); + + /** + * 删除盘点计划信息 + * + * @param wmsStockPlanId 盘点计划主键 + * @return 结果 + */ + public int deleteWmsInventoryPlanByWmsStockPlanId(Long wmsStockPlanId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/service/IWmsInventoryService.java b/ktg-mes/src/main/java/com/ktg/mes/md/service/IWmsInventoryService.java new file mode 100644 index 0000000..777777e --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/service/IWmsInventoryService.java @@ -0,0 +1,61 @@ +package com.ktg.mes.md.service; + +import com.ktg.mes.md.domain.WmsInventory; + +import java.util.List; + +/** + * 盘点Service接口 + * + * @author yinjinlu + * @date 2024-11-12 + */ +public interface IWmsInventoryService { + /** + * 查询盘点 + * + * @param wmsInventoryId 盘点主键 + * @return 盘点 + */ + public WmsInventory selectWmsInventoryByWmsInventoryId(Long wmsInventoryId); + + /** + * 查询盘点列表 + * + * @param wmsInventory 盘点 + * @return 盘点集合 + */ + public List selectWmsInventoryList(WmsInventory wmsInventory); + + /** + * 新增盘点 + * + * @param wmsInventory 盘点 + * @return 结果 + */ + public int insertWmsInventory(WmsInventory wmsInventory); + + /** + * 修改盘点 + * + * @param wmsInventory 盘点 + * @return 结果 + */ + public int updateWmsInventory(WmsInventory wmsInventory); + + /** + * 批量删除盘点 + * + * @param wmsInventoryIds 需要删除的盘点主键集合 + * @return 结果 + */ + public int deleteWmsInventoryByWmsInventoryIds(Long[] wmsInventoryIds); + + /** + * 删除盘点信息 + * + * @param wmsInventoryId 盘点主键 + * @return 结果 + */ + public int deleteWmsInventoryByWmsInventoryId(Long wmsInventoryId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/WmsInventoryPlanServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/WmsInventoryPlanServiceImpl.java new file mode 100644 index 0000000..9ca819c --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/WmsInventoryPlanServiceImpl.java @@ -0,0 +1,90 @@ +package com.ktg.mes.md.service.impl; + +import com.ktg.common.utils.DateUtils; +import com.ktg.mes.md.domain.WmsInventoryPlan; +import com.ktg.mes.md.mapper.WmsInventoryPlanMapper; +import com.ktg.mes.md.service.IWmsInventoryPlanService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 盘点计划Service业务层处理 + * + * @author yinjinlu + * @date 2024-11-12 + */ +@Service +public class WmsInventoryPlanServiceImpl implements IWmsInventoryPlanService { + @Autowired + private WmsInventoryPlanMapper wmsInventoryPlanMapper; + + /** + * 查询盘点计划 + * + * @param wmsStockPlanId 盘点计划主键 + * @return 盘点计划 + */ + @Override + public WmsInventoryPlan selectWmsInventoryPlanByWmsStockPlanId(Long wmsStockPlanId) { + return wmsInventoryPlanMapper.selectWmsInventoryPlanByWmsStockPlanId(wmsStockPlanId); + } + + /** + * 查询盘点计划列表 + * + * @param wmsInventoryPlan 盘点计划 + * @return 盘点计划 + */ + @Override + public List selectWmsInventoryPlanList(WmsInventoryPlan wmsInventoryPlan) { + return wmsInventoryPlanMapper.selectWmsInventoryPlanList(wmsInventoryPlan); + } + + /** + * 新增盘点计划 + * + * @param wmsInventoryPlan 盘点计划 + * @return 结果 + */ + @Override + public int insertWmsInventoryPlan(WmsInventoryPlan wmsInventoryPlan) { + wmsInventoryPlan.setCreateTime(DateUtils.getNowDate()); + return wmsInventoryPlanMapper.insertWmsInventoryPlan(wmsInventoryPlan); + } + + /** + * 修改盘点计划 + * + * @param wmsInventoryPlan 盘点计划 + * @return 结果 + */ + @Override + public int updateWmsInventoryPlan(WmsInventoryPlan wmsInventoryPlan) { + wmsInventoryPlan.setUpdateTime(DateUtils.getNowDate()); + return wmsInventoryPlanMapper.updateWmsInventoryPlan(wmsInventoryPlan); + } + + /** + * 批量删除盘点计划 + * + * @param wmsStockPlanIds 需要删除的盘点计划主键 + * @return 结果 + */ + @Override + public int deleteWmsInventoryPlanByWmsStockPlanIds(Long[] wmsStockPlanIds) { + return wmsInventoryPlanMapper.deleteWmsInventoryPlanByWmsStockPlanIds(wmsStockPlanIds); + } + + /** + * 删除盘点计划信息 + * + * @param wmsStockPlanId 盘点计划主键 + * @return 结果 + */ + @Override + public int deleteWmsInventoryPlanByWmsStockPlanId(Long wmsStockPlanId) { + return wmsInventoryPlanMapper.deleteWmsInventoryPlanByWmsStockPlanId(wmsStockPlanId); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/WmsInventoryServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/WmsInventoryServiceImpl.java new file mode 100644 index 0000000..65edb9a --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/WmsInventoryServiceImpl.java @@ -0,0 +1,90 @@ +package com.ktg.mes.md.service.impl; + +import com.ktg.common.utils.DateUtils; +import com.ktg.mes.md.domain.WmsInventory; +import com.ktg.mes.md.mapper.WmsInventoryMapper; +import com.ktg.mes.md.service.IWmsInventoryService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 盘点Service业务层处理 + * + * @author yinjinlu + * @date 2024-11-12 + */ +@Service +public class WmsInventoryServiceImpl implements IWmsInventoryService { + @Autowired + private WmsInventoryMapper wmsInventoryMapper; + + /** + * 查询盘点 + * + * @param wmsInventoryId 盘点主键 + * @return 盘点 + */ + @Override + public WmsInventory selectWmsInventoryByWmsInventoryId(Long wmsInventoryId) { + return wmsInventoryMapper.selectWmsInventoryByWmsInventoryId(wmsInventoryId); + } + + /** + * 查询盘点列表 + * + * @param wmsInventory 盘点 + * @return 盘点 + */ + @Override + public List selectWmsInventoryList(WmsInventory wmsInventory) { + return wmsInventoryMapper.selectWmsInventoryList(wmsInventory); + } + + /** + * 新增盘点 + * + * @param wmsInventory 盘点 + * @return 结果 + */ + @Override + public int insertWmsInventory(WmsInventory wmsInventory) { + wmsInventory.setCreateTime(DateUtils.getNowDate()); + return wmsInventoryMapper.insertWmsInventory(wmsInventory); + } + + /** + * 修改盘点 + * + * @param wmsInventory 盘点 + * @return 结果 + */ + @Override + public int updateWmsInventory(WmsInventory wmsInventory) { + wmsInventory.setUpdateTime(DateUtils.getNowDate()); + return wmsInventoryMapper.updateWmsInventory(wmsInventory); + } + + /** + * 批量删除盘点 + * + * @param wmsInventoryIds 需要删除的盘点主键 + * @return 结果 + */ + @Override + public int deleteWmsInventoryByWmsInventoryIds(Long[] wmsInventoryIds) { + return wmsInventoryMapper.deleteWmsInventoryByWmsInventoryIds(wmsInventoryIds); + } + + /** + * 删除盘点信息 + * + * @param wmsInventoryId 盘点主键 + * @return 结果 + */ + @Override + public int deleteWmsInventoryByWmsInventoryId(Long wmsInventoryId) { + return wmsInventoryMapper.deleteWmsInventoryByWmsInventoryId(wmsInventoryId); + } +} diff --git a/ktg-mes/src/main/resources/mapper/md/WmsInventoryMapper.xml b/ktg-mes/src/main/resources/mapper/md/WmsInventoryMapper.xml new file mode 100644 index 0000000..0c49c68 --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/md/WmsInventoryMapper.xml @@ -0,0 +1,164 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select WMS_INVENTORY_ID, + WMS_STOCK_PLAN_ID, + M_WAREHOUSE_ID, + AREA_ID, + MD_ITEM_ID, + UNIT_ID, + SYSTEM_COUNT, + INVENTORY_COUNT, + INVENTORY_TIME, + AG_COUNT, + AG_TIME, + DIFF_COUNT, + ATTR1, + ATTR2, + ATTR3, + ATTR4, + CREATE_BY, + CREATE_TIME, + UPDATE_BY, + UPDATE_TIME + from WMS_INVENTORY + + + + + + + + insert into WMS_INVENTORY + + WMS_STOCK_PLAN_ID, + M_WAREHOUSE_ID, + AREA_ID, + MD_ITEM_ID, + UNIT_ID, + SYSTEM_COUNT, + INVENTORY_COUNT, + INVENTORY_TIME, + AG_COUNT, + AG_TIME, + DIFF_COUNT, + ATTR1, + ATTR2, + ATTR3, + ATTR4, + CREATE_BY, + CREATE_TIME, + UPDATE_BY, + UPDATE_TIME, + + + #{wmsStockPlanId}, + #{mWarehouseId}, + #{areaId}, + #{mdItemId}, + #{unitId}, + #{systemCount}, + #{inventoryCount}, + #{inventoryTime}, + #{agCount}, + #{agTime}, + #{diffCount}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update WMS_INVENTORY + + WMS_STOCK_PLAN_ID = #{wmsStockPlanId}, + M_WAREHOUSE_ID = #{mWarehouseId}, + AREA_ID = #{areaId}, + MD_ITEM_ID = #{mdItemId}, + UNIT_ID = #{unitId}, + SYSTEM_COUNT = #{systemCount}, + INVENTORY_COUNT = #{inventoryCount}, + INVENTORY_TIME = #{inventoryTime}, + AG_COUNT = #{agCount}, + AG_TIME = #{agTime}, + DIFF_COUNT = #{diffCount}, + ATTR1 = #{attr1}, + ATTR2 = #{attr2}, + ATTR3 = #{attr3}, + ATTR4 = #{attr4}, + CREATE_BY = #{createBy}, + CREATE_TIME = #{createTime}, + UPDATE_BY = #{updateBy}, + UPDATE_TIME = #{updateTime}, + + where WMS_INVENTORY_ID = #{wmsInventoryId} + + + + delete + from WMS_INVENTORY + where WMS_INVENTORY_ID = #{wmsInventoryId} + + + + delete from WMS_INVENTORY where WMS_INVENTORY_ID in + + #{wmsInventoryId} + + + \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/md/WmsInventoryPlanMapper.xml b/ktg-mes/src/main/resources/mapper/md/WmsInventoryPlanMapper.xml new file mode 100644 index 0000000..2bfe136 --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/md/WmsInventoryPlanMapper.xml @@ -0,0 +1,159 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + select WMS_STOCK_PLAN_ID, + WMS_INVENTORY_CONFIGURE_ID, + PLAN_CODE, + PLAN_NAME, + DATA_TYPE, + M_WAREHOUSE_ID, + BEGIN_TIME, + END_TIME, + ISAG, + STATUS, + DESCRIPTION, + ATTR1, + ATTR2, + ATTR3, + ATTR4, + CREATE_BY, + CREATE_TIME, + UPDATE_BY, + UPDATE_TIME + from WMS_INVENTORY_PLAN + + + + + + + + insert into WMS_INVENTORY_PLAN + + WMS_INVENTORY_CONFIGURE_ID, + PLAN_CODE, + PLAN_NAME, + DATA_TYPE, + M_WAREHOUSE_ID, + BEGIN_TIME, + END_TIME, + ISAG, + STATUS, + DESCRIPTION, + ATTR1, + ATTR2, + ATTR3, + ATTR4, + CREATE_BY, + CREATE_TIME, + UPDATE_BY, + UPDATE_TIME, + + + #{wmsInventoryConfigureId}, + #{planCode}, + #{planName}, + #{dataType}, + #{mWarehouseId}, + #{beginTime}, + #{endTime}, + #{isag}, + #{status}, + #{description}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update WMS_INVENTORY_PLAN + + WMS_INVENTORY_CONFIGURE_ID = #{wmsInventoryConfigureId}, + PLAN_CODE = #{planCode}, + PLAN_NAME = #{planName}, + DATA_TYPE = #{dataType}, + M_WAREHOUSE_ID = #{mWarehouseId}, + BEGIN_TIME = #{beginTime}, + END_TIME = #{endTime}, + ISAG = #{isag}, + STATUS = #{status}, + DESCRIPTION = #{description}, + ATTR1 = #{attr1}, + ATTR2 = #{attr2}, + ATTR3 = #{attr3}, + ATTR4 = #{attr4}, + CREATE_BY = #{createBy}, + CREATE_TIME = #{createTime}, + UPDATE_BY = #{updateBy}, + UPDATE_TIME = #{updateTime}, + + where WMS_STOCK_PLAN_ID = #{wmsStockPlanId} + + + + delete + from WMS_INVENTORY_PLAN + where WMS_STOCK_PLAN_ID = #{wmsStockPlanId} + + + + delete from WMS_INVENTORY_PLAN where WMS_STOCK_PLAN_ID in + + #{wmsStockPlanId} + + + \ No newline at end of file