From 5a8a8e3a7cbcc4872642ec36c3a4af30f3cf9d77 Mon Sep 17 00:00:00 2001 From: cuilei <ray_tsu1@163.com> Date: 星期五, 15 八月 2025 16:16:34 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- src/main/java/org/jeecg/modules/lsw/enums/MaterialCategoryEnum.java | 10 + db/双林新火炬MES数据库设计.pdma.json | 42 ++-- src/main/java/org/jeecg/modules/lsw/entity/LswMaterial.java | 60 ++--- src/main/java/org/jeecg/modules/base/entity/Factory.java | 5 src/main/java/org/jeecg/modules/base/enums/ProductionTypeEnum.java | 21 ++ src/main/java/org/jeecg/modules/mes/job/ProductionOrderSyncCreationJob.java | 10 + src/main/java/org/jeecg/modules/lsw/controller/LswMaterialController.java | 138 +++---------- src/main/java/org/jeecg/modules/lsw/service/ILswMaterialService.java | 57 ++--- src/main/java/org/jeecg/modules/wms/service/WMSWebService.java | 13 + src/main/java/org/jeecg/modules/wms/controller/WMSTestController.java | 14 + src/main/java/org/jeecg/modules/lsw/service/impl/LswMaterialServiceImpl.java | 168 +++++++++------- src/main/java/org/jeecg/modules/mes/job/ProductionOrderSyncUpdateJob.java | 9 src/main/java/org/jeecg/modules/wms/service/impl/ReceiveWMSScanItemListServiceImpl.java | 2 src/main/java/org/jeecg/modules/base/model/FactoryTreeModel.java | 3 14 files changed, 283 insertions(+), 269 deletions(-) diff --git "a/db/\345\217\214\346\236\227\346\226\260\347\201\253\347\202\254MES\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241.pdma.json" "b/db/\345\217\214\346\236\227\346\226\260\347\201\253\347\202\254MES\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241.pdma.json" index b9447c3..18fd831 100644 --- "a/db/\345\217\214\346\236\227\346\226\260\347\201\253\347\202\254MES\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241.pdma.json" +++ "b/db/\345\217\214\346\236\227\346\226\260\347\201\253\347\202\254MES\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241.pdma.json" @@ -2,7 +2,7 @@ "name": "鍙屾灄鏂扮伀鐐琈ES鏁版嵁搴撹璁�", "describe": "鎻忚堪鍙岃柂鏂扮伀鐐琈ES鏁版嵁搴撹璁¤鎯�", "avatar": "", - "version": "4.9.4", + "version": "4.9.2", "createdTime": "2025-3-10 16:38:19", "updatedTime": "2025-8-15 14:58:22", "dbConns": [], @@ -632,7 +632,7 @@ "#DDE5FF" ], "DDLToggleCase": "L", - "menuWidth": "309px" + "menuWidth": "364px" }, "entities": [ { @@ -61180,7 +61180,7 @@ "codeRoot": "" } }, - "defKey": "lsw_鈥媘aterial", + "defKey": "lsw_material", "defName": "绾胯竟搴撶墿鏂欎俊鎭�", "comment": "", "properties": { @@ -61487,24 +61487,6 @@ "baseType": "FC9790A7-36B8-4A48-8F9A-BC1042BCFE64" }, { - "defKey": "material_model", - "defName": "鐗╂枡鍨嬪彿", - "comment": "", - "type": "", - "len": "", - "scale": "", - "primaryKey": false, - "notNull": false, - "autoIncrement": false, - "defaultValue": "", - "hideInGraph": false, - "refDict": "", - "baseType": "FC9790A7-36B8-4A48-8F9A-BC1042BCFE64", - "extProps": {}, - "domain": "54611CCC-CA4B-42E1-9F32-4944C85B85A6", - "id": "C2AF21CA-2BB0-4F88-9E66-F216401711A0" - }, - { "defKey": "material_category", "defName": "鐗╂枡绫诲瀷", "comment": "鎴愬搧/澶栨硶鍏�/鍐呮硶鍏�/姣涘澂/閰嶄欢", @@ -61539,6 +61521,24 @@ "extProps": {}, "domain": "54611CCC-CA4B-42E1-9F32-4944C85B85A6", "id": "11AE1590-5695-4C1E-A85F-72AAD8288740" + }, + { + "defKey": "material_status", + "defName": "鐘舵��", + "comment": "鍚敤銆佺鐢�", + "type": "", + "len": "", + "scale": "", + "primaryKey": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "", + "hideInGraph": false, + "refDict": "", + "baseType": "FC9790A7-36B8-4A48-8F9A-BC1042BCFE64", + "extProps": {}, + "domain": "73FD2BAD-2358-4336-B96D-45DC897BD792", + "id": "D9381762-109B-4003-9520-FF30D6D1D2AF" } ], "correlations": [], diff --git a/src/main/java/org/jeecg/modules/base/entity/Factory.java b/src/main/java/org/jeecg/modules/base/entity/Factory.java index b3c8007..fbcb3ef 100644 --- a/src/main/java/org/jeecg/modules/base/entity/Factory.java +++ b/src/main/java/org/jeecg/modules/base/entity/Factory.java @@ -94,4 +94,9 @@ @Excel(name = "澶囨敞", width = 15) @ApiModelProperty(value = "澶囨敞") private String remark; + + /**浜х嚎绫诲瀷*/ + @Excel(name = "浜х嚎绫诲瀷", width = 15) + @ApiModelProperty(value = "浜х嚎绫诲瀷") + private String productionType; } diff --git a/src/main/java/org/jeecg/modules/base/enums/ProductionTypeEnum.java b/src/main/java/org/jeecg/modules/base/enums/ProductionTypeEnum.java new file mode 100644 index 0000000..6ec4ff1 --- /dev/null +++ b/src/main/java/org/jeecg/modules/base/enums/ProductionTypeEnum.java @@ -0,0 +1,21 @@ +package org.jeecg.modules.base.enums; + + +public enum ProductionTypeEnum { + /** + * 瑁呴厤 + */ + ASSEMBLE, + /** + * 鍐呮硶鍏� + */ + INNERFLANGE, + /** + * 澶栨硶鍏� + */ + OUTERFLANGE, + /** + * 鐑鐞� + */ + HEATTREATMENT +} diff --git a/src/main/java/org/jeecg/modules/base/model/FactoryTreeModel.java b/src/main/java/org/jeecg/modules/base/model/FactoryTreeModel.java index 2adb268..53c6621 100644 --- a/src/main/java/org/jeecg/modules/base/model/FactoryTreeModel.java +++ b/src/main/java/org/jeecg/modules/base/model/FactoryTreeModel.java @@ -74,6 +74,8 @@ private String mdcFlag; + private String productionType; + private List<FactoryTreeModel> children = new ArrayList<>(); public FactoryTreeModel() { @@ -103,5 +105,6 @@ this.updateTime = factory.getUpdateTime(); this.mdcFlag = factory.getMdcFlag(); this.factoryCategory = factory.getFactoryCategory(); + this.productionType = factory.getProductionType(); } } diff --git a/src/main/java/org/jeecg/modules/lsw/controller/LswMaterialController.java b/src/main/java/org/jeecg/modules/lsw/controller/LswMaterialController.java index 3f0c60a..25b8af6 100644 --- a/src/main/java/org/jeecg/modules/lsw/controller/LswMaterialController.java +++ b/src/main/java/org/jeecg/modules/lsw/controller/LswMaterialController.java @@ -10,6 +10,8 @@ import org.apache.shiro.SecurityUtils; import org.jeecg.common.api.vo.Result; import org.jeecg.common.aspect.annotation.AutoLog; +import org.jeecg.common.constant.CommonConstant; +import org.jeecg.common.exception.JeecgBootException; import org.jeecg.common.system.query.QueryGenerator; import org.jeecg.common.system.vo.LoginUser; import org.jeecg.common.util.oConvertUtils; @@ -20,21 +22,15 @@ import org.jeecg.modules.lsw.service.ILswMaterialInventoryService; import org.jeecg.modules.lsw.service.ILswMaterialService; import org.jeecg.modules.lsw.vo.LswMaterialPage; -import org.jeecgframework.poi.excel.ExcelImportUtil; import org.jeecgframework.poi.excel.def.NormalExcelConstants; import org.jeecgframework.poi.excel.entity.ExportParams; -import org.jeecgframework.poi.excel.entity.ImportParams; import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; -import org.springframework.web.multipart.MultipartFile; -import org.springframework.web.multipart.MultipartHttpServletRequest; import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -48,7 +44,7 @@ */ @Api(tags = "绾胯竟搴撶墿鏂欎俊鎭�") @RestController -@RequestMapping("/lswmaterial/lswMaterial") +@RequestMapping("/lsw/lswMaterial") @Slf4j public class LswMaterialController { @Autowired @@ -67,7 +63,6 @@ * @param req * @return */ - //@AutoLog(value = "绾胯竟搴撶墿鏂欎俊鎭�-鍒嗛〉鍒楄〃鏌ヨ") @ApiOperation(value = "绾胯竟搴撶墿鏂欎俊鎭�-鍒嗛〉鍒楄〃鏌ヨ", notes = "绾胯竟搴撶墿鏂欎俊鎭�-鍒嗛〉鍒楄〃鏌ヨ") @GetMapping(value = "/list") public Result<IPage<LswMaterial>> queryPageList(LswMaterial lswMaterial, @@ -75,77 +70,55 @@ @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) { QueryWrapper<LswMaterial> queryWrapper = QueryGenerator.initQueryWrapper(lswMaterial, req.getParameterMap()); - Page<LswMaterial> page = new Page<LswMaterial>(pageNo, pageSize); + if (lswMaterial.isMaterialCategoryNull()) { + queryWrapper.isNull("material_category"); + } + Page<LswMaterial> page = new Page<>(pageNo, pageSize); IPage<LswMaterial> pageList = lswMaterialService.page(page, queryWrapper); return Result.OK(pageList); } /** - * 娣诲姞 - * - * @param lswMaterialPage - * @return - */ - @AutoLog(value = "绾胯竟搴撶墿鏂欎俊鎭�-娣诲姞") - @ApiOperation(value = "绾胯竟搴撶墿鏂欎俊鎭�-娣诲姞", notes = "绾胯竟搴撶墿鏂欎俊鎭�-娣诲姞") - //@RequiresPermissions("org.jeecg.modules:lsw_material:add") - @PostMapping(value = "/add") - public Result<String> add(@RequestBody LswMaterialPage lswMaterialPage) { - LswMaterial lswMaterial = new LswMaterial(); - BeanUtils.copyProperties(lswMaterialPage, lswMaterial); - lswMaterialService.saveMain(lswMaterial, lswMaterialPage.getLswMaterialInventoryList()); - return Result.OK("娣诲姞鎴愬姛锛�"); - } - - /** * 缂栬緫 * - * @param lswMaterialPage + * @param lswMaterial * @return */ @AutoLog(value = "绾胯竟搴撶墿鏂欎俊鎭�-缂栬緫") @ApiOperation(value = "绾胯竟搴撶墿鏂欎俊鎭�-缂栬緫", notes = "绾胯竟搴撶墿鏂欎俊鎭�-缂栬緫") - //@RequiresPermissions("org.jeecg.modules:lsw_material:edit") @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST}) - public Result<String> edit(@RequestBody LswMaterialPage lswMaterialPage) { - LswMaterial lswMaterial = new LswMaterial(); - BeanUtils.copyProperties(lswMaterialPage, lswMaterial); - LswMaterial lswMaterialEntity = lswMaterialService.getById(lswMaterial.getId()); - if (lswMaterialEntity == null) { - return Result.error("鏈壘鍒板搴旀暟鎹�"); + public Result<String> edit(@RequestBody LswMaterial lswMaterial) { + boolean b = lswMaterialService.editMaterial(lswMaterial); + if (!b) { + return Result.error("缂栬緫澶辫触"); } - lswMaterialService.updateMain(lswMaterial, lswMaterialPage.getLswMaterialInventoryList()); return Result.OK("缂栬緫鎴愬姛!"); } - /** - * 閫氳繃id鍒犻櫎 - * - * @param id - * @return - */ - @AutoLog(value = "绾胯竟搴撶墿鏂欎俊鎭�-閫氳繃id鍒犻櫎") - @ApiOperation(value = "绾胯竟搴撶墿鏂欎俊鎭�-閫氳繃id鍒犻櫎", notes = "绾胯竟搴撶墿鏂欎俊鎭�-閫氳繃id鍒犻櫎") - //@RequiresPermissions("org.jeecg.modules:lsw_material:delete") - @DeleteMapping(value = "/delete") - public Result<String> delete(@RequestParam(name = "id", required = true) String id) { - lswMaterialService.delMain(id); - return Result.OK("鍒犻櫎鎴愬姛!"); + @AutoLog(value = "绾胯竟搴撶墿鏂欎俊鎭�-鍚敤") + @ApiOperation(value = "绾胯竟搴撶墿鏂欎俊鎭�-鍚敤", notes = "绾胯竟搴撶墿鏂欎俊鎭�-鍚敤") + @GetMapping("/active") + public Result<?> active(@RequestParam("id") String id) { + LswMaterial entity = lswMaterialService.getById(id); + if (entity == null) { + return Result.error("鏁版嵁涓嶅瓨鍦�"); + } + entity.setMaterialStatus(CommonConstant.STATUS_1); + lswMaterialService.updateById(entity); + return Result.OK("鎿嶄綔鎴愬姛"); } - /** - * 鎵归噺鍒犻櫎 - * - * @param ids - * @return - */ - @AutoLog(value = "绾胯竟搴撶墿鏂欎俊鎭�-鎵归噺鍒犻櫎") - @ApiOperation(value = "绾胯竟搴撶墿鏂欎俊鎭�-鎵归噺鍒犻櫎", notes = "绾胯竟搴撶墿鏂欎俊鎭�-鎵归噺鍒犻櫎") - //@RequiresPermissions("org.jeecg.modules:lsw_material:deleteBatch") - @DeleteMapping(value = "/deleteBatch") - public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) { - this.lswMaterialService.delBatchMain(Arrays.asList(ids.split(","))); - return Result.OK("鎵归噺鍒犻櫎鎴愬姛锛�"); + @AutoLog(value = "绾胯竟搴撶墿鏂欎俊鎭�-绂佺敤") + @ApiOperation(value = "绾胯竟搴撶墿鏂欎俊鎭�-绂佺敤", notes = "绾胯竟搴撶墿鏂欎俊鎭�-绂佺敤") + @GetMapping("/inactive") + public Result<?> inactive(@RequestParam("id") String id) { + LswMaterial entity = lswMaterialService.getById(id); + if (entity == null) { + return Result.error("鏁版嵁涓嶅瓨鍦�"); + } + entity.setMaterialStatus(CommonConstant.STATUS_0); + lswMaterialService.updateById(entity); + return Result.OK("鎿嶄綔鎴愬姛"); } /** @@ -178,7 +151,7 @@ public Result<List<LswMaterialInventory>> queryLswMaterialInventoryListByMainId(@RequestParam(name = "id", required = true) String id) { List<LswMaterialInventory> lswMaterialInventoryList = lswMaterialInventoryService.selectByMainId(id); for (LswMaterialInventory lswMaterialInventory : lswMaterialInventoryList) { - if(StringUtils.isNotEmpty(lswMaterialInventory.getWarehouseId())){ + if (StringUtils.isNotEmpty(lswMaterialInventory.getWarehouseId())) { String warehouseId = lswMaterialInventory.getWarehouseId(); LineSideWarehouse warehouse = lineSideWarehouseService.getById(warehouseId); lswMaterialInventory.setWarehouseName(warehouse.getWarehouseName()); @@ -226,47 +199,6 @@ mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("绾胯竟搴撶墿鏂欎俊鎭暟鎹�", "瀵煎嚭浜�:" + sysUser.getRealname(), "绾胯竟搴撶墿鏂欎俊鎭�")); mv.addObject(NormalExcelConstants.DATA_LIST, pageList); return mv; - } - - /** - * 閫氳繃excel瀵煎叆鏁版嵁 - * - * @param request - * @param response - * @return - */ - //@RequiresPermissions("org.jeecg.modules:lsw_material:importExcel") - @RequestMapping(value = "/importExcel", method = RequestMethod.POST) - public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { - MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; - Map<String, MultipartFile> fileMap = multipartRequest.getFileMap(); - for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) { - // 鑾峰彇涓婁紶鏂囦欢瀵硅薄 - MultipartFile file = entity.getValue(); - ImportParams params = new ImportParams(); - params.setTitleRows(2); - params.setHeadRows(1); - params.setNeedSave(true); - try { - List<LswMaterialPage> list = ExcelImportUtil.importExcel(file.getInputStream(), LswMaterialPage.class, params); - for (LswMaterialPage page : list) { - LswMaterial po = new LswMaterial(); - BeanUtils.copyProperties(page, po); - lswMaterialService.saveMain(po, page.getLswMaterialInventoryList()); - } - return Result.OK("鏂囦欢瀵煎叆鎴愬姛锛佹暟鎹鏁�:" + list.size()); - } catch (Exception e) { - log.error(e.getMessage(), e); - return Result.error("鏂囦欢瀵煎叆澶辫触:" + e.getMessage()); - } finally { - try { - file.getInputStream().close(); - } catch (IOException e) { - e.printStackTrace(); - } - } - } - return Result.OK("鏂囦欢瀵煎叆澶辫触锛�"); } @GetMapping(value = "/searchlikeQuery") diff --git a/src/main/java/org/jeecg/modules/lsw/entity/LswMaterial.java b/src/main/java/org/jeecg/modules/lsw/entity/LswMaterial.java index b988d39..cf383c6 100644 --- a/src/main/java/org/jeecg/modules/lsw/entity/LswMaterial.java +++ b/src/main/java/org/jeecg/modules/lsw/entity/LswMaterial.java @@ -1,9 +1,6 @@ package org.jeecg.modules.lsw.entity; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableLogic; -import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.*; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -18,62 +15,57 @@ /** * @Description: 绾胯竟搴撶墿鏂欎俊鎭� * @Author: jeecg-boot - * @Date: 2025-06-30 + * @Date: 2025-06-30 * @Version: V1.0 */ -@ApiModel(value="lsw_material瀵硅薄", description="绾胯竟搴撶墿鏂欎俊鎭�") +@ApiModel(value = "lsw_material瀵硅薄", description = "绾胯竟搴撶墿鏂欎俊鎭�") @Data @TableName("lsw_material") public class LswMaterial implements Serializable { private static final long serialVersionUID = 1L; - /**涓婚敭*/ - @TableId(type = IdType.ASSIGN_ID) + /**涓婚敭*/ + @TableId(type = IdType.ASSIGN_ID) @ApiModelProperty(value = "涓婚敭") private String id; - /**鍒涘缓浜�*/ + /**鍒涘缓浜�*/ @ApiModelProperty(value = "鍒涘缓浜�") private String createBy; - /**鍒涘缓鏃ユ湡*/ - @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") - @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + /**鍒涘缓鏃ユ湡*/ + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @ApiModelProperty(value = "鍒涘缓鏃ユ湡") private Date createTime; - /**鏇存柊浜�*/ + /**鏇存柊浜�*/ @ApiModelProperty(value = "鏇存柊浜�") private String updateBy; - /**鏇存柊鏃ユ湡*/ - @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") - @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + /**鏇存柊鏃ユ湡*/ + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @ApiModelProperty(value = "鏇存柊鏃ユ湡") private Date updateTime; - /**鎵�灞為儴闂�*/ - @ApiModelProperty(value = "鎵�灞為儴闂�") - private String sysOrgCode; - /**鍒犻櫎鏍囪*/ - @Excel(name = "鍒犻櫎鏍囪", width = 15) + /**鍒犻櫎鏍囪*/ @ApiModelProperty(value = "鍒犻櫎鏍囪") @TableLogic private Integer delFlag; - /**鐗╂枡缂栫爜*/ - @Excel(name = "鐗╂枡缂栫爜", width = 15) + /**鐗╂枡缂栫爜*/ @ApiModelProperty(value = "鐗╂枡缂栫爜") private String materialNumber; - /**鐗╂枡鍚嶇О*/ - @Excel(name = "鐗╂枡鍚嶇О", width = 15) + /**鐗╂枡鍚嶇О*/ @ApiModelProperty(value = "鐗╂枡鍚嶇О") private String materialName; - /**鐗╂枡鍨嬪彿*/ - @Excel(name = "鐗╂枡鍨嬪彿", width = 15) - @ApiModelProperty(value = "鐗╂枡鍨嬪彿") - private String materialModel; - /**鐗╂枡绫诲瀷*/ - @Excel(name = "鐗╂枡绫诲瀷", width = 15, dicCode = "material_category") + /**鐗╂枡绫诲瀷*/ @Dict(dicCode = "material_category") @ApiModelProperty(value = "鐗╂枡绫诲瀷") private String materialCategory; - /**鍗曚綅*/ - @Excel(name = "鍗曚綅", width = 15) - @ApiModelProperty(value = "鍗曚綅") + /**鍩烘湰璁¢噺鍗曚綅*/ + @ApiModelProperty(value = "鍩烘湰璁¢噺鍗曚綅") private String materialUnit; + /**鐗╂枡鐘舵��*/ + @ApiModelProperty(value = "鐗╂枡鐘舵��") + private String materialStatus; + + /** 鐗╂枡绫诲瀷鏄惁涓虹┖ */ + @TableField(exist = false) + private boolean materialCategoryNull; } diff --git a/src/main/java/org/jeecg/modules/lsw/enums/MaterialCategoryEnum.java b/src/main/java/org/jeecg/modules/lsw/enums/MaterialCategoryEnum.java new file mode 100644 index 0000000..4d49942 --- /dev/null +++ b/src/main/java/org/jeecg/modules/lsw/enums/MaterialCategoryEnum.java @@ -0,0 +1,10 @@ +package org.jeecg.modules.lsw.enums; + +public enum MaterialCategoryEnum { + FINISHED_PRODUCT, //鎴愬搧 + OUTER_FLANGE, //澶栨硶鍏� + INNER_FLANGE, //鍐呮硶鍏� + COMPONENTS, //閰嶄欢 + BLANK, //姣涘澂 + ; +} diff --git a/src/main/java/org/jeecg/modules/lsw/service/ILswMaterialService.java b/src/main/java/org/jeecg/modules/lsw/service/ILswMaterialService.java index ce94a36..ab49739 100644 --- a/src/main/java/org/jeecg/modules/lsw/service/ILswMaterialService.java +++ b/src/main/java/org/jeecg/modules/lsw/service/ILswMaterialService.java @@ -3,11 +3,10 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.IService; import org.jeecg.modules.lsw.entity.LswMaterial; -import org.jeecg.modules.lsw.entity.LswMaterialInventory; +import org.jeecg.modules.mes.entity.MesProductionOrder; +import org.jeecg.modules.sap.dto.OrderBomDTO; import javax.servlet.http.HttpServletRequest; -import java.io.Serializable; -import java.util.Collection; import java.util.List; import java.util.Map; @@ -19,36 +18,28 @@ */ public interface ILswMaterialService extends IService<LswMaterial> { - /** - * 娣诲姞涓�瀵瑰 - * - * @param lswMaterial - * @param lswMaterialInventoryList - */ - public void saveMain(LswMaterial lswMaterial,List<LswMaterialInventory> lswMaterialInventoryList) ; - - /** - * 淇敼涓�瀵瑰 - * - * @param lswMaterial - * @param lswMaterialInventoryList - */ - public void updateMain(LswMaterial lswMaterial,List<LswMaterialInventory> lswMaterialInventoryList); - - /** - * 鍒犻櫎涓�瀵瑰 - * - * @param id - */ - public void delMain (String id); - - /** - * 鎵归噺鍒犻櫎涓�瀵瑰 - * - * @param idList - */ - public void delBatchMain (Collection<? extends Serializable> idList); IPage<Map<String, Object>> getLswMaterialListData(Integer pageNo, Integer pageSize, HttpServletRequest req); - + + /** + * 缂栬緫鐗╂枡淇℃伅 + * @param lswMaterial + * @return + */ + boolean editMaterial(LswMaterial lswMaterial); + + /** + * 鏍规嵁鐗╂枡缂栧彿鏌ヨ + * @param materialNumber + * @return + */ + LswMaterial queryByMaterialNumber(String materialNumber); + + /** + * 鎵归噺淇濆瓨鐗╂枡鍩烘湰淇℃伅 + * @param orderMap + * @param orderBomDTOList + * @return + */ + boolean saveOrUpdateMaterial(Map<String, MesProductionOrder> orderMap, List<OrderBomDTO> orderBomDTOList); } diff --git a/src/main/java/org/jeecg/modules/lsw/service/impl/LswMaterialServiceImpl.java b/src/main/java/org/jeecg/modules/lsw/service/impl/LswMaterialServiceImpl.java index 494f85f..3590878 100644 --- a/src/main/java/org/jeecg/modules/lsw/service/impl/LswMaterialServiceImpl.java +++ b/src/main/java/org/jeecg/modules/lsw/service/impl/LswMaterialServiceImpl.java @@ -1,106 +1,126 @@ package org.jeecg.modules.lsw.service.impl; +import cn.hutool.core.collection.CollectionUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.apache.commons.lang.StringUtils; +import org.jeecg.common.constant.CommonConstant; +import org.jeecg.common.exception.JeecgBootException; import org.jeecg.modules.lsw.entity.LswMaterial; import org.jeecg.modules.lsw.entity.LswMaterialInventory; import org.jeecg.modules.lsw.mapper.LswMaterialInventoryMapper; import org.jeecg.modules.lsw.mapper.LswMaterialMapper; import org.jeecg.modules.lsw.service.ILswMaterialService; +import org.jeecg.modules.mes.entity.MesProductionOrder; +import org.jeecg.modules.pms.entity.PmsProcessBillMaterials; +import org.jeecg.modules.sap.dto.OrderBomDTO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.servlet.http.HttpServletRequest; import java.io.Serializable; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; +import java.util.stream.Collectors; /** * @Description: 绾胯竟搴撶墿鏂欎俊鎭� * @Author: jeecg-boot - * @Date: 2025-06-30 + * @Date: 2025-06-30 * @Version: V1.0 */ @Service public class LswMaterialServiceImpl extends ServiceImpl<LswMaterialMapper, LswMaterial> implements ILswMaterialService { - @Autowired - private LswMaterialMapper lswMaterialMapper; - @Autowired - private LswMaterialInventoryMapper lswMaterialInventoryMapper; - - @Override - @Transactional(rollbackFor = Exception.class) - public void saveMain(LswMaterial lswMaterial, List<LswMaterialInventory> lswMaterialInventoryList) { - lswMaterialMapper.insert(lswMaterial); - if(lswMaterialInventoryList!=null && lswMaterialInventoryList.size()>0) { - for(LswMaterialInventory entity:lswMaterialInventoryList) { - //澶栭敭璁剧疆 - entity.setMaterialId(lswMaterial.getId()); - lswMaterialInventoryMapper.insert(entity); - } - } - } + @Autowired + private LswMaterialMapper lswMaterialMapper; + @Autowired + private LswMaterialInventoryMapper lswMaterialInventoryMapper; - @Override - @Transactional(rollbackFor = Exception.class) - public void updateMain(LswMaterial lswMaterial,List<LswMaterialInventory> lswMaterialInventoryList) { - lswMaterialMapper.updateById(lswMaterial); - - //1.鍏堝垹闄ゅ瓙琛ㄦ暟鎹� - lswMaterialInventoryMapper.deleteByMainId(lswMaterial.getId()); - - //2.瀛愯〃鏁版嵁閲嶆柊鎻掑叆 - if(lswMaterialInventoryList!=null && lswMaterialInventoryList.size()>0) { - for(LswMaterialInventory entity:lswMaterialInventoryList) { - //澶栭敭璁剧疆 - entity.setMaterialId(lswMaterial.getId()); - lswMaterialInventoryMapper.insert(entity); - } - } - } + @Override + public IPage<Map<String, Object>> getLswMaterialListData(Integer pageNo, Integer pageSize, HttpServletRequest req) { + IPage<Map> pageData = new Page<Map>(pageNo, pageSize); + Map<String, String> paramMap = new HashMap<String, String>(); + Map<String, String[]> parameterMap = req.getParameterMap(); + if (null != parameterMap) { + if (parameterMap.containsKey("materialNumber") && StringUtils.isNotBlank(parameterMap.get("materialNumber")[0])) { + paramMap.put("materialNumber", parameterMap.get("materialNumber")[0]); + } + if (parameterMap.containsKey("materialName") && StringUtils.isNotBlank(parameterMap.get("materialName")[0])) { + paramMap.put("materialName", parameterMap.get("materialName")[0].trim()); + } + if (parameterMap.containsKey("materialModel") && StringUtils.isNotBlank(parameterMap.get("materialModel")[0])) { + paramMap.put("materialModel", parameterMap.get("materialModel")[0].trim()); + } + if (parameterMap.containsKey("materialCategory") && StringUtils.isNotBlank(parameterMap.get("materialCategory")[0])) { + paramMap.put("materialCategory", parameterMap.get("materialCategory")[0].trim()); + } + } + return super.getBaseMapper().getLswMaterialListData(pageData, paramMap); + } - @Override - @Transactional(rollbackFor = Exception.class) - public void delMain(String id) { - lswMaterialInventoryMapper.deleteByMainId(id); - lswMaterialMapper.deleteById(id); - } + @Override + @Transactional(rollbackFor = Exception.class) + public boolean editMaterial(LswMaterial lswMaterial) { + LswMaterial entity = this.getBaseMapper().selectById(lswMaterial.getId()); + if (entity == null) { + throw new JeecgBootException("瑕佺紪杈戠殑鏁版嵁涓嶅瓨鍦紒"); + } + entity.setMaterialCategory(lswMaterial.getMaterialCategory()); + this.updateById(entity); + return true; + } - @Override - @Transactional(rollbackFor = Exception.class) - public void delBatchMain(Collection<? extends Serializable> idList) { - for(Serializable id:idList) { - lswMaterialInventoryMapper.deleteByMainId(id.toString()); - lswMaterialMapper.deleteById(id); - } - } + @Override + public LswMaterial queryByMaterialNumber(String materialNumber) { + LambdaQueryWrapper<LswMaterial> queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(LswMaterial::getMaterialNumber, materialNumber); + queryWrapper.eq(LswMaterial::getDelFlag, CommonConstant.DEL_FLAG_0); + List<LswMaterial> list = this.getBaseMapper().selectList(queryWrapper); + if (CollectionUtil.isEmpty(list)) { + return null; + } + return list.get(0); + } - @Override - public IPage<Map<String, Object>> getLswMaterialListData(Integer pageNo, Integer pageSize, HttpServletRequest req) { - IPage<Map> pageData = new Page<Map>(pageNo, pageSize); - Map<String, String> paramMap = new HashMap<String, String>(); - Map<String, String[]> parameterMap = req.getParameterMap(); - if (null != parameterMap) { - if (parameterMap.containsKey("materialNumber") && StringUtils.isNotBlank(parameterMap.get("materialNumber")[0])) { - paramMap.put("materialNumber", parameterMap.get("materialNumber")[0]); - } - if (parameterMap.containsKey("materialName") && StringUtils.isNotBlank(parameterMap.get("materialName")[0])) { - paramMap.put("materialName", parameterMap.get("materialName")[0].trim()); - } - if (parameterMap.containsKey("materialModel") && StringUtils.isNotBlank(parameterMap.get("materialModel")[0])) { - paramMap.put("materialModel", parameterMap.get("materialModel")[0].trim()); - } - if (parameterMap.containsKey("materialCategory") && StringUtils.isNotBlank(parameterMap.get("materialCategory")[0])) { - paramMap.put("materialCategory", parameterMap.get("materialCategory")[0].trim()); - } - } - return super.getBaseMapper().getLswMaterialListData(pageData, paramMap); - } + @Override + @Transactional(rollbackFor = Exception.class) + public boolean saveOrUpdateMaterial(Map<String, MesProductionOrder> orderMap, List<OrderBomDTO> orderBomDTOList) { + Map<String, LswMaterial> addMap = new HashMap<>(); + for (Map.Entry<String, MesProductionOrder> entry : orderMap.entrySet()) { + MesProductionOrder order = entry.getValue(); + LswMaterial material = queryByMaterialNumber(order.getMaterialNumber()); + if (material == null) { + //鏂板鐗╂枡 + material = new LswMaterial(); + material.setMaterialStatus(CommonConstant.STATUS_1); + material.setMaterialNumber(order.getMaterialNumber()); + material.setMaterialName(order.getMaterialName()); + material.setMaterialUnit(order.getProductionUnit()); + material.setDelFlag(CommonConstant.DEL_FLAG_0); + addMap.put(material.getMaterialNumber(), material); + } + } + for (OrderBomDTO bomDTO : orderBomDTOList) { + LswMaterial material = queryByMaterialNumber(bomDTO.getMATNR()); + if (material == null) { + //鏂板鐗╂枡 + material = new LswMaterial(); + material.setMaterialStatus(CommonConstant.STATUS_1); + material.setMaterialNumber(bomDTO.getMATNR()); + material.setMaterialName(bomDTO.getMAKTX()); + material.setMaterialUnit(bomDTO.getMEINS()); + material.setDelFlag(CommonConstant.DEL_FLAG_0); + addMap.put(material.getMaterialNumber(), material); + } + } + if (CollectionUtil.isNotEmpty(addMap)) { + Collection<LswMaterial> addList = addMap.values(); + super.saveBatch(addList); + } + return true; + } } diff --git a/src/main/java/org/jeecg/modules/mes/job/ProductionOrderSyncCreationJob.java b/src/main/java/org/jeecg/modules/mes/job/ProductionOrderSyncCreationJob.java index d81111b..42bd30d 100644 --- a/src/main/java/org/jeecg/modules/mes/job/ProductionOrderSyncCreationJob.java +++ b/src/main/java/org/jeecg/modules/mes/job/ProductionOrderSyncCreationJob.java @@ -1,6 +1,7 @@ package org.jeecg.modules.mes.job; import lombok.extern.slf4j.Slf4j; +import org.jeecg.modules.lsw.service.ILswMaterialService; import org.jeecg.modules.mdc.util.DateUtils; import org.jeecg.modules.mdc.util.ThrowableUtil; import org.jeecg.modules.mes.entity.MesProductionOrder; @@ -87,6 +88,8 @@ private ISysQuartzLogService sysQuartzLogService; @Autowired private IQuartzJobService quartzJobService; + @Autowired + private ILswMaterialService lswMaterialService; @Override public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { @@ -144,12 +147,19 @@ log.error("杩斿洖绫诲瀷閿欒锛� class:{}", result == null ? null : result.getClass()); return; } + //璁㈠崟BOM鏁版嵁澶勭悊 List<OrderBomDTO> orderBomDTOList = (List<OrderBomDTO>) result; b = processBillMaterialsService.saveOrUpdateOrderBom(orderMap, orderBomDTOList); if (!b) { log.error("淇濆瓨璁㈠崟BOM澶辫触锛屾棩鏈燂細{}", LocalDateTime.now()); return; } + //鐗╂枡鏁版嵁澶勭悊 + b = lswMaterialService.saveOrUpdateMaterial(orderMap, orderBomDTOList); + if (!b) { + log.error("淇濆瓨鐗╂枡澶辫触锛屾棩鏈燂細{}", LocalDateTime.now()); + return; + } //璁㈠崟宸ュ簭鍚屾 Map<String, Object> orderProcessMap = orderProcessSync.syncOrderProcess(FACTORY_CODE, orderCodes); if (orderBomMap == null || !SUCCESS_CODE.equals(orderProcessMap.get("ztype"))) { diff --git a/src/main/java/org/jeecg/modules/mes/job/ProductionOrderSyncUpdateJob.java b/src/main/java/org/jeecg/modules/mes/job/ProductionOrderSyncUpdateJob.java index 6a7f780..24ad443 100644 --- a/src/main/java/org/jeecg/modules/mes/job/ProductionOrderSyncUpdateJob.java +++ b/src/main/java/org/jeecg/modules/mes/job/ProductionOrderSyncUpdateJob.java @@ -1,6 +1,7 @@ package org.jeecg.modules.mes.job; import lombok.extern.slf4j.Slf4j; +import org.jeecg.modules.lsw.service.ILswMaterialService; import org.jeecg.modules.mdc.util.DateUtils; import org.jeecg.modules.mdc.util.ThrowableUtil; import org.jeecg.modules.mes.entity.MesProductionOrder; @@ -87,6 +88,8 @@ private ISysQuartzLogService sysQuartzLogService; @Autowired private IQuartzJobService quartzJobService; + @Autowired + private ILswMaterialService lswMaterialService; @Override public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { @@ -150,6 +153,12 @@ log.error("淇濆瓨璁㈠崟BOM澶辫触锛屾棩鏈燂細{}", LocalDateTime.now()); return; } + //鐗╂枡鏁版嵁澶勭悊 + b = lswMaterialService.saveOrUpdateMaterial(orderMap, orderBomDTOList); + if (!b) { + log.error("淇濆瓨鐗╂枡澶辫触锛屾棩鏈燂細{}", LocalDateTime.now()); + return; + } //璁㈠崟宸ュ簭鍚屾 Map<String, Object> orderProcessMap = orderProcessSync.syncOrderProcess(FACTORY_CODE, orderCodes); if (orderBomMap == null || !SUCCESS_CODE.equals(orderProcessMap.get("ztype"))) { diff --git a/src/main/java/org/jeecg/modules/wms/controller/WMSTestController.java b/src/main/java/org/jeecg/modules/wms/controller/WMSTestController.java index 71e1995..5aa73af 100644 --- a/src/main/java/org/jeecg/modules/wms/controller/WMSTestController.java +++ b/src/main/java/org/jeecg/modules/wms/controller/WMSTestController.java @@ -8,6 +8,7 @@ import org.jeecg.modules.wms.dto.ReceiveMESScanItemListResponse; import org.jeecg.modules.wms.request.ReceiveMESScanItemList; import org.jeecg.modules.wms.service.ReceiveWMSScanItemListService; +import org.jeecg.modules.wms.service.WMSWebService; import org.springframework.beans.factory.annotation.Value; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; @@ -20,8 +21,6 @@ public class WMSTestController { @Value("${webservice.url}") private String url; - @Value("${webservice.namespace}") - private String namespace; @ApiOperation(value = "WMS闆嗘垚娴嬭瘯-鎺ユ敹WMS绉诲簱缁撴灉", notes = "WMS闆嗘垚娴嬭瘯-鎺ユ敹WMS绉诲簱缁撴灉") @PostMapping("/testReceiveWMSScanItemList") @@ -34,4 +33,15 @@ ReceiveMESScanItemListResponse response = service.receiveWMSScanItemList(request); return Result.ok(response); } + + @ApiOperation(value = "WMS闆嗘垚娴嬭瘯-HelloWord娴嬭瘯", notes = "WMS闆嗘垚娴嬭瘯-HelloWord娴嬭瘯") + @PostMapping("/testHelloWorld") + public Result<?> testHelloWorld() { + JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); + factory.setAddress(url); + factory.setServiceClass(WMSWebService.class); + WMSWebService service = (WMSWebService) factory.create(); + String response = service.helloWorld(); + return Result.ok(response); + } } diff --git a/src/main/java/org/jeecg/modules/wms/service/WMSWebService.java b/src/main/java/org/jeecg/modules/wms/service/WMSWebService.java new file mode 100644 index 0000000..0d1ee5d --- /dev/null +++ b/src/main/java/org/jeecg/modules/wms/service/WMSWebService.java @@ -0,0 +1,13 @@ +package org.jeecg.modules.wms.service; + +import javax.jws.WebMethod; +import javax.jws.WebResult; +import javax.jws.WebService; + +@WebService(name = "WebService", targetNamespace = "http://tempuri.org") +public interface WMSWebService { + + @WebMethod(operationName = "HelloWorld") + @WebResult(name = "HelloWorldResponse") + String helloWorld(); +} diff --git a/src/main/java/org/jeecg/modules/wms/service/impl/ReceiveWMSScanItemListServiceImpl.java b/src/main/java/org/jeecg/modules/wms/service/impl/ReceiveWMSScanItemListServiceImpl.java index f8b405e..12e4d51 100644 --- a/src/main/java/org/jeecg/modules/wms/service/impl/ReceiveWMSScanItemListServiceImpl.java +++ b/src/main/java/org/jeecg/modules/wms/service/impl/ReceiveWMSScanItemListServiceImpl.java @@ -6,13 +6,11 @@ import org.jeecg.modules.wms.dto.ReceiveMESScanItemListResponse; import org.jeecg.modules.wms.request.ReceiveMESScanItemList; import org.jeecg.modules.wms.service.ReceiveWMSScanItemListService; -import org.springframework.stereotype.Service; import javax.jws.WebService; @Slf4j -//@Service @WebService(name = "ReceiveWMSScanItemListService", targetNamespace = "http://xhj008.server.webservice.com", endpointInterface = "org.jeecg.modules.wms.service.ReceiveWMSScanItemListService") public class ReceiveWMSScanItemListServiceImpl implements ReceiveWMSScanItemListService { -- Gitblit v1.9.3