This commit is contained in:
Vinjor 2024-10-23 14:32:38 +08:00
parent 8c22a78224
commit 77036c32f5
4 changed files with 63 additions and 27 deletions

View File

@ -10,7 +10,6 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
@ -112,4 +111,10 @@ public class DlRepairSo extends TenantBaseDO {
/** 关联的配件申请单的id(dl_ticket_wares表的ID) */
private String twId;
/**
* 车牌号
*/
@TableField(exist = false)
private String licenseNumber;
}

View File

@ -1,7 +1,9 @@
package cn.iocoder.yudao.module.stockOperate.entity;
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
import cn.iocoder.yudao.module.project.entity.RepairWares;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
@ -67,4 +69,15 @@ public class DlRepairSoi extends TenantBaseDO {
* 备注
*/
private String remark;
/**
* 配件信息
*/
@TableField(exist = false)
private RepairWares wares;
/**
* 配件类型名称
*/
@TableField(exist = false)
private String typeName;
}

View File

@ -38,11 +38,11 @@ import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.Iterator;
import java.util.HashMap;
import java.util.List;
import java.util.Objects;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
@ -197,6 +197,21 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
// 查子表
List<DlRepairSoi> list = repairSoiService.list(new LambdaQueryWrapper<DlRepairSoi>().eq(DlRepairSoi::getSoId, result.getId()));
if(!list.isEmpty()){
//所有有配件的分类
List<Map<String,String>> typeMapList = waresService.getAllTypeList();
Map<String,String> typeMap = new HashMap<>();
for(Map<String,String> map:typeMapList){
typeMap.put(map.get("id"),map.get("name"));
}
//关联查配件信息
List<RepairWares> repairWaresList = waresService.listByIds(list.stream().map(DlRepairSoi::getGoodsId).collect(Collectors.toList()));
Map<String,RepairWares> waresMap = repairWaresList.stream().collect(Collectors.toMap(RepairWares::getId, Function.identity()));
list.forEach(item->{
item.setWares(waresMap.get(item.getGoodsId()));
item.setTypeName(typeMap.get(item.getWares().getType()));
});
}
result.setGoodsList(list);
return result;
}
@ -338,7 +353,7 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
titem.setId(item.getId());
sois.stream().filter(i -> i.getGoodsId().equals(item.getPartId())).findFirst().ifPresent(i -> {
titem.setItemCount(item.getItemCount() - i.getGoodsCount());
titem.setItemMoney(new BigDecimal(titem.getItemCount()).multiply(item.getItemPrice()).multiply(item.getItemDiscount()));
titem.setItemMoney(new BigDecimal(item.getItemCount()).multiply(item.getItemPrice()).multiply(item.getItemDiscount()));
});
return titem;
}).collect(Collectors.toList());

View File

@ -25,40 +25,43 @@
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
<result property="updater" column="updater" jdbcType="VARCHAR"/>
<result property="twId" column="tw_id" />
<result property="licenseNumber" column="license_number" />
</resultMap>
<sql id="Base_SQL">
select id,
so_type,
purchase_type,
so_no,
supplier_id,
supplier_name,
user_id,
user_name,
so_time,
item_count,
total_price,
so_status,
remark,
corp_id,
corp_name,
dept_id,
create_time,
update_time,
updater,
tw_id
select so.id,
so.so_type,
so.purchase_type,
so.so_no,
so.supplier_id,
so.supplier_name,
so.user_id,
so.user_name,
so.so_time,
so.item_count,
so.total_price,
so.so_status,
so.remark,
so.corp_id,
so.corp_name,
so.dept_id,
so.create_time,
so.update_time,
so.updater,
so.tw_id,
dtw.license_number
from dl_repair_so so
LEFT JOIN dl_ticket_wares dtw ON so.tw_id = dtw.id
where so.deleted = '0'
</sql>
<select id="getRepairSoPage" resultMap="BaseResultMap">
<include refid="Base_SQL"/>
<if test="map.soType != null and map.soType">
and so_type = #{map.soType}
and so.so_type = #{map.soType}
</if>
<if test="map.purchaseType != null and map.purchaseType != ''">
and purchase_type = #{map.purchaseType}
and so.purchase_type = #{map.purchaseType}
</if>
<if test="map.soStatus != null and map.soStatus != ''">
and so.so_status = #{map.soStatus}