|
@@ -4,10 +4,16 @@ import com.ruoyi.basicData.domain.TGoods;
|
|
|
import com.ruoyi.basicData.mapper.TGoodsMapper;
|
|
|
import com.ruoyi.basicData.service.ITGoodsService;
|
|
|
import com.ruoyi.common.constant.UserConstants;
|
|
|
+import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
import com.ruoyi.common.utils.DateUtils;
|
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
|
+import com.ruoyi.warehouseBusiness.domain.TWarehouseBills;
|
|
|
+import com.ruoyi.warehouseBusiness.domain.TWarehousebillsitems;
|
|
|
+import com.ruoyi.warehouseBusiness.mapper.TWarehousebillsitemsMapper;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
+import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
@@ -22,6 +28,9 @@ public class TGoodsServiceImpl implements ITGoodsService {
|
|
|
@Autowired
|
|
|
private TGoodsMapper tGoodsMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private TWarehousebillsitemsMapper tWarehousebillsitemsMapper;
|
|
|
+
|
|
|
/**
|
|
|
* 查询商品详情
|
|
|
*
|
|
@@ -75,8 +84,22 @@ public class TGoodsServiceImpl implements ITGoodsService {
|
|
|
* @return 结果
|
|
|
*/
|
|
|
@Override
|
|
|
- public int deleteTGoodsByIds(Long[] fIds) {
|
|
|
- return tGoodsMapper.deleteTGoodsByIds(fIds);
|
|
|
+ @Transactional
|
|
|
+ public AjaxResult deleteTGoodsByIds(Long[] fIds) {
|
|
|
+ // return tGoodsMapper.deleteTGoodsByIds(fIds);
|
|
|
+ int i = 1;
|
|
|
+ for(Long id:fIds){
|
|
|
+ TWarehousebillsitems tWarehousebillsitems =new TWarehousebillsitems();
|
|
|
+ tWarehousebillsitems.setfGoodsid(id);
|
|
|
+ List<TWarehousebillsitems> warehousebillsitemsList1 =tWarehousebillsitemsMapper.selectTWarehousebillsitemsList(tWarehousebillsitems);
|
|
|
+ if(warehousebillsitemsList1!=null && !warehousebillsitemsList1.isEmpty()){
|
|
|
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
+ return AjaxResult.error("商品第" + i + "行 仓库有货物不可删除");
|
|
|
+ }
|
|
|
+ tGoodsMapper.deleteTGoodsById(id);
|
|
|
+ i++;
|
|
|
+ }
|
|
|
+ return AjaxResult.success();
|
|
|
}
|
|
|
|
|
|
/**
|