diff --git a/hw-api/hw-api-jindie/src/main/java/com/hw/jindie/api/RemoteJindieService.java b/hw-api/hw-api-jindie/src/main/java/com/hw/jindie/api/RemoteJindieService.java index 3997266..f18d905 100644 --- a/hw-api/hw-api-jindie/src/main/java/com/hw/jindie/api/RemoteJindieService.java +++ b/hw-api/hw-api-jindie/src/main/java/com/hw/jindie/api/RemoteJindieService.java @@ -44,4 +44,7 @@ public interface RemoteJindieService { @PostMapping("/jindie/singleSavePurchaseRequisition") R singleSavePurchaseRequisition(@RequestBody String params, @RequestHeader(SecurityConstants.FROM_SOURCE) String source); + /** 采购入库单保存->提交->审核*/ + @PostMapping("/jindie/savePurchaseStorage") + R savePurchaseStorage(@RequestBody String params, @RequestHeader(SecurityConstants.FROM_SOURCE) String source); } diff --git a/hw-api/hw-api-jindie/src/main/java/com/hw/jindie/api/factory/RemoteJindieFallbackFactory.java b/hw-api/hw-api-jindie/src/main/java/com/hw/jindie/api/factory/RemoteJindieFallbackFactory.java index befa477..3deb8cd 100644 --- a/hw-api/hw-api-jindie/src/main/java/com/hw/jindie/api/factory/RemoteJindieFallbackFactory.java +++ b/hw-api/hw-api-jindie/src/main/java/com/hw/jindie/api/factory/RemoteJindieFallbackFactory.java @@ -45,6 +45,11 @@ public class RemoteJindieFallbackFactory implements FallbackFactory singleSavePurchaseRequisition(String params, String source) { return R.fail("采购申请单excel导入失败:" + throwable.getMessage()); } + + @Override + public R savePurchaseStorage(String params, String source) { + return R.fail("采购入库单同步失败:" + throwable.getMessage()); + } }; } } diff --git a/hw-api/hw-api-wms/pom.xml b/hw-api/hw-api-wms/pom.xml new file mode 100644 index 0000000..705aef8 --- /dev/null +++ b/hw-api/hw-api-wms/pom.xml @@ -0,0 +1,28 @@ + + + + com.hw + hw-api + 3.6.3 + + 4.0.0 + + hw-api-wms + + + hw-api-wms接口模块 + + + + + + + com.hw + hw-common-core + + + + + diff --git a/hw-api/hw-api-wms/src/main/java/com/hw/wms/api/RemoteWmsService.java b/hw-api/hw-api-wms/src/main/java/com/hw/wms/api/RemoteWmsService.java new file mode 100644 index 0000000..01697c2 --- /dev/null +++ b/hw-api/hw-api-wms/src/main/java/com/hw/wms/api/RemoteWmsService.java @@ -0,0 +1,26 @@ +package com.hw.wms.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.common.core.web.domain.AjaxResult; +import com.hw.wms.api.factory.RemoteWmsFallbackFactory; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestHeader; + + +@FeignClient(contextId = "remoteWmsService", value = ServiceNameConstants.WMS_SERVICE, fallbackFactory = RemoteWmsFallbackFactory.class) +public interface RemoteWmsService { + + /** + * 定时同步入库信息给ERP + * @param source + * @return + */ + @PostMapping("/api/synchronizeInventoryInformationToERP") + public R synchronizeInventoryInformationToERP(@RequestHeader(SecurityConstants.FROM_SOURCE) String source); + + + +} diff --git a/hw-api/hw-api-wms/src/main/java/com/hw/wms/api/factory/RemoteWmsFallbackFactory.java b/hw-api/hw-api-wms/src/main/java/com/hw/wms/api/factory/RemoteWmsFallbackFactory.java new file mode 100644 index 0000000..f763298 --- /dev/null +++ b/hw-api/hw-api-wms/src/main/java/com/hw/wms/api/factory/RemoteWmsFallbackFactory.java @@ -0,0 +1,31 @@ +package com.hw.wms.api.factory; + +import com.hw.common.core.domain.R; +import com.hw.common.core.web.domain.AjaxResult; +import com.hw.wms.api.RemoteWmsService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.cloud.openfeign.FallbackFactory; +import org.springframework.stereotype.Component; + + +/** + * Wms服务降级处理 + * + * @author ruoyi + */ +@Component +public class RemoteWmsFallbackFactory implements FallbackFactory { + private static final Logger log = LoggerFactory.getLogger(RemoteWmsFallbackFactory.class); + + @Override + public RemoteWmsService create(Throwable throwable) { + log.error("Wms服务调用失败:{}", throwable.getMessage()); + return new RemoteWmsService() { + @Override + public R synchronizeInventoryInformationToERP(String source) { + return R.fail("定时同步入库信息给ERP失败:" + throwable.getMessage()); + } + }; + } +} diff --git a/hw-api/hw-api-wms/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/hw-api/hw-api-wms/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 0000000..7013af9 --- /dev/null +++ b/hw-api/hw-api-wms/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +com.hw.wms.api.factory.RemoteWmsFallbackFactory diff --git a/hw-api/pom.xml b/hw-api/pom.xml index fd5c0e0..4781d1f 100644 --- a/hw-api/pom.xml +++ b/hw-api/pom.xml @@ -17,6 +17,7 @@ hw-api-dms hw-api-job hw-api-jindie + hw-api-wms hw-api diff --git a/hw-common/hw-common-core/src/main/java/com/hw/common/core/constant/ServiceNameConstants.java b/hw-common/hw-common-core/src/main/java/com/hw/common/core/constant/ServiceNameConstants.java index 564d3e5..e99feb9 100644 --- a/hw-common/hw-common-core/src/main/java/com/hw/common/core/constant/ServiceNameConstants.java +++ b/hw-common/hw-common-core/src/main/java/com/hw/common/core/constant/ServiceNameConstants.java @@ -56,4 +56,8 @@ public class ServiceNameConstants * jindie服务下的serviceid * */ public static final String JINDIE_SERVICE = "hw-jindie"; + /** + * wms服务下的serviceid + * */ + public static final String WMS_SERVICE = "hw-wms"; } diff --git a/hw-modules/hw-jindie/src/main/java/com/hw/jindie/domain/MesPurchaseOrder.java b/hw-modules/hw-jindie/src/main/java/com/hw/jindie/domain/MesPurchaseOrder.java index 77b26ee..4e7e801 100644 --- a/hw-modules/hw-jindie/src/main/java/com/hw/jindie/domain/MesPurchaseOrder.java +++ b/hw-modules/hw-jindie/src/main/java/com/hw/jindie/domain/MesPurchaseOrder.java @@ -146,7 +146,18 @@ public class MesPurchaseOrder extends BaseEntity { private Long purchaseOrgId; //供应商id private Long supplierId; + /** + * 规格参数 + */ + private String specificationParameter; + public String getSpecificationParameter() { + return specificationParameter; + } + + public void setSpecificationParameter(String specificationParameter) { + this.specificationParameter = specificationParameter; + } public Long getUnitId() { return unitId; diff --git a/hw-modules/hw-jindie/src/main/java/com/hw/jindie/service/impl/KingdeeErpService.java b/hw-modules/hw-jindie/src/main/java/com/hw/jindie/service/impl/KingdeeErpService.java index d0e220b..a981b14 100644 --- a/hw-modules/hw-jindie/src/main/java/com/hw/jindie/service/impl/KingdeeErpService.java +++ b/hw-modules/hw-jindie/src/main/java/com/hw/jindie/service/impl/KingdeeErpService.java @@ -211,7 +211,11 @@ public class KingdeeErpService { FStockIdObject.put("FNumber", FStockId); FEntity.put("FStockId", FStockIdObject); //仓库 JSONObject FAuxPropIdObject = new JSONObject(); - FAuxPropIdObject.put("FAUXPROPID__FF100001", FAuxPropId); + if (StringUtils.isEmpty(FAuxPropId)){ + FAuxPropIdObject.put("FAUXPROPID__FF100001", "null"); + } else { + FAuxPropIdObject.put("FAUXPROPID__FF100001", FAuxPropId); + } FEntity.put("FAuxPropId", FAuxPropIdObject); //辅助属性 FEntity.put("FSrcBillNo", FSrcBillNo); //源单编号 diff --git a/hw-modules/hw-jindie/src/main/java/com/hw/jindie/service/impl/KingdeeErpSyncServiceImpl.java b/hw-modules/hw-jindie/src/main/java/com/hw/jindie/service/impl/KingdeeErpSyncServiceImpl.java index 3dc4b11..ab44b2f 100644 --- a/hw-modules/hw-jindie/src/main/java/com/hw/jindie/service/impl/KingdeeErpSyncServiceImpl.java +++ b/hw-modules/hw-jindie/src/main/java/com/hw/jindie/service/impl/KingdeeErpSyncServiceImpl.java @@ -762,12 +762,13 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService { * @Descrption:从金蝶ERP同步采购订单 */ public int syncPurchaseOrderFromErp(int startRow, String maxErpModifyDate) throws Exception { + maxErpModifyDate = "2022-03-23 11:30:57"; K3CloudApi api = new K3CloudApi(); // String FDocumentStatus = "C"; JSONObject queryJson = new JSONObject(); String formId = "PUR_PurchaseOrder"; String fieldKeys = "FID,FBillNo,FApproveDate,FDocumentStatus,FPOOrderEntry_FEntryID,FMaterialId,FMaterialId.FNumber,FMaterialId.FName," + - "FQty,FDeliveryDate,FCreateDate,FModifyDate,FUnitId,FStockUnitID,FPriceUnitID,FAuxPropId,FSrcBillNo,FPurchaseOrgId,F_TOND_Base,FSupplierId"; + "FQty,FDeliveryDate,FCreateDate,FModifyDate,FUnitId,FStockUnitID,FPriceUnitID,FAuxPropId,FAUXPROPID.FF100001,FSrcBillNo,FPurchaseOrgId,F_TOND_Base,FSupplierId"; // String filterString = ""; String orderString = ""; int topRowCount = 0; @@ -831,6 +832,8 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService { Long priceUnitId = resultObject.getLong("FPriceUnitID"); //辅助属性 Long auxPropId = resultObject.getLong("FAuxPropId"); + //规格参数 + String FF100001 = resultObject.getString("FAUXPROPID.FF100001"); //源单编号 String srcBillNo = resultObject.getString("FSrcBillNo"); //采购组织 @@ -857,6 +860,7 @@ public class KingdeeErpSyncServiceImpl implements IKingdeeErpSyncService { mesPurchaseOrder.setStockUnitId(stockUnitId); mesPurchaseOrder.setPriceUnitId(priceUnitId); mesPurchaseOrder.setAuxPropId(auxPropId); + mesPurchaseOrder.setSpecificationParameter(FF100001); mesPurchaseOrder.setSrcBillNo(srcBillNo); mesPurchaseOrder.setPurchaseOrgId(purchaseOrgId); mesPurchaseOrder.setTondBase(tondBase); diff --git a/hw-modules/hw-jindie/src/main/resources/mapper/jindie/MesPurchaseOrderMapper.xml b/hw-modules/hw-jindie/src/main/resources/mapper/jindie/MesPurchaseOrderMapper.xml index caf4ebb..ba31dd9 100644 --- a/hw-modules/hw-jindie/src/main/resources/mapper/jindie/MesPurchaseOrderMapper.xml +++ b/hw-modules/hw-jindie/src/main/resources/mapper/jindie/MesPurchaseOrderMapper.xml @@ -36,6 +36,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -43,7 +44,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" material_id, material_code, material_name, order_amount, complete_amount, approve_date, erp_modify_date, plan_delivery_date, begin_date, end_date, order_status, complete_date, is_flag, remark, create_by, create_time, update_by, update_time ,unit_id, - stock_unit_id,price_unit_id,aux_prop_id,src_bill_no,tond_base,purchase_org_id,supplier_id + stock_unit_id,price_unit_id,aux_prop_id,specification_parameter, src_bill_no,tond_base,purchase_org_id,supplier_id from mes_purchase_order @@ -112,6 +113,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" stock_unit_id, price_unit_id, aux_prop_id, + specification_parameter, src_bill_no, tond_base, purchase_org_id, @@ -144,6 +146,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{stockUnitId}, #{priceUnitId}, #{auxPropId}, + #{specificationParameter}, #{srcBillNo}, #{tondBase}, #{purchaseOrgId}, @@ -180,6 +183,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" stock_unit_id=#{stockUnitId}, price_unit_id=#{priceUnitId}, aux_prop_id=#{auxPropId}, + specification_parameter=#{specificationParameter}, src_bill_no=#{srcBillNo}, tond_base=#{tondBase}, purchase_org_id=#{purchaseOrgId}, @@ -210,9 +214,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - INSERT INTO mes_purchase_order (erp_id, fentry_id, po_no, document_status, material_id, material_code, material_name, order_amount, complete_amount, approve_date, erp_modify_date, plan_delivery_date, order_status, unit_id, stock_unit_id, price_unit_id, aux_prop_id, src_bill_no, purchase_org_id, tond_base, supplier_id, create_time,update_time) VALUES + INSERT INTO mes_purchase_order (erp_id, fentry_id, po_no, document_status, material_id, material_code, material_name, order_amount, complete_amount, approve_date, erp_modify_date, plan_delivery_date, order_status, unit_id, stock_unit_id, price_unit_id, aux_prop_id, specification_parameter, src_bill_no, purchase_org_id, tond_base, supplier_id, create_time,update_time) VALUES - (#{item.erpId}, #{item.fentryId}, #{item.poNo},#{item.documentStatus}, #{item.materialId}, #{item.materialCode}, #{item.materialName}, #{item.orderAmount}, #{item.completeAmount}, #{item.approveDate}, #{item.erpModifyDate}, #{item.planDeliveryDate}, #{item.orderStatus}, #{item.unitId}, #{item.stockUnitId}, #{item.priceUnitId}, #{item.auxPropId}, #{item.srcBillNo}, #{item.purchaseOrgId}, #{item.tondBase}, #{item.supplierId}, #{item.createTime},#{item.updateTime}) + (#{item.erpId}, #{item.fentryId}, #{item.poNo},#{item.documentStatus}, #{item.materialId}, #{item.materialCode}, #{item.materialName}, #{item.orderAmount}, #{item.completeAmount}, #{item.approveDate}, #{item.erpModifyDate}, #{item.planDeliveryDate}, #{item.orderStatus}, #{item.unitId}, #{item.stockUnitId}, #{item.priceUnitId}, #{item.auxPropId}, #{specificationParameter},#{item.srcBillNo}, #{item.purchaseOrgId}, #{item.tondBase}, #{item.supplierId}, #{item.createTime},#{item.updateTime}) diff --git a/hw-modules/hw-job/pom.xml b/hw-modules/hw-job/pom.xml index 27ee793..813427e 100644 --- a/hw-modules/hw-job/pom.xml +++ b/hw-modules/hw-job/pom.xml @@ -96,6 +96,13 @@ compile + + com.hw + hw-api-wms + 3.6.3 + compile + + diff --git a/hw-modules/hw-job/src/main/java/com/hw/job/task/RyTask.java b/hw-modules/hw-job/src/main/java/com/hw/job/task/RyTask.java index b9706e5..bdf0e75 100644 --- a/hw-modules/hw-job/src/main/java/com/hw/job/task/RyTask.java +++ b/hw-modules/hw-job/src/main/java/com/hw/job/task/RyTask.java @@ -5,6 +5,7 @@ import com.hw.dms.api.RemoteDmsService; import com.hw.ems.api.RemoteEmsService; import com.hw.jindie.api.RemoteJindieService; import com.hw.jindie.api.domain.vo.ErpSyncInfoVo; +import com.hw.wms.api.RemoteWmsService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import com.hw.common.core.utils.StringUtils; @@ -23,6 +24,10 @@ public class RyTask private RemoteDmsService remoteDmsService; @Autowired private RemoteJindieService remoteJindieService; + @Autowired + private RemoteWmsService remoteWmsService; + + public void ryMultipleParams(String s, Boolean b, Long l, Double d, Integer i) { System.out.println(StringUtils.format("执行多参方法: 字符串类型{},布尔类型{},长整型{},浮点型{},整形{}", s, b, l, d, i)); @@ -102,4 +107,8 @@ public class RyTask remoteJindieService.syncPurchaseOrderFromErp(erpSyncInfoVo,SecurityConstants.INNER); } + public void syncInventoryInformationToERP(){ + System.out.println("++定时同步入库信息给ERP++ErpPurchaseOrder"); + remoteWmsService.synchronizeInventoryInformationToERP(SecurityConstants.INNER); + } } diff --git a/hw-modules/hw-mes/src/main/resources/mapper/mes/MesPurchaseOrderMapper.xml b/hw-modules/hw-mes/src/main/resources/mapper/mes/MesPurchaseOrderMapper.xml index bb13287..839170e 100644 --- a/hw-modules/hw-mes/src/main/resources/mapper/mes/MesPurchaseOrderMapper.xml +++ b/hw-modules/hw-mes/src/main/resources/mapper/mes/MesPurchaseOrderMapper.xml @@ -36,6 +36,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -65,7 +66,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select purchase_order_id, erp_id, fentry_id, po_no, document_status, material_id, material_code, material_name, order_amount, complete_amount, approve_date, erp_modify_date, plan_delivery_date, begin_date, end_date, order_status, complete_date, is_flag, unit_id, stock_unit_id, price_unit_id, aux_prop_id, src_bill_no, purchase_org_id, tond_base, supplier_id, remark, create_by, create_time, update_by, update_time from mes_purchase_order + select purchase_order_id, erp_id, fentry_id, po_no, document_status, material_id, material_code, material_name, order_amount, complete_amount, approve_date, erp_modify_date, plan_delivery_date, begin_date, end_date, order_status, complete_date, is_flag, unit_id, stock_unit_id, price_unit_id, aux_prop_id, specification_parameter, src_bill_no, purchase_org_id, tond_base, supplier_id, remark, create_by, create_time, update_by, update_time from mes_purchase_order + diff --git a/pom.xml b/pom.xml index 67c133b..5cca1f6 100644 --- a/pom.xml +++ b/pom.xml @@ -240,7 +240,12 @@ hw-api-dms ${hw.version} - + + + com.hw + hw-api-wms + ${hw.version} +