领料单获取

highway
zhaoxiaolin 1 year ago
parent d70b27e01f
commit ae4d615aff

1
.gitignore vendored

@ -5,3 +5,4 @@
/**/.settings/*
/**/.node_modules/*
/**/*.idea
/**/*.iml

@ -7,6 +7,8 @@ import com.op.system.api.factory.RemoteSapFallbackFactory;
import com.op.system.api.model.SapProOrder;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
/**
@ -18,12 +20,12 @@ import java.util.List;
public interface RemoteSapService {
@PostMapping("/sap/shopOrderSync")
public R<List<SapProOrder>> shopOrderSync(SapProOrder sapProOrder);
public R<List<SapProOrder>> shopOrderSync(@RequestBody SapProOrder sapProOrder);
@PostMapping("/bomSync")
public R<Boolean> bomSync();
@PostMapping("/sap/sapProRouteProcess")
public R<Boolean> sapProRouteProcess();
@PostMapping("/sap/materialPreparation")
public R<List<SapMaterialPreparation>>materialPreparation(SapMaterialPreparation sapMaterialPreparation);
public R<List<SapMaterialPreparation>>materialPreparation(@RequestParam("shopOrder") String shopOrder);
}

@ -7,6 +7,7 @@ import com.op.system.api.model.SapProOrder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
@ -32,7 +33,7 @@ public class RemoteSapFallbackFactory implements FallbackFactory<RemoteSapServic
}
@Override
public R<List<SapMaterialPreparation>> materialPreparation(SapMaterialPreparation sapMaterialPreparation) {
public R<List<SapMaterialPreparation>> materialPreparation(String shopOrder) {
return R.fail("SAP服务获取SAP领料单失败:" + throwable.getMessage());
}
};

@ -1,6 +1,11 @@
package com.op.job.task;
import com.op.common.core.domain.R;
import com.op.common.core.utils.DateUtils;
import com.op.common.core.web.domain.AjaxResult;
import com.op.system.api.RemoteMesService;
import com.op.system.api.RemoteSapService;
import com.op.system.api.model.SapProOrder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.op.common.core.utils.StringUtils;
@ -16,6 +21,9 @@ public class RyTask {
@Autowired
private RemoteMesService remoteMesService;
@Autowired
private RemoteSapService remoteSapService;
public void ryMultipleParams(String s, Boolean b, Long l, Double d, Integer i) {
System.out.println(StringUtils.format("执行多参方法: 字符串类型{},布尔类型{},长整型{},浮点型{},整形{}", s, b, l, d, i));
}
@ -28,6 +36,16 @@ public class RyTask {
System.out.println("执行无参方法");
}
public void shopOrderSync(){
SapProOrder sapProOrder=new SapProOrder();
sapProOrder.setCreateTime(DateUtils.getNowDate());
remoteSapService.shopOrderSync(sapProOrder);
}
/**23
* 16
* 0 0 23 * * ?
*/
public void getMesPrepareTask(){
System.out.println("++同步领料单+开始++getMesPrepareTask+++++");
remoteMesService.getMesPrepare();

@ -119,6 +119,17 @@ public class MesPrepare extends BaseEntity {
/** 工厂编码 */
@Excel(name = "工厂编码")
private String factoryCode;
private String dayStr;
public String getDayStr() {
return dayStr;
}
public void setDayStr(String dayStr) {
this.dayStr = dayStr;
}
public String getMaterialCode() {
return materialCode;
}

@ -58,4 +58,6 @@ public interface MesPrepareMapper {
* @return
*/
public int deleteMesPrepareByPrepareIds(String[] prepareIds);
public List<MesPrepare> getParentWorkOrderT1(MesPrepare qo);
}

@ -1,5 +1,6 @@
package com.op.mes.service.impl;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.*;
import java.util.stream.Collectors;
@ -25,6 +26,8 @@ import org.springframework.stereotype.Service;
import com.op.mes.mapper.MesPrepareMapper;
import com.op.mes.domain.MesPrepare;
import com.op.mes.service.IMesPrepareService;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.RequestParam;
/**
* Service
@ -43,6 +46,7 @@ public class MesPrepareServiceImpl implements IMesPrepareService {
private RemoteUserService remoteUserService;
@Autowired
private MesPrepareDetailMapper mesPrepareDetailMapper;
/**
*
*
@ -119,9 +123,6 @@ public class MesPrepareServiceImpl implements IMesPrepareService {
@Override
public R getMesPrepare() {
SapMaterialPreparation qo = new SapMaterialPreparation();
List<SapMaterialPreparation> sapMaterialPreparationList = remoteSapService.materialPreparation(qo).getData();
// 加载sf-cloud库的sys_datasource
SysUser sysUser = new SysUser();
sysUser.setUserId(1L);
@ -132,46 +133,64 @@ public class MesPrepareServiceImpl implements IMesPrepareService {
dateSources.size(),
0L, TimeUnit.MILLISECONDS,
new LinkedBlockingQueue<Runnable>());
try{
dateSources.forEach(dateSource ->{
logger.info("++++++++++++"+dateSource.get("poolName")+"++++开始++++++++++");
Runnable run = () -> getMesPrepareByFactory(dateSource.get("poolName"),sapMaterialPreparationList);
try {
dateSources.forEach(dateSource -> {
logger.info("++++++++++++" + dateSource.get("poolName") + "++++开始++++++++++");
Runnable run = () -> getMesPrepareByFactory(dateSource.get("poolName"));
executorService.execute(run);
});
}catch (Exception e){
} catch (Exception e) {
logger.error("service == deviceOfflineTimingTask == exception", e);
return R.fail("service == deviceOfflineTimingTask == exception");
}finally {
} finally {
executorService.shutdown();
}
return R.ok(true);
}
public void getMesPrepareByFactory(String poolName, List<SapMaterialPreparation> sapMaterialPreparationList) {
public void getMesPrepareByFactory(String poolName) {
DynamicDataSourceContextHolder.push(poolName);// 这是数据源的key
List<SapMaterialPreparation> list = sapMaterialPreparationList.stream()
.filter(a->a.getWERKS().equals(poolName))
.collect(Collectors.toList());
// List<SapMaterialPreparation> list = sapMaterialPreparationList.stream()
// .filter(a->a.getWERKS().equals(poolName))
// .collect(Collectors.toList());
//取出各单位集合中所有单位名称
Set<String> orderCodes = list.stream().map(SapMaterialPreparation::getAUFNR).collect(Collectors.toSet());
for(String orderCode : orderCodes){
//获取T+1天的所有母工单
MesPrepare qo = new MesPrepare();
Calendar cal = Calendar.getInstance();
cal.add(Calendar.DATE, 1);//这里改为1
Date time = cal.getTime();
qo.setDayStr(new SimpleDateFormat("yyyy-MM-dd").format(time));
List<MesPrepare> parents = mesPrepareMapper.getParentWorkOrderT1(qo);
if (CollectionUtils.isEmpty(parents)) {
System.out.println("T+1无母工单数据");
}
for (MesPrepare mesPrepare : parents) {
List<SapMaterialPreparation> sapMaterialPreparationList = remoteSapService.materialPreparation(mesPrepare.getWorkorderCode()).getData();
if (CollectionUtils.isEmpty(sapMaterialPreparationList)) {
System.out.println("sap无领料单数据");
}
//取出各领料单
Set<String> orderCodes = sapMaterialPreparationList.stream().map(SapMaterialPreparation::getAUFNR).collect(Collectors.toSet());
for (String orderCode : orderCodes) {
/**mes_prepare**/
String mesPrepareId = IdUtils.fastSimpleUUID();
MesPrepare mesPrepare = new MesPrepare();
mesPrepare.setPrepareId(mesPrepareId);
mesPrepare.setWorkorderCode(orderCode);//工单(子)
mesPrepare.setCreateTime(DateUtils.getNowDate());
mesPrepare.setCreateBy(SecurityUtils.getUsername());
mesPrepare.setStatus("L0");//默认待确认
mesPrepareMapper.insertMesPrepare(mesPrepare);
MesPrepare mesPrepare0 = new MesPrepare();
mesPrepare0.setPrepareId(mesPrepareId);
mesPrepare0.setWorkorderCode(orderCode);//工单(子)
mesPrepare0.setCreateTime(DateUtils.getNowDate());
mesPrepare0.setCreateBy(SecurityUtils.getUsername());
mesPrepare0.setStatus("L0");//默认待确认
mesPrepareMapper.insertMesPrepare(mesPrepare0);
/**mes_prepare_detail**/
List<MesPrepareDetail> details = new ArrayList<>();
List<SapMaterialPreparation> listdetails = list.stream()
.filter(a->a.getAUFNR().equals(orderCode))
.collect(Collectors.toList());
// List<SapMaterialPreparation> listdetails = list.stream()
// .filter(a->a.getAUFNR().equals(orderCode))
// .collect(Collectors.toList());
MesPrepareDetail detail = null;
Date createDate = DateUtils.getNowDate();
for(SapMaterialPreparation sap:listdetails){
for (SapMaterialPreparation sap : sapMaterialPreparationList) {
detail = new MesPrepareDetail();
detail.setPrepareId(mesPrepareId);
detail.setRecordId(IdUtils.fastSimpleUUID());
@ -192,10 +211,12 @@ public class MesPrepareServiceImpl implements IMesPrepareService {
}
mesPrepareDetailMapper.insertMesPrepareDetails(details);
}
}
}
public static void main(String args[]){
public static void main(String args[]) {
List<SapMaterialPreparation> list = new ArrayList<>();
SapMaterialPreparation p1 = new SapMaterialPreparation();
p1.setAUFNR("1001");

@ -118,9 +118,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
)VALUES
<foreach collection="list" item="d" index="index" separator=",">
(
#{list.recordId},#{list.prepareId},#{list.materialCode},#{list.materialName},#{list.unit},
#{list.quantity},#{list.createBy},#{list.createTime},#{list.factoryCode},#{list.status},
#{list.locator},#{list.needDate},#{list.recoil},#{list.fundQuanlity},#{list.buyFlag},
#{d.recordId},#{d.prepareId},#{d.materialCode},#{d.materailName},#{d.unit},
#{d.quantity},#{d.createBy},#{d.createTime},#{d.factoryCode},#{d.status},
#{d.locator},#{d.needDate},#{d.recoil},#{d.fundQuanlity},#{d.buyFlag}
)
</foreach>

@ -101,117 +101,124 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectMesPrepareVo"/>
where prepare_id = #{prepareId}
</select>
<!--T+1天的母单-->
<select id="getParentWorkOrderT1" resultType="com.op.mes.domain.MesPrepare">
select workorder_code workorderCode
from pro_order_workorder
where parent_order = '0' and prod_type = 'prod'
and CONVERT(varchar(100), product_date, 23) = #{dayStr}
</select>
<!-- <insert id="insertMesPrepare" parameterType="MesPrepare">-->
<!-- insert into mes_prepare-->
<!-- <trim prefix="(" suffix=")" suffixOverrides=",">-->
<!-- <if test="prepareId != null">prepare_id,</if>-->
<!-- <if test="workorderCode != null and workorderCode != ''">workorder_code,</if>-->
<!-- <if test="workorderName != null">workorder_name,</if>-->
<!-- <if test="parentOrder != null and parentOrder != ''">parent_order,</if>-->
<!-- <if test="orderId != null and orderId != ''">order_id,</if>-->
<!-- <if test="orderCode != null">order_code,</if>-->
<!-- <if test="productId != null">product_id,</if>-->
<!-- <if test="productCode != null and productCode != ''">product_code,</if>-->
<!-- <if test="prodType != null">prod_type,</if>-->
<!-- <if test="productName != null and productName != ''">product_name,</if>-->
<!-- <if test="productSpc != null">product_spc,</if>-->
<!-- <if test="wetDetailPlanId != null">wet_detail_plan_id,</if>-->
<!-- <if test="productDate != null">product_date,</if>-->
<!-- <if test="shiftId != null">shift_id,</if>-->
<!-- <if test="ancestors != null">ancestors,</if>-->
<!-- <if test="status != null">status,</if>-->
<!-- <if test="remark != null">remark,</if>-->
<!-- <if test="attr1 != null">attr1,</if>-->
<!-- <if test="attr2 != null">attr2,</if>-->
<!-- <if test="attr3 != null">attr3,</if>-->
<!-- <if test="attr4 != null">attr4,</if>-->
<!-- <if test="createBy != null">create_by,</if>-->
<!-- <if test="createTime != null">create_time,</if>-->
<!-- <if test="updateBy != null">update_by,</if>-->
<!-- <if test="updateTime != null">update_time,</if>-->
<!-- <if test="factoryCode != null">factory_code,</if>-->
<!-- <if test="materialCode != null and materialCode != ''">material_code,</if>-->
<!-- <if test="materialName != null and materialName != ''">material_name,</if>-->
<!-- <if test="materialSpc != null">material_spc,</if>-->
<!-- <if test="unit != null and unit != ''">unit,</if>-->
<!-- <if test="quantity != null">quantity,</if>-->
<!-- </trim>-->
<!-- <trim prefix="values (" suffix=")" suffixOverrides=",">-->
<!-- <if test="prepareId != null">#{prepareId},</if>-->
<!-- <if test="workorderCode != null and workorderCode != ''">#{workorderCode},</if>-->
<!-- <if test="workorderName != null">#{workorderName},</if>-->
<!-- <if test="parentOrder != null and parentOrder != ''">#{parentOrder},</if>-->
<!-- <if test="orderId != null and orderId != ''">#{orderId},</if>-->
<!-- <if test="orderCode != null">#{orderCode},</if>-->
<!-- <if test="productId != null">#{productId},</if>-->
<!-- <if test="productCode != null and productCode != ''">#{productCode},</if>-->
<!-- <if test="prodType != null">#{prodType},</if>-->
<!-- <if test="productName != null and productName != ''">#{productName},</if>-->
<!-- <if test="productSpc != null">#{productSpc},</if>-->
<!-- <if test="wetDetailPlanId != null">#{wetDetailPlanId},</if>-->
<!-- <if test="productDate != null">#{productDate},</if>-->
<!-- <if test="shiftId != null">#{shiftId},</if>-->
<!-- <if test="ancestors != null">#{ancestors},</if>-->
<!-- <if test="status != null">#{status},</if>-->
<!-- <if test="remark != null">#{remark},</if>-->
<!-- <if test="attr1 != null">#{attr1},</if>-->
<!-- <if test="attr2 != null">#{attr2},</if>-->
<!-- <if test="attr3 != null">#{attr3},</if>-->
<!-- <if test="attr4 != null">#{attr4},</if>-->
<!-- <if test="createBy != null">#{createBy},</if>-->
<!-- <if test="createTime != null">#{createTime},</if>-->
<!-- <if test="updateBy != null">#{updateBy},</if>-->
<!-- <if test="updateTime != null">#{updateTime},</if>-->
<!-- <if test="factoryCode != null">#{factoryCode},</if>-->
<!-- <if test="materialCode != null and materialCode != ''">#{materialCode},</if>-->
<!-- <if test="materialName != null and materialName != ''">#{materialName},</if>-->
<!-- <if test="materialSpc != null">#{materialSpc},</if>-->
<!-- <if test="unit != null and unit != ''">#{unit},</if>-->
<!-- <if test="quantity != null">#{quantity},</if>-->
<!-- </trim>-->
<!-- </insert>-->
<insert id="insertMesPrepare" parameterType="MesPrepare">
insert into mes_prepare
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="prepareId != null">prepare_id,</if>
<if test="workorderCode != null and workorderCode != ''">workorder_code,</if>
<if test="workorderName != null">workorder_name,</if>
<if test="parentOrder != null and parentOrder != ''">parent_order,</if>
<if test="orderId != null and orderId != ''">order_id,</if>
<if test="orderCode != null">order_code,</if>
<if test="productId != null">product_id,</if>
<if test="productCode != null and productCode != ''">product_code,</if>
<if test="prodType != null">prod_type,</if>
<if test="productName != null and productName != ''">product_name,</if>
<if test="productSpc != null">product_spc,</if>
<if test="wetDetailPlanId != null">wet_detail_plan_id,</if>
<if test="productDate != null">product_date,</if>
<if test="shiftId != null">shift_id,</if>
<if test="ancestors != null">ancestors,</if>
<if test="status != null">status,</if>
<if test="remark != null">remark,</if>
<if test="attr1 != null">attr1,</if>
<if test="attr2 != null">attr2,</if>
<if test="attr3 != null">attr3,</if>
<if test="attr4 != null">attr4,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="factoryCode != null">factory_code,</if>
<if test="materialCode != null and materialCode != ''">material_code,</if>
<if test="materialName != null and materialName != ''">material_name,</if>
<if test="materialSpc != null">material_spc,</if>
<if test="unit != null and unit != ''">unit,</if>
<if test="quantity != null">quantity,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="prepareId != null">#{prepareId},</if>
<if test="workorderCode != null and workorderCode != ''">#{workorderCode},</if>
<if test="workorderName != null">#{workorderName},</if>
<if test="parentOrder != null and parentOrder != ''">#{parentOrder},</if>
<if test="orderId != null and orderId != ''">#{orderId},</if>
<if test="orderCode != null">#{orderCode},</if>
<if test="productId != null">#{productId},</if>
<if test="productCode != null and productCode != ''">#{productCode},</if>
<if test="prodType != null">#{prodType},</if>
<if test="productName != null and productName != ''">#{productName},</if>
<if test="productSpc != null">#{productSpc},</if>
<if test="wetDetailPlanId != null">#{wetDetailPlanId},</if>
<if test="productDate != null">#{productDate},</if>
<if test="shiftId != null">#{shiftId},</if>
<if test="ancestors != null">#{ancestors},</if>
<if test="status != null">#{status},</if>
<if test="remark != null">#{remark},</if>
<if test="attr1 != null">#{attr1},</if>
<if test="attr2 != null">#{attr2},</if>
<if test="attr3 != null">#{attr3},</if>
<if test="attr4 != null">#{attr4},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="factoryCode != null">#{factoryCode},</if>
<if test="materialCode != null and materialCode != ''">#{materialCode},</if>
<if test="materialName != null and materialName != ''">#{materialName},</if>
<if test="materialSpc != null">#{materialSpc},</if>
<if test="unit != null and unit != ''">#{unit},</if>
<if test="quantity != null">#{quantity},</if>
</trim>
</insert>
<!-- <update id="updateMesPrepare" parameterType="MesPrepare">-->
<!-- update mes_prepare-->
<!-- <trim prefix="SET" suffixOverrides=",">-->
<!-- <if test="workorderCode != null and workorderCode != ''">workorder_code = #{workorderCode},</if>-->
<!-- <if test="workorderName != null">workorder_name = #{workorderName},</if>-->
<!-- <if test="parentOrder != null and parentOrder != ''">parent_order = #{parentOrder},</if>-->
<!-- <if test="orderId != null and orderId != ''">order_id = #{orderId},</if>-->
<!-- <if test="orderCode != null">order_code = #{orderCode},</if>-->
<!-- <if test="productId != null">product_id = #{productId},</if>-->
<!-- <if test="productCode != null and productCode != ''">product_code = #{productCode},</if>-->
<!-- <if test="prodType != null">prod_type = #{prodType},</if>-->
<!-- <if test="productName != null and productName != ''">product_name = #{productName},</if>-->
<!-- <if test="productSpc != null">product_spc = #{productSpc},</if>-->
<!-- <if test="wetDetailPlanId != null">wet_detail_plan_id = #{wetDetailPlanId},</if>-->
<!-- <if test="productDate != null">product_date = #{productDate},</if>-->
<!-- <if test="shiftId != null">shift_id = #{shiftId},</if>-->
<!-- <if test="ancestors != null">ancestors = #{ancestors},</if>-->
<!-- <if test="status != null">status = #{status},</if>-->
<!-- <if test="remark != null">remark = #{remark},</if>-->
<!-- <if test="attr1 != null">attr1 = #{attr1},</if>-->
<!-- <if test="attr2 != null">attr2 = #{attr2},</if>-->
<!-- <if test="attr3 != null">attr3 = #{attr3},</if>-->
<!-- <if test="attr4 != null">attr4 = #{attr4},</if>-->
<!-- <if test="createBy != null">create_by = #{createBy},</if>-->
<!-- <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="factoryCode != null">factory_code = #{factoryCode},</if>-->
<!-- </trim>-->
<!-- where prepare_id = #{prepareId}-->
<!-- </update>-->
<update id="updateMesPrepare" parameterType="MesPrepare">
update mes_prepare
<trim prefix="SET" suffixOverrides=",">
<if test="workorderCode != null and workorderCode != ''">workorder_code = #{workorderCode},</if>
<if test="workorderName != null">workorder_name = #{workorderName},</if>
<if test="parentOrder != null and parentOrder != ''">parent_order = #{parentOrder},</if>
<if test="orderId != null and orderId != ''">order_id = #{orderId},</if>
<if test="orderCode != null">order_code = #{orderCode},</if>
<if test="productId != null">product_id = #{productId},</if>
<if test="productCode != null and productCode != ''">product_code = #{productCode},</if>
<if test="prodType != null">prod_type = #{prodType},</if>
<if test="productName != null and productName != ''">product_name = #{productName},</if>
<if test="productSpc != null">product_spc = #{productSpc},</if>
<if test="wetDetailPlanId != null">wet_detail_plan_id = #{wetDetailPlanId},</if>
<if test="productDate != null">product_date = #{productDate},</if>
<if test="shiftId != null">shift_id = #{shiftId},</if>
<if test="ancestors != null">ancestors = #{ancestors},</if>
<if test="status != null">status = #{status},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="attr1 != null">attr1 = #{attr1},</if>
<if test="attr2 != null">attr2 = #{attr2},</if>
<if test="attr3 != null">attr3 = #{attr3},</if>
<if test="attr4 != null">attr4 = #{attr4},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<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="factoryCode != null">factory_code = #{factoryCode},</if>
</trim>
where prepare_id = #{prepareId}
</update>
<!-- <delete id="deleteMesPrepareByPrepareId" parameterType="String">-->
<!-- delete from mes_prepare where prepare_id = #{prepareId}-->
<!-- </delete>-->
<delete id="deleteMesPrepareByPrepareId" parameterType="String">
delete from mes_prepare where prepare_id = #{prepareId}
</delete>
<!-- <delete id="deleteMesPrepareByPrepareIds" parameterType="String">-->
<!-- delete from mes_prepare where prepare_id in -->
<!-- <foreach item="prepareId" collection="array" open="(" separator="," close=")">-->
<!-- #{prepareId}-->
<!-- </foreach>-->
<!-- </delete>-->
<delete id="deleteMesPrepareByPrepareIds" parameterType="String">
delete from mes_prepare where prepare_id in
<foreach item="prepareId" collection="array" open="(" separator="," close=")">
#{prepareId}
</foreach>
</delete>
</mapper>

@ -1,5 +1,6 @@
package com.op.sap.controller;
import com.op.common.core.domain.R;
import com.op.common.core.utils.DateUtils;
import com.op.common.core.web.controller.BaseController;
import com.op.common.core.web.domain.AjaxResult;
@ -10,6 +11,7 @@ import com.op.sap.service.SapBomService;
import com.op.sap.domain.SapBom;
import com.op.sap.service.SapMaterialPreparationService;
import com.op.sap.service.SapOrderService;
import com.op.system.api.domain.sap.SapMaterialPreparation;
import com.op.system.api.model.SapProOrder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -35,7 +37,7 @@ public class SapController extends BaseController {
*/
@PostMapping("/shopOrderSync")
@Log(title = "同步SAP订单", businessType = BusinessType.SAP)
public AjaxResult shopOrderSync(@RequestBody SapProOrder sapProOrder){
public R<List<SapProOrder>> shopOrderSync(@RequestBody SapProOrder sapProOrder){
return sapOrderService.shopOrderSync(sapProOrder);
}
@ -66,7 +68,7 @@ public class SapController extends BaseController {
@PostMapping("/materialPreparation")
@Log(title = "生产订单备料单接口", businessType = BusinessType.SAP)
public AjaxResult materialPreparation(@RequestParam("shopOrder") String shopOrder){
public R<List<SapMaterialPreparation>> materialPreparation(@RequestParam("shopOrder") String shopOrder){
return sapMaterialPreparationService.MaterialPreparation(shopOrder);
}

@ -1,8 +1,12 @@
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.SapMaterialPreparation;
import java.util.List;
public interface SapMaterialPreparationService {
AjaxResult MaterialPreparation(String shopOrder);
R<List<SapMaterialPreparation>> MaterialPreparation(String shopOrder);
}

@ -1,5 +1,6 @@
package com.op.sap.service;
import com.op.common.core.domain.R;
import com.op.common.core.web.domain.AjaxResult;
import com.op.sap.domain.SapBom;
import com.op.system.api.model.SapProOrder;
@ -8,5 +9,5 @@ import java.util.List;
public interface SapOrderService {
AjaxResult shopOrderSync(SapProOrder sapProOrder);
R<List<SapProOrder>> shopOrderSync(SapProOrder sapProOrder);
}

@ -1,10 +1,12 @@
package com.op.sap.service.impl;
import com.op.common.core.domain.R;
import com.op.common.core.web.domain.AjaxResult;
import com.op.sap.domain.SapMaterialPreparation;
import com.op.sap.mapper.SapMaterialPreparationMapper;
import com.op.sap.service.SapMaterialPreparationService;
import com.op.sap.util.SAPConnUtils;
import com.op.system.api.domain.sap.SapMaterialPreparation;
import com.sap.conn.jco.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -19,7 +21,7 @@ public class SapMaterialPreparationServiceImpl implements SapMaterialPreparation
SapMaterialPreparationMapper sapMaterialPreparationMapper;
@Override
public AjaxResult MaterialPreparation(String shopOrder) {
public R<List<SapMaterialPreparation>> MaterialPreparation(String shopOrder) {
// 连接
try {
@ -86,9 +88,9 @@ public class SapMaterialPreparationServiceImpl implements SapMaterialPreparation
sapMaterialPreparation.setZQLSL(ZQLSL);
sapMaterialPreparationList.add(sapMaterialPreparation);
}
return AjaxResult.success(sapMaterialPreparationList);
return R.ok(sapMaterialPreparationList);
} catch (Exception e) {
return AjaxResult.error(e.getMessage());
return R.fail(e.getMessage());
}
}
}

@ -1,5 +1,6 @@
package com.op.sap.service.impl;
import com.op.common.core.domain.R;
import com.op.common.core.utils.DateUtils;
import com.op.common.core.utils.uuid.IdUtils;
import com.op.common.core.web.domain.AjaxResult;
@ -27,12 +28,8 @@ import java.util.List;
@Service
public class SapOrderServiceImpl implements SapOrderService {
@Autowired
private RemotePlanService remotePlanService;
@Override
public AjaxResult shopOrderSync(SapProOrder sapProOrder) {
public R<List<SapProOrder>> shopOrderSync(SapProOrder sapProOrder) {
try {
// 获取调用 RFC 函数对象
@ -98,7 +95,7 @@ public class SapOrderServiceImpl implements SapOrderService {
// remoteMesService.sapAddOrder(proOrder);
}
return AjaxResult.success(proOrderList);
return R.ok(proOrderList);
} catch (Exception e) {
return null;
}

Loading…
Cancel
Save