备件新增类型字段

master
FCD 4 weeks ago
parent 371a062547
commit fd5464b546

@ -207,6 +207,9 @@ public class SparePartsLedger extends BaseEntity {
private String spareType; private String spareType;
private String isLow; private String isLow;
@Excel(name = "备件品类")
private String spareCategory;
//////////////////////////////////////////////////////////附属表 //////////////////////////////////////////////////////////附属表
@ -642,6 +645,15 @@ public class SparePartsLedger extends BaseEntity {
return spareInventoryUpper; return spareInventoryUpper;
} }
public String getSpareCategory() {
return spareCategory;
}
public void setSpareCategory(String spareCategory) {
this.spareCategory = spareCategory;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

@ -542,6 +542,37 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
} }
} }
// 是否有备件更换
List<EquSpareApply> list = equOrder.getSpareList();
if (list != null) {
// 获取备件表流水号
int applySerialNum = equSpareApplyMapper.selectSerialNumber();
// 处理备件信息(申领单)
for (EquSpareApply spare : list) {
EquSpareApply apply = new EquSpareApply();
apply.setApplyId(IdUtils.fastSimpleUUID());// id
apply.setApplyCode("A" + equOrder.getOrderCode() + String.format("%02d", applySerialNum));// 申领单编码
applySerialNum++;// 流水号递增
apply.setSpareCode(spare.getMaterialCode());// 备件号
apply.setSpareName(spare.getMaterialDesc());// 备件名称
apply.setSpareQuantity(spare.getSpareQuantity());// 备件数量
apply.setFactoryCode(equOrder.getFactoryCode());// 工厂
apply.setApplyPeople(SecurityContextHolder.getUserName());
apply.setWorkCode(equOrder.getOrderCode());// 设置关联单号
apply.setCreateBy(SecurityContextHolder.getUserName());
apply.setCreateTime(DateUtils.getNowDate());
apply.setSpareUseEquipment(equOrder.getEquipmentCode());// 设置使用设备编码
apply.setApplyTime(DateUtils.getNowDate());// 设置申领时间
// 插入备件信息(可优化)
equSpareApplyMapper.insertEquSpareApply(apply);
// 减少备件仓库中备件数量
sparePartsLedgerMapper.updateSpareNumReduce(apply);
}
}
// 更新工单信息 // 更新工单信息
equOrderMapper.updateEquOrder(equOrder); equOrderMapper.updateEquOrder(equOrder);
return success(); return success();

