Merge remote-tracking branch 'origin/master'

highway
zhaoxiaolin 1 year ago
commit 80d762197c

@ -1,5 +1,7 @@
package com.op.system.api.domain.sap;
import java.util.List;
/**
*
*/
@ -7,14 +9,14 @@ public class SapRFW {
private String aufnr;
private String gamng;
private lt_gs lt_gs;
private lt_hw lt_hw;
private List<lt_hw> lt_hwList;
public SapRFW.lt_hw getLt_hw() {
return lt_hw;
public List<lt_hw> getLt_hwList() {
return lt_hwList;
}
public void setLt_hw(SapRFW.lt_hw lt_hw) {
this.lt_hw = lt_hw;
public void setLt_hwList(List<lt_hw> lt_hwList) {
this.lt_hwList = lt_hwList;
}
public SapRFW.lt_gs getLt_gs() {
@ -140,13 +142,5 @@ public class SapRFW {
'}';
}
}
@Override
public String toString() {
return "{" +
"aufnr:"+aufnr+","+
"gamng:"+gamng+","+
"lt_gs:"+lt_gs.toString()+","+
"lt_hw:"+lt_hw.toString()+","+
"}";
}
}

@ -1,6 +1,7 @@
package com.op.device.controller;
import com.op.common.core.web.domain.AjaxResult;
import com.op.device.domain.EquOperationRecord;
import com.op.device.service.IDeviceInterfaceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@ -49,4 +50,25 @@ public class DeviceInterfaceController {
return deviceInterfaceService.getRepairQuantity();
}
/**
* -MTBF top10
* /
* @param equOperationRecord
* @return
*/
@GetMapping("/equipmentStability")
public AjaxResult getEquipmentStabilityList(EquOperationRecord equOperationRecord) {
return deviceInterfaceService.getEquipmentStabilityList(equOperationRecord);
}
/**
*
* /
* @param equOperationRecord
* @return
*/
@GetMapping("/equipmentIntactRate")
public AjaxResult getEquipmentIntactRate(EquOperationRecord equOperationRecord) {
return deviceInterfaceService.getEquipmentIntactRate(equOperationRecord);
}
}

@ -95,6 +95,39 @@ public class EquCheckItem extends BaseEntity {
// 更新日期结束
private String updateTimeEnd;
// 检查项工具
private String itemTools;
// 循环周期类型
private String itemLoopType;
// 循环周期
private int itemLoop;
public int getItemLoop() {
return itemLoop;
}
public void setItemLoop(int itemLoop) {
this.itemLoop = itemLoop;
}
public String getItemLoopType() {
return itemLoopType;
}
public void setItemLoopType(String itemLoopType) {
this.itemLoopType = itemLoopType;
}
public String getItemTools() {
return itemTools;
}
public void setItemTools(String itemTools) {
this.itemTools = itemTools;
}
private List<EquCheckItemDetail> equCheckItemDetailList;
public List<EquCheckItemDetail> getEquCheckItemDetailList() {

@ -64,6 +64,26 @@ public class EquOperationRecord extends BaseEntity {
/** 删除标识 */
private String delFlag;
//MTBF接口字段
//序号
private String serialNumber;
//开机时间
private String onTime;
//故障次数
private String shutDownNumber;
//mtbf
private String mtbf;
//IntactRate 完好设备占比字段
//运行设备
private String operationEquipment;
//故障设备
private String faultEquipment;
//总设备
private String totalEquipment;
//百分比
private String intactRate;
public void setId(String id) {
this.id = id;
}
@ -149,6 +169,70 @@ public class EquOperationRecord extends BaseEntity {
return delFlag;
}
//虚拟字段 序号
public void setSerialNumber(String serialNumber) {
this.serialNumber = serialNumber;
}
public String getSerialNumber() {
return serialNumber;
}
//开机时间
public void setOnTime(String onTime) {
this.onTime = onTime;
}
public String getOnTime() {
return onTime;
}
//故障次数
public void setShutDownNumber(String shutDownNumber) {
this.shutDownNumber = shutDownNumber;
}
public String getShutDownNumber() {
return shutDownNumber;
}
//mtbf
public void setMtbf(String mtbf) {
this.mtbf = mtbf;
}
public String getMtbf() {
return mtbf;
}
//运行设备
public void setOperationEquipment(String operationEquipment) {
this.operationEquipment = operationEquipment;
}
public String getOperationEquipment() {
return operationEquipment;
}
//故障设备
public void setFaultEquipment(String faultEquipment) {
this.faultEquipment = faultEquipment;
}
public String getFaultEquipment() {
return faultEquipment;
}
//总设备
public void setTotalEquipment(String totalEquipment) {
this.totalEquipment = totalEquipment;
}
public String getTotalEquipment() {
return totalEquipment;
}
//完好率
public void setIntactRate(String intactRate) {
this.intactRate = intactRate;
}
public String getIntactRate() {
return intactRate;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

@ -72,6 +72,16 @@ public class EquOrderDetail extends BaseEntity {
private List<EquOrderStandard> standardList;
private String itemTools;
public String getItemTools() {
return itemTools;
}
public void setItemTools(String itemTools) {
this.itemTools = itemTools;
}
public List<EquOrderStandard> getStandardList() {
return standardList;
}

@ -80,6 +80,16 @@ public class EquPlanDetail extends BaseEntity {
// 主计划code
private String planCode;
private String itemTools;
public String getItemTools() {
return itemTools;
}
public void setItemTools(String itemTools) {
this.itemTools = itemTools;
}
public String getPlanCode() {
return planCode;
}

@ -78,6 +78,26 @@ public class EquPlanStandard extends BaseEntity {
private Boolean showFlag;
private String itemMethod;
private String itemTools;
public String getItemMethod() {
return itemMethod;
}
public void setItemMethod(String itemMethod) {
this.itemMethod = itemMethod;
}
public String getItemTools() {
return itemTools;
}
public void setItemTools(String itemTools) {
this.itemTools = itemTools;
}
public Boolean getShowFlag() {
return showFlag;
}

@ -62,6 +62,39 @@ public class EquCheckItemDTO {
// 设备编码list
private List<String> equipmentCodeList;
// 检查工具
private String itemTools;
// 循环周期类型
private String itemLoopType;
// 循环周期
private int itemLoop;
public String getItemLoopType() {
return itemLoopType;
}
public void setItemLoopType(String itemLoopType) {
this.itemLoopType = itemLoopType;
}
public int getItemLoop() {
return itemLoop;
}
public void setItemLoop(int itemLoop) {
this.itemLoop = itemLoop;
}
public String getItemTools() {
return itemTools;
}
public void setItemTools(String itemTools) {
this.itemTools = itemTools;
}
public List<String> getEquipmentCodeList() {
return equipmentCodeList;
}

@ -46,6 +46,39 @@ public class EquCheckItemVO {
// 设备编码
private String equipmentCode;
// 检查工具
private String itemTools;
// 循环周期类型
private String itemLoopType;
// 循环周期
private int itemLoop;
public String getItemLoopType() {
return itemLoopType;
}
public void setItemLoopType(String itemLoopType) {
this.itemLoopType = itemLoopType;
}
public int getItemLoop() {
return itemLoop;
}
public void setItemLoop(int itemLoop) {
this.itemLoop = itemLoop;
}
public String getItemTools() {
return itemTools;
}
public void setItemTools(String itemTools) {
this.itemTools = itemTools;
}
public String getEquipmentName() {
return equipmentName;
}

@ -62,5 +62,4 @@ public interface EquEquipmentMapper {
//查询设备类型
List<EquEquipment> getEquipmentTypeList(EquEquipment equEquipment);
}

@ -65,4 +65,10 @@ public interface EquOperationRecordMapper {
* @return
*/
List<EquOperationRecord> selectEquOperationRecordByEquipmentCode(String equipmentCode);
//设备稳定性 MTBF设备平均故障间隔
List<EquOperationRecord> getMTBFList(EquOperationRecord equOperationRecord);
//设备完好率
EquOperationRecord getEquipmentIntactRate(EquOperationRecord equOperationRecord);
}

@ -1,6 +1,7 @@
package com.op.device.service;
import com.op.common.core.web.domain.AjaxResult;
import com.op.device.domain.EquOperationRecord;
/**
*
@ -24,4 +25,18 @@ public interface IDeviceInterfaceService {
* @return
*/
AjaxResult getRepairQuantity();
/**
* MTBF /
* @return
*/
AjaxResult getEquipmentStabilityList(EquOperationRecord equOperationRecord);
/**
*
* /
* @param equOperationRecord
* @return
*/
AjaxResult getEquipmentIntactRate(EquOperationRecord equOperationRecord);
}

@ -5,6 +5,7 @@ import com.op.common.core.web.domain.AjaxResult;
import com.op.device.domain.EquOperationRecord;
import com.op.device.domain.EquRepairWorkOrder;
import com.op.device.domain.MesReportWork;
import com.op.device.mapper.EquEquipmentMapper;
import com.op.device.domain.vo.IEquipmentVO;
import com.op.device.domain.vo.IRepairWorkOrderVO;
import com.op.device.mapper.DeviceInterfaceMapper;
@ -130,6 +131,7 @@ public class DeviceInterfaceServiceImpl implements IDeviceInterfaceService {
/**
* TOP10
* /
*
* @return
*/
@Override
@ -179,4 +181,29 @@ public class DeviceInterfaceServiceImpl implements IDeviceInterfaceService {
return success(top10);
}
/**
* -MTBF top10
* /
*/
@Override
@DS("#header.poolName")
public AjaxResult getEquipmentStabilityList(EquOperationRecord equOperationRecord) {
//查询所有设备(设备停用的除外)
List<EquOperationRecord> equipmentList = equOperationRecordMapper.getMTBFList(equOperationRecord);
return success(equipmentList);
}
/**
*
* /
*/
@Override
@DS("#header.poolName")
public AjaxResult getEquipmentIntactRate(EquOperationRecord equOperationRecord) {
//查询所有设备(设备停用的除外)
EquOperationRecord equipmentIntactRate = equOperationRecordMapper.getEquipmentIntactRate(equOperationRecord);
return success(equipmentIntactRate);
}
}

@ -21,10 +21,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="createBy" column="create_by" />
<result property="updateTime" column="update_time" />
<result property="updateBy" column="update_by" />
<result property="itemTools" column="item_tools" />
<result property="itemLoop" column="item_loop" />
<result property="itemLoopType" column="item_loop_type" />
</resultMap>
<sql id="selectEquCheckItemVo">
select item_id, item_code, item_name, item_method, item_type, item_type_name, item_remark, factory_code, attr1, attr2, attr3, del_flag, create_time, create_by, update_time, update_by from equ_check_item
select item_id, item_code, item_name, item_method, item_type, item_type_name, item_remark, factory_code, attr1, attr2, attr3, del_flag, create_time, create_by, update_time, update_by ,item_tools ,item_loop,item_loop_type from equ_check_item
</sql>
<select id="selectEquCheckItemList" parameterType="EquCheckItem" resultMap="EquCheckItemResult">
@ -41,6 +44,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="attr2 != null and attr2 != ''"> and attr2 = #{attr2}</if>
<if test="attr3 != null and attr3 != ''"> and attr3 = #{attr3}</if>
<if test="delFlag != null and delFlag != ''"> and del_flag = #{delFlag}</if>
<if test="itemLoop != null and itemLoop != ''"> and item_loop = #{itemLoop}</if>
<if test="itemLoopType != null and itemLoopType != ''"> and item_loop_type = #{itemLoopType}</if>
<if test="itemTools != null and itemTools != ''"> and item_tools like concat('%', #{itemTools}, '%')</if>
<if test="createTimeStart != null "> and CONVERT(date,create_time) >= #{createTimeStart}</if>
<if test="createTimeEnd != null "> and #{createTimeEnd} >= CONVERT(date,create_time)</if>
<if test="createBy != null and createBy != ''"> and create_by like concat('%', #{createBy}, '%')</if>
@ -100,6 +106,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="updateBy != null and updateBy != ''">update_by,</if>
<if test="itemTools != null and itemTools != ''">item_tools,</if>
<if test="itemLoop != null and itemLoop != ''">item_loop,</if>
<if test="itemLoopType != null and itemLoopType != ''">item_loop_type,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="itemId != null">#{itemId},</if>
@ -118,6 +127,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
<if test="itemTools != null and itemTools != ''">#{itemTools},</if>
<if test="itemLoop != null and itemLoop != ''">#{itemLoop},</if>
<if test="itemLoopType != null and itemLoopType != ''">#{itemLoopType},</if>
</trim>
</insert>
@ -139,6 +151,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="itemTools != null and itemTools != ''">item_tools = #{itemTools},</if>
<if test="itemLoop != null and itemLoop != ''">item_loop = #{itemLoop},</if>
<if test="itemLoopType != null and itemLoopType != ''">item_loop_type = #{itemLoopType},</if>
</trim>
where item_id = #{itemId} and del_flag = '0'
</update>

@ -149,4 +149,34 @@
#{id}
</foreach>
</delete>
<!--设备稳定性 MTBF-->
<select id="getMTBFList" parameterType="EquOperationRecord" resultType="com.op.device.domain.EquOperationRecord">
select
row_number() over (ORDER BY sum(CASE WHEN eor.type = 'on' THEN cast(datediff(minute, eor.start_time,eor.end_time)*1.0/60 as decimal(10,2)) ELSE null END )/sum(CASE WHEN type = 'off' THEN 1 ELSE 0 END) DESC) AS serialNumber,
eor.equipment_code AS equipmentCode,
sum(CASE WHEN eor.type = 'on' THEN cast(datediff(minute, eor.start_time,eor.end_time)*1.0/60 as decimal(10,2)) ELSE null END ) AS onTime,
sum(CASE WHEN eor.type = 'off' THEN 1 ELSE 0 END) AS shutDownNumber,
cast(sum(CASE WHEN eor.type = 'on' THEN datediff(minute, eor.start_time,eor.end_time)*1.0/60 ELSE null END )/sum(CASE WHEN type = 'off' THEN 1 ELSE 0 END)as decimal(10,2)) as mtbf
from equ_operation_record eor
left join base_equipment be on eor.equipment_code = be.equipment_code
where be.status = '1'
and be.del_flag = '0'
and eor.start_time is not null
and eor.end_time is not null
GROUP BY eor.equipment_code
ORDER BY onTime desc
</select>
<!--完好设备占比-->
<select id="getEquipmentIntactRate" parameterType="EquOperationRecord" resultType="com.op.device.domain.EquOperationRecord">
SELECT
SUM(CASE WHEN equipment_status = '1' or equipment_status = '3' THEN 1 Else 0 END) AS operationEquipment,
SUM(CASE WHEN equipment_status = '0' or equipment_status = '0' THEN 1 Else 0 END) AS faultEquipment,
COUNT(*) AS totalEquipment,
CONCAT(cast(SUM(CASE WHEN equipment_status = '1' or equipment_status = '3' THEN 1 Else 0 END)*100/COUNT(*)as decimal(10,2)),'%') AS intactRate
FROM base_equipment
WHERE del_flag = '0' AND status = '1'
</select>
</mapper>

@ -23,12 +23,13 @@
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="itemTools" column="item_tools" />
</resultMap>
<sql id="selectEquOrderDetailVo">
select id, code, order_code, parent_code, item_code, item_name, item_method,
item_type, item_type_name, factory_code, attr1, attr2, attr3, del_flag,
create_by, create_time, update_by, update_time
create_by, create_time, update_by, update_time,item_tools
from equ_order_detail
</sql>
@ -47,6 +48,7 @@
<if test="attr1 != null and attr1 != ''"> and attr1 = #{attr1}</if>
<if test="attr2 != null and attr2 != ''"> and attr2 = #{attr2}</if>
<if test="attr3 != null and attr3 != ''"> and attr3 = #{attr3}</if>
<if test="itemTools != null and itemTools != ''"> and item_tools = #{itemTools}</if>
and del_flag = '0'
</where>
</select>
@ -87,6 +89,7 @@
<if test="createTime != null">create_time,</if>
<if test="updateBy != null and updateBy != ''">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="itemTools != null">item_tools,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
@ -107,6 +110,7 @@
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="itemTools != null">#{itemTools},</if>
</trim>
</insert>
<insert id="insertEquOrderDetails">
@ -115,7 +119,7 @@
id, order_code,
item_code, item_name, item_method,
item_type, item_type_name, factory_code, del_flag,
create_by, create_time
create_by, create_time,item_tools
)
VALUES
<foreach collection="list" index="index" item="item" separator=",">
@ -123,7 +127,7 @@
#{item.id},#{item.parentCode},
#{item.itemCode},#{item.itemName},#{item.itemMethod},
#{item.itemType},#{item.itemTypeName},#{item.factoryCode},#{item.delFlag},
#{item.createBy},#{item.createTime}
#{item.createBy},#{item.createTime},#{itemTools}
)
</foreach>
@ -141,6 +145,7 @@
<if test="itemType != null">item_type = #{itemType},</if>
<if test="itemTypeName != null">item_type_name = #{itemTypeName},</if>
<if test="factoryCode != null and factoryCode != ''">factory_code = #{factoryCode},</if>
<if test="itemTools != null and itemTools != ''">item_tools = #{itemTools},</if>
<if test="attr1 != null">attr1 = #{attr1},</if>
<if test="attr2 != null">attr2 = #{attr2},</if>
<if test="attr3 != null">attr3 = #{attr3},</if>

@ -25,12 +25,13 @@
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="itemTools" column="item_tools" />
</resultMap>
<sql id="selectEquPlanDetailVo">
select id, code, plan_id,plan_code, parent_code, item_code, item_name, item_method, item_type,
item_type_name, item_remark, factory_code, attr1, attr2, attr3, del_flag,
create_by, create_time, update_by, update_time
create_by, create_time, update_by, update_time,item_tools
from equ_plan_detail
</sql>
@ -51,6 +52,7 @@
<if test="attr1 != null and attr1 != ''"> and attr1 = #{attr1}</if>
<if test="attr2 != null and attr2 != ''"> and attr2 = #{attr2}</if>
<if test="attr3 != null and attr3 != ''"> and attr3 = #{attr3}</if>
<if test="itemTools != null and itemTools != ''"> and item_tools = #{itemTools}</if>
and del_flag = '0'
</where>
ORDER BY item_name
@ -94,6 +96,7 @@
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="itemTools != null">item_tools,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
@ -116,6 +119,7 @@
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="itemTools != null">#{itemTools},</if>
</trim>
</insert>
@ -141,6 +145,7 @@
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="itemTools != null">item_tools = #{itemTools},</if>
</trim>
where id = #{id} and del_flag = '0'
</update>

@ -304,10 +304,12 @@ public class IWCInterfaceServiceImpl implements IWCSInterfaceService {
ltgs.setConf_activity5(work.getSac5());//折旧
ltgs.setConf_activity6(work.getSac6());
sapRFW.setLt_gs(ltgs);
List<SapRFW.lt_hw> lt_hwList =new ArrayList<>();
SapRFW.lt_hw lthw = sapRFW.new lt_hw();//MES生产订单报工货物移动修改
lthw.setEntry_qnt(work.getQuantityFeedback().toString());//TODO;
lthw.setMaterial(work.getProcessCode());
sapRFW.setLt_hw(lthw);
lt_hwList.add(lthw);
sapRFW.setLt_hwList(lt_hwList);
//添加调用sap日志
SysSapLog sysSapLog = new SysSapLog();
sysSapLog.setId(IdUtils.fastSimpleUUID());

@ -244,7 +244,6 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService {
mesPrepare.setStatus("L0");//待确认
proOrderWorkorderMapper.createPrepare(mesPrepare);
//备(领)料明细
List<MesPrepareDetailDTO> details = new ArrayList<>();
MesPrepareDetailDTO detail = new MesPrepareDetailDTO();
detail.setCreateTime(DateUtils.getNowDate());

@ -176,7 +176,7 @@ public class SapController extends BaseController {
calendar.setTime(maxTime0);
calendar.add(Calendar.DAY_OF_YEAR, 1);
Date maxTime = calendar.getTime();
qo.setAedat(DateFormatUtils.format(maxTime, "yyyyMMdd"));//修改日期20230923
// qo.setAedat(DateFormatUtils.format(maxTime, "yyyyMMdd"));//修改日期20230923
}
qo.setWerks(dateSource.get("poolName").replace("ds_", ""));//工厂
@ -202,6 +202,19 @@ public class SapController extends BaseController {
return sapMaterialPreparationService.MaterialPreparation(shopOrder);
}
/**
*
* ***
* @param sapBackflushMPQueryList
* @return
*/
@PostMapping("/sapBackflushMP")
@Log(title = "", businessType = BusinessType.SAP)
public R sapBackflushMP(@RequestBody List<SapBackflushMPQuery> sapBackflushMPQueryList){
return sapItemSyncService.sapBackflushMP(sapBackflushMPQueryList);
}
@PostMapping("/sapMaterialPosting")
@Log(title = "订单物料领料过账、原材料补料、订单物料退料过账接口MB1A", businessType = BusinessType.SAP)
public R sapMaterialPosting(@RequestBody SapMaterialPosting sapMaterialPosting){
@ -223,13 +236,14 @@ public class SapController extends BaseController {
/**
*
* @param shopOrder
*
* @param sapCloseOrderQuery
* @return
*/
@PostMapping("/sapCloseOrder")
@Log(title = "生产订单关闭接口", businessType = BusinessType.SAP)
public R sapCloseOrder(@RequestParam("shopOrder") String shopOrder){
return sapOrderService.sapCloseOrder(shopOrder);
public R sapCloseOrder(@RequestBody SapCloseOrderQuery sapCloseOrderQuery){
return sapOrderService.sapCloseOrder(sapCloseOrderQuery);
}
/**

@ -0,0 +1,117 @@
package com.op.sap.domain.vo;
/**
*
* auth YangWL
*
* MATNR CHAR 18 0
* PLANT CHAR 4 0
* GR_RCPT CHAR 12 0 /
* LGORT CHAR 4 0
* UMLGO CHAR 4 0 /
* QUANTITY QUAN 13 3
* MEINS UNIT 3 0
* BATCH CHAR 10 0
* MOVE_BATCH CHAR 10 0 /
*/
public class SapBackflushMPQuery {
private String matnr;
private String plant;
private String gr_rcpt;
private String lgort;
private String umlgo;
private String quantity;
private String meins;
private String batch;
private String move_batch;
public String getMatnr() {
return matnr;
}
public void setMatnr(String matnr) {
this.matnr = matnr;
}
public String getPlant() {
return plant;
}
public void setPlant(String plant) {
this.plant = plant;
}
public String getGr_rcpt() {
return gr_rcpt;
}
public void setGr_rcpt(String gr_rcpt) {
this.gr_rcpt = gr_rcpt;
}
public String getLgort() {
return lgort;
}
public void setLgort(String lgort) {
this.lgort = lgort;
}
public String getUmlgo() {
return umlgo;
}
public void setUmlgo(String umlgo) {
this.umlgo = umlgo;
}
public String getQuantity() {
return quantity;
}
public void setQuantity(String quantity) {
this.quantity = quantity;
}
public String getMeins() {
return meins;
}
public void setMeins(String meins) {
this.meins = meins;
}
public String getBatch() {
return batch;
}
public void setBatch(String batch) {
this.batch = batch;
}
public String getMove_batch() {
return move_batch;
}
public void setMove_batch(String move_batch) {
this.move_batch = move_batch;
}
@Override
public String toString() {
return "SapBackflushMPQuery{" +
"matnr='" + matnr + '\'' +
", plant='" + plant + '\'' +
", gr_rcpt='" + gr_rcpt + '\'' +
", lgort='" + lgort + '\'' +
", umlgo='" + umlgo + '\'' +
", quantity='" + quantity + '\'' +
", meins='" + meins + '\'' +
", batch='" + batch + '\'' +
", move_batch='" + move_batch + '\'' +
'}';
}
}

@ -0,0 +1,23 @@
package com.op.sap.domain.vo;
public class SapCloseOrderQuery {
private String leadOrder;
private String order;
public String getLeadOrder() {
return leadOrder;
}
public void setLeadOrder(String leadOrder) {
this.leadOrder = leadOrder;
}
public String getOrder() {
return order;
}
public void setOrder(String order) {
this.order = order;
}
}

@ -1,6 +1,7 @@
package com.op.sap.service;
import com.op.common.core.domain.R;
import com.op.sap.domain.vo.SapBackflushMPQuery;
import com.op.sap.domain.vo.SapItemQuery;
import com.op.sap.domain.vo.SapMaterialPosting;
import com.op.system.api.domain.sap.SapBaseProduct;
@ -25,4 +26,6 @@ public interface SapItemSyncService {
*/
R sapMaterialPosting(SapMaterialPosting sapMaterialPosting);
R sapBackflushMP(List<SapBackflushMPQuery> sapBackflushMPQueryList);
}

@ -2,6 +2,7 @@ package com.op.sap.service;
import com.op.common.core.domain.R;
import com.op.sap.domain.vo.SapCloseOrderQuery;
import com.op.sap.domain.vo.SapPurchaseOrderQuery;
import com.op.system.api.domain.sap.SapCreateOrder;
import com.op.system.api.domain.sap.SapRFW;
@ -32,11 +33,11 @@ public interface SapOrderService {
/**
*
* @param shopOrder
* @param sapCloseOrderQuery
* @return
*/
R sapCloseOrder(String shopOrder);
R sapCloseOrder(SapCloseOrderQuery sapCloseOrderQuery);
/**
*

@ -8,6 +8,7 @@ import com.op.common.core.utils.DateUtils;
import com.op.common.core.utils.StringUtils;
import com.op.common.core.utils.bean.BeanValidators;
import com.op.common.security.utils.SecurityUtils;
import com.op.sap.domain.vo.SapBackflushMPQuery;
import com.op.sap.domain.vo.SapItemQuery;
import com.op.sap.domain.vo.SapMaterialPosting;
import com.op.sap.mapper.SapBaseProductMapper;
@ -98,13 +99,6 @@ public class SapItemSyncImpl implements SapItemSyncService {
S_LAEDA.setValue("HIGH", END_DATE);
}
// 获取调用 RFC 函数对象
func.execute(dest);
// 获取 内表 - ZMES_PRO
@ -297,6 +291,68 @@ public class SapItemSyncImpl implements SapItemSyncService {
}
}
/**
*
* @param sapBackflushMPQueryList
* @return
*/
@Override
public R sapBackflushMP(List<SapBackflushMPQuery> sapBackflushMPQueryList) {
try {
JCoRepository repository = dest.getRepository();
JCoFunction func = repository.getFunction("ZPPR_MES_GOODSMVT_CREATE_B");
if (func == null) {
throw new RuntimeException("Function does not exist in SAP");
}
JCoTable L_ITEM = func.getTableParameterList().getTable("L_ITEM");
System.out.println(L_ITEM);
//
// int successNum = 0;
// int failureNum = 0;
// StringBuilder successMsg = new StringBuilder();
// StringBuilder failureMsg = new StringBuilder();
// log.info("反冲物料开始过账----------------------------------------");
// for (int i = 0; i < sapBackflushMPQueryList.size(); i++) {
// L_ITEM.setRow(i);
// L_ITEM.appendRow();
// L_ITEM.setValue("MATNR",sfp.getMatnr());
// }
for (SapBackflushMPQuery sfp:sapBackflushMPQueryList){
// if (StringUtils.isEmpty(sfp.getMatnr())){
// return R.fail("物料号为空!");
// }
// if (StringUtils.isEmpty(sfp.getPlant())){
//
// }
L_ITEM.appendRow();
L_ITEM.setValue("MATNR",sfp.getMatnr());
L_ITEM.setValue("PLANT",sfp.getPlant());
L_ITEM.setValue("GR_RCPT",sfp.getGr_rcpt());
L_ITEM.setValue("LGORT",sfp.getLgort());
L_ITEM.setValue("UMLGO",sfp.getUmlgo());
L_ITEM.setValue("QUANTITY",sfp.getQuantity());
L_ITEM.setValue("MEINS",sfp.getMeins());
L_ITEM.setValue("BATCH",sfp.getBatch());
L_ITEM.setValue("MOVE_BATCH",sfp.getMove_batch());
}
return R.ok();
}catch (Exception e){
return R.fail(e.getMessage());
}
}
public static void main(String[] args) {
SapBackflushMPQuery sapBackflushMPQuery=new SapBackflushMPQuery();
System.out.println(sapBackflushMPQuery.toString());
}
public String importProducts(List<SapBaseProduct> sapBaseProductList){
if (StringUtils.isNull(sapBaseProductList) || sapBaseProductList.size() == 0)
{

@ -6,6 +6,7 @@ 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.sap.domain.vo.SapCloseOrderQuery;
import com.op.sap.domain.vo.SapPurchaseOrderQuery;
import com.op.sap.service.SapOrderService;
@ -202,8 +203,9 @@ public class SapOrderServiceImpl implements SapOrderService {
}
@Override
public R sapCloseOrder(String shopOrder) {
String L_MSG=null;
public R sapCloseOrder(SapCloseOrderQuery sapCloseOrderQuery) {
StringBuilder Msg = new StringBuilder();
try {
//获取连接
// JCoDestination dest = SAPConnUtils.connect();
@ -215,19 +217,26 @@ public class SapOrderServiceImpl implements SapOrderService {
// 配置传入参数
JCoParameterList jCoParameterList = func.getImportParameterList();
if (StringUtils.isEmpty(shopOrder)){
return R.fail("订单号为空");
if (StringUtils.isEmpty(sapCloseOrderQuery.getLeadOrder())){
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("订单关闭失败");
if (StringUtils.isEmpty(sapCloseOrderQuery.getOrder())){
return R.fail("子订单号为空");
}
return R.ok(L_MSG);
//关闭母订单
jCoParameterList.setValue("P_AUFNR",sapCloseOrderQuery.getLeadOrder());
func.execute(dest);//执行调用函数
// JCoParameterList J= func.getExportParameterList();
// System.out.println(J);
String L_MSG1= func.getExportParameterList().getString("L_MSG");
Msg.append(sapCloseOrderQuery.getLeadOrder()+L_MSG1+";");
//关闭子订单
jCoParameterList.setValue("P_AUFNR",sapCloseOrderQuery.getOrder());
func.execute(dest);//执行调用函数
String L_MSG2= func.getExportParameterList().getString("L_MSG");
Msg.append(sapCloseOrderQuery.getOrder()+L_MSG2);
return R.ok(null,Msg.toString());
}catch (Exception e){
return R.fail(e.getMessage());
}
@ -260,7 +269,7 @@ public class SapOrderServiceImpl implements SapOrderService {
if (sapRFW.getLt_gs()==null){
return R.fail("生产订单报工工时为空");
}
if (sapRFW.getLt_hw()==null){
if (sapRFW.getLt_hwList()==null){
return R.fail("生产订单报工货物移动为空");
}
/**
@ -280,9 +289,12 @@ public class SapOrderServiceImpl implements SapOrderService {
*/
JCoTable LT_HW_jCoTable = func.getTableParameterList().getTable("LT_HW");
System.out.println("LT_HW_jCoTable"+LT_HW_jCoTable);
for (SapRFW.lt_hw lt_hw:sapRFW.getLt_hwList()){
LT_HW_jCoTable.appendRow();
LT_HW_jCoTable.setValue("MATERIAL", sapRFW.getLt_hw().getMaterial());
LT_HW_jCoTable.setValue("ENTRY_QNT", sapRFW.getLt_hw().getEntry_qnt());
LT_HW_jCoTable.setValue("MATERIAL", lt_hw.getMaterial());
LT_HW_jCoTable.setValue("ENTRY_QNT", lt_hw.getEntry_qnt());
}
func.execute(dest);//执行调用函数
JCoParameterList J= func.getExportParameterList();
@ -364,7 +376,7 @@ public class SapOrderServiceImpl implements SapOrderService {
JCoFunction func = repository.getFunction("ZPPR_MES_PRODORD_CHANGE");
// 配置传入参数
JCoParameterList jCoParameterList = func.getImportParameterList();
System.out.println(jCoParameterList);
//System.out.println(jCoParameterList);
if (func == null) {
throw new RuntimeException("Function does not exist in SAP");
}
@ -381,10 +393,13 @@ public class SapOrderServiceImpl implements SapOrderService {
jCoParameterList.setValue("P_QUANTITY",sapProOrder.getQuantity());
func.execute(dest);//执行调用函数
JCoParameterList J= func.getExportParameterList();
System.out.println(J);
String RETCODE= func.getExportParameterList().getString("RETCODE");
String MESSAGE= func.getExportParameterList().getString("MESSAGE");
System.out.println(MESSAGE);
return R.ok(MESSAGE);
if ((Constants.FAIL).equals(Integer.parseInt(RETCODE))){
return R.fail(null,"订单号:"+sapProOrder.getAufnr()+MESSAGE);
}else {
return R.ok(null,"订单号:"+sapProOrder.getAufnr()+MESSAGE);
}
}catch (Exception e){
return R.fail(e.getMessage());
}

@ -176,8 +176,8 @@ public class SapRouterServiceImpl implements SapRouterService {
"删除标识:" + LOEKZ+
"物料号:" + MATNR+
"物料描述:" + MAKTX+
"任务清单使用"+VERWE+
"状态"+STATU+
"任务清单使用"+VERWE+
"状态"+STATU+
"任务清单描述:" + KTEXT+
" 操作/活动编号:" + VORNR+
"控制码:" + STEUS+
@ -190,16 +190,14 @@ public class SapRouterServiceImpl implements SapRouterService {
"工作中心:" + ARBPL+
"基本数量:" + BMSCH+
"工序计量单位:" + MEINH+
"标准值01" + VGW01+
"标准值01(机器)" + VGW01+
"计量单位01" + VGE01+
"标准值02" + VGE02+
"标准值02人工" + VGW02+
"计量单位02" + VGE02+
"标准值03" + VGE03+
"标准值03折旧" + VGW03+
"计量单位03" + VGE03+
" 标准值04" + VGE04+
"标准值04其它" + VGW04+
" 计量单位04" + VGE04);
//工艺路线下的工序
if (StringUtil.isBlank(PLNNR)) {
throw new ServiceException("任务清单组码不能为空");
@ -239,6 +237,18 @@ public class SapRouterServiceImpl implements SapRouterService {
sapProRoute.setAttr1("job");//说明是来自定时任务
sapProRoute.setCreateTime(DateUtils.dateTime("yyyy-MM-dd", ANDAT));
sapProRoute.setRouteVersion("1.0");
//机器
sapProRoute.setTecMachine(VGW01);
sapProRoute.setTecMachineUnit(VGE01);
//人工
sapProRoute.setTecMan(VGW02);
sapProRoute.setTecManUnit(VGE02);
//折旧
sapProRoute.setTecDepreciation(VGW03);
sapProRoute.setTecDepreciationUnit(VGE03);
//其它
sapProRoute.setTecOther(VGW04);
sapProRoute.setTecOtherUnit(VGE04);
sapProRouteMapper.insertProRoute(sapProRoute);
//增加工艺路线和工序的关系
@ -265,58 +275,79 @@ public class SapRouterServiceImpl implements SapRouterService {
successNum++;
}
}
//更新工艺路线
else {
//验证是否存在工序
sapProProcess.setProcessName(LTXA1);
SapProProcess operation = sapProProcessMapper.selectProProcessByProcessName(sapProProcess);
//验证原材料是否存在
SapBaseProduct sapBaseProduct=new SapBaseProduct();
sapBaseProduct.setProductCode(MATNR);
sapBaseProduct = sapBaseProductMapper.selectBaseProductByProductCode(sapBaseProduct);
if (StringUtils.isNull(operation)){
failureNum++;
failureMsg.append(failureNum+"、工艺路线【" + PLNNR + "】下的工序【" + LTXA1 + "】不存在!");
}
else if (StringUtils.isNull(sapBaseProduct)){
failureNum++;
failureMsg.append(failureNum+"、工艺路线【" + PLNNR + "】下的物料【" + MATNR + "】不存在!");
}
else if(!StringUtils.isNull(operation) && !StringUtils.isNull(sapBaseProduct)) {
//验证是否存在工艺路线和工序的关系
SapProRouteProcess sapProRouteProcess = new SapProRouteProcess();
sapProRouteProcess.setRouteId(sapProRoute.getRouteId());
sapProRouteProcess.setProcessId(operation.getProcessId());
List<SapProRouteProcess> sapProRouteProcessList = sapProRouteProcessMapper.selectProRouteProcessList(sapProRouteProcess);
if (sapProRouteProcessList .size()==0) {
//增加工艺路线和工序的关系
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);
sapProRouteProcessMapper.insertProRouteProcess(sapProRouteProcess);
}
//验证是否存在工艺路线和物料的关系
SapProRouteProduct sapProRouteProduct = new SapProRouteProduct();
sapProRouteProduct.setRouteId(sapProRoute.getRouteId());
sapProRouteProduct.setItemCode(MATNR);
List<SapProRouteProduct> sapProRouteProductList = sapProRouteProductMapper.selectProRouteProductList(sapProRouteProduct);
if (sapProRouteProductList .size()==0) {
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));
sapProRouteProductMapper.insertProRouteProduct(sapProRouteProduct);
}
}
sapProRoute.setRouteName(KTEXT);
sapProRoute.setRouteDesc(KTEXT);
sapProRoute.setEnableFlag("Y");
//机器
sapProRoute.setTecMachine(VGW01);
sapProRoute.setTecMachineUnit(VGE01);
//人工
sapProRoute.setTecMan(VGW02);
sapProRoute.setTecManUnit(VGE02);
//折旧
sapProRoute.setTecDepreciation(VGW03);
sapProRoute.setTecDepreciationUnit(VGE03);
//其它
sapProRoute.setTecOther(VGW04);
sapProRoute.setTecOtherUnit(VGE04);
sapProRoute.setUpdateBy(ANNAM);
sapProRoute.setUpdateTime(DateUtils.getNowDate());
sapProRouteMapper.updateProRoute(sapProRoute);
}
// else{
// //验证是否存在工序
// sapProProcess.setProcessName(LTXA1);
// SapProProcess operation = sapProProcessMapper.selectProProcessByProcessName(sapProProcess);
// //验证产品是否存在
// SapBaseProduct sapBaseProduct=new SapBaseProduct();
// sapBaseProduct.setProductCode(MATNR);
// sapBaseProduct = sapBaseProductMapper.selectBaseProductByProductCode(sapBaseProduct);
// if (StringUtils.isNull(operation)){
// failureNum++;
// failureMsg.append(failureNum+"、工艺路线【" + PLNNR + "】下的工序【" + LTXA1 + "】不存在!");
// }
// else if (StringUtils.isNull(sapBaseProduct)){
// failureNum++;
// failureMsg.append(failureNum+"、工艺路线【" + PLNNR + "】下的物料【" + MATNR + "】不存在!");
// }
// else if(!StringUtils.isNull(operation) && !StringUtils.isNull(sapBaseProduct)) {
// //验证是否存在工艺路线和工序的关系
// SapProRouteProcess sapProRouteProcess = new SapProRouteProcess();
// sapProRouteProcess.setRouteId(sapProRoute.getRouteId());
// sapProRouteProcess.setProcessId(operation.getProcessId());
// List<SapProRouteProcess> sapProRouteProcessList = sapProRouteProcessMapper.selectProRouteProcessList(sapProRouteProcess);
// if (sapProRouteProcessList .size()==0) {
// //增加工艺路线和工序的关系
// 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);
// sapProRouteProcessMapper.insertProRouteProcess(sapProRouteProcess);
// }
// //验证是否存在工艺路线和物料的关系
// SapProRouteProduct sapProRouteProduct = new SapProRouteProduct();
// sapProRouteProduct.setRouteId(sapProRoute.getRouteId());
// sapProRouteProduct.setItemCode(MATNR);
// List<SapProRouteProduct> sapProRouteProductList = sapProRouteProductMapper.selectProRouteProductList(sapProRouteProduct);
// if (sapProRouteProductList .size()==0) {
// 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));
// sapProRouteProductMapper.insertProRouteProduct(sapProRouteProduct);
// }
// }
// }
}

@ -24,6 +24,7 @@ public class SAPConnUtils {
destination = JCoDestinationManager.getDestination(ABAP_AS_POOLED);
if (destination!=null){
logger.info("连接SAP成功");
System.err.println("连接SAP成功");
}
} catch (JCoException e) {
logger.info("连接SAP失败错误: " + e.toString());

@ -97,6 +97,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateTime != null">update_time,</if>
<if test="routeVersion != null">route_version,</if>
<if test="needCheck != null">need_check,</if>
<if test="tecMan != null">tec_man,</if>
<if test="tecManUnit != null">tec_man_unit,</if>
<if test="tecMachine != null">tec_machine,</if>
<if test="tecMachineUnit != null">tec_machine_unit,</if>
<if test="tecDepreciation != null">tec_depreciation,</if>
<if test="tecDepreciationUnit != null">tec_depreciation_unit,</if>
<if test="tecOther != null">tec_other,</if>
<if test="tecOtherUnit != null">tec_ohter_unit,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
@ -116,6 +124,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateTime != null">#{updateTime},</if>
<if test="routeVersion != null">#{routeVersion},</if>
<if test="needCheck != null">#{needCheck},</if>
<if test="tecMan != null">#{tecMan},</if>
<if test="tecManUnit != null">#{tecManUnit},</if>
<if test="tecMachine != null">#{tecMachine},</if>
<if test="tecMachineUnit != null">#{tecMachineUnit},</if>
<if test="tecDepreciation != null">#{tecDepreciation},</if>
<if test="tecDepreciationUnit != null">#{tecDepreciationUnit},</if>
<if test="tecOther != null">#{tecOther},</if>
<if test="tecOtherUnit != null">#{tecOtherUnit},</if>
</trim>
</insert>
@ -128,6 +144,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="routeDesc != null">route_desc = #{routeDesc},</if>
<if test="enableFlag != null and enableFlag != ''">enable_flag = #{enableFlag},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="tecMan != null">tec_man = #{tecMan},</if>
<if test="tecManUnit != null">tec_man_unit = #{tecManUnit},</if>
<if test="tecMachine != null">tec_machine = #{tecMachine},</if>
<if test="tecMachineUnit != null">tec_machine_unit = #{tecMachineUnit},</if>
<if test="tecDepreciation != null">tec_depreciation = #{tecDepreciation},</if>
<if test="tecDepreciationUnit != null">tec_depreciation_unit = #{tecDepreciationUnit},</if>
<if test="tecOther != null">tec_other = #{tecOther},</if>
<if test="tecOtherUnit != null">tec_ohter_unit = #{tecOtherUnit},</if>
<if test="attr1 != null">attr1 = #{attr1},</if>
<if test="attr2 != null">attr2 = #{attr2},</if>
<if test="attr3 != null">attr3 = #{attr3},</if>

Loading…
Cancel
Save