diff --git a/lidee-core/src/main/java/com/lideeyunji/core/framework/config/job/ErpBasicDataInformationJob.java b/lidee-core/src/main/java/com/lideeyunji/core/framework/config/job/ErpBasicDataInformationJob.java new file mode 100644 index 0000000..ce62dac --- /dev/null +++ b/lidee-core/src/main/java/com/lideeyunji/core/framework/config/job/ErpBasicDataInformationJob.java @@ -0,0 +1,176 @@ +package com.lideeyunji.core.framework.config.job; + +import com.lideeyunji.core.framework.entity.*; +import com.lideeyunji.core.framework.mapper.erp.*; +import com.lideeyunji.tool.framework.quartz.core.handler.JobHandler; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.util.List; + +@Component("ErpBasicDataInformationJob") +@Slf4j +public class ErpBasicDataInformationJob implements JobHandler { + + @Resource + private ErpBfMeasureUnitMapper erpBfMeasureUnitMapper; + + @Resource + private ErpBfPartnerMapper erpBfPartnerMapper; + + @Resource + private ErpScmBaseSnMapper erpScmBaseSnMapper; + + @Resource + private ErpScmBatchMapper erpScmBatchMapper; + + @Resource + private ErpScmWarehouseMapper erpScmWarehouseMapper; + + @Override + public String execute(String param) throws Exception { + log.info("*********** 开始同步基础数据信息 ************"); + try { + syncMeasureUnitIncrement(); + } catch (Exception e) { + log.error("增量同步计量单位数据失败", e); + } + try { + syncPartnerIncrement(); + } catch (Exception e) { + log.error("增量同步往来单位数据失败", e); + } + try { + syncBaseSnIncrement(); + } catch (Exception e) { + log.error("增量同步批次号数据失败", e); + } + try { + syncBatchIncrement(); + } catch (Exception e) { + log.error("增量同步批次数据失败", e); + } + try { + syncWarehouseIncrement(); + } catch (Exception e) { + log.error("增量同步仓库数据失败", e); + } + log.info("========== 所有ERP数据增量同步完成 =========="); + return "========== 所有ERP数据增量同步完成 =========="; + } + + + + public int[] syncMeasureUnitIncrement() { + log.info("开始增量同步计量单位数据..."); + List dataList = erpBfMeasureUnitMapper.selectMeasureUnitFromErp(); + if (dataList == null || dataList.isEmpty()) { + log.info("计量单位数据为空,跳过同步"); + return new int[]{0, 0, 0}; + } + int insertCount = 0, updateCount = 0, skipCount = 0; + for (ErpBfMeasureUnit data : dataList) { + int result = erpBfMeasureUnitMapper.syncMeasureUnitByTimestamp(data); + if (result == 1) { + insertCount++; + } else if (result == 2) { + updateCount++; + } else { + skipCount++; + } + } + log.info("计量单位增量同步完成,新增{}条,更新{}条,跳过{}条", insertCount, updateCount, skipCount); + return new int[]{insertCount, updateCount, skipCount}; + } + + public int[] syncPartnerIncrement() { + log.info("开始增量同步往来单位数据..."); + List dataList = erpBfPartnerMapper.selectPartnerFromErp(); + if (dataList == null || dataList.isEmpty()) { + log.info("往来单位数据为空,跳过同步"); + return new int[]{0, 0, 0}; + } + int insertCount = 0, updateCount = 0, skipCount = 0; + for (ErpBfPartner data : dataList) { + int result = erpBfPartnerMapper.syncPartnerByTimestamp(data); + if (result == 1) { + insertCount++; + } else if (result == 2) { + updateCount++; + } else { + skipCount++; + } + } + log.info("往来单位增量同步完成,新增{}条,更新{}条,跳过{}条", insertCount, updateCount, skipCount); + return new int[]{insertCount, updateCount, skipCount}; + } + + public int[] syncBaseSnIncrement() { + log.info("开始增量同步批次号数据..."); + List dataList = erpScmBaseSnMapper.selectBaseSnFromErp(); + if (dataList == null || dataList.isEmpty()) { + log.info("批次号数据为空,跳过同步"); + return new int[]{0, 0, 0}; + } + int insertCount = 0, updateCount = 0, skipCount = 0; + for (ErpScmBaseSn data : dataList) { + int result = erpScmBaseSnMapper.syncBaseSnByTimestamp(data); + if (result == 1) { + insertCount++; + } else if (result == 2) { + updateCount++; + } else { + skipCount++; + } + } + log.info("批次号增量同步完成,新增{}条,更新{}条,跳过{}条", insertCount, updateCount, skipCount); + return new int[]{insertCount, updateCount, skipCount}; + } + + public int[] syncBatchIncrement() { + log.info("开始增量同步批次数据..."); + List dataList = erpScmBatchMapper.selectBatchFromErp(); + if (dataList == null || dataList.isEmpty()) { + log.info("批次数据为空,跳过同步"); + return new int[]{0, 0, 0}; + } + int insertCount = 0, updateCount = 0, skipCount = 0; + for (ErpScmBatch data : dataList) { + int result = erpScmBatchMapper.syncBatchByTimestamp(data); + if (result == 1) { + insertCount++; + } else if (result == 2) { + updateCount++; + } else { + skipCount++; + } + } + log.info("批次增量同步完成,新增{}条,更新{}条,跳过{}条", insertCount, updateCount, skipCount); + return new int[]{insertCount, updateCount, skipCount}; + } + + public int[] syncWarehouseIncrement() { + log.info("开始增量同步仓库数据..."); + List dataList = erpScmWarehouseMapper.selectWarehouseFromErp(); + if (dataList == null || dataList.isEmpty()) { + log.info("仓库数据为空,跳过同步"); + return new int[]{0, 0, 0}; + } + int insertCount = 0, updateCount = 0, skipCount = 0; + for (ErpScmWarehouse data : dataList) { + int result = erpScmWarehouseMapper.syncWarehouseByTimestamp(data); + if (result == 1) { + insertCount++; + } else if (result == 2) { + updateCount++; + } else { + skipCount++; + } + } + log.info("仓库增量同步完成,新增{}条,更新{}条,跳过{}条", insertCount, updateCount, skipCount); + return new int[]{insertCount, updateCount, skipCount}; + } + + +} diff --git a/lidee-core/src/main/java/com/lideeyunji/core/framework/entity/ErpBfMeasureUnit.java b/lidee-core/src/main/java/com/lideeyunji/core/framework/entity/ErpBfMeasureUnit.java new file mode 100644 index 0000000..a2bafda --- /dev/null +++ b/lidee-core/src/main/java/com/lideeyunji/core/framework/entity/ErpBfMeasureUnit.java @@ -0,0 +1,74 @@ +package com.lideeyunji.core.framework.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * 计量单位表对象 ERP_bfMeasureUnit + * + * @author 雷神 + * @date 2026-04-10 + */ +@TableName("ERP_BFMEASUREUNIT") +@Data +public class ErpBfMeasureUnit implements Serializable { + private static final long serialVersionUID = 1L; + + /** ID */ + @TableId(value = "ID", type = IdType.INPUT) + private String id; + + /** 编码 */ + @TableField(value = "Code") + private String code; + + /** 名称 */ + @TableField(value = "Name") + private String name; + + /** 精度 */ + @TableField(value = "Accuracy") + private Integer accuracy; + + /** 创建人 */ + @TableField(value = "TimeStamp_CreatedBy") + private String timeStampCreatedBy; + + /** 创建时间 */ + @TableField(value = "TimeStamp_CreatedOn") + private Date timeStampCreatedOn; + + /** 最后修改人 */ + @TableField(value = "TimeStamp_LastChangedBy") + private String timeStampLastChangedBy; + + /** 最后修改时间 */ + @TableField(value = "TimeStamp_LastChangedOn") + private Date timeStampLastChangedOn; + + /** 是否可用 */ + @TableField(value = "State_IsEnabled") + private String stateIsEnabled; + + /** 停用时间 */ + @TableField(value = "State_DisableTime") + private Date stateDisableTime; + + /** 异步删除状态 */ + @TableField(value = "State_AsyncDeleteStatus") + private String stateAsyncDeleteStatus; + + /** 单位类别 */ + @TableField(value = "UnitType") + private String unitType; + + /** 排序号 */ + @TableField(value = "SortOrder") + private Integer sortOrder; +} \ No newline at end of file diff --git a/lidee-core/src/main/java/com/lideeyunji/core/framework/entity/ErpBfPartner.java b/lidee-core/src/main/java/com/lideeyunji/core/framework/entity/ErpBfPartner.java new file mode 100644 index 0000000..28a0179 --- /dev/null +++ b/lidee-core/src/main/java/com/lideeyunji/core/framework/entity/ErpBfPartner.java @@ -0,0 +1,403 @@ +package com.lideeyunji.core.framework.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +/** + * 往来单位表对象 ERP_BFPartner + * + * @author 雷神 + * @date 2026-04-10 + */ +@TableName("ERP_BFPARTNER") +@Data +public class ErpBfPartner implements Serializable { + private static final long serialVersionUID = 1L; + + /** ID */ + @TableId(value = "ID", type = IdType.INPUT) + private String id; + + /** 编码 */ + @TableField(value = "Code") + private String code; + + /** 名称 */ + @TableField(value = "Name") + private String name; + + /** 备注(弃用) */ + @TableField(value = "Remark") + private String remark; + + /** 是否可用 */ + @TableField(value = "State_IsEnabled") + private String stateIsEnabled; + + /** 停用时间 */ + @TableField(value = "State_DisableTime") + private Date stateDisableTime; + + /** 异步删除状态 */ + @TableField(value = "State_AsyncDeleteStatus") + private String stateAsyncDeleteStatus; + + /** 附件 */ + @TableField(value = "Attachment") + private String attachment; + + /** 法人代表 */ + @TableField(value = "Representative") + private String representative; + + /** 行业 */ + @TableField(value = "Industry") + private String industry; + + /** 地区 */ + @TableField(value = "Area") + private String area; + + /** 社会信用代码 */ + @TableField(value = "OrganizationCode") + private String organizationCode; + + /** 所属国家或地区 */ + @TableField(value = "CountryOrRegion") + private String countryOrRegion; + + /** 行政区划 */ + @TableField(value = "OfRegion") + private String ofRegion; + + /** 类别 */ + @TableField(value = "Type") + private String type; + + /** 创建人 */ + @TableField(value = "TimeStamp_CreatedBy") + private String timeStampCreatedBy; + + /** 创建时间 */ + @TableField(value = "TimeStamp_CreatedOn") + private Date timeStampCreatedOn; + + /** 最后修改人 */ + @TableField(value = "TimeStamp_LastChangedBy") + private String timeStampLastChangedBy; + + /** 最后修改时间 */ + @TableField(value = "TimeStamp_LastChangedOn") + private Date timeStampLastChangedOn; + + /** 默认交易币种 */ + @TableField(value = "DefaultCurrencyID") + private String defaultCurrencyId; + + /** 审批状态 */ + @TableField(value = "BillStatus") + private String billStatus; + + /** 审批流程ID */ + @TableField(value = "InstanceID") + private String instanceId; + + /** 上级往来单位 */ + @TableField(value = "SuperiorPartner") + private String superiorPartner; + + /** 注册资金 */ + @TableField(value = "RegisteredCapital") + private String registeredCapital; + + /** 主页 */ + @TableField(value = "CompanyWebsite") + private String companyWebsite; + + /** 电子邮箱 */ + @TableField(value = "Email") + private String email; + + /** 默认地址 */ + @TableField(value = "DefaultAddress") + private String defaultAddress; + + /** 默认联系人 */ + @TableField(value = "DefaultContact") + private String defaultContact; + + /** 公私性质 */ + @TableField(value = "CompanyOrPerson") + private String companyOrPerson; + + /** 是否客户 */ + @TableField(value = "IsCustomer") + private String isCustomer; + + /** 是否供应商 */ + @TableField(value = "IsVender") + private String isVender; + + /** 是否其他 */ + @TableField(value = "IsOther") + private String isOther; + + /** 是否内部单位 */ + @TableField(value = "InteriorCompany") + private String interiorCompany; + + /** 是否分配 */ + @TableField(value = "Distribution") + private String distribution; + + /** 内部单位核算组织 */ + @TableField(value = "InteriorAccountingOrg") + private String interiorAccountingOrg; + + /** 内部单位行政组织 */ + @TableField(value = "InteriorAdminOrg") + private String interiorAdminOrg; + + /** 纳税人名称 */ + @TableField(value = "Taxpayer") + private String taxpayer; + + /** 默认单位名称 */ + @TableField(value = "DefaultCompany") + private String defaultCompany; + + /** 纳税人识别号 */ + @TableField(value = "TaxIDNumber") + private String taxIdNumber; + + /** 注册地址(弃用) */ + @TableField(value = "RegisteredAddress") + private String registeredAddress; + + /** 联系电话 */ + @TableField(value = "ContactInfo") + private String contactInfo; + + /** 开户银行 */ + @TableField(value = "Bank") + private String bank; + + /** 银行账号 */ + @TableField(value = "Account") + private String account; + + /** 纳税人类型 */ + @TableField(value = "TypeOfTaxpayer") + private String typeOfTaxpayer; + + /** 邮箱地址 */ + @TableField(value = "TaxpayerEmail") + private String taxpayerEmail; + + /** 收票手机号 */ + @TableField(value = "TelForInvoice") + private String telForInvoice; + + /** 供应商类别 */ + @TableField(value = "TypeOfSuppier") + private String typeOfSuppier; + + /** 供应商地区 */ + @TableField(value = "RegionOfSuppier") + private String regionOfSuppier; + + /** 客户类别 */ + @TableField(value = "TypeOfClient") + private String typeOfClient; + + /** 客户地区 */ + @TableField(value = "RegionOfClient") + private String regionOfClient; + + /** 信用额度 */ + @TableField(value = "LineOfCredit") + private Integer lineOfCredit; + + /** 到账(日) */ + @TableField(value = "AccountPeriod") + private Integer accountPeriod; + + /** 开票银行 */ + @TableField(value = "BankForInvoice") + private String bankForInvoice; + + /** 简称 */ + @TableField(value = "ShortName") + private String shortName; + + /** 摘要(弃用) */ + @TableField(value = "Summary") + private String summary; + + /** 所属行政组织ID */ + @TableField(value = "OwnerOrg") + private String ownerOrg; + + /** 所属作用域ID */ + @TableField(value = "OwnerDomain") + private String ownerDomain; + + /** 密级等级 */ + @TableField(value = "SecLevel") + private Integer secLevel; + + /** 密级 */ + @TableField(value = "SecLevelID") + private String secLevelId; + + /** 使用范围 */ + @TableField(value = "DomainType") + private String domainType; + + /** 关联字段1 */ + @TableField(value = "ReferID1") + private String referId1; + + /** 关联字段2 */ + @TableField(value = "ReferID2") + private String referId2; + + /** 关联字段3 */ + @TableField(value = "ReferID3") + private String referId3; + + /** 关联字段4 */ + @TableField(value = "ReferID4") + private String referId4; + + /** 关联字段5 */ + @TableField(value = "ReferID5") + private String referId5; + + /** 显示字段1 */ + @TableField(value = "PlainText1") + private String plainText1; + + /** 显示字段2 */ + @TableField(value = "PlainText2") + private String plainText2; + + /** 显示字段3 */ + @TableField(value = "PlainText3") + private String plainText3; + + /** 显示字段4 */ + @TableField(value = "PlainText4") + private String plainText4; + + /** 显示字段5 */ + @TableField(value = "PlainText5") + private String plainText5; + + /** 数字字段1 */ + @TableField(value = "Dec1") + private BigDecimal dec1; + + /** 数字字段2 */ + @TableField(value = "Dec2") + private BigDecimal dec2; + + /** 数字字段3 */ + @TableField(value = "Dec3") + private BigDecimal dec3; + + /** 数字字段4 */ + @TableField(value = "Dec4") + private BigDecimal dec4; + + /** 数字字段5 */ + @TableField(value = "Dec5") + private BigDecimal dec5; + + /** 单位性质 */ + @TableField(value = "UnitNature") + private String unitNature; + + /** 备注 */ + @TableField(value = "NRemark") + private String nRemark; + + /** 摘要 */ + @TableField(value = "NSummary") + private String nSummary; + + /** 注册地址 */ + @TableField(value = "NRegisteredAddress") + private String nRegisteredAddress; + + /** 启用电子签章 */ + @TableField(value = "EnableESign") + private String enableESign; + + /** 注册时间 */ + @TableField(value = "RegisteredTime") + private Date registeredTime; + + /** 实缴资本 */ + @TableField(value = "PaidInCapital") + private String paidInCapital; + + /** 信用评级 */ + @TableField(value = "CreditRating") + private String creditRating; + + /** 经营状态 */ + @TableField(value = "ManagementState") + private String managementState; + + /** 实际控制人 */ + @TableField(value = "ActualController") + private String actualController; + + /** 助记码 */ + @TableField(value = "Mnemocode") + private String mnemocode; + + /** 审批类型 */ + @TableField(value = "BillType") + private String billType; + + /** 实际控制单位 */ + @TableField(value = "ActualControllerPartner") + private String actualControllerPartner; + + /** 往来单位所属组织范围 */ + @TableField(value = "IEOwnerDomains") + private String ieOwnerDomains; + + /** 经营范围 */ + @TableField(value = "BusinessScope") + private String businessScope; + + /** 外部评级等级 */ + @TableField(value = "PublicRatingLevel") + private String publicRatingLevel; + + /** 评分 */ + @TableField(value = "PublicRatingScore") + private BigDecimal publicRatingScore; + + /** 是否黑名单 */ + @TableField(value = "InPublicBlacklist") + private String inPublicBlacklist; + + /** 办公电话 */ + @TableField(value = "OfficePhone") + private String officePhone; + + /** 企业规模 */ + @TableField(value = "EnterpriseScale") + private String enterpriseScale; +} \ No newline at end of file diff --git a/lidee-core/src/main/java/com/lideeyunji/core/framework/entity/ErpScmBaseSn.java b/lidee-core/src/main/java/com/lideeyunji/core/framework/entity/ErpScmBaseSn.java new file mode 100644 index 0000000..8613ad6 --- /dev/null +++ b/lidee-core/src/main/java/com/lideeyunji/core/framework/entity/ErpScmBaseSn.java @@ -0,0 +1,471 @@ +package com.lideeyunji.core.framework.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +/** + * 单件档案表对象 ERP_ScmBaseSN + * + * @author 雷神 + * @date 2026-04-10 + */ +@TableName("ERP_SCMBASESN") +@Data +public class ErpScmBaseSn implements Serializable { + private static final long serialVersionUID = 1L; + + /** ID */ + @TableId(value = "ID", type = IdType.INPUT) + private String id; + + /** 单件号 */ + @TableField(value = "SN") + private String sn; + + /** 数据年度 */ + @TableField(value = "DataYear") + private String dataYear; + + /** 数据月份 */ + @TableField(value = "DataMonth") + private String dataMonth; + + /** 库存组织 */ + @TableField(value = "IMOrgID") + private String imOrgId; + + /** 物料ID */ + @TableField(value = "MaterialID") + private String materialId; + + /** 物料编号 */ + @TableField(value = "MCode") + private String mCode; + + /** 物料名称 */ + @TableField(value = "MName") + private String mName; + + /** 物料规格 */ + @TableField(value = "MSpecs") + private String mSpecs; + + /** 物料型号 */ + @TableField(value = "MModel") + private String mModel; + + /** 物料描述 */ + @TableField(value = "MNote") + private String mNote; + + /** 辅数量 */ + @TableField(value = "SecQty") + private BigDecimal secQty; + + /** 辅计量单位ID */ + @TableField(value = "SecUnitID") + private String secUnitId; + + /** 辅计量单位 */ + @TableField(value = "SecUnit") + private String secUnit; + + /** 换算规则 */ + @TableField(value = "ConvRule") + private String convRule; + + /** 主辅换算率 */ + @TableField(value = "ConvRatio") + private String convRatio; + + /** 辅计量精度 */ + @TableField(value = "SecPrecision") + private Integer secPrecision; + + /** 备注 */ + @TableField(value = "Remarks") + private String remarks; + + /** 辅助信息ID */ + @TableField(value = "ExContentID") + private String exContentId; + + /** 辅助信息描述 */ + @TableField(value = "ExContent") + private String exContent; + + /** 物料辅助ID */ + @TableField(value = "MExContentID") + private String mExContentId; + + /** 物料辅助描述 */ + @TableField(value = "MExContent") + private String mExContent; + + /** 物料特征ID */ + @TableField(value = "MFeatureID") + private String mFeatureId; + + /** 批次ID */ + @TableField(value = "BatchID") + private String batchId; + + /** 批次编号 */ + @TableField(value = "BatchCode") + private String batchCode; + + /** 质检状态 */ + @TableField(value = "QualityState") + private String qualityState; + + /** 质量等级 */ + @TableField(value = "QualityLevel") + private String qualityLevel; + + /** 检验完成时间 */ + @TableField(value = "QualityTime") + private Date qualityTime; + + /** 库存状态 */ + @TableField(value = "BatchStockState") + private String batchStockState; + + /** 放行状态 */ + @TableField(value = "ReleaseState") + private String releaseState; + + /** 来源供应商 */ + @TableField(value = "VenderID") + private String venderId; + + /** 来源生产厂 */ + @TableField(value = "FactoryID") + private String factoryId; + + /** 原始批号 */ + @TableField(value = "OriBatchCode") + private String oriBatchCode; + + /** 入库日期 */ + @TableField(value = "RecDate") + private Date recDate; + + /** 生产日期 */ + @TableField(value = "ProductDate") + private Date productDate; + + /** 生效日期 */ + @TableField(value = "EfficientDate") + private Date efficientDate; + + /** 失效日期 */ + @TableField(value = "DisableDate") + private Date disableDate; + + /** 仓库 */ + @TableField(value = "Wh") + private String wh; + + /** 物料特征描述 */ + @TableField(value = "MFeature") + private String mFeature; + + /** 货位 */ + @TableField(value = "Bin") + private String bin; + + /** 仓库ID */ + @TableField(value = "WhID") + private String whId; + + /** 货位ID */ + @TableField(value = "BinID") + private String binId; + + /** 垛号 */ + @TableField(value = "PileCode") + private String pileCode; + + /** 物料版本 */ + @TableField(value = "MVersion") + private String mVersion; + + /** 在库状态 */ + @TableField(value = "StoreState") + private String storeState; + + /** 停用 */ + @TableField(value = "IsStop") + private String isStop; + + /** 停用时间 */ + @TableField(value = "StopTime") + private Date stopTime; + + /** 停用人 */ + @TableField(value = "StopUserID") + private String stopUserId; + + /** 停用人姓名 */ + @TableField(value = "StopUser") + private String stopUser; + + /** 是否归档 */ + @TableField(value = "IsArchive") + private String isArchive; + + /** 已打印 */ + @TableField(value = "IsPrinted") + private String isPrinted; + + /** 打印次数 */ + @TableField(value = "PrintingTimes") + private Integer printingTimes; + + /** 附件行数 */ + @TableField(value = "AttachmentCnts") + private Integer attachmentCnts; + + /** 单件规则ID */ + @TableField(value = "SNRuleID") + private String snRuleId; + + /** 文本自定义栏目01 */ + @TableField(value = "C01") + private String c01; + + /** 文本自定义栏目02 */ + @TableField(value = "C02") + private String c02; + + /** 文本自定义栏目03 */ + @TableField(value = "C03") + private String c03; + + /** 文本自定义栏目04 */ + @TableField(value = "C04") + private String c04; + + /** 文本自定义栏目05 */ + @TableField(value = "C05") + private String c05; + + /** 文本自定义栏目06 */ + @TableField(value = "C06") + private String c06; + + /** 文本自定义栏目07 */ + @TableField(value = "C07") + private String c07; + + /** 文本自定义栏目08 */ + @TableField(value = "C08") + private String c08; + + /** 文本自定义栏目09 */ + @TableField(value = "C09") + private String c09; + + /** 文本自定义栏目10 */ + @TableField(value = "C10") + private String c10; + + /** 文本自定义栏目11 */ + @TableField(value = "C11") + private String c11; + + /** 文本自定义栏目12 */ + @TableField(value = "C12") + private String c12; + + /** 文本自定义栏目13 */ + @TableField(value = "C13") + private String c13; + + /** 文本自定义栏目14 */ + @TableField(value = "C14") + private String c14; + + /** 文本自定义栏目15 */ + @TableField(value = "C15") + private String c15; + + /** 文本自定义栏目16 */ + @TableField(value = "C16") + private String c16; + + /** 文本自定义栏目17 */ + @TableField(value = "C17") + private String c17; + + /** 文本自定义栏目18 */ + @TableField(value = "C18") + private String c18; + + /** 文本自定义栏目19 */ + @TableField(value = "C19") + private String c19; + + /** 文本自定义栏目20 */ + @TableField(value = "C20") + private String c20; + + /** 数值自定义栏目01 */ + @TableField(value = "N01") + private BigDecimal n01; + + /** 数值自定义栏目02 */ + @TableField(value = "N02") + private BigDecimal n02; + + /** 数值自定义栏目03 */ + @TableField(value = "N03") + private BigDecimal n03; + + /** 数值自定义栏目04 */ + @TableField(value = "N04") + private BigDecimal n04; + + /** 数值自定义栏目05 */ + @TableField(value = "N05") + private BigDecimal n05; + + /** 数值自定义栏目06 */ + @TableField(value = "N06") + private BigDecimal n06; + + /** 数值自定义栏目07 */ + @TableField(value = "N07") + private BigDecimal n07; + + /** 数值自定义栏目08 */ + @TableField(value = "N08") + private BigDecimal n08; + + /** 数值自定义栏目09 */ + @TableField(value = "N09") + private BigDecimal n09; + + /** 数值自定义栏目10 */ + @TableField(value = "N10") + private BigDecimal n10; + + /** 创建人 */ + @TableField(value = "TimeStamp_CreatedBy") + private String timeStampCreatedBy; + + /** 创建时间 */ + @TableField(value = "TimeStamp_CreatedOn") + private Date timeStampCreatedOn; + + /** 最后修改人 */ + @TableField(value = "TimeStamp_LastChangedBy") + private String timeStampLastChangedBy; + + /** 最后修改时间 */ + @TableField(value = "TimeStamp_LastChangedOn") + private Date timeStampLastChangedOn; + + /** Version */ + @TableField(value = "Version") + private Date version; + + /** 保证贮存期 */ + @TableField(value = "StoragePeriod") + private Date storagePeriod; + + /** 化验日期 */ + @TableField(value = "AssayDate") + private Date assayDate; + + /** 检验日期 */ + @TableField(value = "CheckDate") + private Date checkDate; + + /** 复验日期 */ + @TableField(value = "RecheckDate") + private Date recheckDate; + + /** 上次油封日期 */ + @TableField(value = "PreOilSealDate") + private Date preOilSealDate; + + /** 油封日期 */ + @TableField(value = "OilSealDate") + private Date oilSealDate; + + /** 化验次数 */ + @TableField(value = "AssayNum") + private Integer assayNum; + + /** 复检次数 */ + @TableField(value = "RecheckNum") + private Integer recheckNum; + + /** 占用ID */ + @TableField(value = "OccID") + private String occId; + + /** 占用类型 */ + @TableField(value = "OccType") + private String occType; + + /** 占用状态 */ + @TableField(value = "OccState") + private String occState; + + /** 物料图号 */ + @TableField(value = "MDrawingNo") + private String mDrawingNo; + + /** 项目ID */ + @TableField(value = "ProjectID") + private String projectId; + + /** 项目名称 */ + @TableField(value = "ProjectName") + private String projectName; + + /** 项目编号 */ + @TableField(value = "ProjectCode") + private String projectCode; + + /** 出库单ID */ + @TableField(value = "GIBillID") + private String giBillId; + + /** 出库单编号 */ + @TableField(value = "GIBillCode") + private String giBillCode; + + /** 出库单分录ID */ + @TableField(value = "GIBillItemID") + private String giBillItemId; + + /** 出库单分录行号 */ + @TableField(value = "GIBillItemNo") + private String giBillItemNo; + + /** 入库单ID */ + @TableField(value = "GRBillID") + private String grBillId; + + /** 入库单编号 */ + @TableField(value = "GRBillCode") + private String grBillCode; + + /** 入库单分录ID */ + @TableField(value = "GRBillItemID") + private String grBillItemId; + + /** 入库单分录行号 */ + @TableField(value = "GRBillItemNo") + private String grBillItemNo; +} \ No newline at end of file diff --git a/lidee-core/src/main/java/com/lideeyunji/core/framework/entity/ErpScmBatch.java b/lidee-core/src/main/java/com/lideeyunji/core/framework/entity/ErpScmBatch.java new file mode 100644 index 0000000..9e28130 --- /dev/null +++ b/lidee-core/src/main/java/com/lideeyunji/core/framework/entity/ErpScmBatch.java @@ -0,0 +1,576 @@ +package com.lideeyunji.core.framework.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +/** + * 批次档案 + * + * @author 雷神 + * @since 2026-04-10 + */ +@Data +@TableName("ERP_SCMBATCH") +public class ErpScmBatch implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @TableId(value = "ID", type = IdType.INPUT) + private String id; + + /** + * Version + */ + @TableField("Version") + private Date version; + + /** + * 管理组织 + */ + @TableField("BizOrgID") + private String bizOrgId; + + /** + * 物料 + */ + @TableField("MaterialID") + private String materialId; + + /** + * 批次号 + */ + @TableField("BatchCode") + private String batchCode; + + /** + * 质检状态 + */ + @TableField("QualityState") + private String qualityState; + + /** + * 质量等级 + */ + @TableField("QualityLevel") + private String qualityLevel; + + /** + * 检验完成时间 + */ + @TableField("QualityTime") + private Date qualityTime; + + /** + * 库存状态 + */ + @TableField("BatchStockState") + private String batchStockState; + + /** + * 放行状态 + */ + @TableField("ReleaseState") + private String releaseState; + + /** + * 来源供应商 + */ + @TableField("VenderID") + private String venderId; + + /** + * 来源生产厂 + */ + @TableField("FactoryID") + private String factoryId; + + /** + * 原始批号 + */ + @TableField("OriBatchCode") + private String oriBatchCode; + + /** + * 入库日期 + */ + @TableField("RecDate") + private Date recDate; + + /** + * 生产日期 + */ + @TableField("ProductDate") + private Date productDate; + + /** + * 生效日期 + */ + @TableField("EfficientDate") + private Date efficientDate; + + /** + * 失效日期 + */ + @TableField("DisableDate") + private Date disableDate; + + /** + * 库存计量单位 + */ + @TableField("InvUnitID") + private String invUnitId; + + /** + * 批次计量单位 + */ + @TableField("BatchUnitID") + private String batchUnitId; + + /** + * 库存计量换算系数 + */ + @TableField("InvUnitRate") + private BigDecimal invUnitRate; + + /** + * 批次计量换算系数 + */ + @TableField("BatchUnitRate") + private BigDecimal batchUnitRate; + + /** + * 辅助信息ID + */ + @TableField("ExContentID") + private String exContentId; + + /** + * 辅助信息描述 + */ + @TableField("ExContent") + private String exContent; + + /** + * 备注 + */ + @TableField("Note") + private String note; + + /** + * 合同ID + */ + @TableField("ContractID") + private String contractId; + + /** + * 合同号 + */ + @TableField("ContractCode") + private String contractCode; + + /** + * 采购订单ID + */ + @TableField("POID") + private String poId; + + /** + * 采购订单 + */ + @TableField("POCode") + private String poCode; + + /** + * 停用 + */ + @TableField("IsStop") + private String isStop; + + /** + * 停用时间 + */ + @TableField("StopTime") + private Date stopTime; + + /** + * 停用人 + */ + @TableField("StopUserID") + private String stopUserId; + + /** + * 停用人姓名 + */ + @TableField("StopUser") + private String stopUser; + + /** + * 是否归档 + */ + @TableField("IsArchive") + private String isArchive; + + /** + * 批次规则ID + */ + @TableField("BatchRuleID") + private String batchRuleId; + + /** + * 已打印 + */ + @TableField("IsPrinted") + private String isPrinted; + + /** + * 打印次数 + */ + @TableField("PrintingTimes") + private Integer printingTimes; + + /** + * 批次价格 + */ + @TableField("BatchPrice") + private BigDecimal batchPrice; + + /** + * 辅助属性 + */ + @TableField("AssAttribute") + private String assAttribute; + + /** + * 有效次数 + */ + @TableField("EffectiveTimes") + private Integer effectiveTimes; + + /** + * 有效天数 + */ + @TableField("ValidDate") + private Integer validDate; + + /** + * 附件行数 + */ + @TableField("AttachmentCnts") + private Integer attachmentCnts; + + /** + * 项目ID + */ + @TableField("Project") + private String project; + + /** + * 仓库 + */ + @TableField("Warehouse") + private String warehouse; + + /** + * 项目任务 + */ + @TableField("WBS") + private String wbs; + + /** + * 项目任务Code + */ + @TableField("WBSCode") + private String wbsCode; + + /** + * 仓库Code + */ + @TableField("WarehouseCode") + private String warehouseCode; + + /** + * 项目Code + */ + @TableField("ProjectCode") + private String projectCode; + + /** + * 文本自定义栏目01 + */ + @TableField("C01") + private String c01; + + /** + * 文本自定义栏目02 + */ + @TableField("C02") + private String c02; + + /** + * 文本自定义栏目03 + */ + @TableField("C03") + private String c03; + + /** + * 文本自定义栏目04 + */ + @TableField("C04") + private String c04; + + /** + * 文本自定义栏目05 + */ + @TableField("C05") + private String c05; + + /** + * 文本自定义栏目06 + */ + @TableField("C06") + private String c06; + + /** + * 文本自定义栏目07 + */ + @TableField("C07") + private String c07; + + /** + * 文本自定义栏目08 + */ + @TableField("C08") + private String c08; + + /** + * 文本自定义栏目09 + */ + @TableField("C09") + private String c09; + + /** + * 文本自定义栏目10 + */ + @TableField("C10") + private String c10; + + /** + * 文本自定义栏目11 + */ + @TableField("C11") + private String c11; + + /** + * 文本自定义栏目12 + */ + @TableField("C12") + private String c12; + + /** + * 文本自定义栏目13 + */ + @TableField("C13") + private String c13; + + /** + * 文本自定义栏目14 + */ + @TableField("C14") + private String c14; + + /** + * 文本自定义栏目15 + */ + @TableField("C15") + private String c15; + + /** + * 文本自定义栏目16 + */ + @TableField("C16") + private String c16; + + /** + * 文本自定义栏目17 + */ + @TableField("C17") + private String c17; + + /** + * 文本自定义栏目18 + */ + @TableField("C18") + private String c18; + + /** + * 文本自定义栏目19 + */ + @TableField("C19") + private String c19; + + /** + * 文本自定义栏目20 + */ + @TableField("C20") + private String c20; + + /** + * 数值自定义栏目01 + */ + @TableField("N01") + private BigDecimal n01; + + /** + * 数值自定义栏目02 + */ + @TableField("N02") + private BigDecimal n02; + + /** + * 数值自定义栏目03 + */ + @TableField("N03") + private BigDecimal n03; + + /** + * 数值自定义栏目04 + */ + @TableField("N04") + private BigDecimal n04; + + /** + * 数值自定义栏目05 + */ + @TableField("N05") + private BigDecimal n05; + + /** + * 数值自定义栏目06 + */ + @TableField("N06") + private BigDecimal n06; + + /** + * 数值自定义栏目07 + */ + @TableField("N07") + private BigDecimal n07; + + /** + * 数值自定义栏目08 + */ + @TableField("N08") + private BigDecimal n08; + + /** + * 数值自定义栏目09 + */ + @TableField("N09") + private BigDecimal n09; + + /** + * 数值自定义栏目10 + */ + @TableField("N10") + private BigDecimal n10; + + /** + * 创建人 + */ + @TableField("TimeStamps_CreatedBy") + private String timestampsCreatedBy; + + /** + * 创建时间 + */ + @TableField("TimeStamps_CreatedOn") + private Date timestampsCreatedOn; + + /** + * 最后修改人 + */ + @TableField("TimeStamps_LastChangedBy") + private String timestampsLastChangedBy; + + /** + * 最后修改时间 + */ + @TableField("TimeStamps_LastChangedOn") + private Date timestampsLastChangedOn; + + /** + * 复检日期 + */ + @TableField("ReQCDate") + private Date reQcDate; + + /** + * 保证贮存期 + */ + @TableField("StoragePeriod") + private Date storagePeriod; + + /** + * 化验日期 + */ + @TableField("AssayDate") + private Date assayDate; + + /** + * 检验日期 + */ + @TableField("CheckDate") + private Date checkDate; + + /** + * 复验日期 + */ + @TableField("RecheckDate") + private Date recheckDate; + + /** + * 上次油封日期 + */ + @TableField("PreOilSealDate") + private Date preOilSealDate; + + /** + * 油封日期 + */ + @TableField("OilSealDate") + private Date oilSealDate; + + /** + * 化验次数 + */ + @TableField("AssayNum") + private Integer assayNum; + + /** + * 复检次数 + */ + @TableField("RecheckNum") + private Integer recheckNum; + + /** + * 生产厂家ID + */ + @TableField("ManufacturerID") + private String manufacturerId; + + /** + * 有效期至 + */ + @TableField("ValidTo") + private String validTo; +} \ No newline at end of file diff --git a/lidee-core/src/main/java/com/lideeyunji/core/framework/entity/ErpScmWarehouse.java b/lidee-core/src/main/java/com/lideeyunji/core/framework/entity/ErpScmWarehouse.java new file mode 100644 index 0000000..529f589 --- /dev/null +++ b/lidee-core/src/main/java/com/lideeyunji/core/framework/entity/ErpScmWarehouse.java @@ -0,0 +1,204 @@ +package com.lideeyunji.core.framework.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +/** + * 仓库定义 + * + * @author 雷神 + * @since 2026-04-10 + */ +@Data +@TableName("ERP_SCMWAREHOUSE") +public class ErpScmWarehouse implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @TableId(value = "ID", type = IdType.INPUT) + private String id; + + /** + * 仓库编号 + */ + @TableField("WarehouseCode") + private String warehouseCode; + + /** + * 仓库名称 + */ + @TableField("WarehouseName") + private String warehouseName; + + /** + * 仓库地址 + */ + @TableField("Address") + private String address; + + /** + * 是否管理货位 + */ + @TableField("IsMgrBin") + private String isMgrBin; + + /** + * 版本 + */ + @TableField("Version") + private Date version; + + /** + * 经度 + */ + @TableField("Longitude") + private BigDecimal longitude; + + /** + * 纬度 + */ + @TableField("Latitude") + private BigDecimal latitude; + + /** + * 创建人 + */ + @TableField("Timestamp_CreatedBy") + private String timestampCreatedBy; + + /** + * 创建时间 + */ + @TableField("Timestamp_CreatedOn") + private Date timestampCreatedOn; + + /** + * 最后修改人 + */ + @TableField("Timestamp_LastChangedBy") + private String timestampLastChangedBy; + + /** + * 最后修改时间 + */ + @TableField("Timestamp_LastChangedOn") + private Date timestampLastChangedOn; + + /** + * 热区信息 + */ + @TableField("HotZoneInfo") + private String hotZoneInfo; + + /** + * 行政组织 + */ + @TableField("CreateOrg") + private String createOrg; + + /** + * 是否启用 + */ + @TableField("StopStatus") + private String stopStatus; + + /** + * 备注 + */ + @TableField("Remarks") + private String remarks; + + /** + * 管理部门 + */ + @TableField("DeptId") + private String deptId; + + /** + * 联系人 + */ + @TableField("ContactUser") + private String contactUser; + + /** + * 联系方式 + */ + @TableField("ContactPhone") + private String contactPhone; + + /** + * 货位数 + */ + @TableField("BinCnt") + private Integer binCnt; + + /** + * 垛号管理 + */ + @TableField("IsMgrStack") + private String isMgrStack; + + /** + * 停用时间 + */ + @TableField("StopTime") + private Date stopTime; + + /** + * 停用人 + */ + @TableField("StopUserID") + private String stopUserId; + + /** + * 停用人姓名 + */ + @TableField("StopUser") + private String stopUser; + + /** + * 仓库堆垛管理 + */ + @TableField("IsMgrWhStack") + private String isMgrWhStack; + + /** + * 所属区划 + */ + @TableField("Region") + private String region; + + /** + * 过账使用 + */ + @TableField("IsInterSUage") + private String isInterSUage; + + /** + * 默认货位ID + */ + @TableField("DefBinID") + private String defBinId; + + /** + * 默认货位编号 + */ + @TableField("DefBinCode") + private String defBinCode; + + /** + * 默认货位 + */ + @TableField("DefBin") + private String defBin; +} \ No newline at end of file diff --git a/lidee-core/src/main/java/com/lideeyunji/core/framework/mapper/erp/ErpBfMeasureUnitMapper.java b/lidee-core/src/main/java/com/lideeyunji/core/framework/mapper/erp/ErpBfMeasureUnitMapper.java new file mode 100644 index 0000000..633119a --- /dev/null +++ b/lidee-core/src/main/java/com/lideeyunji/core/framework/mapper/erp/ErpBfMeasureUnitMapper.java @@ -0,0 +1,52 @@ +package com.lideeyunji.core.framework.mapper.erp; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.lideeyunji.core.framework.entity.ErpBfMeasureUnit; +import org.apache.ibatis.annotations.Mapper; + +import java.util.Date; +import java.util.List; + +/** + * 计量单位 Mapper 接口 + * + * @author 雷神 + * @since 2026-04-11 + */ +@Mapper +public interface ErpBfMeasureUnitMapper extends BaseMapper { + + + @DS("erp") + default List selectMeasureUnitFromErp() { + return this.selectList(new LambdaQueryWrapper<>()); + } + + + /** + * 同步单条计量单位数据(根据时间戳判断新增/更新/跳过) + * @return 1:新增, 2:更新, 0:跳过 + */ + @DS("sjzt") + default int syncMeasureUnitByTimestamp(ErpBfMeasureUnit sourceData) { + ErpBfMeasureUnit targetData = this.selectById(sourceData.getId()); + if (targetData == null) { + // 目标库不存在,新增 + this.insert(sourceData); + return 1; + } + // 比较时间戳 + Date sourceTime = sourceData.getTimeStampLastChangedOn(); + Date targetTime = targetData.getTimeStampLastChangedOn(); + if (sourceTime != null && targetTime != null && !sourceTime.equals(targetTime)) { + // 时间戳不同,更新 + this.updateById(sourceData); + return 2; + } + // 时间戳相同,跳过 + return 0; + } + +} \ No newline at end of file diff --git a/lidee-core/src/main/java/com/lideeyunji/core/framework/mapper/erp/ErpBfPartnerMapper.java b/lidee-core/src/main/java/com/lideeyunji/core/framework/mapper/erp/ErpBfPartnerMapper.java new file mode 100644 index 0000000..a2893ba --- /dev/null +++ b/lidee-core/src/main/java/com/lideeyunji/core/framework/mapper/erp/ErpBfPartnerMapper.java @@ -0,0 +1,52 @@ +package com.lideeyunji.core.framework.mapper.erp; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.lideeyunji.core.framework.entity.ErpBfPartner; +import org.apache.ibatis.annotations.Mapper; + +import java.util.Date; +import java.util.List; + +/** + * 往来单位 Mapper 接口 + * + * @author 雷神 + * @since 2026-04-11 + */ +@Mapper +public interface ErpBfPartnerMapper extends BaseMapper { + + // ==================== 往来单位 ==================== + + @DS("erp") + default List selectPartnerFromErp() { + return this.selectList(new LambdaQueryWrapper<>()); + } + + + /** + * 同步单条往来单位数据(根据时间戳判断新增/更新/跳过) + * @return 1:新增, 2:更新, 0:跳过 + */ + @DS("sjzt") + default int syncPartnerByTimestamp(ErpBfPartner sourceData) { + ErpBfPartner targetData = this.selectById(sourceData.getId()); + if (targetData == null) { + // 目标库不存在,新增 + this.insert(sourceData); + return 1; + } + // 比较时间戳 + Date sourceTime = sourceData.getTimeStampLastChangedOn(); + Date targetTime = targetData.getTimeStampLastChangedOn(); + if (sourceTime != null && targetTime != null && !sourceTime.equals(targetTime)) { + // 时间戳不同,更新 + this.updateById(sourceData); + return 2; + } + // 时间戳相同,跳过 + return 0; + } +} \ No newline at end of file diff --git a/lidee-core/src/main/java/com/lideeyunji/core/framework/mapper/erp/ErpScmBaseSnMapper.java b/lidee-core/src/main/java/com/lideeyunji/core/framework/mapper/erp/ErpScmBaseSnMapper.java new file mode 100644 index 0000000..7c9eda3 --- /dev/null +++ b/lidee-core/src/main/java/com/lideeyunji/core/framework/mapper/erp/ErpScmBaseSnMapper.java @@ -0,0 +1,51 @@ +package com.lideeyunji.core.framework.mapper.erp; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.lideeyunji.core.framework.entity.ErpScmBaseSn; +import org.apache.ibatis.annotations.Mapper; + +import java.util.Date; +import java.util.List; + +/** + * 批次号 Mapper 接口 + * + * @author 雷神 + * @since 2026-04-11 + */ +@Mapper +public interface ErpScmBaseSnMapper extends BaseMapper { + + + + @DS("erp") + default List selectBaseSnFromErp() { + return this.selectList(new LambdaQueryWrapper<>()); + } + + /** + * 同步单条批次号数据(根据时间戳判断新增/更新/跳过) + * @return 1:新增, 2:更新, 0:跳过 + */ + @DS("sjzt") + default int syncBaseSnByTimestamp(ErpScmBaseSn sourceData) { + ErpScmBaseSn targetData = this.selectById(sourceData.getId()); + if (targetData == null) { + // 目标库不存在,新增 + this.insert(sourceData); + return 1; + } + // 比较时间戳 + Date sourceTime = sourceData.getTimeStampLastChangedOn(); + Date targetTime = targetData.getTimeStampLastChangedOn(); + if (sourceTime != null && targetTime != null && !sourceTime.equals(targetTime)) { + // 时间戳不同,更新 + this.updateById(sourceData); + return 2; + } + // 时间戳相同,跳过 + return 0; + } +} \ No newline at end of file diff --git a/lidee-core/src/main/java/com/lideeyunji/core/framework/mapper/erp/ErpScmBatchMapper.java b/lidee-core/src/main/java/com/lideeyunji/core/framework/mapper/erp/ErpScmBatchMapper.java new file mode 100644 index 0000000..e4e2708 --- /dev/null +++ b/lidee-core/src/main/java/com/lideeyunji/core/framework/mapper/erp/ErpScmBatchMapper.java @@ -0,0 +1,50 @@ +package com.lideeyunji.core.framework.mapper.erp; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.lideeyunji.core.framework.entity.ErpScmBatch; +import org.apache.ibatis.annotations.Mapper; + +import java.util.Date; +import java.util.List; + +/** + * 批次 Mapper 接口 + * + * @author 雷神 + * @since 2026-04-11 + */ +@Mapper +public interface ErpScmBatchMapper extends BaseMapper { + + @DS("erp") + default List selectBatchFromErp() { + return this.selectList(new LambdaQueryWrapper<>()); + } + + + /** + * 同步单条批次数据(根据时间戳判断新增/更新/跳过) + * @return 1:新增, 2:更新, 0:跳过 + */ + @DS("sjzt") + default int syncBatchByTimestamp(ErpScmBatch sourceData) { + ErpScmBatch targetData = this.selectById(sourceData.getId()); + if (targetData == null) { + // 目标库不存在,新增 + this.insert(sourceData); + return 1; + } + // 比较时间戳 + Date sourceTime = sourceData.getTimestampsLastChangedOn(); + Date targetTime = targetData.getTimestampsLastChangedOn(); + if (sourceTime != null && targetTime != null && !sourceTime.equals(targetTime)) { + // 时间戳不同,更新 + this.updateById(sourceData); + return 2; + } + // 时间戳相同,跳过 + return 0; + } +} \ No newline at end of file diff --git a/lidee-core/src/main/java/com/lideeyunji/core/framework/mapper/erp/ErpScmWarehouseMapper.java b/lidee-core/src/main/java/com/lideeyunji/core/framework/mapper/erp/ErpScmWarehouseMapper.java new file mode 100644 index 0000000..91c4fcd --- /dev/null +++ b/lidee-core/src/main/java/com/lideeyunji/core/framework/mapper/erp/ErpScmWarehouseMapper.java @@ -0,0 +1,52 @@ +package com.lideeyunji.core.framework.mapper.erp; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.lideeyunji.core.framework.entity.ErpScmWarehouse; +import org.apache.ibatis.annotations.Mapper; + +import java.util.Date; +import java.util.List; + +/** + * 仓库 Mapper 接口 + * + * @author 雷神 + * @since 2026-04-11 + */ +@Mapper +public interface ErpScmWarehouseMapper extends BaseMapper { + + + + @DS("erp") + default List selectWarehouseFromErp() { + return this.selectList(new LambdaQueryWrapper<>()); + } + + /** + * 同步单条仓库数据(根据时间戳判断新增/更新/跳过) + * @return 1:新增, 2:更新, 0:跳过 + */ + @DS("sjzt") + default int syncWarehouseByTimestamp(ErpScmWarehouse sourceData) { + ErpScmWarehouse targetData = this.selectById(sourceData.getId()); + if (targetData == null) { + // 目标库不存在,新增 + this.insert(sourceData); + return 1; + } + // 比较时间戳 + Date sourceTime = sourceData.getTimestampLastChangedOn(); + Date targetTime = targetData.getTimestampLastChangedOn(); + if (sourceTime != null && targetTime != null && !sourceTime.equals(targetTime)) { + // 时间戳不同,更新 + this.updateById(sourceData); + return 2; + } + // 时间戳相同,跳过 + return 0; + } + +} \ No newline at end of file