feat 辅材入库聚合
This commit is contained in:
parent
72480250c8
commit
a08a86b2bf
@ -2,6 +2,7 @@ package com.cim.idm.controller;
|
|||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.cim.idm.constants.delivery.DeliveryStateEnums;
|
import com.cim.idm.constants.delivery.DeliveryStateEnums;
|
||||||
|
import com.cim.idm.constants.delivery.DeliveryTypeEnums;
|
||||||
import com.cim.idm.exception.GlobalException;
|
import com.cim.idm.exception.GlobalException;
|
||||||
import com.cim.idm.model.dto.delivery.DeliveryDelDto;
|
import com.cim.idm.model.dto.delivery.DeliveryDelDto;
|
||||||
import com.cim.idm.model.dto.delivery.DeliveryDto;
|
import com.cim.idm.model.dto.delivery.DeliveryDto;
|
||||||
@ -85,8 +86,16 @@ public class DeliveryController {
|
|||||||
throw new GlobalException("不存在该单据");
|
throw new GlobalException("不存在该单据");
|
||||||
}
|
}
|
||||||
// 获取采购单明细及批次
|
// 获取采购单明细及批次
|
||||||
return AjaxResult.me().setSuccess(true).setResultObj(
|
String deliveryType = params.get("deliveryType");
|
||||||
deliveryService.getStoreDetail(storeDetailDto.getDocumentName(), storeDetailDto.getSiteName(), nameList, deliveryName));
|
if (deliveryType.equals(DeliveryTypeEnums.BATCH.getCode())) {
|
||||||
|
// 批次
|
||||||
|
return AjaxResult.me().setSuccess(true).setResultObj(
|
||||||
|
deliveryService.getStoreDetail(storeDetailDto.getDocumentName(), storeDetailDto.getSiteName(), nameList, deliveryName));
|
||||||
|
} else {
|
||||||
|
// 辅材
|
||||||
|
return AjaxResult.me().setSuccess(true).setResultObj(
|
||||||
|
deliveryService.getMaterialDetail(storeDetailDto.getDocumentName(), storeDetailDto.getSiteName(), nameList, deliveryName));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -43,6 +43,16 @@ public interface DeliveryDao {
|
|||||||
@MapKey("storeDetail")
|
@MapKey("storeDetail")
|
||||||
List<Map<String, Object>> getStoreDetail(@Param("siteName") String siteName,
|
List<Map<String, Object>> getStoreDetail(@Param("siteName") String siteName,
|
||||||
@Param("nameList") List<String> nameList,
|
@Param("nameList") List<String> nameList,
|
||||||
|
@Param("typeList") List<String> typeList,
|
||||||
|
@Param("deliveryName") String deliveryName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取入库详情
|
||||||
|
*/
|
||||||
|
@MapKey("materialDetail")
|
||||||
|
List<Map<String, Object>> getMaterialDetail(@Param("siteName") String siteName,
|
||||||
|
@Param("nameList") List<String> nameList,
|
||||||
|
@Param("typeList") List<String> typeList,
|
||||||
@Param("deliveryName") String deliveryName);
|
@Param("deliveryName") String deliveryName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -14,6 +14,7 @@ import com.cim.idm.model.vo.ReceiveDetailVo;
|
|||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public interface IDeliveryService {
|
public interface IDeliveryService {
|
||||||
/**
|
/**
|
||||||
@ -40,6 +41,16 @@ public interface IDeliveryService {
|
|||||||
*/
|
*/
|
||||||
ReceiveDetailVo getStoreDetail(String documentName, String siteName, List<String> nameList, String deliveryName);
|
ReceiveDetailVo getStoreDetail(String documentName, String siteName, List<String> nameList, String deliveryName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取辅材明细及批次
|
||||||
|
* @param documentName 单据名称
|
||||||
|
* @param siteName 组织
|
||||||
|
* @param nameList 名称
|
||||||
|
* @param deliveryName 到库单号
|
||||||
|
* @return 采购订单
|
||||||
|
*/
|
||||||
|
List<Map<String, Object>> getMaterialDetail(String documentName, String siteName, List<String> nameList, String deliveryName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据 key 获取值
|
* 根据 key 获取值
|
||||||
* @param storeDetailDto 单据请求
|
* @param storeDetailDto 单据请求
|
||||||
|
@ -70,7 +70,7 @@ public class DeliveryServiceImpl implements IDeliveryService {
|
|||||||
public ReceiveDetailVo getStoreDetail(String documentName, String siteName, List<String> nameList, String deliveryName) {
|
public ReceiveDetailVo getStoreDetail(String documentName, String siteName, List<String> nameList, String deliveryName) {
|
||||||
ReceiveDetailVo receiveDetailVo = new ReceiveDetailVo();
|
ReceiveDetailVo receiveDetailVo = new ReceiveDetailVo();
|
||||||
// 采购单明细
|
// 采购单明细
|
||||||
List<Map<String, Object>> storeDetail = deliveryDao.getStoreDetail(siteName, nameList, deliveryName);
|
List<Map<String, Object>> storeDetail = deliveryDao.getStoreDetail(siteName, nameList, ReceiveTypeEnums.getPurchase(), deliveryName);
|
||||||
receiveDetailVo.setStoreDetail(storeDetail);
|
receiveDetailVo.setStoreDetail(storeDetail);
|
||||||
// 批次
|
// 批次
|
||||||
List<Map<String, Object>> storeCharge = deliveryDao.getStoreCharge(siteName, documentName);
|
List<Map<String, Object>> storeCharge = deliveryDao.getStoreCharge(siteName, documentName);
|
||||||
@ -78,6 +78,11 @@ public class DeliveryServiceImpl implements IDeliveryService {
|
|||||||
return receiveDetailVo;
|
return receiveDetailVo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Map<String, Object>> getMaterialDetail(String documentName, String siteName, List<String> nameList, String deliveryName) {
|
||||||
|
return deliveryDao.getMaterialDetail(siteName, nameList, ReceiveTypeEnums.getPurchase(), deliveryName);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MaterialDelivery getByKey(StoreDetailDto storeDetailDto) {
|
public MaterialDelivery getByKey(StoreDetailDto storeDetailDto) {
|
||||||
return deliveryDao.getByKey(storeDetailDto);
|
return deliveryDao.getByKey(storeDetailDto);
|
||||||
|
@ -164,7 +164,78 @@
|
|||||||
#{name}
|
#{name}
|
||||||
</foreach>
|
</foreach>
|
||||||
AND m.SITENAME = #{siteName}
|
AND m.SITENAME = #{siteName}
|
||||||
AND m2.RECEIVEREQUESTTYPE IN ( 'ZK4A', '45', '4C', 'Z001', 'Z002', 'Z003', 'Z004' )
|
AND m2.RECEIVEREQUESTTYPE IN
|
||||||
|
<foreach item="type" index="index" collection="typeList" open="(" separator="," close=")">
|
||||||
|
#{type}
|
||||||
|
</foreach>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!-- GetNoBatchPOStockIn 00001 -->
|
||||||
|
<select id="getMaterialDetail" resultType="map">
|
||||||
|
WITH MAIN AS (
|
||||||
|
SELECT m.MATERIALSPECNAME,
|
||||||
|
SUM( m.REQUESTQUANTITY ) REQUESTQUANTITY,
|
||||||
|
SUM( m.RECEIVEDQUANTITY ) RECEIVEDQUANTITY,
|
||||||
|
SUM( m.REQUESTQUANTITY - m.RECEIVEDQUANTITY) AS ThisAcceptNumber
|
||||||
|
FROM MATERIALRECEIVEREQUESTDETAIL m
|
||||||
|
WHERE m.RECEIVEREQUESTNAME in
|
||||||
|
<foreach item="name" index="index" collection="nameList" open="(" separator="," close=")">
|
||||||
|
#{name}
|
||||||
|
</foreach>
|
||||||
|
GROUP BY m.MATERIALSPECNAME
|
||||||
|
)
|
||||||
|
<if test="deliveryName != null">
|
||||||
|
,DELIVERY AS (
|
||||||
|
SELECT sum(md.DELIVERYNUM) DELIVERYNUM, md.MATERIALSPECNAME MATERIALSPECNAME
|
||||||
|
FROM MATERIALDELIVERYRECEIVE md
|
||||||
|
WHERE md.DELIVERYNAME = #{deliveryName}
|
||||||
|
and md.RECEIVEREQUESTNAME IN
|
||||||
|
<foreach item="name" index="index" collection="nameList" open="(" separator="," close=")">
|
||||||
|
#{name}
|
||||||
|
</foreach>
|
||||||
|
GROUP BY md.MATERIALSPECNAME
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
SELECT distinct MAIN.RECEIVEDQUANTITY, MAIN.ThisAcceptNumber,
|
||||||
|
<if test="deliveryName != null">
|
||||||
|
DELIVERY.DELIVERYNUM REQUESTQUANTITY,
|
||||||
|
</if>
|
||||||
|
<if test="deliveryName == null">
|
||||||
|
MAIN.REQUESTQUANTITY REQUESTQUANTITY,
|
||||||
|
</if>
|
||||||
|
m3.DESCRIPTION, be.DESCRIPTION AS ERPLOCATION2, m.ERPLOCATION, o.ORGNAME AS ERPFACTORY2,
|
||||||
|
m2.STOCKORGNO AS ERPFACTORY, sss.DESCRIPTION AS LOCATIONNAME2, m.LOCATIONNAME, m2.SUPPLIERNO,
|
||||||
|
ss.SPECNAME, m.PHASE, m3.DESC_CN, m.MATERIALSPECNAME,
|
||||||
|
m.MATERIALUNIT, MM.FNAME MATERIALUNITDESC, m.SDK_ID, m.PHASE, m.SITENAME,
|
||||||
|
DECODE(m3.IS_BATCH, 'Y', '是' , '否') IS_BATCH, DECODE(m3.IQCFLAG, 'Y', '是' ,'否') IQCFLAG,
|
||||||
|
CASE WHEN m3.EXPIRATION_RULES = '0' THEN '不遵守有效期管理'
|
||||||
|
WHEN m3.EXPIRATION_RULES = '1' THEN '遵守有效期管理'
|
||||||
|
ELSE '未定义'
|
||||||
|
END AS REPLACED_VALUE
|
||||||
|
FROM MAIN
|
||||||
|
LEFT JOIN MATERIALRECEIVEREQUESTDETAIL m ON MAIN.MATERIALSPECNAME = m.MATERIALSPECNAME
|
||||||
|
LEFT JOIN MATERIALRECEIVEREQUEST m2 ON m.RECEIVEREQUESTNAME = m2.RECEIVEREQUESTNAME
|
||||||
|
LEFT JOIN MATERIALSPEC m3 ON m.MATERIALSPECNAME = m3.MATERIALSPECNAME
|
||||||
|
LEFT JOIN SDK_SPEC ss ON m.SDK_ID = ss.SDK_ID
|
||||||
|
LEFT JOIN MATERIALUNIT MM ON MM.FNUMBER = m.MATERIALUNIT
|
||||||
|
LEFT JOIN BS_ERPLOCATION be ON m.ERPLOCATION = be.ERPLOCATIONNAME
|
||||||
|
LEFT JOIN ORG o ON o.ORGNO = m2.STOCKORGNO
|
||||||
|
LEFT JOIN STORAGESPEC sss ON m.LOCATIONNAME = sss.STORAGENAME
|
||||||
|
<if test="deliveryName != null">
|
||||||
|
INNER JOIN DELIVERY ON DELIVERY.MATERIALSPECNAME = m.MATERIALSPECNAME
|
||||||
|
</if>
|
||||||
|
WHERE m.RECEIVEREQUESTNAME in
|
||||||
|
<foreach item="name" index="index" collection="nameList" open="(" separator="," close=")">
|
||||||
|
#{name}
|
||||||
|
</foreach>
|
||||||
|
AND m.SITENAME = #{siteName}
|
||||||
|
AND (m.REQUESTQUANTITY - m.RECEIVEDQUANTITY) > 0
|
||||||
|
AND m2.RECEIVEREQUESTTYPE IN
|
||||||
|
<foreach item="type" index="index" collection="typeList" open="(" separator="," close=")">
|
||||||
|
#{type}
|
||||||
|
</foreach>
|
||||||
|
AND (m2.RETURNFLAG IS NULL OR m2.RETURNFLAG != 'Y')
|
||||||
|
AND (m3.IS_BATCH IS NULL OR m3.IS_BATCH != 'Y')
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- GetPackingRow xh002 -->
|
<!-- GetPackingRow xh002 -->
|
||||||
|
Loading…
x
Reference in New Issue
Block a user