Browse Source

20250225

java8
qiezi 11 months ago
parent
commit
2e01fda05b
  1. 2
      src/main/java/com/xujie/sys/modules/pms/entity/InventoryStockVoData.java
  2. 1
      src/main/java/com/xujie/sys/modules/pms/mapper/InventoryStockMapper.java
  3. 9
      src/main/java/com/xujie/sys/modules/pms/service/Impl/InventoryStockServiceImpl.java
  4. 95
      src/main/resources/mapper/pms/InventoryStockMapper.xml

2
src/main/java/com/xujie/sys/modules/pms/entity/InventoryStockVoData.java

@ -12,4 +12,6 @@ public class InventoryStockVoData extends InventoryStockVo {
private Float qtyOfPo;
private String securityMethod;
private String searchType;
}

1
src/main/java/com/xujie/sys/modules/pms/mapper/InventoryStockMapper.java

@ -30,6 +30,7 @@ public interface InventoryStockMapper extends BaseMapper<InventoryStockEntity> {
* @date: 2023/2/24 15:59
*/
IPage<InventoryStockVoData> queryPage(Page<InventoryStockVoData> inventoryStockEntityPage, @Param("query") InventoryStockVoData vo);
IPage<InventoryStockVoData> queryPageByPo(Page<InventoryStockVoData> inventoryStockEntityPage, @Param("query") InventoryStockVoData vo);
int updateQtyOfPoByIdOfAdd(InventoryStockEntity inventoryStockEntity);

9
src/main/java/com/xujie/sys/modules/pms/service/Impl/InventoryStockServiceImpl.java

@ -13,6 +13,7 @@ import com.xujie.sys.modules.pms.service.InventoryStockService;
import com.xujie.sys.modules.sys.entity.SysUserEntity;
import org.apache.shiro.SecurityUtils;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
@Service("inventoryStockService")
@ -21,9 +22,13 @@ public class InventoryStockServiceImpl extends ServiceImpl<InventoryStockMapper,
@Override
public PageUtils queryPage(InventoryStockVoData params) {
String username = ((SysUserEntity) SecurityUtils.getSubject().getPrincipal()).getUsername();
IPage<InventoryStockVoData> page = null;
params.setUsername(username);
IPage<InventoryStockVoData> page = this.baseMapper.queryPage(new Page<InventoryStockVoData>(params.getPage(), params.getLimit()), params);
if (StringUtils.hasText(params.getSearchType())) {
page = baseMapper.queryPageByPo(new Page<InventoryStockVoData>(params.getPage(), params.getLimit()), params);
}else {
page = this.baseMapper.queryPage(new Page<InventoryStockVoData>(params.getPage(), params.getLimit()), params);
}
return new PageUtils(page);
}

95
src/main/resources/mapper/pms/InventoryStockMapper.xml

@ -102,6 +102,12 @@
<if test="query.safetyStock == '安全'">
and A.qty_on_hand <![CDATA[>]]> B.min_stock
</if>
<if test="query.safetyStock == '不安全' and (query.securityMethod == '库存' or query.securityMethod == '' or query.securityMethod == null )">
and A.qty_on_hand <![CDATA[<=]]> B.min_stock
</if>
<if test="query.safetyStock == '不安全' and query.securityMethod == '库存和在途'">
and A.qty_on_hand + isnull(A.qty_of_po,0.0) <![CDATA[<=]]> B.min_stock
</if>
</where>
GROUP BY
<if test="query.groupType == 0">
@ -110,12 +116,6 @@
<if test="query.groupType == 1">
A.site, A.part_no, B.part_description, b.min_stock, b.max_stock, B.average_price, B.umid,a.citem_code
</if>
<if test="query.safetyStock == '不安全' and (query.securityMethod == '库存' or query.securityMethod == '' or query.securityMethod == null )">
having sum(A.qty_on_hand) <![CDATA[<=]]> B.min_stock
</if>
<if test="query.safetyStock == '不安全' and query.securityMethod == '库存和在途'">
having sum(A.qty_on_hand) + sum(isnull(A.qty_of_po,0.0)) <![CDATA[<=]]> B.min_stock
</if>
</select>
<update id="updateQtyOfPoByIdOfAdd">
@ -129,4 +129,87 @@
<update id="updateQtyOfPoByIdOfSub">
update inventory_stock set qty_of_po = isnull(qty_of_po,0) - #{qtyOfPo} where id = #{id}
</update>
<select id="queryPageByPo" resultType="com.xujie.sys.modules.pms.entity.InventoryStockVoData">
SELECT
A.citem_code,
min(A.id) as id,
A.site,
min(A.warehouse_id) AS warehouse_id,
A.part_no,min(A.batch_no) as batch_no,
min(A.location_id) AS location_id,
sum(isnull( A.in_qty , 0 )) AS inQty,
sum(isnull( A.out_qty , 0 )) AS outQty,
sum(isnull( A.qty_on_hand , 0 )) AS qtyOnHand,
B.part_description,
min(B.spec) AS spec,
B.min_stock,
B.max_stock,
min(A.partner_id) AS partner_id,
min(A.first_in_date) AS first_in_date,
B.average_price,
B.umid,
sum(isnull(A.qty_of_po,0)) as qty_of_po,
(sum(isnull( A.qty_on_hand , 0 )) * B.average_price) as totalCost,
dbo.get_bu_desc( A.site,A.citem_code) buDesc
from inventory_stock A
left join part_spare B on A.site = B.site and A.part_no = B.part_no and a.citem_code=b.bu_no
left join accessBu D on A.site=D.site and A.citem_code=d.bu_no and D.username=#{query.username}
<where>
A.site = #{query.site} and D.username is not null
and A.batch_no is not null and b.part_no is not null
<if test="query.active != null and query.active != ''">
and B.active = #{query.active}
</if>
<if test="query.buNo != null and query.buNo != ''">
and a.citem_code = #{query.buNo}
</if>
<if test="query.batchNo != null and query.batchNo != ''">
and A.batch_no like '%'+#{query.batchNo}+'%'
</if>
<if test="query.warehouseId != null and query.warehouseId != ''">
and A.warehouse_id like '%'+#{query.warehouseId}+'%'
</if>
<if test="query.locationId != null and query.locationId != ''">
and A.location_id like '%'+#{query.locationId}+'%'
</if>
<if test="query.partNo != null and query.partNo != ''">
and A.part_no like '%'+#{query.partNo}+'%'
</if>
<if test="query.partDescription != null and query.partDescription != ''">
and B.part_description like '%'+#{query.partDescription}+'%'
</if>
<if test="query.spec != null and query.spec != '' ">
and B.spec like '%'+#{query.spec}+'%'
</if>
<if test="query.startFirstInDate != null and query.startFirstInDate != ''">
and A.first_in_date >= #{query.startFirstInDate}
</if>
<if test="query.endFirstInDate != null and query.endFirstInDate != ''">
and A.first_in_date <![CDATA[<=]]> #{query.endFirstInDate}
</if>
<if test="query.startQtyOnHand != null ">
and A.qty_on_hand >= #{query.startQtyOnHand}
</if>
<if test="query.endQtyOnHand !=null ">
and A.qty_on_hand <![CDATA[<=]]> #{query.endQtyOnHand}
</if>
<if test="query.safetyStock == '安全'">
and A.qty_on_hand <![CDATA[>]]> B.min_stock
</if>
</where>
GROUP BY
<if test="query.groupType == 0">
A.site, A.part_no, B.part_description, A.batch_no, b.min_stock, b.max_stock, B.average_price, B.umid,a.citem_code
</if>
<if test="query.groupType == 1">
A.site, A.part_no, B.part_description, b.min_stock, b.max_stock, B.average_price, B.umid,a.citem_code
</if>
<if test="query.safetyStock == '不安全' and (query.securityMethod == '库存' or query.securityMethod == '' or query.securityMethod == null )">
having sum(A.qty_on_hand) <![CDATA[<=]]> B.min_stock
</if>
<if test="query.safetyStock == '不安全' and query.securityMethod == '库存和在途'">
having sum(A.qty_on_hand) + sum(isnull(A.qty_of_po,0.0)) <![CDATA[<=]]> B.min_stock
</if>
</select>
</mapper>
Loading…
Cancel
Save