erp:
1、金蝶同步物料信息,参数增加最新时间
master
xs 5 months ago
parent 7a212ed527
commit 133ffe986e

@ -3,9 +3,11 @@ package com.hw.jindie.api;
import com.hw.common.core.constant.SecurityConstants; import com.hw.common.core.constant.SecurityConstants;
import com.hw.common.core.constant.ServiceNameConstants; import com.hw.common.core.constant.ServiceNameConstants;
import com.hw.common.core.domain.R; import com.hw.common.core.domain.R;
import com.hw.jindie.api.domain.vo.ErpSyncInfoVo;
import com.hw.jindie.api.factory.RemoteJindieFallbackFactory; import com.hw.jindie.api.factory.RemoteJindieFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestHeader;
/** /**
@ -23,7 +25,7 @@ public interface RemoteJindieService {
/** 同步物料*/ /** 同步物料*/
@PostMapping("/jindie/syncMaterialInfoFromErp") @PostMapping("/jindie/syncMaterialInfoFromErp")
R<Integer> syncMaterialInfoFromErp(@RequestHeader(SecurityConstants.FROM_SOURCE) String source); R<Integer> syncMaterialInfoFromErp(@RequestBody ErpSyncInfoVo erpSyncInfoVo,@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
/** 同步项目信息*/ /** 同步项目信息*/
@PostMapping("/jindie/syncProjectInfoFromErp") @PostMapping("/jindie/syncProjectInfoFromErp")

@ -0,0 +1,9 @@
package com.hw.jindie.api.domain.vo;
import lombok.Data;
@Data
public class ErpSyncInfoVo {
private String maxErpModifyDate;
}

@ -2,7 +2,9 @@ package com.hw.jindie.api.factory;
import com.hw.common.core.domain.R; import com.hw.common.core.domain.R;
import com.hw.jindie.api.RemoteJindieService; import com.hw.jindie.api.RemoteJindieService;
import com.hw.jindie.api.domain.vo.ErpSyncInfoVo;
import org.springframework.cloud.openfeign.FallbackFactory; import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.web.bind.annotation.RequestBody;
/** /**
* @ClassName : RemoteJindieFallbackFactory * @ClassName : RemoteJindieFallbackFactory
@ -19,7 +21,7 @@ public class RemoteJindieFallbackFactory implements FallbackFactory<RemoteJindie
} }
@Override @Override
public R<Integer> syncMaterialInfoFromErp(String source) { public R<Integer> syncMaterialInfoFromErp(ErpSyncInfoVo erpSyncInfoVo,String source) {
return R.fail("同步物料信息失败:" + throwable.getMessage()); return R.fail("同步物料信息失败:" + throwable.getMessage());
} }

@ -5,8 +5,11 @@ import com.hw.common.core.web.domain.AjaxResult;
import com.hw.common.log.annotation.Log; import com.hw.common.log.annotation.Log;
import com.hw.common.log.enums.BusinessType; import com.hw.common.log.enums.BusinessType;
import com.hw.common.security.annotation.InnerAuth; import com.hw.common.security.annotation.InnerAuth;
import com.hw.jindie.api.domain.vo.ErpSyncInfoVo;
import com.hw.jindie.service.IKingdeeErpSyncService; import com.hw.jindie.service.IKingdeeErpSyncService;
import com.hw.jindie.service.impl.KingdeeErpService; import com.hw.jindie.service.impl.KingdeeErpService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -20,6 +23,8 @@ import org.springframework.web.bind.annotation.*;
@RestController @RestController
@RequestMapping("/jindie") @RequestMapping("/jindie")
public class KingdeeErpSyncController { public class KingdeeErpSyncController {
private static final Logger logger = LoggerFactory.getLogger(KingdeeErpSyncController.class);
@Autowired @Autowired
private IKingdeeErpSyncService kingdeeErpSyncService; private IKingdeeErpSyncService kingdeeErpSyncService;
@ -29,15 +34,15 @@ public class KingdeeErpSyncController {
/** /**
* erpMES * erpMES
* */ */
@PostMapping("/syncSupplierInfoFromErp") @PostMapping("/syncSupplierInfoFromErp")
@Log(title = "ERP供应商信息", businessType = BusinessType.INSERT) @Log(title = "ERP供应商信息", businessType = BusinessType.INSERT)
@InnerAuth @InnerAuth
public AjaxResult syncSupplierInfoFromErp(){ public AjaxResult syncSupplierInfoFromErp() {
try { try {
return AjaxResult.success(kingdeeErpSyncService.syncSupplierInfoFromErp(0)); return AjaxResult.success(kingdeeErpSyncService.syncSupplierInfoFromErp(0));
} catch (Exception e){ } catch (Exception e) {
e.printStackTrace(); logger.error("同步供应商信息错误:" + e.getMessage());
return AjaxResult.error(); return AjaxResult.error();
} }
} }
@ -45,49 +50,46 @@ public class KingdeeErpSyncController {
/** /**
* ERPMES * ERPMES
*/ */
// @RequiresPermissions("wms:mobile:addrawinstock")
@Log(title = "ERP物料信息", businessType = BusinessType.INSERT) @Log(title = "ERP物料信息", businessType = BusinessType.INSERT)
@PostMapping(("/syncMaterialInfoFromErp")) @PostMapping(("/syncMaterialInfoFromErp"))
@InnerAuth @InnerAuth
public AjaxResult syncMaterialInfoFromErp() { public AjaxResult syncMaterialInfoFromErp(@RequestBody ErpSyncInfoVo erpSyncInfoVo) {
try { try {
return AjaxResult.success(kingdeeErpSyncService.syncMaterialInfoFromErp(0)); return AjaxResult.success(kingdeeErpSyncService.syncMaterialInfoFromErp(0, erpSyncInfoVo));
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); logger.error("同步物料信息错误:" + e.getMessage());
return AjaxResult.error(); return AjaxResult.error();
} }
} }
/** /**
* ERPMES * ERPMES
* */ */
@PostMapping("/syncProjectInfoFromErp") @PostMapping("/syncProjectInfoFromErp")
@Log(title = "ERP项目信息", businessType = BusinessType.INSERT) @Log(title = "ERP项目信息", businessType = BusinessType.INSERT)
@InnerAuth @InnerAuth
public AjaxResult syncProjectInfoFromErp(){ public AjaxResult syncProjectInfoFromErp() {
try { try {
return AjaxResult.success(kingdeeErpSyncService.syncProjectInfoFromErp(0)); return AjaxResult.success(kingdeeErpSyncService.syncProjectInfoFromErp(0));
} } catch (Exception e) {
catch (Exception e) { logger.error("同步项目信息错误:" + e.getMessage());
return AjaxResult.error(); return AjaxResult.error();
} }
} }
/** /**
* ERPERP * ERPERP
* */ */
@PostMapping("/syncSaleOrderFromErp") @PostMapping("/syncSaleOrderFromErp")
@Log(title = "ERP销售订单", businessType = BusinessType.INSERT) @Log(title = "ERP销售订单", businessType = BusinessType.INSERT)
@InnerAuth @InnerAuth
public AjaxResult syncSaleOrderFromErp(){ public AjaxResult syncSaleOrderFromErp() {
try { try {
return AjaxResult.success(kingdeeErpSyncService.syncSaleOrderFromErp(0)); return AjaxResult.success(kingdeeErpSyncService.syncSaleOrderFromErp(0));
} } catch (Exception e) {
catch (Exception e) { logger.error("同步销售订单信息错误:" + e.getMessage());
e.printStackTrace();
return AjaxResult.error(); return AjaxResult.error();
} }
} }
@ -95,25 +97,20 @@ public class KingdeeErpSyncController {
/** /**
* ERPMES * ERPMES
* */ */
@PostMapping("/syncPurchaseOrderFromErp") @PostMapping("/syncPurchaseOrderFromErp")
@Log(title = "ERP采购订单", businessType = BusinessType.INSERT) @Log(title = "ERP采购订单", businessType = BusinessType.INSERT)
@InnerAuth @InnerAuth
public AjaxResult syncPurchaseOrderFromErp(){ public AjaxResult syncPurchaseOrderFromErp() {
try { try {
return AjaxResult.success(kingdeeErpSyncService.syncPurchaseOrderFromErp(0)); return AjaxResult.success(kingdeeErpSyncService.syncPurchaseOrderFromErp(0));
} } catch (Exception e) {
catch (Exception e) { logger.error("同步采购订单信息错误:" + e.getMessage());
return AjaxResult.error(); return AjaxResult.error();
} }
} }
/** /**
* ->-> * ->->
* *
@ -149,6 +146,7 @@ public class KingdeeErpSyncController {
/** /**
* ->-> * ->->
*
* @param params {"FMaterialId": "01150020","FDate": "2024-04-12 00:00:00","FUnitID": "zhi1","FStockId": "CK052","FAuxPropId": "304不锈钢滤帽","FQty": 4.0000,"FPrice": 20.3} * @param params {"FMaterialId": "01150020","FDate": "2024-04-12 00:00:00","FUnitID": "zhi1","FStockId": "CK052","FAuxPropId": "304不锈钢滤帽","FQty": 4.0000,"FPrice": 20.3}
* @return {"msg": "{\"IsSuccess\":true,\"Errors\":[],\"SuccessEntitys\":[{\"Id\":\"116470\",\"Number\":\"QTCK004153\",\"DIndex\":0}]}","code": 200} * @return {"msg": "{\"IsSuccess\":true,\"Errors\":[],\"SuccessEntitys\":[{\"Id\":\"116470\",\"Number\":\"QTCK004153\",\"DIndex\":0}]}","code": 200}
*/ */
@ -164,6 +162,7 @@ public class KingdeeErpSyncController {
/** /**
* ->-> * ->->
*
* @param params {"FMaterialId": "01150020","FDate": "2024-04-12 00:00:00","FUnitID": "zhi1","FStockId": "CK052","FAuxPropId": "304不锈钢滤帽","FQty": 4.0000,"FPrice": 20.3} * @param params {"FMaterialId": "01150020","FDate": "2024-04-12 00:00:00","FUnitID": "zhi1","FStockId": "CK052","FAuxPropId": "304不锈钢滤帽","FQty": 4.0000,"FPrice": 20.3}
* @return { "msg": "{\"IsSuccess\":true,\"Errors\":[],\"SuccessEntitys\":[{\"Id\":\"100418\",\"Number\":\"QTRK000352\",\"DIndex\":0}]}", "code": 200} * @return { "msg": "{\"IsSuccess\":true,\"Errors\":[],\"SuccessEntitys\":[{\"Id\":\"100418\",\"Number\":\"QTRK000352\",\"DIndex\":0}]}", "code": 200}
*/ */
@ -253,5 +252,4 @@ public class KingdeeErpSyncController {
} }
} }

