Merge remote-tracking branch 'origin/master'

master
mengjiao 12 months ago
commit 705fdb1a3d

@ -338,6 +338,16 @@ public class SapController extends BaseController {
return sapOrderService.shopUpdateSync(sapProOrder);
}
/**
*
*/
@PostMapping("/shopOrderBomUpdate")
@Log(title = "生产订单组件修改", businessType = BusinessType.SAP)
public R shopOrderBomUpdate(@RequestBody(required = false) List<Map<String, Object>> mapList) {
return sapOrderService.shopOrderBomUpdate(mapList);
}
/**
*
@ -476,4 +486,27 @@ public class SapController extends BaseController {
return sapWmsService.sapProductWarehousing(mapList);
}
/**
*
*
* @param mapList
* @return
*/
@PostMapping("/inComingCheck")
@Log(title = "来料检验", businessType = BusinessType.SAP)
public R inComingCheck(@RequestBody(required = false) Map<String, Object> mapList) {
return sapItemSyncService.inComingCheck(mapList);
}
/**
*
*/
@PostMapping("/FPinventory")
@Log(title = "来料检验", businessType = BusinessType.SAP)
public R FPinventory(@RequestBody(required = false) Map<String, Object> mapList) {
return sapItemSyncService.FPinventory(mapList);
}
}

@ -31,4 +31,7 @@ public interface SapItemSyncService {
R sapBackflushMP(List<SapBackflushMPQuery> sapBackflushMPQueryList);
R inComingCheck(Map<String, Object> mapList);
R FPinventory(Map<String, Object> mapList);
}

@ -58,4 +58,6 @@ public interface SapOrderService {
R sapPOrderGoodsReceipt(List<Map<String, Object>> mapList);
R shopOrderBomUpdate(List<Map<String, Object>> mapList);
}

