| | |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.core.common.Cools; |
| | | import com.zy.asrs.entity.StoreType; |
| | | import com.zy.asrs.entity.Tag; |
| | | import com.zy.asrs.entity.param.MatSyncParam; |
| | | import com.zy.asrs.service.OpenService; |
| | | import com.zy.asrs.service.StoreTypeService; |
| | | import com.zy.asrs.service.TagService; |
| | | import com.zy.asrs.task.AbstractHandler; |
| | | import com.zy.asrs.task.core.ReturnT; |
| | | import com.zy.nc.entity.NccBdCustomerWms; |
| | | import com.zy.nc.entity.NccSaleDbckmxb; |
| | | import com.zy.nc.service.NccBdCustomerWmsService; |
| | | import com.zy.nc.service.NccCgCgdhdWmsService; |
| | | import com.zy.common.utils.NodeUtils; |
| | | import com.zy.nc.entity.*; |
| | | import com.zy.nc.service.*; |
| | | import com.zy.system.entity.User; |
| | | import com.zy.system.service.UserService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | @Slf4j |
| | |
| | | @Autowired |
| | | private NccCgCgdhdWmsService nccCgCgdhdWmsService; |
| | | |
| | | @Autowired |
| | | private NccCkPddWmsService nccCkPddWmsService; |
| | | |
| | | |
| | | @Autowired |
| | | private NccJcBmWmsService nccJcBmWmsService; |
| | | |
| | | @Autowired |
| | | private NccJcCkhwService nccJcCkhwService; |
| | | |
| | | @Autowired |
| | | private NccJcCkWmsService nccJcCkWmsService; |
| | | |
| | | @Autowired |
| | | private NccJcQilibcBarcodeflowWmsService nccJcQilibcBarcodeflowWmsService; |
| | | |
| | | @Autowired |
| | | private NccJcRyWmsService nccJcRyWmsService; |
| | | |
| | | @Autowired |
| | | private NccJcWlflWmsService nccJcWlflWmsService; |
| | | |
| | | @Autowired |
| | | private NccOrgCorpWmsService nccOrgCorpWmsService; |
| | | |
| | | |
| | | @Autowired |
| | | private VGetBdMaterialService vGetBdMaterialService; |
| | | |
| | | @Autowired |
| | | private OpenService openService; |
| | | |
| | | @Autowired |
| | | private TagService tagService; |
| | | |
| | | @Autowired |
| | | private UserService userService; |
| | | |
| | | @Autowired |
| | | private StoreTypeService storeTypeService; |
| | | |
| | | @Value("${NYNC.pageSize}") |
| | | private Integer pageSize; |
| | | |
| | | /** |
| | | * |
| | | * |
| | | * @return |
| | | */ |
| | | public ReturnT<String> start1() { |
| | | nccBdCustomerWmsService.selectList(new EntityWrapper<NccBdCustomerWms>().ne("wms_flag",1)) |
| | | log.info("shuju:{}", JSONObject.toJSON(nccSaleXsckmx)); |
| | | Page<NccBdCustomerWms> page = new Page<>(1, pageSize); |
| | | Page<NccBdCustomerWms> wmsFlag = nccBdCustomerWmsService.selectPage(page, new EntityWrapper<NccBdCustomerWms>().ne("wms_flag", 1)); |
| | | for (NccBdCustomerWms nccBdCustomerWms : wmsFlag.getRecords()) { |
| | | //TODO |
| | | log.info("NccBdCustomerWms数据:{}", JSONObject.toJSON(nccBdCustomerWms)); |
| | | } |
| | | return SUCCESS; |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * |
| | | * @return |
| | | */ |
| | | public ReturnT<String> start2() { |
| | | NccSaleDbckmxb nccSaleDbckmxb = NccCgCgdhdWmsService.selectById("1001A1100000000H9KKJ"); |
| | | log.info("shuju:{}", JSONObject.toJSON(nccSaleDbckmxb)); |
| | | Page<NccCgCgdhdWms> page = new Page<>(1, pageSize); |
| | | Page<NccCgCgdhdWms> wmsFlag = nccCgCgdhdWmsService.selectPage(page, new EntityWrapper<NccCgCgdhdWms>().ne("wms_flag", 1)); |
| | | for (NccCgCgdhdWms nccCgCgdhdWms : wmsFlag.getRecords()) { |
| | | log.info("NccCgCgdhdWms数据:{}", JSONObject.toJSON(nccCgCgdhdWms)); |
| | | } |
| | | return SUCCESS; |
| | | } |
| | | |
| | | public ReturnT<String> start3() { |
| | | Page<NccCkPddWms> page = new Page<>(1, pageSize); |
| | | Page<NccCkPddWms> wmsFlag = nccCkPddWmsService.selectPage(page, new EntityWrapper<NccCkPddWms>().ne("wms_flag", 1)); |
| | | for (NccCkPddWms nccCkPddWms : wmsFlag.getRecords()) { |
| | | log.info("NccCkPddWms数据:{}", JSONObject.toJSON(nccCkPddWms)); |
| | | } |
| | | return SUCCESS; |
| | | } |
| | | |
| | | public ReturnT<String> start4() { |
| | | Page<NccJcBmWms> page = new Page<>(1, pageSize); |
| | | Page<NccJcBmWms> wmsFlag = nccJcBmWmsService.selectPage(page, new EntityWrapper<NccJcBmWms>().ne("wms_flag", 1)); |
| | | for (NccJcBmWms nccCkPddWms : wmsFlag.getRecords()) { |
| | | log.info("NccJcBmWms数据:{}", JSONObject.toJSON(nccCkPddWms)); |
| | | } |
| | | return SUCCESS; |
| | | } |
| | | |
| | | |
| | | public ReturnT<String> start5() { |
| | | Page<NccJcCkhw> page = new Page<>(1, pageSize); |
| | | Page<NccJcCkhw> wmsFlag = nccJcCkhwService.selectPage(page, new EntityWrapper<NccJcCkhw>().ne("wms_flag", 1)); |
| | | for (NccJcCkhw nccJcCkhw : wmsFlag.getRecords()) { |
| | | log.info("NccJcCkhw数据:{}", JSONObject.toJSON(nccJcCkhw)); |
| | | } |
| | | return SUCCESS; |
| | | } |
| | | |
| | | public ReturnT<String> start6() { |
| | | Page<NccJcCkWms> page = new Page<>(1, pageSize); |
| | | Page<NccJcCkWms> wmsFlag = nccJcCkWmsService.selectPage(page, new EntityWrapper<NccJcCkWms>().ne("wms_flag", 1)); |
| | | for (NccJcCkWms nccJcCkWms : wmsFlag.getRecords()) { |
| | | log.info("NccJcCkWms数据:{}", JSONObject.toJSON(nccJcCkWms)); |
| | | StoreType storeType = storeTypeService.selectById(nccJcCkWms.getCode()); |
| | | if (storeType == null) { |
| | | storeType = new StoreType(); |
| | | storeType.setStoreName(nccJcCkWms.getName()); |
| | | storeType.setStatus(1); |
| | | storeType.setStoreId(nccJcCkWms.getCode()); |
| | | storeType.setCreateBy(1L); |
| | | storeType.setCreateTime(new Date()); |
| | | storeTypeService.insert(storeType); |
| | | } else { |
| | | storeType.setStoreName(nccJcCkWms.getName()); |
| | | storeTypeService.updateById(storeType); |
| | | } |
| | | nccJcCkWms.setWmsFlag(1); |
| | | nccJcCkWmsService.updateById(nccJcCkWms); |
| | | } |
| | | return SUCCESS; |
| | | } |
| | | |
| | | public ReturnT<String> start7() { |
| | | Page<NccJcQilibcBarcodeflowWms> page = new Page<>(1, pageSize); |
| | | Page<NccJcQilibcBarcodeflowWms> wmsFlag = nccJcQilibcBarcodeflowWmsService.selectPage(page, new EntityWrapper<NccJcQilibcBarcodeflowWms>().ne("wms_flag", 1)); |
| | | for (NccJcQilibcBarcodeflowWms nccJcQilibcBarcodeflowWms : wmsFlag.getRecords()) { |
| | | log.info("NccJcQilibcBarcodeflowWms数据:{}", JSONObject.toJSON(nccJcQilibcBarcodeflowWms)); |
| | | } |
| | | return SUCCESS; |
| | | } |
| | | |
| | | public ReturnT<String> start8() { |
| | | Page<NccJcRyWms> page = new Page<>(1, pageSize); |
| | | Page<NccJcRyWms> wmsFlag = nccJcRyWmsService.selectPage(page, new EntityWrapper<NccJcRyWms>().ne("wms_flag", 1).eq("sszzmc", "浙江福莱新材料股份有限公司烟台分公司")); |
| | | for (NccJcRyWms nccJcRyWms : wmsFlag.getRecords()) { |
| | | User user = userService.selectOne(new EntityWrapper<User>().eq("username", nccJcRyWms.getRybm())); |
| | | if (user == null) { |
| | | user = new User(); |
| | | user.setUsername(nccJcRyWms.getRybm()); |
| | | user.setNickname(nccJcRyWms.getRymc()); |
| | | user.setRoleId(12L); |
| | | user.setStatus(1); |
| | | user.setCreateTime(new Date()); |
| | | userService.insert(user); |
| | | } else { |
| | | user.setUsername(nccJcRyWms.getRybm()); |
| | | user.setNickname(nccJcRyWms.getRymc()); |
| | | user.setRoleId(12L); |
| | | user.setStatus(1); |
| | | userService.updateById(user); |
| | | } |
| | | nccJcRyWms.setWmsFlag(1); |
| | | nccJcRyWmsService.updateById(nccJcRyWms); |
| | | log.info("NccJcRyWms数据:{}", JSONObject.toJSON(nccJcRyWms)); |
| | | } |
| | | |
| | | return SUCCESS; |
| | | } |
| | | |
| | | public ReturnT<String> start9() { |
| | | Page<NccJcWlflWms> page = new Page<>(1, pageSize); |
| | | Page<NccJcWlflWms> wmsFlag = nccJcWlflWmsService.selectPage(page, new EntityWrapper<NccJcWlflWms>().ne("wms_flag", 1)); |
| | | Tag top = tagService.getTop(); |
| | | for (NccJcWlflWms nccJcWlflWms : wmsFlag.getRecords()) { |
| | | if (!Cools.isEmpty(nccJcWlflWms.getSjflbm())) { |
| | | Tag priTag = tagService.selectOne(new EntityWrapper<Tag>().eq("uuid", nccJcWlflWms.getSjflbm())); |
| | | if (priTag == null) { |
| | | continue; |
| | | } else { |
| | | Tag tag = new Tag(); |
| | | tag.setUuid(nccJcWlflWms.getCode()); |
| | | tag.setName(nccJcWlflWms.getName()); |
| | | tag.setParentId(priTag.getId()); |
| | | tag.setParentName(priTag.getName()); |
| | | tag.setType(0); |
| | | tag.setLevel(priTag.getLevel() + 1); |
| | | tag.setStatus(1); |
| | | tag.setCreateTime(new Date()); |
| | | tag.setPath(priTag.getPath()); |
| | | NodeUtils nodeUtils = new NodeUtils(); |
| | | nodeUtils.executePath(priTag.getId()); |
| | | tag.setPath(nodeUtils.path.toString()); |
| | | tag.setPathName(nodeUtils.pathName.toString()); |
| | | tagService.insert(tag); |
| | | nccJcWlflWms.setWmsFlag(1); |
| | | nccJcWlflWmsService.updateById(nccJcWlflWms); |
| | | } |
| | | } else { |
| | | Tag tag = new Tag(); |
| | | tag.setUuid(nccJcWlflWms.getCode()); |
| | | tag.setName(nccJcWlflWms.getName()); |
| | | tag.setStatus(1); |
| | | tag.setCreateTime(new Date()); |
| | | tag.setType(0); |
| | | tag.setLevel(2); |
| | | tag.setParentId(top.getId()); |
| | | tag.setParentName(top.getName()); |
| | | tag.setPath(top.getPath()); |
| | | NodeUtils nodeUtils = new NodeUtils(); |
| | | nodeUtils.executePath(top.getId()); |
| | | tag.setPath(nodeUtils.path.toString()); |
| | | tag.setPathName(nodeUtils.pathName.toString()); |
| | | tagService.insert(tag); |
| | | nccJcWlflWms.setWmsFlag(1); |
| | | nccJcWlflWmsService.updateById(nccJcWlflWms); |
| | | } |
| | | log.info("NccJcWlflWms数据:{}", JSONObject.toJSON(nccJcWlflWms)); |
| | | } |
| | | return SUCCESS; |
| | | } |
| | | |
| | | public ReturnT<String> start10() { |
| | | Page<NccOrgCorpWms> page = new Page<>(1, pageSize); |
| | | Page<NccOrgCorpWms> wmsFlag = nccOrgCorpWmsService.selectPage(page, new EntityWrapper<NccOrgCorpWms>().ne("wms_flag", 1)); |
| | | for (NccOrgCorpWms nccOrgCorpWms : wmsFlag.getRecords()) { |
| | | |
| | | log.info("NccOrgCorpWms数据:{}", JSONObject.toJSON(nccOrgCorpWms)); |
| | | } |
| | | return SUCCESS; |
| | | } |
| | | |
| | | |
| | | public ReturnT<String> start13() { |
| | | Page<VGetBdMaterial> page = new Page<>(1, pageSize); |
| | | Page<VGetBdMaterial> wmsFlag = vGetBdMaterialService.selectPage(page, new EntityWrapper<VGetBdMaterial>().ne("wms_flag", 1)); |
| | | MatSyncParam param = new MatSyncParam(); |
| | | List<MatSyncParam.MatParam> matDetails = new ArrayList<>(); |
| | | MatSyncParam.MatParam matParam; |
| | | for (VGetBdMaterial vGetBdMaterial : wmsFlag.getRecords()) { |
| | | Tag priTag = tagService.selectOne(new EntityWrapper<Tag>().eq("uuid", vGetBdMaterial.get存货分类编码())); |
| | | if (priTag == null) { |
| | | continue; |
| | | } |
| | | matParam = new MatSyncParam.MatParam(); |
| | | matParam.setMatnr(vGetBdMaterial.get物料编码()); |
| | | matParam.setMaktx(vGetBdMaterial.get物料名称()); |
| | | matParam.setSpecs(vGetBdMaterial.get规格()); |
| | | matParam.setModel(vGetBdMaterial.get型号()); |
| | | matParam.setUnit(vGetBdMaterial.get主单位()); |
| | | matParam.setMemo(vGetBdMaterial.get备注()); |
| | | matParam.setGroupCode(vGetBdMaterial.get存货分类编码()); |
| | | matParam.setGroupName(vGetBdMaterial.get存货分类名称()); |
| | | matDetails.add(matParam); |
| | | } |
| | | if (!matDetails.isEmpty()) { |
| | | param.setMatDetails(matDetails); |
| | | openService.syncMat(param); |
| | | for (VGetBdMaterial vGetBdMaterial : wmsFlag.getRecords()) { |
| | | vGetBdMaterial.setWmsFlag(1); |
| | | } |
| | | vGetBdMaterialService.updateBatchById(wmsFlag.getRecords()); |
| | | } |
| | | return SUCCESS; |
| | | } |
| | | |
| | | } |