3/4 inv 库存优化 1.0

dev_drug_dm
wangwei 1 month ago
parent f5394baa43
commit 4cc5c023b9

@ -17,7 +17,6 @@ public interface DeviceReceiveOrderDetailDao extends BaseMapper<DeviceReceiveOrd
*/
List<DeviceReceiveOrderDetailEntity> selectByOrderId(@Param("orderId") String orderId);
List<DeviceReceiveOrderDetailResponse> selectByorderIdFk(FilterDeviceReceiveOrderDetailRequest detailRequest);
/**
*
@ -63,4 +62,4 @@ public interface DeviceReceiveOrderDetailDao extends BaseMapper<DeviceReceiveOrd
* @param orderId
*/
void resetCode(@Param("orderId") String orderId);
}
}

@ -43,37 +43,4 @@ public interface InvCountCodesDao extends BaseMapper<InvCountCodesEntity> {
*/
Long countByOrderId(@Param("orderIdFk") String orderIdFk);
/**
*
*
* @param code
* @param orderIdFk
* @return
*/
Long selectCountByCodeAndOrderId(@Param("code") String code, @Param("orderIdFk") String orderIdFk);
/**
*
*
* @param orderId
*/
void resetCountFiledValue(@Param("orderId") String orderId);
/**
* ID
*
* @param orderIdFk
* @param productId
* @return
*/
List<InvCountCodesEntity> selectByOrderIdAndProductId(@Param("orderIdFk") String orderIdFk, @Param("productId") String productId);
/**
*
*
* @param codesRequest
* @return
*/
List<String> selectCodes(FilterInvCountCodesRequest codesRequest);
}
}

@ -28,15 +28,6 @@ public interface InvCountOrderDao extends BaseMapper<InvCountOrderEntity> {
*/
String selectOrderIdById(@Param("id") String id);
/**
*
*
* @param deptCode
* @param invCode
* @param invSpaceCode
* @return
*/
Integer countBySpaceCode(@Param("deptCode") String deptCode, @Param("invCode") String invCode, @Param("invSpaceCode") String invSpaceCode);
/**
*
@ -60,4 +51,4 @@ public interface InvCountOrderDao extends BaseMapper<InvCountOrderEntity> {
*/
void deleteByOrderId(@Param("orderId") String orderId);
}
}

@ -69,12 +69,6 @@ public interface InvCountOrderDetailDao extends BaseMapper<InvCountOrderDetailEn
*/
List<InvCountOrderDetailEntity> selectByOrderId(@Param("orderId") String orderId);
/**
*
*
* @param orderId
*/
void resetCountFiledValue(@Param("orderId") String orderId);
/**
*
@ -83,4 +77,4 @@ public interface InvCountOrderDetailDao extends BaseMapper<InvCountOrderDetailEn
*/
int updateBatch(List<InvCountOrderDetailEntity> list);
}
}

@ -9,7 +9,6 @@ import java.util.List;
public interface InvInnerOrderPrintDao extends BaseMapper<InvInnerOrderPrintEntity> {
List<InvInnerOrderPrintEntity> filterOrderPrintList(FilterinnerOrderprintRequest filterinnerOrderprintRequest);
List<InnerOrderPrintResponse> filterJoinInnerPrint(FilterinnerOrderprintRequest filterinnerOrderprintRequest);
}

@ -29,40 +29,4 @@ public interface InvPreInProductDetailDao extends BaseMapperPlus<InvPreInProduct
*/
List<InvPreInProductDetailEntity> filterPreProductDetailList(FilterInvPreProductDetailRequest filterInvPreProductDetailRequest);
List<InvPreinProductResponse> findGroupBySpace(FilterInvPreinProductRequest filterInvPreinProductRequest);
/**
*
*
* @param detailRequest
* @return
*/
boolean deleteInvPreProductDetail(FilterInvProductDetailRequest detailRequest);
List<InvPlaceDetailResponse> getInvProductInfo(FilterInvPlaceRequest filterInvPlaceRequest);
void batchBindSpace(@Param("ids") List<Integer> ids, @Param("invSpaceCode") String invSpaceCode);
List<IoOrderResponse> getInvPlaceOrderList(FilterInvPlaceRequest filterInvPlaceRequest);
Integer getInventoryQuantity(@Param("code") String code, @Param("invCode") String invCode);
//用货架查询
List<InvPlaceDetailResponse> filterSpaceList(FilterInvPlaceRequest filterInvPlaceOrderRequest);
List<InvPlaceDetailResponse> findByGroupCode(@Param("invCode") String invCode, @Param("code") String code);
List<InvPreInProductDetailEntity> findBySpaceList(@Param("spaceList") List<String> spaceList);
InvProductNewVo selectLastInBatch(@Param("relId") String relId, @Param("batchNo") String batchNo, @Param("mainAction") String mainAction);
InvProductNewVo selectFirstInBatch(@Param("relId") String relId, @Param("batchNo") String batchNo, @Param("mainAction") String mainAction);
Integer selectCountByInBatch(@Param("relId") String relId, @Param("batchNo") String batchNo,@Param("inBatchNo") String inBatchNo, @Param("mainAction") String mainAction);
InvProductNewVo selectNextInBatch(@Param("relId") String relId, @Param("batchNo") String batchNo, @Param("mainAction") String mainAction, @Param("inBatchNo") String inBatchNo);
}

@ -20,12 +20,4 @@ public interface InvPreProductDao extends BaseMapperPlus<InvPreProductDao, InvPr
*/
List<InvPreProductResponse> filterList(FilterInvPreProductRequest invPreProductRequest);
/**
*
*
* @param invPreProductRequest
* @return
*/
List<InvPreProductEntity> filterPreProductList(FilterInvPreProductRequest invPreProductRequest);
}
}

@ -19,9 +19,6 @@ import java.util.List;
*/
public interface InvPreProductDetailDao extends BaseMapperPlus<InvPreProductDetailDao, InvPreProductDetailEntity, InvPreProductDetailEntity> {
List<InvPreinProductResponse> findGroupBySpace(FilterInvPreinProductRequest filterInvPreinProductRequest);
/**
*
*
@ -38,27 +35,5 @@ public interface InvPreProductDetailDao extends BaseMapperPlus<InvPreProductDeta
*/
boolean deleteInvPreProductDetail(FilterInvProductDetailRequest detailRequest);
List<InvPlaceDetailResponse> getInvProductInfo(FilterInvPlaceRequest filterInvPlaceRequest);
void batchBindSpace(@Param("ids") List<Integer> ids, @Param("invSpaceCode") String invSpaceCode);
List<IoOrderResponse> getInvPlaceOrderList(FilterInvPlaceRequest filterInvPlaceRequest);
Integer getInventoryQuantity(@Param("code") String code,@Param("invCode") String invCode);
//用货架查询
List<InvPlaceDetailResponse> filterSpaceList(FilterInvPlaceRequest filterInvPlaceOrderRequest);
List<InvPlaceDetailResponse> findByGroupCode(@Param("invCode") String invCode, @Param("code") String code);
InvProductNewVo selectLastInBatch(@Param("relId") String relId, @Param("batchNo") String batchNo, @Param("mainAction") String mainAction);
InvProductNewVo selectFirstInBatch(@Param("relId") String relId, @Param("batchNo") String batchNo, @Param("mainAction") String mainAction);
Integer selectCountByInBatch(@Param("relId") String relId, @Param("batchNo") String batchNo,@Param("inBatchNo") String inBatchNo, @Param("mainAction") String mainAction);
InvProductNewVo selectNextInBatch(@Param("relId") String relId, @Param("batchNo") String batchNo, @Param("mainAction") String mainAction, @Param("inBatchNo") String inBatchNo);
}

