@@ -38,6 +38,8 @@ public enum BizExceptionCode implements BaseExceptionCode {
//采购 70000-71999
PURCCHECKIN_POST_ERROR(70000,""),
+ PURCHASE_UNAUDIT_ERROR(72006,"采购订单已转采购验收单,无法反审核"),
+
//销售
SALE_ALL_TURNOUT(72000, "该销售单已全部转出货,无法转出货单"),
@@ -26,4 +26,6 @@ public interface PurchaseMapper extends CommonBaseMapper<Purchase>{
@Param("companyId") Long companyId);
String selectCodeById(Long id);
+ Integer checkTurnInstatus(Long id);
}
@@ -498,6 +498,11 @@ public class PurchaseServiceImpl extends CommonBaseServiceImpl<PurchaseMapper, P
@Transactional
private void singleUnAudit(Long id) {
Purchase purchase = new Purchase();
+ //检查是否已转验收单
+ Integer num = getMapper().checkTurnInstatus(id);
+ if (num > 0) {
+ throw new BizException(BizExceptionCode.PURCHASE_UNAUDIT_ERROR);
+ }
//生成更新对象
purchase.setId(id);
purchase.setPu_status(Status.UNAUDITED.getDisplay());
@@ -422,4 +422,9 @@
<select id="selectCodeById" resultType="string" parameterType="long">
select pu_code from purchase where pu_id=#{id}
</select>
+ <select id="checkTurnInstatus" resultType="int" >
+ select count(1) from purchasedetail where PD_PUID=#{id} and PD_YQTY !=0;
+</select>
</mapper>