sap模块代码整合

highway
zhaoxiaolin 2 years ago
parent d2c7cadd07
commit 60de714016

@ -1,4 +1,4 @@
package com.op.sap.domain;
package com.op.system.api.domain.sap;
import com.op.common.core.annotation.Excel;
import com.op.common.core.web.domain.BaseEntity;

@ -1,4 +1,4 @@
package com.op.sap.domain;
package com.op.system.api.domain.sap;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.op.common.core.annotation.Excel;
@ -12,6 +12,9 @@ import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
* BOM
*/
public class SapBom extends BaseEntity {
private static final long serialVersionUID = 1L;

@ -1,4 +1,4 @@
package com.op.sap.domain;
package com.op.system.api.domain.sap;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.op.common.core.annotation.Excel;
@ -9,6 +9,9 @@ import org.apache.commons.lang3.builder.ToStringStyle;
import java.math.BigDecimal;
import java.util.Date;
/**
* BOM
*/
public class SapBomComponent extends BaseEntity {
/** 主键 */
private Long id;

@ -1,18 +1,22 @@
package com.op.system.api.domain.sap;
/**
*
*/
public class SapCreateOrder {
private String werks;//工厂编码
private String werks;
private String aufpar;//订单类型
private String aufpar;
private String matnr;//物料编号
private String matnr;
private String quantity;//数量
private String quantity;
private String dates;//开始时间
private String dates;
private String datee;
private String datee;//完成时间
public String getWerks() {
return werks;

@ -1,6 +1,9 @@
package com.op.system.api.domain.sap;
/**
*
*/
public class SapMaterialPreparation {
//订单号
private String AUFNR;

@ -1,21 +1,14 @@
package com.op.sap.domain;
package com.op.system.api.domain.sap;
import com.op.common.core.annotation.Excel;
import com.op.common.core.web.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.util.List;
/**
* pro_process
*
* @author yinjinlu
* @date 2022-05-12
*
*/
public class SapProProcess extends BaseEntity
{
public class SapProProcess extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 工序ID */
@ -50,7 +43,7 @@ public class SapProProcess extends BaseEntity
private Long attr4;
private String fileList;
private List<SapBaseFile> files;
//s:拆分 m合并
private String splitMerge;
//拆分合并数量
@ -64,13 +57,7 @@ public class SapProProcess extends BaseEntity
//线体设备
private String equipment;
public List<SapBaseFile> getFiles() {
return files;
}
public void setFiles(List<SapBaseFile> files) {
this.files = files;
}
public String getWorkCenter() {
return workCenter;
@ -212,21 +199,22 @@ public class SapProProcess extends BaseEntity
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("processId", getProcessId())
.append("processCode", getProcessCode())
.append("processName", getProcessName())
.append("attention", getAttention())
.append("enableFlag", getEnableFlag())
.append("remark", getRemark())
.append("attr1", getAttr1())
.append("attr2", getAttr2())
.append("attr3", getAttr3())
.append("attr4", getAttr4())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("processId", getProcessId())
.append("processCode", getProcessCode())
.append("processName", getProcessName())
.append("attention", getAttention())
.append("enableFlag", getEnableFlag())
.append("remark", getRemark())
.append("attr1", getAttr1())
.append("attr2", getAttr2())
.append("attr3", getAttr3())
.append("attr4", getAttr4())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

@ -1,4 +1,4 @@
package com.op.sap.domain;
package com.op.system.api.domain.sap;
import com.op.common.core.annotation.Excel;
import com.op.common.core.web.domain.BaseEntity;

@ -1,9 +1,12 @@
package com.op.sap.domain;
package com.op.system.api.domain.sap;
import com.op.common.core.annotation.Excel;
import com.op.common.core.web.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.util.List;
import java.util.Objects;
/**
@ -64,10 +67,6 @@ public class SapProRoute extends BaseEntity
private String tecConfAcivity5Unit;
private String tecConfAcivity6;
private String tecConfAcivity6Unit;
private String fileList;
private List<SapBaseFile> files;
private List<String> idList;
private String routeVersion;
@ -248,21 +247,7 @@ public class SapProRoute extends BaseEntity
this.tecConfAcivity6Unit = tecConfAcivity6Unit;
}
public String getFileList() {
return fileList;
}
public void setFileList(String fileList) {
this.fileList = fileList;
}
public List<SapBaseFile> getFiles() {
return files;
}
public void setFiles(List<SapBaseFile> files) {
this.files = files;
}
public List<String> getIdList() {
return idList;
@ -305,8 +290,6 @@ public class SapProRoute extends BaseEntity
", tecConfAcivity5Unit='" + tecConfAcivity5Unit + '\'' +
", tecConfAcivity6='" + tecConfAcivity6 + '\'' +
", tecConfAcivity6Unit='" + tecConfAcivity6Unit + '\'' +
", fileList='" + fileList + '\'' +
", files=" + files +
", idList=" + idList +
", routeVersion='" + routeVersion + '\'' +
'}';

@ -1,4 +1,4 @@
package com.op.sap.domain;
package com.op.system.api.domain.sap;
import com.op.common.core.annotation.Excel;
import com.op.common.core.web.domain.BaseEntity;

@ -1,4 +1,4 @@
package com.op.sap.domain;
package com.op.system.api.domain.sap;
import com.op.common.core.annotation.Excel;
import com.op.common.core.web.domain.BaseEntity;

@ -6,11 +6,9 @@ import com.op.common.core.domain.R;
//import com.op.quality.domain.BaseFile;
import com.op.quality.domain.BaseFile;
import com.op.quality.domain.QcProCheck;
//import com.op.quality.mapper.BaseFileMapper;
import com.op.quality.mapper.BaseFileMapper;
import com.op.quality.mapper.QcProCheckMapper;
import com.op.quality.service.QcProCheckService;
import com.sap.conn.jco.JCoException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@ -1,17 +1,15 @@
package com.op.sap.controller;
import com.op.common.core.domain.R;
import com.op.common.core.utils.DateUtils;
import com.op.common.core.web.controller.BaseController;
import com.op.common.core.web.domain.AjaxResult;
import com.op.common.log.annotation.Log;
import com.op.common.log.enums.BusinessType;
import com.op.sap.service.SapBomService;
import com.op.sap.domain.SapBom;
import com.op.sap.service.SapMaterialPreparationService;
import com.op.sap.service.SapOrderService;
import com.op.sap.service.SapService;
import com.op.sap.service.SapRouterService;
import com.op.system.api.domain.sap.SapCreateOrder;
import com.op.system.api.domain.sap.SapMaterialPreparation;
import com.op.system.api.domain.sap.SapRFW;
@ -25,8 +23,6 @@ import java.util.List;
@RequestMapping("/sap")
public class SapController extends BaseController {
@Autowired
private SapService sapService;
@Autowired
private SapOrderService sapOrderService;
@ -36,6 +32,8 @@ public class SapController extends BaseController {
@Autowired
private SapMaterialPreparationService sapMaterialPreparationService;
@Autowired
private SapRouterService sapRouterService;
/**
*
@ -62,7 +60,7 @@ public class SapController extends BaseController {
*/
@PostMapping("/bomSync")
@Log(title = "同步SAP物料清单", businessType = BusinessType.SAP)
public AjaxResult saveBom(){
public R bomSync(){
return sapBomService.bomSync();
}
@ -78,16 +76,18 @@ public class SapController extends BaseController {
return sapMaterialPreparationService.MaterialPreparation(shopOrder);
}
@PostMapping("/sapProRouteProcess")
public R<Boolean> sapProRouteProcess() {
return sapService.sapProRouteProcess();
}
/**
*
* @param sapCreateOrderList
* @return
*/
@PostMapping("/SapCreateOrder")
@PostMapping("/sapCreateOrder")
@Log(title = "生产订单创建接口", businessType = BusinessType.SAP)
public R<List<String>> SapCreateOrder(@RequestBody List<SapCreateOrder> sapCreateOrderList){
return sapOrderService.SapCreateOrder(sapCreateOrderList);
}
/**
*
* @param shopOrder
@ -105,4 +105,10 @@ public class SapController extends BaseController {
return sapOrderService.sapRFWOrder(sapRFW);
}
@PostMapping("/sapRouterSync")
public R sapRouerSync() {
return sapRouterService.sapRouterSync();
}
}

@ -1,123 +0,0 @@
package com.op.sap.domain;
import com.op.common.core.annotation.Excel;
import com.op.common.core.web.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* base_file
*
* @author Open Platform
* @date 2023-07-10
*/
public class SapBaseFile extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 附件ID */
private String fileId;
/** 附件名称 */
@Excel(name = "附件名称")
private String fileName;
/** 附件地址 */
@Excel(name = "附件地址")
private String fileAddress;
/** 数据来源 */
@Excel(name = "数据来源")
private String sourceId;
/** 预留字段1 */
@Excel(name = "预留字段1")
private String attr1;
/** 预留字段2 */
@Excel(name = "预留字段2")
private String attr2;
/** 预留字段3 */
@Excel(name = "预留字段3")
private Long attr3;
/** 预留字段4 */
@Excel(name = "预留字段4")
private Long attr4;
public void setFileId(String fileId) {
this.fileId = fileId;
}
public String getFileId() {
return fileId;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public String getFileName() {
return fileName;
}
public void setFileAddress(String fileAddress) {
this.fileAddress = fileAddress;
}
public String getFileAddress() {
return fileAddress;
}
public void setSourceId(String sourceId) {
this.sourceId = sourceId;
}
public String getSourceId() {
return sourceId;
}
public void setAttr1(String attr1) {
this.attr1 = attr1;
}
public String getAttr1() {
return attr1;
}
public void setAttr2(String attr2) {
this.attr2 = attr2;
}
public String getAttr2() {
return attr2;
}
public void setAttr3(Long attr3) {
this.attr3 = attr3;
}
public Long getAttr3() {
return attr3;
}
public void setAttr4(Long attr4) {
this.attr4 = attr4;
}
public Long getAttr4() {
return attr4;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("fileId", getFileId())
.append("fileName", getFileName())
.append("fileAddress", getFileAddress())
.append("sourceId", getSourceId())
.append("remark", getRemark())
.append("attr1", getAttr1())
.append("attr2", getAttr2())
.append("attr3", getAttr3())
.append("attr4", getAttr4())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

@ -0,0 +1,125 @@
package com.op.sap.domain;
public class SapMaterialPreparation {
//订单号
private String AUFNR;
//预留/相关需求的项目编号
private String RSPOS;
//物料号
private String MATNR;
//物料描述(短文本)
private String MAKTX;
//工厂
private String WERKS;
//库存地点
private String LGORT;
//组件的需求日期
private String BDTER;
//需求量
private String BDMNG;
//欠料数量
private String ZQLSL;
//基本计量单位
private String MEINS;
//标识:反冲
private String RGEKZ;
//直接采购标识
private String DBSKZ;
public String getAUFNR() {
return AUFNR;
}
public void setAUFNR(String AUFNR) {
this.AUFNR = AUFNR;
}
public String getRSPOS() {
return RSPOS;
}
public void setRSPOS(String RSPOS) {
this.RSPOS = RSPOS;
}
public String getMATNR() {
return MATNR;
}
public void setMATNR(String MATNR) {
this.MATNR = MATNR;
}
public String getMAKTX() {
return MAKTX;
}
public void setMAKTX(String MAKTX) {
this.MAKTX = MAKTX;
}
public String getWERKS() {
return WERKS;
}
public void setWERKS(String WERKS) {
this.WERKS = WERKS;
}
public String getLGORT() {
return LGORT;
}
public void setLGORT(String LGORT) {
this.LGORT = LGORT;
}
public String getBDTER() {
return BDTER;
}
public void setBDTER(String BDTER) {
this.BDTER = BDTER;
}
public String getBDMNG() {
return BDMNG;
}
public void setBDMNG(String BDMNG) {
this.BDMNG = BDMNG;
}
public String getZQLSL() {
return ZQLSL;
}
public void setZQLSL(String ZQLSL) {
this.ZQLSL = ZQLSL;
}
public String getMEINS() {
return MEINS;
}
public void setMEINS(String MEINS) {
this.MEINS = MEINS;
}
public String getRGEKZ() {
return RGEKZ;
}
public void setRGEKZ(String RGEKZ) {
this.RGEKZ = RGEKZ;
}
public String getDBSKZ() {
return DBSKZ;
}
public void setDBSKZ(String DBSKZ) {
this.DBSKZ = DBSKZ;
}
}

@ -1,169 +0,0 @@
package com.op.sap.domain;
import com.op.common.core.web.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.ArrayList;
import java.util.List;
/**
* sys_dept
*
* @author OP
*/
public class SapSysDept extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 部门ID */
private Long deptId;
/** 父部门ID */
private Long parentId;
/** 祖级列表 */
private String ancestors;
/** 部门名称 */
private String deptName;
/** 显示顺序 */
private Integer orderNum;
/** 负责人 */
private String leader;
/** 联系电话 */
private String phone;
/** 邮箱 */
private String email;
/** 部门状态:0正常,1停用 */
private String status;
/** 删除标志0代表存在 2代表删除 */
private String delFlag;
/** 父部门名称 */
private String parentName;
/** 子部门 */
private List<SapSysDept> children = new ArrayList<SapSysDept>();
public Long getDeptId() {
return deptId;
}
public void setDeptId(Long deptId) {
this.deptId = deptId;
}
public Long getParentId() {
return parentId;
}
public void setParentId(Long parentId) {
this.parentId = parentId;
}
public String getAncestors() {
return ancestors;
}
public void setAncestors(String ancestors) {
this.ancestors = ancestors;
}
@NotBlank(message = "部门名称不能为空")
@Size(min = 0, max = 30, message = "部门名称长度不能超过30个字符")
public String getDeptName() {
return deptName;
}
public void setDeptName(String deptName) {
this.deptName = deptName;
}
@NotNull(message = "显示顺序不能为空")
public Integer getOrderNum() {
return orderNum;
}
public void setOrderNum(Integer orderNum) {
this.orderNum = orderNum;
}
public String getLeader() {
return leader;
}
public void setLeader(String leader) {
this.leader = leader;
}
@Size(min = 0, max = 11, message = "联系电话长度不能超过11个字符")
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
@Email(message = "邮箱格式不正确")
@Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符")
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getDelFlag() {
return delFlag;
}
public void setDelFlag(String delFlag) {
this.delFlag = delFlag;
}
public String getParentName() {
return parentName;
}
public void setParentName(String parentName) {
this.parentName = parentName;
}
public List<SapSysDept> getChildren() {
return children;
}
public void setChildren(List<SapSysDept> children) {
this.children = children;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).append("deptId", getDeptId())
.append("parentId", getParentId()).append("ancestors", getAncestors()).append("deptName", getDeptName())
.append("orderNum", getOrderNum()).append("leader", getLeader()).append("phone", getPhone())
.append("email", getEmail()).append("status", getStatus()).append("delFlag", getDelFlag())
.append("createBy", getCreateBy()).append("createTime", getCreateTime())
.append("updateBy", getUpdateBy()).append("updateTime", getUpdateTime()).toString();
}
}

@ -1,202 +0,0 @@
package com.op.sap.domain;
import com.op.common.core.annotation.Excel;
import com.op.common.core.annotation.Excel.ColumnType;
import com.op.common.core.web.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.Set;
/**
* sys_role
*
* @author OP
*/
public class SapSysRole extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 角色ID */
@Excel(name = "角色序号", cellType = ColumnType.NUMERIC)
private Long roleId;
/** 角色名称 */
@Excel(name = "角色名称")
private String roleName;
/** 角色权限 */
@Excel(name = "角色权限")
private String roleKey;
/** 角色排序 */
@Excel(name = "角色排序")
private Integer roleSort;
/** 数据范围1所有数据权限2自定义数据权限3本部门数据权限4本部门及以下数据权限5仅本人数据权限 */
@Excel(name = "数据范围", readConverterExp = "1=所有数据权限,2=自定义数据权限,3=本部门数据权限,4=本部门及以下数据权限,5=仅本人数据权限")
private String dataScope;
/** 菜单树选择项是否关联显示( 0父子不互相关联显示 1父子互相关联显示 */
private boolean menuCheckStrictly;
/** 部门树选择项是否关联显示0父子不互相关联显示 1父子互相关联显示 */
private boolean deptCheckStrictly;
/** 角色状态0正常 1停用 */
@Excel(name = "角色状态", readConverterExp = "0=正常,1=停用")
private String status;
/** 删除标志0代表存在 2代表删除 */
private String delFlag;
/** 用户是否存在此角色标识 默认不存在 */
private boolean flag = false;
/** 菜单组 */
private Long[] menuIds;
/** 部门组(数据权限) */
private Long[] deptIds;
/** 角色菜单权限 */
private Set<String> permissions;
public SapSysRole() {
}
public SapSysRole(Long roleId) {
this.roleId = roleId;
}
public Long getRoleId() {
return roleId;
}
public void setRoleId(Long roleId) {
this.roleId = roleId;
}
public boolean isAdmin() {
return isAdmin(this.roleId);
}
public static boolean isAdmin(Long roleId) {
return roleId != null && 1L == roleId;
}
@NotBlank(message = "角色名称不能为空")
@Size(min = 0, max = 30, message = "角色名称长度不能超过30个字符")
public String getRoleName() {
return roleName;
}
public void setRoleName(String roleName) {
this.roleName = roleName;
}
@NotBlank(message = "权限字符不能为空")
@Size(min = 0, max = 100, message = "权限字符长度不能超过100个字符")
public String getRoleKey() {
return roleKey;
}
public void setRoleKey(String roleKey) {
this.roleKey = roleKey;
}
@NotNull(message = "显示顺序不能为空")
public Integer getRoleSort() {
return roleSort;
}
public void setRoleSort(Integer roleSort) {
this.roleSort = roleSort;
}
public String getDataScope() {
return dataScope;
}
public void setDataScope(String dataScope) {
this.dataScope = dataScope;
}
public boolean isMenuCheckStrictly() {
return menuCheckStrictly;
}
public void setMenuCheckStrictly(boolean menuCheckStrictly) {
this.menuCheckStrictly = menuCheckStrictly;
}
public boolean isDeptCheckStrictly() {
return deptCheckStrictly;
}
public void setDeptCheckStrictly(boolean deptCheckStrictly) {
this.deptCheckStrictly = deptCheckStrictly;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getDelFlag() {
return delFlag;
}
public void setDelFlag(String delFlag) {
this.delFlag = delFlag;
}
public boolean isFlag() {
return flag;
}
public void setFlag(boolean flag) {
this.flag = flag;
}
public Long[] getMenuIds() {
return menuIds;
}
public void setMenuIds(Long[] menuIds) {
this.menuIds = menuIds;
}
public Long[] getDeptIds() {
return deptIds;
}
public void setDeptIds(Long[] deptIds) {
this.deptIds = deptIds;
}
public Set<String> getPermissions() {
return permissions;
}
public void setPermissions(Set<String> permissions) {
this.permissions = permissions;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).append("roleId", getRoleId())
.append("roleName", getRoleName()).append("roleKey", getRoleKey()).append("roleSort", getRoleSort())
.append("dataScope", getDataScope()).append("menuCheckStrictly", isMenuCheckStrictly())
.append("deptCheckStrictly", isDeptCheckStrictly()).append("status", getStatus())
.append("delFlag", getDelFlag()).append("createBy", getCreateBy()).append("createTime", getCreateTime())
.append("updateBy", getUpdateBy()).append("updateTime", getUpdateTime()).append("remark", getRemark())
.toString();
}
}

@ -1,282 +0,0 @@
package com.op.sap.domain;
import com.op.common.core.annotation.Excel;
import com.op.common.core.annotation.Excel.ColumnType;
import com.op.common.core.annotation.Excel.Type;
import com.op.common.core.annotation.Excels;
import com.op.common.core.web.domain.BaseEntity;
import com.op.common.core.xss.Xss;
import com.op.system.api.domain.SysDept;
import com.op.system.api.domain.SysRole;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.util.Date;
import java.util.List;
/**
* sys_user
*
* @author sf
*/
public class SapSysUser extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 用户ID */
@Excel(name = "用户序号", cellType = ColumnType.NUMERIC, prompt = "用户编号")
private Long userId;
/** 部门ID */
@Excel(name = "部门编号", type = Type.IMPORT)
private Long deptId;
/** 用户账号 */
@Excel(name = "登录名称")
private String userName;
/** 用户昵称 */
@Excel(name = "用户名称")
private String nickName;
/** 用户邮箱 */
@Excel(name = "用户邮箱")
private String email;
/** 手机号码 */
@Excel(name = "手机号码")
private String phonenumber;
/** 用户性别 */
@Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知")
private String sex;
/** 用户头像 */
private String avatar;
/** 密码 */
private String password;
/** 帐号状态0正常 1停用 */
@Excel(name = "帐号状态", readConverterExp = "0=正常,1=停用")
private String status;
/** 删除标志0代表存在 2代表删除 */
private String delFlag;
/** 最后登录IP */
@Excel(name = "最后登录IP", type = Type.EXPORT)
private String loginIp;
/** 最后登录时间 */
@Excel(name = "最后登录时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Type.EXPORT)
private Date loginDate;
/** 部门对象 */
@Excels({ @Excel(name = "部门名称", targetAttr = "deptName", type = Type.EXPORT),
@Excel(name = "部门负责人", targetAttr = "leader", type = Type.EXPORT) })
private SysDept dept;
/** 角色对象 */
private List<SysRole> roles;
/** 角色组 */
private Long[] roleIds;
/** 岗位组 */
private Long[] postIds;
/** 角色ID */
private Long roleId;
private String datasourceId;
public String getDatasourceId() {
return datasourceId;
}
public void setDatasourceId(String datasourceId) {
this.datasourceId = datasourceId;
}
public SapSysUser() {
}
public SapSysUser(Long userId) {
this.userId = userId;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public boolean isAdmin() {
return isAdmin(this.userId);
}
public static boolean isAdmin(Long userId) {
return userId != null && 1L == userId;
}
public Long getDeptId() {
return deptId;
}
public void setDeptId(Long deptId) {
this.deptId = deptId;
}
@Xss(message = "用户昵称不能包含脚本字符")
@Size(min = 0, max = 30, message = "用户昵称长度不能超过30个字符")
public String getNickName() {
return nickName;
}
public void setNickName(String nickName) {
this.nickName = nickName;
}
@Xss(message = "用户账号不能包含脚本字符")
@NotBlank(message = "用户账号不能为空")
@Size(min = 0, max = 30, message = "用户账号长度不能超过30个字符")
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
@Email(message = "邮箱格式不正确")
@Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符")
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
@Size(min = 0, max = 11, message = "手机号码长度不能超过11个字符")
public String getPhonenumber() {
return phonenumber;
}
public void setPhonenumber(String phonenumber) {
this.phonenumber = phonenumber;
}
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex;
}
public String getAvatar() {
return avatar;
}
public void setAvatar(String avatar) {
this.avatar = avatar;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getDelFlag() {
return delFlag;
}
public void setDelFlag(String delFlag) {
this.delFlag = delFlag;
}
public String getLoginIp() {
return loginIp;
}
public void setLoginIp(String loginIp) {
this.loginIp = loginIp;
}
public Date getLoginDate() {
return loginDate;
}
public void setLoginDate(Date loginDate) {
this.loginDate = loginDate;
}
public SysDept getDept() {
return dept;
}
public void setDept(SysDept dept) {
this.dept = dept;
}
public List<SysRole> getRoles() {
return roles;
}
public void setRoles(List<SysRole> roles) {
this.roles = roles;
}
public Long[] getRoleIds() {
return roleIds;
}
public void setRoleIds(Long[] roleIds) {
this.roleIds = roleIds;
}
public Long[] getPostIds() {
return postIds;
}
public void setPostIds(Long[] postIds) {
this.postIds = postIds;
}
public Long getRoleId() {
return roleId;
}
public void setRoleId(Long roleId) {
this.roleId = roleId;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).append("userId", getUserId())
.append("deptId", getDeptId()).append("userName", getUserName()).append("nickName", getNickName())
.append("email", getEmail()).append("phonenumber", getPhonenumber()).append("sex", getSex())
.append("avatar", getAvatar()).append("password", getPassword()).append("status", getStatus())
.append("delFlag", getDelFlag()).append("loginIp", getLoginIp()).append("loginDate", getLoginDate())
.append("createBy", getCreateBy()).append("createTime", getCreateTime())
.append("updateBy", getUpdateBy()).append("updateTime", getUpdateTime()).append("remark", getRemark())
.append("dept", getDept()).toString();
}
}

@ -1,71 +0,0 @@
package com.op.sap.mapper;
import com.op.common.core.domain.BaseFileData;
import com.op.sap.domain.SapBaseFile;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* Mapper
*
* @author Open Platform
* @date 2023-07-10
*/
@Mapper
public interface SapBaseFileMapper {
/**
*
*
* @param fileId
* @return
*/
public SapBaseFile selectBaseFileByFileId(String fileId);
/**
*
*
* @param baseFile
* @return
*/
public List<SapBaseFile> selectBaseFileList(SapBaseFile baseFile);
/**
*
*
* @param baseFile
* @return
*/
public int insertBaseFile(SapBaseFile baseFile);
/**
*
*
* @param baseFile
* @return
*/
public int updateBaseFile(SapBaseFile baseFile);
/**
*
*
* @param fileId
* @return
*/
public int deleteBaseFileByFileId(String fileId);
/**
*
*
* @param fileIds
* @return
*/
public int deleteBaseFileByFileIds(String[] fileIds);
Boolean insertBaseFileBatch(@Param("baseFiles") List<BaseFileData> baseFiles);
List<SapBaseFile> getBaseFileBatch(String processId);
void deleteBaseFileBySourceId(String processId);
}

@ -2,7 +2,8 @@ package com.op.sap.mapper;
import com.op.sap.domain.SapBaseProduct;
import com.op.system.api.domain.sap.SapBaseProduct;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@ -63,5 +64,5 @@ public interface SapBaseProductMapper {
*/
public int deleteBaseProductByProductIds(String[] productIds);
public String selectBaseProductIDByProductCode(String productCode);
public SapBaseProduct selectBaseProductByProductCode(SapBaseProduct sapBaseProduct);
}

@ -1,10 +1,6 @@
package com.op.sap.mapper;
import com.op.sap.domain.SapBom;
import com.op.sap.domain.SapBomComponent;
import java.util.List;
import com.op.system.api.domain.sap.SapBomComponent;
/**
* BOMMapper

@ -1,7 +1,7 @@
package com.op.sap.mapper;
import com.op.sap.domain.SapBom;
import com.op.sap.domain.SapBomComponent;
import com.op.system.api.domain.sap.SapBom;
import com.op.system.api.domain.sap.SapBomComponent;
import org.apache.ibatis.annotations.Mapper;
@Mapper

@ -1,6 +1,7 @@
package com.op.sap.mapper;
import com.op.sap.domain.SapProProcessContent;
import com.op.system.api.domain.sap.SapProProcessContent;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;

@ -1,6 +1,8 @@
package com.op.sap.mapper;
import com.op.sap.domain.SapProProcess;
import com.op.system.api.domain.sap.SapProProcess;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@ -67,5 +69,5 @@ public interface SapProProcessMapper
*/
public int deleteProProcessByProcessIds(String[] processIds);
int selectProProcessByProcessName(String processName);
public SapProProcess selectProProcessByProcessName(SapProProcess sapProProcess);
}

@ -1,6 +1,8 @@
package com.op.sap.mapper;
import com.op.sap.domain.SapProRoute;
import com.op.system.api.domain.sap.SapProRoute;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@ -78,6 +80,6 @@ public interface SapProRouteMapper {
* @return
*/
List<SapProRoute> selectAllRoute();
int selectProRouteByRouteCode(String routeCode);
SapProRoute selectProRouteByRouteCode(String routeCode);
}

@ -1,6 +1,7 @@
package com.op.sap.mapper;
import com.op.sap.domain.SapProRouteProcess;
import com.op.system.api.domain.sap.SapProRouteProcess;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;

@ -1,6 +1,8 @@
package com.op.sap.mapper;
import com.op.sap.domain.SapProRouteProduct;
import com.op.system.api.domain.sap.SapProRouteProduct;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;

@ -1,119 +0,0 @@
package com.op.sap.mapper;
import com.op.system.api.domain.SysDept;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
*
*
* @author OP
*/
public interface SapSysDeptMapper {
/**
*
*
* @param dept
* @return
*/
public List<SysDept> selectDeptList(SysDept dept);
/**
* ID
*
* @param roleId ID
* @param deptCheckStrictly
* @return
*/
public List<Long> selectDeptListByRoleId(@Param("roleId") Long roleId,
@Param("deptCheckStrictly") boolean deptCheckStrictly);
/**
* ID
*
* @param deptId ID
* @return
*/
public SysDept selectDeptById(Long deptId);
/**
* ID
*
* @param deptId ID
* @return
*/
public List<SysDept> selectChildrenDeptById(Long deptId);
/**
* ID
*
* @param deptId ID
* @return
*/
public int selectNormalChildrenDeptById(Long deptId);
/**
*
*
* @param deptId ID
* @return
*/
public int hasChildByDeptId(Long deptId);
/**
*
*
* @param deptId ID
* @return
*/
public int checkDeptExistUser(Long deptId);
/**
*
*
* @param deptName
* @param parentId ID
* @return
*/
public SysDept checkDeptNameUnique(@Param("deptName") String deptName, @Param("parentId") Long parentId);
/**
*
*
* @param dept
* @return
*/
public int insertDept(SysDept dept);
/**
*
*
* @param dept
* @return
*/
public int updateDept(SysDept dept);
/**
*
*
* @param deptIds ID
*/
public void updateDeptStatusNormal(Long[] deptIds);
/**
*
*
* @param depts
* @return
*/
public int updateDeptChildren(@Param("depts") List<SysDept> depts);
/**
*
*
* @param deptId ID
* @return
*/
public int deleteDeptById(Long deptId);
}

@ -1,134 +0,0 @@
package com.op.sap.mapper;
import com.op.sap.domain.SapSysUser;
import com.op.system.api.domain.SysUser;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
*
*
* @author OP
*/
public interface SapSysUserMapper {
/**
*
*
* @param sysUser
* @return
*/
public List<SapSysUser> selectUserList(SapSysUser sysUser);
/**
*
*
* @param user
* @return
*/
public List<SapSysUser> selectAllocatedList(SapSysUser user);
/**
*
*
* @param user
* @return
*/
public List<SapSysUser> selectUnallocatedList(SapSysUser user);
/**
*
*
* @param userName
* @return
*/
public SapSysUser selectUserByUserName(String userName);
/**
* ID
*
* @param userId ID
* @return
*/
public SapSysUser selectUserById(Long userId);
/**
*
*
* @param user
* @return
*/
public int insertUser(SapSysUser user);
/**
*
*
* @param user
* @return
*/
public int updateUser(SapSysUser user);
/**
*
*
* @param userName
* @param avatar
* @return
*/
public int updateUserAvatar(@Param("userName") String userName, @Param("avatar") String avatar);
/**
*
*
* @param userName
* @param password
* @return
*/
public int resetUserPwd(@Param("userName") String userName, @Param("password") String password);
/**
* ID
*
* @param userId ID
* @return
*/
public int deleteUserById(Long userId);
/**
*
*
* @param userIds ID
* @return
*/
public int deleteUserByIds(Long[] userIds);
/**
*
*
* @param userName
* @return
*/
public SapSysUser checkUserNameUnique(String userName);
/**
*
*
* @param phonenumber
* @return
*/
public SapSysUser checkPhoneUnique(String phonenumber);
/**
* email
*
* @param email
* @return
*/
public SapSysUser checkEmailUnique(String email);
public List<Map<String, String>> getPoolNameList(SapSysUser user);
public String getPoolName(String poolName);
Integer getNums();
}

@ -2,7 +2,9 @@ package com.op.sap.service;
import com.op.sap.domain.SapBaseProduct;
import com.op.common.core.domain.R;
import com.op.system.api.domain.sap.SapBaseProduct;
import java.util.List;
@ -63,7 +65,7 @@ public interface ISapBaseProductService {
public String selectBaseProductIDByProductCode(String productCode);
public SapBaseProduct selectBaseProductByProductCode(SapBaseProduct sapBaseProduct);

@ -1,64 +0,0 @@
package com.op.sap.service;
import com.op.common.core.domain.BaseFileData;
import com.op.sap.domain.SapBaseFile;
import java.util.List;
/**
* Service
*
* @author Open Platform
* @date 2023-07-10
*/
public interface SapBaseFileService {
/**
*
*
* @param fileId
* @return
*/
public SapBaseFile selectBaseFileByFileId(String fileId);
/**
*
*
* @param baseFile
* @return
*/
public List<SapBaseFile> selectBaseFileList(SapBaseFile baseFile);
/**
*
*
* @param baseFile
* @return
*/
public int insertBaseFile(SapBaseFile baseFile);
/**
*
*
* @param baseFile
* @return
*/
public int updateBaseFile(SapBaseFile baseFile);
/**
*
*
* @param fileIds
* @return
*/
public int deleteBaseFileByFileIds(String[] fileIds);
/**
*
*
* @param fileId
* @return
*/
public int deleteBaseFileByFileId(String fileId);
public Boolean insertBaseFileBatch(List<BaseFileData> baseFiles);
}

@ -1,10 +1,8 @@
package com.op.sap.service;
import com.op.common.core.domain.R;
import com.op.common.core.web.domain.AjaxResult;
import com.op.sap.domain.SapBom;
import java.util.List;
public interface SapBomService {
public AjaxResult bomSync();
public R bomSync();
}

@ -1,6 +1,7 @@
package com.op.sap.service;
import com.op.common.core.domain.R;
import com.op.common.core.web.domain.AjaxResult;
import com.op.system.api.domain.sap.SapCreateOrder;
import com.op.system.api.domain.sap.SapRFW;
import com.op.system.api.model.SapProOrder;
@ -10,7 +11,6 @@ import java.util.List;
public interface SapOrderService {
R<List<SapProOrder>> shopOrderSync(SapProOrder sapProOrder);
R<List<String>> SapCreateOrder(List<SapCreateOrder> sapCreateOrderList);
R sapCloseOrder(String shopOrder);

@ -1,63 +0,0 @@
package com.op.sap.service;
import com.op.sap.domain.SapProRouteProduct;
import java.util.List;
/**
* 线Service
*
* @author Open Platform
* @date 2023-07-13
*/
public interface SapProRouteProductService {
/**
* 线
*
* @param recordId 线
* @return 线
*/
public SapProRouteProduct selectProRouteProductByRecordId(String recordId);
/**
* 线
*
* @param proRouteProduct 线
* @return 线
*/
public List<SapProRouteProduct> selectProRouteProductList(SapProRouteProduct proRouteProduct);
/**
* 线
*
* @param proRouteProduct 线
* @return
*/
public int insertProRouteProduct(SapProRouteProduct proRouteProduct);
/**
* 线
*
* @param proRouteProduct 线
* @return
*/
public int updateProRouteProduct(SapProRouteProduct proRouteProduct);
/**
* 线
*
* @param recordIds 线
* @return
*/
public int deleteProRouteProductByRecordIds(String[] recordIds);
/**
* 线
*
* @param recordId 线
* @return
*/
public int deleteProRouteProductByRecordId(String recordId);
SapProRouteProduct getList(SapProRouteProduct proRouteProduct);
}

@ -1,76 +0,0 @@
package com.op.sap.service;
import com.op.sap.domain.SapProRoute;
import java.util.List;
/**
* 线Service
*
* @author yinjinlu
* @date 2022-05-12
*/
public interface SapProRouteService
{
/**
* 线
*
* @param routeId 线
* @return 线
*/
public SapProRoute selectProRouteByRouteId(String routeId);
/**
* 线
*
* @param proRoute 线
* @return 线
*/
public List<SapProRoute> selectProRouteList(SapProRoute proRoute);
/**
* 线
* @param itemId
* @return
*/
public SapProRoute getRouteByProductId(String itemId);
public Boolean checkRouteCodeUnique(SapProRoute proRoute);
/**
* 线
*
* @param proRoute 线
* @return
*/
public int insertProRoute(SapProRoute proRoute);
/**
* 线
*
* @param proRoute 线
* @return
*/
public int updateProRoute(SapProRoute proRoute);
/**
* 线
*
* @param routeIds 线
* @return
*/
public int deleteProRouteByRouteIds(String[] routeIds);
/**
* 线
*
* @param routeId 线
* @return
*/
public int deleteProRouteByRouteId(String routeId);
public int batchInsertProRoute(SapProRoute proRoute);
//查询工艺路线是否存在
int selectProRrouteByRouteCode(String routeCode);
}

@ -0,0 +1,9 @@
package com.op.sap.service;
import com.op.common.core.domain.R;
import com.op.common.core.web.domain.AjaxResult;
public interface SapRouterService {
R sapRouterSync();
}

@ -1,25 +0,0 @@
package com.op.sap.service;
import com.op.common.core.domain.R;
import com.op.system.api.model.SapProOrder;
import java.util.List;
public interface SapService {
// R<Boolean> sapItem();
// R<Boolean> sapBom();
//
// R<Boolean> sapProRoute();
// R<Boolean> sapProRouteProduct();
R<Boolean> sapProRouteProcess();
//
//
//
// List<SapProOrder> shopOrderSync(SapProOrder sapProOrder);
}

@ -1,110 +0,0 @@
package com.op.sap.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.common.core.domain.BaseFileData;
import com.op.common.core.utils.DateUtils;
import com.op.sap.domain.SapBaseFile;
import com.op.sap.mapper.SapBaseFileMapper;
import com.op.sap.service.SapBaseFileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* Service
*
* @author Open Platform
* @date 2023-07-10
*/
@Service
public class SapBaseFileServiceImpl implements SapBaseFileService {
@Autowired
private SapBaseFileMapper baseFileMapper;
/**
*
*
* @param fileId
* @return
*/
@Override
@DS("#header.poolName")
public SapBaseFile selectBaseFileByFileId(String fileId) {
return baseFileMapper.selectBaseFileByFileId(fileId);
}
/**
*
*
* @param baseFile
* @return
*/
@Override
@DS("#header.poolName")
public List<SapBaseFile> selectBaseFileList(SapBaseFile baseFile) {
return baseFileMapper.selectBaseFileList(baseFile);
}
/**
*
*
* @param baseFile
* @return
*/
@Override
@DS("#header.poolName")
public int insertBaseFile(SapBaseFile baseFile) {
baseFile.setCreateTime(DateUtils.getNowDate());
return baseFileMapper.insertBaseFile(baseFile);
}
/**
*
*
* @param baseFile
* @return
*/
@Override
@DS("#header.poolName")
public int updateBaseFile(SapBaseFile baseFile) {
baseFile.setUpdateTime(DateUtils.getNowDate());
return baseFileMapper.updateBaseFile(baseFile);
}
/**
*
*
* @param fileIds
* @return
*/
@Override
@DS("#header.poolName")
public int deleteBaseFileByFileIds(String[] fileIds) {
return baseFileMapper.deleteBaseFileByFileIds(fileIds);
}
/**
*
*
* @param fileId
* @return
*/
@Override
@DS("#header.poolName")
public int deleteBaseFileByFileId(String fileId) {
return baseFileMapper.deleteBaseFileByFileId(fileId);
}
/**
*
*
* @param baseFiles
* @return
*/
@Override
@DS("#header.poolName")
public Boolean insertBaseFileBatch(List<BaseFileData> baseFiles) {
return baseFileMapper.insertBaseFileBatch(baseFiles);
}
}

@ -1,14 +1,22 @@
package com.op.sap.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
import com.op.common.core.domain.R;
import com.op.common.core.utils.DateUtils;
import com.op.common.security.utils.SecurityUtils;
import com.op.sap.domain.SapBaseProduct;
import com.op.sap.mapper.SapBaseProductMapper;
import com.op.sap.service.ISapBaseProductService;
import com.op.sap.util.SAPConnUtils;
import com.op.system.api.RemotePlanService;
import com.op.system.api.domain.sap.SapBaseProduct;
import com.sap.conn.jco.*;
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.List;
/**
@ -102,8 +110,8 @@ public class SapBaseProductServiceImpl implements ISapBaseProductService {
}
@Override
public String selectBaseProductIDByProductCode(String productCode) {
return baseProductMapper.selectBaseProductIDByProductCode(productCode);
public SapBaseProduct selectBaseProductByProductCode(SapBaseProduct sapBaseProduct) {
return baseProductMapper.selectBaseProductByProductCode(sapBaseProduct);
}

@ -2,24 +2,21 @@ package com.op.sap.service.impl;
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
import com.op.common.core.constant.Constants;
import com.op.common.core.domain.R;
import com.op.common.core.exception.ServiceException;
import com.op.common.core.utils.DateUtils;
import com.op.common.core.web.domain.AjaxResult;
import com.op.sap.domain.SapBom;
import com.op.sap.domain.SapBomComponent;
import com.op.sap.domain.SapConn;
import com.op.system.api.domain.sap.SapBom;
import com.op.system.api.domain.sap.SapBomComponent;
import com.op.sap.mapper.SapBomComponentMapper;
import com.op.sap.mapper.SapBomMapper;
import com.op.sap.service.SapBomService;
import com.op.sap.util.SAPConnUtils;
import com.op.system.api.model.SapProOrder;
import com.sap.conn.jco.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
@ -36,7 +33,7 @@ public class SapBomServiceImpl implements SapBomService {
private SapBomComponentMapper sapBomComponentMapper;
@Override
public AjaxResult bomSync() {
public R bomSync() {
try {
// 获取调用 RFC 函数对象
@ -54,11 +51,17 @@ public class SapBomServiceImpl implements SapBomService {
// jCoTable.setValue(Constants.OPTION, "EQ");
// jCoTable.setValue(Constants.LOW, "00012222");
JCoTable jCoTables = func.getTableParameterList().getTable("S_STLNR");
JCoTable jCoTables = func.getTableParameterList().getTable("S_MATNR");
jCoTables.appendRow();
jCoTables.setValue(Constants.SIGN, "I");
jCoTables.setValue(Constants.OPTION, "EQ");
jCoTables.setValue(Constants.LOW, "00012222");
jCoTables.setValue(Constants.LOW, "000000010101000115");
JCoTable S_WERKS_jCoTables = func.getTableParameterList().getTable("S_WERKS");
S_WERKS_jCoTables.appendRow();
S_WERKS_jCoTables.setValue(Constants.SIGN, "I");
S_WERKS_jCoTables.setValue(Constants.OPTION, "EQ");
S_WERKS_jCoTables.setValue(Constants.LOW, "1000");
// 获取调用 RFC 函数对象
func.execute(dest);
// 获取 内表 - ZMES_PRO
@ -112,7 +115,7 @@ public class SapBomServiceImpl implements SapBomService {
+ " - 生产版本有效期:" + ADATU + " - 生产版本截止日期:" + BDATU + " - BOM计算数量" + LOSGR +
" - BOM计算单位" + MEINS +
" - BOM基本数量" + BMENG + " - BOM基本单位" + BMEIN + " - BOM层次" + STUFE + " - 项目编号:" + WEGXX
+ " - 组件编码:" + PMATNR + " - 组件上层物料编码:" + OJTXB + " - 组件名称:" + PMAKTX
+ " - 组件编码:" + PMATNR + " - 组件名称:" + PMAKTX + " - 组件上层物料名称:" + OJTXB
+ " - 标准用量:" + PMENGE + " - 损耗率:" + PAUSCH + " - 损耗额:" + PXHLCE + " - 含损耗用量:" + PMNGKO
+ " - 组件数量单位:" + PMEINS + " - 组件采购标志:" + PBESKZ + " - 物料供应标识:" + BEIKZ + " - 物料供应标识:" + BEIKZ_NM
+ " - 成本核算标识相关:" + SANKA);
@ -152,9 +155,9 @@ public class SapBomServiceImpl implements SapBomService {
// sapBomComponentMapper.insertSapBomComponent(sapBomComponent);
}
// inserBaseBom(sapBomList);
return AjaxResult.success();
return R.ok();
} catch (Exception e) {
throw new ServiceException(e.getMessage());
return R.fail(e.getMessage());
}
}

@ -4,14 +4,18 @@ import com.op.common.core.domain.R;
import com.op.common.core.utils.DateUtils;
import com.op.common.core.utils.StringUtils;
import com.op.common.core.utils.uuid.IdUtils;
import com.op.common.core.web.domain.AjaxResult;
import com.op.sap.service.SapOrderService;
import com.op.sap.util.SAPConnUtils;
import com.op.system.api.domain.sap.SapCreateOrder;
import com.op.system.api.domain.sap.SapRFW;
import com.op.system.api.model.SapProOrder;
import com.sap.conn.jco.*;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
@ -37,6 +41,8 @@ public class SapOrderServiceImpl implements SapOrderService {
jCoTable.setValue("SIGN", "I");
jCoTable.setValue("OPTION", "EQ");
jCoTable.setValue("LOW", DateUtils.parseDateToStr("yyyyMMdd", sapProOrder.getCreateTime()));
func.execute(dest);//执行调用函数
// 获取 内表 - ZMES_PRO
JCoTable maraTable = func.getTableParameterList().getTable("ZMES_PRO");
@ -90,7 +96,7 @@ public class SapOrderServiceImpl implements SapOrderService {
return R.ok(proOrderList);
} catch (Exception e) {
return R.fail(e.getMessage());
return null;
}
}
@ -157,15 +163,15 @@ public class SapOrderServiceImpl implements SapOrderService {
if (StringUtils.isEmpty(shopOrder)){
return R.fail("订单号为空");
}
jCoParameterList.setValue("P_AUFNR",shopOrder);
func.execute(dest);//执行调用函数
JCoParameterList J= func.getExportParameterList();
System.out.println(J);
L_MSG= func.getExportParameterList().getString("L_MSG");
if (StringUtils.isEmpty(L_MSG)){
return R.fail("订单关闭失败");
}
return R.ok(L_MSG);
jCoParameterList.setValue("P_AUFNR",shopOrder);
func.execute(dest);//执行调用函数
JCoParameterList J= func.getExportParameterList();
System.out.println(J);
L_MSG= func.getExportParameterList().getString("L_MSG");
if (StringUtils.isEmpty(L_MSG)){
return R.fail("订单关闭失败");
}
return R.ok(L_MSG);
}catch (Exception e){
return R.fail(e.getMessage());
@ -228,7 +234,7 @@ public class SapOrderServiceImpl implements SapOrderService {
System.out.println(J);
MESSAGE= func.getExportParameterList().getString("MESSAGE");
if (StringUtils.isEmpty(MESSAGE)){
return R.fail("订单关闭失败");
return R.fail("订单号:"+sapRFW.getAufnr()+"报工失败");
}
return R.ok(MESSAGE);

@ -1,132 +0,0 @@
package com.op.sap.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.common.core.utils.DateUtils;
import com.op.common.core.utils.uuid.IdUtils;
import com.op.common.security.utils.SecurityUtils;
import com.op.sap.domain.SapProRouteProduct;
import com.op.sap.mapper.SapProRouteProductMapper;
import com.op.sap.service.SapProRouteProductService;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
* 线Service
*
* @author Open Platform
* @date 2023-07-13
*/
@Service
public class SapProRouteProductServiceImpl implements SapProRouteProductService {
@Autowired
private SapProRouteProductMapper proRouteProductMapper;
/**
* 线
*
* @param recordId 线
* @return 线
*/
@Override
@DS("#header.poolName")
public SapProRouteProduct selectProRouteProductByRecordId(String recordId) {
return proRouteProductMapper.selectProRouteProductByRecordId(recordId);
}
/**
* 线
*
* @param proRouteProduct 线
* @return 线
*/
@Override
@DS("#header.poolName")
public List<SapProRouteProduct> selectProRouteProductList(SapProRouteProduct proRouteProduct) {
return proRouteProductMapper.selectProRouteProductList(proRouteProduct);
}
/**
* 线
*
* @param proRouteProduct 线
* @return
*/
@Override
@DS("#header.poolName")
public int insertProRouteProduct(SapProRouteProduct proRouteProduct) {
Date now = DateUtils.getNowDate();
if(StringUtils.isNotBlank(proRouteProduct.getRouteId())){
//删除之前的关联关系
proRouteProductMapper.deleteByRouteId(proRouteProduct);
}
if(proRouteProduct.getSelectedValues()!=null){
SapProRouteProduct proRouteProductDto =null;
for(String ProductCode:proRouteProduct.getSelectedValues()){
//查询物料编码对应的各种信息
proRouteProductDto = new SapProRouteProduct();
proRouteProductDto.setRecordId(IdUtils.fastSimpleUUID());
proRouteProductDto.setCreateTime(now);
proRouteProductDto.setCreateBy(SecurityUtils.getUsername());
proRouteProductDto.setRouteId(proRouteProduct.getRouteId());
proRouteProductDto.setItemId(proRouteProduct.getItemId());
proRouteProductDto.setItemCode(ProductCode);
proRouteProductDto.setItemName(proRouteProduct.getItemName());
proRouteProductMapper.insertProRouteProduct(proRouteProductDto);
}
}
//新增关联关系
return 1;
}
/**
* 线
*
* @param proRouteProduct 线
* @return
*/
@Override
@DS("#header.poolName")
public int updateProRouteProduct(SapProRouteProduct proRouteProduct) {
proRouteProduct.setUpdateTime(DateUtils.getNowDate());
return proRouteProductMapper.updateProRouteProduct(proRouteProduct);
}
/**
* 线
*
* @param recordIds 线
* @return
*/
@Override
@DS("#header.poolName")
public int deleteProRouteProductByRecordIds(String[] recordIds) {
return proRouteProductMapper.deleteProRouteProductByRecordIds(recordIds);
}
/**
* 线
*
* @param recordId 线
* @return
*/
@Override
@DS("#header.poolName")
public int deleteProRouteProductByRecordId(String recordId) {
return proRouteProductMapper.deleteProRouteProductByRecordId(recordId);
}
@Override
@DS("#header.poolName")
public SapProRouteProduct getList(SapProRouteProduct proRouteProduct) {
SapProRouteProduct dto = new SapProRouteProduct();
List<SapProRouteProduct> unSelected = proRouteProductMapper.getRouteProdProductListUndo(proRouteProduct);
dto.setUnSelect(unSelected);
List<SapProRouteProduct> selected= proRouteProductMapper.getRouteProdProductListDo(proRouteProduct);
dto.setSelected(selected);
return dto;
}
}

@ -1,210 +0,0 @@
package com.op.sap.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.common.core.constant.UserConstants;
import com.op.common.core.domain.BaseFileData;
import com.op.common.core.utils.DateUtils;
import com.op.common.core.utils.StringUtils;
import com.op.common.core.utils.uuid.IdUtils;
import com.op.common.security.utils.SecurityUtils;
import com.op.sap.domain.SapBaseFile;
import com.op.sap.domain.SapProRoute;
import com.op.sap.mapper.SapBaseFileMapper;
import com.op.sap.mapper.SapProRouteMapper;
import com.op.sap.service.SapProRouteService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* 线Service
*
* @author yinjinlu
* @date 2022-05-12
*/
@Service
public class SapProRouteServiceImpl implements SapProRouteService {
@Autowired
private SapProRouteMapper proRouteMapper;
@Autowired
private SapBaseFileMapper baseFileMapper;
/**
* 线
*
* @param routeId 线
* @return 线
*/
@Override
@DS("#header.poolName")
public SapProRoute selectProRouteByRouteId(String routeId) {
SapProRoute p = proRouteMapper.selectProRouteByRouteId(routeId);
List<SapBaseFile> files = baseFileMapper.getBaseFileBatch(routeId);
if (!CollectionUtils.isEmpty(files)) {
p.setFiles(files);
}
return p;
}
/**
* 线
*
* @param proRoute 线
* @return 线
*/
@Override
@DS("#header.poolName")
public List<SapProRoute> selectProRouteList(SapProRoute proRoute) {
return proRouteMapper.selectProRouteList(proRoute);
}
@Override
public SapProRoute getRouteByProductId(String itemId) {
return proRouteMapper.getRouteByProductId(itemId);
}
@Override
@DS("#header.poolName")
public Boolean checkRouteCodeUnique(SapProRoute proRoute) {
SapProRoute route = proRouteMapper.checkRouteCodeUnique(proRoute);
String routeId = proRoute.getRouteId();
if (StringUtils.isNotNull(route) && !route.getRouteId().equals(routeId)) {
return UserConstants.NOT_UNIQUE;
}
return UserConstants.UNIQUE;
}
/**
* 线
*
* @param proRoute 线
* @return
*/
@Override
@DS("#header.poolName")
public int insertProRoute(SapProRoute proRoute) {
proRoute.setCreateTime(DateUtils.getNowDate());
proRoute.setRouteVersion("V.1");
//上传附件
if (StringUtils.isNotEmpty(proRoute.getFileList())) {
String[] ids = proRoute.getFileList().split(",");
List<BaseFileData> files = new ArrayList<>();
BaseFileData file = null;
for (String id : ids) {
file = new BaseFileData();
file.setFileId(IdUtils.fastSimpleUUID());
file.setFileName(id.split("&fileName=")[1]);
file.setFileAddress(id);
file.setSourceId(proRoute.getRouteId());
file.setCreateBy(SecurityUtils.getUsername());
file.setCreateTime(new Date());
files.add(file);
}
baseFileMapper.insertBaseFileBatch(files);
}
return proRouteMapper.insertProRoute(proRoute);
}
/**
* 线
*
* @param proRoute 线
* @return
*/
@Override
@DS("#header.poolName")
public int updateProRoute(SapProRoute proRoute) {
proRoute.setUpdateTime(DateUtils.getNowDate());
baseFileMapper.deleteBaseFileBySourceId(proRoute.getRouteId());
//上传附件
if (StringUtils.isNotEmpty(proRoute.getFileList())) {
String[] ids = proRoute.getFileList().split(",");
List<BaseFileData> files = new ArrayList<>();
BaseFileData file = null;
for (String id : ids) {
file = new BaseFileData();
file.setFileId(IdUtils.fastSimpleUUID());
file.setFileAddress(id);
file.setFileName(id.split("&fileName=")[1]);
file.setSourceId(proRoute.getRouteId());
file.setCreateBy(SecurityUtils.getUsername());
file.setCreateTime(new Date());
files.add(file);
}
baseFileMapper.insertBaseFileBatch(files);
}
//更新版本V.1->递增
String nowRouteVersion = proRoute.getRouteVersion().replace("V", "")
.replace(".", "");
int nowRouteVersionNum = Integer.parseInt(nowRouteVersion);
String newRouteVersionNum = "V." + (++nowRouteVersionNum);
proRoute.setRouteVersion(newRouteVersionNum);
return proRouteMapper.updateProRoute(proRoute);
}
/**
* 线
*
* @param routeIds 线
* @return
*/
@Override
@DS("#header.poolName")
public int deleteProRouteByRouteIds(String[] routeIds) {
return proRouteMapper.deleteProRouteByRouteIds(routeIds);
}
/**
* 线
*
* @param routeId 线
* @return
*/
@Override
@DS("#header.poolName")
public int deleteProRouteByRouteId(String routeId) {
return proRouteMapper.deleteProRouteByRouteId(routeId);
}
@Override
@DS("#header.poolName")
public int batchInsertProRoute(SapProRoute proRoute) {
proRoute.setCreateTime(DateUtils.getNowDate());
if (StringUtils.isNotEmpty(proRoute.getFileList())) {
List<String> ids = proRoute.getIdList();
// for (int j = ids.size(); j < 1; j--) {
for (String id :ids) {
String[] f = proRoute.getFileList().split(",");
List<BaseFileData> files = new ArrayList<>();
BaseFileData file = null;
for (String file1 : f) {
file = new BaseFileData();
file.setFileId(IdUtils.fastSimpleUUID());
file.setFileName(file1.split("&fileName=")[1]);
file.setFileAddress(file1);
file.setSourceId(id);
file.setCreateBy(SecurityUtils.getUsername());
file.setCreateTime(new Date());
files.add(file);
}
baseFileMapper.insertBaseFileBatch(files);
}
}
return 1;
}
@Override
public int selectProRrouteByRouteCode(String routeCode) {
return proRouteMapper.selectProRouteByRouteCode(routeCode);
}
}

@ -0,0 +1,261 @@
package com.op.sap.service.impl;
import com.alibaba.csp.sentinel.util.StringUtil;
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
import com.op.common.core.domain.R;
import com.op.common.core.exception.ServiceException;
import com.op.common.core.utils.DateUtils;
import com.op.common.core.utils.uuid.IdUtils;
import com.op.common.core.utils.uuid.UUID;
import com.op.common.core.web.domain.AjaxResult;
import com.op.sap.mapper.*;
import com.op.sap.service.SapRouterService;
import com.op.sap.util.SAPConnUtils;
import com.op.system.api.domain.sap.*;
import com.sap.conn.jco.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.server.ServerErrorException;
import java.rmi.ServerException;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.TreeSet;
import java.util.stream.Collectors;
@Service
public class SapRouterServiceImpl implements SapRouterService {
@Autowired
private SapProProcessMapper sapProProcessMapper;
@Autowired
private SapProProcessContentMapper sapProProcessContentMapper;
@Autowired
private SapProRouteMapper sapProRouteMapper;
@Autowired
private SapProRouteProductMapper sapProRouteProductMapper;
@Autowired
private SapProRouteProcessMapper sapProRouteProcessMapper;
@Autowired
private SapBaseProductMapper sapBaseProductMapper;
@Override
public R sapRouterSync() {
try {
// 获取调用 RFC 函数对象
//获取连接
JCoDestination dest = SAPConnUtils.connect();
JCoRepository repository = dest.getRepository();
JCoFunction func = repository.getFunction("ZPPR_MES_ROUTING");
if (func == null) {
throw new RuntimeException("Function does not exist in SAP");
}
// 配置传入参数
JCoTable jCoTable = func.getTableParameterList().getTable("S_WERKS");
jCoTable.appendRow();
jCoTable.setValue("SIGN", "I");
jCoTable.setValue("OPTION", "EQ");
jCoTable.setValue("LOW", "1000");
func.execute(dest);//执行调用函数
// 获取 内表 - ZMES_PRO
JCoTable maraTable = func.getTableParameterList().getTable("LT_ROUTING");
JCoRecordMetaData metaData = maraTable.getRecordMetaData();
System.out.println("###" + metaData.toString());
DynamicDataSourceContextHolder.push("ds_1000");
for (int i = 0; i <maraTable.getNumRows(); i++) {
SapProProcess sapProProcess=new SapProProcess();
maraTable.setRow(i);
String WERKS = maraTable.getString("WERKS");
String PLNTY = maraTable.getString("PLNTY");
String PLNNR = maraTable.getString("PLNNR");
String PLNAL = maraTable.getString("PLNAL");
String LOEKZ = maraTable.getString("LOEKZ");
String MATNR = maraTable.getString("MATNR");
String MAKTX = maraTable.getString("MAKTX");
String VERWE = maraTable.getString("VERWE");
String STATU = maraTable.getString("STATU");
String LOSVN = maraTable.getString("LOSVN");
String LOSBS = maraTable.getString("LOSBS");
String KTEXT = maraTable.getString("KTEXT");
String VORNR = maraTable.getString("VORNR");
String STEUS = maraTable.getString("STEUS");
String KTSCH = maraTable.getString("KTSCH");
String LTXA1 = maraTable.getString("LTXA1");
String ANDAT = maraTable.getString("ANDAT");
String ANNAM = maraTable.getString("ANNAM");
String AEDAT = maraTable.getString("AEDAT");
String AENAM = maraTable.getString("AENAM");
String ARBPL = maraTable.getString("ARBPL");
String UMREN = maraTable.getString("UMREN");
String UMREZ = maraTable.getString("UMREZ");
String BMSCH = maraTable.getString("BMSCH");
String MEINH = maraTable.getString("MEINH");
String LAR01 = maraTable.getString("LAR01");
String VGW01 = maraTable.getString("VGW01");
String VGE01 = maraTable.getString("VGE01");
String VGW02 = maraTable.getString("VGW02");
String VGE02 = maraTable.getString("VGE02");
String VGW03 = maraTable.getString("VGW03");
String VGE03 = maraTable.getString("VGE03");
String VGW04 = maraTable.getString("VGW04");
String VGE04 = maraTable.getString("VGE04");
String VGW05 = maraTable.getString("VGW05");
String VGE05 = maraTable.getString("VGE05");
String VGW06 = maraTable.getString("VGW06");
String VGE06 = maraTable.getString("VGE06");
String UEMUS = maraTable.getString("UEMUS");
String UEKAN = maraTable.getString("UEKAN");
String FLIES = maraTable.getString("FLIES");
String SPMUS = maraTable.getString("SPMUS");
String SPLIM = maraTable.getString("SPLIM");
String CKSELKZ = maraTable.getString("CKSELKZ");
System.out.println(
"工厂:" + WERKS+
"任务清单类型:" + PLNTY+
"任务清单组码:" + PLNNR+
"组计数器:" + PLNAL+
"删除标识:" + LOEKZ+
"物料号:" + MATNR+
"物料描述:" + MAKTX+
"任务清单描述:" + KTEXT+
" 操作/活动编号:" + VORNR+
"控制码:" + STEUS+
"工序短文本:" + LTXA1+
"创建日期:" + ANDAT+
"创建者:" + ANNAM+
"更改日期:" + AEDAT+
"更改者:" + AENAM+
"工作中心:" + ARBPL+
"基本数量:" + BMSCH+
"工序计量单位:" + MEINH+
"标准值01" + VGW01+
"计量单位01" + VGE01+
"标准值02" + VGE02+
"计量单位02" + VGE02+
"标准值03" + VGE03+
"计量单位03" + VGE03+
" 标准值04" + VGE04+
" 计量单位04" + VGE04);
// sapProProcess.setProcessName(LTXA1);
// sapProProcess.setWorkCenter(ARBPL);
// sapProProcessList.add(sapProProcess);
// sapProProcessList = sapProProcessList.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(SapProProcess::getProcessName))), ArrayList::new));
if (StringUtil.isBlank(PLNNR)) {
throw new ServiceException("任务清单组码不能为空");
}
//查询有无工艺路线
SapProRoute sapProRoute=sapProRouteMapper.selectProRouteByRouteCode(PLNNR);
//如果工艺路线存在,去查询工艺路线对应成品
// Float revision = new Float(1.0);
if (sapProRoute==null){
/**
*
*/
sapProProcess.setProcessName(LTXA1);
SapProProcess operation = sapProProcessMapper.selectProProcessByProcessName(sapProProcess);
if (operation == null) {
throw new ServiceException("工艺路线【" + PLNNR + "】下的工序【" + LTXA1 + "】不存在!");
}
SapBaseProduct sapBaseProduct=new SapBaseProduct();
sapBaseProduct.setProductCode(MATNR);
sapBaseProduct = sapBaseProductMapper.selectBaseProductByProductCode(sapBaseProduct);
if (sapBaseProduct==null){
throw new ServiceException("工艺路线【" + PLNNR + "】下的物料【" + MATNR + "】不存在!");
}
//添加工艺路线
sapProRoute=new SapProRoute();
String routerid = IdUtils.fastSimpleUUID();
sapProRoute.setRouteId(routerid);
sapProRoute.setRouteCode(PLNNR);
sapProRoute.setRouteName(KTEXT);
sapProRoute.setRouteDesc(KTEXT);
sapProRoute.setEnableFlag("Y");
sapProRoute.setCreateBy(ANNAM);
sapProRoute.setCreateTime(DateUtils.dateTime("yyyy-MM-dd", ANDAT));
sapProRoute.setRouteVersion("1.0");
sapProRouteMapper.insertProRoute(sapProRoute);
//增加工艺路线和工序的关系
SapProRouteProcess sapProRouteProcess=new SapProRouteProcess();
sapProRouteProcess.setRecordId(IdUtils.fastSimpleUUID());
sapProRouteProcess.setRouteId(routerid);
sapProRouteProcess.setProcessId(operation.getProcessId());
sapProRouteProcess.setProcessCode(operation.getProcessCode());
sapProRouteProcess.setProcessName(operation.getProcessName());
sapProRouteProcess.setOrderNum(1);
sapProRouteProcess.setCreateTime(DateUtils.dateTime("yyyy-MM-dd", ANDAT));
sapProRouteProcess.setCreateBy(ANNAM);
sapProRouteProcessMapper.insertProRouteProcess(sapProRouteProcess);
//增加与产品的关系
SapProRouteProduct sapProRouteProduct=new SapProRouteProduct();
sapProRouteProduct.setRecordId(IdUtils.fastSimpleUUID());
sapProRouteProduct.setRouteId(routerid);
sapProRouteProduct.setItemId(sapBaseProduct.getProductId());
sapProRouteProduct.setItemCode(MATNR);
sapProRouteProduct.setItemName(sapBaseProduct.getProductDescZh());
sapProRouteProduct.setCreateBy(ANNAM);
sapProRouteProduct.setCreateTime(DateUtils.dateTime("yyyy-MM-dd", ANDAT));
sapProRouteProductMapper.insertProRouteProduct(sapProRouteProduct);
}
else {
//工艺路线存在
SapProRouteProduct sapProRouteProduct=new SapProRouteProduct();
sapProRouteProduct.setRouteId(sapProRoute.getRouteId());
sapProRouteProduct.setItemCode(MATNR);
List<SapProRouteProduct> sapProRouteProductList=sapProRouteProductMapper.selectProRouteProductList(sapProRouteProduct);
if (sapProRouteProductList==null){
SapBaseProduct sapBaseProduct=new SapBaseProduct();
sapBaseProduct.setProductCode(MATNR);
sapBaseProduct = sapBaseProductMapper.selectBaseProductByProductCode(sapBaseProduct);
if (sapBaseProduct==null){
throw new ServiceException("工艺路线【" + PLNNR + "】下的物料【" + MATNR + "】不存在!");
}
sapProProcess.setProcessName(LTXA1);
SapProProcess operation = sapProProcessMapper.selectProProcessByProcessName(sapProProcess);
if (operation == null) {
throw new ServiceException("工艺路线【" + PLNNR + "】下的工序【" + LTXA1 + "】不存在!");
}
sapProRouteProduct.setRecordId(IdUtils.fastSimpleUUID());
sapProRouteProduct.setRouteId(sapProRoute.getRouteId());
sapProRouteProduct.setItemId(sapBaseProduct.getProductId());
sapProRouteProduct.setItemCode(MATNR);
sapProRouteProduct.setItemName(sapBaseProduct.getProductDescZh());
sapProRouteProduct.setCreateBy(ANNAM);
sapProRouteProduct.setCreateTime(DateUtils.dateTime("yyyy-MM-dd", ANDAT));
//增加工艺路线和工序的关系
SapProRouteProcess sapProRouteProcess=new SapProRouteProcess();
sapProRouteProcess.setRecordId(IdUtils.fastSimpleUUID());
sapProRouteProcess.setRouteId(sapProRoute.getRouteId());
sapProRouteProcess.setProcessId(operation.getProcessId());
sapProRouteProcess.setProcessCode(operation.getProcessCode());
sapProRouteProcess.setProcessName(operation.getProcessName());
sapProRouteProcess.setOrderNum(1);
sapProRouteProcess.setCreateTime(DateUtils.dateTime("yyyy-MM-dd", ANDAT));
sapProRouteProcess.setCreateBy(ANNAM);
sapProRouteProductMapper.insertProRouteProduct(sapProRouteProduct);
sapProRouteProcessMapper.insertProRouteProcess(sapProRouteProcess);
}
}
}
}catch (Exception e){
return R.fail(e.getMessage());
}
return null;
}
}

@ -1,937 +0,0 @@
package com.op.sap.service.impl;
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
import com.op.common.core.constant.Constants;
import com.op.common.core.domain.R;
import com.op.common.core.utils.DateUtils;
import com.op.common.core.utils.uuid.IdUtils;
import com.op.common.core.utils.uuid.UUID;
import com.op.sap.domain.*;
import com.op.sap.mapper.*;
import com.op.sap.service.ISapBaseProductService;
import com.op.sap.service.SapService;
import com.op.sap.util.SAPConnUtils;
import com.op.system.api.model.SapProOrder;
import com.sap.conn.jco.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
@Service
public class SapServiceImpl implements SapService {
// @Autowired
// private RemotePlanService remotePlanService;
@Autowired
private ISapBaseProductService sapBaseProductService;
@Autowired
private SapSysDeptMapper sapSysDeptMapper;
@Autowired
private SapSysUserMapper sapSysUserMapper;
@Autowired
private SapBaseProductMapper sapBaseProductMapper;
@Autowired
private SapProRouteMapper sapProRouteMapper;
@Autowired
private SapProRouteProductMapper sapProRouteProductMapper;
@Autowired
private SapProProcessMapper sapProProcessMapper;
@Autowired
private SapProProcessContentMapper sapProProcessContentMapper;
@Autowired
private SapProRouteProcessMapper sapProRouteProcessMapper;
// @Override
// public List<SapProOrder> shopOrderSync(SapProOrder sapProOrder) {
//
//
// // 连接
// SapConn con = new SapConn(
// ashost,
// sysnr,
// client,
// user,
// passwd,
// lang,
// pool_capacity,
// peak_limit,
// saprouter
// );
// JCoDestination jCoDestination = SAPConnUtils.connect(con);
// try {
// // 获取调用 RFC 函数对象
// JCoFunction func = jCoDestination.getRepository().getFunction("ZPPR_MES_PRO_TO");
// // 配置传入参数
// JCoParameterList importParameterList = func.getImportParameterList();
//// importParameterList.setValue("S_AUFNR",001002125255 );
// // 调用并获取返回值
// func.execute(jCoDestination);
// // 获取 内表 - ZMES_PRO
// JCoTable maraTable = func.getTableParameterList().getTable("ZMES_PRO");
// JCoRecordMetaData metaData = maraTable.getRecordMetaData();
// System.out.println("###" + metaData.toString());
// SapProOrder proOrder = new SapProOrder();
// List<SapProOrder> proOrderList = new ArrayList<>();
// // 循环输出 Table 数据
// for (int i = 0; i < maraTable.getNumRows(); i++) {
// maraTable.setRow(i);
// String AUFNR = maraTable.getString("AUFNR");
// String AUART = maraTable.getString("AUART");
// String MAUFNR = maraTable.getString("MAUFNR");
// String PLNBEZ = maraTable.getString("PLNBEZ");
// String MAKTX = maraTable.getString("MAKTX");
// String PWERK = maraTable.getString("PWERK");
// String GAMNG = maraTable.getString("GAMNG");
// String GMEIN = maraTable.getString("GMEIN");
// String PLNNR = maraTable.getString("PLNNR");
// String GSTRP = maraTable.getString("GSTRP");
// String GLTRP = maraTable.getString("GLTRP");
// String ERNAM = maraTable.getString("ERNAM");
// String ERDAT = maraTable.getString("ERDAT");
// String STTXT = maraTable.getString("STTXT");
// System.out.println("订单号:" + AUFNR + " - 订单类型:" + AUART + " - 上级订单编号:" + MAUFNR + " - 物料号:" + PLNBEZ + " - 物料描述(短文本):" + MAKTX
// + " - 订单的计划工厂:" + PWERK + " - 订单数量总计:" + GAMNG + " - 基本计量单位:" + GMEIN + " - 任务清单组码:" + PLNNR + " - 基本开始日期:" + GSTRP
// + " - 基本完成日期:" + GLTRP + " - 输入者:" + ERNAM + " - 创建日期:" + ERDAT + " - 系统状态:" + STTXT);
// proOrder.setId(IdUtils.fastSimpleUUID());
// proOrder.setPlanFactoryCode(PWERK);
// proOrder.setOrderCode(AUFNR);
// proOrder.setOrderType(AUART);
// proOrder.setProdCode(PLNBEZ);
// proOrder.setProdDesc(MAKTX);
// proOrder.setQuantity(Long.parseLong(GAMNG.substring(0, GAMNG.indexOf("."))));
// proOrder.setUnit(GMEIN);
// proOrder.setWorkerOrder(PLNNR);
// proOrder.setPlanProDate(DateUtils.dateTime("yyyy-MM-dd", GSTRP));
// proOrder.setPlanComplete(DateUtils.dateTime("yyyy-MM-dd", GLTRP));
// proOrder.setParentOrder(MAUFNR);
// proOrder.setCreateBy(ERNAM);
// proOrder.setCreateTime(DateUtils.dateTime("yyyy-MM-dd", ERDAT));
// proOrder.setUpdateBy(ERNAM);
// proOrder.setUpdateTime(DateUtils.dateTime("yyyy-MM-dd", ERDAT));
// proOrder.setStatus("0");
// proOrderList.add(proOrder);
// // remotePlanService.sapAddOrder(proOrder);
// // remoteMesService.sapAddOrder(proOrder);
// }
// return proOrderList;
// } catch (Exception e) {
// return null;
// }
// }
//
//
// @Override
// public R<Boolean> sapItem() {
// DynamicDataSourceContextHolder.push("lanju_op_xiaolan_ds");
// // 连接
// SapConn con = new SapConn(
// ashost,
// sysnr,
// client,
// user,
// passwd,
// lang,
// pool_capacity,
// peak_limit,
// saprouter
// );
// JCoDestination jCoDestination = SAPConnUtils.connect(con);
// try {
//// // 获取调用 RFC 函数对象
//// JCoFunction func = jCoDestination.getRepository().getFunction("ZMMR_MES_MAT_GET");
//// // 配置传入参数
//// JCoParameterList importParameterList = func.getImportParameterList();
//// //importParameterList.setValue("S_AUFNR",001002125255 );
//// // 调用并获取返回值
//// func.execute(jCoDestination);
//// // 获取 内表 - ZMES_PRO
//// JCoTable maraTable = func.getTableParameterList().getTable("LT_MARA");
//// JCoRecordMetaData metaData = maraTable.getRecordMetaData();
//// System.out.println("###"+metaData.toString());
//// SapProOrder proOrder=new SapProOrder();
//// List<SapProOrder> proOrderList=new ArrayList<>();
//// // 循环输出 Table 数据
//// for (int i = 0; i < maraTable.getNumRows(); i++) {
//// maraTable.setRow(i);
//// String AUFNR = maraTable.getString("AUFNR");
//// String AUART = maraTable.getString("AUART");
//// String MAUFNR = maraTable.getString("MAUFNR");
//// String PLNBEZ = maraTable.getString("PLNBEZ");
// //获取调用 RFC 函数对象
// JCoFunction func = jCoDestination.getRepository().getFunction("ZMMR_MES_MAT_GET");
// // 配置传入参数
// JCoParameterList importParameterList = func.getImportParameterList();
// //importParameterList.setValue("S_AUFNR",001002125255 );
// // 调用并获取返回值
// func.execute(jCoDestination);
// // 获取 内表 - LT_BOM
// JCoTable maraTable = func.getTableParameterList().getTable("LT_MARA");
// JCoRecordMetaData metaData = maraTable.getRecordMetaData();
// System.out.println("###" + metaData.toString());
//// SapProOrder proOrder=new SapProOrder();
// SapBaseProduct baseProduct = new SapBaseProduct();
// String[] str = new String[maraTable.getNumRows()];
// List<SapBaseProduct> baseProductList = new ArrayList<>();
// // 循环输出 Table 数据
// for (int i = 0; i < maraTable.getNumRows(); i++) {
//
// maraTable.setRow(i);
// String MATNR = maraTable.getString("MATNR");
// String MAKTX = maraTable.getString("MAKTX");
// String EAN11 = maraTable.getString("EAN11");
// String MTART = maraTable.getString("MTART");
// String MTBEZ = maraTable.getString("MTBEZ");
// String MATKL = maraTable.getString("MATKL");
// String WGBEZ = maraTable.getString("WGBEZ");
// BigDecimal BRGEW = maraTable.getBigDecimal("BRGEW");
// BigDecimal NTGEW = maraTable.getBigDecimal("NTGEW");
// BigDecimal VOLUM = maraTable.getBigDecimal("VOLUM");
// String VOLEH = maraTable.getString("VOLEH");
// String MEINS = maraTable.getString("MEINS");
// String MEINH = maraTable.getString("MEINH");
// String UMREZ = maraTable.getString("UMREZ");
// String UMREN = maraTable.getString("UMREN");
// String LVORM = maraTable.getString("LVORM");
// String MENGE = maraTable.getString("MENGE");
// String MHDHB = maraTable.getString("MHDHB");
// String SPART = maraTable.getString("SPART");
// String SPART_NM = maraTable.getString("SPART_NM");
// String MVGR1 = maraTable.getString("MVGR1");
// String MVGR1_NM = maraTable.getString("MVGR1_NM");
// String MVGR2 = maraTable.getString("MVGR2");
// String MVGR2_NM = maraTable.getString("MVGR2_NM");
// String MVGR3 = maraTable.getString("MVGR3");
// String MVGR3_NM = maraTable.getString("MVGR3_NM");
// String MVGR4 = maraTable.getString("MVGR4");
// String MVGR4_NM = maraTable.getString("MVGR4_NM");
// String MVGR5 = maraTable.getString("MVGR5");
// String MVGR5_NM = maraTable.getString("MVGR5_NM");
//// String SANKA = maraTable.getString("SANKA");
//// System.out.println("MATNR" + MATNR + "MAKTX" + MAKTX);
// baseProduct.setProductCode(MATNR);
// baseProduct.setProductDescZh(MAKTX);
//// baseProduct.setProductean11(EAN11);
// baseProduct.setProductGroup(MATKL);
// baseProduct.setProductGroupName(WGBEZ);
// baseProduct.setGrossWeight(BRGEW);
// baseProduct.setNetWeight(NTGEW);
// baseProduct.setVolume(VOLUM);
// baseProduct.setDelFlag("0");
// str[i] = baseProduct.getProductCode();
// if (i!=0){
// if (str[i].equals(str[i-1])) {
// System.out.println("chongfu");
//
// }else {
// sapBaseProductMapper.insertBaseProduct(baseProduct);
// }
// }
//
//
//// baseProductList.add(i, baseProduct);
//// sapBaseProductMapper.insertBaseProduct(baseProduct);
//
//
// }
// } catch (Exception e) {
// return R.fail(e.getMessage());
// }
// return R.ok();
// }
//
// @Override
// public R<Boolean> sapBom() {
// // 连接
// SapConn con = new SapConn(
// ashost,
// sysnr,
// client,
// user,
// passwd,
// lang,
// pool_capacity,
// peak_limit,
// saprouter
// );
// JCoDestination jCoDestination = SAPConnUtils.connect(con);
// try {
// // 获取调用 RFC 函数对象
// JCoFunction func = jCoDestination.getRepository().getFunction("ZMMR_MES_MAT_GET");
// // 配置传入参数
// JCoParameterList importParameterList = func.getImportParameterList();
// //importParameterList.setValue("S_AUFNR",001002125255 );
// // 调用并获取返回值
// func.execute(jCoDestination);
// // 获取 内表 - ZMES_PRO
// JCoTable maraTable = func.getTableParameterList().getTable("LT_MARA");
// JCoRecordMetaData metaData = maraTable.getRecordMetaData();
// System.out.println("###" + metaData.toString());
// SapProOrder proOrder = new SapProOrder();
// List<SapProOrder> proOrderList = new ArrayList<>();
// // 循环输出 Table 数据
// for (int i = 0; i < maraTable.getNumRows(); i++) {
// maraTable.setRow(i);
// String AUFNR = maraTable.getString("AUFNR");
// String AUART = maraTable.getString("AUART");
// String MAUFNR = maraTable.getString("MAUFNR");
// String PLNBEZ = maraTable.getString("PLNBEZ");
// System.out.println("工厂:" + AUFNR + " - 物料号:" + AUART + " - 物料组:"
// + MAUFNR + " - 生产版本:" + PLNBEZ);
// }
//
//// sapBaseProductService.insertBaseProduct(baseProduct);
// }
// catch(
// Exception e)
//
// {
// return R.fail(e.getMessage());
// }
// return R.ok();
//}
//
// @Override
// public R<Boolean> sapProRoute() {
// DynamicDataSourceContextHolder.push("lanju_op_xiaolan_ds");
// // 连接
// SapConn con = new SapConn(
// ashost,
// sysnr,
// client,
// user,
// passwd,
// lang,
// pool_capacity,
// peak_limit,
// saprouter
// );
// JCoDestination jCoDestination = SAPConnUtils.connect(con);
// try {
// // 获取调用 RFC 函数对象
// JCoFunction func = jCoDestination.getRepository().getFunction("ZPPR_MES_ROUTING");
// // 配置传入参数
// JCoParameterList importParameterList = func.getImportParameterList();
//// System.out.println(importParameterList.getListMetaData());
// // importParameterList.setValue("S_ERDAT","2019-11-07" );
// // 调用并获取返回值
// func.execute(jCoDestination);
// // 获取 内表 - ZMES_PRO
// JCoTable maraTable = func.getTableParameterList().getTable("LT_ROUTING");
// JCoRecordMetaData metaData = maraTable.getRecordMetaData();
// String[] str = new String[maraTable.getNumRows()];
//// System.out.println("###" + metaData.toString());
//
// List<SapProRoute> proRouteList = new ArrayList<>();
// for (int i = 0; i <maraTable.getNumRows(); i++) {
// SapProRoute proRoute = new SapProRoute();
// maraTable.setRow(i);
// String WERKS = maraTable.getString("WERKS");
// String PLNTY = maraTable.getString("PLNTY");
// String PLNNR = maraTable.getString("PLNNR");
// String PLNAL = maraTable.getString("PLNAL");
// String LOEKZ = maraTable.getString("LOEKZ");
// String MATNR = maraTable.getString("MATNR");
// String MAKTX = maraTable.getString("MAKTX");
// String VERWE = maraTable.getString("VERWE");
// String STATU = maraTable.getString("STATU");
// String LOSVN = maraTable.getString("LOSVN");
// String LOSBS = maraTable.getString("LOSBS");
// String KTEXT = maraTable.getString("KTEXT");
// String VORNR = maraTable.getString("VORNR");
// String STEUS = maraTable.getString("STEUS");
// String KTSCH = maraTable.getString("KTSCH");
// String LTXA1 = maraTable.getString("LTXA1");
// String ANDAT = maraTable.getString("ANDAT");
// String ANNAM = maraTable.getString("ANNAM");
// String AEDAT = maraTable.getString("AEDAT");
// String AENAM = maraTable.getString("AENAM");
// String ARBPL = maraTable.getString("ARBPL");
// String UMREN = maraTable.getString("UMREN");
// String UMREZ = maraTable.getString("UMREZ");
// String BMSCH = maraTable.getString("BMSCH");
// String MEINH = maraTable.getString("MEINH");
// String LAR01 = maraTable.getString("LAR01");
// String VGW01 = maraTable.getString("VGW01");
// String VGE01 = maraTable.getString("VGE01");
// String VGW02 = maraTable.getString("VGW02");
// String VGE02 = maraTable.getString("VGE02");
// String VGW03 = maraTable.getString("VGW03");
// String VGE03 = maraTable.getString("VGE03");
// String VGW04 = maraTable.getString("VGW04");
// String VGE04 = maraTable.getString("VGE04");
// String VGW05 = maraTable.getString("VGW05");
// String VGE05 = maraTable.getString("VGE05");
// String VGW06 = maraTable.getString("VGW06");
// String VGE06 = maraTable.getString("VGE06");
// String UEMUS = maraTable.getString("UEMUS");
// String UEKAN = maraTable.getString("UEKAN");
// String FLIES = maraTable.getString("FLIES");
// String SPMUS = maraTable.getString("SPMUS");
// String SPLIM = maraTable.getString("SPLIM");
// String CKSELKZ = maraTable.getString("CKSELKZ");
// proRoute.setRouteId(UUID.randomUUID().toString().replaceAll("-",""));
// proRoute.setRouteCode(PLNNR);
// proRoute.setRouteName(KTEXT);
// proRoute.setCreateBy(ANNAM);
// proRoute.setRouteDesc(KTEXT);
// proRoute.setEnableFlag("Y");
// proRoute.setCreateTime(DateUtils.dateTime("yyyy-MM-dd", ANDAT));
// if (proRoute.getRouteName().isEmpty()){
// proRoute.setRouteName("无");
// }
// proRouteList.add(i,proRoute);
//
// }
// proRouteList = proRouteList.stream().collect(Collectors.collectingAndThen
// (Collectors.toCollection(() ->new TreeSet<>(Comparator.comparing(SapProRoute::getRouteCode))),
// ArrayList::new));
// for (int i = 0; i < proRouteList.size(); i++) {
// sapProRouteMapper.insertProRoute(proRouteList.get(i));
// }
//
//
// }
// catch (Exception e){
// return R.fail(e.getMessage());
// }
// return R.ok();
// }
// @Override
// public R<Boolean> sapProRouteProduct() {
// DynamicDataSourceContextHolder.push("lanju_op_xiaolan_ds");
//
// try {
// // 获取调用 RFC 函数对象
// //获取连接
// JCoDestination dest = SAPConnUtils.connect();
// JCoRepository repository = dest.getRepository();
// JCoFunction func = repository.getFunction("ZPPR_MES_ROUTING");
// if (func == null) {
// throw new RuntimeException("Function does not exist in SAP");
// }
// // 配置传入参数
//// JCoTable jCoTable = func.getTableParameterList().getTable("S_STLNR");
//// jCoTable.appendRow();
//// jCoTable.setValue(Constants.SIGN, "I");
//// jCoTable.setValue(Constants.OPTION, "EQ");
//// jCoTable.setValue(Constants.LOW, "00012222");
//
//// JCoTable jCoTables = func.getTableParameterList().getTable("LT_ROUTING");
//// jCoTables.appendRow();
//// jCoTables.setValue(Constants.SIGN, "I");
//// jCoTables.setValue(Constants.OPTION, "EQ");
//// jCoTables.setValue(Constants.LOW, "00012222");
// // 获取调用 RFC 函数对象
// func.execute(dest);
// // 获取 内表 - ZMES_PRO
// JCoTable maraTable = func.getTableParameterList().getTable("LT_ROUTING");
// JCoRecordMetaData metaData = maraTable.getRecordMetaData();
// System.out.println("###" + metaData.toString());
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
// // 获取调用 RFC 函数对象
// JCoFunction func = jCoDestination.getRepository().getFunction("ZPPR_MES_ROUTING");
// // 配置传入参数
// JCoParameterList importParameterList = func.getImportParameterList();
//// System.out.println(importParameterList.getListMetaData());
// // importParameterList.setValue("S_ERDAT","2019-11-07" );
// // 调用并获取返回值
// func.execute(jCoDestination);
// // 获取 内表 - ZMES_PRO
// JCoTable maraTable = func.getTableParameterList().getTable("LT_ROUTING");
// JCoRecordMetaData metaData = maraTable.getRecordMetaData();
// String[] str = new String[maraTable.getNumRows()];
//// System.out.println("###" + metaData.toString());
// List<SapProRoute> proRouteList = new ArrayList<>();
// List<SapProRouteProduct> proRouteProductList = new ArrayList<>();
// for (int i = 0; i <maraTable.getNumRows(); i++) {
// SapProRouteProduct proRouteProduct = new SapProRouteProduct();
// SapProRoute proRoute = new SapProRoute();
// maraTable.setRow(i);
// String WERKS = maraTable.getString("WERKS");
// String PLNTY = maraTable.getString("PLNTY");
// String PLNNR = maraTable.getString("PLNNR");
// String PLNAL = maraTable.getString("PLNAL");
// String LOEKZ = maraTable.getString("LOEKZ");
// String MATNR = maraTable.getString("MATNR");
// String MAKTX = maraTable.getString("MAKTX");
// String VERWE = maraTable.getString("VERWE");
// String STATU = maraTable.getString("STATU");
// String LOSVN = maraTable.getString("LOSVN");
// String LOSBS = maraTable.getString("LOSBS");
// String KTEXT = maraTable.getString("KTEXT");
// String VORNR = maraTable.getString("VORNR");
// String STEUS = maraTable.getString("STEUS");
// String KTSCH = maraTable.getString("KTSCH");
// String LTXA1 = maraTable.getString("LTXA1");
// String ANDAT = maraTable.getString("ANDAT");
// String ANNAM = maraTable.getString("ANNAM");
// String AEDAT = maraTable.getString("AEDAT");
// String AENAM = maraTable.getString("AENAM");
// String ARBPL = maraTable.getString("ARBPL");
// String UMREN = maraTable.getString("UMREN");
// String UMREZ = maraTable.getString("UMREZ");
// String BMSCH = maraTable.getString("BMSCH");
// String MEINH = maraTable.getString("MEINH");
// String LAR01 = maraTable.getString("LAR01");
// String VGW01 = maraTable.getString("VGW01");
// String VGE01 = maraTable.getString("VGE01");
// String VGW02 = maraTable.getString("VGW02");
// String VGE02 = maraTable.getString("VGE02");
// String VGW03 = maraTable.getString("VGW03");
// String VGE03 = maraTable.getString("VGE03");
// String VGW04 = maraTable.getString("VGW04");
// String VGE04 = maraTable.getString("VGE04");
// String VGW05 = maraTable.getString("VGW05");
// String VGE05 = maraTable.getString("VGE05");
// String VGW06 = maraTable.getString("VGW06");
// String VGE06 = maraTable.getString("VGE06");
// String UEMUS = maraTable.getString("UEMUS");
// String UEKAN = maraTable.getString("UEKAN");
// String FLIES = maraTable.getString("FLIES");
// String SPMUS = maraTable.getString("SPMUS");
// String SPLIM = maraTable.getString("SPLIM");
// String CKSELKZ = maraTable.getString("CKSELKZ");
// proRoute.setRouteCode(PLNNR);
// proRoute.setRouteName(KTEXT);
// proRoute.setCreateBy(ANNAM);
// proRoute.setRouteDesc(KTEXT);
// proRoute.setRouteId(UUID.randomUUID().toString().replaceAll("-",""));
// proRoute.setEnableFlag("Y");
// if (proRoute.getRouteName().isEmpty()){
// proRoute.setRouteName("无");
// }
// proRouteList.add(i,proRoute);
// proRouteProduct.setRecordId(UUID.randomUUID().toString().replace("-",""));
// proRouteProduct.setItemCode(MATNR);
// proRouteProduct.setItemName(MAKTX);
// proRouteProduct.setRouteId(proRouteList.get(i).getRouteId());
// proRouteProductList.add(i,proRouteProduct);
// }
// //根据routecode去重
// proRouteList = proRouteList.stream().collect(Collectors.collectingAndThen
// (Collectors.toCollection(() ->new TreeSet<>(Comparator.comparing(SapProRoute::getRouteCode))),
// ArrayList::new));
// for (int i = 0; i < proRouteList.size(); i++) {
// sapProRouteMapper.insertProRoute(proRouteList.get(i));
// }
//// for (int i = 0; i <proRouteList.size(); i++) {sapProRouteMapper.insertProRoute(proRouteList.get(i));}
// for (int j=0; j<proRouteProductList.size(); j++) {
// //item_id为空时不插入
// if (!sapBaseProductMapper.selectBaseProductIDByProductCode(proRouteProductList.get(j).getItemCode()).isEmpty()){
// proRouteProductList.get(j).setItemId
// (sapBaseProductMapper.selectBaseProductIDByProductCode(proRouteProductList.get(j).getItemCode()));
// sapProRouteProductMapper.insertProRouteProduct(proRouteProductList.get(j));
// }}
//
// }
// catch (Exception e){
// return R.fail(e.getMessage());
// }
// return R.ok();
// }
@Override
public R<Boolean> sapProRouteProcess() {
// DynamicDataSourceContextHolder.push("lanju_op_xiaolan_ds");
// DynamicDataSourceContextHolder.push("lanju_op_cloud");
try {
// 获取调用 RFC 函数对象
//获取连接
JCoDestination dest = SAPConnUtils.connect();
JCoRepository repository = dest.getRepository();
JCoFunction func = repository.getFunction("ZPPR_MES_ROUTING");
if (func == null) {
throw new RuntimeException("Function does not exist in SAP");
}
// 获取调用 RFC 函数对象
func.execute(dest);
// 获取 内表 - ZMES_PRO
JCoTable maraTable = func.getTableParameterList().getTable("LT_ROUTING");
JCoRecordMetaData metaData = maraTable.getRecordMetaData();
// System.out.println("###" + metaData.toString());
// System.out.println("###" + metaData.toString());
Map<String,SapProRoute> mapProRoute = new IdentityHashMap<String,SapProRoute>();
Map<String,SapProProcess> mapProProcess = new IdentityHashMap<String,SapProProcess>();
Map<String,SapProRouteProcess> mapProRouteProcessNew = new IdentityHashMap<String,SapProRouteProcess>();
Map<String,SapProRouteProcess> mapProRouteProcessOld = new IdentityHashMap<String,SapProRouteProcess>();
List<SapProProcess> proProcessList = new ArrayList<>();
List<SapProRouteProcess> proRouteProcessList = new ArrayList<>();
List<SapProProcessContent> proProcessContentList = new ArrayList<>();
List<SapProRoute> proRouteList = new ArrayList();
Set<String> set = new HashSet<>();
for (int i = 0,arr1=0,arr2=0; i <maraTable.getNumRows(); i++) {
SapProProcess proProcess = new SapProProcess();
SapProRouteProcess proRouteProcessNew = new SapProRouteProcess();
SapProRouteProcess proRouteProcessOld = new SapProRouteProcess();
SapProProcessContent proProcessContent = new SapProProcessContent();
SapProRoute proRoute = new SapProRoute();
maraTable.setRow(i);
// System.out.println(i);
String WERKS = maraTable.getString("WERKS");
String PLNTY = maraTable.getString("PLNTY");
String PLNNR = maraTable.getString("PLNNR");
String PLNAL = maraTable.getString("PLNAL");
String LOEKZ = maraTable.getString("LOEKZ");
String MATNR = maraTable.getString("MATNR");
String MAKTX = maraTable.getString("MAKTX");
String VERWE = maraTable.getString("VERWE");
String STATU = maraTable.getString("STATU");
String LOSVN = maraTable.getString("LOSVN");
String LOSBS = maraTable.getString("LOSBS");
String KTEXT = maraTable.getString("KTEXT");
String VORNR = maraTable.getString("VORNR");
String STEUS = maraTable.getString("STEUS");
String KTSCH = maraTable.getString("KTSCH");
String LTXA1 = maraTable.getString("LTXA1");
String ANDAT = maraTable.getString("ANDAT");
String ANNAM = maraTable.getString("ANNAM");
String AEDAT = maraTable.getString("AEDAT");
String AENAM = maraTable.getString("AENAM");
String ARBPL = maraTable.getString("ARBPL");
String UMREN = maraTable.getString("UMREN");
String UMREZ = maraTable.getString("UMREZ");
String BMSCH = maraTable.getString("BMSCH");
String MEINH = maraTable.getString("MEINH");
String LAR01 = maraTable.getString("LAR01");
String VGW01 = maraTable.getString("VGW01");
String VGE01 = maraTable.getString("VGE01");
String VGW02 = maraTable.getString("VGW02");
String VGE02 = maraTable.getString("VGE02");
String VGW03 = maraTable.getString("VGW03");
String VGE03 = maraTable.getString("VGE03");
String VGW04 = maraTable.getString("VGW04");
String VGE04 = maraTable.getString("VGE04");
String VGW05 = maraTable.getString("VGW05");
String VGE05 = maraTable.getString("VGE05");
String VGW06 = maraTable.getString("VGW06");
String VGE06 = maraTable.getString("VGE06");
String UEMUS = maraTable.getString("UEMUS");
String UEKAN = maraTable.getString("UEKAN");
String FLIES = maraTable.getString("FLIES");
String SPMUS = maraTable.getString("SPMUS");
String SPLIM = maraTable.getString("SPLIM");
String CKSELKZ = maraTable.getString("CKSELKZ");
//根据工厂切换数据源
// String pre = "ds_";
// String werks = pre+WERKS;
// String url = sapSysUserMapper.getPoolName(werks);
set.add(WERKS);
// if (url.isEmpty()){
// System.out.println("当前无工厂");
// break;
// }
// String[] split = url.split("=");
// System.out.println(split[1]);
// DynamicDataSourceContextHolder.push(split[1]);
// DynamicDataSourceContextHolder.push(werks);
// System.out.println(DynamicDataSourceContextHolder.peek());
proRoute.setRouteCode(PLNNR);
proRoute.setRouteName(KTEXT);
proRoute.setCreateBy(ANNAM);
proRoute.setRouteDesc(KTEXT);
proRoute.setTecMan(VGW01);
proRoute.setTecManUnit(VGE01);
proRoute.setTecMachine(VGW02);
proRoute.setTecMachineUnit(VGE02);
proRoute.setTecDepreciation(VGW03);
proRoute.setTecDepreciationUnit(VGE03);
proRoute.setTecOther(VGW04);
proRoute.setTecOtherUnit(VGE04);
proRoute.setTecConfAcivity5(VGW05);
proRoute.setTecConfAcivity5Unit(VGE05);
proRoute.setTecConfAcivity6(VGW06);
proRoute.setTecConfAcivity6Unit(VGE06);
proRoute.setAttr1(Integer.valueOf(i).toString());
proRoute.setRouteId(UUID.randomUUID().toString().replaceAll("-",""));
proRoute.setEnableFlag("Y");
if (proRoute.getRouteName().isEmpty()){
proRoute.setRouteName("无");
}
mapProRoute.put(WERKS,proRoute);
proRouteList.add(i,proRoute);
// if (proRoute.getRouteName()!="无"){
// {
//// System.out.println(sapProRouteMapper.selectProRouteByRouteCode(value.getRouteCode()));
// if (sapProRouteMapper.selectProRouteByRouteCode(proRoute.getRouteCode())==0){
// proRoute.setRouteId(UUID.randomUUID().toString().replaceAll("-",""));
// arr1 = 1;
// }
// else{
// arr1=0;
// }
// }}
proProcess.setProcessId(UUID.randomUUID().toString().replaceAll("-",""));
proProcess.setProcessName(LTXA1);
proProcess.setProcessCode(LTXA1);
proProcess.setAttention(LTXA1);
proProcess.setEnableFlag("Y");
proProcess.setWorkCenter(ARBPL);
proProcess.setAttr1(Integer.valueOf(i).toString());
proProcess.setCreateTime(DateUtils.dateTime("yyyy-MM-dd", ANDAT));
proProcess.setCreateBy(ANNAM);
proProcess.setUpdateBy(AENAM);
mapProProcess.put(WERKS,proProcess);
proProcessList.add(i,proProcess);
// if (proProcess.getProcessCode()!=null){
// if (sapProProcessMapper.selectProProcessByProcessName(proProcess.getProcessName())==0){
// proProcess.setProcessId(UUID.randomUUID().toString().replaceAll("-",""));
// arr2 = 1;
// }
// else{
// arr2 = 0;
// }
// }
proRouteProcessNew.setRouteId(proRoute.getRouteId());
proRouteProcessNew.setProcessId(proProcess.getProcessId());
proRouteProcessNew.setAttr1(Integer.valueOf(i).toString());
proRouteProcessNew.setProcessCode(proProcess.getProcessCode());
proRouteProcessNew.setProcessName(proProcess.getProcessName());
proRouteProcessNew.setOrderNum(1);
proRouteProcessNew.setCreateTime(DateUtils.dateTime(("yyyy-MM-dd"),ANDAT));
proRouteProcessNew.setCreateBy(ANNAM);
proRouteProcessNew.setUpdateBy(AENAM);
proRouteProcessNew.setRecordId(UUID.randomUUID().toString().replace("-",""));
mapProRouteProcessNew.put(WERKS,proRouteProcessNew);
proRouteProcessOld.setProcessCode(proProcess.getProcessCode());
proRouteProcessOld.setProcessName(proProcess.getProcessName());
proRouteProcessOld.setOrderNum(1);
proRouteProcessOld.setCreateTime(DateUtils.dateTime(("yyyy-MM-dd"),ANDAT));
proRouteProcessOld.setCreateBy(ANNAM);
proRouteProcessOld.setUpdateBy(AENAM);
mapProRouteProcessOld.put(WERKS,proRouteProcessOld);
// sapProRouteProcessMapper.insertProRouteProcess(proRouteProcess);
//
//
// sapProRouteProcessMapper.updateProRouteProcess(proRouteProcess);
// //根据routecode去重
//
// for (int i = 0; i < proRouteList.size(); i++) {
//
//
// }
// //quchong
//
// for (int i = 0; i < proProcessList.size(); i++) {
// if (!proProcessList.get(i).getProcessCode().isEmpty()){
// proProcessList.get(i).setProcessId(UUID.randomUUID().toString().replaceAll("-",""));
// sapProProcessMapper.insertProProcess(proProcessList.get(i));
//// System.out.println(proProcessList.get(i));
// }
// }
// proProcessContentList = proProcessContentList.stream().collect(Collectors.collectingAndThen
// (Collectors.toCollection(() ->new TreeSet<>(Comparator.comparing(SapProProcessContent::getContentText))),
// ArrayList::new));
// for (int j=0; j<proProcessContentList.size(); j++) {
// if (!proProcessContentList.get(j).getContentText().isEmpty()){
// sapProProcessContentMapper.insertProProcessContent(proProcessContentList.get(j));
// }}
// proRouteProcessList = proRouteProcessList.stream().collect(Collectors.collectingAndThen
// (Collectors.toCollection(() ->new TreeSet<>(Comparator.comparing(SapProRouteProcess::getProcessCode))),
// ArrayList::new));
// for (int k = 0;k<proRouteProcessList.size();k++){
// if (!proRouteProcessList.get(k).getProcessCode().isEmpty()){
// sapProRouteProcessMapper.insertProRouteProcess(proRouteProcessList.get(k));
// }}
// proRouteProcessList = proRouteProcessList.stream().collect(Collectors.collectingAndThen
// (Collectors.toCollection(() ->new TreeSet<>(Comparator.comparing(SapProRouteProcess::getProcessCode))),
// ArrayList::new));
// for (int k = 0;k<proRouteProcessList.size();k++){
// if (!proRouteProcessList.get(k).getProcessCode().isEmpty()){ sapProRouteProcessMapper.insertProRouteProcess(proRouteProcessList.get(k));}
// if (proRouteList.get(k).getRouteName()!="无"){ sapProRouteMapper.insertProRoute(proRouteList.get(k)); }
// if (!proProcessList.get(k).getProcessCode().isEmpty()){ sapProProcessMapper.insertProProcess(proProcessList.get(k)); }
// if (!proProcessContentList.get(k).getContentText().isEmpty()){ sapProProcessContentMapper.insertProProcessContent(proProcessContentList.get(k)); }
// }
}
Integer nums = sapSysUserMapper.getNums();
List<String> list = Arrays.asList(set.toArray(new String[0]));
// Integer nums = sapSysUserMapper.getNums();
for (int i=0;i<nums;i++){
String s = list.get(i);
mapProRoute.forEach((key,value)->{
if (key.equals(s)){
DynamicDataSourceContextHolder.push("ds_"+s);
if (value.getRouteName()!="无"){
{
// System.out.println(s);
// System.out.println(sapProRouteMapper.selectProRouteByRouteCode(value.getRouteCode()));
if (sapProRouteMapper.selectProRouteByRouteCode(value.getRouteCode())==0){
value.setRouteId(UUID.randomUUID().toString().replaceAll("-",""));
sapProRouteMapper.insertProRoute(value);
// arr1 = 1;
}
else{
// System.out.println(value);
sapProRouteMapper.updateProRoute(value);
// arr1=0;
}
}}
}
});
mapProProcess.forEach((key, value) ->{
if (key.equals(s)){
DynamicDataSourceContextHolder.push("ds_"+s);
if (value.getProcessCode()!=null&&value.getProcessCode()!=""){
if (sapProProcessMapper.selectProProcessByProcessName(value.getProcessName())==0){
value.setProcessId(UUID.randomUUID().toString().replaceAll("-",""));
// System.out.println(value.getProcessCode()+"================================================");
sapProProcessMapper.insertProProcess(value);
}
else{
// System.out.println(value);
sapProProcessMapper.updateProProcess(value);
}
}
}
});
mapProRouteProcessNew.forEach((key, value) ->{
if (key.equals(s)){
DynamicDataSourceContextHolder.push("ds_"+s);
if ((sapProRouteProcessMapper.selectProRouteProcessByProcessCode(value.getProcessCode()))==0){
// System.out.println(value);
sapProRouteProcessMapper.insertProRouteProcess(value);
}
}
});
mapProRouteProcessOld.forEach((key, value) ->{
if (key.equals(s)){
DynamicDataSourceContextHolder.push("ds_"+s);
if ((sapProRouteProcessMapper.selectProRouteProcessByProcessCode(value.getProcessCode()))!=0){
// System.out.println(value);
sapProRouteProcessMapper.updateProRouteProcess(value);
}}
});
}
}
catch (Exception e){
return R.fail(e.getMessage());
}
return R.ok();
}
// public static void main(String[] args) throws JCoException {
// // 连接
// SapConn con = new SapConn(
// "192.168.0.53",
// "00",
// "800",
// "MES",
// "123456",
// "zh",
// "true",
// "20",
// ""
// );
// JCoDestination jCoDestination = SAPConnUtils.connect(con);
// // 获取调用 RFC 函数对象
// JCoFunction func = jCoDestination.getRepository().getFunction("ZPPR_MES_PRO_TO");
// // 配置传入参数
// JCoParameterList importParameterList = func.getImportParameterList();
// System.out.println(importParameterList.getListMetaData());
// // importParameterList.setValue("S_ERDAT","2019-11-07" );
// // 调用并获取返回值
// func.execute(jCoDestination);
// // 获取 内表 - ZMES_PRO
// JCoTable maraTable = func.getTableParameterList().getTable("ZMES_PRO");
// JCoRecordMetaData metaData = maraTable.getRecordMetaData();
// System.out.println("###" + metaData.toString());
// SapProOrder proOrder = new SapProOrder();
// List<SapProOrder> proOrderList = new ArrayList<>();
// for (int i = 0; i < maraTable.getNumRows(); i++) {
// maraTable.setRow(i);
// String AUFNR = maraTable.getString("AUFNR");
// String AUART = maraTable.getString("AUART");
// String MAUFNR = maraTable.getString("MAUFNR");
// String PLNBEZ = maraTable.getString("PLNBEZ");
// String MAKTX = maraTable.getString("MAKTX");
// String PWERK = maraTable.getString("PWERK");
// String GAMNG = maraTable.getString("GAMNG");
// String GMEIN = maraTable.getString("GMEIN");
// String PLNNR = maraTable.getString("PLNNR");
// String GSTRP = maraTable.getString("GSTRP");
// String GLTRP = maraTable.getString("GLTRP");
// String ERNAM = maraTable.getString("ERNAM");
// String ERDAT = maraTable.getString("ERDAT");
// String STTXT = maraTable.getString("STTXT");
// System.out.println("订单号:" +AUFNR+" - 订单类型:" + AUART+ " - 上级订单编号:" + MAUFNR+ " - 物料号:" + PLNBEZ+ " - 物料描述(短文本):" + MAKTX
// + " - 订单的计划工厂:" + PWERK+ " - 订单数量总计:" + GAMNG+ " - 基本计量单位:" + GMEIN+ " - 任务清单组码:" + PLNNR+ " - 基本开始日期:" + GSTRP
// + " - 基本完成日期:" + GLTRP+ " - 输入者:" + ERNAM+ " - 创建日期:" + ERDAT+ " - 系统状态:" + STTXT);
// }
// // 循环输出 Table 数据
//// for (int i = 0; i < maraTable.getNumRows(); i++) {
//// maraTable.setRow(i);
//// String MATNR = maraTable.getString("MATNR");
//// String MAKTX = maraTable.getString("MAKTX");
//// String EAN11 = maraTable.getString("EAN11");
//// String MTART = maraTable.getString("MTART");
//// String MTBEZ = maraTable.getString("MTBEZ");
//// String MATKL = maraTable.getString("MATKL");
//// String WGBEZ = maraTable.getString("WGBEZ");
//// String BRGEW = maraTable.getString("BRGEW");
//// String NTGEW = maraTable.getString("NTGEW");
//// String VOLUM = maraTable.getString("VOLUM");
//// String VOLEH = maraTable.getString("VOLEH");
//// String MEINS = maraTable.getString("MEINS");
//// String MEINH = maraTable.getString("MEINH");
//// String UMREZ = maraTable.getString("UMREZ");
//// String UMREN = maraTable.getString("UMREN");
//// String LVORM = maraTable.getString("LVORM");
//// String MENGE = maraTable.getString("MENGE");
//// String MHDHB = maraTable.getString("MHDHB");
//// String SPART = maraTable.getString("SPART");
//// String SPART_NM = maraTable.getString("SPART_NM");
//// String MVGR1 = maraTable.getString("MVGR1");
//// String MVGR1_NM = maraTable.getString("MVGR1_NM");
//// String MVGR2 = maraTable.getString("MVGR2");
//// String MVGR2_NM = maraTable.getString("MVGR2_NM");
//// String MVGR3 = maraTable.getString("MVGR3");
//// String MVGR3_NM = maraTable.getString("MVGR3_NM");
//// String MVGR4 = maraTable.getString("MVGR4");
//// String MVGR4_NM = maraTable.getString("MVGR4_NM");
//// String MVGR5 = maraTable.getString("MVGR5");
//// String MVGR5_NM = maraTable.getString("MVGR5_NM");
//// System.out.println("物料号:" + MATNR + " - 物料描述:" + MAKTX + " - 国际文件号(EAN/UPC)" + EAN11 + " - 物料类型:" + MTART );
//// }
// }
}

@ -44,7 +44,7 @@ public class SAPConnUtils {
private static final String ABAP_AS_POOLED = "ABAP_AS_WITH_POOL";
static {
Properties connectProperties = new Properties();
connectProperties.setProperty(DestinationDataProvider.JCO_ASHOST, "192.168.0.53");
connectProperties.setProperty(DestinationDataProvider.JCO_ASHOST, "192.168.0.54");
connectProperties.setProperty(DestinationDataProvider.JCO_SYSNR, "00");
connectProperties.setProperty(DestinationDataProvider.JCO_USER, "MES");
connectProperties.setProperty(DestinationDataProvider.JCO_PASSWD, "123456");

Loading…
Cancel
Save