@ -22,12 +22,4 @@ public interface InvPreinProductDao extends BaseMapperPlus<InvPreinProductDao, I
*/
List<InvPreinProductResponse> filterList(FilterInvPreinProductRequest invPreProductRequest);
/**
*
*
* @param invPreProductRequest
* @return
*/
List<InvPreinProductEntity> filterPreProductList(FilterInvPreinProductRequest invPreProductRequest);
}

@ -77,7 +77,7 @@ public interface InvProductDao extends BaseMapperPlus<InvProductDao, InvProductE
/**
*
*
* @param filterProductNames
* @param
* @return
*/
List<InvProductResponse> filterProductNames(FilterInvProductRequest filterInvProductRequest);

@ -28,17 +28,6 @@ public interface InvProductNewDao extends BaseMapperPlus<InvProductNewDao, InvPr
*/
List<InvProductNewVo> filterInvProductDetailList(FilterInvProductDetailRequest filterInvProductDetailRequest);
List<InvProductResponse> findGroupBySpace(FilterInvProductRequest filterInvProductRequest);
/**
*
*
* @param detailRequest
* @return
*/
boolean deleteInvProductDetail(FilterInvProductDetailRequest detailRequest);
/**
*
*
@ -62,7 +51,7 @@ public interface InvProductNewDao extends BaseMapperPlus<InvProductNewDao, InvPr
* @return
*/
InvProductNewVo selectByInvAndCode(BindInvSpaceRequest bindInvSpaceRequest);
//TODO 120241022 先解开注释这个是要用码查的肯定查不到
/**
* ID(20241017===)
*
@ -71,48 +60,6 @@ public interface InvProductNewDao extends BaseMapperPlus<InvProductNewDao, InvPr
*/
List<String> selectSupIdByCode(@Param("code") String code);
// /**
// * 查询盘点单的码(20241017===没用到注释了)
// *
// * @param invCode
// * @param invSpaceCode
// * @param relId
// * @param batchNo
// * @return
// */
// List<String> selectCountOrderCodes(@Param("invCode") String invCode, @Param("invSpaceCode") String invSpaceCode, @Param("relId") Long relId, @Param("batchNo") String batchNo);
// /**
// * 查询库存摆放的产品详情数据(20241017===没用到注释了)
// *
// * @param filterInvPlaceRequest
// * @return
// */
// List<InvPlaceDetailResponse> getInvProductInfo(FilterInvPlaceRequest filterInvPlaceRequest);
/**
*
*
* @param filterInvPlaceRequest
* @return
*/
List<IoOrderResponse> getInvPlaceOrderList(FilterInvPlaceRequest filterInvPlaceRequest);
Integer getInventoryQuantity(@Param("code") String code, @Param("invCode") String invCode);
//用货架查询
List<InvPlaceDetailResponse> filterSpaceList(FilterInvPlaceRequest filterInvPlaceOrderRequest);
List<InvPlaceDetailResponse> findByGroupCode(@Param("invCode") String invCode, @Param("code") String code, @Param("isCheckSpace") Boolean isCheckSpace);
InvProductNewVo selectLastInBatch(@Param("relId") String relId, @Param("batchNo") String batchNo, @Param("invCode") String invCode, @Param("mainAction") String mainAction);
InvProductNewVo selectFirstInBatch(@Param("relId") String relId, @Param("batchNo") String batchNo, @Param("invCode") String invCode, @Param("mainAction") String mainAction);
Integer selectCountByInBatch(@Param("relId") String relId, @Param("batchNo") String batchNo, @Param("invCode") String invCode, @Param("inBatchNo") String inBatchNo, @Param("mainAction") String mainAction);
InvProductNewVo selectNextInBatch(@Param("relId") String relId, @Param("batchNo") String batchNo, @Param("invCode") String invCode, @Param("mainAction") String mainAction, @Param("inBatchNo") String inBatchNo);
List<InvProductNewVo> selectOrderInfo(@Param(("orderIdFk")) String orderIdFk,@Param(("price")) BigDecimal price);

@ -7,20 +7,6 @@
where orderIdFk = #{orderId}
</select>
<select id="selectByorderIdFk" resultType="com.glxp.api.res.inv.DeviceReceiveOrderDetailResponse">
select drod.*, bp.manufactory, bp.ylqxzcrbarmc, bp.zczbhhzbapzbh,bp.cpmctymc,bp.ggxh
from device_receive_order_detail drod
left join basic_udirel bu on bu.id = drod.relId
left join basic_products bp on bp.uuid = bu.uuid
<where>
<if test="orderIdFk != null and orderIdFk != ''">
AND drod.orderIdFk = #{orderIdFk}
</if>
</where>
order by drod.id
</select>
<delete id="deleteByOrderId">
delete
from device_receive_order_detail
@ -115,4 +101,4 @@
where orderIdFk = #{orderId}
and code like '%#'
</update>
</mapper>
</mapper>

@ -40,40 +40,4 @@
from inv_count_codes
where orderIdFk = #{orderIdFk}
</select>
<select id="selectCountByCodeAndOrderId" resultType="java.lang.Long">
select count(*)
from inv_count_codes
where orderIdFk = #{orderIdFk}
and code = #{code}
</select>
<update id="resetCountFiledValue">
update inv_count_codes
set status = null
where orderIdFk = #{orderId}
</update>
<select id="selectByOrderIdAndProductId" resultType="com.glxp.api.entity.inv.InvCountCodesEntity">
select *
from inv_count_codes
where orderIdFk = #{orderIdFk}
and relId = #{productId}
</select>
<select id="selectCodes" resultType="java.lang.String">
select code
from inv_count_codes
<where>
<if test="orderIdFk != null and orderIdFk != ''">
AND orderIdFk = #{orderIdFk}
</if>
<if test="relId != null and relId != ''">
AND relId = #{relId
</if>
<if test="batchNo != null and batchNo != ''">
AND batchNo = #{batchNo}
</if>
</where>
</select>
</mapper>
</mapper>

@ -48,22 +48,6 @@
where id = #{id}
</select>
<select id="countBySpaceCode" resultType="java.lang.Integer">
select count(*)
from inv_count_order
<where>
<if test="deptCode != null and deptCode != ''">
AND deptCode = #{deptCode}
</if>
<if test="invCode != null and invCode != ''">
AND invCode = #{invCode}
</if>
<if test="invSpaceCode != null and invSpaceCode != ''">
AND invSpaceCode = #{invSpaceCode}
</if>
</where>
</select>
<update id="updateByOrderId">
update inv_count_order
set deptCode = #{deptCode,jdbcType=VARCHAR},
@ -93,4 +77,4 @@
from inv_count_order
where orderId = #{orderId}
</delete>
</mapper>
</mapper>

