Commit 74942e39 by 胡懿

货品查询接口返回二维码信息

parent 6b5c96bc
......@@ -30,7 +30,7 @@ public class GoodsInfo extends DataEntity<GoodsInfo> {
private BigDecimal amount; // 单价
public BigDecimal infoSum; // 总价
private QrCode qrCode; // 二维码(xml中无关联查询)
private QrCode qrCode; // 二维码
private List<String> modelList; // 查询时使用的属性
public GoodsInfo() {
......
......@@ -21,13 +21,18 @@
type.code AS "type.code",
type.name AS "type.name"
type.name AS "type.name",
qr.id AS "qrCode.id",
qr.code "qrCode.code",
qr.state "qrCode.state",
qr.url "qrCode.url"
</sql>
<sql id="goodsInfoJoins">
LEFT JOIN t_wh_material_type type ON type.id = a.type_id
LEFT JOIN t_wh_goods b ON b.id = a.goods_id
LEFT JOIN t_wh_qr qr on qr.goods_info_id = a.id
</sql>
......
......@@ -17,10 +17,4 @@ import java.util.List;
*/
@MyBatisMapper
public interface StorageInfoMapper extends BaseMapper<StorageInfo> {
/**
* 入库明细统计
* @return
*/
List<CountStorageInfo> findCsiList(StorageInfo storageInfo);
}
\ No newline at end of file
......@@ -66,8 +66,11 @@
AND a.type_id = #{type.id}
</if>
<if test="shelves != null and shelves.id != null and shelves.id != ''">
AND a.shelves_id = #{shelves.id}
<if test="shelvesIds != null and shelvesIds != null and shelvesIds != ''">
AND a.shelves_id LIKE
<if test="dbName == 'oracle'">'%'||#{shelvesIds}||'%'</if>
<if test="dbName == 'mssql'">'%'+#{shelvesIds}+'%'</if>
<if test="dbName == 'mysql'">concat('%',#{shelvesIds},'%')</if>
</if>
......@@ -195,34 +198,5 @@
select * FROM t_wh_storage_info where ${propertyName} = '${value}'
</select>
<select id="findCsiList" resultType="com.jeeplus.modules.warehouse.storage.dto.CountStorageInfo" >
SELECT
a.name AS "name",
a.type_id AS "type.id",
type.name AS "type.name",
a.model AS "model",
sum(a.amount) AS "sum",
a.amount AS "amount",
a.goods_info_id AS "goodsInfo.id",
a.shelves_id AS "shelves.id",
s.name AS "shelves.name",
w.id AS "warehouse.id",
w.name AS "warehouse.name",
qr.state AS "state",
COUNT( a.id ) AS "num"
FROM
t_wh_storage_info a
LEFT JOIN t_wh_material_type type on a.type_id = type.id
LEFT JOIN t_wh_shelves s on s.id = a.shelves_id
LEFT JOIN t_wh_warehouse w on w.id = s.warehouse_id
LEFT JOIN t_wh_qr qr ON qr.id = a.qr_id
<where>
a.del_flag = #{DEL_FLAG_NORMAL}
<if test="storage != null and storage.id != null and storage.id != ''">
AND a.storage_id = #{storage.id}
</if>
</where>
GROUP BY a.goods_info_id,a.shelves_id,qr.state,a.amount
</select>
</mapper>
\ No newline at end of file
......@@ -79,7 +79,6 @@ public class StorageService extends CrudService<StorageMapper, Storage> {
@Transactional(readOnly = false)
public void save(Storage storage) {
super.save(storage);
Map<String, Integer> map = new HashMap<>();
BigDecimal money = new BigDecimal(0.00);
for (StorageInfo storageInfo : storage.getStorageInfoList()){
if (storageInfo.getId() == null){
......@@ -96,7 +95,6 @@ public class StorageService extends CrudService<StorageMapper, Storage> {
// 计算需要变更的总价格
money = money.subtract(goodsInfo.getInfoSum());
// 更改二维码状态为已入库
QrCode qrCode = qrCodeMapper.get(storageInfo.getQrCode().getId());
qrCode.setState("1");
......@@ -106,17 +104,9 @@ public class StorageService extends CrudService<StorageMapper, Storage> {
storageInfo.preUpdate();
storageInfoMapper.update(storageInfo);
}
}else{
storageInfoMapper.delete(storageInfo);
money = money.add(goodsInfo.getAmount().multiply(new BigDecimal(goodsInfo.getNum())));
// 计算货品明细中的需要变更的数量
Integer count = map.get(goodsInfo.getId());
if (null == count) {
count = 1;
} else {
count ++;
}
map.put(goodsInfo.getId(), count);
storageInfoMapper.delete(storageInfo);
money = money.add(goodsInfo.getInfoSum());
// 更改二维码状态为未入库
QrCode qrCode = qrCodeMapper.get(storageInfo.getQrCode().getId());
......@@ -126,17 +116,6 @@ public class StorageService extends CrudService<StorageMapper, Storage> {
}
}
// 更新货品明细中的数量
Set<Map.Entry<String, Integer>> countSet = map.entrySet();
for (Map.Entry<String, Integer> entry : countSet) {
String goodsInfoId = entry.getKey();
int count = entry.getValue();
GoodsInfo goodsInfo = goodsInfoMapper.get(goodsInfoId);
goodsInfo.setNum(goodsInfo.getNum() + count);
goodsInfo.preUpdate();
goodsInfoMapper.update(goodsInfo);
}
// 更新货品表总价
Goods temGoods = new Goods();
temGoods.setBatchNum(storage.getBatchNum());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment