diff --git a/src/main/java/com/shzg/project/unique/controller/WornUniqueCodeController.java b/src/main/java/com/shzg/project/unique/controller/WornUniqueCodeController.java index a47428e..90e4730 100644 --- a/src/main/java/com/shzg/project/unique/controller/WornUniqueCodeController.java +++ b/src/main/java/com/shzg/project/unique/controller/WornUniqueCodeController.java @@ -39,7 +39,6 @@ public class WornUniqueCodeController extends BaseController /** * 查询唯一码管理列表 */ - @DataScope(deptAlias = "d") @PreAuthorize("@ss.hasPermi('unique:code:list')") @GetMapping("/list") public TableDataInfo list(WornUniqueCode wornUniqueCode) @@ -47,7 +46,6 @@ public class WornUniqueCodeController extends BaseController startPage(); List list = wornUniqueCodeService.selectWornUniqueCodeList(wornUniqueCode); return getDataTable(list); - } /** diff --git a/src/main/java/com/shzg/project/unique/domain/WornUniqueCode.java b/src/main/java/com/shzg/project/unique/domain/WornUniqueCode.java index 3039b8c..91d6505 100644 --- a/src/main/java/com/shzg/project/unique/domain/WornUniqueCode.java +++ b/src/main/java/com/shzg/project/unique/domain/WornUniqueCode.java @@ -32,8 +32,8 @@ public class WornUniqueCode extends BaseEntity @Excel(name = "项目ID", readConverterExp = "用于数据隔离,对应sys_dept.id") private Long projectId; - /** 当前状态(0初始化创建 1已打印 2已入库 3已出库 4已配送) */ - @Excel(name = "当前状态", readConverterExp = "0=初始化创建,1=已打印,2=已入库,3=已出库,4=已配送") + /** 当前状态(0=初始化创建,1=生成入库单号,2=快速入库,3=生成出库单号,4=快速出库) */ + @Excel(name = "当前状态", readConverterExp = "0=初始化创建,1=生成入库单号,2=快速入库,3=生成出库单号,4=快速出库") private String status; /** RFID编码 */ diff --git a/src/main/java/com/shzg/project/unique/domain/WornUniqueCodeEvent.java b/src/main/java/com/shzg/project/unique/domain/WornUniqueCodeEvent.java index d5e0a52..2df1597 100644 --- a/src/main/java/com/shzg/project/unique/domain/WornUniqueCodeEvent.java +++ b/src/main/java/com/shzg/project/unique/domain/WornUniqueCodeEvent.java @@ -22,8 +22,8 @@ public class WornUniqueCodeEvent extends BaseEntity @Excel(name = "唯一码ID") private Long uniqueCodeId; - /** 事件类型(0生成 1打印 2入库 3出库 4配送) */ - @Excel(name = "事件类型", readConverterExp = "0=生成,1=打印,2=入库,3=出库,4=配送") + /** 事件类型(0生成唯一码 1生成入库单号 2快速入库 3生成出库单号 4快速出库) */ + @Excel(name = "事件类型", readConverterExp = "0=生成唯一码,1=生成入库单号,2=快速入库,3=生成出库单号,4=快速出库") private String eventType; /** 事件状态 */ diff --git a/src/main/java/com/shzg/project/unique/mapper/WornUniqueCodeMapper.java b/src/main/java/com/shzg/project/unique/mapper/WornUniqueCodeMapper.java index d05a021..b27f5ba 100644 --- a/src/main/java/com/shzg/project/unique/mapper/WornUniqueCodeMapper.java +++ b/src/main/java/com/shzg/project/unique/mapper/WornUniqueCodeMapper.java @@ -2,6 +2,7 @@ package com.shzg.project.unique.mapper; import java.util.List; import com.shzg.project.unique.domain.WornUniqueCode; +import io.lettuce.core.dynamic.annotation.Param; /** * 唯一码管理Mapper接口 @@ -51,4 +52,16 @@ public interface WornUniqueCodeMapper * @return 结果 */ public int deleteWornUniqueCodeByIds(Long[] ids); + + /** + * 根据唯一码更新状态 + * @param wornUniqueCode 唯一码对象 + * @return 影响行数 + */ + int updateByCode(WornUniqueCode wornUniqueCode); + + /** + * 根据code查询id + */ + Long selectIdByCode(@Param("code") Integer code); } diff --git a/src/main/java/com/shzg/project/unique/service/impl/WornUniqueCodeServiceImpl.java b/src/main/java/com/shzg/project/unique/service/impl/WornUniqueCodeServiceImpl.java index 5b2adee..bf679cb 100644 --- a/src/main/java/com/shzg/project/unique/service/impl/WornUniqueCodeServiceImpl.java +++ b/src/main/java/com/shzg/project/unique/service/impl/WornUniqueCodeServiceImpl.java @@ -78,6 +78,7 @@ public class WornUniqueCodeServiceImpl implements IWornUniqueCodeService return code; } + /** * 查询唯一码管理列表 * @@ -88,6 +89,10 @@ public class WornUniqueCodeServiceImpl implements IWornUniqueCodeService @Override public List selectWornUniqueCodeList(WornUniqueCode wornUniqueCode) { + if (!SecurityUtils.isAdmin()) + { + wornUniqueCode.setProjectId(SecurityUtils.getDeptId()); + } return wornUniqueCodeMapper.selectWornUniqueCodeList(wornUniqueCode); } @@ -97,6 +102,9 @@ public class WornUniqueCodeServiceImpl implements IWornUniqueCodeService * @param wornUniqueCode 唯一码管理 * @return 结果 */ + /** + * 新增唯一码管理 + */ @Override @Transactional(rollbackFor = Exception.class) public int insertWornUniqueCode(WornUniqueCode wornUniqueCode) @@ -109,19 +117,28 @@ public class WornUniqueCodeServiceImpl implements IWornUniqueCodeService } /* ================== 1️⃣ 获取当前用户 ================== */ -// Long userId = SecurityUtils.getLoginUser().getUser().getUserId(); -// Long deptId = SecurityUtils.getLoginUser().getUser().getDeptId(); - Long userId = 111L; - Long deptId = 222L; + Long userId = SecurityUtils.getLoginUser().getUser().getUserId(); + Long deptId = SecurityUtils.getLoginUser().getUser().getDeptId(); wornUniqueCode.setProjectId(deptId); /* ================== 2️⃣ 主表 ================== */ wornUniqueCode.setCreateTime(DateUtils.getNowDate()); wornUniqueCode.setCreateBy(String.valueOf(userId)); - wornUniqueCode.setStatus("0"); wornUniqueCode.setIsDelete("0"); + // 🔥 关键修改:根据 billNo 判断状态 + if (wornUniqueCode.getBillNo() != null && !wornUniqueCode.getBillNo().trim().isEmpty()) + { + wornUniqueCode.setStatus("1"); // 已生成入库单号 + wornUniqueCode.setBillNo(wornUniqueCode.getBillNo()); + } + else + { + wornUniqueCode.setStatus("0"); // 初始化 + } + + // 先占位 wornUniqueCode.setCode(0); wornUniqueCodeMapper.insertWornUniqueCode(wornUniqueCode); @@ -154,16 +171,25 @@ public class WornUniqueCodeServiceImpl implements IWornUniqueCodeService /* ================== 5️⃣ 插入事件 ================== */ WornUniqueCodeEvent event = new WornUniqueCodeEvent(); event.setUniqueCodeId(id); - event.setEventType("0"); - event.setEventStatus("0"); - event.setEventDesc("唯一码生成"); - event.setOperatorId(userId); - event.setCreateTime(DateUtils.getNowDate()); event.setCreateBy(String.valueOf(userId)); event.setIsDelete("0"); + // 🔥 关键修改:根据 billNo 判断事件类型 + if (wornUniqueCode.getBillNo() != null && !wornUniqueCode.getBillNo().trim().isEmpty()) + { + event.setEventType("1"); // 生成入库单号 + event.setEventStatus("1"); + event.setEventDesc("生成入库单号"); + } + else + { + event.setEventType("0"); // 唯一码生成 + event.setEventStatus("0"); + event.setEventDesc("唯一码生成"); + } + eventMapper.insertWornUniqueCodeEvent(event); return 1; diff --git a/src/main/java/com/shzg/project/worn/controller/WornInboundBillController.java b/src/main/java/com/shzg/project/worn/controller/WornInboundBillController.java new file mode 100644 index 0000000..85d565b --- /dev/null +++ b/src/main/java/com/shzg/project/worn/controller/WornInboundBillController.java @@ -0,0 +1,104 @@ +package com.shzg.project.worn.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.shzg.framework.aspectj.lang.annotation.Log; +import com.shzg.framework.aspectj.lang.enums.BusinessType; +import com.shzg.project.worn.domain.WornInboundBill; +import com.shzg.project.worn.service.IWornInboundBillService; +import com.shzg.framework.web.controller.BaseController; +import com.shzg.framework.web.domain.AjaxResult; +import com.shzg.common.utils.poi.ExcelUtil; +import com.shzg.framework.web.page.TableDataInfo; + +/** + * 入库库存Controller + * + * @author shzg + * @date 2026-03-26 + */ +@RestController +@RequestMapping("/worn/inboundBill") +public class WornInboundBillController extends BaseController +{ + @Autowired + private IWornInboundBillService wornInboundBillService; + + /** + * 查询入库库存列表 + */ + @PreAuthorize("@ss.hasPermi('worn:inbound:list')") + @GetMapping("/list") + public TableDataInfo list(WornInboundBill wornInboundBill) + { + startPage(); + List list = wornInboundBillService.selectWornInboundBillList(wornInboundBill); + return getDataTable(list); + } + + /** + * 导出入库库存列表 + */ + @PreAuthorize("@ss.hasPermi('worn:inbound:export')") + @Log(title = "入库库存", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, WornInboundBill wornInboundBill) + { + List list = wornInboundBillService.selectWornInboundBillList(wornInboundBill); + ExcelUtil util = new ExcelUtil(WornInboundBill.class); + util.exportExcel(response, list, "入库库存数据"); + } + + /** + * 获取入库库存详细信息 + */ + @PreAuthorize("@ss.hasPermi('worn:inbound:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return success(wornInboundBillService.selectWornInboundBillById(id)); + } + + /** + * 新增入库库存 + */ + @PreAuthorize("@ss.hasPermi('worn:inbound:add')") + @Log(title = "入库库存", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WornInboundBill wornInboundBill) + { + return toAjax(wornInboundBillService.insertWornInboundBill(wornInboundBill)); + } + + /** + * 修改入库库存 + */ + @PreAuthorize("@ss.hasPermi('worn:inbound:edit')") + @Log(title = "入库库存", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WornInboundBill wornInboundBill) + { + return toAjax(wornInboundBillService.updateWornInboundBill(wornInboundBill)); + } + + /** + * 删除入库库存 + */ + @PreAuthorize("@ss.hasPermi('worn:inbound:remove')") + @Log(title = "入库库存", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(wornInboundBillService.deleteWornInboundBillByIds(ids)); + } +} diff --git a/src/main/java/com/shzg/project/worn/controller/WornInboundItemController.java b/src/main/java/com/shzg/project/worn/controller/WornInboundItemController.java new file mode 100644 index 0000000..de57213 --- /dev/null +++ b/src/main/java/com/shzg/project/worn/controller/WornInboundItemController.java @@ -0,0 +1,104 @@ +package com.shzg.project.worn.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.shzg.framework.aspectj.lang.annotation.Log; +import com.shzg.framework.aspectj.lang.enums.BusinessType; +import com.shzg.project.worn.domain.WornInboundItem; +import com.shzg.project.worn.service.IWornInboundItemService; +import com.shzg.framework.web.controller.BaseController; +import com.shzg.framework.web.domain.AjaxResult; +import com.shzg.common.utils.poi.ExcelUtil; +import com.shzg.framework.web.page.TableDataInfo; + +/** + * 入库单明细Controller + * + * @author shzg + * @date 2026-03-26 + */ +@RestController +@RequestMapping("/worn/item") +public class WornInboundItemController extends BaseController +{ + @Autowired + private IWornInboundItemService wornInboundItemService; + + /** + * 查询入库单明细列表 + */ + @PreAuthorize("@ss.hasPermi('worn:item:list')") + @GetMapping("/list") + public TableDataInfo list(WornInboundItem wornInboundItem) + { + startPage(); + List list = wornInboundItemService.selectWornInboundItemList(wornInboundItem); + return getDataTable(list); + } + + /** + * 导出入库单明细列表 + */ + @PreAuthorize("@ss.hasPermi('worn:item:export')") + @Log(title = "入库单明细", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, WornInboundItem wornInboundItem) + { + List list = wornInboundItemService.selectWornInboundItemList(wornInboundItem); + ExcelUtil util = new ExcelUtil(WornInboundItem.class); + util.exportExcel(response, list, "入库单明细数据"); + } + + /** + * 获取入库单明细详细信息 + */ + @PreAuthorize("@ss.hasPermi('worn:item:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return success(wornInboundItemService.selectWornInboundItemById(id)); + } + + /** + * 新增入库单明细 + */ + @PreAuthorize("@ss.hasPermi('worn:item:add')") + @Log(title = "入库单明细", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WornInboundItem wornInboundItem) + { + return toAjax(wornInboundItemService.insertWornInboundItem(wornInboundItem)); + } + + /** + * 修改入库单明细 + */ + @PreAuthorize("@ss.hasPermi('worn:item:edit')") + @Log(title = "入库单明细", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WornInboundItem wornInboundItem) + { + return toAjax(wornInboundItemService.updateWornInboundItem(wornInboundItem)); + } + + /** + * 删除入库单明细 + */ + @PreAuthorize("@ss.hasPermi('worn:item:remove')") + @Log(title = "入库单明细", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(wornInboundItemService.deleteWornInboundItemByIds(ids)); + } +} diff --git a/src/main/java/com/shzg/project/worn/domain/WornInboundBill.java b/src/main/java/com/shzg/project/worn/domain/WornInboundBill.java new file mode 100644 index 0000000..507a111 --- /dev/null +++ b/src/main/java/com/shzg/project/worn/domain/WornInboundBill.java @@ -0,0 +1,117 @@ +package com.shzg.project.worn.domain; + +import java.util.Date; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.shzg.framework.web.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.shzg.framework.aspectj.lang.annotation.Excel; + +/** + * 入库库存对象 worn_inbound_bill + */ +public class WornInboundBill extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 主键ID */ + private Long id; + + /** 入库单号 */ + @Excel(name = "入库单号") + private String billNo; + + /** 入库单类型(0入库单入库 1调拨入库 2退货入库) */ + @Excel(name = "入库单类型", readConverterExp = "0=入库申请,1=入库成功") + private String billType; + + /** 仓库编码 */ + @Excel(name = "仓库编码") + private String warehouseCode; + + /** 仓库名称 */ + @Excel(name = "仓库名称") + private String warehouseName; + + /** 存储区编码 */ + @Excel(name = "存储区编码") + private String areaCode; + + /** 存储区名称 */ + @Excel(name = "存储区名称") + private String areaName; + + /** 入库时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "入库时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date inboundTime; + + /** 状态(0草稿 1已完成) */ + @Excel(name = "状态", readConverterExp = "0=草稿,1=已完成") + private String status; + + /** 逻辑删除(0正常 1删除) */ + @Excel(name = "逻辑删除", readConverterExp = "0=正常,1=删除") + private String isDelete; + + /** ================== 新增:明细列表 ================== */ + private List itemList; + + public Long getId() { return id; } + public void setId(Long id) { this.id = id; } + + public String getBillNo() { return billNo; } + public void setBillNo(String billNo) { this.billNo = billNo; } + + public String getBillType() { return billType; } + public void setBillType(String billType) { this.billType = billType; } + + public String getWarehouseCode() { return warehouseCode; } + public void setWarehouseCode(String warehouseCode) { this.warehouseCode = warehouseCode; } + + public String getWarehouseName() { return warehouseName; } + public void setWarehouseName(String warehouseName) { this.warehouseName = warehouseName; } + + public String getAreaCode() { return areaCode; } + public void setAreaCode(String areaCode) { this.areaCode = areaCode; } + + public String getAreaName() { return areaName; } + public void setAreaName(String areaName) { this.areaName = areaName; } + + public Date getInboundTime() { return inboundTime; } + public void setInboundTime(Date inboundTime) { this.inboundTime = inboundTime; } + + public String getStatus() { return status; } + public void setStatus(String status) { this.status = status; } + + public String getIsDelete() { return isDelete; } + public void setIsDelete(String isDelete) { this.isDelete = isDelete; } + + public List getItemList() { return itemList; } + public void setItemList(List itemList) { this.itemList = itemList; } + + @Override + public String toString() + { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("billNo", getBillNo()) + .append("billType", getBillType()) + .append("warehouseCode", getWarehouseCode()) + .append("warehouseName", getWarehouseName()) + .append("areaCode", getAreaCode()) + .append("areaName", getAreaName()) + .append("remark", getRemark()) + .append("inboundTime", getInboundTime()) + .append("status", getStatus()) + .append("isDelete", getIsDelete()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("itemList", getItemList()) + .toString(); + } +} \ No newline at end of file diff --git a/src/main/java/com/shzg/project/worn/domain/WornInboundItem.java b/src/main/java/com/shzg/project/worn/domain/WornInboundItem.java new file mode 100644 index 0000000..2a03fa5 --- /dev/null +++ b/src/main/java/com/shzg/project/worn/domain/WornInboundItem.java @@ -0,0 +1,125 @@ +package com.shzg.project.worn.domain; + +import java.math.BigDecimal; + +import com.shzg.framework.web.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.shzg.framework.aspectj.lang.annotation.Excel; + +/** + * 入库单明细对象 worn_inbound_item + * + * @author shzg + * @date 2026-03-26 + */ +public class WornInboundItem extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 主键ID */ + private Long id; + + /** 入库单ID */ + @Excel(name = "入库单ID") + private Long billId; + + /** 入库单号 */ + @Excel(name = "入库单号") + private String billNo; + + /** 物料ID */ + @Excel(name = "物料ID") + private Long materialId; + + /** 数量 */ + @Excel(name = "数量") + private BigDecimal quantity; + + /** 唯一码编码 */ + @Excel(name = "唯一码编码") + private Integer uniqueCode; + + /** 物料备注 */ + @Excel(name = "物料备注") + private String remark; + + // ================== 物料扩展信息(查询用,不入库) ================== + + /** 物料名称 */ + @Excel(name = "物料名称") + private String materialName; + + /** 物料简称 */ + @Excel(name = "物料简称") + private String materialShortName; + + /** 物料编码 */ + @Excel(name = "物料编码") + private String materialCode; + + /** 规格 */ + @Excel(name = "规格") + private String specification; + + /** 型号 */ + @Excel(name = "型号") + private String model; + + // ================== getter / setter ================== + + public Long getId() { return id; } + public void setId(Long id) { this.id = id; } + + public Long getBillId() { return billId; } + public void setBillId(Long billId) { this.billId = billId; } + + public String getBillNo() { return billNo; } + public void setBillNo(String billNo) { this.billNo = billNo; } + + public Long getMaterialId() { return materialId; } + public void setMaterialId(Long materialId) { this.materialId = materialId; } + + public BigDecimal getQuantity() { return quantity; } + public void setQuantity(BigDecimal quantity) { this.quantity = quantity; } + + public Integer getUniqueCode() { return uniqueCode; } + public void setUniqueCode(Integer uniqueCode) { this.uniqueCode = uniqueCode; } + + public String getRemark() { return remark; } + public void setRemark(String remark) { this.remark = remark; } + + public String getMaterialName() { return materialName; } + public void setMaterialName(String materialName) { this.materialName = materialName; } + + public String getMaterialShortName() { return materialShortName; } + public void setMaterialShortName(String materialShortName) { this.materialShortName = materialShortName; } + + public String getMaterialCode() { return materialCode; } + public void setMaterialCode(String materialCode) { this.materialCode = materialCode; } + + public String getSpecification() { return specification; } + public void setSpecification(String specification) { this.specification = specification; } + + public String getModel() { return model; } + public void setModel(String model) { this.model = model; } + + // ================== toString ================== + + @Override + public String toString() { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("billId", getBillId()) + .append("billNo", getBillNo()) + .append("materialId", getMaterialId()) + .append("materialName", getMaterialName()) + .append("materialCode", getMaterialCode()) + .append("quantity", getQuantity()) + .append("uniqueCode", getUniqueCode()) + .append("remark", getRemark()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .toString(); + } +} \ No newline at end of file diff --git a/src/main/java/com/shzg/project/worn/domain/WornMaterial.java b/src/main/java/com/shzg/project/worn/domain/WornMaterial.java index 11bd998..656e33a 100644 --- a/src/main/java/com/shzg/project/worn/domain/WornMaterial.java +++ b/src/main/java/com/shzg/project/worn/domain/WornMaterial.java @@ -80,6 +80,10 @@ public class WornMaterial extends BaseEntity @Excel(name = "逻辑删除", readConverterExp = "0=正常,1=删除") private String isDelete; + // ================== 🔥 新增 keyword(模糊搜索) ================== + /** 关键字(用于模糊查询,不落库) */ + private String keyword; + // ================== 查询展示字段(不落库) ================== @@ -96,209 +100,177 @@ public class WornMaterial extends BaseEntity private String typeParentNames; - public Long getId() - { + public Long getId() { return id; } - public void setId(Long id) - { + public void setId(Long id) { this.id = id; } - public String getMaterialName() - { + public String getMaterialName() { return materialName; } - public void setMaterialName(String materialName) - { + public void setMaterialName(String materialName) { this.materialName = materialName; } - public String getMaterialShortName() - { + public String getMaterialShortName() { return materialShortName; } - public void setMaterialShortName(String materialShortName) - { + public void setMaterialShortName(String materialShortName) { this.materialShortName = materialShortName; } - public String getMaterialCode() - { + public String getMaterialCode() { return materialCode; } - public void setMaterialCode(String materialCode) - { + public void setMaterialCode(String materialCode) { this.materialCode = materialCode; } - public Long getTypeId() - { + public Long getTypeId() { return typeId; } - public void setTypeId(Long typeId) - { + public void setTypeId(Long typeId) { this.typeId = typeId; } - public Long getUnitId() - { + public Long getUnitId() { return unitId; } - public void setUnitId(Long unitId) - { + public void setUnitId(Long unitId) { this.unitId = unitId; } - public String getMaterialCategory() - { + public String getMaterialCategory() { return materialCategory; } - public void setMaterialCategory(String materialCategory) - { + public void setMaterialCategory(String materialCategory) { this.materialCategory = materialCategory; } - public BigDecimal getKgFactor() - { + public BigDecimal getKgFactor() { return kgFactor; } - public void setKgFactor(BigDecimal kgFactor) - { + public void setKgFactor(BigDecimal kgFactor) { this.kgFactor = kgFactor; } - public String getSpecification() - { + public String getSpecification() { return specification; } - public void setSpecification(String specification) - { + public void setSpecification(String specification) { this.specification = specification; } - public String getModel() - { + public String getModel() { return model; } - public void setModel(String model) - { + public void setModel(String model) { this.model = model; } - public String getBarcode() - { + public String getBarcode() { return barcode; } - public void setBarcode(String barcode) - { + public void setBarcode(String barcode) { this.barcode = barcode; } - public BigDecimal getWeight() - { + public BigDecimal getWeight() { return weight; } - public void setWeight(BigDecimal weight) - { + public void setWeight(BigDecimal weight) { this.weight = weight; } - public String getDescription() - { + public String getDescription() { return description; } - public void setDescription(String description) - { + public void setDescription(String description) { this.description = description; } - public Long getOrderNum() - { + public Long getOrderNum() { return orderNum; } - public void setOrderNum(Long orderNum) - { + public void setOrderNum(Long orderNum) { this.orderNum = orderNum; } - public String getStatus() - { + public String getStatus() { return status; } - public void setStatus(String status) - { + public void setStatus(String status) { this.status = status; } - public String getIsDelete() - { + public String getIsDelete() { return isDelete; } - public void setIsDelete(String isDelete) - { + public void setIsDelete(String isDelete) { this.isDelete = isDelete; } - public String getUnitName() - { + public String getKeyword() { + return keyword; + } + + public void setKeyword(String keyword) { + this.keyword = keyword; + } + + public String getUnitName() { return unitName; } - public void setUnitName(String unitName) - { + public void setUnitName(String unitName) { this.unitName = unitName; } - public String getTypeName() - { + public String getTypeName() { return typeName; } - public void setTypeName(String typeName) - { + public void setTypeName(String typeName) { this.typeName = typeName; } - public String getTypeAncestors() - { + public String getTypeAncestors() { return typeAncestors; } - public void setTypeAncestors(String typeAncestors) - { + public void setTypeAncestors(String typeAncestors) { this.typeAncestors = typeAncestors; } - public String getTypeParentNames() - { + public String getTypeParentNames() { return typeParentNames; } - public void setTypeParentNames(String typeParentNames) - { + public void setTypeParentNames(String typeParentNames) { this.typeParentNames = typeParentNames; } @Override public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) .append("id", getId()) .append("materialName", getMaterialName()) .append("materialShortName", getMaterialShortName()) @@ -315,6 +287,7 @@ public class WornMaterial extends BaseEntity .append("orderNum", getOrderNum()) .append("status", getStatus()) .append("isDelete", getIsDelete()) + .append("keyword", getKeyword()) .append("unitName", getUnitName()) .append("typeName", getTypeName()) .append("typeAncestors", getTypeAncestors()) diff --git a/src/main/java/com/shzg/project/worn/mapper/WornInboundBillMapper.java b/src/main/java/com/shzg/project/worn/mapper/WornInboundBillMapper.java new file mode 100644 index 0000000..3ceab4a --- /dev/null +++ b/src/main/java/com/shzg/project/worn/mapper/WornInboundBillMapper.java @@ -0,0 +1,61 @@ +package com.shzg.project.worn.mapper; + +import java.util.List; +import com.shzg.project.worn.domain.WornInboundBill; + +/** + * 入库库存Mapper接口 + * + * @author shzg + * @date 2026-03-26 + */ +public interface WornInboundBillMapper +{ + /** + * 查询入库库存 + * + * @param id 入库库存主键 + * @return 入库库存 + */ + public WornInboundBill selectWornInboundBillById(Long id); + + /** + * 查询入库库存列表 + * + * @param wornInboundBill 入库库存 + * @return 入库库存集合 + */ + public List selectWornInboundBillList(WornInboundBill wornInboundBill); + + /** + * 新增入库库存 + * + * @param wornInboundBill 入库库存 + * @return 结果 + */ + public int insertWornInboundBill(WornInboundBill wornInboundBill); + + /** + * 修改入库库存 + * + * @param wornInboundBill 入库库存 + * @return 结果 + */ + public int updateWornInboundBill(WornInboundBill wornInboundBill); + + /** + * 删除入库库存 + * + * @param id 入库库存主键 + * @return 结果 + */ + public int deleteWornInboundBillById(Long id); + + /** + * 批量删除入库库存 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteWornInboundBillByIds(Long[] ids); +} diff --git a/src/main/java/com/shzg/project/worn/mapper/WornInboundItemMapper.java b/src/main/java/com/shzg/project/worn/mapper/WornInboundItemMapper.java new file mode 100644 index 0000000..3028971 --- /dev/null +++ b/src/main/java/com/shzg/project/worn/mapper/WornInboundItemMapper.java @@ -0,0 +1,61 @@ +package com.shzg.project.worn.mapper; + +import java.util.List; +import com.shzg.project.worn.domain.WornInboundItem; + +/** + * 入库单明细Mapper接口 + * + * @author shzg + * @date 2026-03-26 + */ +public interface WornInboundItemMapper +{ + /** + * 查询入库单明细 + * + * @param id 入库单明细主键 + * @return 入库单明细 + */ + public WornInboundItem selectWornInboundItemById(Long id); + + /** + * 查询入库单明细列表 + * + * @param wornInboundItem 入库单明细 + * @return 入库单明细集合 + */ + public List selectWornInboundItemList(WornInboundItem wornInboundItem); + + /** + * 新增入库单明细 + * + * @param wornInboundItem 入库单明细 + * @return 结果 + */ + public int insertWornInboundItem(WornInboundItem wornInboundItem); + + /** + * 修改入库单明细 + * + * @param wornInboundItem 入库单明细 + * @return 结果 + */ + public int updateWornInboundItem(WornInboundItem wornInboundItem); + + /** + * 删除入库单明细 + * + * @param id 入库单明细主键 + * @return 结果 + */ + public int deleteWornInboundItemById(Long id); + + /** + * 批量删除入库单明细 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteWornInboundItemByIds(Long[] ids); +} diff --git a/src/main/java/com/shzg/project/sensor/config/MqttClientConfig.java b/src/main/java/com/shzg/project/worn/sensor/config/MqttClientConfig.java similarity index 97% rename from src/main/java/com/shzg/project/sensor/config/MqttClientConfig.java rename to src/main/java/com/shzg/project/worn/sensor/config/MqttClientConfig.java index 391808c..5e1246a 100644 --- a/src/main/java/com/shzg/project/sensor/config/MqttClientConfig.java +++ b/src/main/java/com/shzg/project/worn/sensor/config/MqttClientConfig.java @@ -1,6 +1,6 @@ -package com.shzg.project.sensor.config;//package com.zg.project.wisdom.config; +package com.shzg.project.worn.sensor.config;//package com.zg.project.wisdom.config; -import com.shzg.project.sensor.mqtt.dispatcher.MqttMessageDispatcher; +import com.shzg.project.worn.sensor.mqtt.dispatcher.MqttMessageDispatcher; import lombok.extern.slf4j.Slf4j; import org.eclipse.paho.client.mqttv3.*; import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence; diff --git a/src/main/java/com/shzg/project/sensor/config/MqttProperties.java b/src/main/java/com/shzg/project/worn/sensor/config/MqttProperties.java similarity index 95% rename from src/main/java/com/shzg/project/sensor/config/MqttProperties.java rename to src/main/java/com/shzg/project/worn/sensor/config/MqttProperties.java index 79913cf..d60edfc 100644 --- a/src/main/java/com/shzg/project/sensor/config/MqttProperties.java +++ b/src/main/java/com/shzg/project/worn/sensor/config/MqttProperties.java @@ -1,4 +1,4 @@ -package com.shzg.project.sensor.config; +package com.shzg.project.worn.sensor.config; import lombok.Data; import org.springframework.boot.context.properties.ConfigurationProperties; diff --git a/src/main/java/com/shzg/project/sensor/config/MqttPublishClient.java b/src/main/java/com/shzg/project/worn/sensor/config/MqttPublishClient.java similarity index 97% rename from src/main/java/com/shzg/project/sensor/config/MqttPublishClient.java rename to src/main/java/com/shzg/project/worn/sensor/config/MqttPublishClient.java index 210dee2..109f7c5 100644 --- a/src/main/java/com/shzg/project/sensor/config/MqttPublishClient.java +++ b/src/main/java/com/shzg/project/worn/sensor/config/MqttPublishClient.java @@ -1,4 +1,4 @@ -package com.shzg.project.sensor.config; +package com.shzg.project.worn.sensor.config; import lombok.extern.slf4j.Slf4j; import org.eclipse.paho.client.mqttv3.MqttClient; diff --git a/src/main/java/com/shzg/project/sensor/mqtt/dispatcher/MqttMessageDispatcher.java b/src/main/java/com/shzg/project/worn/sensor/mqtt/dispatcher/MqttMessageDispatcher.java similarity index 84% rename from src/main/java/com/shzg/project/sensor/mqtt/dispatcher/MqttMessageDispatcher.java rename to src/main/java/com/shzg/project/worn/sensor/mqtt/dispatcher/MqttMessageDispatcher.java index cb2651d..b445002 100644 --- a/src/main/java/com/shzg/project/sensor/mqtt/dispatcher/MqttMessageDispatcher.java +++ b/src/main/java/com/shzg/project/worn/sensor/mqtt/dispatcher/MqttMessageDispatcher.java @@ -1,8 +1,8 @@ -package com.shzg.project.sensor.mqtt.dispatcher; +package com.shzg.project.worn.sensor.mqtt.dispatcher; -import com.shzg.project.sensor.mqtt.handler.HumiSensorHandler; -import com.shzg.project.sensor.mqtt.handler.SmokeSensorHandler; -import com.shzg.project.sensor.mqtt.handler.TempSensorHandler; +import com.shzg.project.worn.sensor.mqtt.handler.HumiSensorHandler; +import com.shzg.project.worn.sensor.mqtt.handler.SmokeSensorHandler; +import com.shzg.project.worn.sensor.mqtt.handler.TempSensorHandler; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; diff --git a/src/main/java/com/shzg/project/sensor/mqtt/handler/HumiSensorHandler.java b/src/main/java/com/shzg/project/worn/sensor/mqtt/handler/HumiSensorHandler.java similarity index 95% rename from src/main/java/com/shzg/project/sensor/mqtt/handler/HumiSensorHandler.java rename to src/main/java/com/shzg/project/worn/sensor/mqtt/handler/HumiSensorHandler.java index 2a96861..2f33912 100644 --- a/src/main/java/com/shzg/project/sensor/mqtt/handler/HumiSensorHandler.java +++ b/src/main/java/com/shzg/project/worn/sensor/mqtt/handler/HumiSensorHandler.java @@ -1,4 +1,4 @@ -package com.shzg.project.sensor.mqtt.handler; +package com.shzg.project.worn.sensor.mqtt.handler; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; diff --git a/src/main/java/com/shzg/project/sensor/mqtt/handler/SmokeSensorHandler.java b/src/main/java/com/shzg/project/worn/sensor/mqtt/handler/SmokeSensorHandler.java similarity index 96% rename from src/main/java/com/shzg/project/sensor/mqtt/handler/SmokeSensorHandler.java rename to src/main/java/com/shzg/project/worn/sensor/mqtt/handler/SmokeSensorHandler.java index c99cddc..df4ca2a 100644 --- a/src/main/java/com/shzg/project/sensor/mqtt/handler/SmokeSensorHandler.java +++ b/src/main/java/com/shzg/project/worn/sensor/mqtt/handler/SmokeSensorHandler.java @@ -1,4 +1,4 @@ -package com.shzg.project.sensor.mqtt.handler; +package com.shzg.project.worn.sensor.mqtt.handler; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; diff --git a/src/main/java/com/shzg/project/sensor/mqtt/handler/TempSensorHandler.java b/src/main/java/com/shzg/project/worn/sensor/mqtt/handler/TempSensorHandler.java similarity index 96% rename from src/main/java/com/shzg/project/sensor/mqtt/handler/TempSensorHandler.java rename to src/main/java/com/shzg/project/worn/sensor/mqtt/handler/TempSensorHandler.java index e5e425d..a1f82a2 100644 --- a/src/main/java/com/shzg/project/sensor/mqtt/handler/TempSensorHandler.java +++ b/src/main/java/com/shzg/project/worn/sensor/mqtt/handler/TempSensorHandler.java @@ -1,4 +1,4 @@ -package com.shzg.project.sensor.mqtt.handler; +package com.shzg.project.worn.sensor.mqtt.handler; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; diff --git a/src/main/java/com/shzg/project/worn/service/IWornInboundBillService.java b/src/main/java/com/shzg/project/worn/service/IWornInboundBillService.java new file mode 100644 index 0000000..c7387ab --- /dev/null +++ b/src/main/java/com/shzg/project/worn/service/IWornInboundBillService.java @@ -0,0 +1,61 @@ +package com.shzg.project.worn.service; + +import java.util.List; +import com.shzg.project.worn.domain.WornInboundBill; + +/** + * 入库库存Service接口 + * + * @author shzg + * @date 2026-03-26 + */ +public interface IWornInboundBillService +{ + /** + * 查询入库库存 + * + * @param id 入库库存主键 + * @return 入库库存 + */ + public WornInboundBill selectWornInboundBillById(Long id); + + /** + * 查询入库库存列表 + * + * @param wornInboundBill 入库库存 + * @return 入库库存集合 + */ + public List selectWornInboundBillList(WornInboundBill wornInboundBill); + + /** + * 新增入库库存 + * + * @param wornInboundBill 入库库存 + * @return 结果 + */ + public int insertWornInboundBill(WornInboundBill wornInboundBill); + + /** + * 修改入库库存 + * + * @param wornInboundBill 入库库存 + * @return 结果 + */ + public int updateWornInboundBill(WornInboundBill wornInboundBill); + + /** + * 批量删除入库库存 + * + * @param ids 需要删除的入库库存主键集合 + * @return 结果 + */ + public int deleteWornInboundBillByIds(Long[] ids); + + /** + * 删除入库库存信息 + * + * @param id 入库库存主键 + * @return 结果 + */ + public int deleteWornInboundBillById(Long id); +} diff --git a/src/main/java/com/shzg/project/worn/service/IWornInboundItemService.java b/src/main/java/com/shzg/project/worn/service/IWornInboundItemService.java new file mode 100644 index 0000000..7e2e3c0 --- /dev/null +++ b/src/main/java/com/shzg/project/worn/service/IWornInboundItemService.java @@ -0,0 +1,61 @@ +package com.shzg.project.worn.service; + +import java.util.List; +import com.shzg.project.worn.domain.WornInboundItem; + +/** + * 入库单明细Service接口 + * + * @author shzg + * @date 2026-03-26 + */ +public interface IWornInboundItemService +{ + /** + * 查询入库单明细 + * + * @param id 入库单明细主键 + * @return 入库单明细 + */ + public WornInboundItem selectWornInboundItemById(Long id); + + /** + * 查询入库单明细列表 + * + * @param wornInboundItem 入库单明细 + * @return 入库单明细集合 + */ + public List selectWornInboundItemList(WornInboundItem wornInboundItem); + + /** + * 新增入库单明细 + * + * @param wornInboundItem 入库单明细 + * @return 结果 + */ + public int insertWornInboundItem(WornInboundItem wornInboundItem); + + /** + * 修改入库单明细 + * + * @param wornInboundItem 入库单明细 + * @return 结果 + */ + public int updateWornInboundItem(WornInboundItem wornInboundItem); + + /** + * 批量删除入库单明细 + * + * @param ids 需要删除的入库单明细主键集合 + * @return 结果 + */ + public int deleteWornInboundItemByIds(Long[] ids); + + /** + * 删除入库单明细信息 + * + * @param id 入库单明细主键 + * @return 结果 + */ + public int deleteWornInboundItemById(Long id); +} diff --git a/src/main/java/com/shzg/project/worn/service/impl/WornInboundBillServiceImpl.java b/src/main/java/com/shzg/project/worn/service/impl/WornInboundBillServiceImpl.java new file mode 100644 index 0000000..28d763b --- /dev/null +++ b/src/main/java/com/shzg/project/worn/service/impl/WornInboundBillServiceImpl.java @@ -0,0 +1,216 @@ +package com.shzg.project.worn.service.impl; + +import java.util.List; +import com.shzg.common.utils.DateUtils; +import com.shzg.common.utils.SecurityUtils; +import com.shzg.project.unique.domain.WornUniqueCode; +import com.shzg.project.unique.domain.WornUniqueCodeEvent; +import com.shzg.project.unique.mapper.WornUniqueCodeEventMapper; +import com.shzg.project.unique.mapper.WornUniqueCodeMapper; +import com.shzg.project.worn.domain.WornInboundItem; +import com.shzg.project.worn.mapper.WornInboundItemMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.shzg.project.worn.mapper.WornInboundBillMapper; +import com.shzg.project.worn.domain.WornInboundBill; +import com.shzg.project.worn.service.IWornInboundBillService; +import org.springframework.transaction.annotation.Transactional; + +/** + * 入库库存Service业务层处理 + * + * @author shzg + * @date 2026-03-26 + */ +@Service +public class WornInboundBillServiceImpl implements IWornInboundBillService +{ + @Autowired + private WornInboundBillMapper wornInboundBillMapper; + + @Autowired + private WornInboundItemMapper wornInboundItemMapper; + + @Autowired + private WornUniqueCodeMapper wornUniqueCodeMapper; + + @Autowired + private WornUniqueCodeEventMapper eventMapper; + + + /** + * 查询入库库存 + * + * @param id 入库库存主键 + * @return 入库库存 + */ + @Override + public WornInboundBill selectWornInboundBillById(Long id) + { + return wornInboundBillMapper.selectWornInboundBillById(id); + } + + /** + * 查询入库库存列表 + * + * @param wornInboundBill 入库库存 + * @return 入库库存 + */ + @Override + public List selectWornInboundBillList(WornInboundBill wornInboundBill) + { + return wornInboundBillMapper.selectWornInboundBillList(wornInboundBill); + } + + /** + * 新增入库库存 + * + * @param wornInboundBill 入库库存 + * @return 结果 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public int insertWornInboundBill(WornInboundBill wornInboundBill) + { + /* ================== 1. 参数校验 ================== */ + if (wornInboundBill == null) + { + throw new RuntimeException("入库单参数不能为空"); + } + if (wornInboundBill.getItemList() == null || wornInboundBill.getItemList().isEmpty()) + { + throw new RuntimeException("入库明细不能为空"); + } + + /* ================== 2. 当前用户 ================== */ + Long userId = SecurityUtils.getLoginUser().getUser().getUserId(); + + /* ================== 3. 主表赋值 ================== */ + wornInboundBill.setCreateTime(DateUtils.getNowDate()); + wornInboundBill.setCreateBy(String.valueOf(userId)); + wornInboundBill.setBillType("0"); + wornInboundBill.setStatus("0"); + wornInboundBill.setIsDelete("0"); + + // 生成单号 + if (wornInboundBill.getBillNo() == null || "".equals(wornInboundBill.getBillNo().trim())) + { + wornInboundBill.setBillNo("RK" + System.currentTimeMillis()); + } + + /* ================== 4. 插入主表 ================== */ + int rows = wornInboundBillMapper.insertWornInboundBill(wornInboundBill); + if (rows <= 0) + { + throw new RuntimeException("入库单新增失败"); + } + + Long billId = wornInboundBill.getId(); + String billNo = wornInboundBill.getBillNo(); + + if (billId == null) + { + throw new RuntimeException("入库单新增失败,ID未回填"); + } + + /* ================== 5. 插入明细 ================== */ + List itemList = wornInboundBill.getItemList(); + for (WornInboundItem item : itemList) + { + if (item == null) + { + continue; + } + + item.setBillId(billId); + item.setBillNo(billNo); + item.setCreateTime(DateUtils.getNowDate()); + item.setCreateBy(String.valueOf(userId)); + + int itemRows = wornInboundItemMapper.insertWornInboundItem(item); + if (itemRows <= 0) + { + throw new RuntimeException("入库明细新增失败"); + } + + /* ================== 6. 唯一码联动 ================== */ + if (item.getUniqueCode() != null) + { + Integer code = item.getUniqueCode(); + + Long uniqueId = wornUniqueCodeMapper.selectIdByCode(code); + if (uniqueId == null) + { + throw new RuntimeException("唯一码不存在:" + code); + } + + WornUniqueCode update = new WornUniqueCode(); + update.setCode(code); + update.setStatus("1"); + update.setUpdateBy(String.valueOf(userId)); + update.setUpdateTime(DateUtils.getNowDate()); + + int updateRows = wornUniqueCodeMapper.updateByCode(update); + if (updateRows <= 0) + { + throw new RuntimeException("唯一码状态更新失败:" + code); + } + + WornUniqueCodeEvent event = new WornUniqueCodeEvent(); + event.setUniqueCodeId(uniqueId); + event.setEventType("1"); + event.setEventStatus("1"); + event.setEventDesc("入库单入库"); + event.setOperatorId(userId); + event.setCreateBy(String.valueOf(userId)); + event.setCreateTime(DateUtils.getNowDate()); + event.setIsDelete("0"); + + int eventRows = eventMapper.insertWornUniqueCodeEvent(event); + if (eventRows <= 0) + { + throw new RuntimeException("唯一码事件记录失败:" + code); + } + } + } + + return 1; + } + + /** + * 修改入库库存 + * + * @param wornInboundBill 入库库存 + * @return 结果 + */ + @Override + public int updateWornInboundBill(WornInboundBill wornInboundBill) + { + wornInboundBill.setUpdateTime(DateUtils.getNowDate()); + return wornInboundBillMapper.updateWornInboundBill(wornInboundBill); + } + + /** + * 批量删除入库库存 + * + * @param ids 需要删除的入库库存主键 + * @return 结果 + */ + @Override + public int deleteWornInboundBillByIds(Long[] ids) + { + return wornInboundBillMapper.deleteWornInboundBillByIds(ids); + } + + /** + * 删除入库库存信息 + * + * @param id 入库库存主键 + * @return 结果 + */ + @Override + public int deleteWornInboundBillById(Long id) + { + return wornInboundBillMapper.deleteWornInboundBillById(id); + } +} diff --git a/src/main/java/com/shzg/project/worn/service/impl/WornInboundItemServiceImpl.java b/src/main/java/com/shzg/project/worn/service/impl/WornInboundItemServiceImpl.java new file mode 100644 index 0000000..0797e5d --- /dev/null +++ b/src/main/java/com/shzg/project/worn/service/impl/WornInboundItemServiceImpl.java @@ -0,0 +1,95 @@ +package com.shzg.project.worn.service.impl; + +import java.util.List; +import com.shzg.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.shzg.project.worn.mapper.WornInboundItemMapper; +import com.shzg.project.worn.domain.WornInboundItem; +import com.shzg.project.worn.service.IWornInboundItemService; + +/** + * 入库单明细Service业务层处理 + * + * @author shzg + * @date 2026-03-26 + */ +@Service +public class WornInboundItemServiceImpl implements IWornInboundItemService +{ + @Autowired + private WornInboundItemMapper wornInboundItemMapper; + + /** + * 查询入库单明细 + * + * @param id 入库单明细主键 + * @return 入库单明细 + */ + @Override + public WornInboundItem selectWornInboundItemById(Long id) + { + return wornInboundItemMapper.selectWornInboundItemById(id); + } + + /** + * 查询入库单明细列表 + * + * @param wornInboundItem 入库单明细 + * @return 入库单明细 + */ + @Override + public List selectWornInboundItemList(WornInboundItem wornInboundItem) + { + return wornInboundItemMapper.selectWornInboundItemList(wornInboundItem); + } + + /** + * 新增入库单明细 + * + * @param wornInboundItem 入库单明细 + * @return 结果 + */ + @Override + public int insertWornInboundItem(WornInboundItem wornInboundItem) + { + wornInboundItem.setCreateTime(DateUtils.getNowDate()); + return wornInboundItemMapper.insertWornInboundItem(wornInboundItem); + } + + /** + * 修改入库单明细 + * + * @param wornInboundItem 入库单明细 + * @return 结果 + */ + @Override + public int updateWornInboundItem(WornInboundItem wornInboundItem) + { + return wornInboundItemMapper.updateWornInboundItem(wornInboundItem); + } + + /** + * 批量删除入库单明细 + * + * @param ids 需要删除的入库单明细主键 + * @return 结果 + */ + @Override + public int deleteWornInboundItemByIds(Long[] ids) + { + return wornInboundItemMapper.deleteWornInboundItemByIds(ids); + } + + /** + * 删除入库单明细信息 + * + * @param id 入库单明细主键 + * @return 结果 + */ + @Override + public int deleteWornInboundItemById(Long id) + { + return wornInboundItemMapper.deleteWornInboundItemById(id); + } +} diff --git a/src/main/resources/mybatis/unique/WornUniqueCodeMapper.xml b/src/main/resources/mybatis/unique/WornUniqueCodeMapper.xml index 5359992..5164068 100644 --- a/src/main/resources/mybatis/unique/WornUniqueCodeMapper.xml +++ b/src/main/resources/mybatis/unique/WornUniqueCodeMapper.xml @@ -1,9 +1,9 @@ + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - + @@ -21,7 +21,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select id, code, bill_no, project_id, status, rfid_code, print_count, create_by, create_time, update_by, update_time, remark, is_delete from worn_unique_code + select id, code, bill_no, project_id, status, rfid_code, print_count, create_by, create_time, update_by, update_time, remark, is_delete + from worn_unique_code - + + + insert into worn_unique_code @@ -57,7 +77,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update_time, remark, is_delete, - + #{code}, #{billNo}, @@ -71,7 +91,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{updateTime}, #{remark}, #{isDelete}, - + @@ -93,6 +113,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where id = #{id} + + update worn_unique_code + set status = #{status}, + update_by = #{updateBy}, + update_time = #{updateTime} + where code = #{code} + + delete from worn_unique_code where id in diff --git a/src/main/resources/mybatis/worn/WornInboundBillMapper.xml b/src/main/resources/mybatis/worn/WornInboundBillMapper.xml new file mode 100644 index 0000000..1676680 --- /dev/null +++ b/src/main/resources/mybatis/worn/WornInboundBillMapper.xml @@ -0,0 +1,116 @@ + + + + + + + + + + + + + + + + + + + + + + + + select id, bill_no, bill_type, warehouse_code, warehouse_name, area_code, area_name, remark, inbound_time, status, is_delete, create_by, create_time, update_by, update_time from worn_inbound_bill + + + + + + + + insert into worn_inbound_bill + + bill_no, + bill_type, + warehouse_code, + warehouse_name, + area_code, + area_name, + remark, + inbound_time, + status, + is_delete, + create_by, + create_time, + update_by, + update_time, + + + #{billNo}, + #{billType}, + #{warehouseCode}, + #{warehouseName}, + #{areaCode}, + #{areaName}, + #{remark}, + #{inboundTime}, + #{status}, + #{isDelete}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update worn_inbound_bill + + bill_no = #{billNo}, + bill_type = #{billType}, + warehouse_code = #{warehouseCode}, + warehouse_name = #{warehouseName}, + area_code = #{areaCode}, + area_name = #{areaName}, + remark = #{remark}, + inbound_time = #{inboundTime}, + status = #{status}, + is_delete = #{isDelete}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where id = #{id} + + + + delete from worn_inbound_bill where id = #{id} + + + + delete from worn_inbound_bill where id in + + #{id} + + + \ No newline at end of file diff --git a/src/main/resources/mybatis/worn/WornInboundItemMapper.xml b/src/main/resources/mybatis/worn/WornInboundItemMapper.xml new file mode 100644 index 0000000..5546579 --- /dev/null +++ b/src/main/resources/mybatis/worn/WornInboundItemMapper.xml @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + select id, bill_id, bill_no, material_id, quantity, unique_code, remark, create_by, create_time from worn_inbound_item + + + + + + + + insert into worn_inbound_item + + bill_id, + bill_no, + material_id, + quantity, + unique_code, + remark, + create_by, + create_time, + + + #{billId}, + #{billNo}, + #{materialId}, + #{quantity}, + #{uniqueCode}, + #{remark}, + #{createBy}, + #{createTime}, + + + + + update worn_inbound_item + + bill_id = #{billId}, + bill_no = #{billNo}, + material_id = #{materialId}, + quantity = #{quantity}, + unique_code = #{uniqueCode}, + remark = #{remark}, + create_by = #{createBy}, + create_time = #{createTime}, + + where id = #{id} + + + + delete from worn_inbound_item where id = #{id} + + + + delete from worn_inbound_item where id in + + #{id} + + + \ No newline at end of file diff --git a/src/main/resources/mybatis/worn/WornMaterialMapper.xml b/src/main/resources/mybatis/worn/WornMaterialMapper.xml index 4b34057..32057ae 100644 --- a/src/main/resources/mybatis/worn/WornMaterialMapper.xml +++ b/src/main/resources/mybatis/worn/WornMaterialMapper.xml @@ -91,6 +91,20 @@ + + AND ( + wm.material_name LIKE CONCAT('%', #{keyword}, '%') + OR wm.material_short_name LIKE CONCAT('%', #{keyword}, '%') + OR wm.material_code LIKE CONCAT('%', #{keyword}, '%') + OR wm.specification LIKE CONCAT('%', #{keyword}, '%') + OR wm.model LIKE CONCAT('%', #{keyword}, '%') + OR wm.barcode LIKE CONCAT('%', #{keyword}, '%') + OR wm.description LIKE CONCAT('%', #{keyword}, '%') + OR t.type_name LIKE CONCAT('%', #{keyword}, '%') + OR u.unit_name LIKE CONCAT('%', #{keyword}, '%') + ) + + AND wm.material_name LIKE CONCAT('%',#{materialName},'%')