@ -70,13 +70,6 @@
where orderIdFk = #{orderId}
</select>
<select id="resetCountFiledValue">
update inv_count_order_detail
set profitNum = null,
lossNum = null,
status = null
where orderIdFk = #{orderId}
</select>
<update id="updateBatch" parameterType="java.util.List">
update inv_count_order_detail
@ -147,4 +140,4 @@
#{item.id,jdbcType=INTEGER}
</foreach>
</update>
</mapper>
</mapper>

@ -3,7 +3,6 @@
<mapper namespace="com.glxp.api.dao.inv.InvInnerOrderPrintDao">
<resultMap id="BaseResultMap" autoMapping="true" type="com.glxp.api.entity.inv.InvInnerOrderPrintEntity">
<!--@mbg.generated-->
<!--@Table inv_inner_order_print-->
<!-- <id column="id" jdbcType="INTEGER" property="id"/>-->
<result column="orderIdFk" jdbcType="VARCHAR" property="orderIdFk"/>
<result column="udiCode" jdbcType="VARCHAR" property="udiCode"/>
@ -23,22 +22,6 @@
createTime, updateUser, updateTime
</sql>
<select id="filterOrderPrintList" parameterType="com.glxp.api.req.inv.FilterinnerOrderprintRequest"
resultType="com.glxp.api.entity.inv.InvInnerOrderPrintEntity">
SELECT *
FROM inv_inner_order_print
<where>
<if test="orderIdFk != '' and orderIdFk != null">
AND orderIdFk = #{orderIdFk}
</if>
<if test="udiCode != '' and udiCode != null">
AND udiCode = #{udiCode}
</if>
</where>
</select>
<select id="filterJoinInnerPrint" parameterType="com.glxp.api.req.inv.FilterinnerOrderprintRequest"
resultType="com.glxp.api.res.inv.InnerOrderPrintResponse">
SELECT inv_inner_order_print.id,

