库位修改以及批量导入 不能重复的校验
This commit is contained in:
@@ -126,11 +126,17 @@ public class PcdeDetailServiceImpl implements IPcdeDetailService
|
|||||||
|
|
||||||
// 获取库位编号
|
// 获取库位编号
|
||||||
String locationCode = pcdeDetail.getPcode();
|
String locationCode = pcdeDetail.getPcode();
|
||||||
|
String warehouseCode = pcdeDetail.getWarehouseCode();
|
||||||
|
String scene = pcdeDetail.getScene();
|
||||||
|
String pcode = pcdeDetail.getPcode();
|
||||||
|
|
||||||
// 检查该库位是否仍有关联货物
|
// 按 仓库+场景+库位编码 校验是否有关联货物
|
||||||
int count = rkInfoMapper.countRkInfoByLocationCode(locationCode);
|
int count = rkInfoMapper.countRkInfoByPcdeDetail(warehouseCode, scene, pcode);
|
||||||
|
|
||||||
|
// // 检查该库位是否仍有关联货物
|
||||||
|
// int count = rkInfoMapper.countRkInfoByLocationCode(locationCode);
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
throw new ServiceException("库位 [" + locationCode + "] 上还有货物,无法批量删除");
|
throw new ServiceException("库位 [" + pcode + "] 上还有货物,无法批量删除");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -181,5 +181,5 @@ public interface GysJhMapper
|
|||||||
@Param("gysJhId") Long gysJhId);
|
@Param("gysJhId") Long gysJhId);
|
||||||
|
|
||||||
|
|
||||||
int syncGysJhQty(GysJh gysJh);
|
int syncGysJhQty(@Param("gysJhId") Long gysJhId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -195,4 +195,8 @@ public interface RkInfoMapper
|
|||||||
|
|
||||||
|
|
||||||
public int countRkInfoByLocationCode(String locationCode);
|
public int countRkInfoByLocationCode(String locationCode);
|
||||||
|
|
||||||
|
int countRkInfoByPcdeDetail(@Param("warehouseCode") String warehouseCode,
|
||||||
|
@Param("scene") String scene,
|
||||||
|
@Param("pcode") String pcode);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -210,7 +210,7 @@ public class RkBillServiceImpl implements IRkBillService
|
|||||||
if (gysJh == null) {
|
if (gysJh == null) {
|
||||||
throw new RuntimeException("供应计划不存在,ID:" + gysJhId);
|
throw new RuntimeException("供应计划不存在,ID:" + gysJhId);
|
||||||
}
|
}
|
||||||
int rows = gysJhMapper.syncGysJhQty(gysJh);
|
int rows = gysJhMapper.syncGysJhQty(gysJhId);
|
||||||
// 重新查(必须)
|
// 重新查(必须)
|
||||||
gysJh = gysJhMapper.selectGysJhById(gysJhId);
|
gysJh = gysJhMapper.selectGysJhById(gysJhId);
|
||||||
BigDecimal planQty = gysJh.getJhQty();
|
BigDecimal planQty = gysJh.getJhQty();
|
||||||
|
|||||||
@@ -517,7 +517,7 @@ public class RkRecordServiceImpl implements IRkRecordService
|
|||||||
if (gysJh == null) {
|
if (gysJh == null) {
|
||||||
throw new ServiceException("供应计划不存在,ID:" + gysJhId);
|
throw new ServiceException("供应计划不存在,ID:" + gysJhId);
|
||||||
}
|
}
|
||||||
int rows = gysJhMapper.syncGysJhQty(gysJh);
|
int rows = gysJhMapper.syncGysJhQty(gysJhId);
|
||||||
// 重新查(必须)
|
// 重新查(必须)
|
||||||
gysJh = gysJhMapper.selectGysJhById(gysJhId);
|
gysJh = gysJhMapper.selectGysJhById(gysJhId);
|
||||||
BigDecimal planQty = gysJh.getJhQty();
|
BigDecimal planQty = gysJh.getJhQty();
|
||||||
|
|||||||
@@ -317,29 +317,19 @@
|
|||||||
WHERE id = #{gysJhId}
|
WHERE id = #{gysJhId}
|
||||||
AND IFNULL(real_qty, 0) >= #{rollbackQty}
|
AND IFNULL(real_qty, 0) >= #{rollbackQty}
|
||||||
</update>
|
</update>
|
||||||
<update id="syncGysJhQty" parameterType="GysJh">
|
<update id="syncGysJhQty">
|
||||||
UPDATE gys_jh gj
|
UPDATE gys_jh gj
|
||||||
LEFT JOIN (
|
LEFT JOIN (
|
||||||
SELECT
|
SELECT
|
||||||
sap_no,
|
gys_jh_id,
|
||||||
wl_no,
|
|
||||||
xm_no,
|
|
||||||
IFNULL(SUM(real_qty), 0) AS total_real_qty
|
IFNULL(SUM(real_qty), 0) AS total_real_qty
|
||||||
FROM rk_info
|
FROM rk_info
|
||||||
WHERE (is_delete = '0' OR is_delete IS NULL)
|
WHERE (is_delete = '0' OR is_delete IS NULL)
|
||||||
AND exec_status = '1'
|
AND exec_status = '1'
|
||||||
AND sap_no = #{sapNo}
|
AND gys_jh_id = #{gysJhId}
|
||||||
AND wl_no = #{wlNo}
|
GROUP BY gys_jh_id
|
||||||
AND xm_no = #{xmNo}
|
) t ON gj.id = t.gys_jh_id
|
||||||
GROUP BY sap_no, wl_no, xm_no
|
|
||||||
) t
|
|
||||||
ON gj.sap_no = t.sap_no
|
|
||||||
AND gj.wl_no = t.wl_no
|
|
||||||
AND gj.xm_no = t.xm_no
|
|
||||||
SET gj.real_qty = IFNULL(t.total_real_qty, 0)
|
SET gj.real_qty = IFNULL(t.total_real_qty, 0)
|
||||||
WHERE (gj.is_delete = '0' OR gj.is_delete IS NULL)
|
WHERE gj.id = #{gysJhId}
|
||||||
AND gj.sap_no = #{sapNo}
|
|
||||||
AND gj.wl_no = #{wlNo}
|
|
||||||
AND gj.xm_no = #{xmNo}
|
|
||||||
</update>
|
</update>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -731,4 +731,17 @@
|
|||||||
AND is_chuku = 0
|
AND is_chuku = 0
|
||||||
AND IFNULL(real_qty, 0) > 0
|
AND IFNULL(real_qty, 0) > 0
|
||||||
</select>
|
</select>
|
||||||
|
<select id="countRkInfoByPcdeDetail" resultType="int">
|
||||||
|
SELECT COUNT(1)
|
||||||
|
FROM rk_info ri
|
||||||
|
INNER JOIN pcde_detail pd ON ri.pcode_id = pd.encoded_id
|
||||||
|
WHERE pd.warehouse_code = #{warehouseCode}
|
||||||
|
AND pd.scene = #{scene}
|
||||||
|
AND pd.pcode = #{pcode}
|
||||||
|
AND (pd.is_delete = '0' OR pd.is_delete IS NULL)
|
||||||
|
AND (ri.is_delete = '0' OR ri.is_delete IS NULL)
|
||||||
|
AND ri.exec_status = 1
|
||||||
|
AND ri.is_chuku = 0
|
||||||
|
AND IFNULL(ri.real_qty, 0) > 0
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
Reference in New Issue
Block a user