| | |
| | | "avatar": "", |
| | | "version": "4.9.2", |
| | | "createdTime": "2025-3-10 16:38:19", |
| | | "updatedTime": "2025-9-8 15:48:21", |
| | | "updatedTime": "2025-9-9 17:51:22", |
| | | "dbConns": [], |
| | | "profile": { |
| | | "default": { |
| | |
| | | "extProps": {}, |
| | | "domain": "FF4459C5-6B45-4DBF-8FC0-E06239BC05B4", |
| | | "id": "8D7E6299-FC48-42A2-86FD-0AC3B881BB8B" |
| | | }, |
| | | { |
| | | "defKey": "unloading_flag", |
| | | "defName": "䏿æ è®°", |
| | | "comment": "", |
| | | "type": "", |
| | | "len": "", |
| | | "scale": "", |
| | | "primaryKey": false, |
| | | "notNull": false, |
| | | "autoIncrement": false, |
| | | "defaultValue": "", |
| | | "hideInGraph": false, |
| | | "refDict": "", |
| | | "baseType": "FC9790A7-36B8-4A48-8F9A-BC1042BCFE64", |
| | | "extProps": {}, |
| | | "domain": "6F7C1C5C-D159-41E6-BF9D-54DEEFA79AFF", |
| | | "id": "52642C9A-5EA8-4B30-91CB-5B154D75A139" |
| | | } |
| | | ], |
| | | "correlations": [], |
| | |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import liquibase.pro.packaged.G; |
| | | import org.jeecg.common.api.vo.Result; |
| | | import org.jeecg.common.system.query.QueryGenerator; |
| | | import org.jeecg.common.util.oConvertUtils; |
| | | import org.jeecg.modules.cms.entity.CuttingInbound; |
| | | import org.jeecg.modules.cms.entity.CuttingInboundDetail; |
| | | import org.jeecg.modules.cms.entity.CuttingReceive; |
| | | import org.jeecg.modules.cms.entity.CuttingReceiveDetail; |
| | | import org.jeecg.modules.cms.entity.*; |
| | | import org.jeecg.modules.cms.service.ICuttingInventoryService; |
| | | import org.jeecg.modules.cms.service.ICuttingReceiveDetailService; |
| | | import org.jeecg.modules.cms.service.ICuttingReceiveService; |
| | | |
| | |
| | | |
| | | @Autowired |
| | | private ICuttingReceiveDetailService cuttingReceiveDetailService; |
| | | |
| | | /** |
| | | * å页å表æ¥è¯¢ |
| | | * |
| | |
| | | //@RequiresPermissions("org.jeecg.modules:cms_cutting_receive:add") |
| | | @PostMapping(value = "/add") |
| | | public Result<String> add(@RequestBody JSONObject jSONObject) { |
| | | // ä¿åä¸»è¡¨æ°æ® |
| | | CuttingReceive cuttingReceive = jSONObject.toJavaObject(CuttingReceive.class); |
| | | cuttingReceive.setOrderStatus("1"); |
| | | cuttingReceiveService.saveOrUpdate(cuttingReceive); |
| | | //å é¤åå
³èæ°æ® |
| | | |
| | | // å é¤åæå
³èçæç»æ°æ® |
| | | List<CuttingReceiveDetail> cuttingReceiveDetailList = cuttingReceiveDetailService.lambdaQuery().eq(CuttingReceiveDetail::getOrderId, cuttingReceive.getId()).list(); |
| | | cuttingReceiveDetailService.removeBatchByIds(cuttingReceiveDetailList); |
| | | //æ·»å æ°å
³èæ°æ® |
| | | |
| | | // éæ°æ·»å æ°çæç»æ°æ® |
| | | JSONArray jsonArray = jSONObject.getJSONArray("detailData"); |
| | | List<CuttingReceiveDetail> list = jsonArray.toJavaList(CuttingReceiveDetail.class); |
| | | for (int i = 0; i < list.size(); i++) { |
| | |
| | | return Result.ok(list); |
| | | } |
| | | |
| | | /** |
| | | * éæ©åºååå
·çå表 |
| | | * |
| | | * @return |
| | | */ |
| | | @GetMapping("/getInventoryToolList") |
| | | public Result<?> getInventoryToolList(@RequestParam("pageNo") Integer pageNo, |
| | | @RequestParam("pageSize") Integer pageSize, |
| | | @RequestParam Map<String, Object> params) { |
| | | IPage<Map<String, Object>> inventoryTooList = cuttingReceiveService.getInventoryToolList(pageNo, pageSize, params); |
| | | return Result.ok(inventoryTooList); |
| | | } |
| | | } |
| | |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.util.Date; |
| | | import java.math.BigDecimal; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import lombok.Data; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import org.jeecg.common.constant.CommonConstant; |
| | |
| | | @Excel(name = "å½è¿ç¡®è®¤æè§", width = 15) |
| | | @ApiModelProperty(value = "å½è¿ç¡®è®¤æè§") |
| | | private String returnConfirmComment; |
| | | |
| | | } |
| | |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.util.Date; |
| | | import java.math.BigDecimal; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import lombok.Data; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | |
| | | package org.jeecg.modules.cms.mapper; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.jeecg.modules.cms.entity.CuttingReceive; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | |
| | | */ |
| | | public interface CuttingReceiveMapper extends BaseMapper<CuttingReceive> { |
| | | |
| | | IPage<Map<String, Object>> getInventoryToolList(IPage<Map> pageData, Map<String, Object> params); |
| | | } |
| | |
| | | t1.cutting_id cuttingId, |
| | | t1.workpiece_material workpieceMaterial, |
| | | t1.used_life usedLife, |
| | | t2.cutting_code cuttingCode, |
| | | t2.cutting_name cuttingName |
| | | t2.cutting_barcode cuttingCBarcode, |
| | | t2.inventory_status inventoryStatus, |
| | | t2.current_life currentLife, |
| | | t3.cutting_code cuttingCode, |
| | | t3.cutting_name cuttingName |
| | | FROM |
| | | cms_cutting_receive_detail t1 |
| | | LEFT JOIN cms_cutting_tool t2 ON t1.cutting_id = t2.id |
| | | LEFT JOIN cms_cutting_inventory t2 ON t1.inventory_id = t2.id |
| | | LEFT JOIN cms_cutting_tool t3 ON t1.cutting_id = t3.id |
| | | WHERE t1.order_id = #{orderId} |
| | | </select> |
| | | </mapper> |
| | |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="org.jeecg.modules.cms.mapper.CuttingReceiveMapper"> |
| | | |
| | | <select id="getInventoryToolList" parameterType="Map" resultType="Map"> |
| | | SELECT |
| | | t1.cutting_id cuttingId, |
| | | t1.id, |
| | | t1.cutting_barcode cuttingBarcode, |
| | | t1.current_life currentLife, |
| | | t2.cutting_code cuttingCode, |
| | | t2.cutting_name cuttingName, |
| | | t2.cutting_category, |
| | | t3.item_text cuttingCategory |
| | | FROM cms_cutting_inventory t1 |
| | | LEFT JOIN cms_cutting_tool t2 ON t1.cutting_id = t2.id |
| | | LEFT JOIN (select * from v_sys_dict where dict_code = 'cutting_category') t3 on t3.item_value = t2.cutting_category |
| | | WHERE t1.inventory_status = 'æ£å¸¸' |
| | | AND t2.del_flag = 0 |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | |
| | | <select id="getCuttingToolList" parameterType="Map" resultType="Map"> |
| | | SELECT |
| | | t1.id, |
| | | t1.cutting_code cuttingCode, |
| | | t1.cutting_name cuttingName, |
| | | t1.cutting_category, |
| | | t1.store_location storeLocation, |
| | | t1.supplier_id supplierId, |
| | | t1.minimum_package_unit minimumPackageUnit, |
| | | t1.cutting_material cuttingMaterial, |
| | | t1.cutting_model cuttingModel, |
| | | t1.drawing_number drawingNumber, |
| | | t1.inventory_warning inventoryWarning, |
| | | t1.remark remark, |
| | | t2.item_text cuttingCategory |
| | | t1.id, |
| | | t1.cutting_code cuttingCode, |
| | | t1.cutting_name cuttingName, |
| | | t1.cutting_category, |
| | | t1.store_location storeLocation, |
| | | t1.supplier_id supplierId, |
| | | t1.minimum_package_unit minimumPackageUnit, |
| | | t1.cutting_material cuttingMaterial, |
| | | t1.cutting_model cuttingModel, |
| | | t1.drawing_number drawingNumber, |
| | | t1.inventory_warning inventoryWarning, |
| | | t1.remark remark, |
| | | t2.item_text cuttingCategory |
| | | FROM |
| | | cms_cutting_tool t1 |
| | | cms_cutting_tool t1 |
| | | left join (select * from v_sys_dict where dict_code = 'cutting_category') t2 on t2.item_value = t1.cutting_category |
| | | WHERE t1.del_flag = 0 |
| | | <if test="params.cuttingCode != null and params.cuttingCode != ''"> |
| | |
| | | package org.jeecg.modules.cms.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import org.jeecg.modules.cms.entity.CuttingReceive; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @Description: åå
·é¢ç¨å |
| | |
| | | */ |
| | | public interface ICuttingReceiveService extends IService<CuttingReceive> { |
| | | |
| | | IPage<Map<String, Object>> getInventoryToolList(Integer pageNo, Integer pageSize, Map<String, Object> params); |
| | | } |
| | |
| | | package org.jeecg.modules.cms.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import org.jeecg.modules.cms.entity.CuttingReceive; |
| | | import org.jeecg.modules.cms.mapper.CuttingReceiveMapper; |
| | | import org.jeecg.modules.cms.service.ICuttingReceiveService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @Description: åå
·é¢ç¨å |
| | |
| | | @Service |
| | | public class CuttingReceiveServiceImpl extends ServiceImpl<CuttingReceiveMapper, CuttingReceive> implements ICuttingReceiveService { |
| | | |
| | | @Override |
| | | public IPage<Map<String, Object>> getInventoryToolList(Integer pageNo, Integer pageSize, Map<String, Object> params) { |
| | | IPage<Map> pageData = new Page<Map>(pageNo, pageSize); |
| | | return super.getBaseMapper().getInventoryToolList(pageData,params); |
| | | } |
| | | } |
| | |
| | | return Collections.emptyList(); |
| | | } |
| | | |
| | | // @Override |
| | | // public EamEquipment selectByEquipmentCode(String equipmentCode) { |
| | | // if (StringUtils.isBlank(equipmentCode)) { |
| | | // return null; |
| | | // } |
| | | // QueryWrapper<EamEquipment> queryWrapper = new QueryWrapper<>(); |
| | | // //ç¨æ·æ°æ®æé |
| | | // LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | // if (sysUser == null) { |
| | | // return null; |
| | | // } |
| | | // if (StringUtils.isNotBlank(sysUser.getEquipmentIds())) { |
| | | // //éæ©äºè®¾å¤ï¼æ ¹æ®è®¾å¤idè¿æ»¤è®¾å¤ |
| | | // List<String> equipArr = Arrays.asList(sysUser.getEquipmentIds().split(",")); |
| | | // queryWrapper.in("equipment_code", equipArr); |
| | | // } else { |
| | | // //没æéæ©è®¾å¤ï¼æ ¹æ®è½¦é´è¿æ»¤è®¾å¤ |
| | | // queryWrapper.exists("select 1 from mdc_user_production t where t.user_id={0} and t.pro_id=org_id", sysUser.getId()); |
| | | // } |
| | | // queryWrapper.eq("equipment_code", equipmentCode); |
| | | // queryWrapper.eq("del_flag", CommonConstant.DEL_FLAG_0); |
| | | // |
| | | // return eamEquipmentMapper.selectOne(queryWrapper); |
| | | // } |
| | | |
| | | /** |
| | | * |
| | | * @param equipmentCode |
| | | * @return |
| | | */ |
| | | @Override |
| | | public EamEquipment selectByEquipmentCode(String equipmentCode) { |
| | | if (StringUtils.isBlank(equipmentCode)) { |
| | | return null; |
| | | } |
| | | QueryWrapper<EamEquipment> queryWrapper = new QueryWrapper<>(); |
| | | //ç¨æ·æ°æ®æé |
| | | LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | if (sysUser == null) { |
| | | return null; |
| | | } |
| | | if (StringUtils.isNotBlank(sysUser.getEquipmentIds())) { |
| | | //éæ©äºè®¾å¤ï¼æ ¹æ®è®¾å¤idè¿æ»¤è®¾å¤ |
| | | List<String> equipArr = Arrays.asList(sysUser.getEquipmentIds().split(",")); |
| | | queryWrapper.in("equipment_code", equipArr); |
| | | } else { |
| | | //没æéæ©è®¾å¤ï¼æ ¹æ®è½¦é´è¿æ»¤è®¾å¤ |
| | | queryWrapper.exists("select 1 from mdc_user_production t where t.user_id={0} and t.pro_id=org_id", sysUser.getId()); |
| | | } |
| | | // ç§»é¤ç¨æ·æ°æ®æéè¿æ»¤ï¼ç´æ¥æ ¹æ®è®¾å¤ç¼ç æ¥è¯¢ |
| | | queryWrapper.eq("equipment_code", equipmentCode); |
| | | queryWrapper.eq("del_flag", CommonConstant.DEL_FLAG_0); |
| | | |
| | | return eamEquipmentMapper.selectOne(queryWrapper); |
| | | } |
| | | |
| | | /** |
| | | * è·åææç产线idï¼å
嫿æä¸çº§ï¼ |
| | | */ |
| | |
| | | import org.jeecg.modules.lsw.enums.MaterialInventoryStatusEnum; |
| | | import org.jeecg.modules.lsw.service.ILswMaterialInventoryService; |
| | | import org.jeecg.modules.lsw.vo.MaterialInventoryStatisticsVO; |
| | | import org.jeecg.modules.lsw.vo.MaterialInventoryVO; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | |
| | | public Result<String> statisticsInventory(@RequestParam(name = "materialId") String materialId) { |
| | | //åºåç»è®¡æ°é |
| | | List<MaterialInventoryStatisticsVO> list = lswMaterialInventoryService.statisticsInventory(materialId); |
| | | if(CollectionUtil.isEmpty(list)){ |
| | | if (CollectionUtil.isEmpty(list)) { |
| | | return Result.OK("0"); |
| | | } |
| | | StringBuilder sb = new StringBuilder(); |
| | | for(MaterialInventoryStatisticsVO vo : list){ |
| | | for (MaterialInventoryStatisticsVO vo : list) { |
| | | sb.append(vo.getWarehouseName()).append(": ").append(vo.getMaterialQuantity().stripTrailingZeros().toPlainString()).append(" | "); |
| | | } |
| | | return Result.OK(sb.toString()); |
| | | } |
| | | |
| | | @ApiOperation(value = "ç©æåºåä¿¡æ¯-æ ¹æ®äº§çº¿æ¥è¯¢åºå", notes = "ç©æåºåä¿¡æ¯-æ ¹æ®äº§çº¿æ¥è¯¢åºå") |
| | | @GetMapping(value = "/queryMaterialInventory") |
| | | public Result<List<MaterialInventoryVO>> queryMaterialInventory(@RequestParam(name = "factoryId") String factoryId) { |
| | | List<MaterialInventoryVO> list = lswMaterialInventoryService.queryMaterialInventory(factoryId); |
| | | return Result.OK(list); |
| | | } |
| | | } |
| | |
| | | import org.jeecg.modules.lsw.entity.LswMaterialInventory; |
| | | import org.jeecg.modules.lsw.vo.LswMaterialInventoryVo; |
| | | import org.jeecg.modules.lsw.vo.MaterialInventoryStatisticsVO; |
| | | import org.jeecg.modules.lsw.vo.MaterialInventoryVO; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | * @return |
| | | */ |
| | | List<MaterialInventoryStatisticsVO> statisticsInventory(@Param("materialId") String materialId); |
| | | |
| | | /** |
| | | * æ¥è¯¢ç©æåºå |
| | | * @param warehouseId |
| | | * @param materialCategoryList |
| | | * @return |
| | | */ |
| | | List<MaterialInventoryVO> queryMaterialInventory(@Param("warehouseId") String warehouseId, @Param("materialCategoryList") List<String> materialCategoryList); |
| | | } |
| | |
| | | left join base_line_side_warehouse m2 on m1.warehouse_id = m2.id |
| | | |
| | | </select> |
| | | <select id="queryMaterialInventory" resultType="org.jeecg.modules.lsw.vo.MaterialInventoryVO"> |
| | | select t2.material_number, |
| | | t2.material_name, |
| | | t2.material_category, |
| | | t1.batch_number, |
| | | t1.quantity |
| | | from lsw_material_inventory t1 |
| | | left join lsw_material t2 on t1.material_id = t2.id |
| | | where t1.inventory_status = 'NORMAL' |
| | | and t1.warehouse_id = #{warehouseId} |
| | | and t2.material_category in |
| | | <foreach collection="materialCategoryList" item="item" separator="," open="(" close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </select> |
| | | </mapper> |
| | |
| | | import org.jeecg.modules.lsw.entity.LswMaterialInventory; |
| | | import org.jeecg.modules.lsw.vo.LswMaterialInventoryVo; |
| | | import org.jeecg.modules.lsw.vo.MaterialInventoryStatisticsVO; |
| | | import org.jeecg.modules.lsw.vo.MaterialInventoryVO; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | * @return |
| | | */ |
| | | LswMaterialInventory queryByMaterialNumberAndBatchNumber(String materialNumber, String batchNumber, String warehouseId); |
| | | |
| | | /** |
| | | * æ¥è¯¢ç©æåºå |
| | | * @param factoryId |
| | | * @return |
| | | */ |
| | | List<MaterialInventoryVO> queryMaterialInventory(String factoryId); |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.jeecg.modules.base.entity.Factory; |
| | | import org.jeecg.modules.base.entity.LineSideWarehouse; |
| | | import org.jeecg.modules.base.enums.ProductionTypeEnum; |
| | | import org.jeecg.modules.base.service.IFactoryService; |
| | | import org.jeecg.modules.base.service.ILineSideWarehouseService; |
| | | import org.jeecg.modules.lsw.entity.LswMaterial; |
| | | import org.jeecg.modules.lsw.entity.LswMaterialInventory; |
| | | import org.jeecg.modules.lsw.enums.MaterialCategoryEnum; |
| | | import org.jeecg.modules.lsw.enums.MaterialInventoryStatusEnum; |
| | | import org.jeecg.modules.lsw.mapper.LswMaterialInventoryMapper; |
| | | import org.jeecg.modules.lsw.service.ILswMaterialInventoryService; |
| | | import org.jeecg.modules.lsw.service.ILswMaterialService; |
| | | import org.jeecg.modules.lsw.vo.LswMaterialInventoryVo; |
| | | import org.jeecg.modules.lsw.vo.MaterialInventoryStatisticsVO; |
| | | import org.jeecg.modules.lsw.vo.MaterialInventoryVO; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | private LswMaterialInventoryMapper lswMaterialInventoryMapper; |
| | | @Autowired |
| | | private ILswMaterialService materialService; |
| | | @Autowired |
| | | private ILineSideWarehouseService lineSideWarehouseService; |
| | | @Autowired |
| | | private IFactoryService factoryService; |
| | | |
| | | @Override |
| | | public List<LswMaterialInventoryVo> selectLineSideMaterialInventoryByMaterialNumber(List<String> bomMaterialNumberList, String factoryId) { |
| | |
| | | queryWrapper.eq(LswMaterialInventory::getInventoryStatus, MaterialInventoryStatusEnum.NORMAL.name()); |
| | | return lswMaterialInventoryMapper.selectOne(queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public List<MaterialInventoryVO> queryMaterialInventory(String factoryId) { |
| | | Factory factory = factoryService.getById(factoryId); |
| | | if (factory == null) { |
| | | return Collections.emptyList(); |
| | | } |
| | | LineSideWarehouse warehouse = lineSideWarehouseService.queryByFactoryId(factoryId); |
| | | if (warehouse == null) { |
| | | return Collections.emptyList(); |
| | | } |
| | | List<String> materialCategory = new ArrayList<>(); |
| | | if (ProductionTypeEnum.ASSEMBLE.name().equals(factory.getProductionType())) { |
| | | materialCategory.add(MaterialCategoryEnum.OUTER_FLANGE.name()); |
| | | materialCategory.add(MaterialCategoryEnum.INNER_FLANGE.name()); |
| | | materialCategory.add(MaterialCategoryEnum.SMALL_INNER_RING.name()); |
| | | materialCategory.add(MaterialCategoryEnum.STEEL_BALL.name()); |
| | | materialCategory.add(MaterialCategoryEnum.COMPONENTS.name()); |
| | | } else if (ProductionTypeEnum.INNERFLANGE.name().equals(factory.getProductionType())) { |
| | | materialCategory.add(MaterialCategoryEnum.BLANK.name()); |
| | | } else if (ProductionTypeEnum.OUTERFLANGE.name().equals(factory.getProductionType())) { |
| | | materialCategory.add(MaterialCategoryEnum.BLANK.name()); |
| | | } else if (ProductionTypeEnum.HEATTREATMENT.name().equals(factory.getProductionType())) { |
| | | materialCategory.add(MaterialCategoryEnum.BLANK.name()); |
| | | } |
| | | return lswMaterialInventoryMapper.queryMaterialInventory(warehouse.getId(), materialCategory); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.lsw.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | public class MaterialInventoryVO { |
| | | //ç©æç¼å· |
| | | private String materialNumber; |
| | | //ç©æåç§° |
| | | private String materialName; |
| | | //ç©æç±»å |
| | | private String materialCategory; |
| | | //æ¹æ¬¡å· |
| | | private String batchNumber; |
| | | //åºåæ°é |
| | | private BigDecimal quantity; |
| | | } |
| | |
| | | package org.jeecg.modules.mes.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import io.swagger.annotations.Api; |
| | |
| | | import org.jeecg.common.api.vo.Result; |
| | | import org.jeecg.common.aspect.annotation.AutoLog; |
| | | import org.jeecg.common.system.base.controller.JeecgController; |
| | | import org.jeecg.common.system.query.QueryGenerator; |
| | | import org.jeecg.modules.mes.entity.MesMaterialLoading; |
| | | import org.jeecg.modules.mes.service.IMesMaterialLoadingService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.servlet.ModelAndView; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.Arrays; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @Description: 䏿 |
| | | * @Author: jeecg-boot |
| | | * @Date: 2025-07-07 |
| | | * @Version: V1.0 |
| | | */ |
| | | @Api(tags="䏿") |
| | | * @Description: 䏿 |
| | | * @Author: jeecg-boot |
| | | * @Date: 2025-07-07 |
| | | * @Version: V1.0 |
| | | */ |
| | | @Api(tags = "䏿") |
| | | @RestController |
| | | @RequestMapping("/mes/mesMaterialLoading") |
| | | @Slf4j |
| | | public class MesMaterialLoadingController extends JeecgController<MesMaterialLoading, IMesMaterialLoadingService> { |
| | | @Autowired |
| | | private IMesMaterialLoadingService mesMaterialLoadingService; |
| | | @Autowired |
| | | private IMesMaterialLoadingService mesMaterialLoadingService; |
| | | |
| | | /** |
| | | * å页å表æ¥è¯¢ |
| | | * |
| | | * @param mesMaterialLoading |
| | | * @param pageNo |
| | | * @param pageSize |
| | | * @param req |
| | | * @return |
| | | */ |
| | | //@AutoLog(value = "䏿-å页å表æ¥è¯¢") |
| | | @ApiOperation(value="䏿-å页å表æ¥è¯¢", notes="䏿-å页å表æ¥è¯¢") |
| | | @GetMapping(value = "/list") |
| | | public Result<IPage<MesMaterialLoading>> queryPageList(MesMaterialLoading mesMaterialLoading, |
| | | @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, |
| | | @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, |
| | | HttpServletRequest req) { |
| | | Map<String, String[]> parameterMap = req.getParameterMap(); |
| | | QueryWrapper<MesMaterialLoading> queryWrapper = QueryGenerator.initQueryWrapper(mesMaterialLoading, parameterMap); |
| | | Page<MesMaterialLoading> page = new Page<MesMaterialLoading>(pageNo, pageSize); |
| | | IPage<MesMaterialLoading> pageList = mesMaterialLoadingService.queryPageList(page, parameterMap); |
| | | return Result.OK(pageList); |
| | | } |
| | | |
| | | /** |
| | | * æ·»å |
| | | * |
| | | * @param mesMaterialLoading |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "䏿-æ·»å ") |
| | | @ApiOperation(value="䏿-æ·»å ", notes="䏿-æ·»å ") |
| | | //@RequiresPermissions("org.jeecg.modules:mes_material_loading:add") |
| | | @PostMapping(value = "/add") |
| | | public Result<String> add(@RequestBody MesMaterialLoading mesMaterialLoading) { |
| | | mesMaterialLoadingService.save(mesMaterialLoading); |
| | | return Result.OK("æ·»å æåï¼"); |
| | | } |
| | | |
| | | /** |
| | | * ç¼è¾ |
| | | * |
| | | * @param mesMaterialLoading |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "䏿-ç¼è¾") |
| | | @ApiOperation(value="䏿-ç¼è¾", notes="䏿-ç¼è¾") |
| | | //@RequiresPermissions("org.jeecg.modules:mes_material_loading:edit") |
| | | @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) |
| | | public Result<String> edit(@RequestBody MesMaterialLoading mesMaterialLoading) { |
| | | mesMaterialLoadingService.updateById(mesMaterialLoading); |
| | | return Result.OK("ç¼è¾æå!"); |
| | | } |
| | | |
| | | /** |
| | | * éè¿idå é¤ |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "䏿-éè¿idå é¤") |
| | | @ApiOperation(value="䏿-éè¿idå é¤", notes="䏿-éè¿idå é¤") |
| | | //@RequiresPermissions("org.jeecg.modules:mes_material_loading:delete") |
| | | @DeleteMapping(value = "/delete") |
| | | public Result<String> delete(@RequestParam(name="id",required=true) String id) { |
| | | mesMaterialLoadingService.removeById(id); |
| | | return Result.OK("å 餿å!"); |
| | | } |
| | | |
| | | /** |
| | | * æ¹éå é¤ |
| | | * |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "䏿-æ¹éå é¤") |
| | | @ApiOperation(value="䏿-æ¹éå é¤", notes="䏿-æ¹éå é¤") |
| | | //@RequiresPermissions("org.jeecg.modules:mes_material_loading:deleteBatch") |
| | | @DeleteMapping(value = "/deleteBatch") |
| | | public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) { |
| | | this.mesMaterialLoadingService.removeByIds(Arrays.asList(ids.split(","))); |
| | | return Result.OK("æ¹éå 餿å!"); |
| | | } |
| | | |
| | | /** |
| | | * éè¿idæ¥è¯¢ |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | //@AutoLog(value = "䏿-éè¿idæ¥è¯¢") |
| | | @ApiOperation(value="䏿-éè¿idæ¥è¯¢", notes="䏿-éè¿idæ¥è¯¢") |
| | | @GetMapping(value = "/queryById") |
| | | public Result<MesMaterialLoading> queryById(@RequestParam(name="id",required=true) String id) { |
| | | MesMaterialLoading mesMaterialLoading = mesMaterialLoadingService.getById(id); |
| | | if(mesMaterialLoading==null) { |
| | | return Result.error("æªæ¾å°å¯¹åºæ°æ®"); |
| | | } |
| | | return Result.OK(mesMaterialLoading); |
| | | } |
| | | |
| | | /** |
| | | * 导åºexcel |
| | | * |
| | | * @param request |
| | | * @param mesMaterialLoading |
| | | */ |
| | | //@RequiresPermissions("org.jeecg.modules:mes_material_loading:exportXls") |
| | | @RequestMapping(value = "/exportXls") |
| | | public ModelAndView exportXls(HttpServletRequest request, MesMaterialLoading mesMaterialLoading) { |
| | | return super.exportXls(request, mesMaterialLoading, MesMaterialLoading.class, "䏿"); |
| | | } |
| | | |
| | | /** |
| | | * éè¿excel导å
¥æ°æ® |
| | | * |
| | | * @param request |
| | | * @param response |
| | | * @return |
| | | */ |
| | | //@RequiresPermissions("mes_material_loading:importExcel") |
| | | @RequestMapping(value = "/importExcel", method = RequestMethod.POST) |
| | | public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { |
| | | return super.importExcel(request, response, MesMaterialLoading.class); |
| | | } |
| | | /** |
| | | * éè¿loadingIdæ¥è¯¢ä¸æä¿¡æ¯ |
| | | * |
| | | * @param request |
| | | * @param response |
| | | * @return |
| | | */ |
| | | @RequestMapping("/queryUnloadingByLoadingId") |
| | | public Result<?> queryUnloadingByLoadingId(HttpServletRequest request, HttpServletResponse response) { |
| | | String loadingId = request.getParameter("loadingId"); |
| | | return Result.OK(mesMaterialLoadingService.queryUnloadingByLoadingId(loadingId)); |
| | | } |
| | | /* |
| | | * éè¿ workOrderId æ¥è¯¢ä¸æä¿¡æ¯ |
| | | * @param workOrderId |
| | | * */ |
| | | @GetMapping("/queryLoadingByWorkOrderId") |
| | | public Result<?> queryLoadingByWorkOrderId(@RequestParam(name = "workOrderId", required = true) String workOrderId) { |
| | | return Result.OK(mesMaterialLoadingService.queryLoadingByWorkOrderId(workOrderId)); |
| | | /** |
| | | * å页å表æ¥è¯¢ |
| | | * |
| | | * @param mesMaterialLoading |
| | | * @param pageNo |
| | | * @param pageSize |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "䏿-å页å表æ¥è¯¢", notes = "䏿-å页å表æ¥è¯¢") |
| | | @GetMapping(value = "/list") |
| | | public Result<IPage<MesMaterialLoading>> queryPageList(MesMaterialLoading mesMaterialLoading, |
| | | @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, |
| | | @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) { |
| | | Page<MesMaterialLoading> page = new Page<>(pageNo, pageSize); |
| | | IPage<MesMaterialLoading> pageList = mesMaterialLoadingService.queryPageList(page, mesMaterialLoading); |
| | | return Result.OK(pageList); |
| | | } |
| | | |
| | | /** |
| | | * æ·»å |
| | | * |
| | | * @param mesMaterialLoading |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "䏿-æ·»å ") |
| | | @ApiOperation(value = "䏿-æ·»å ", notes = "䏿-æ·»å ") |
| | | @PostMapping(value = "/add") |
| | | public Result<String> add(@RequestBody MesMaterialLoading mesMaterialLoading) { |
| | | boolean b = mesMaterialLoadingService.loading(mesMaterialLoading); |
| | | if (!b) { |
| | | Result.error("ä¸æå¤±è´¥ï¼"); |
| | | } |
| | | return Result.OK("䏿æåï¼"); |
| | | } |
| | | |
| | | /** |
| | | * ç¼è¾ |
| | | * |
| | | * @param mesMaterialLoading |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "䏿-ç¼è¾") |
| | | @ApiOperation(value = "䏿-ç¼è¾", notes = "䏿-ç¼è¾") |
| | | @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST}) |
| | | public Result<String> edit(@RequestBody MesMaterialLoading mesMaterialLoading) { |
| | | mesMaterialLoadingService.updateById(mesMaterialLoading); |
| | | return Result.OK("ç¼è¾æå!"); |
| | | } |
| | | |
| | | /** |
| | | * éè¿idæ¥è¯¢ |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | //@AutoLog(value = "䏿-éè¿idæ¥è¯¢") |
| | | @ApiOperation(value = "䏿-éè¿idæ¥è¯¢", notes = "䏿-éè¿idæ¥è¯¢") |
| | | @GetMapping(value = "/queryById") |
| | | public Result<MesMaterialLoading> queryById(@RequestParam(name = "id", required = true) String id) { |
| | | MesMaterialLoading mesMaterialLoading = mesMaterialLoadingService.getById(id); |
| | | if (mesMaterialLoading == null) { |
| | | return Result.error("æªæ¾å°å¯¹åºæ°æ®"); |
| | | } |
| | | return Result.OK(mesMaterialLoading); |
| | | } |
| | | |
| | | /** |
| | | * éè¿loadingIdæ¥è¯¢ä¸æä¿¡æ¯ |
| | | * |
| | | * @param request |
| | | * @param response |
| | | * @return |
| | | */ |
| | | @RequestMapping("/queryUnloadingByLoadingId") |
| | | public Result<?> queryUnloadingByLoadingId(HttpServletRequest request, HttpServletResponse response) { |
| | | String loadingId = request.getParameter("loadingId"); |
| | | return Result.OK(mesMaterialLoadingService.queryUnloadingByLoadingId(loadingId)); |
| | | } |
| | | } |
| | |
| | | List<Map<String, Object>> res = orderList.stream().map(order -> { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("title", order.getOrderCode()); |
| | | map.put("text", order.getOrderCode()); |
| | | map.put("label", order.getOrderCode()); |
| | | map.put("value", order.getId()); |
| | | return map; |
| | |
| | | /** |
| | | * @Description: 䏿 |
| | | * @Author: jeecg-boot |
| | | * @Date: 2025-07-07 |
| | | * @Date: 2025-07-07 |
| | | * @Version: V1.0 |
| | | */ |
| | | @Data |
| | | @TableName("mes_material_loading") |
| | | @Accessors(chain = true) |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @ApiModel(value="mes_material_loading对象", description="䏿") |
| | | @ApiModel(value = "mes_material_loading对象", description = "䏿") |
| | | public class MesMaterialLoading 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; |
| | | /**å 餿 è®°*/ |
| | | @Excel(name = "å 餿 è®°", width = 15) |
| | | /**å 餿 è®°*/ |
| | | @Excel(name = "å 餿 è®°", width = 15) |
| | | @ApiModelProperty(value = "å 餿 è®°") |
| | | @TableLogic |
| | | private Integer delFlag; |
| | | /**产线ID*/ |
| | | @Excel(name = "产线ID", width = 15) |
| | | @ApiModelProperty(value = "产线ID") |
| | | @Dict(dictTable = "base_factory", dicCode = "id", dicText = "factory_name") |
| | | private String factoryId; |
| | | /**åºåå°ID*/ |
| | | @Excel(name = "åºåå°ID", width = 15) |
| | | @ApiModelProperty(value = "åºåå°ID") |
| | | @Dict(dictTable = "base_line_side_warehouse", dicCode = "id", dicText = "warehouse_name") |
| | | private String warehouseId; |
| | | /**ç©æç¼ç */ |
| | | @Excel(name = "ç©æç¼ç ", width = 15) |
| | | /**ç©æç¼ç */ |
| | | @Excel(name = "ç©æç¼ç ", width = 15) |
| | | @ApiModelProperty(value = "ç©æç¼ç ") |
| | | private String materialNumber; |
| | | /**ç©æåç§°*/ |
| | | @Excel(name = "ç©æåç§°", width = 15) |
| | | /**ç©æåç§°*/ |
| | | @Excel(name = "ç©æåç§°", width = 15) |
| | | @ApiModelProperty(value = "ç©æåç§°") |
| | | private String materialName; |
| | | /**æ¹æ¬¡å·*/ |
| | | @Excel(name = "æ¹æ¬¡å·", width = 15) |
| | | /**æ¹æ¬¡å·*/ |
| | | @Excel(name = "æ¹æ¬¡å·", width = 15) |
| | | @ApiModelProperty(value = "æ¹æ¬¡å·") |
| | | private String batchNumber; |
| | | /**é¢ç尺寸*/ |
| | | @Excel(name = "é¢ç尺寸", width = 15) |
| | | @ApiModelProperty(value = "é¢ç尺寸") |
| | | @Dict(dicCode = "steel_ball_size") |
| | | private String steelBallSize; |
| | | /**æ°é*/ |
| | | @Excel(name = "æ°é", width = 15) |
| | | /**æ°é*/ |
| | | @Excel(name = "æ°é", width = 15) |
| | | @ApiModelProperty(value = "æ°é") |
| | | private BigDecimal quantity; |
| | | /**å©ä½æ°é*/ |
| | | @Excel(name = "å©ä½æ°é", width = 15) |
| | | /**å©ä½æ°é*/ |
| | | @Excel(name = "å©ä½æ°é", width = 15) |
| | | @ApiModelProperty(value = "å©ä½æ°é") |
| | | private BigDecimal remainingQuantity; |
| | | /**䏿æ è®°*/ |
| | | @Excel(name = "䏿æ è®°", width = 15) |
| | | @ApiModelProperty(value = "䏿æ è®°") |
| | | private String unloadingFlag; |
| | | /** åç±» */ |
| | | @TableField(exist = false) |
| | | @ApiModelProperty(value = "å·¥åå·") |
| | | private String workOrderCode; |
| | | @TableField(exist = false) |
| | | @ApiModelProperty(value = "设å¤åç§°") |
| | | private String equipmentName; |
| | | private String category; |
| | | } |
| | |
| | | /**çæ¬¡åç§°*/ |
| | | @TableField(exist = false) |
| | | private String shiftName; |
| | | |
| | | /**ç产工å*/ |
| | | @TableField(exist = false) |
| | | private String text; |
| | | |
| | | /**ç产工åid*/ |
| | | @TableField(exist = false) |
| | | private String value; |
| | | } |
| | |
| | | package org.jeecg.modules.mes.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Constants; |
| | |
| | | */ |
| | | public interface MesMaterialLoadingMapper extends BaseMapper<MesMaterialLoading> { |
| | | List<MesMaterialUnloading> queryUnloadingByLoadingId(@Param("loadingId") String loadingId); |
| | | List<MesMaterialLoading> queryLoadingByWorkOrderId(@Param("workOrderId") String workOrderId); |
| | | |
| | | IPage<MesMaterialLoading> queryPageList(Page<MesMaterialLoading> page, |
| | | @Param(Constants.WRAPPER) Wrapper<MesMaterialLoading> queryWrapper); |
| | | /** |
| | | * å页æ¥è¯¢ |
| | | * @param page |
| | | * @param queryWrapper |
| | | * @return |
| | | */ |
| | | IPage<MesMaterialLoading> queryPageList(Page<MesMaterialLoading> page, @Param(Constants.WRAPPER) Wrapper<MesMaterialLoading> queryWrapper); |
| | | } |
| | |
| | | <select id="queryUnloadingByLoadingId" resultType="org.jeecg.modules.mes.entity.MesMaterialUnloading"> |
| | | select * from mes_material_unloading where loading_id = #{loadingId} and del_flag = 0 order by create_time desc |
| | | </select> |
| | | <select id="queryLoadingByWorkOrderId" resultType="org.jeecg.modules.mes.entity.MesMaterialLoading"> |
| | | select mml.* ,mpwo.work_order_code as workOrderCode |
| | | from mes_material_loading mml |
| | | left join mes_production_work_order mpwo on mml.work_order_id = mpwo.id |
| | | where mml.work_order_id = #{workOrderId} |
| | | and mml.del_flag = 0 |
| | | </select> |
| | | |
| | | <select id="queryPageList" resultType="org.jeecg.modules.mes.entity.MesMaterialLoading"> |
| | | SELECT |
| | | t1.*, |
| | | t2.work_order_code workOrderCode, |
| | | t3.equipment_name equipmentName |
| | | FROM mes_material_loading t1 |
| | | LEFT JOIN mes_production_work_order t2 ON t1.work_order_id = t2.id |
| | | LEFT JOIN eam_equipment t3 ON t1.equipment_id = t3.id |
| | | ${ew.customSqlSegment} |
| | | select * |
| | | from (SELECT m.id, |
| | | m.create_by, |
| | | m.create_time, |
| | | m.material_number, |
| | | m.material_name, |
| | | m.factory_id, |
| | | m.warehouse_id, |
| | | m.batch_number, |
| | | m.steel_ball_size, |
| | | m.quantity, |
| | | m.remaining_quantity, |
| | | m.unloading_flag, |
| | | 'LOADING' AS category |
| | | FROM mes_material_loading m |
| | | WHERE m.del_flag = 0 |
| | | UNION ALL |
| | | SELECT t1.id, |
| | | t1.create_by, |
| | | t1.create_time, |
| | | t1.material_number, |
| | | t1.material_name, |
| | | t2.factory_id, |
| | | t2.warehouse_id, |
| | | t2.batch_number, |
| | | t2.steel_ball_size, |
| | | t2.quantity, |
| | | t2.remaining_quantity, |
| | | t2.unloading_flag, |
| | | 'UNLOADING' AS category |
| | | FROM mes_material_unloading t1 |
| | | INNER JOIN mes_material_loading t2 ON t1.loading_id = t2.id |
| | | WHERE t1.del_flag = 0) mml |
| | | ${ew.customSqlSegment} |
| | | </select> |
| | | </mapper> |
| | |
| | | <select id="queryPageList" resultType="org.jeecg.modules.mes.entity.MesProductionWorkOrder"> |
| | | SELECT |
| | | t1.*, |
| | | t1.work_order_code AS text, |
| | | t1.id AS value, |
| | | t2.factory_code factoryCode, |
| | | t3.shift_code shiftCode |
| | | FROM mes_production_work_order t1 |
| | |
| | | /** |
| | | * @Description: 䏿 |
| | | * @Author: jeecg-boot |
| | | * @Date: 2025-07-07 |
| | | * @Date: 2025-07-07 |
| | | * @Version: V1.0 |
| | | */ |
| | | public interface IMesMaterialLoadingService extends IService<MesMaterialLoading> { |
| | | List<MesMaterialUnloading> queryUnloadingByLoadingId(String loadingId); |
| | | List<MesMaterialLoading> queryLoadingByWorkOrderId(String workOrderId); |
| | | |
| | | IPage<MesMaterialLoading> queryPageList(Page<MesMaterialLoading> page, Map<String, String[]> parameterMap); |
| | | /** |
| | | * å页æ¥è¯¢ |
| | | * @param page |
| | | * @param mesMaterialLoading |
| | | * @return |
| | | */ |
| | | IPage<MesMaterialLoading> queryPageList(Page<MesMaterialLoading> page, MesMaterialLoading mesMaterialLoading); |
| | | |
| | | /** |
| | | * 䏿æ¥å£ |
| | | * @param mesMaterialLoading |
| | | * @return |
| | | */ |
| | | boolean loading(MesMaterialLoading mesMaterialLoading); |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.jeecg.common.constant.CommonConstant; |
| | | import org.jeecg.common.exception.JeecgBootException; |
| | | import org.jeecg.common.system.vo.LoginUser; |
| | | import org.jeecg.modules.base.entity.LineSideWarehouse; |
| | | import org.jeecg.modules.base.service.ILineSideWarehouseService; |
| | | import org.jeecg.modules.lsw.entity.LswMaterial; |
| | | import org.jeecg.modules.lsw.entity.LswMaterialInventory; |
| | | import org.jeecg.modules.lsw.entity.LswMaterialOutbound; |
| | | import org.jeecg.modules.lsw.enums.MaterialCategoryEnum; |
| | | import org.jeecg.modules.lsw.enums.MaterialOutboundCategory; |
| | | import org.jeecg.modules.lsw.service.ILswMaterialInventoryService; |
| | | import org.jeecg.modules.lsw.service.ILswMaterialOutboundService; |
| | | import org.jeecg.modules.lsw.service.ILswMaterialService; |
| | | import org.jeecg.modules.mes.entity.MesMaterialLoading; |
| | | import org.jeecg.modules.mes.entity.MesMaterialUnloading; |
| | | import org.jeecg.modules.mes.mapper.MesMaterialLoadingMapper; |
| | | import org.jeecg.modules.mes.service.IMesMaterialLoadingService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @Description: 䏿 |
| | | * @Author: jeecg-boot |
| | | * @Date: 2025-07-07 |
| | | * @Date: 2025-07-07 |
| | | * @Version: V1.0 |
| | | */ |
| | | @Service |
| | | public class MesMaterialLoadingServiceImpl extends ServiceImpl<MesMaterialLoadingMapper, MesMaterialLoading> implements IMesMaterialLoadingService { |
| | | |
| | | @Autowired |
| | | private ILineSideWarehouseService lineSideWarehouseService; |
| | | @Autowired |
| | | private ILswMaterialOutboundService lswMaterialOutboundService; |
| | | @Autowired |
| | | private ILswMaterialInventoryService materialInventoryService; |
| | | @Autowired |
| | | private ILswMaterialService materialService; |
| | | |
| | | @Override |
| | | public List<MesMaterialUnloading> queryUnloadingByLoadingId(String loadingId) { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<MesMaterialLoading> queryLoadingByWorkOrderId(String workOrderId) { |
| | | return baseMapper.queryLoadingByWorkOrderId(workOrderId); |
| | | public IPage<MesMaterialLoading> queryPageList(Page<MesMaterialLoading> page, MesMaterialLoading mesMaterialLoading) { |
| | | QueryWrapper<MesMaterialLoading> queryWrapper = new QueryWrapper<>(); |
| | | if (StringUtils.isNotBlank(mesMaterialLoading.getFactoryId())) { |
| | | queryWrapper.eq("mml.factory_id", mesMaterialLoading.getFactoryId()); |
| | | } |
| | | if (StringUtils.isNotBlank(mesMaterialLoading.getCategory())) { |
| | | queryWrapper.eq("mml.category", mesMaterialLoading.getCategory()); |
| | | } |
| | | if (StringUtils.isNotBlank(mesMaterialLoading.getMaterialNumber())) { |
| | | queryWrapper.like("mml.material_number", mesMaterialLoading.getMaterialNumber()); |
| | | } |
| | | if (StringUtils.isNotBlank(mesMaterialLoading.getMaterialName())) { |
| | | queryWrapper.like("mml.material_name", mesMaterialLoading.getMaterialName()); |
| | | } |
| | | if (StringUtils.isNotBlank(mesMaterialLoading.getBatchNumber())) { |
| | | queryWrapper.like("mml.batch_number", mesMaterialLoading.getBatchNumber()); |
| | | } |
| | | queryWrapper.orderByDesc("mml.create_time"); |
| | | return this.baseMapper.queryPageList(page, queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public IPage<MesMaterialLoading> queryPageList(Page<MesMaterialLoading> page, Map<String, String[]> parameterMap) { |
| | | QueryWrapper<MesMaterialLoading> queryWrapper = Wrappers.query(); |
| | | String[] factoryIds = parameterMap.get("factoryId"); |
| | | if (factoryIds != null && factoryIds.length > 0) { |
| | | queryWrapper.eq("t2.factory_id", factoryIds[0]); |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean loading(MesMaterialLoading mesMaterialLoading) { |
| | | if (mesMaterialLoading == null) { |
| | | throw new JeecgBootException("åæ°é误ï¼"); |
| | | } |
| | | String[] workOrderIds = parameterMap.get("workOrderId"); |
| | | if (workOrderIds != null && workOrderIds.length > 0) { |
| | | queryWrapper.eq("t1.work_order_id", workOrderIds[0]); |
| | | if (StringUtils.isBlank(mesMaterialLoading.getFactoryId()) |
| | | || StringUtils.isBlank(mesMaterialLoading.getMaterialNumber()) |
| | | || mesMaterialLoading.getQuantity() == null |
| | | || mesMaterialLoading.getQuantity().intValue() < 1 |
| | | || StringUtils.isBlank(mesMaterialLoading.getBatchNumber())) { |
| | | throw new JeecgBootException("åæ°é误ï¼"); |
| | | } |
| | | String[] materialNumbers = parameterMap.get("materialNumber"); |
| | | if (materialNumbers != null && materialNumbers.length > 0) { |
| | | queryWrapper.like("t1.material_number", materialNumbers[0]); |
| | | LineSideWarehouse warehouse = lineSideWarehouseService.queryByFactoryId(mesMaterialLoading.getFactoryId()); |
| | | if (warehouse == null) { |
| | | throw new JeecgBootException("线边åºä¸åå¨ï¼è¯·æ£æ¥ï¼"); |
| | | } |
| | | String[] materialNames = parameterMap.get("materialName"); |
| | | if (materialNames != null && materialNames.length > 0) { |
| | | queryWrapper.like("t1.material_name", materialNames[0]); |
| | | |
| | | LswMaterial material = materialService.queryByMaterialNumber(mesMaterialLoading.getMaterialNumber()); |
| | | if (material == null) { |
| | | throw new JeecgBootException("ç©æä¿¡æ¯ä¸åå¨ï¼è¯·æ£æ¥ï¼"); |
| | | } |
| | | String[] batchNumbers = parameterMap.get("batchNumber"); |
| | | if (batchNumbers != null && batchNumbers.length > 0) { |
| | | queryWrapper.like("t1.batch_number", batchNumbers[0]); |
| | | |
| | | if (MaterialCategoryEnum.STEEL_BALL.name().equals(material.getMaterialCategory()) && StringUtils.isBlank(mesMaterialLoading.getSteelBallSize())) { |
| | | throw new JeecgBootException("é¢ç尺寸ä¸è½ä¸ºç©ºï¼è¯·æ£æ¥ï¼"); |
| | | } |
| | | String[] equipmentIds = parameterMap.get("equipmentId"); |
| | | if (equipmentIds != null && equipmentIds.length > 0) { |
| | | queryWrapper.eq("t1.equipment_id", equipmentIds[0]); |
| | | |
| | | LswMaterialInventory inventory = materialInventoryService.queryByMaterialNumberAndBatchNumber(mesMaterialLoading.getMaterialNumber(), mesMaterialLoading.getBatchNumber(), warehouse.getId()); |
| | | if (inventory == null) { |
| | | throw new JeecgBootException("åºåä¸åå¨ï¼è¯·æ£æ¥ï¼"); |
| | | } |
| | | queryWrapper.orderByDesc("t1.create_time"); |
| | | return this.baseMapper.queryPageList(page, queryWrapper); |
| | | if (inventory.getQuantity().compareTo(mesMaterialLoading.getQuantity()) != 0) { |
| | | throw new JeecgBootException("䏿ååºåæ°éä¸å¹é
ï¼è¯·æ£æ¥ï¼"); |
| | | } |
| | | |
| | | //人åä¿¡æ¯ |
| | | LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | if (sysUser == null) { |
| | | throw new JeecgBootException("ç¨æ·ä¿¡æ¯è·å失败ï¼"); |
| | | } |
| | | LswMaterialOutbound outbound = new LswMaterialOutbound(); |
| | | outbound.setMaterialNumber(mesMaterialLoading.getMaterialNumber()); |
| | | outbound.setMaterialName(mesMaterialLoading.getMaterialName()); |
| | | outbound.setQuantity(mesMaterialLoading.getQuantity()); |
| | | outbound.setFactoryId(mesMaterialLoading.getFactoryId()); |
| | | outbound.setWarehouseId(warehouse.getId()); |
| | | outbound.setBatchNumber(mesMaterialLoading.getBatchNumber()); |
| | | outbound.setOutboundCategory(MaterialOutboundCategory.MATERIAL_LOADING.name()); |
| | | outbound.setInventoryId(inventory.getId()); |
| | | outbound.setOutboundStaff(sysUser.getUsername()); |
| | | boolean b = lswMaterialOutboundService.outboundMaterial(outbound); |
| | | if (!b) { |
| | | throw new JeecgBootException("åºååºåºå¤±è´¥ï¼"); |
| | | } |
| | | mesMaterialLoading.setWarehouseId(warehouse.getId()); |
| | | mesMaterialLoading.setRemainingQuantity(mesMaterialLoading.getQuantity()); |
| | | mesMaterialLoading.setDelFlag(CommonConstant.DEL_FLAG_0); |
| | | mesMaterialLoading.setUnloadingFlag(CommonConstant.STATUS_0); |
| | | this.save(mesMaterialLoading); |
| | | return true; |
| | | } |
| | | } |