@ -68,373 +68,4 @@
</otherwise>
</choose>
</select>
<select id="findGroupBySpace" resultType="com.glxp.api.res.inv.InvPreinProductResponse">
select ipp.id,
ipp.nameCode,
bp.cpmctymc,
ipp.relId,
bp.ggxh,
ipp.batchNo,
ipp.produceDate,
ipp.expireDate,
bp.ylqxzcrbarmc,
bp.zczbhhzbapzbh,
ipp.inCount,
ipp.outCount,
ipp.reCount,
basic_corp.name supName,
ipp.supId,
auth_dept.name deptName,
auth_warehouse.name invName,
as.name spaceName,
ipp.deptCode,
ipp.invCode
from inv_prein_product_detail ipp
inner join basic_udirel on ipp.relId = basic_udirel.id
inner join basic_products bp on basic_udirel.uuid = bp.uuid
left join basic_corp on ipp.supId = basic_corp.erpId
left join auth_dept on auth_dept.code = ipp.deptCode
left join auth_warehouse on auth_warehouse.code = ipp.invCode
left join auth_space `as` on ipp.code = `as`.code
<where>
<if test="cpmctymc != null and cpmctymc != ''">
AND bp.cpmctymc like concat('%', #{cpmctymc}, '%')
</if>
<if test="nameCode != null and nameCode != ''">
AND ipp.nameCode like concat('%', #{nameCode}, '%')
</if>
<if test="relIdFk != null and relIdFk != ''">
AND ipp.relId = #{relIdFk}
</if>
<if test="ggxh != null and ggxh != ''">
AND bp.ggxh like concat('%', #{ggxh}, '%')
</if>
<if test="batchNo != null and batchNo != ''">
AND ipp.batchNo like concat('%', #{batchNo}, '%')
</if>
<if test="productionDate != null and productionDate != ''">
AND ipp.produceDate = #{productionDate}
</if>
<if test="expireDate != null and expireDate != ''">
AND ipp.expireDate = #{expireDate}
</if>
<if test="ylqxzcrbarmc != null and ylqxzcrbarmc != ''">
AND bp.ylqxzcrbarmc like concat('%', #{ylqxzcrbarmc}, '%')
</if>
<if test="zczbhhzbapzbh != null and zczbhhzbapzbh != ''">
AND bp.zczbhhzbapzbh like concat('%', #{zczbhhzbapzbh}, '%')
</if>
<if test="supId != null and supId != ''">
AND ipp.supId = #{supId}
</if>
<if test="deptCode != null and deptCode != ''">
AND ipp.deptCode = #{deptCode}
</if>
<if test="invCode != null and invCode != ''">
AND ipp.invCode = #{invCode}
</if>
<if test="spaceCode != null and spaceCode != ''">
AND ipp.invSpaceCode = #{spaceCode}
</if>
<if test="invCodes != null and invCodes.size() != 0">
AND ipp.invCode in
<foreach collection="invCodes" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</where>
GROUP BY ipp.relId, ipp.batchNo
order by ipp.updateTime desc
</select>
<delete id="deleteInvPreProductDetail">
delete
from inv_prein_product_detail
<where>
<if test="relId != null and relId != ''">
AND relId = #{relId}
</if>
<if test="batchNo != null and batchNo != '' and batchNo != 'empty'">
AND batchNo = #{batchNo}
</if>
<if test="batchNo == 'empty'">
AND batchNo is null
</if>
<if test="supId != null and supId != ''">
AND supId = #{supId}
</if>
<if test="invCode != null and invCode != ''">
AND invCode = #{invCode}
</if>
</where>
</delete>
<select id="getInvProductInfo" resultType="com.glxp.api.res.inv.InvPlaceDetailResponse">
select ipd.code,
ipd.relId,
ipd.batchNo,
ipd.serialNo,
ipd.invSpaceCode,
ipd.invCode,
bp.cpmctymc productName,
bp.ggxh,
bp.measname,
bp.zczbhhzbapzbh,
bp.manufactory,
(select name from auth_space s where s.code = ipd.invSpaceCode) invSpaceName,
(select name from basic_corp bc where bc.erpId = ipd.supId) supName
from inv_prein_product_detail ipd
left join basic_udirel bu on bu.id = ipd.relId
left join basic_products bp on bp.uuid = bu.uuid
<where>
<if test="invCode != null and invCode != ''">
AND ipd.invCode = #{invCode}
</if>
<if test="invSpaceCode != null and invSpaceCode != ''">
AND ipd.invSpaceCode = #{invSpaceCode}
</if>
<if test="code != null and code != ''">
AND ipd.code = #{code}
</if>
<if test="orderId != null and orderId != ''">
AND ipd.orderId = #{orderId}
</if>
</where>
group by ipd.id
</select>
<update id="batchBindSpace">
update inv_prein_product_detail
set invSpaceCode = #{invSpaceCode}
where id in
<foreach collection="ids" index="index" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</update>
<select id="getInvPlaceOrderList" resultType="com.glxp.api.res.inout.IoOrderResponse">
select ipd.orderId billNo,
(select name from basic_bussiness_type where action = o.action) billTypeName,
o.mainAction,
o.fromCorp,
o.corpOrderId,
o.fromType,
o.createTime,
o.auditTime,
(select employeeName from auth_user where id = o.reviewUser) reviewUserName
from inv_prein_product_detail ipd
left join io_order o on ipd.orderId = o.billNo
<where>
<if test="invCode != null and invCode != ''">
AND ipd.invCode = #{invCode}
</if>
<if test="orderId != null and orderId != ''">
AND ipd.orderId like concat('%', #{orderId}, '%')
</if>
</where>
group by ipd.orderId
</select>
<select id="getInventoryQuantity" resultType="java.lang.Integer">
SELECT ifnull(SUM(inCount), 0) - ifnull(SUM(outCount), 0)
FROM inv_prein_product_detail ipd
WHERE CODE = #{code}
and invCode = #{invCode}
and (invSpaceCode is null or invSpaceCode = '')
</select>
<select id="filterSpaceList" resultType="com.glxp.api.res.inv.InvPlaceDetailResponse">
SELECT t1.nameCode,
t1.relId,
(SELECT NAME FROM auth_dept WHERE auth_dept.`code` = t1.deptCode) AS deptName,
(SELECT NAME FROM auth_warehouse WHERE auth_warehouse.`code` = t1.invCode) AS invName,
(SELECT NAME FROM auth_space WHERE auth_space.`code` = t1.invSpaceCode) AS invSpaceName,
SUM(t1.reCount) as count,
bp.cpmctymc as productName,
bp.ggxh,
t1.batchNo,
t1.produceDate as productionDate,
t1.expireDate,
bp.measname,
bp.zczbhhzbapzbh,
bp.ylqxzcrbarmc,
bp.manufactory,
(SELECT `name` FROM basic_corp WHERE erpId = t1.supId) supName
FROM inv_prein_product_detail t1
LEFT JOIN basic_udirel bu ON bu.id = t1.relId
LEFT JOIN basic_products bp ON bp.uuid = bu.uuid
<where>
<if test="code != null and code != ''">
AND t1.code = #{code}
and t1.invSpaceCode IS NOT NULL
and t1.invSpaceCode != ''
</if>
<if test="invSpaceCode != null and invSpaceCode != ''">
AND t1.invSpaceCode = #{invSpaceCode}
</if>
</where>
GROUP BY CODE,
invSpaceCode
</select>
<select id="findByGroupCode" resultType="com.glxp.api.res.inv.InvPlaceDetailResponse">
select pd.id,
pd.code,
pd.relId,
pd.batchNo,
pd.produceDate productionDate,
pd.expireDate,
bp.ggxh,
bp.cpmctymc productName,
bp.zczbhhzbapzbh,
bp.ylqxzcrbarmc,
bp.nameCode,
bp.manufactory,
pd.invSpaceCode,
pd.invCode,
ad.name deptName,
aw.name invName,
sp.name invSpaceName,
ifnull(sum(pd.inCount), 0) as inCount,
ifnull(sum(pd.outCount), 0) as outCount,
pd.inCount - pd.outCount as reCount
from inv_prein_product_detail pd
left join basic_udirel bu on pd.relId = bu.id
left join basic_products bp on bp.uuid = bu.uuid
left join auth_dept ad on pd.deptCode = ad.code
left join auth_warehouse aw on pd.invCode = aw.code
left join auth_space sp on pd.invSpaceCode = sp.code
and sp.invStorageCode = pd.deptCode and sp.invWarehouseCode = pd.invCode
<where>
<if test="invCode != null and invCode != ''">
AND pd.invCode = #{invCode}
</if>
<if test="code != null and code != ''">
AND pd.code = #{code}
</if>
</where>
group by pd.invSpaceCode
</select>
<select id="findBySpaceList" resultType="com.glxp.api.entity.inv.InvPreInProductDetailEntity">
select pd.id,
pd.code,
pd.relId,
pd.batchNo,
pd.produceDate,
pd.expireDate,
pd.invSpaceCode,
pd.deptCode,
pd.invCode,
pd.supId,
pd.nameCode,
pd.invSpaceCode,
ifnull(sum(pd.count), 0) as count,
ifnull(sum(pd.inCount), 0) as inCount,
ifnull(sum(pd.outCount), 0) as outCount,
ifnull(sum(pd.reCount), 0) as reCount
from inv_prein_product_detail pd
<where>
reCount > 0
<if test="spaceList != null and spaceList.size() != 0">
AND pd.invSpaceCode in
<foreach collection="spaceList" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</where>
group by code
</select>
<select id="selectLastInBatch" resultType="com.glxp.api.vo.basic.InvProductNewVo">
select *
from inv_prein_product_detail
<where>
<if test="relId != null and relId != ''">
AND relId = #{relId}
</if>
<if test="mainAction != null and mainAction != ''">
AND mainAction = #{mainAction}
</if>
<if test="batchNo != null and batchNo != ''">
AND batchNo = #{batchNo}
</if>
<if test="batchNo == null or batchNo == ''">
AND batchNo is null
</if>
</where>
order by inBatchNo desc
limit 1;
</select>
<select id="selectFirstInBatch" resultType="com.glxp.api.vo.basic.InvProductNewVo">
select *
from inv_prein_product_detail
<where>
<if test="relId != null and relId != ''">
AND relId = #{relId}
</if>
<if test="mainAction != null and mainAction != ''">
AND mainAction = #{mainAction}
</if>
<if test="batchNo != null and batchNo != ''">
AND batchNo = #{batchNo}
</if>
<if test="batchNo == null or batchNo == ''">
AND batchNo is null
</if>
</where>
order by inBatchNo
limit 1;
</select>
<select id="selectCountByInBatch" resultType="java.lang.Integer">
select sum(reCount)
from inv_prein_product_detail
<where>
<if test="relId != null and relId != ''">
AND relId = #{relId}
</if>
<if test="inBatchNo != null and inBatchNo != ''">
AND inBatchNo = #{inBatchNo}
</if>
<if test="mainAction != null and mainAction != ''">
AND mainAction = #{mainAction}
</if>
<if test="batchNo != null and batchNo != ''">
AND batchNo = #{batchNo}
</if>
<if test="batchNo == null or batchNo == ''">
AND batchNo is null
</if>
</where>
</select>
<select id="selectNextInBatch" resultType="com.glxp.api.vo.basic.InvProductNewVo">
select *
from inv_prein_product_detail
<where>
<if test="relId != null and relId != ''">
AND relId = #{relId}
</if>
<if test="mainAction != null and mainAction != ''">
AND mainAction = #{mainAction}
</if>
<if test="batchNo != null and batchNo != ''">
AND batchNo = #{batchNo}
</if>
<if test="batchNo == null or batchNo == ''">
AND batchNo is null
</if>
and inBatchNo > #{inBatchNo}
LIMIT 1
</where>
</select>
</mapper>

@ -90,61 +90,4 @@
group by ipp.id
</select>
<select id="filterPreProductList" resultType="com.glxp.api.entity.inv.InvPreProductEntity">
select ipp.*
from inv_pre_product ipp
inner join basic_udirel on ipp.relIdFk = basic_udirel.id
inner join basic_products bp on basic_udirel.uuid = bp.uuid
left join basic_corp on ipp.supId = basic_corp.erpId
left join auth_dept on auth_dept.code = ipp.deptCode
left join auth_warehouse on auth_warehouse.code = ipp.invCode
<where>
bp.diType = 1
<if test="cpmctymc != null and cpmctymc != ''">
AND bp.cpmctymc like concat('%', #{cpmctymc}, '%')
</if>
<if test="nameCode != null and nameCode != ''">
AND ipp.nameCode like concat('%', #{nameCode}, '%')
</if>
<if test="relIdFk != null and relIdFk != ''">
AND ipp.relIdFk = #{relIdFk}
</if>
<if test="ggxh != null and ggxh != ''">
AND bp.ggxh like concat('%', #{ggxh}, '%')
</if>
<if test="batchNo != null and batchNo != ''">
AND ipp.batchNo like concat('%', #{batchNo}, '%')
</if>
<if test="productionDate != null and productionDate != ''">
AND ipp.productionDate = #{productionDate}
</if>
<if test="expireDate != null and expireDate != ''">
AND ipp.expireDate = #{expireDate}
</if>
<if test="ylqxzcrbarmc != null and ylqxzcrbarmc != ''">
AND bp.ylqxzcrbarmc like concat('%', #{ylqxzcrbarmc}, '%')
</if>
<if test="zczbhhzbapzbh != null and zczbhhzbapzbh != ''">
AND bp.zczbhhzbapzbh like concat('%', #{zczbhhzbapzbh}, '%')
</if>
<if test="customerId != null and customerId != ''">
AND ipp.customerId = #{customerId}
</if>
<if test="supId != null and supId != ''">
AND ipp.supId = #{supId}
</if>
<if test="deptCode != null and deptCode != ''">
AND ipp.deptCode = #{deptCode}
</if>
<if test="invCode != null and invCode != ''">
AND ipp.invCode = #{invCode}
</if>
<if test="invCodes != null and invCodes.size() != 0">
AND ipp.invCode in
<foreach collection="invCodes" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</where>
</select>
</mapper>

@ -1,85 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.glxp.api.dao.inv.InvPreProductDetailDao">
<select id="findGroupBySpace" resultType="com.glxp.api.res.inv.InvPreinProductResponse">
select ipp.id,
ipp.nameCode,
bp.cpmctymc,
ipp.relId,
bp.ggxh,
ipp.batchNo,
ipp.produceDate,
ipp.expireDate,
bp.ylqxzcrbarmc,
bp.zczbhhzbapzbh,
ipp.inCount,
ipp.outCount,
ipp.reCount,
basic_corp.name supName,
ipp.supId,
auth_dept.name deptName,
auth_warehouse.name invName,
as.name spaceName,
ipp.deptCode,
ipp.invCode
from inv_pre_product_detail ipp
inner join basic_udirel on ipp.relId = basic_udirel.id
inner join basic_products bp on basic_udirel.uuid = bp.uuid
left join basic_corp on ipp.supId = basic_corp.erpId
left join auth_dept on auth_dept.code = ipp.deptCode
left join auth_warehouse on auth_warehouse.code = ipp.invCode
left join auth_space `as` on ipp.code = `as`.code
<where>
<if test="cpmctymc != null and cpmctymc != ''">
AND bp.cpmctymc like concat('%', #{cpmctymc}, '%')
</if>
<if test="nameCode != null and nameCode != ''">
AND ipp.nameCode like concat('%', #{nameCode}, '%')
</if>
<if test="relIdFk != null and relIdFk != ''">
AND ipp.relId = #{relIdFk}
</if>
<if test="ggxh != null and ggxh != ''">
AND bp.ggxh like concat('%', #{ggxh}, '%')
</if>
<if test="batchNo != null and batchNo != ''">
AND ipp.batchNo like concat('%', #{batchNo}, '%')
</if>
<if test="productionDate != null and productionDate != ''">
AND ipp.produceDate = #{productionDate}
</if>
<if test="expireDate != null and expireDate != ''">
AND ipp.expireDate = #{expireDate}
</if>
<if test="ylqxzcrbarmc != null and ylqxzcrbarmc != ''">
AND bp.ylqxzcrbarmc like concat('%', #{ylqxzcrbarmc}, '%')
</if>
<if test="zczbhhzbapzbh != null and zczbhhzbapzbh != ''">
AND bp.zczbhhzbapzbh like concat('%', #{zczbhhzbapzbh}, '%')
</if>
<if test="supId != null and supId != ''">
AND ipp.supId = #{supId}
</if>
<if test="deptCode != null and deptCode != ''">
AND ipp.deptCode = #{deptCode}
</if>
<if test="invCode != null and invCode != ''">
AND ipp.invCode = #{invCode}
</if>
<if test="spaceCode != null and spaceCode != ''">
AND ipp.invSpaceCode = #{spaceCode}
</if>
<if test="invCodes != null and invCodes.size() != 0">
AND ipp.invCode in
<foreach collection="invCodes" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</where>
GROUP BY ipp.relId, ipp.batchNo
order by ipp.updateTime desc
</select>
<select id="filterPreProductDetailList" resultType="com.glxp.api.entity.inv.InvPreProductDetailEntity">
select *
@ -171,236 +92,4 @@
</if>
</where>
</delete>
<select id="getInvProductInfo" resultType="com.glxp.api.res.inv.InvPlaceDetailResponse">
select ipd.code,
ipd.relId,
ipd.batchNo,
ipd.serialNo,
ipd.invSpaceCode,
ipd.invCode,
bp.cpmctymc productName,
bp.ggxh,
bp.measname,
bp.zczbhhzbapzbh,
bp.manufactory,
(select name from auth_space s where s.code = ipd.invSpaceCode) invSpaceName,
(select name from basic_corp bc where bc.erpId = ipd.supId) supName
from inv_pre_product_detail ipd
left join basic_udirel bu on bu.id = ipd.relId
left join basic_products bp on bp.uuid = bu.uuid
<where>
<if test="invCode != null and invCode != ''">
AND ipd.invCode = #{invCode}
</if>
<if test="invSpaceCode != null and invSpaceCode != ''">
AND ipd.invSpaceCode = #{invSpaceCode}
</if>
<if test="code != null and code != ''">
AND ipd.code = #{code}
</if>
<if test="orderId != null and orderId != ''">
AND ipd.orderId = #{orderId}
</if>
</where>
group by ipd.id
</select>
<update id="batchBindSpace">
update inv_pre_product_detail
set invSpaceCode = #{invSpaceCode}
where id in
<foreach collection="ids" index="index" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</update>
<select id="getInvPlaceOrderList" resultType="com.glxp.api.res.inout.IoOrderResponse">
select ipd.orderId billNo,
(select name from basic_bussiness_type where action = o.action) billTypeName,
o.mainAction,
o.fromCorp,
o.corpOrderId,
o.fromType,
o.createTime,
o.auditTime,
(select employeeName from auth_user where id = o.reviewUser) reviewUserName
from inv_pre_product_detail ipd
left join io_order o on ipd.orderId = o.billNo
<where>
<if test="invCode != null and invCode != ''">
AND ipd.invCode = #{invCode}
</if>
<if test="orderId != null and orderId != ''">
AND ipd.orderId like concat('%', #{orderId}, '%')
</if>
</where>
group by ipd.orderId
</select>
<select id="getInventoryQuantity" resultType="java.lang.Integer">
SELECT ifnull(SUM(inCount), 0) - ifnull(SUM(outCount), 0)
FROM inv_pre_product_detail ipd
WHERE CODE = #{code}
and invCode = #{invCode}
and (invSpaceCode is null or invSpaceCode = '')
</select>
<select id="filterSpaceList" resultType="com.glxp.api.res.inv.InvPlaceDetailResponse">
SELECT t1.nameCode,
t1.relId,
(SELECT NAME FROM auth_dept WHERE auth_dept.`code` = t1.deptCode) AS deptName,
(SELECT NAME FROM auth_warehouse WHERE auth_warehouse.`code` = t1.invCode) AS invName,
(SELECT NAME FROM auth_space WHERE auth_space.`code` = t1.invSpaceCode) AS invSpaceName,
SUM(t1.reCount) as count,
bp.cpmctymc as productName,
bp.ggxh,
t1.batchNo,
t1.produceDate as productionDate,
t1.expireDate,
bp.measname,
bp.zczbhhzbapzbh,
bp.ylqxzcrbarmc,
bp.manufactory,
(SELECT `name` FROM basic_corp WHERE erpId = t1.supId) supName
FROM inv_pre_product_detail t1
LEFT JOIN basic_udirel bu ON bu.id = t1.relId
LEFT JOIN basic_products bp ON bp.uuid = bu.uuid
<where>
<if test="code != null and code != ''">
AND t1.code = #{code}
</if>
<if test="invSpaceCode != null and invSpaceCode != ''">
AND t1.invSpaceCode = #{invSpaceCode}
</if>
</where>
GROUP BY CODE,
invSpaceCode
</select>
<select id="findByGroupCode" resultType="com.glxp.api.res.inv.InvPlaceDetailResponse">
select pd.id,
pd.code,
pd.relId,
pd.batchNo,
pd.produceDate productionDate,
pd.expireDate,
bp.ggxh,
bp.cpmctymc productName,
bp.zczbhhzbapzbh,
bp.ylqxzcrbarmc,
bp.nameCode,
bp.manufactory,
pd.invSpaceCode,
pd.invCode,
ad.name deptName,
aw.name invName,
sp.name invSpaceName,
ifnull(sum(pd.inCount), 0) as inCount,
ifnull(sum(pd.outCount), 0) as outCount,
pd.inCount - pd.outCount as reCount
from inv_pre_product_detail pd
left join basic_udirel bu on pd.relId = bu.id
left join basic_products bp on bp.uuid = bu.uuid
left join auth_dept ad on pd.deptCode = ad.code
left join auth_warehouse aw on pd.invCode = aw.code
left join auth_space sp on pd.invSpaceCode = sp.code
and sp.invStorageCode = pd.deptCode and sp.invWarehouseCode = pd.invCode
<where>
<if test="invCode != null and invCode != ''">
AND pd.invCode = #{invCode}
</if>
<if test="code != null and code != ''">
AND pd.code = #{code}
</if>
</where>
group by pd.invSpaceCode
</select>
<select id="selectLastInBatch" resultType="com.glxp.api.vo.basic.InvProductNewVo">
select *
from inv_pre_product_detail
<where>
<if test="relId != null and relId != ''">
AND relId = #{relId}
</if>
<if test="mainAction != null and mainAction != ''">
AND mainAction = #{mainAction}
</if>
<if test="batchNo != null and batchNo != ''">
AND batchNo = #{batchNo}
</if>
<if test="batchNo == null or batchNo == ''">
AND batchNo is null
</if>
</where>
order by inBatchNo desc
limit 1;
</select>
<select id="selectFirstInBatch" resultType="com.glxp.api.vo.basic.InvProductNewVo">
select *
from inv_pre_product_detail
<where>
<if test="relId != null and relId != ''">
AND relId = #{relId}
</if>
<if test="mainAction != null and mainAction != ''">
AND mainAction = #{mainAction}
</if>
<if test="batchNo != null and batchNo != ''">
AND batchNo = #{batchNo}
</if>
<if test="batchNo == null or batchNo == ''">
AND batchNo is null
</if>
</where>
order by inBatchNo
limit 1;
</select>
<select id="selectCountByInBatch" resultType="java.lang.Integer">
select sum(reCount)
from inv_pre_product_detail
<where>
<if test="relId != null and relId != ''">
AND relId = #{relId}
</if>
<if test="inBatchNo != null and inBatchNo != ''">
AND inBatchNo = #{inBatchNo}
</if>
<if test="mainAction != null and mainAction != ''">
AND mainAction = #{mainAction}
</if>
<if test="batchNo != null and batchNo != ''">
AND batchNo = #{batchNo}
</if>
<if test="batchNo == null or batchNo == ''">
AND batchNo is null
</if>
</where>
</select>
<select id="selectNextInBatch" resultType="com.glxp.api.vo.basic.InvProductNewVo">
select *
from inv_pre_product_detail
<where>
<if test="relId != null and relId != ''">
AND relId = #{relId}
</if>
<if test="mainAction != null and mainAction != ''">
AND mainAction = #{mainAction}
</if>
<if test="batchNo != null and batchNo != ''">
AND batchNo = #{batchNo}
</if>
<if test="batchNo == null or batchNo == ''">
AND batchNo is null
</if>
and inBatchNo > #{inBatchNo}
LIMIT 1
</where>
</select>
</mapper>

@ -88,62 +88,4 @@
</where>
group by ipp.id
</select>
<select id="filterPreProductList" resultType="com.glxp.api.entity.inv.InvPreinProductEntity">
select ipp.*
from inv_prein_product ipp
inner join basic_udirel on ipp.relIdFk = basic_udirel.id
inner join basic_products bp on basic_udirel.uuid = bp.uuid
left join basic_corp on ipp.supId = basic_corp.erpId
left join auth_dept on auth_dept.code = ipp.deptCode
left join auth_warehouse on auth_warehouse.code = ipp.invCode
<where>
bp.diType = 1
<if test="cpmctymc != null and cpmctymc != ''">
AND bp.cpmctymc like concat('%', #{cpmctymc}, '%')
</if>
<if test="nameCode != null and nameCode != ''">
AND ipp.nameCode like concat('%', #{nameCode}, '%')
</if>
<if test="relIdFk != null and relIdFk != ''">
AND ipp.relIdFk = #{relIdFk}
</if>
<if test="ggxh != null and ggxh != ''">
AND bp.ggxh like concat('%', #{ggxh}, '%')
</if>
<if test="batchNo != null and batchNo != ''">
AND ipp.batchNo like concat('%', #{batchNo}, '%')
</if>
<if test="productionDate != null and productionDate != ''">
AND ipp.productionDate = #{productionDate}
</if>
<if test="expireDate != null and expireDate != ''">
AND ipp.expireDate = #{expireDate}
</if>
<if test="ylqxzcrbarmc != null and ylqxzcrbarmc != ''">
AND bp.ylqxzcrbarmc like concat('%', #{ylqxzcrbarmc}, '%')
</if>
<if test="zczbhhzbapzbh != null and zczbhhzbapzbh != ''">
AND bp.zczbhhzbapzbh like concat('%', #{zczbhhzbapzbh}, '%')
</if>
<if test="customerId != null and customerId != ''">
AND ipp.customerId = #{customerId}
</if>
<if test="supId != null and supId != ''">
AND ipp.supId = #{supId}
</if>
<if test="deptCode != null and deptCode != ''">
AND ipp.deptCode = #{deptCode}
</if>
<if test="invCode != null and invCode != ''">
AND ipp.invCode = #{invCode}
</if>
<if test="invCodes != null and invCodes.size() != 0">
AND ipp.invCode in
<foreach collection="invCodes" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</where>
</select>
</mapper>

@ -3,106 +3,6 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.glxp.api.dao.inv.InvProductNewDao">
<select id="findGroupBySpace" resultType="com.glxp.api.res.inv.InvProductResponse">
select ipp.id,
ipp.nameCode,
bp.cpmctymc,
ipp.relIdFk as relId,
bp.ggxh,
bp.measname,
ipp.batchNo,
ipp.productionDate as produceDate,
ipp.expireDate,
bp.ylqxzcrbarmc,
bp.zczbhhzbapzbh,
bp.bzgg,
inCount,
outCount,
reCount,
basic_corp.name supName,
ipp.supId,
auth_dept.name deptName,
auth_warehouse.name invName,
as.name spaceName,
ipp.deptCode,
ipp.invCode,
ipp.invSpaceCode,
<!-- ipp.code as code,-->
bp.productsType,
bp.levelUnit,
bp.prepnUnit,
bp.prepnSpec,
bp.specialCode,
bp.storageCondition,
bp.transportCondition,
bp.indate,
bp.useAttribute,
bp.packMatrial,
bp.majorType,
bp.majorStatus,
bp.physicType,
bp.medicareType
from inv_product ipp
inner join basic_udirel on ipp.relIdFk = basic_udirel.id
inner join basic_products bp on basic_udirel.uuid = bp.uuid
left join basic_corp on ipp.supId = basic_corp.erpId
left join auth_dept on auth_dept.code = ipp.deptCode
left join auth_warehouse on auth_warehouse.code = ipp.invCode
left join auth_space `as` on ipp.invSpaceCode = `as`.code
<where>
<if test="cpmctymc != null and cpmctymc != ''">
AND bp.cpmctymc like concat('%', #{cpmctymc}, '%')
</if>
<if test="nameCode != null and nameCode != ''">
AND ipp.nameCode like concat('%', #{nameCode}, '%')
</if>
<if test="relIdFk != null and relIdFk != ''">
AND ipp.relIdFk = #{relIdFk}
</if>
<if test="productsType != null ">
AND bp.productsType = #{productsType}
</if>
<if test="ggxh != null and ggxh != ''">
AND bp.ggxh like concat('%', #{ggxh}, '%')
</if>
<if test="batchNo != null and batchNo != ''">
AND ipp.batchNo like concat('%', #{batchNo}, '%')
</if>
<if test="productionDate != null and productionDate != ''">
AND ipp.productionDate = #{productionDate}
</if>
<if test="expireDate != null and expireDate != ''">
AND ipp.expireDate = #{expireDate}
</if>
<if test="ylqxzcrbarmc != null and ylqxzcrbarmc != ''">
AND bp.ylqxzcrbarmc like concat('%', #{ylqxzcrbarmc}, '%')
</if>
<if test="zczbhhzbapzbh != null and zczbhhzbapzbh != ''">
AND bp.zczbhhzbapzbh like concat('%', #{zczbhhzbapzbh}, '%')
</if>
<if test="supId != null and supId != ''">
AND ipp.supId = #{supId}
</if>
<if test="deptCode != null and deptCode != ''">
AND ipp.deptCode = #{deptCode}
</if>
<if test="invCode != null and invCode != ''">
AND ipp.invCode = #{invCode}
</if>
<if test="invSpaceCode != null and invSpaceCode != ''">
AND ipp.invSpaceCode = #{invSpaceCode}
</if>
<if test="invCodes != null and invCodes.size() != 0">
AND ipp.invCode in
<foreach collection="invCodes" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</where>
GROUP BY ipp.relIdFk, ipp.batchNo
order by ipp.updateTime desc
</select>
<select id="filterInvProductDetailList" resultType="com.glxp.api.vo.basic.InvProductNewVo"
parameterType="com.glxp.api.req.inv.FilterInvProductDetailRequest">
@ -186,28 +86,6 @@
</choose>
</select>
<delete id="deleteInvProductDetail">
delete
from inv_product
<where>
<if test="relId != null and relId != ''">
AND relIdFk = #{relId}
</if>
<if test="batchNo != null and batchNo != '' and batchNo != 'empty'">
AND batchNo = #{batchNo}
</if>
<if test="batchNo == 'empty'">
AND batchNo is null
</if>
<if test="supId != null and supId != ''">
AND supId = #{supId}
</if>
<if test="invCode != null and invCode != ''">
AND invCode = #{invCode}
</if>
</where>
</delete>
<select id="selectPlaceDetailList" resultType="com.glxp.api.res.inv.InvPlaceDetailResponse">
select pd.id,
<!-- pd.code,-->
@ -248,49 +126,6 @@
<!-- group by pd.code-->
</select>
<select id="findByGroupCode" resultType="com.glxp.api.res.inv.InvPlaceDetailResponse">
select pd.id,
pd.code,
pd.relIdFk as relId,
pd.batchNo,
pd.productionDate productionDate,
pd.expireDate,
bp.ggxh,
bp.cpmctymc productName,
bp.zczbhhzbapzbh,
bp.ylqxzcrbarmc,
bp.nameCode,
bp.manufactory,
pd.invSpaceCode,
pd.invCode,
ad.name deptName,
aw.name invName,
sp.name invSpaceName,
inCount,
outCount,
reCount
from inv_product pd
left join basic_udirel bu on pd.relIdFk = bu.id
left join basic_products bp on bp.uuid = bu.uuid
left join auth_dept ad on pd.deptCode = ad.code
left join auth_warehouse aw on pd.invCode = aw.code
left join auth_space sp on pd.invSpaceCode = sp.code
and sp.invStorageCode = pd.deptCode and sp.invWarehouseCode = pd.invCode
<where>
<if test="invCode != null and invCode != ''">
AND pd.invCode = #{invCode}
</if>
<!-- <if test="code != null and code != ''">-->
<!-- AND pd.code = #{code}-->
<!-- </if>-->
<if test="isCheckSpace != null and isCheckSpace == true">
AND (pd.invSpaceCode is not null or pd.invSpaceCode != '')
</if>
</where>
group by pd.invSpaceCode
</select>
<update id="batchBindSpace">
update inv_product
set invSpaceCode = #{invSpaceCode}
@ -314,236 +149,6 @@
from inv_product_detail
where code = #{code}
</select>
<select id="selectCountOrderCodes" resultType="java.lang.String">
select distinct code
from inv_product_detail
<where>
<if test="invCode != null and invCode != ''">
AND invCode = #{invCode}
</if>
<if test="invSpaceCode != null and invSpaceCode != ''">
AND invSpaceCode = #{invSpaceCode}
</if>
<if test="relId != null">
AND relIdFk = #{relId}
</if>
<if test="batchNo != null and batchNo != ''">
AND batchNo = #{batchNo}
</if>
</where>
</select>
<select id="getInvProductInfo" resultType="com.glxp.api.res.inv.InvPlaceDetailResponse">
select ipd.code,
ipd.relId,
ipd.batchNo,
ipd.serialNo,
ipd.invSpaceCode,
ipd.invCode,
bp.cpmctymc productName,
bp.ggxh,
bp.measname,
bp.zczbhhzbapzbh,
bp.manufactory,
(select name from auth_space s where s.code = ipd.invSpaceCode) invSpaceName,
(select name from basic_corp bc where bc.erpId = ipd.supId) supName
from inv_product_detail ipd
left join basic_udirel bu on bu.id = ipd.relId
left join basic_products bp on bp.uuid = bu.uuid
<where>
<if test="invCode != null and invCode != ''">
AND ipd.invCode = #{invCode}
</if>
<if test="invSpaceCode != null and invSpaceCode != ''">
AND ipd.invSpaceCode = #{invSpaceCode}
</if>
<if test="code != null and code != ''">
AND ipd.code = #{code}
</if>
<if test="orderId != null and orderId != ''">
AND ipd.orderId = #{orderId}
</if>
</where>
group by ipd.id
</select>
<select id="getInvPlaceOrderList" resultType="com.glxp.api.res.inout.IoOrderResponse">
select odr.orderIdFk billNo,
(select name from basic_bussiness_type where action = o.action) billTypeName,
o.mainAction,
o.fromCorp,
o.corpOrderId,
o.fromType,
o.createTime,
o.auditTime,
(select employeeName from auth_user where id = o.reviewUser) reviewUserName
from io_order_detail_biz odr
left join io_order o on o.billNo = odr.orderIdFk
<where>
<if test="invCode != null and invCode != ''">
AND odr.invCode = #{invCode}
</if>
<if test="orderId != null and orderId != ''">
AND odr.orderIdFk like concat('%', #{orderId}, '%')
</if>
</where>
group by odr.orderIdFk
</select>
<select id="getInventoryQuantity" resultType="java.lang.Integer">
SELECT reCount
FROM inv_product ipd
WHERE invCode = #{invCode}
and (invSpaceCode is null or invSpaceCode = '')
</select>
<select id="filterSpaceList" resultType="com.glxp.api.res.inv.InvPlaceDetailResponse">
SELECT t1.nameCode,
t1.relIdFk as relId,
(SELECT NAME FROM auth_dept WHERE auth_dept.`code` = t1.deptCode) AS deptName,
(SELECT NAME FROM auth_warehouse WHERE auth_warehouse.`code` = t1.invCode) AS invName,
(SELECT NAME FROM auth_space WHERE auth_space.`code` = t1.invSpaceCode) AS invSpaceName,
<include refid="inOrOutcount"/> as count,
bp.cpmctymc as productName,
bp.ggxh,
t1.batchNo,
t1.productionDate as produceDate as productionDate,
t1.expireDate,
bp.measname,
bp.zczbhhzbapzbh,
bp.ylqxzcrbarmc,
bp.manufactory,
(SELECT `name` FROM basic_corp WHERE erpId = t1.supId) supName
FROM inv_product t1
LEFT JOIN basic_udirel bu ON bu.id = t1.relIdFk
LEFT JOIN basic_products bp ON bp.uuid = bu.uuid
<where>
<!-- <if test="code != null and code != ''">-->
<!-- AND t1.code = #{code}-->
<!-- </if>-->
<if test="invSpaceCode != null and invSpaceCode != ''">
AND t1.invSpaceCode = #{invSpaceCode}
</if>
</where>
GROUP BY invSpaceCode
</select>
<select id="selectLastInBatch" resultType="com.glxp.api.vo.basic.InvProductNewVo">
select <include refid="selectInvPreProduct"/>
from inv_product
<where>
<if test="relId != null and relId != ''">
AND relIdFk = #{relId}
</if>
<if test="invCode != null and invCode != ''">
AND invCode = #{invCode}
</if>
<!-- <if test="mainAction != null and mainAction != ''">-->
<!-- AND mainAction = #{mainAction}-->
<!-- </if>-->
<if test="batchNo != null and batchNo != ''">
AND batchNo = #{batchNo}
</if>
<if test="batchNo == null or batchNo == ''">
AND batchNo is null
</if>
</where>
order by inBatchNo desc
limit 1;
</select>
<select id="selectFirstInBatch" resultType="com.glxp.api.vo.basic.InvProductNewVo">
select <include refid="selectInvPreProduct"/>
from inv_product
<where>
<if test="relId != null and relId != ''">
AND relIdFk = #{relId}
</if>
<if test="invCode != null and invCode != ''">
AND invCode = #{invCode}
</if>
<!-- <if test="mainAction != null and mainAction != ''">-->
<!-- AND mainAction = #{mainAction}-->
<!-- </if>-->
<if test="batchNo != null and batchNo != ''">
AND batchNo = #{batchNo}
</if>
<if test="batchNo == null or batchNo == ''">
AND batchNo is null
</if>
</where>
order by inBatchNo
limit 1;
</select>
<select id="selectCountByInBatch" resultType="java.lang.Integer">
select
<include refid="inOrOutcount"/>
from inv_product
<where>
<if test="relId != null and relId != ''">
AND relIdFk = #{relId}
</if>
<if test="invCode != null and invCode != ''">
AND invCode = #{invCode}
</if>
<if test="inBatchNo != null and inBatchNo != ''">
AND inBatchNo = #{inBatchNo}
</if>
<!-- <if test="mainAction != null and mainAction != ''">-->
<!-- AND mainAction = #{mainAction}-->
<!-- </if>-->
<if test="batchNo != null and batchNo != ''">
AND batchNo = #{batchNo}
</if>
<if test="batchNo == null or batchNo == ''">
AND batchNo is null
</if>
</where>
</select>
<select id="selectNextInBatch" resultType="com.glxp.api.vo.basic.InvProductNewVo">
select <include refid="selectInvPreProduct"/>
from inv_product
<where>
<if test="relId != null and relId != ''">
AND relIdFk = #{relId}
</if>
<if test="invCode != null and invCode != ''">
AND invCode = #{invCode}
</if>
<!-- <if test="mainAction != null and mainAction != ''">-->
<!-- AND mainAction = #{mainAction}-->
<!-- </if>-->
<if test="batchNo != null and batchNo != ''">
AND batchNo = #{batchNo}
</if>
<if test="batchNo == null or batchNo == ''">
AND batchNo is null
</if>
and inBatchNo > #{inBatchNo}
LIMIT 1
</where>
</select>
<sql id="selectInvPreProduct">
*
</sql>
<sql id="inOrOutcount">
<choose>
<when test="mainAction =='WareHouseOut'.toString() ">
outCount
</when>
<when test="mainAction =='WareHouseIn'.toString() ">
inCount
</when>
</choose>
</sql>
<select id="selectOrderInfo" resultType="com.glxp.api.vo.basic.InvProductNewVo">
select t1.deptCode,t1.invCode,t1.mainAction,t2.* from io_order t1 inner join io_order_detail_biz t2 on t1.billNo = t2.orderIdFk
<where>

Loading…
Cancel
Save