耗材领用管理代码提交
							parent
							
								
									44afbdd651
								
							
						
					
					
						commit
						913dca5ebc
					
				| @ -0,0 +1,12 @@ | |||||||
|  | package com.glxp.api.req.basic; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | import com.glxp.api.res.basic.BasicErpUnitsResponse; | ||||||
|  | import lombok.Data; | ||||||
|  | 
 | ||||||
|  | @Data | ||||||
|  | public class CombineSingleUnitRequest { | ||||||
|  |     private String key; | ||||||
|  |     private String thirdSys; | ||||||
|  |     private BasicErpUnitsResponse basicErpUnitsResponse; | ||||||
|  | } | ||||||
| @ -0,0 +1,10 @@ | |||||||
|  | package com.glxp.api.req.basic; | ||||||
|  | 
 | ||||||
|  | import lombok.Data; | ||||||
|  | 
 | ||||||
|  | @Data | ||||||
|  | public class RemoveRelRequest { | ||||||
|  | 
 | ||||||
|  |     private String relId; | ||||||
|  |     private String thirdSys; | ||||||
|  | } | ||||||
| @ -0,0 +1,41 @@ | |||||||
|  | package com.glxp.api.req.inout; | ||||||
|  | 
 | ||||||
|  | import com.glxp.api.entity.inout.PurReceiveEntity; | ||||||
|  | import lombok.Data; | ||||||
|  | 
 | ||||||
|  | import java.util.List; | ||||||
|  | 
 | ||||||
|  | @Data | ||||||
|  | public class UpdateReceiveDetailRequest { | ||||||
|  | 
 | ||||||
|  |       private Integer id; | ||||||
|  | 
 | ||||||
|  |       /** | ||||||
|  |        * 订单外键 | ||||||
|  |        */ | ||||||
|  |       private String orderIdFk; | ||||||
|  | 
 | ||||||
|  |       /** | ||||||
|  |        * 产品ID | ||||||
|  |        */ | ||||||
|  |       private Integer relIdFk; | ||||||
|  | 
 | ||||||
|  |       private String nameCode; | ||||||
|  | 
 | ||||||
|  |       /** | ||||||
|  |        * 数量 | ||||||
|  |        */ | ||||||
|  |       private Integer count; | ||||||
|  | 
 | ||||||
|  |       /** | ||||||
|  |        * 供应商ID | ||||||
|  |        */ | ||||||
|  |       private String supId; | ||||||
|  | 
 | ||||||
|  |       private String productDate; | ||||||
|  | 
 | ||||||
|  |       private String batchNo; | ||||||
|  | 
 | ||||||
|  |       private String expireDate; | ||||||
|  | 
 | ||||||
|  | } | ||||||
| @ -0,0 +1,118 @@ | |||||||
|  | package com.glxp.api.service.thrsys; | ||||||
|  | 
 | ||||||
|  | import cn.hutool.extra.pinyin.PinyinUtil; | ||||||
|  | import com.glxp.api.common.res.BaseResponse; | ||||||
|  | import com.glxp.api.constant.ConstantStatus; | ||||||
|  | import com.glxp.api.entity.thrsys.ThrCorpEntity; | ||||||
|  | import com.glxp.api.entity.thrsys.ThrSystemDetailEntity; | ||||||
|  | import com.glxp.api.http.ErpBasicClient; | ||||||
|  | import com.glxp.api.req.basic.BasicUnitMaintainFilterRequest; | ||||||
|  | import com.glxp.api.req.thrsys.FilterThrCorpRequest; | ||||||
|  | import com.glxp.api.req.thrsys.ThrUnitMaintainFilterRequest; | ||||||
|  | import com.glxp.api.res.PageSimpleResponse; | ||||||
|  | import com.glxp.api.res.basic.BasicErpUnitsResponse; | ||||||
|  | import com.glxp.api.res.thrsys.ThrCorpsResponse; | ||||||
|  | import com.glxp.api.res.thrsys.ThrUnitMaintainResponse; | ||||||
|  | import com.glxp.api.service.basic.BasicCorpService; | ||||||
|  | import com.glxp.api.util.CustomUtil; | ||||||
|  | import org.springframework.beans.BeanUtils; | ||||||
|  | import org.springframework.scheduling.annotation.Async; | ||||||
|  | import org.springframework.stereotype.Service; | ||||||
|  | 
 | ||||||
|  | import javax.annotation.Resource; | ||||||
|  | import java.util.ArrayList; | ||||||
|  | import java.util.Date; | ||||||
|  | import java.util.List; | ||||||
|  | import java.util.Locale; | ||||||
|  | import java.util.stream.Collectors; | ||||||
|  | 
 | ||||||