@ -9,6 +9,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.system.api.domain.quality.QcCheckTaskIncomeDTO;
import com.op.system.api.domain.sap.SapBackflushMPQuery;
import com.op.sap.domain.vo.SapItemQuery;
import com.op.system.api.domain.sap.SapMaterialPosting;
@ -68,7 +69,7 @@ public class SapItemSyncImpl implements SapItemSyncService {
S_MATKL
S_ERSDA
S_LAEDA */
sapItemQuery.setMatnr("000000040000005209");
if (!StringUtils.isNull(sapItemQuery.getMatnr())) {
JCoTable S_MATNR = func.getTableParameterList().getTable("S_MATNR");
S_MATNR.appendRow();
@ -93,14 +94,14 @@ public class SapItemSyncImpl implements SapItemSyncService {
S_ERSDA.setValue(Constants.LOW, sapItemQuery.getErsda());
S_ERSDA.setValue("HIGH", END_DATE);
}
if (!StringUtils.isNull(sapItemQuery.getLaeda())) {
JCoTable S_LAEDA = func.getTableParameterList().getTable("S_LAEDA");
S_LAEDA.appendRow();
S_LAEDA.setValue(Constants.SIGN, "I");
S_LAEDA.setValue(Constants.OPTION, "BT");
S_LAEDA.setValue(Constants.LOW, sapItemQuery.getLaeda());
S_LAEDA.setValue("HIGH", END_DATE);
}
// if (!StringUtils.isNull(sapItemQuery.getLaeda())) {
// JCoTable S_LAEDA = func.getTableParameterList().getTable("S_LAEDA");
// S_LAEDA.appendRow();
// S_LAEDA.setValue(Constants.SIGN, "I");
// S_LAEDA.setValue(Constants.OPTION, "BT");
// S_LAEDA.setValue(Constants.LOW, sapItemQuery.getLaeda());
// S_LAEDA.setValue("HIGH", END_DATE);
// }
// 获取调用 RFC 函数对象
func.execute(dest);
@ -211,6 +212,7 @@ public class SapItemSyncImpl implements SapItemSyncService {
baseProduct.setGrossWeight(BRGEW);
baseProduct.setNetWeight(NTGEW);
baseProduct.setVolume(VOLUM);
baseProduct.setMeins(MEINS);
baseProduct.setDelFlag("0");
baseProduct.setActiveFlag("1");
baseProduct.setCreateBy(SecurityUtils.getUsername());
@ -352,6 +354,8 @@ public class SapItemSyncImpl implements SapItemSyncService {
}
public String importProducts(List<SapBaseProduct> sapBaseProductList) {
if (StringUtils.isNull(sapBaseProductList) || sapBaseProductList.size() == 0) {
throw new ServiceException("同步物料数据为空!");
@ -394,4 +398,71 @@ public class SapItemSyncImpl implements SapItemSyncService {
}
return successMsg.toString();
}
@Override
public R inComingCheck(Map<String, Object> mapList) {
try {
JCoRepository repository = dest.getRepository();
JCoFunction func = repository.getFunction("ZMES_MSEG_MKPF");
if (func == null) {
throw new RuntimeException("Function does not exist in SAP");
}
log.info("来料检验-------" + mapList.toString());
func.execute(dest);//执行调用函数
JCoTable maraTable = func.getTableParameterList().getTable("LT_LLZJ");
System.out.println(maraTable);
List<QcCheckTaskIncomeDTO> qcCheckTaskIncomeDTOList=new ArrayList<>();
for (int i = 0; i < maraTable.getNumRows(); i++) {
maraTable.setRow(i);
QcCheckTaskIncomeDTO qcCheckTaskIncomeDTO=new QcCheckTaskIncomeDTO();
qcCheckTaskIncomeDTO.setOrderNo(maraTable.getString("EBELN"));
qcCheckTaskIncomeDTO.setMaterialCode(maraTable.getString("MATNR"));
qcCheckTaskIncomeDTO.setMaterialName(maraTable.getString("MAKTX"));
System.out.println(maraTable);
qcCheckTaskIncomeDTOList.add(qcCheckTaskIncomeDTO);
}
return R.ok();
} catch (Exception e) {
log.error(e.getMessage());
return R.fail(e.getMessage());
}
}
@Override
public R FPinventory(Map<String, Object> mapList) {
try {
JCoRepository repository = dest.getRepository();
JCoFunction func = repository.getFunction("ZMES_ZSDR29");
if (func == null) {
throw new RuntimeException("Function does not exist in SAP");
}
log.info("成品备货单参数-------" + mapList.toString());
JCoTable S_TDDAT = func.getTableParameterList().getTable("S_TDDAT");
JCoTable S_MATNR = func.getTableParameterList().getTable("S_MATNR");
S_TDDAT.appendRow();
S_TDDAT.setValue(Constants.SIGN, "I");
S_TDDAT.setValue(Constants.OPTION, "BT");
S_TDDAT.setValue(Constants.LOW, "20231201");
S_TDDAT.setValue("HIGH", END_DATE);
System.out.println(S_TDDAT);
System.out.println(S_MATNR);
func.execute(dest);//执行调用函数
JCoTable maraTable = func.getTableParameterList().getTable("LT_CP");
System.out.println(maraTable);
// List<QcCheckTaskIncomeDTO> qcCheckTaskIncomeDTOList=new ArrayList<>();
// for (int i = 0; i < maraTable.getNumRows(); i++) {
// maraTable.setRow(i);
// QcCheckTaskIncomeDTO qcCheckTaskIncomeDTO=new QcCheckTaskIncomeDTO();
// qcCheckTaskIncomeDTO.setOrderNo(maraTable.getString("EBELN"));
// qcCheckTaskIncomeDTO.setMaterialCode(maraTable.getString("MATNR"));
// qcCheckTaskIncomeDTO.setMaterialName(maraTable.getString("MAKTX"));
// System.out.println(maraTable);
// qcCheckTaskIncomeDTOList.add(qcCheckTaskIncomeDTO);
// }
return R.ok();
} catch (Exception e) {
log.error(e.getMessage());
return R.fail(e.getMessage());
}
}
}

@ -1,8 +1,10 @@
package com.op.sap.service.impl;
import com.alibaba.fastjson2.JSONObject;
import com.alibaba.nacos.shaded.org.checkerframework.checker.units.qual.C;
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;
@ -92,9 +94,6 @@ public class SapOrderServiceImpl implements SapOrderService {
}
func.execute(dest);//执行调用函数
// 获取 内表 - ZMES_PRO
JCoTable maraTable = func.getTableParameterList().getTable("ZMES_PRO");
@ -451,12 +450,10 @@ public class SapOrderServiceImpl implements SapOrderService {
if (func == null) {
throw new RuntimeException("Function does not exist in SAP");
}
if (StringUtils.isEmpty(sapProOrder.getAufnr()))
{
if (StringUtils.isEmpty(sapProOrder.getAufnr())) {
return R.fail("订单号为空!");
}
if (StringUtils.isEmpty(sapProOrder.getQuantity()))
{
if (StringUtils.isEmpty(sapProOrder.getQuantity())) {
return R.fail("数量为空!");
}
@ -596,6 +593,55 @@ public class SapOrderServiceImpl implements SapOrderService {
}
}
@Override
public R shopOrderBomUpdate(List<Map<String, Object>> mapList) {
int successNum = 0;
int failureNum = 0;
StringBuilder successMsg = new StringBuilder();
StringBuilder failureMsg = new StringBuilder();
try {
JCoRepository repository = dest.getRepository();
JCoFunction func = repository.getFunction("ZMES_AUFNR_CHANGE");
if (func == null) {
throw new RuntimeException("Function does not exist in SAP");
}
log.info("生产订单组件修改-------" + mapList.toString());
JCoParameterList jCoParameterList = func.getImportParameterList();
for (Map m : mapList) {
jCoParameterList.setValue("P_AUFNR", m.get("P_AUFNR"));
jCoParameterList.setValue("P_MATNR", m.get("P_MATNR"));
jCoParameterList.setValue("P_GMEIN", m.get("P_GMEIN"));
jCoParameterList.setValue("P_WERKS", m.get("P_WERKS"));
jCoParameterList.setValue("P_LGORT", m.get("P_LGORT"));
func.execute(dest);//执行调用函数
//获取结果
String L_MSG = func.getExportParameterList().getString("MSG");
String RETCODE = func.getExportParameterList().getString("RETCODE");
if (Constants.SUCCESS.equals(Integer.parseInt(RETCODE))){
successNum++;
successMsg.append("<br/>" + successNum + "、物料:"+m.get("P_MATNR")+L_MSG);
}else {
failureNum++;
failureMsg.append("<br/>" + failureNum + "、物料 " +m.get("P_MATNR")+L_MSG);
}
}
} catch (Exception e) {
log.error(e.getMessage());
return R.fail(e.getMessage());
}
if (failureNum > 0) {
failureMsg.insert(0, "很抱歉添加SAP组件失败共 " + failureNum + " 条数据格式不正确,错误如下:");
throw new ServiceException(failureMsg.toString());
// return R.fail(failureMsg.toString());
} else {
successMsg.insert(0, "恭喜您添加SAP组件成功共 " + successNum + " 条,数据如下:");
}
return R.ok(successMsg);
}
}

@ -21,6 +21,7 @@
<result property="netWeight" column="net_weight"/>
<result property="tareWeight" column="tare_weight"/>
<result property="volume" column="volume"/>
<result property="meins" column="meins"/>
<result property="unitPrice" column="unit_price"/>
<result property="productGroup" column="product_group"/>
<result property="productGroupName" column="product_group_name"/>
@ -50,7 +51,7 @@
</resultMap>
<sql id="selectBaseProductVo">
select product_id, product_code, product_desc_zh, product_model,product_desc_en, rule_code, old_product_code, parts_product_code, sku_barcode, length, width, height, gross_weight, net_weight, tare_weight, volume, unit_price, product_group, product_group_name, user_defined1, user_defined2, user_defined3, user_defined4, user_defined5, user_defined6, create_by, create_time, update_by, update_time, factory_code, active_flag, sync_flag, primary_uom, del_flag, bstme, basic_order, conv_order, ausme, basic_issue, conv_issue, append_flag, append_percent from base_product
select product_id, product_code, product_desc_zh, product_model,product_desc_en, rule_code, old_product_code, parts_product_code, sku_barcode, length, width, height, gross_weight, net_weight, tare_weight, volume,meins, unit_price, product_group, product_group_name, user_defined1, user_defined2, user_defined3, user_defined4, user_defined5, user_defined6, create_by, create_time, update_by, update_time, factory_code, active_flag, sync_flag, primary_uom, del_flag, bstme, basic_order, conv_order, ausme, basic_issue, conv_issue, append_flag, append_percent from base_product
</sql>
<select id="selectSBaseProductList" parameterType="com.op.system.api.domain.sap.SapBaseProduct"
@ -129,6 +130,7 @@
<if test="netWeight != null">net_weight,</if>
<if test="tareWeight != null">tare_weight,</if>
<if test="volume != null">volume,</if>
<if test="meins != null">meins,</if>
<if test="unitPrice != null">unit_price,</if>
<if test="productGroup != null">product_group,</if>
<if test="productGroupName != null">product_group_name,</if>
@ -173,6 +175,7 @@
<if test="netWeight != null">#{netWeight},</if>
<if test="tareWeight != null">#{tareWeight},</if>
<if test="volume != null">#{volume},</if>
<if test="meins != null">meins,</if>
<if test="unitPrice != null">#{unitPrice},</if>
<if test="productGroup != null">#{productGroup},</if>
<if test="productGroupName != null">#{productGroupName},</if>
@ -220,6 +223,7 @@
<if test="netWeight != null">net_weight = #{netWeight},</if>
<if test="tareWeight != null">tare_weight = #{tareWeight},</if>
<if test="volume != null">volume = #{volume},</if>
<if test="meins != null">meins = #{meins},</if>
<if test="unitPrice != null">unit_price = #{unitPrice},</if>
<if test="productGroup != null">product_group = #{productGroup},</if>
<if test="productGroupName != null">product_group_name = #{productGroupName},</if>

Loading…
Cancel
Save