@ -1,9 +1,11 @@
package com.hw.jindie.service; package com.hw.jindie.service;
import com.hw.jindie.api.domain.vo.ErpSyncInfoVo;
public interface IKingdeeErpSyncService { public interface IKingdeeErpSyncService {
public int syncSupplierInfoFromErp(int startRow) throws Exception; public int syncSupplierInfoFromErp(int startRow) throws Exception;
public int syncMaterialInfoFromErp(int startRow) throws Exception; public int syncMaterialInfoFromErp(int startRow, ErpSyncInfoVo erpSyncInfoVo) throws Exception;
public int syncProjectInfoFromErp(int startRow) throws Exception; public int syncProjectInfoFromErp(int startRow) throws Exception;
public int syncSaleOrderFromErp(int startRow) throws Exception; public int syncSaleOrderFromErp(int startRow) throws Exception;
public int syncPurchaseOrderFromErp(int startRow) throws Exception; public int syncPurchaseOrderFromErp(int startRow) throws Exception;

@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.hw.common.core.utils.DateUtils; import com.hw.common.core.utils.DateUtils;
import com.hw.common.core.utils.StringUtils; import com.hw.common.core.utils.StringUtils;
import com.hw.jindie.api.domain.vo.ErpSyncInfoVo;
import com.hw.jindie.domain.*; import com.hw.jindie.domain.*;
import com.hw.jindie.mapper.*; import com.hw.jindie.mapper.*;
import com.hw.jindie.service.IKingdeeErpSyncService; import com.hw.jindie.service.IKingdeeErpSyncService;
@ -181,8 +182,9 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
* @Description:ERP * @Description:ERP
*/ */
@Override @Override
public int syncMaterialInfoFromErp(int startRow) throws Exception { public int syncMaterialInfoFromErp(int startRow, ErpSyncInfoVo erpSyncInfoVo) throws Exception {
String maxErpModifyDate = mesBaseMaterialInfoMapper.selectMaxErpModifyDate(); String maxErpModifyDate = StringUtils.isEmpty(erpSyncInfoVo.getMaxErpModifyDate())
?mesBaseMaterialInfoMapper.selectMaxErpModifyDate():erpSyncInfoVo.getMaxErpModifyDate();
return syncMaterialInfoFromErp(startRow, maxErpModifyDate); return syncMaterialInfoFromErp(startRow, maxErpModifyDate);
} }
@ -727,6 +729,10 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService {
mesPurchaseOrder.setTondBase(tondBase); mesPurchaseOrder.setTondBase(tondBase);
mesPurchaseOrder.setSupplierId(supplierId); mesPurchaseOrder.setSupplierId(supplierId);
mesPurchaseOrder.setUpdateTime(currentDate); mesPurchaseOrder.setUpdateTime(currentDate);
//todo:需要确认ERP中的采购订单信息有没有完成和代采购的状态等信息
// mesPurchaseOrder.setOrderStatus(待采购);
if (approveDate != null) { if (approveDate != null) {
mesPurchaseOrder.setApproveDate(conversionERPTime(approveDate)); mesPurchaseOrder.setApproveDate(conversionERPTime(approveDate));
} }

@ -10,7 +10,7 @@
<result property="fentryId" column="fentry_id"/> <result property="fentryId" column="fentry_id"/>
<result property="saleorderCode" column="saleorder_code"/> <result property="saleorderCode" column="saleorder_code"/>
<result property="saleorderLinenumber" column="saleorder_linenumber"/> <result property="saleorderLinenumber" column="saleorder_linenumber"/>
<result property="documentStatus" column="document_statsu"/> <result property="documentStatus" column="document_status"/>
<result property="factoryId" column="factory_id"/> <result property="factoryId" column="factory_id"/>
<result property="prodlineId" column="prodline_id"/> <result property="prodlineId" column="prodline_id"/>
<result property="materialId" column="material_id"/> <result property="materialId" column="material_id"/>
@ -48,7 +48,7 @@
fentry_id, fentry_id,
saleorder_code, saleorder_code,
saleorder_linenumber, saleorder_linenumber,
document_statsu, document_status,
factory_id, factory_id,
prodline_id, prodline_id,
material_id, material_id,
@ -89,7 +89,7 @@
<if test="saleorderLinenumber != null and saleorderLinenumber != ''">and saleorder_linenumber = <if test="saleorderLinenumber != null and saleorderLinenumber != ''">and saleorder_linenumber =
#{saleorderLinenumber} #{saleorderLinenumber}
</if> </if>
<if test="documentStatus != null and documentStatus != ''">and document_statsu = #{documentStatus}</if> <if test="documentStatus != null and documentStatus != ''">and document_status = #{documentStatus}</if>
<if test="factoryId != null ">and factory_id = #{factoryId}</if> <if test="factoryId != null ">and factory_id = #{factoryId}</if>
<if test="prodlineId != null ">and prodline_id = #{prodlineId}</if> <if test="prodlineId != null ">and prodline_id = #{prodlineId}</if>
<if test="materialId != null ">and material_id = #{materialId}</if> <if test="materialId != null ">and material_id = #{materialId}</if>
@ -130,7 +130,7 @@
<if test="fentryId != null">fentry_id,</if> <if test="fentryId != null">fentry_id,</if>
<if test="saleorderCode != null">saleorder_code,</if> <if test="saleorderCode != null">saleorder_code,</if>
<if test="saleorderLinenumber != null">saleorder_linenumber,</if> <if test="saleorderLinenumber != null">saleorder_linenumber,</if>
<if test="documentStatus != null">document_statsu,</if> <if test="documentStatus != null">document_status,</if>
<if test="factoryId != null">factory_id,</if> <if test="factoryId != null">factory_id,</if>
<if test="prodlineId != null">prodline_id,</if> <if test="prodlineId != null">prodline_id,</if>
<if test="materialId != null">material_id,</if> <if test="materialId != null">material_id,</if>
@ -204,7 +204,7 @@
<if test="fentryId != null">fentry_id = #{fentryId},</if> <if test="fentryId != null">fentry_id = #{fentryId},</if>
<if test="saleorderCode != null">saleorder_code = #{saleorderCode},</if> <if test="saleorderCode != null">saleorder_code = #{saleorderCode},</if>
<if test="saleorderLinenumber != null">saleorder_linenumber = #{saleorderLinenumber},</if> <if test="saleorderLinenumber != null">saleorder_linenumber = #{saleorderLinenumber},</if>
<if test="documentStatus != null">document_statsu = #{documentStatus},</if> <if test="documentStatus != null">document_status = #{documentStatus},</if>
<if test="factoryId != null">factory_id = #{factoryId},</if> <if test="factoryId != null">factory_id = #{factoryId},</if>
<if test="prodlineId != null">prodline_id = #{prodlineId},</if> <if test="prodlineId != null">prodline_id = #{prodlineId},</if>
<if test="materialId != null">material_id = #{materialId},</if> <if test="materialId != null">material_id = #{materialId},</if>
@ -268,7 +268,7 @@
<insert id="batchMesBaseSaleOrder"> <insert id="batchMesBaseSaleOrder">
INSERT INTO mes_sale_order (erp_id, fentry_id, saleorder_code, saleorder_linenumber, document_statsu, material_id, material_code, material_name, matkl, order_amount, complete_amount, release_qty, approve_date, erp_modify_date, plan_delivery_date, stock_id, owner_id, aux_prop_id, sale_dept_id, price, stock_org_id, tond_base, create_time,update_time) VALUES INSERT INTO mes_sale_order (erp_id, fentry_id, saleorder_code, saleorder_linenumber, document_status, material_id, material_code, material_name, matkl, order_amount, complete_amount, release_qty, approve_date, erp_modify_date, plan_delivery_date, stock_id, owner_id, aux_prop_id, sale_dept_id, price, stock_org_id, tond_base, create_time,update_time) VALUES
<foreach item="item" index="index" collection="list" separator=","> <foreach item="item" index="index" collection="list" separator=",">
(#{item.erpId}, #{item.fentryId}, #{item.saleorderCode}, #{item.saleorderLinenumber}, #{item.documentStatus}, #{item.materialId}, #{item.materialCode}, #{item.materialName}, #{item.matkl}, #{item.orderAmount}, #{item.completeAmount}, #{item.releaseQty}, #{item.approveDate}, #{item.erpModifyDate}, #{item.planDeliveryDate}, #{item.stockId}, #{item.ownerId}, #{item.auxPropId}, #{item.saleDeptId}, #{item.price}, #{item.stockOrgId}, #{item.tondBase}, #{item.createTime}, #{item.updateTime}) (#{item.erpId}, #{item.fentryId}, #{item.saleorderCode}, #{item.saleorderLinenumber}, #{item.documentStatus}, #{item.materialId}, #{item.materialCode}, #{item.materialName}, #{item.matkl}, #{item.orderAmount}, #{item.completeAmount}, #{item.releaseQty}, #{item.approveDate}, #{item.erpModifyDate}, #{item.planDeliveryDate}, #{item.stockId}, #{item.ownerId}, #{item.auxPropId}, #{item.saleDeptId}, #{item.price}, #{item.stockOrgId}, #{item.tondBase}, #{item.createTime}, #{item.updateTime})
</foreach> </foreach>

Loading…
Cancel
Save