feat(cms): 添加库存刀具列表接口并优化相关功能
- 在 CuttingReceiveController 中添加 getInventoryToolList 接口
- 在 CuttingReceiveMapper 和 CuttingReceiveServiceImpl 中实现 getInventoryToolList 方法
- 修改 CuttingReceiveDetailMapper.xml 中的查询语句,加入库存状态和当前寿命字段
- 优化 CuttingToolMapper.xml 中的查询语句,使用左连接查询字典表
- 移除 CuttingReceive 和 CuttingReceiveDetail 类中未使用的注解
| | |
| | | |
| | | 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); |
| | | } |
| | | } |