重要更新,库存管理中添加入库日期字段,以支持线边库功能。

This commit is contained in:
JinLu.Yin 2022-09-09 23:17:10 +08:00
parent e474936fa7
commit 8c76de19f1
7 changed files with 61 additions and 2 deletions

View File

@ -1,6 +1,8 @@
package com.ktg.mes.qc.mapper; package com.ktg.mes.qc.mapper;
import java.util.List; import java.util.List;
import com.ktg.mes.qc.domain.QcMobParam;
import com.ktg.mes.qc.domain.QcTemplate; import com.ktg.mes.qc.domain.QcTemplate;
/** /**
@ -35,6 +37,14 @@ public interface QcTemplateMapper
public QcTemplate selectQcTemplateByProductAndQcType(QcTemplate qcTemplate); public QcTemplate selectQcTemplateByProductAndQcType(QcTemplate qcTemplate);
/**
* 根据物料/产品和检验类型查询对应的检测模板
* @param param
* @return
*/
public QcTemplate findTemplateByProductIdAndQcType(QcMobParam param);
public QcTemplate checkTemplateCodeUnique(QcTemplate qcTemplate); public QcTemplate checkTemplateCodeUnique(QcTemplate qcTemplate);
/** /**

View File

@ -1,6 +1,8 @@
package com.ktg.mes.qc.service; package com.ktg.mes.qc.service;
import java.util.List; import java.util.List;
import com.ktg.mes.qc.domain.QcMobParam;
import com.ktg.mes.qc.domain.QcTemplate; import com.ktg.mes.qc.domain.QcTemplate;
/** /**
@ -33,6 +35,13 @@ public interface IQcTemplateService
*/ */
public QcTemplate selectQcTemplateByProductAndQcType(QcTemplate qcTemplate); public QcTemplate selectQcTemplateByProductAndQcType(QcTemplate qcTemplate);
/**
* 根据物料/产品和检验类型查询对应的检测模板
* @param param
* @return
*/
public QcTemplate findTemplateByProductIdAndQcType(QcMobParam param);
/** /**
* 检测模板编号是否唯一 * 检测模板编号是否唯一
* @param qcTemplate * @param qcTemplate

View File

@ -5,6 +5,7 @@ import java.util.List;
import com.ktg.common.constant.UserConstants; import com.ktg.common.constant.UserConstants;
import com.ktg.common.utils.DateUtils; import com.ktg.common.utils.DateUtils;
import com.ktg.common.utils.StringUtils; import com.ktg.common.utils.StringUtils;
import com.ktg.mes.qc.domain.QcMobParam;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.ktg.mes.qc.mapper.QcTemplateMapper; import com.ktg.mes.qc.mapper.QcTemplateMapper;
@ -52,6 +53,11 @@ public class QcTemplateServiceImpl implements IQcTemplateService
return qcTemplateMapper.selectQcTemplateByProductAndQcType(qcTemplate); return qcTemplateMapper.selectQcTemplateByProductAndQcType(qcTemplate);
} }
@Override
public QcTemplate findTemplateByProductIdAndQcType(QcMobParam param) {
return qcTemplateMapper.findTemplateByProductIdAndQcType(param);
}
@Override @Override
public String checkTemplateCodeUnique(QcTemplate qcTemplate) { public String checkTemplateCodeUnique(QcTemplate qcTemplate) {
QcTemplate template = qcTemplateMapper.checkTemplateCodeUnique(qcTemplate); QcTemplate template = qcTemplateMapper.checkTemplateCodeUnique(qcTemplate);

View File

@ -105,6 +105,11 @@ public class WmMaterialStock extends BaseEntity
@Excel(name = "在库数量") @Excel(name = "在库数量")
private BigDecimal quantityOnhand; private BigDecimal quantityOnhand;
/** 库存有效期 */
@JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss")
@Excel(name = "入库时间", width = 30, dateFormat = "yyyy-MM-dd hh:mm:ss")
private Date recptDate;
/** 库存有效期 */ /** 库存有效期 */
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "库存有效期", width = 30, dateFormat = "yyyy-MM-dd") @Excel(name = "库存有效期", width = 30, dateFormat = "yyyy-MM-dd")
@ -324,7 +329,16 @@ public class WmMaterialStock extends BaseEntity
{ {
return quantityOnhand; return quantityOnhand;
} }
public void setExpireDate(Date expireDate)
public Date getRecptDate() {
return recptDate;
}
public void setRecptDate(Date recptDate) {
this.recptDate = recptDate;
}
public void setExpireDate(Date expireDate)
{ {
this.expireDate = expireDate; this.expireDate = expireDate;
} }
@ -395,6 +409,7 @@ public class WmMaterialStock extends BaseEntity
.append("vendorName", getVendorName()) .append("vendorName", getVendorName())
.append("vendorNick", getVendorNick()) .append("vendorNick", getVendorNick())
.append("quantityOnhand", getQuantityOnhand()) .append("quantityOnhand", getQuantityOnhand())
.append("recptDate",getRecptDate())
.append("expireDate", getExpireDate()) .append("expireDate", getExpireDate())
.append("attr1", getAttr1()) .append("attr1", getAttr1())
.append("attr2", getAttr2()) .append("attr2", getAttr2())