|  | @Service | ||||||
|  | public class ThrUnitImportService { | ||||||
|  | 
 | ||||||
|  |     @Resource | ||||||
|  |     private BasicCorpService basicCorpService; | ||||||
|  |     @Resource | ||||||
|  |     private ThrCorpService thrCorpService; | ||||||
|  |     @Resource | ||||||
|  |     private ErpBasicClient erpBasicClient; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     @Async | ||||||
|  |     public void selectAllUnit(ThrSystemDetailEntity thrSystemDetailEntity, ThrUnitMaintainFilterRequest unitMaintainFilterRequest) { | ||||||
|  |         List<ThrCorpsResponse> imports = new ArrayList<>(); | ||||||
|  |         if (thrSystemDetailEntity.getFromType() == 0) { | ||||||
|  |             int page = 1; | ||||||
|  | 
 | ||||||
|  |             List<ThrCorpsResponse> erpUnitsResponses = new ArrayList<>(); | ||||||
|  |             while (true) { | ||||||
|  |                 unitMaintainFilterRequest.setPage(page); | ||||||
|  |                 unitMaintainFilterRequest.setLimit(100); | ||||||
|  |                 BaseResponse<PageSimpleResponse<ThrCorpsResponse>> baseResponse = | ||||||
|  |                         erpBasicClient.getErpCrop(unitMaintainFilterRequest); | ||||||
|  |                 List<ThrCorpsResponse> temps = baseResponse.getData().getList(); | ||||||
|  |                 if (temps.size() < 100) { | ||||||
|  |                     erpUnitsResponses.addAll(temps); | ||||||
|  |                     break; | ||||||
|  |                 } else { | ||||||
|  |                     page++; | ||||||
|  |                     erpUnitsResponses.addAll(temps); | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|  |             imports.addAll(erpUnitsResponses); | ||||||
|  | 
 | ||||||
|  |         } else { | ||||||
|  |             FilterThrCorpRequest filterThrCorpRequest = new FilterThrCorpRequest(); | ||||||
|  |             BeanUtils.copyProperties(unitMaintainFilterRequest, filterThrCorpRequest); | ||||||
|  |             filterThrCorpRequest.setThirdSysFk(unitMaintainFilterRequest.getThirdSys()); | ||||||
|  |             filterThrCorpRequest.setPage(null); | ||||||
|  |             List<ThrCorpsResponse> thrCorpEntities = thrCorpService.filterThrCorps(filterThrCorpRequest); | ||||||
|  | //            List<ThrCorpsResponse> lists = thrCorpEntities.stream().map(
 | ||||||
|  | //                    item -> {
 | ||||||
|  | //                        ThrCorpsResponse thrProductsEntity = new ThrCorpsResponse();
 | ||||||
|  | //                        BeanUtils.copyProperties(item, thrProductsEntity);
 | ||||||
|  | //                        thrProductsEntity.setId(item.getUnitId());
 | ||||||
|  | //                        return thrProductsEntity;
 | ||||||
|  | //                    }
 | ||||||
|  | //            ).collect(Collectors.toList());
 | ||||||
|  |             imports.addAll(thrCorpEntities); | ||||||
|  |         } | ||||||
|  |         if (imports != null && imports.size() > 0) { | ||||||
|  |             for (ThrCorpsResponse erpUnitsResponse : imports) { | ||||||
|  |                 ThrUnitMaintainResponse thrUnitMaintainResponse = new ThrUnitMaintainResponse(); | ||||||
|  |                 if (unitMaintainFilterRequest.getThirdSys() != null) { | ||||||
|  |                     if ("thirdId".equals(unitMaintainFilterRequest.getThirdSys())) { | ||||||
|  |                         thrUnitMaintainResponse.setThirdId(erpUnitsResponse.getId()); | ||||||
|  |                         thrUnitMaintainResponse.setThirdName(erpUnitsResponse.getName()); | ||||||
|  |                     } else if ("thirdId1".equals(unitMaintainFilterRequest.getThirdSys())) { | ||||||
|  |                         thrUnitMaintainResponse.setThirdId1(erpUnitsResponse.getId()); | ||||||
|  |                         thrUnitMaintainResponse.setThirdName1(erpUnitsResponse.getName()); | ||||||
|  |                     } else if ("thirdId2".equals(unitMaintainFilterRequest.getThirdSys())) { | ||||||
|  |                         thrUnitMaintainResponse.setThirdId2(erpUnitsResponse.getId()); | ||||||
|  |                         thrUnitMaintainResponse.setThirdName2(erpUnitsResponse.getName()); | ||||||
|  |                     } else if ("thirdId3".equals(unitMaintainFilterRequest.getThirdSys())) { | ||||||
|  |                         thrUnitMaintainResponse.setThirdId3(erpUnitsResponse.getId()); | ||||||
|  |                         thrUnitMaintainResponse.setThirdName3(erpUnitsResponse.getName()); | ||||||
|  |                     } else if ("thirdId4".equals(unitMaintainFilterRequest.getThirdSys())) { | ||||||
|  |                         thrUnitMaintainResponse.setThirdId4(erpUnitsResponse.getId()); | ||||||
|  |                         thrUnitMaintainResponse.setThirdName4(erpUnitsResponse.getName()); | ||||||
|  |                     } | ||||||
|  |                 } | ||||||
|  |                 thrUnitMaintainResponse.setErpId(CustomUtil.getId()); | ||||||
|  |                 thrUnitMaintainResponse.setName(erpUnitsResponse.getName()); | ||||||
|  |                 if (erpUnitsResponse.getSpell() == null || "".equals(erpUnitsResponse.getSpell())) { | ||||||
|  |                     thrUnitMaintainResponse.setSpell(PinyinUtil.getFirstLetter(erpUnitsResponse.getName(), "").toUpperCase(Locale.ROOT)); | ||||||
|  |                 } else { | ||||||
|  |                     thrUnitMaintainResponse.setSpell(erpUnitsResponse.getSpell()); | ||||||
|  |                 } | ||||||
|  |                 thrUnitMaintainResponse.setAddr(erpUnitsResponse.getAddr()); | ||||||
|  |                 thrUnitMaintainResponse.setCreditNo(erpUnitsResponse.getCreditNo()); | ||||||
|  |                 thrUnitMaintainResponse.setCorpType(ConstantStatus.CORP_SP); | ||||||
|  |                 thrUnitMaintainResponse.setContact(erpUnitsResponse.getContact()); | ||||||
|  |                 thrUnitMaintainResponse.setMobile(erpUnitsResponse.getMobile()); | ||||||
|  |                 thrUnitMaintainResponse.setUpdateTime(new Date()); | ||||||
|  |                 basicCorpService.insertThrUnitMaintainignore(thrUnitMaintainResponse); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | } | ||||||
					Loading…
					
					
				
		Reference in New Issue