新增入库模块

This commit is contained in:
2026-03-26 16:06:40 +08:00
parent 9e41dbdc9f
commit 188882a9ff
27 changed files with 1381 additions and 120 deletions

View File

@@ -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<WornUniqueCode> list = wornUniqueCodeService.selectWornUniqueCodeList(wornUniqueCode);
return getDataTable(list);
}
/**

View File

@@ -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编码 */

View File

@@ -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;
/** 事件状态 */

View File

@@ -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);
}

View File

@@ -78,6 +78,7 @@ public class WornUniqueCodeServiceImpl implements IWornUniqueCodeService
return code;
}
/**
* 查询唯一码管理列表
*
@@ -88,6 +89,10 @@ public class WornUniqueCodeServiceImpl implements IWornUniqueCodeService
@Override
public List<WornUniqueCode> 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;

View File

@@ -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<WornInboundBill> 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<WornInboundBill> list = wornInboundBillService.selectWornInboundBillList(wornInboundBill);
ExcelUtil<WornInboundBill> util = new ExcelUtil<WornInboundBill>(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));
}
}

View File

@@ -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<WornInboundItem> 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<WornInboundItem> list = wornInboundItemService.selectWornInboundItemList(wornInboundItem);
ExcelUtil<WornInboundItem> util = new ExcelUtil<WornInboundItem>(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));
}
}

View File

@@ -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<WornInboundItem> 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<WornInboundItem> getItemList() { return itemList; }
public void setItemList(List<WornInboundItem> 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();
}
}

View File

@@ -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();
}
}

View File

@@ -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())

View File

@@ -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<WornInboundBill> 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);
}

View File

@@ -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<WornInboundItem> 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);
}

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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<WornInboundBill> 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);
}

View File

@@ -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<WornInboundItem> 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);
}

View File

@@ -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<WornInboundBill> 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<WornInboundItem> 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);
}
}

View File

@@ -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<WornInboundItem> 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);
}
}

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.shzg.project.unique.mapper.WornUniqueCodeMapper">
<resultMap type="WornUniqueCode" id="WornUniqueCodeResult">
@@ -21,7 +21,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectWornUniqueCodeVo">
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
</sql>
<select id="selectWornUniqueCodeList" parameterType="WornUniqueCode" resultMap="WornUniqueCodeResult">
@@ -29,11 +30,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
FROM worn_unique_code t
LEFT JOIN sys_dept d ON t.project_id = d.dept_id
<where>
<if test="code != null"> and t.code = #{code}</if>
<if test="billNo != null and billNo != ''"> and t.bill_no = #{billNo}</if>
<if test="projectId != null "> and t.project_id = #{projectId}</if>
<if test="status != null and status != ''"> and t.status = #{status}</if>
<if test="rfidCode != null and rfidCode != ''"> and t.rfid_code = #{rfidCode}</if>
${params.dataScope}
<if test="code != null and code != ''">
AND t.code = #{code}
</if>
<if test="billNo != null and billNo != ''">
AND t.bill_no = #{billNo}
</if>
<if test="projectId != null">
AND t.project_id = #{projectId}
</if>
<if test="status != null and status != ''">
AND t.status = #{status}
</if>
<if test="rfidCode != null and rfidCode != ''">
AND t.rfid_code = #{rfidCode}
</if>
</where>
</select>
@@ -42,6 +56,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id}
</select>
<select id="selectIdByCode" resultType="java.lang.Long">
select id
from worn_unique_code
where code = #{code}
</select>
<insert id="insertWornUniqueCode" parameterType="WornUniqueCode" useGeneratedKeys="true" keyProperty="id">
insert into worn_unique_code
<trim prefix="(" suffix=")" suffixOverrides=",">
@@ -57,7 +77,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
<if test="isDelete != null">is_delete,</if>
</trim>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="code != null">#{code},</if>
<if test="billNo != null">#{billNo},</if>
@@ -71,7 +91,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
<if test="isDelete != null">#{isDelete},</if>
</trim>
</trim>
</insert>
<update id="updateWornUniqueCode" parameterType="WornUniqueCode">
@@ -93,6 +113,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id}
</update>
<update id="updateByCode" parameterType="WornUniqueCode">
update worn_unique_code
set status = #{status},
update_by = #{updateBy},
update_time = #{updateTime}
where code = #{code}
</update>
<delete id="deleteWornUniqueCodeByIds" parameterType="Long">
delete from worn_unique_code where id in
<foreach item="id" collection="array" open="(" separator="," close=")">

View File

@@ -0,0 +1,116 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.shzg.project.worn.mapper.WornInboundBillMapper">
<resultMap type="WornInboundBill" id="WornInboundBillResult">
<result property="id" column="id" />
<result property="billNo" column="bill_no" />
<result property="billType" column="bill_type" />
<result property="warehouseCode" column="warehouse_code" />
<result property="warehouseName" column="warehouse_name" />
<result property="areaCode" column="area_code" />
<result property="areaName" column="area_name" />
<result property="remark" column="remark" />
<result property="inboundTime" column="inbound_time" />
<result property="status" column="status" />
<result property="isDelete" column="is_delete" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectWornInboundBillVo">
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
</sql>
<select id="selectWornInboundBillList" parameterType="WornInboundBill" resultMap="WornInboundBillResult">
<include refid="selectWornInboundBillVo"/>
<where>
<if test="billNo != null and billNo != ''"> and bill_no = #{billNo}</if>
<if test="billType != null and billType != ''"> and bill_type = #{billType}</if>
<if test="warehouseCode != null and warehouseCode != ''"> and warehouse_code = #{warehouseCode}</if>
<if test="warehouseName != null and warehouseName != ''"> and warehouse_name like concat('%', #{warehouseName}, '%')</if>
<if test="areaCode != null and areaCode != ''"> and area_code = #{areaCode}</if>
<if test="areaName != null and areaName != ''"> and area_name like concat('%', #{areaName}, '%')</if>
<if test="inboundTime != null "> and inbound_time = #{inboundTime}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
<if test="isDelete != null and isDelete != ''"> and is_delete = #{isDelete}</if>
</where>
</select>
<select id="selectWornInboundBillById" parameterType="Long" resultMap="WornInboundBillResult">
<include refid="selectWornInboundBillVo"/>
where id = #{id}
</select>
<insert id="insertWornInboundBill" parameterType="WornInboundBill" useGeneratedKeys="true" keyProperty="id">
insert into worn_inbound_bill
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="billNo != null and billNo != ''">bill_no,</if>
<if test="billType != null">bill_type,</if>
<if test="warehouseCode != null">warehouse_code,</if>
<if test="warehouseName != null">warehouse_name,</if>
<if test="areaCode != null">area_code,</if>
<if test="areaName != null">area_name,</if>
<if test="remark != null">remark,</if>
<if test="inboundTime != null">inbound_time,</if>
<if test="status != null">status,</if>
<if test="isDelete != null">is_delete,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="billNo != null and billNo != ''">#{billNo},</if>
<if test="billType != null">#{billType},</if>
<if test="warehouseCode != null">#{warehouseCode},</if>
<if test="warehouseName != null">#{warehouseName},</if>
<if test="areaCode != null">#{areaCode},</if>
<if test="areaName != null">#{areaName},</if>
<if test="remark != null">#{remark},</if>
<if test="inboundTime != null">#{inboundTime},</if>
<if test="status != null">#{status},</if>
<if test="isDelete != null">#{isDelete},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateWornInboundBill" parameterType="WornInboundBill">
update worn_inbound_bill
<trim prefix="SET" suffixOverrides=",">
<if test="billNo != null and billNo != ''">bill_no = #{billNo},</if>
<if test="billType != null">bill_type = #{billType},</if>
<if test="warehouseCode != null">warehouse_code = #{warehouseCode},</if>
<if test="warehouseName != null">warehouse_name = #{warehouseName},</if>
<if test="areaCode != null">area_code = #{areaCode},</if>
<if test="areaName != null">area_name = #{areaName},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="inboundTime != null">inbound_time = #{inboundTime},</if>
<if test="status != null">status = #{status},</if>
<if test="isDelete != null">is_delete = #{isDelete},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteWornInboundBillById" parameterType="Long">
delete from worn_inbound_bill where id = #{id}
</delete>
<delete id="deleteWornInboundBillByIds" parameterType="String">
delete from worn_inbound_bill where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,88 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.shzg.project.worn.mapper.WornInboundItemMapper">
<resultMap type="WornInboundItem" id="WornInboundItemResult">
<result property="id" column="id" />
<result property="billId" column="bill_id" />
<result property="billNo" column="bill_no" />
<result property="materialId" column="material_id" />
<result property="quantity" column="quantity" />
<result property="uniqueCode" column="unique_code" />
<result property="remark" column="remark" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
</resultMap>
<sql id="selectWornInboundItemVo">
select id, bill_id, bill_no, material_id, quantity, unique_code, remark, create_by, create_time from worn_inbound_item
</sql>
<select id="selectWornInboundItemList" parameterType="WornInboundItem" resultMap="WornInboundItemResult">
<include refid="selectWornInboundItemVo"/>
<where>
<if test="billId != null "> and bill_id = #{billId}</if>
<if test="billNo != null and billNo != ''"> and bill_no = #{billNo}</if>
<if test="materialId != null "> and material_id = #{materialId}</if>
<if test="quantity != null "> and quantity = #{quantity}</if>
<if test="uniqueCode != null"> and unique_code = #{uniqueCode}</if>
</where>
</select>
<select id="selectWornInboundItemById" parameterType="Long" resultMap="WornInboundItemResult">
<include refid="selectWornInboundItemVo"/>
where id = #{id}
</select>
<insert id="insertWornInboundItem" parameterType="WornInboundItem" useGeneratedKeys="true" keyProperty="id">
insert into worn_inbound_item
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="billId != null">bill_id,</if>
<if test="billNo != null">bill_no,</if>
<if test="materialId != null">material_id,</if>
<if test="quantity != null">quantity,</if>
<if test="uniqueCode != null">unique_code,</if>
<if test="remark != null">remark,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="billId != null">#{billId},</if>
<if test="billNo != null">#{billNo},</if>
<if test="materialId != null">#{materialId},</if>
<if test="quantity != null">#{quantity},</if>
<if test="uniqueCode != null">#{uniqueCode},</if>
<if test="remark != null">#{remark},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</insert>
<update id="updateWornInboundItem" parameterType="WornInboundItem">
update worn_inbound_item
<trim prefix="SET" suffixOverrides=",">
<if test="billId != null">bill_id = #{billId},</if>
<if test="billNo != null">bill_no = #{billNo},</if>
<if test="materialId != null">material_id = #{materialId},</if>
<if test="quantity != null">quantity = #{quantity},</if>
<if test="uniqueCode != null">unique_code = #{uniqueCode},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteWornInboundItemById" parameterType="Long">
delete from worn_inbound_item where id = #{id}
</delete>
<delete id="deleteWornInboundItemByIds" parameterType="String">
delete from worn_inbound_item where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -91,6 +91,20 @@
<where>
<if test="keyword != null and keyword != ''">
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}, '%')
)
</if>
<if test="materialName != null and materialName != ''">
AND wm.material_name LIKE CONCAT('%',#{materialName},'%')
</if>