View File

@ -119,6 +119,9 @@ public class WmTransactionServiceImpl implements IWmTransactionService
stock.setVendorName(transaction.getVendorName()); stock.setVendorName(transaction.getVendorName());
stock.setVendorNick(transaction.getVendorNick()); stock.setVendorNick(transaction.getVendorNick());
} }
//使用库存事务日期初始化入库日期
//一般在入库的时候才会涉及到materialStock的新增出库的时候都是出的现有库存
stock.setRecptDate(transaction.getTransactionDate());
stock.setExpireDate(transaction.getExpireDate()); stock.setExpireDate(transaction.getExpireDate());
} }
} }

View File

@ -53,6 +53,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
limit 1; limit 1;
</select> </select>
<select id="findTemplateByProductIdAndQcType" parameterType="QcMobParam" resultMap="QcTemplateResult">
select t.*
from qc_template t
left join qc_template_product p
on t.template_id = p.template_id
where p.item_id = #{itemId}
and t.qc_types like concat('%',#{qcType},'%')
limit 1
</select>
<insert id="insertQcTemplate" parameterType="QcTemplate" useGeneratedKeys="true" keyProperty="templateId"> <insert id="insertQcTemplate" parameterType="QcTemplate" useGeneratedKeys="true" keyProperty="templateId">
insert into qc_template insert into qc_template
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">

View File

@ -27,6 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="vendorName" column="vendor_name" /> <result property="vendorName" column="vendor_name" />
<result property="vendorNick" column="vendor_nick" /> <result property="vendorNick" column="vendor_nick" />
<result property="quantityOnhand" column="quantity_onhand" /> <result property="quantityOnhand" column="quantity_onhand" />
<result property="recptDate" column="recpt_date"></result>
<result property="expireDate" column="expire_date" /> <result property="expireDate" column="expire_date" />
<result property="attr1" column="attr1" /> <result property="attr1" column="attr1" />
<result property="attr2" column="attr2" /> <result property="attr2" column="attr2" />
@ -39,7 +40,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectWmMaterialStockVo"> <sql id="selectWmMaterialStockVo">
select material_stock_id, item_type_id, item_id, item_code, item_name, specification, unit_of_measure, batch_code, warehouse_id, warehouse_code, warehouse_name, location_id, location_code, location_name, area_id, area_code, area_name, vendor_id, vendor_code, vendor_name, vendor_nick, quantity_onhand, expire_date, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from wm_material_stock select material_stock_id, item_type_id, item_id, item_code, item_name, specification, unit_of_measure, batch_code, warehouse_id, warehouse_code, warehouse_name, location_id, location_code, location_name, area_id, area_code, area_name, vendor_id, vendor_code, vendor_name, vendor_nick, quantity_onhand,recpt_date, expire_date, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from wm_material_stock
</sql> </sql>
<select id="selectWmMaterialStockList" parameterType="WmMaterialStock" resultMap="WmMaterialStockResult"> <select id="selectWmMaterialStockList" parameterType="WmMaterialStock" resultMap="WmMaterialStockResult">
@ -66,6 +67,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="vendorName != null and vendorName != ''"> and vendor_name like concat('%', #{vendorName}, '%')</if> <if test="vendorName != null and vendorName != ''"> and vendor_name like concat('%', #{vendorName}, '%')</if>
<if test="vendorNick != null and vendorNick != ''"> and vendor_nick = #{vendorNick}</if> <if test="vendorNick != null and vendorNick != ''"> and vendor_nick = #{vendorNick}</if>
<if test="quantityOnhand != null "> and quantity_onhand = #{quantityOnhand}</if> <if test="quantityOnhand != null "> and quantity_onhand = #{quantityOnhand}</if>
<if test="recptDate !=null"> and recpt_date = #{recptDate}</if>
<if test="expireDate != null "> and expire_date = #{expireDate}</if> <if test="expireDate != null "> and expire_date = #{expireDate}</if>
<if test="attr1 != null and attr1 != ''"> and attr1 = #{attr1}</if> <if test="attr1 != null and attr1 != ''"> and attr1 = #{attr1}</if>
<if test="attr2 != null and attr2 != ''"> and attr2 = #{attr2}</if> <if test="attr2 != null and attr2 != ''"> and attr2 = #{attr2}</if>
@ -90,6 +92,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="locationId != null "> and location_id = #{locationId}</if> <if test="locationId != null "> and location_id = #{locationId}</if>
<if test="areaId != null "> and area_id = #{areaId}</if> <if test="areaId != null "> and area_id = #{areaId}</if>
<if test="vendorId != null "> and vendor_id = #{vendorId}</if> <if test="vendorId != null "> and vendor_id = #{vendorId}</if>
<if test="recptDate !=null"> and recpt_date = #{recptDate}</if>
</where> </where>
and 1=1 limit 1 and 1=1 limit 1
</select> </select>
@ -118,6 +121,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="vendorName != null">vendor_name,</if> <if test="vendorName != null">vendor_name,</if>
<if test="vendorNick != null">vendor_nick,</if> <if test="vendorNick != null">vendor_nick,</if>
<if test="quantityOnhand != null">quantity_onhand,</if> <if test="quantityOnhand != null">quantity_onhand,</if>
<if test="recptDate !=null">recpt_date,</if>
<if test="expireDate != null">expire_date,</if> <if test="expireDate != null">expire_date,</if>
<if test="attr1 != null">attr1,</if> <if test="attr1 != null">attr1,</if>
<if test="attr2 != null">attr2,</if> <if test="attr2 != null">attr2,</if>
@ -150,6 +154,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="vendorName != null">#{vendorName},</if> <if test="vendorName != null">#{vendorName},</if>
<if test="vendorNick != null">#{vendorNick},</if> <if test="vendorNick != null">#{vendorNick},</if>
<if test="quantityOnhand != null">#{quantityOnhand},</if> <if test="quantityOnhand != null">#{quantityOnhand},</if>
<if test="recptDate !=null">#{recptDate},</if>
<if test="expireDate != null">#{expireDate},</if> <if test="expireDate != null">#{expireDate},</if>
<if test="attr1 != null">#{attr1},</if> <if test="attr1 != null">#{attr1},</if>
<if test="attr2 != null">#{attr2},</if> <if test="attr2 != null">#{attr2},</if>
@ -186,6 +191,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="vendorName != null">vendor_name = #{vendorName},</if> <if test="vendorName != null">vendor_name = #{vendorName},</if>
<if test="vendorNick != null">vendor_nick = #{vendorNick},</if> <if test="vendorNick != null">vendor_nick = #{vendorNick},</if>
<if test="quantityOnhand != null">quantity_onhand = #{quantityOnhand},</if> <if test="quantityOnhand != null">quantity_onhand = #{quantityOnhand},</if>
<if test="recptDate !=null">recpt_date = #{recptDate},</if>
<if test="expireDate != null">expire_date = #{expireDate},</if> <if test="expireDate != null">expire_date = #{expireDate},</if>
<if test="attr1 != null">attr1 = #{attr1},</if> <if test="attr1 != null">attr1 = #{attr1},</if>
<if test="attr2 != null">attr2 = #{attr2},</if> <if test="attr2 != null">attr2 = #{attr2},</if>