Merge remote-tracking branch 'origin/master'

master
wws 2 years ago
commit 1f0fd5b808

@ -0,0 +1,56 @@
package com.op.system.api.domain.sap;
import com.fasterxml.jackson.annotation.JsonFormat;
import javax.xml.crypto.Data;
import java.util.Date;
public class SapWorkCenter {
private String weeks;
private String name1;
private String arbpl;
private String ktext;
@JsonFormat(pattern = "yyyy-MM-dd")
private Date aedat_grnd;
public String getWeeks() {
return weeks;
}
public void setWeeks(String weeks) {
this.weeks = weeks;
}
public String getName1() {
return name1;
}
public void setName1(String name1) {
this.name1 = name1;
}
public String getArbpl() {
return arbpl;
}
public void setArbpl(String arbpl) {
this.arbpl = arbpl;
}
public String getKtext() {
return ktext;
}
public void setKtext(String ktext) {
this.ktext = ktext;
}
public Date getAedat_grnd() {
return aedat_grnd;
}
public void setAedat_grnd(Date aedat_grnd) {
this.aedat_grnd = aedat_grnd;
}
}

@ -8,6 +8,7 @@ import com.op.common.core.utils.uuid.IdUtils;
import com.op.mes.domain.MesDailyReport;
import com.op.mes.domain.MesProcessReport;
import com.op.mes.domain.MesReportProduction;
import com.op.mes.domain.dto.LineChartDto;
import com.op.mes.domain.dto.SysFactoryDto;
import com.op.mes.mapper.MesReportWorkMapper;
import org.apache.commons.lang.StringUtils;
@ -181,6 +182,13 @@ public class MesReportWorkController extends BaseController {
public List<SysFactoryDto> getWorkcenterList(MesDailyReport mesDailyReport) {
return mesReportWorkService.getWorkcenterList(mesDailyReport);
}
/**首页柱状图**/
@GetMapping("/getLineChartData")
public LineChartDto getLineChartData(MesReportProduction mesReportProduction) {
return mesReportWorkService.getLineChartData(mesReportProduction);
}
}

@ -45,6 +45,24 @@ public class MesReportProduction extends BaseEntity {
private String unit;
private String productDateStart;
private String productDateEnd;
private String feedbackTime;
private String nameDate;
public String getNameDate() {
return nameDate;
}
public void setNameDate(String nameDate) {
this.nameDate = nameDate;
}
public String getFeedbackTime() {
return feedbackTime;
}
public void setFeedbackTime(String feedbackTime) {
this.feedbackTime = feedbackTime;
}
public String getFactoryCode() {
return factoryCode;

@ -0,0 +1,39 @@
package com.op.mes.domain.dto;
import java.util.List;
/**
* echart
*
* @author Open Platform
* @date 2023-07-03
*/
public class LineChartDto{
private List<String> seriesNames;
private List<String> xAxisDatas;
private List<LineChartSeriesDto> seriesDatas;
public List<String> getSeriesNames() {
return seriesNames;
}
public void setSeriesNames(List<String> seriesNames) {
this.seriesNames = seriesNames;
}
public List<String> getxAxisDatas() {
return xAxisDatas;
}
public void setxAxisDatas(List<String> xAxisDatas) {
this.xAxisDatas = xAxisDatas;
}
public List<LineChartSeriesDto> getSeriesDatas() {
return seriesDatas;
}
public void setSeriesDatas(List<LineChartSeriesDto> seriesDatas) {
this.seriesDatas = seriesDatas;
}
}

@ -0,0 +1,50 @@
package com.op.mes.domain.dto;
import com.op.common.core.web.domain.TreeEntity;
import java.util.List;
/**
* echart
*
* @author Open Platform
* @date 2023-07-03
*/
public class LineChartSeriesDto {
private String name;
private String type;
private String stack;
private List<String> data;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getStack() {
return stack;
}
public void setStack(String stack) {
this.stack = stack;
}
public List<String> getData() {
return data;
}
public void setData(List<String> data) {
this.data = data;
}
}

@ -1,12 +1,14 @@
package com.op.mes.mapper;
import java.util.List;
import java.util.Map;
import com.op.mes.domain.MesDailyReport;
import com.op.mes.domain.MesProcessReport;
import com.op.mes.domain.MesReportProduction;
import com.op.mes.domain.MesReportWork;
import com.op.mes.domain.dto.SysFactoryDto;
import org.apache.ibatis.annotations.MapKey;
/**
* Mapper
@ -78,4 +80,8 @@ public interface MesReportWorkMapper {
List<SysFactoryDto> getWorkcenterList(MesDailyReport mesDailyReport);
public void updateWorkOrderStatus(MesReportWork work);
@MapKey("nameDate")
Map<String,MesReportProduction> getLineChartsDatas(MesReportProduction mesReportProduction);
List<String> getLineChartsNames(MesReportProduction mesReportProduction);
}

@ -6,6 +6,7 @@ import com.op.mes.domain.MesDailyReport;
import com.op.mes.domain.MesProcessReport;
import com.op.mes.domain.MesReportProduction;
import com.op.mes.domain.MesReportWork;
import com.op.mes.domain.dto.LineChartDto;
import com.op.mes.domain.dto.SysFactoryDto;
/**
@ -72,4 +73,6 @@ public interface IMesReportWorkService {
String getTitleName(MesDailyReport mesDailyReport);
List<SysFactoryDto> getWorkcenterList(MesDailyReport mesDailyReport);
LineChartDto getLineChartData(MesReportProduction mesReportProduction);
}

@ -1,14 +1,18 @@
package com.op.mes.service.impl;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.common.core.utils.DateUtils;
import com.op.mes.domain.MesDailyReport;
import com.op.mes.domain.MesProcessReport;
import com.op.mes.domain.MesReportProduction;
import com.op.mes.domain.dto.LineChartDto;
import com.op.mes.domain.dto.LineChartSeriesDto;
import com.op.mes.domain.dto.SysFactoryDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -226,4 +230,101 @@ public class MesReportWorkServiceImpl implements IMesReportWorkService {
return mesReportWorkMapper.getWorkcenterList(mesDailyReport);
}
/**
* seriesNames: ['(18)', '(60)', '(288)', '(30)', '(60)'],
* xAxisDatas: ['2023/08/01', '2023/08/02', '2023/08/03', '2023/08/04', '2023/08/05', '2023/08/06', '2023/08/07',
* '2023/08/08','2023/08/09','2023/08/10','2023/08/11','2023/08/12','2023/08/13','2023/08/14',
* ],
* seriesDatas: [
* {
* name: '(18)',
* type: 'bar',//line
* stack: 'Total',
* data: [120, 132, 101, 134, 90, 230, 210,120, 132, 101, 134, 90, 230, 210]
* }
* ]
* @param mesDailyReport
* @return
*/
@Override
@DS("#header.poolName")
public LineChartDto getLineChartData(MesReportProduction mesReportProduction) {
LineChartDto lineChartDto = new LineChartDto();
Calendar calendar = Calendar.getInstance();
Date now = calendar.getTime();
calendar.set(Calendar.DAY_OF_MONTH, 1);
Date firstDayOfMonth = calendar.getTime();
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
String startTime = dateFormat.format(firstDayOfMonth);
String endTime = dateFormat.format(now);
mesReportProduction.setProductDateStart(startTime);
mesReportProduction.setProductDateEnd(endTime);
//图例名称
List<String> seriesNames = mesReportWorkMapper.getLineChartsNames(mesReportProduction);
lineChartDto.setSeriesNames(seriesNames);
//日期名称数组
List<String> xAxisDatas = getDays(startTime,endTime);
lineChartDto.setxAxisDatas(xAxisDatas);
Map<String,MesReportProduction> productdatas = mesReportWorkMapper.getLineChartsDatas(mesReportProduction);
//值
List<LineChartSeriesDto> seriesDatas = new ArrayList<>();
LineChartSeriesDto lineChartSeriesDto = null;
for(String productName:seriesNames){
lineChartSeriesDto = new LineChartSeriesDto();
lineChartSeriesDto.setName(productName);
lineChartSeriesDto.setType("bar");
lineChartSeriesDto.setStack("Total");
List<String> datas = new ArrayList<>();
for(String dayStr:xAxisDatas) {
MesReportProduction data0 = productdatas.get(productName + dayStr);
if (data0 != null) {
datas.add(data0.getQuantity());
} else {
datas.add("0");
}
}
lineChartSeriesDto.setData(datas);
seriesDatas.add(lineChartSeriesDto);
}
lineChartDto.setSeriesDatas(seriesDatas);
return lineChartDto;
}
/**两个日期之间的所有日期**/
public static List<String> getDays(String startTime,String endTime) {
// 返回的日期集合
List<String> days = new ArrayList<String>();
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
try {
Date start = dateFormat.parse(startTime);
Date end = dateFormat.parse(endTime);
Calendar tempStart = Calendar.getInstance();
tempStart.setTime(start);
Calendar tempEnd = Calendar.getInstance();
tempEnd.setTime(end);
tempEnd.add(Calendar.DATE, +1);// 日期加1(包含结束)
while (tempStart.before(tempEnd)) {
days.add(dateFormat.format(tempStart.getTime()));
tempStart.add(Calendar.DAY_OF_YEAR, 1);
}
} catch (ParseException e) {
e.printStackTrace();
}
return days;
}
public static void main(String[] args) {
Calendar calendar = Calendar.getInstance();
Date now = calendar.getTime();
calendar.set(Calendar.DAY_OF_MONTH, 1);
Date firstDayOfMonth = calendar.getTime();
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
String formattedDate = format.format(firstDayOfMonth);
System.out.println("当前日期: " + format.format(now));
System.out.println("当月的第一天: " + formattedDate);
}
}

@ -211,8 +211,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
factory_code factoryCode
from sys_factory where f_type = 'c'
</select>
<select id="getLineChartsDatas" resultType="com.op.mes.domain.MesReportProduction">
select
mrw.product_name+CONVERT(varchar(10),mrw.feedback_time, 120) nameDate,
mrw.product_code productCode,
mrw.product_name productName,
CONVERT(varchar(10),mrw.feedback_time, 120) feedbackTime,
sum(mrw.quantity_feedback) quantity
from mes_report_work mrw
where
CONVERT(varchar(10),mrw.feedback_time, 120) >= #{productDateStart}
and #{productDateEnd} >= CONVERT(varchar(10),mrw.feedback_time, 120)
group by mrw.product_code,mrw.product_name,mrw.feedback_time
order by mrw.feedback_time
</select>
<select id="getLineChartsNames" resultType="java.lang.String">
select
distinct mrw.product_name productName
from mes_report_work mrw
where
CONVERT(varchar(10),mrw.feedback_time, 120) >= #{productDateStart}
and #{productDateEnd} >= CONVERT(varchar(10),mrw.feedback_time, 120)
</select>
<insert id="insertMesReportWork" parameterType="MesReportWork">
<insert id="insertMesReportWork" parameterType="MesReportWork">
insert into mes_report_work
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>

@ -1,4 +1,4 @@
package com.op.quality.Controller;
package com.op.quality.controller;
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
import com.op.common.core.domain.R;
@ -13,7 +13,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
/**
* @ClassName : quaController

@ -2,14 +2,10 @@ package com.op.sap.controller;
import com.op.common.core.domain.R;
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.service.*;
import com.op.sap.service.SapMaterialPreparationService;
import com.op.sap.service.SapOrderService;
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;
@ -35,6 +31,12 @@ public class SapController extends BaseController {
@Autowired
private SapRouterService sapRouterService;
@Autowired
private SapItemSyncService sapItemSyncService;
@Autowired
private SapWorkCenterService sapWorkCenterService;
/**
*
* @return
@ -49,17 +51,18 @@ public class SapController extends BaseController {
*
* @return
*/
// @PostMapping("/itemSync")
// public List itemSync(){
// return sapService.itemSync();
// }
@PostMapping("/itemSync")
@Log(title = "同步SAP物料清单", businessType = BusinessType.SAP)
public R itemSync(){
return sapItemSyncService.itemSync();
}
/**
*
* @return
*/
@PostMapping("/bomSync")
@Log(title = "同步SAP物料清单", businessType = BusinessType.SAP)
@Log(title = "同步SAP物料组件清单", businessType = BusinessType.SAP)
public R bomSync(){
return sapBomService.bomSync();
}
@ -99,6 +102,11 @@ public class SapController extends BaseController {
return sapOrderService.sapCloseOrder(shopOrder);
}
/**
*
* @param sapRFW
* @return
*/
@PostMapping("/sapRFWOrder")
@Log(title = "生产订单报工接口", businessType = BusinessType.SAP)
public R sapRFWOrder(@RequestBody SapRFW sapRFW){
@ -106,9 +114,42 @@ public class SapController extends BaseController {
}
/**
* 线
* @return
*/
@PostMapping("/sapRouterSync")
@Log(title = "工艺路线同步接口", businessType = BusinessType.SAP)
public R sapRouerSync() {
return sapRouterService.sapRouterSync();
}
/**
*
*/
@PostMapping("/sapWorkCenterSync")
@Log(title = "工作中心接口", businessType = BusinessType.SAP)
public R sapWorkCenterSync(){
return sapWorkCenterService.sapWorkCenterSync();
}
/**
*
*/
@PostMapping("/sapSupplierSync")
@Log(title = "供应商主数据", businessType = BusinessType.SAP)
public R sapSupplierSync(){
return sapWorkCenterService.sapSupplierSync();
}
/**
*
* @return
*/
@PostMapping("/sapCustomSync")
@Log(title = "客户主数据", businessType = BusinessType.SAP)
public R sapCustomSync(){
return sapWorkCenterService.sapCustomSync();
}
}

@ -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;
}
}

@ -4,16 +4,20 @@ import com.op.system.api.domain.sap.SapBom;
import com.op.system.api.domain.sap.SapBomComponent;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface SapBomMapper {
/**
* BOM
*
* @param sapBom BOM
* @return
*/
List<SapBom> selectBaseBomByBomCode(String bomCode);
public int insertBaseBom(SapBom sapBom);
void insertBaseBomBatch(List<SapBom> sapBomList);
public int insertBasetBomComponent(SapBomComponent sapBomComponent);
}

@ -2,7 +2,10 @@ 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.SapBom;
public interface SapBomService {
public R bomSync();
SapBom getMaxRevisionBom(String STLNR);
}

@ -0,0 +1,17 @@
package com.op.sap.service;
import com.op.common.core.domain.R;
import java.util.List;
/**
* 20238
*/
public interface SapItemSyncService {
/**
*
* @return
*/
R itemSync();
}

@ -8,12 +8,38 @@ import com.op.system.api.model.SapProOrder;
import java.util.List;
/**
* 20238
*/
public interface SapOrderService {
/**
*
* @param sapProOrder
* @return
*/
R<List<SapProOrder>> shopOrderSync(SapProOrder sapProOrder);
/**
*
* @param sapCreateOrderList
* @return
*/
R<List<String>> SapCreateOrder(List<SapCreateOrder> sapCreateOrderList);
/**
*
* @param shopOrder
* @return
*/
R sapCloseOrder(String shopOrder);
/**
*
* @param sapRFW
* @return
*/
R sapRFWOrder(SapRFW sapRFW);
}

@ -0,0 +1,12 @@
package com.op.sap.service;
import com.op.common.core.domain.R;
public interface SapWorkCenterService {
R sapWorkCenterSync();
R sapSupplierSync();
R sapCustomSync();
}

@ -4,7 +4,11 @@ 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.utils.StringUtils;
import com.op.common.core.utils.uuid.IdUtils;
import com.op.common.core.web.domain.AjaxResult;
import com.op.sap.util.HandleEnum;
import com.op.system.api.domain.sap.SapBom;
import com.op.system.api.domain.sap.SapBomComponent;
import com.op.sap.mapper.SapBomComponentMapper;
@ -13,14 +17,15 @@ import com.op.sap.service.SapBomService;
import com.op.sap.util.SAPConnUtils;
import com.sap.conn.jco.*;
import org.apache.ibatis.session.ExecutorType;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.TreeSet;
import java.util.*;
import java.util.stream.Collectors;
@Service
@ -32,6 +37,9 @@ public class SapBomServiceImpl implements SapBomService {
@Autowired
private SapBomComponentMapper sapBomComponentMapper;
@Autowired
private SqlSessionFactory sqlSessionFactory;
@Override
public R bomSync() {
@ -52,10 +60,10 @@ public class SapBomServiceImpl implements SapBomService {
// jCoTable.setValue(Constants.LOW, "00012222");
JCoTable jCoTables = func.getTableParameterList().getTable("S_MATNR");
jCoTables.appendRow();
jCoTables.setValue(Constants.SIGN, "I");
jCoTables.setValue(Constants.OPTION, "EQ");
jCoTables.setValue(Constants.LOW, "000000010101000115");
// jCoTables.appendRow();
// jCoTables.setValue(Constants.SIGN, "I");
// jCoTables.setValue(Constants.OPTION, "EQ");
// jCoTables.setValue(Constants.LOW, "000000010101000115");
JCoTable S_WERKS_jCoTables = func.getTableParameterList().getTable("S_WERKS");
S_WERKS_jCoTables.appendRow();
@ -68,15 +76,14 @@ public class SapBomServiceImpl implements SapBomService {
JCoTable maraTable = func.getTableParameterList().getTable("LT_BOM");
JCoRecordMetaData metaData = maraTable.getRecordMetaData();
System.out.println("###" + metaData.toString());
SapBom sapBom = new SapBom();
SapBomComponent sapBomComponent=new SapBomComponent();
DynamicDataSourceContextHolder.push("op_xiaolan");
List<SapBom> sapBomList=new ArrayList<>();
List<SapBomComponent> sapBomComponentList=new ArrayList<>();
for (int i = 0; i < maraTable.getNumRows(); i++) {
maraTable.setRow(i);
String STLNR = maraTable.getString("STLNR");
if (STLNR == null || STLNR.equals("")){
throw new ServiceException("组件清单码为空");
}
String MATNR = maraTable.getString("MATNR");
String MAKTX = maraTable.getString("MAKTX");
String WERKS = maraTable.getString("WERKS");
@ -107,40 +114,59 @@ public class SapBomServiceImpl implements SapBomService {
String BEIKZ = maraTable.getString("BEIKZ");
String BEIKZ_NM = maraTable.getString("BEIKZ_NM");
String SANKA = maraTable.getString("SANKA");
System.out.println("物料编码:" + MATNR +
" - 物料名称:" + MAKTX + " - 工厂:" + WERKS +
" - 生产版本:" + VERID + " - BOM单号" + STLNR
+ " - 可选BOM" + STLAL + " - 创建日期:" + ANDAT + " - 创建者:" + ANNAM +
" - 修改日期:" + AEDAT + " - 修改者:" + AENAM
+ " - 生产版本有效期:" + ADATU + " - 生产版本截止日期:" + BDATU + " - BOM计算数量" + LOSGR +
" - BOM计算单位" + MEINS +
" - BOM基本数量" + BMENG + " - BOM基本单位" + BMEIN + " - BOM层次" + STUFE + " - 项目编号:" + WEGXX
+ " - 组件编码:" + PMATNR + " - 组件名称:" + PMAKTX + " - 组件上层物料名称:" + OJTXB
+ " - 标准用量:" + PMENGE + " - 损耗率:" + PAUSCH + " - 损耗额:" + PXHLCE + " - 含损耗用量:" + PMNGKO
+ " - 组件数量单位:" + PMEINS + " - 组件采购标志:" + PBESKZ + " - 物料供应标识:" + BEIKZ + " - 物料供应标识:" + BEIKZ_NM
+ " - 成本核算标识相关:" + SANKA);
// sapBom.setFactoryCode(WERKS);
// sapBom.setProductionVersion(VERID);
// sapBom.setBomCode(STLNR);
// sapBom.setOptionalBom(STLAL);
// sapBom.setPvvd(DateUtils.dateTime("yyyy-MM-dd", ADATU));
// sapBom.setPved(DateUtils.dateTime("yyyy-MM-dd", BDATU));
// sapBom.setBomCalculateNumber(new BigDecimal(LOSGR));
// sapBom.setBomCalculateUnit(MEINS);
// sapBom.setBomBaseNumber(new BigDecimal(BMENG));
// sapBom.setBomBaseUnit(BMEIN);
// sapBom.setComponentUnit(PMEINS);
// sapBom.setComponentProFlag(PBESKZ);
// sapBom.setCreateBy(ANNAM);
// // sapBom.setCreateTime(DateUtils.dateTime("yyyy-MM-dd", ANDAT));
// sapBom.setUpdateBy(AENAM);
// // sapBom.setUpdateTime(DateUtils.dateTime("yyyy-MM-dd", AEDAT));
String OJMBR = maraTable.getString("OJMBR");
if (!StringUtils.isEmpty(STLAL)){
System.out.println("物料编码:" + MATNR +
" - 物料名称:" + MAKTX + " - 工厂:" + WERKS +
" - 生产版本:" + VERID + " - BOM单号" + STLNR
+ " - 可选BOM" + STLAL + " - 创建日期:" + ANDAT + " - 创建者:" + ANNAM +
" - 修改日期:" + AEDAT + " - 修改者:" + AENAM
+ " - 生产版本有效期:" + ADATU + " - 生产版本截止日期:" + BDATU + " - BOM计算数量" + LOSGR +
" - BOM计算单位" + MEINS +
" - BOM基本数量" + BMENG + " - BOM基本单位" + BMEIN + " - BOM层次" + STUFE + " - 项目编号:" + WEGXX
+ " - 组件编码:" + PMATNR + " - 组件名称:" + PMAKTX + " - 组件上层物料编码:" + OJMBR+" - 组件上层物料名称:" + OJTXB
+ " - 标准用量:" + PMENGE + " - 损耗率:" + PAUSCH + " - 损耗额:" + PXHLCE + " - 含损耗用量:" + PMNGKO
+ " - 组件数量单位:" + PMEINS + " - 组件采购标志:" + PBESKZ + " - 物料供应标识:" + BEIKZ + " - 物料供应标识:" + BEIKZ_NM
+ " - 成本核算标识相关:" + SANKA);
}
//插入BOM表
//BomBO
/**
* BOM
*/
SapBom sapBom = new SapBom();
sapBom.setFactoryCode(WERKS);
sapBom.setProductionVersion(STLAL);
sapBom.setBomCode(STLNR);
sapBom.setCumc(OJMBR);
sapBom.setComponent(PMATNR);
sapBom.setOptionalBom(STLAL);
sapBom.setPvvd(DateUtils.dateTime("yyyy-MM-dd", ADATU));
sapBom.setPved(DateUtils.dateTime("yyyy-MM-dd", BDATU));
sapBom.setBomCalculateNumber(new BigDecimal(LOSGR));
sapBom.setBomCalculateUnit(MEINS);
sapBom.setBomBaseNumber(new BigDecimal(BMENG));
sapBom.setBomBaseUnit(BMEIN);
sapBom.setComponentUnit(PMEINS);
sapBom.setComponentProFlag(PBESKZ);
// sapBom.setCurrentVersion("");
sapBom.setCreateBy(ANNAM);
sapBom.setCreateTime(DateUtils.dateTime("yyyy-MM-dd", ANDAT));
sapBom.setUpdateBy(AENAM);
sapBom.setUpdateTime(DateUtils.dateTime("yyyy-MM-dd", AEDAT));
SapBomComponent sapBomComponent=new SapBomComponent();
sapBomComponent.setBomCode(STLNR);
sapBomComponent.setSite(WERKS);
sapBomComponent.setSite("1000");
sapBomComponent.setMsi(BEIKZ);
sapBomComponent.setSanka(SANKA);
sapBomComponent.setProductCode(MATNR);
sapBomComponent.setCumc(OJTXB);
sapBomComponent.setCumc(OJMBR);
sapBomComponent.setComponent(PMATNR);
sapBomComponent.setBomHierarchy(STUFE);
sapBomComponent.setProjectNo(WEGXX);
sapBomComponent.setStandardDosage(new BigDecimal(PMENGE));
@ -148,13 +174,13 @@ public class SapBomServiceImpl implements SapBomService {
sapBomComponent.setLossAmount(new BigDecimal(PXHLCE));
sapBomComponent.setCilosses(new BigDecimal(PMNGKO));
sapBomComponent.setCreateBy(ANNAM);
// sapBomComponent.setCreateTime(DateUtils.dateTime("yyyy-MM-dd", ANDAT));
sapBomComponent.setCreateTime(DateUtils.dateTime("yyyy-MM-dd", ANDAT));
sapBomComponent.setUpdateBy(AENAM);
// sapBomComponent.setUpdateTime(DateUtils.dateTime("yyyy-MM-dd", AEDAT));
// sapBomList.add(sapBom);
// sapBomComponentMapper.insertSapBomComponent(sapBomComponent);
sapBomComponent.setUpdateTime(DateUtils.dateTime("yyyy-MM-dd", AEDAT));
sapBomComponentList.add(sapBomComponent);
sapBomList.add(sapBom);
}
// inserBaseBom(sapBomList);
createBOM(sapBomList,sapBomComponentList);
return R.ok();
} catch (Exception e) {
return R.fail(e.getMessage());
@ -162,10 +188,65 @@ public class SapBomServiceImpl implements SapBomService {
}
}
public void inserBaseBom(List<SapBom> sapBomList){
sapBomList = sapBomList.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(SapBom::getBomCode))), ArrayList::new));
for (SapBom sapBom:sapBomList) {
sapBomMapper.insertBaseBom(sapBom);
@Override
public SapBom getMaxRevisionBom(String STLNR) {
List<SapBom> list = sapBomMapper.selectBaseBomByBomCode(STLNR);
if (list == null || list.size() <= 0) {
return null;
}
return list.get(0);
}
public void createBOM(List<SapBom> sapBomList,List<SapBomComponent> sapBomComponentList){
List<SapBom> newBomList = sapBomList.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(SapBom::getBomCode))), ArrayList::new));
if (newBomList.size()>0){
DynamicDataSourceContextHolder.push("ds_1000");
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH,false);
for (SapBom sapBom:newBomList) {
List<SapBomComponent> sapBomComponents;
//查询Bom号是否存在
SapBom bomModel = this.getMaxRevisionBom(sapBom.getBomCode());
//存在且版本号大于现有版本
if (bomModel!=null&&sapBom.getOptionalBom()!=null&&Float.parseFloat(sapBom.getOptionalBom())>Float.parseFloat(bomModel.getOptionalBom()))
{
//升级BOM
String bomBo = HandleEnum.BOM.getHandle(sapBom.getFactoryCode(),sapBom.getBomCode(),sapBom.getOptionalBom());
sapBom.setBomBo(bomBo);
//插入BOM表
sapBomMapper.insertBaseBom(sapBom);
//筛选组件清单
sapBomComponents = sapBomComponentList.stream().filter(sbc->
sbc.getBomCode().equals(sapBom.getBomCode())).collect(Collectors.toList());
//执行插入
sapBomComponents.stream().forEach(components -> {
components.setBomBo(bomBo);
sapBomComponentMapper.insertSapBomComponent(components);
});
}
else if (bomModel==null&&sapBom.getOptionalBom()!=null){
//插入初始BOM
String bomBo = HandleEnum.BOM.getHandle(sapBom.getFactoryCode(),sapBom.getBomCode(),sapBom.getOptionalBom());
sapBom.setBomBo(bomBo);
//插入BOM表
sapBomMapper.insertBaseBom(sapBom);
//筛选组件清单
sapBomComponents = sapBomComponentList.stream().filter(sbc->
sbc.getBomCode().equals(sapBom.getBomCode())).collect(Collectors.toList());
//执行插入
sapBomComponents.stream().forEach(components -> {
components.setBomBo(bomBo);
sapBomComponentMapper.insertSapBomComponent(components);
});
}
sqlSession.commit();
sqlSession.clearCache();
}
}
}

@ -0,0 +1,130 @@
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.sap.mapper.SapBaseProductMapper;
import com.op.sap.service.SapItemSyncService;
import com.op.sap.util.SAPConnUtils;
import com.op.system.api.domain.sap.SapBaseProduct;
import com.sap.conn.jco.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
@Service
public class SapItemSyncImpl implements SapItemSyncService {
@Autowired
private SapBaseProductMapper sapBaseProductMapper;
@Override
public R itemSync() {
try {
// 获取调用 RFC 函数对象
//获取连接
JCoDestination dest = SAPConnUtils.connect();
JCoRepository repository = dest.getRepository();
JCoFunction func = repository.getFunction("ZMMR_MES_MAT_GET");
if (func == null) {
throw new RuntimeException("Function does not exist in SAP");
}
JCoTable jCoTables = func.getTableParameterList().getTable("S_MATNR");
System.out.println(jCoTables);
// jCoTables.appendRow();
// jCoTables.setValue(Constants.SIGN, "I");
// jCoTables.setValue(Constants.OPTION, "EQ");
// jCoTables.setValue(Constants.LOW, "000000010101000115");
// 获取调用 RFC 函数对象
func.execute(dest);
// 获取 内表 - ZMES_PRO
JCoTable maraTable = func.getTableParameterList().getTable("LT_MARA");
JCoRecordMetaData metaData = maraTable.getRecordMetaData();
System.out.println("###" + metaData.toString());
DynamicDataSourceContextHolder.push("ds_1000");
for (int i = 0; i < maraTable.getNumRows(); i++) {
SapBaseProduct baseProduct = new SapBaseProduct();
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+
"物料描述(短文本):" + MAKTX+
"国际文件号(EAN/UPC)" + EAN11+
"物料类型:" + MTART+
"物料类型描述:" + MTBEZ+
"物料组:" + MATKL+
"物料组描述:" + WGBEZ+
"毛重:" + BRGEW+
"净重:" + NTGEW+
"体积:" + VOLUM+
"体积单位:" + VOLEH+
"基本计量单位:" + MEINS+
"帐面库存单位的可选计量单位 " + MEINH+
"基本计量单位转换分子:" + UMREZ+
"转换为基本计量单位的分母:" + UMREN+
"在客户级标记要删除的物料:" + LVORM+
"数量:" + MENGE+
"总货架寿命 " + MHDHB+
"产品组:" + SPART+
"产品组描述:" + SPART_NM+
"物料组1" + MVGR1+
"物料组1描述" + MVGR1_NM+
"物料组2" + MVGR2+
"物料组2描述" + MVGR2_NM+
" 物料组3" + MVGR3+
" 物料组描述 " + MVGR3_NM);
//查询物料存不存在
baseProduct.setProductCode(MATNR);
SapBaseProduct sapBaseProduct=sapBaseProductMapper.selectBaseProductByProductCode(baseProduct);
if (sapBaseProduct==null){
sapBaseProduct.setProductCode(MATNR);
sapBaseProduct.setProductDescZh(MAKTX);
// baseProduct.setProductean11(EAN11);
sapBaseProduct.setProductGroup(MATKL);
sapBaseProduct.setProductGroupName(WGBEZ);
sapBaseProduct.setGrossWeight(BRGEW);
sapBaseProduct.setNetWeight(NTGEW);
sapBaseProduct.setVolume(VOLUM);
sapBaseProduct.setDelFlag("0");
// sapBaseProductMapper.insertBaseProduct(sapBaseProduct);
}
}
return R.ok();
}catch (Exception e){
return R.fail(e.getMessage());
}
}
}

@ -0,0 +1,169 @@
package com.op.sap.service.impl;
import com.op.common.core.domain.R;
import com.op.common.core.utils.DateUtils;
import com.op.sap.service.SapWorkCenterService;
import com.op.sap.util.SAPConnUtils;
import com.op.system.api.domain.sap.SapWorkCenter;
import com.sap.conn.jco.*;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
@Service
public class SapWorkCenterServiceImpl implements SapWorkCenterService {
@Override
public R sapWorkCenterSync() {
try {
// 获取调用 RFC 函数对象
//获取连接
JCoDestination dest = SAPConnUtils.connect();
JCoRepository repository = dest.getRepository();
JCoFunction func = repository.getFunction("ZMES_GET_ARBPL");
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_ARBPL");
JCoRecordMetaData metaData = maraTable.getRecordMetaData();
System.out.println("###" + metaData.toString());
List<SapWorkCenter> sapWorkCenterList=new ArrayList<>();
for (int i = 0; i <maraTable.getNumRows(); i++) {
maraTable.setRow(i);
SapWorkCenter sapWorkCenter=new SapWorkCenter();
String WERKS = maraTable.getString("WERKS");
String NAME1 = maraTable.getString("NAME1");
String ARBPL = maraTable.getString("ARBPL");
String KTEXT = maraTable.getString("KTEXT");
String AEDAT_GRND = maraTable.getString("AEDAT_GRND");
System.out.println(
"工厂:" + WERKS+
"工厂描述:" + NAME1+
"工作中心:" + ARBPL+
"工作中心描述 " + KTEXT+
"更新日期:" + AEDAT_GRND);
sapWorkCenter.setWeeks(WERKS);
sapWorkCenter.setName1(NAME1);
sapWorkCenter.setArbpl(ARBPL);
sapWorkCenter.setKtext(KTEXT);
sapWorkCenter.setAedat_grnd(DateUtils.dateTime("yyyy-MM-dd", AEDAT_GRND));
sapWorkCenterList.add(sapWorkCenter);
}
return R.ok(sapWorkCenterList);
}catch (Exception e){
return R.fail(e.getMessage());
}
}
@Override
public R sapSupplierSync() {
try {
// 获取调用 RFC 函数对象
//获取连接
JCoDestination dest = SAPConnUtils.connect();
JCoRepository repository = dest.getRepository();
JCoFunction func = repository.getFunction("ZMES_GET_LFB1");
if (func == null) {
throw new RuntimeException("Function does not exist in SAP");
}
// 配置传入参数
JCoTable jCoTable = func.getTableParameterList().getTable("S_BUKRS");
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_LIFNR");
JCoRecordMetaData metaData = maraTable.getRecordMetaData();
System.out.println("###" + metaData.toString());
List<SapWorkCenter> sapWorkCenterList=new ArrayList<>();
for (int i = 0; i <maraTable.getNumRows(); i++) {
maraTable.setRow(i);
SapWorkCenter sapWorkCenter=new SapWorkCenter();
String BUKRS = maraTable.getString("BUKRS");
String LIFNR = maraTable.getString("LIFNR");
String NAME1 = maraTable.getString("NAME1");
String TELF1 = maraTable.getString("TELF1");
String STRAS = maraTable.getString("STRAS");
System.out.println(
"公司代码:" + BUKRS+
"供应商:" + LIFNR+
"供应商名称:" + NAME1+
"第一个电话号 " + TELF1+
"住宅号及街道:" + STRAS);
// sapWorkCenter.setWeeks(WERKS);
// sapWorkCenter.setName1(NAME1);
// sapWorkCenter.setArbpl(ARBPL);
// sapWorkCenter.setKtext(KTEXT);
// sapWorkCenter.setAedat_grnd(DateUtils.dateTime("yyyy-MM-dd", AEDAT_GRND));
// sapWorkCenterList.add(sapWorkCenter);
}
return R.ok(sapWorkCenterList);
}catch (Exception e){
return R.fail(e.getMessage());
}
}
@Override
public R sapCustomSync() {
try {
// 获取调用 RFC 函数对象
//获取连接
JCoDestination dest = SAPConnUtils.connect();
JCoRepository repository = dest.getRepository();
JCoFunction func = repository.getFunction("ZMES_GET_KNA1");
if (func == null) {
throw new RuntimeException("Function does not exist in SAP");
}
// 配置传入参数
JCoTable jCoTable = func.getTableParameterList().getTable("S_BUKRS");
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_KUNNR");
JCoRecordMetaData metaData = maraTable.getRecordMetaData();
System.out.println("###" + metaData.toString());
List<SapWorkCenter> sapWorkCenterList=new ArrayList<>();
for (int i = 0; i <maraTable.getNumRows(); i++) {
maraTable.setRow(i);
SapWorkCenter sapWorkCenter=new SapWorkCenter();
String BUKRS = maraTable.getString("BUKRS");
String KUNNR = maraTable.getString("KUNNR");
String NAME1 = maraTable.getString("NAME1");
String TELF1 = maraTable.getString("TELF1");
String STRAS = maraTable.getString("STRAS");
String ERDAT = maraTable.getString("ERDAT");
System.out.println(
"公司代码:" + BUKRS+
"客户编号:" + KUNNR+
"客户名称:" + NAME1+
"第一个电话号 " + TELF1+
"住宅号及街道:" + STRAS+
"记录创建日期"+ERDAT);
// sapWorkCenter.setWeeks(WERKS);
// sapWorkCenter.setName1(NAME1);
// sapWorkCenter.setArbpl(ARBPL);
// sapWorkCenter.setKtext(KTEXT);
// sapWorkCenter.setAedat_grnd(DateUtils.dateTime("yyyy-MM-dd", AEDAT_GRND));
// sapWorkCenterList.add(sapWorkCenter);
}
return R.ok(sapWorkCenterList);
}catch (Exception e){
return R.fail(e.getMessage());
}
}
}

@ -0,0 +1,260 @@
package com.op.sap.util;
import java.text.MessageFormat;
/**
* HANDLE
*
* @author Ervin Chen
* @date 2020/2/5 14:50
*/
public enum HandleEnum {
/**
*
*/
SFC("SFCBO:", "SFCBO:{0},{1}"),
/**
*
**/
USER("UserBO:", "UserBO:{0},{1}"),
/**
*
**/
BOM("BOMBO:", "BOMBO:{0},{1},{2}"),
PRINT("PrintBO:", "PrintBO:{0},{1}"),
/**
*
**/
CALL_ITEM("CallItemBO:", "CallItemBO:{0},{1}"),
/**
*
*/
SHOP_ORDER("ShopOrderBO:", "ShopOrderBO:{0},{1}"),
/**
*
*/
SFC_BOM("SFCBOMBO:", "SFCBOMBO:{0}"),
SFC_DATA("SFCDataBO:", "SFCDataBO:{0},{1}"),
/**
*
*/
ITEM("ItemBO:", "ItemBO:{0},{1},{2}"),
/**
*
*/
RESOURCE("ResourceBO:", "ResourceBO:{0},{1}"),
/**
*
**/
STATUS("StatusBO:", "StatusBO:{0},{1}"),
/**
*
**/
RESOURCE_TYPE("ResourceTypeBO:", "ResourceTypeBO:{0},{1}"),
/****/
RESOURCE_TYPE_RESOURCEBO("ResourceTypeResourceBO", "ResourceTypeResourceBO:{0},{1}"),
/**
* 线
*/
ROUTER("RouterBO:", "RouterBO:{0},{1},{2},{3}"),
ROUTER_OPERATION("RouterOperationBO:", "RouterOperationBO:RouterStepBO:{0},{1}"),
/**
* 线
**/
ROUTER_STEP("RouterStepBO:", "RouterStepBO:{0},{1},{2},{3},{4}"),
/**
*
*/
INVENTORY("InventoryBO:", "InventoryBO:{0},{1}"),
/**
*
*/
ITEM_GROUP("ItemGroupBO:", "ItemGroupBO:{0},{1}"),
/**
*
*/
DATA_FIELD("DataFieldBO:", "DataFieldBO:{0},{1}"),
/**
*
*/
NEXT_NUMBER("NextNumberBO:", "NextNumberBO:{0},{1}"),
/**
*
*/
OPERATION("OperationBO:", "OperationBO:{0},{1},{2}"),
/**
*
**/
WORK_CENTER("WorkCenterBO:", "WorkCenterBO:{0},{1}"),
/****/
SFC_DISPATCH("SfcDispatchBO:", "SfcDispatchBO:{0},{1}"),
/**
*
*/
INSPECTION_ITEM("InspectionItemBO:", "InspectionItemBO:{0},{1},{2}"),
/**
*
*/
NEXT_NUMBER_CODE("NextNumberCodeBO:", "NextNumberCodeBO:{0},{1},{2}"),
/**
*
**/
RESOURCE_INSPECT_PLAN("ResourceInspectPlanBo", "ResourceInspectPlanBo:{0},{1},{2}"),
/**
* ,HANDLE,HANDLE
**/
RESOURCE_INSPECT_RESOURCE("ResourceInspectResourceBo", "ResourceInspectResourceBo:{0},{1},{2}"),
/**
*
**/
RESOURCE_INSPECT_TASK("ResourceInspectTaskBo", "ResourceInspectTaskBo:{0},{1}"),
/**
*
**/
SPLIT_SFC("SplitSfcBo", "SplitSfcBo:{0},{1}"),
/**
*
**/
RESOURCE_REPAIR_TASK("ResourceRepairTaskBo", "ResourceRepairTaskBo:{0},{1}"),
/**
*
**/
ITEM_BATCH("ItemBatchBo", "ItemBatchBo:{0},{1},{2}"),
/**
*
**/
PROD_READY_TASK("ProdReadyTaskBO", "ProdReadyTaskBO:{0},{1}"),
/**
*
**/
PROD_READY_TASK_DETAIL("ProdReadyTaskDetailBO", "ProdReadyTaskDetailBO:{0},{1}"),
/**
*
**/
RESOURCE_INSPECT_TASK_PARAM("ResourceInspectTaskParamBo", "ResourceInspectTaskParamBo:{0},{1}"),
/**
*
**/
ABNORMAL_BILL("AbnormalBillBo", "AbnormalBillBo:{0},{1}"),
/**
*
**/
ABNORMAL_BILL_DISPOSE("AbnormalBillDisposeBo", "AbnormalBillDisposeBo:{0},{1}"),
/**
*
**/
NC_CODE("NCCodeBO", "NCCodeBO:{0},{1}"),
/**
*
**/
NC_GROUP("NCGroupBO", "NCGroupBO:{0},{1}"),
/**
*
**/
DATA_TYPE("DataTypeBO", "DataTypeBO:{0},{1},{2}"),
/**
*
**/
RESOURCE_INSPECT_TASK_SPARE("ResourceInspectTaskSpareBo", "ResourceInspectTaskSpareBo:{0},{1}"),
/**
*
**/
INSPECTION_TASK("InspectionBO:", "InspectionBO:{0},{1}"),
/**
*
**/
INSPECTION_TASK_DETAIL("InspectionTaskDetailBO:", "InspectionTaskDetailBO:{0},{1}"),
/**
*
**/
SELF_REPORT("SelfReportBO:", "SelfReportBO:{0},{1}"),
/**
*
**/
LOAD_INVENTORY("LoadInventoryBO:", "LoadInventoryBO:{0},{1}"),
/**
*
**/
USR("UserBO", "UserBO:{0},{1}"),
TOOL("ToolBO", "ToolBO:{0},{1}"),
USER_RESOURCE("UserResourceBo", "UserResourceBo:{0},{1},{2}"),
SFC_SCRAP("SfcScrapBo", "SfcScrapBo:{0},{1}"),
ABNORMAL_PLAN("AbnormalPlanBo", "AbnormalPlanBo:{0},{1}");
private String prefix;
private String pattern;
HandleEnum(String prefix, String pattern) {
this.prefix = prefix;
this.pattern = pattern;
}
public String getHandle(String... parts) {
return MessageFormat.format(pattern, parts);
}
public String getPart(String handle, int position) {
String handleParts = handle.replace(prefix, "");
String[] parts = handleParts.split(",");
if (position >= parts.length) {
return null;
} else {
return parts[position];
}
}
public String getPrefix() {
return prefix;
}
}

@ -14,12 +14,12 @@ spring:
nacos:
discovery:
namespace: lanju-op
group: zxl
group: ywl
# 服务注册地址
server-addr: 140.249.53.142:8848
config:
namespace: lanju-op
group: zxl
group: ywl
#命名空间
#group: local
# 配置中心地址

@ -68,6 +68,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
insert into base_bom_component
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="bomBo != null">bom_bo,</if>
<if test="bomCode != null and bomCode != ''">bom_code,</if>
<if test="site != null">site,</if>
<if test="productCode != null">product_code,</if>
@ -94,6 +95,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="bomBo != null">#{bomBo},</if>
<if test="bomCode != null and bomCode != ''">#{bomCode},</if>
<if test="site != null">#{site},</if>
<if test="productCode != null">#{productCode},</if>

@ -60,14 +60,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where>
</select>
<select id="selectBaseBomByFactoryCode" parameterType="String" resultMap="BaseBomResult">
<select id="selectBaseBomByBomCode" parameterType="String" resultMap="BaseBomResult">
<include refid="selectBaseBomVo"/>
where factory_code = #{factoryCode}
where bom_code = #{bomCode}
order by production_version desc
</select>
<insert id="insertBaseBom" parameterType="com.op.system.api.domain.sap.SapBom">
insert into base_bom
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="bomBo != null">bom_bo,</if>
<if test="factoryCode != null">factory_code,</if>
<if test="productionVersion != null">production_version,</if>
<if test="bomCode != null">bom_code,</if>
@ -94,6 +96,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="currentVersion != null">current_version,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="bomBo != null">#{bomBo},</if>
<if test="factoryCode != null">#{factoryCode},</if>
<if test="productionVersion != null">#{productionVersion},</if>
<if test="bomCode != null">#{bomCode},</if>
@ -120,6 +123,64 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="currentVersion != null">#{currentVersion},</if>
</trim>
</insert>
<insert id="insertBaseBomBatch">
insert into base_bom
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="item.bomBo != null">bom_bo,</if>
<if test="item.factoryCode != null">factory_code,</if>
<if test="item.productionVersion != null">production_version,</if>
<if test="item.bomCode != null">bom_code,</if>
<if test="item.optionalBom != null">optional_bom,</if>
<if test="item.optionalBomText != null">optional_bom_text,</if>
<if test="item.pvvd != null">pvvd,</if>
<if test="item.pved != null">pved,</if>
<if test="item.bomCalculateNumber != null">bom_calculate_number,</if>
<if test="item.bomCalculateUnit != null">bom_calculate_unit,</if>
<if test="item.bomBaseNumber != null">bom_base_number,</if>
<if test="item.bomBaseUnit != null">bom_base_unit,</if>
<if test="item.componentUnit != null">component_unit,</if>
<if test="item.componentProFlag != null">component_pro_flag,</if>
<if test="item.msi != null">msi,</if>
<if test="item.sanka != null">sanka,</if>
<if test="item.attr1 != null">attr1,</if>
<if test="item.attr2 != null">attr2,</if>
<if test="item.attr3 != null">attr3,</if>
<if test="item.createBy != null">create_by,</if>
<if test="item.createTime != null">create_time,</if>
<if test="item.updateBy != null">update_by,</if>
<if test="item.updateTime != null">update_time,</if>
<if test="item.remark != null">remark,</if>
<if test="item.currentVersion != null">current_version,</if>
</trim>
VALUES
<foreach collection="list" index="index" item="item" separator=",">
<if test="item.bomBo != null">#{bomBo},</if>
<if test="item.factoryCode != null">#{factoryCode},</if>
<if test="item.productionVersion != null">#{productionVersion},</if>
<if test="item.bomCode != null">#{bomCode},</if>
<if test="item.optionalBom != null">#{optionalBom},</if>
<if test="item.optionalBomText != null">#{optionalBomText},</if>
<if test="item.pvvd != null">#{pvvd},</if>
<if test="item.pved != null">#{pved},</if>
<if test="item.bomCalculateNumber != null">#{bomCalculateNumber},</if>
<if test="item.bomCalculateUnit != null">#{bomCalculateUnit},</if>
<if test="item.bomBaseNumber != null">#{bomBaseNumber},</if>
<if test="item.bomBaseUnit != null">#{bomBaseUnit},</if>
<if test="item.componentUnit != null">#{componentUnit},</if>
<if test="item.componentProFlag != null">#{componentProFlag},</if>
<if test="item.msi != null">#{msi},</if>
<if test="item.sanka != null">#{sanka},</if>
<if test="item.attr1 != null">#{attr1},</if>
<if test="item.attr2 != null">#{attr2},</if>
<if test="item.attr3 != null">#{attr3},</if>
<if test="item.createBy != null">#{createBy},</if>
<if test="item.createTime != null">#{createTime},</if>
<if test="item.updateBy != null">#{updateBy},</if>
<if test="item.updateTime != null">#{updateTime},</if>
<if test="item.remark != null">#{remark},</if>
<if test="item.currentVersion != null">#{currentVersion},</if>
</foreach>
</insert>
<update id="updateBaseBom" parameterType="com.op.system.api.domain.sap.SapBom">
update base_bom

@ -198,6 +198,7 @@ public class SysDeptServiceImpl implements ISysDeptService {
throw new ServiceException("部门停用,不允许新增");
}
dept.setAncestors(info.getAncestors() + "," + dept.getParentId());
dept.setDelFlag("0");
return deptMapper.insertDept(dept);
}

@ -99,6 +99,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="phone != null and phone != ''">phone,</if>
<if test="email != null and email != ''">email,</if>
<if test="status != null">status,</if>
<if test="delFlag != null and delFlag != ''">del_flag,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
create_time
)values(
@ -111,6 +112,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="phone != null and phone != ''">#{phone},</if>
<if test="email != null and email != ''">#{email},</if>
<if test="status != null">#{status},</if>
<if test="delFlag != null and delFlag != ''">#{delFlag},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
GETDATE()
)

