erp:
1、金蝶同步物料信息,参数增加最新时间
master
xs 4 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.ServiceNameConstants;
import com.hw.common.core.domain.R;
import com.hw.jindie.api.domain.vo.ErpSyncInfoVo;
import com.hw.jindie.api.factory.RemoteJindieFallbackFactory;
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.RequestHeader;
/**
@ -23,7 +25,7 @@ public interface RemoteJindieService {
/** 同步物料*/
@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")

@ -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.jindie.api.RemoteJindieService;
import com.hw.jindie.api.domain.vo.ErpSyncInfoVo;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.web.bind.annotation.RequestBody;
/**
* @ClassName : RemoteJindieFallbackFactory
@ -19,7 +21,7 @@ public class RemoteJindieFallbackFactory implements FallbackFactory<RemoteJindie
}
@Override
public R<Integer> syncMaterialInfoFromErp(String source) {
public R<Integer> syncMaterialInfoFromErp(ErpSyncInfoVo erpSyncInfoVo,String source) {
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.enums.BusinessType;
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.impl.KingdeeErpService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -20,6 +23,8 @@ import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/jindie")
public class KingdeeErpSyncController {
private static final Logger logger = LoggerFactory.getLogger(KingdeeErpSyncController.class);
@Autowired
private IKingdeeErpSyncService kingdeeErpSyncService;
@ -29,15 +34,15 @@ public class KingdeeErpSyncController {
/**
* erpMES
* */
*/
@PostMapping("/syncSupplierInfoFromErp")
@Log(title = "ERP供应商信息", businessType = BusinessType.INSERT)
@InnerAuth
public AjaxResult syncSupplierInfoFromErp(){
public AjaxResult syncSupplierInfoFromErp() {
try {
return AjaxResult.success(kingdeeErpSyncService.syncSupplierInfoFromErp(0));
} catch (Exception e){
e.printStackTrace();
} catch (Exception e) {
logger.error("同步供应商信息错误:" + e.getMessage());
return AjaxResult.error();
}
}
@ -45,49 +50,46 @@ public class KingdeeErpSyncController {
/**
* ERPMES
*/
// @RequiresPermissions("wms:mobile:addrawinstock")
@Log(title = "ERP物料信息", businessType = BusinessType.INSERT)
@PostMapping(("/syncMaterialInfoFromErp"))
@InnerAuth
public AjaxResult syncMaterialInfoFromErp() {
public AjaxResult syncMaterialInfoFromErp(@RequestBody ErpSyncInfoVo erpSyncInfoVo) {
try {
return AjaxResult.success(kingdeeErpSyncService.syncMaterialInfoFromErp(0));
return AjaxResult.success(kingdeeErpSyncService.syncMaterialInfoFromErp(0, erpSyncInfoVo));
} catch (Exception e) {
e.printStackTrace();
logger.error("同步物料信息错误:" + e.getMessage());
return AjaxResult.error();
}
}
/**
* ERPMES
* */
*/
@PostMapping("/syncProjectInfoFromErp")
@Log(title = "ERP项目信息", businessType = BusinessType.INSERT)
@InnerAuth
public AjaxResult syncProjectInfoFromErp(){
public AjaxResult syncProjectInfoFromErp() {
try {
return AjaxResult.success(kingdeeErpSyncService.syncProjectInfoFromErp(0));
}
catch (Exception e) {
} catch (Exception e) {
logger.error("同步项目信息错误:" + e.getMessage());
return AjaxResult.error();
}
}
/**
* ERPERP
* */
*/
@PostMapping("/syncSaleOrderFromErp")
@Log(title = "ERP销售订单", businessType = BusinessType.INSERT)
@InnerAuth
public AjaxResult syncSaleOrderFromErp(){
public AjaxResult syncSaleOrderFromErp() {
try {
return AjaxResult.success(kingdeeErpSyncService.syncSaleOrderFromErp(0));
}
catch (Exception e) {
e.printStackTrace();
} catch (Exception e) {
logger.error("同步销售订单信息错误:" + e.getMessage());
return AjaxResult.error();
}
}
@ -95,25 +97,20 @@ public class KingdeeErpSyncController {
/**
* ERPMES
* */
*/
@PostMapping("/syncPurchaseOrderFromErp")
@Log(title = "ERP采购订单", businessType = BusinessType.INSERT)
@InnerAuth
public AjaxResult syncPurchaseOrderFromErp(){
public AjaxResult syncPurchaseOrderFromErp() {
try {
return AjaxResult.success(kingdeeErpSyncService.syncPurchaseOrderFromErp(0));
}
catch (Exception e) {
} catch (Exception e) {
logger.error("同步采购订单信息错误:" + e.getMessage());
return AjaxResult.error();
}
}
/**
* ->->
*
@ -133,8 +130,8 @@ public class KingdeeErpSyncController {
* ->->
*
* @param params {"FMaterialId": "02030002","FMaterialDesc": "推进式搅拌机",
* "FAuxPropId": "①【搅拌机】380V--BLD12搅拌机功率3kw速比23转速65rpm ②【搅拌杆】搅拌杆长度3200mm轴径57 ③【叶轮】叶轮直径650二叶双层 ④【材质】碳钢衬胶⑤【机架】TJA2机架特别备注①湘潭电机二级能效②衬胶材质③电压:三相380V/50Hz; 电机防护/绝缘/温升:IP56/F/B",
* "FUnitID": "tai","FStockId": "CK002","FSrcBillNo": "JYCG-2023-5184","FRealQty": 4.0000,"FDate": "2024-04-10 00:00:00"}
* "FAuxPropId": "①【搅拌机】380V--BLD12搅拌机功率3kw速比23转速65rpm ②【搅拌杆】搅拌杆长度3200mm轴径57 ③【叶轮】叶轮直径650二叶双层 ④【材质】碳钢衬胶⑤【机架】TJA2机架特别备注①湘潭电机二级能效②衬胶材质③电压:三相380V/50Hz; 电机防护/绝缘/温升:IP56/F/B",
* "FUnitID": "tai","FStockId": "CK002","FSrcBillNo": "JYCG-2023-5184","FRealQty": 4.0000,"FDate": "2024-04-10 00:00:00"}
* @return {"msg": "{"IsSuccess":true,"Errors":[],"SuccessEntitys":[{"Id":"106249","Number":"CGRK00779","DIndex":0}]}","code": 200
* }
*/
@ -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}
* @return {"msg": "{\"IsSuccess\":true,\"Errors\":[],\"SuccessEntitys\":[{\"Id\":\"116470\",\"Number\":\"QTCK004153\",\"DIndex\":0}]}","code": 200}
*/
@ -164,8 +162,9 @@ 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}
* @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}
*/
@PostMapping(("/saveOtherInStorage"))
public AjaxResult saveOtherInStorage(@RequestBody String params) {
@ -253,5 +252,4 @@ public class KingdeeErpSyncController {
}
}

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

@ -10,7 +10,7 @@
<result property="fentryId" column="fentry_id"/>
<result property="saleorderCode" column="saleorder_code"/>
<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="prodlineId" column="prodline_id"/>
<result property="materialId" column="material_id"/>
@ -48,7 +48,7 @@
fentry_id,
saleorder_code,
saleorder_linenumber,
document_statsu,
document_status,
factory_id,
prodline_id,
material_id,
@ -89,7 +89,7 @@
<if test="saleorderLinenumber != null and saleorderLinenumber != ''">and saleorder_linenumber =
#{saleorderLinenumber}
</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="prodlineId != null ">and prodline_id = #{prodlineId}</if>
<if test="materialId != null ">and material_id = #{materialId}</if>
@ -130,7 +130,7 @@
<if test="fentryId != null">fentry_id,</if>
<if test="saleorderCode != null">saleorder_code,</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="prodlineId != null">prodline_id,</if>
<if test="materialId != null">material_id,</if>
@ -204,7 +204,7 @@
<if test="fentryId != null">fentry_id = #{fentryId},</if>
<if test="saleorderCode != null">saleorder_code = #{saleorderCode},</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="prodlineId != null">prodline_id = #{prodlineId},</if>
<if test="materialId != null">material_id = #{materialId},</if>
@ -268,7 +268,7 @@
<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=",">
(#{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>

Loading…
Cancel
Save