|  |  |  | @ -12,6 +12,7 @@ import com.glxp.api.constant.BusinessType; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.constant.ConstantStatus; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.controller.BaseController; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.entity.basic.*; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.entity.inv.InvProductEntity; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.entity.system.SystemParamConfigEntity; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.entity.thrsys.ThrProductsEntity; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.entity.thrsys.ThrSystemEntity; | 
			
		
	
	
		
			
				
					|  |  |  | @ -26,6 +27,9 @@ import com.glxp.api.res.basic.BasicProductThirdSysResponse; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.res.basic.UdiRelevanceResponse; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.service.auth.CustomerService; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.service.basic.*; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.service.inout.IoCodeService; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.service.inv.InvPreProductService; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.service.inv.InvProductService; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.service.system.SystemParamConfigService; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.service.thrsys.ThrDataService; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.service.thrsys.ThrSystemService; | 
			
		
	
	
		
			
				
					|  |  |  | @ -246,6 +250,11 @@ public class UdiRelevanceController extends BaseController { | 
			
		
	
		
			
				
					|  |  |  |  |         return ResultVOUtils.success("删除成功"); | 
			
		
	
		
			
				
					|  |  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     @Resource | 
			
		
	
		
			
				
					|  |  |  |  |     IoCodeService codeService; | 
			
		
	
		
			
				
					|  |  |  |  |     @Resource | 
			
		
	
		
			
				
					|  |  |  |  |     CompanyProductRelevanceService companyProductRelevanceService; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     @AuthRuleAnnotation("") | 
			
		
	
		
			
				
					|  |  |  |  |     @PostMapping("/udi/udirel/deleteById") | 
			
		
	
		
			
				
					|  |  |  |  |     @Log(title = "单据管理", businessType = BusinessType.DELETE) | 
			
		
	
	
		
			
				
					|  |  |  | @ -256,37 +265,15 @@ public class UdiRelevanceController extends BaseController { | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  |         String ids = deleteRequest.getId(); | 
			
		
	
		
			
				
					|  |  |  |  |         UdiRelevanceEntity udiRelevanceEntity = udiRelevanceService.selectById(Long.parseLong(ids)); | 
			
		
	
		
			
				
					|  |  |  |  |         //todo 单据未完成
 | 
			
		
	
		
			
				
					|  |  |  |  | //        if (udiRelevanceEntity != null && udiRelevanceEntity.getUuid() != null) {
 | 
			
		
	
		
			
				
					|  |  |  |  | //            List<UdiRelevanceEntity> udiRelevanceEntities = udiRelevanceService.selectByUuid(udiRelevanceEntity.getUuid());
 | 
			
		
	
		
			
				
					|  |  |  |  | //            if (udiRelevanceEntities != null && !udiRelevanceEntities.isEmpty()) {
 | 
			
		
	
		
			
				
					|  |  |  |  | //                for (UdiRelevanceEntity udiRelevanceEntity1 : udiRelevanceEntities) {
 | 
			
		
	
		
			
				
					|  |  |  |  | //                    List<UdiInfoEntity> udiInfoEntities = udiInfoService.findByUuids(udiRelevanceEntity1.getUuid());
 | 
			
		
	
		
			
				
					|  |  |  |  | //                    if (udiInfoEntities != null && udiInfoEntities.size() > 0) {
 | 
			
		
	
		
			
				
					|  |  |  |  | //                        for (int i = 0; i < udiInfoEntities.size(); i++) {
 | 
			
		
	
		
			
				
					|  |  |  |  | //                            List<WarehouseEntity> warehouseEntityList = warehouseService.searchCode(udiInfoEntities.get(i).getNameCode());
 | 
			
		
	
		
			
				
					|  |  |  |  | //                            if (warehouseEntityList != null && warehouseEntityList.size() > 0) {
 | 
			
		
	
		
			
				
					|  |  |  |  | //                                return ResultVOUtils.error(500, "该产品已被" + warehouseEntityList.get(0).getOrderId() + "订单关联不能删除");
 | 
			
		
	
		
			
				
					|  |  |  |  | //                            }
 | 
			
		
	
		
			
				
					|  |  |  |  | //                        }
 | 
			
		
	
		
			
				
					|  |  |  |  | //                    }
 | 
			
		
	
		
			
				
					|  |  |  |  | //                }
 | 
			
		
	
		
			
				
					|  |  |  |  | //                WarehouseQueryRequest warehouseQueryRequest = new WarehouseQueryRequest();
 | 
			
		
	
		
			
				
					|  |  |  |  | //                warehouseQueryRequest.setRelId(ids);
 | 
			
		
	
		
			
				
					|  |  |  |  | //                if (StrUtil.isNotEmpty(ids)) {
 | 
			
		
	
		
			
				
					|  |  |  |  | //                    List<WarehouseEntity> warehouseEntityList = warehouseService.findByOrderId(warehouseQueryRequest);
 | 
			
		
	
		
			
				
					|  |  |  |  | //                    if (CollUtil.isNotEmpty(warehouseEntityList)) {
 | 
			
		
	
		
			
				
					|  |  |  |  | //                        return ResultVOUtils.error(500, "该产品已被" + warehouseEntityList.get(0).getOrderId() + "订单关联不能删除");
 | 
			
		
	
		
			
				
					|  |  |  |  | //                    }
 | 
			
		
	
		
			
				
					|  |  |  |  | //                }
 | 
			
		
	
		
			
				
					|  |  |  |  | //            }
 | 
			
		
	
		
			
				
					|  |  |  |  | //        }
 | 
			
		
	
		
			
				
					|  |  |  |  | //
 | 
			
		
	
		
			
				
					|  |  |  |  | //        CompanyProductRelevanceEntity companyProductRelevanceEntity = companyProductRelevanceService.findByUdiRlIdUnitFk(ids, null);
 | 
			
		
	
		
			
				
					|  |  |  |  | //        if (companyProductRelevanceEntity != null) {
 | 
			
		
	
		
			
				
					|  |  |  |  | //            return ResultVOUtils.error(500, "该产品已被已被供应商选入" + "不能删除!");
 | 
			
		
	
		
			
				
					|  |  |  |  | //        }
 | 
			
		
	
		
			
				
					|  |  |  |  | //
 | 
			
		
	
		
			
				
					|  |  |  |  |         if (udiRelevanceEntity != null && udiRelevanceEntity.getUuid() != null) { | 
			
		
	
		
			
				
					|  |  |  |  |             if (codeService.isExitByRelId(udiRelevanceEntity.getId() + "")) { | 
			
		
	
		
			
				
					|  |  |  |  |                 return ResultVOUtils.error(500, "该产品已关联单据,无法删除!"); | 
			
		
	
		
			
				
					|  |  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |  |             if (companyProductRelevanceService.isExitByRelId(udiRelevanceEntity.getId() + "")) { | 
			
		
	
		
			
				
					|  |  |  |  |                 return ResultVOUtils.error(500, "该产品已被已被供应商选入,无法删除!"); | 
			
		
	
		
			
				
					|  |  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         udiRelevanceService.deleteById(ids); | 
			
		
	
		
			
				
					|  |  |  |  |         List<UdiRelevanceEntity> udiRelevanceEntities = udiRelevanceService.selectByUuid(udiRelevanceEntity.getUuid()); | 
			
		
	
	
		
			
				
					|  |  |  | @ -294,9 +281,6 @@ public class UdiRelevanceController extends BaseController { | 
			
		
	
		
			
				
					|  |  |  |  |             udiProductService.deleteByUuid(udiRelevanceEntity.getUuid()); | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         //todo
 | 
			
		
	
		
			
				
					|  |  |  |  | //        companyProductRelevanceService.deleteByRlId(ids);//删除供应商关联表产品信息
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         return ResultVOUtils.success("删除成功"); | 
			
		
	
		
			
				
					|  |  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
	
		
			
				
					|  |  |  | @ -421,20 +405,24 @@ public class UdiRelevanceController extends BaseController { | 
			
		
	
		
			
				
					|  |  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     @Resource | 
			
		
	
		
			
				
					|  |  |  |  |     InvProductService invProductService; | 
			
		
	
		
			
				
					|  |  |  |  |     @Resource | 
			
		
	
		
			
				
					|  |  |  |  |     InvPreProductService invPreProductService; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     //查询产品是否可以被禁用   todo 库存还未完成
 | 
			
		
	
		
			
				
					|  |  |  |  |     @AuthRuleAnnotation("") | 
			
		
	
		
			
				
					|  |  |  |  |     @PostMapping("/udi/udirel/disable") | 
			
		
	
		
			
				
					|  |  |  |  |     public BaseResponse disable(@RequestBody UdiCombineRequest udiCombineRequest) { | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | //        InvProductEntity invProductEntity = invProductService.selectExit(combineRequest.getRelId());
 | 
			
		
	
		
			
				
					|  |  |  |  | //        if (invProductEntity != null) {
 | 
			
		
	
		
			
				
					|  |  |  |  | //            return ResultVOUtils.error(500, "库存已存在,无法禁用");
 | 
			
		
	
		
			
				
					|  |  |  |  | //        }
 | 
			
		
	
		
			
				
					|  |  |  |  | //
 | 
			
		
	
		
			
				
					|  |  |  |  | //        InvProductEntity invPreProductEntity = invPreProductService.selectExit(combineRequest.getRelId());
 | 
			
		
	
		
			
				
					|  |  |  |  | //        if (invPreProductEntity != null) {
 | 
			
		
	
		
			
				
					|  |  |  |  | //            return ResultVOUtils.error(500, "库存已存在,无法禁用");
 | 
			
		
	
		
			
				
					|  |  |  |  | //        }
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         if (invProductService.isExitByRelId(udiCombineRequest.getRelId() + "")) { | 
			
		
	
		
			
				
					|  |  |  |  |             return ResultVOUtils.error(500, "库存已存在,无法禁用"); | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         if (invPreProductService.isExitByRelId(udiCombineRequest.getRelId() + "")) { | 
			
		
	
		
			
				
					|  |  |  |  |             return ResultVOUtils.error(500, "寄售库存已存在,无法禁用"); | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  |         return ResultVOUtils.success("更新成功"); | 
			
		
	
		
			
				
					|  |  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
	
		
			
				
					|  |  |  | 
 |