| | |
| | | import com.fzzy.async.fzzy40.entity.Fz40DepotStore; |
| | | import com.fzzy.async.fzzy40.repository.Fzzy40Sync1208Rep; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang.StringUtils; |
| | | import org.apache.commons.lang.time.DateUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | |
| | | apiData.setShnd(fz40DepotStore.getFoodYear()); |
| | | |
| | | //产地代码 |
| | | String cd = commonService.getFoodLocationIdFromCache(fz40DepotStore.getFoodLocation()); |
| | | apiData.setCd(cd); |
| | | mappingCode = commonService.getFoodLocationIdFromCache(fz40DepotStore.getFoodLocation()); |
| | | if (StringUtils.isEmpty(mappingCode)) { |
| | | mappingCode = apiData.getHwdm().substring(2, 8); |
| | | } |
| | | apiData.setCd(mappingCode); |
| | | |
| | | apiData.setBgy(api1105.getBgy()); |
| | | apiData.setBgy(StringUtils.isEmpty(api1105.getBgy()) ? "保管员" : api1105.getBgy()); |
| | | apiData.setLqgsdwdm(fz40DepotStore.getLqgsdwdm()); |
| | | apiData.setLqxzqhdm(api1102.getXzqhdm()); |
| | | if (apiData.getLsxzdm().equals("121")) { |
| | | //省级储备粮-粮权行政区划代码为省级 |
| | | apiData.setLqxzqhdm(api1102.getXzqhdm().substring(0, 2) + "0000"); |
| | | } |
| | | if (apiData.getLsxzdm().equals("122")) { |
| | | //市级储备粮-粮权行政区划代码为市级 |
| | | apiData.setLqxzqhdm(api1102.getXzqhdm().substring(0, 4) + "00"); |
| | | } |
| | | |
| | | //粮权归属单位 |
| | | apiData.setLqgsdwdm(api1102.getDwdm()); |
| | | //粮权行政区划代码 |
| | | apiData.setLqxzqhdm(api1102.getDwdm().substring(2, 8)); |
| | | if (null == apiData.getLqgsdwdm()) { |
| | | api1208List = api1208Rep.findDataByHwdm(api1105.getHwdm()); |
| | | if (null != api1208List && api1208List.size() > 0) { |
| | | apiData.setLqgsdwdm(api1208List.get(0).getLqgsdwdm()); |
| | | apiData.setLqxzqhdm(api1208List.get(0).getLqxzqhdm()); |
| | | apiData.setLqgstydwbm(api1208List.get(0).getLqgstydwbm()); |
| | | }else { |
| | | apiData.setLqgsdwdm(api1102.getDwdm()); |
| | | apiData.setLqxzqhdm(api1102.getXzqhdm()); |
| | | } |
| | | } |
| | | |
| | | |
| | | //若为商品粮,则粮权性质区划代码为null |
| | | if ("200".equals(apiData.getLsxzdm())) { |
| | | apiData.setLqxzqhdm(null); |
| | | } |
| | | |
| | | //管理方式-默认直储 |
| | | apiData.setGlfs("01"); |
| | | if (StringUtils.isEmpty(fz40DepotStore.getManageType())) { |
| | | apiData.setGlfs("01"); |
| | | } else { |
| | | apiData.setGlfs(fz40DepotStore.getManageType()); |
| | | } |
| | | |
| | | //收储地点-默认库内 |
| | | apiData.setScdd("1"); |
| | | //储粮方式 |
| | | apiData.setClfs(fz40DepotStore.getStoreType()); |
| | | //包装储粮是,核查包存粮包数 |
| | | if ("2".equals(apiData.getClfs())) { |
| | | apiData.setBclbs((int) (fz40DepotStore.getStorageReal() / 25)); |
| | | } |
| | | |
| | | //货位状态 |
| | | mappingCode = apiTriggerService.getMappingCode(Constant.TRIGGER_P_HWZT, fz40DepotStore.getDepotStatus()); |
| | | apiData.setHwzt(mappingCode); |
| | | if(null == fz40DepotStore.getStoreDate()){ |
| | | if (null == fz40DepotStore.getStoreDate()) { |
| | | fz40DepotStore.setStoreDate(new Date()); |
| | | } |
| | | //入仓时间 |
| | | apiData.setRcsj(fz40DepotStore.getStoreDate()); |
| | | //封仓日期 |
| | | if("3".equals(apiData.getHwzt())){ |
| | | apiData.setFcrq(DateUtils.addDays(fz40DepotStore.getStoreDate(), 10)); |
| | | if ("3".equals(apiData.getHwzt()) || "4".equals(apiData.getHwzt())) { |
| | | if (null == fz40DepotStore.getFullDate()) { |
| | | fz40DepotStore.setFullDate(DateUtils.addDays(fz40DepotStore.getStoreDate(), 30)); |
| | | } |
| | | apiData.setFcrq(fz40DepotStore.getFullDate()); |
| | | } |
| | | //出仓完成时间 |
| | | if("1".equals(apiData.getHwzt())){ |
| | | apiData.setCcwcsj(DateUtils.addDays(fz40DepotStore.getStoreDate(), 5)); |
| | | |
| | | if ("1".equals(apiData.getHwzt())) { |
| | | //出仓完成时间 |
| | | apiData.setCcwcsj(fz40DepotStore.getOutDate()); |
| | | //清仓时间 |
| | | apiData.setQcsj(DateUtils.addHours(apiData.getCcwcsj(), 60)); |
| | | } |
| | | //国别 |
| | | apiData.setGb("156"); |
| | |
| | | |
| | | //库存每次新增 |
| | | api1208List = api1208Rep.getDataById(apiData.getId()); |
| | | if(null == api1208List || api1208List.isEmpty()){ |
| | | if (null == api1208List || api1208List.isEmpty()) { |
| | | apiData.setCzbz(Constant.CZBZ_I); |
| | | }else { |
| | | } else { |
| | | apiData.setCzbz(api1208List.get(0).getCzbz()); |
| | | } |
| | | |