@ -0,0 +1,402 @@
package com.op.wms.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.op.common.core.annotation.Excel;
import com.op.common.core.web.domain.BaseEntity;
/**
* wms_sell_out_embryo
*
* @author Open Platform
* @date 2023-09-04
*/
public class WmsSellOutEmbryo extends BaseEntity {
private static final long serialVersionUID = 1L;
/** ID */
private String id;
/** 交货单号 */
@Excel(name = "交货单号")
private String deliveryOrder;
/** 项次 */
@Excel(name = "项次")
private String itemNumber;
/** 工厂编码 */
@Excel(name = "工厂编码")
private String factoryCode;
/** 仓库编码 */
@Excel(name = "仓库编码")
private String whCode;
/** 库区编码 */
@Excel(name = "库区编码")
private String waCode;
/** 库位编码 */
@Excel(name = "库位编码")
private String wlCode;
/** 出库地点 */
@Excel(name = "出库地点")
private String deliveryPlace;
/** 产品名称 */
@Excel(name = "产品名称")
private String productName;
/** 产品编码 */
@Excel(name = "产品编码")
private String productCode;
/** 产品分类 */
@Excel(name = "产品分类")
private String productSort;
/** 规格型号 */
@Excel(name = "规格型号")
private String specification;
/** 单位 */
@Excel(name = "单位")
private String unitOfMeasure;
/** 批号 */
@Excel(name = "批次号")
private String lotNumber;
/** 计划出库数量 */
@Excel(name = "计划出库数量")
private Long planQuantity;
/** 出库数量 */
@Excel(name = "出库数量")
private Long outQuantity;
/** 出库状态 */
@Excel(name = "出库状态")
private String status;
/** 过账SAP状态 */
@Excel(name = "过账SAP状态")
private String sapStatus;
/** 过账SAP凭证 */
@Excel(name = "过账SAP凭证")
private String sapProof;
/** 过账SAP返回信息 */
@Excel(name = "过账SAP返回信息")
private String sapMessage;
/** 出库时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "出库时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date outDate;
/** 预留字段1 */
@Excel(name = "预留字段1")
private String attr1;
/** 预留字段2 */
@Excel(name = "预留字段2")
private String attr2;
/** 预留字段3 */
@Excel(name = "预留字段3")
private String attr3;
/** 预留字段4 */
@Excel(name = "预留字段4")
private String attr4;
/** 预留字段5 */
@Excel(name = "预留字段5")
private String attr5;
/** 预留字段6 */
@Excel(name = "预留字段6")
private String attr6;
/** 预留字段7 */
@Excel(name = "预留字段7")
private String attr7;
/** 预留字段8 */
@Excel(name = "预留字段8")
private String attr8;
/** 预留字段9 */
@Excel(name = "预留字段9")
private String attr9;
/** 预留字段10 */
@Excel(name = "预留字段10")
private String attr10;
public void setId(String id) {
this.id = id;
}
public String getId() {
return id;
}
public void setDeliveryOrder(String deliveryOrder) {
this.deliveryOrder = deliveryOrder;
}
public String getDeliveryOrder() {
return deliveryOrder;
}
public void setItemNumber(String itemNumber) {
this.itemNumber = itemNumber;
}
public String getItemNumber() {
return itemNumber;
}
public void setFactoryCode(String factoryCode) {
this.factoryCode = factoryCode;
}
public String getFactoryCode() {
return factoryCode;
}
public void setWhCode(String whCode) {
this.whCode = whCode;
}
public String getWhCode() {
return whCode;
}
public void setWaCode(String waCode) {
this.waCode = waCode;
}
public String getWaCode() {
return waCode;
}
public void setWlCode(String wlCode) {
this.wlCode = wlCode;
}
public String getWlCode() {
return wlCode;
}
public void setDeliveryPlace(String deliveryPlace) {
this.deliveryPlace = deliveryPlace;
}
public String getDeliveryPlace() {
return deliveryPlace;
}
public void setProductName(String productName) {
this.productName = productName;
}
public String getProductName() {
return productName;
}
public void setProductCode(String productCode) {
this.productCode = productCode;
}
public String getProductCode() {
return productCode;
}
public void setProductSort(String productSort) {
this.productSort = productSort;
}
public String getProductSort() {
return productSort;
}
public void setSpecification(String specification) {
this.specification = specification;
}
public String getSpecification() {
return specification;
}
public void setUnitOfMeasure(String unitOfMeasure) {
this.unitOfMeasure = unitOfMeasure;
}
public String getUnitOfMeasure() {
return unitOfMeasure;
}
public void setLotNumber(String lotNumber) {
this.lotNumber = lotNumber;
}
public String getLotNumber() {
return lotNumber;
}
public void setPlanQuantity(Long planQuantity) {
this.planQuantity = planQuantity;
}
public Long getPlanQuantity() {
return planQuantity;
}
public void setOutQuantity(Long outQuantity) {
this.outQuantity = outQuantity;
}
public Long getOutQuantity() {
return outQuantity;
}
public void setStatus(String status) {
this.status = status;
}
public String getStatus() {
return status;
}
public void setSapStatus(String sapStatus) {
this.sapStatus = sapStatus;
}
public String getSapStatus() {
return sapStatus;
}
public void setSapProof(String sapProof) {
this.sapProof = sapProof;
}
public String getSapProof() {
return sapProof;
}
public void setSapMessage(String sapMessage) {
this.sapMessage = sapMessage;
}
public String getSapMessage() {
return sapMessage;
}
public void setOutDate(Date outDate) {
this.outDate = outDate;
}
public Date getOutDate() {
return outDate;
}
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(String attr3) {
this.attr3 = attr3;
}
public String getAttr3() {
return attr3;
}
public void setAttr4(String attr4) {
this.attr4 = attr4;
}
public String getAttr4() {
return attr4;
}
public void setAttr5(String attr5) {
this.attr5 = attr5;
}
public String getAttr5() {
return attr5;
}
public void setAttr6(String attr6) {
this.attr6 = attr6;
}
public String getAttr6() {
return attr6;
}
public void setAttr7(String attr7) {
this.attr7 = attr7;
}
public String getAttr7() {
return attr7;
}
public void setAttr8(String attr8) {
this.attr8 = attr8;
}
public String getAttr8() {
return attr8;
}
public void setAttr9(String attr9) {
this.attr9 = attr9;
}
public String getAttr9() {
return attr9;
}
public void setAttr10(String attr10) {
this.attr10 = attr10;
}
public String getAttr10() {
return attr10;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("deliveryOrder", getDeliveryOrder())
.append("itemNumber", getItemNumber())
.append("factoryCode", getFactoryCode())
.append("whCode", getWhCode())
.append("waCode", getWaCode())
.append("wlCode", getWlCode())
.append("deliveryPlace", getDeliveryPlace())
.append("productName", getProductName())
.append("productCode", getProductCode())
.append("productSort", getProductSort())
.append("specification", getSpecification())
.append("unitOfMeasure", getUnitOfMeasure())
.append("lotNumber", getLotNumber())
.append("planQuantity", getPlanQuantity())
.append("outQuantity", getOutQuantity())
.append("status", getStatus())
.append("sapStatus", getSapStatus())
.append("sapProof", getSapProof())
.append("sapMessage", getSapMessage())
.append("outDate", getOutDate())
.append("attr1", getAttr1())
.append("attr2", getAttr2())
.append("attr3", getAttr3())
.append("attr4", getAttr4())
.append("attr5", getAttr5())
.append("attr6", getAttr6())
.append("attr7", getAttr7())
.append("attr8", getAttr8())
.append("attr9", getAttr9())
.append("attr10", getAttr10())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}

@ -0,0 +1,254 @@
package com.op.wms.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.op.common.core.annotation.Excel;
import com.op.common.core.web.domain.BaseEntity;
/**
* wms_sell_out_tray
*
* @author Open Platform
* @date 2023-09-04
*/
public class WmsSellOutTray extends BaseEntity {
private static final long serialVersionUID = 1L;
/** ID */
private String id;
/** 交货单号 */
@Excel(name = "交货单号")
private String deliveryOrder;
/** 工厂编码 */
@Excel(name = "工厂编码")
private String factoryCode;
/** 仓库编码 */
@Excel(name = "仓库编码")
private String whCode;
/** 库区编码 */
@Excel(name = "库区编码")
private String waCode;
/** 库位编码 */
@Excel(name = "库位编码")
private String wlCode;
/** 产品名称 */
@Excel(name = "产品名称")
private String productName;
/** 产品编码 */
@Excel(name = "产品编码")
private String productCode;
/** 产品分类 */
@Excel(name = "产品分类")
private String productSort;
/** 托盘号 */
@Excel(name = "托盘号")
private String sn;
/** 箱码 */
@Excel(name = "箱码")
private String barcode;
/** 预留字段1 */
@Excel(name = "批次号")
private String lotNumber;
/** 预留字段2 */
@Excel(name = "预留字段2")
private String userDefined2;
/** 预留字段3 */
@Excel(name = "预留字段3")
private String userDefined3;
/** 预留字段4 */
@Excel(name = "预留字段4")
private String userDefined4;
/** 预留字段5 */
@Excel(name = "预留字段5")
private String userDefined5;
/** 预留字段6 */
@Excel(name = "预留字段6")
private String userDefined6;
/** 预留字段7 */
@Excel(name = "预留字段7")
private String userDefined7;
/** 预留字段8 */
@Excel(name = "预留字段8")
private String userDefined8;
public void setId(String id) {
this.id = id;
}
public String getId() {
return id;
}
public void setDeliveryOrder(String deliveryOrder) {
this.deliveryOrder = deliveryOrder;
}
public String getDeliveryOrder() {
return deliveryOrder;
}
public void setFactoryCode(String factoryCode) {
this.factoryCode = factoryCode;
}
public String getFactoryCode() {
return factoryCode;
}
public void setWhCode(String whCode) {
this.whCode = whCode;
}
public String getWhCode() {
return whCode;
}
public void setWaCode(String waCode) {
this.waCode = waCode;
}
public String getWaCode() {
return waCode;
}
public void setWlCode(String wlCode) {
this.wlCode = wlCode;
}
public String getWlCode() {
return wlCode;
}
public void setProductName(String productName) {
this.productName = productName;
}
public String getProductName() {
return productName;
}
public void setProductCode(String productCode) {
this.productCode = productCode;
}
public String getProductCode() {
return productCode;
}
public void setProductSort(String productSort) {
this.productSort = productSort;
}
public String getProductSort() {
return productSort;
}
public void setSn(String sn) {
this.sn = sn;
}
public String getSn() {
return sn;
}
public void setBarcode(String barcode) {
this.barcode = barcode;
}
public String getBarcode() {
return barcode;
}
public void setLotNumber(String lotNumber) {
this.lotNumber = lotNumber;
}
public String getLotNumber() {
return lotNumber;
}
public void setUserDefined2(String userDefined2) {
this.userDefined2 = userDefined2;
}
public String getUserDefined2() {
return userDefined2;
}
public void setUserDefined3(String userDefined3) {
this.userDefined3 = userDefined3;
}
public String getUserDefined3() {
return userDefined3;
}
public void setUserDefined4(String userDefined4) {
this.userDefined4 = userDefined4;
}
public String getUserDefined4() {
return userDefined4;
}
public void setUserDefined5(String userDefined5) {
this.userDefined5 = userDefined5;
}
public String getUserDefined5() {
return userDefined5;
}
public void setUserDefined6(String userDefined6) {
this.userDefined6 = userDefined6;
}
public String getUserDefined6() {
return userDefined6;
}
public void setUserDefined7(String userDefined7) {
this.userDefined7 = userDefined7;
}
public String getUserDefined7() {
return userDefined7;
}
public void setUserDefined8(String userDefined8) {
this.userDefined8 = userDefined8;
}
public String getUserDefined8() {
return userDefined8;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("deliveryOrder", getDeliveryOrder())
.append("factoryCode", getFactoryCode())
.append("whCode", getWhCode())
.append("waCode", getWaCode())
.append("wlCode", getWlCode())
.append("productName", getProductName())
.append("productCode", getProductCode())
.append("productSort", getProductSort())
.append("sn", getSn())
.append("barcode", getBarcode())
.append("lotNumber", getLotNumber())
.append("userDefined2", getUserDefined2())
.append("userDefined3", getUserDefined3())
.append("userDefined4", getUserDefined4())
.append("userDefined5", getUserDefined5())
.append("userDefined6", getUserDefined6())
.append("userDefined7", getUserDefined7())
.append("userDefined8", getUserDefined8())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}
Loading…
Cancel
Save