@ -45,6 +45,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="endMoney" column="end_money" /> <result property="endMoney" column="end_money" />
<result property="substituteParts" column="substitute_parts" /> <result property="substituteParts" column="substitute_parts" />
<result property="ownEquipmentCode" column="own_equipment_code" /> <result property="ownEquipmentCode" column="own_equipment_code" />
<result property="spareCategory" column="spare_category" />
<result property="wlCode" column="wl_code" />
</resultMap> </resultMap>
<sql id="selectSparePartsLedgerVo"> <sql id="selectSparePartsLedgerVo">
@ -88,20 +90,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
end_inventory, end_inventory,
end_money, end_money,
substitute_parts, substitute_parts,
own_equipment_code own_equipment_code,
spare_category,
wl_code
from equ_spareparts_ledger from equ_spareparts_ledger
</sql> </sql>
<select id="selectSparePartsLedgerList" parameterType="SparePartsLedger" resultMap="SparePartsLedgerResult"> <select id="selectSparePartsLedgerList" parameterType="SparePartsLedger" resultMap="SparePartsLedgerResult">
<include refid="selectSparePartsLedgerVo"/> <include refid="selectSparePartsLedgerVo"/>
<where> <where>
del_flag = '0'
<if test="storageId != null and storageId != ''"> and storage_id = #{storageId}</if> <if test="storageId != null and storageId != ''"> and storage_id = #{storageId}</if>
<if test="whCode != null and whCode != ''"> and wh_code = #{whCode}</if> <if test="whCode != null and whCode != ''"> and wh_code = #{whCode}</if>
<if test="regionCode != null and regionCode != ''"> and region_code = #{regionCode}</if> <if test="regionCode != null and regionCode != ''"> and region_code = #{regionCode}</if>
<if test="waCode != null and waCode != ''"> and wa_code = #{waCode}</if> <if test="waCode != null and waCode != ''"> and wa_code = #{waCode}</if>
<if test="storageType != null and storageType != ''"> and storage_type = #{storageType}</if> <if test="storageType != null and storageType != ''"> and storage_type = #{storageType}</if>
<if test="wlCode != null and wlCode != ''"> and wl_code = #{wlCode}</if> <if test="wlCode != null and wlCode != ''"> and wl_code = #{wlCode}</if>
<if test="materialCode != null and materialCode != ''"> and material_code like concat('%', #{materialCode}, '%')</if> <if test="materialCode != null and materialCode != ''"> and( material_code like concat('%', #{materialCode}, '%') OR material_desc like concat('%', #{materialCode}, '%') )</if>
<if test="materialDesc != null and materialDesc != ''"> and material_desc like concat('%', #{materialDesc}, '%')</if> <if test="materialDesc != null and materialDesc != ''"> and material_desc like concat('%', #{materialDesc}, '%')</if>
<if test="amount != null "> and amount = #{amount}</if> <if test="amount != null "> and amount = #{amount}</if>
<if test="storageAmount != null "> and storage_amount = #{storageAmount}</if> <if test="storageAmount != null "> and storage_amount = #{storageAmount}</if>
@ -142,7 +147,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="ownEquipmentName != null and ownEquipmentName != ''"> and own_equipment_name like concat('%', #{ownEquipmentName}, '%')</if> <if test="ownEquipmentName != null and ownEquipmentName != ''"> and own_equipment_name like concat('%', #{ownEquipmentName}, '%')</if>
<if test='isLow == "0"'>and TRY_CAST(safe_stock AS DECIMAL(18,2)) &gt; amount</if> <if test='isLow == "0"'>and TRY_CAST(safe_stock AS DECIMAL(18,2)) &gt; amount</if>
<if test='isLow == "1"'>and TRY_CAST(safe_stock AS DECIMAL(18,2)) &lt;= amount</if> <if test='isLow == "1"'>and TRY_CAST(safe_stock AS DECIMAL(18,2)) &lt;= amount</if>
and del_flag = '0' <if test="spareCategory != null and spareCategory != ''"> and spare_category = #{spareCategory}</if>
</where> </where>
ORDER BY ORDER BY
CASE WHEN TRY_CONVERT(numeric(18,2), safe_stock) > amount THEN 0 ELSE 1 END, CASE WHEN TRY_CONVERT(numeric(18,2), safe_stock) > amount THEN 0 ELSE 1 END,
@ -222,6 +227,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
end_money, end_money,
<if test="substituteParts != null">substitute_parts,</if> <if test="substituteParts != null">substitute_parts,</if>
<if test="ownEquipmentCode != null">own_equipment_code,</if> <if test="ownEquipmentCode != null">own_equipment_code,</if>
<if test="spareCategory != null">spare_category,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="storageId != null and storageId != ''">#{storageId},</if> <if test="storageId != null and storageId != ''">#{storageId},</if>
@ -283,6 +289,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{endMoney}, #{endMoney},
<if test="substituteParts != null">#{substituteParts},</if> <if test="substituteParts != null">#{substituteParts},</if>
<if test="ownEquipmentCode != null">#{ownEquipmentCode},</if> <if test="ownEquipmentCode != null">#{ownEquipmentCode},</if>
<if test="spareCategory != null">#{spareCategory},</if>
</trim> </trim>
</insert> </insert>
@ -347,6 +354,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
end_money = #{endMoney}, end_money = #{endMoney},
<if test="substituteParts != null">substitute_parts = #{substituteParts},</if> <if test="substituteParts != null">substitute_parts = #{substituteParts},</if>
<if test="ownEquipmentCode != null">own_equipment_code = #{ownEquipmentCode},</if> <if test="ownEquipmentCode != null">own_equipment_code = #{ownEquipmentCode},</if>
<if test="spareCategory != null">spare_category = #{spareCategory},</if>
</trim> </trim>
where storage_id = #{storageId} where storage_id = #{storageId}
</update> </update>

Loading…
Cancel
Save