wangxin преди 2 дни
родител
ревизия
837164a420

+ 24 - 7
src/main/java/cn/ezhizao/project/business/controller/BizInboundOrderController.java

@@ -2,14 +2,11 @@ package cn.ezhizao.project.business.controller;
 
 import cn.ezhizao.framework.web.controller.BaseController;
 import cn.ezhizao.framework.web.domain.AjaxResult;
-import cn.ezhizao.project.business.domain.BizCertificate;
-import cn.ezhizao.project.business.domain.BizInboundOrder;
-import cn.ezhizao.project.business.domain.BizInboundOrderDetail;
-import cn.ezhizao.project.business.service.IBizCertificateService;
-import cn.ezhizao.project.business.service.IBizInboundOrderDetailService;
-import cn.ezhizao.project.business.service.IBizInboundOrderService;
+import cn.ezhizao.project.business.domain.*;
+import cn.ezhizao.project.business.service.*;
 import cn.hutool.core.date.DateTime;
 import io.swagger.annotations.Api;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -30,6 +27,10 @@ public class BizInboundOrderController extends BaseController {
     private IBizInboundOrderDetailService bizInboundOrderDetailService;
     @Resource
     private IBizCertificateService bizCertificateService;
+    @Resource
+    private IBizTakeStockPeriodService bizTakeStockPeriodService;
+    @Resource
+    private IBizTaksStockLotService bizTaksStockLotService;
 
     /**
      * 库存推送
@@ -80,6 +81,7 @@ public class BizInboundOrderController extends BaseController {
      * 上架
      */
     @PostMapping("/putAway")
+    @Transactional
     public AjaxResult putAway(@RequestBody BizInboundOrder bizInboundOrder) {
         // 入参
         // "palletCode": "2410616" -- 托盘码
@@ -109,7 +111,6 @@ public class BizInboundOrderController extends BaseController {
             l.setIsInbound(1);
         });
         bizInboundOrderDetailService.updateBatchById(details);
-
         list.forEach(l ->{
             // 判断未入库明细数量是否大于0 假设大于0 则部分入库,否则全部入库
             long inboundNum =  bizInboundOrderDetailService.query().eq("inbound_order_id", l.getId()).eq("is_inbound", 0).count();
@@ -123,6 +124,22 @@ public class BizInboundOrderController extends BaseController {
         });
         bizInboundOrderService .updateBatchById(list);
 
+        //查找当天是否有盘点数据
+        List<BizTakeStockPeriod> periods = bizTakeStockPeriodService.query().eq("start_time", DateTime.now().toString("yyyy-MM-dd")).orderByDesc("create_time").list();
+        //如果当天有盘点数据,根据details入库单明细的批次id,将periods当天最新创建的盘点数据中的入库字段设为1,表示该批次已入库
+        if (!periods.isEmpty()) {
+            //拿到入库单明细的批次id进行去重
+            List<Long> uniqueLotIdList = details.stream().map(BizInboundOrderDetail::getLotId).distinct().collect(Collectors.toList());
+
+            BizTaksStockLot taksStockLot = new BizTaksStockLot();
+            taksStockLot.setTakeStockPeriodId(periods.get(0).getId());
+            taksStockLot.setLotIdsForInbound(uniqueLotIdList);
+
+            //根据盘点id和批次id修改盘点明细中批次的入库状态
+            bizTaksStockLotService.updateBatchByIdsForInbound(taksStockLot);
+
+        }
+
         return success("更新成功");
     }
 }

+ 61 - 0
src/main/java/cn/ezhizao/project/business/domain/BizTakeStockPeriod.java

@@ -0,0 +1,61 @@
+package cn.ezhizao.project.business.domain;
+
+import cn.ezhizao.framework.aspectj.lang.annotation.Excel;
+import cn.ezhizao.framework.web.domain.BaseEntity;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 盘点时间对象 biz_take_stock_period
+ *
+ * @author ezhizao
+ * @date 2024-08-15
+ */
+@Data
+@TableName(value = "biz_take_stock_period")
+public class BizTakeStockPeriod extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 盘点状态(1:开始盘点,2:结束盘点) */
+    @Excel(name = "盘点状态", readConverterExp = "1=:开始盘点,2:结束盘点")
+    @ApiModelProperty(value = "盘点状态")
+    private Integer status;
+
+    /** 盘点开始时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Excel(name = "盘点开始时间", width = 30, dateFormat = "yyyy-MM-dd ")
+    @ApiModelProperty(value = "盘点开始时间")
+    private Date startTime;
+
+    /** 盘点结束时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Excel(name = "盘点结束时间", width = 30, dateFormat = "yyyy-MM-dd")
+    @ApiModelProperty(value = "盘点结束时间")
+    private Date endTime;
+    private String remark;
+    @TableField(exist = false)
+    private String createStartTime;
+    @TableField(exist = false)
+    private String createEndTime;
+    @TableField(exist = false)
+    private String startTimeStr;
+    @TableField(exist = false)
+    private String startTimeEnd;
+    @TableField(exist = false)
+    private String endTimeStr;
+    @TableField(exist = false)
+    private String endTimeEnd;
+    private String stockYear;
+    private String stockMonth;
+    @TableField(exist = false)
+    private String stockTime;
+    @TableField(exist = false)
+    private String flag;
+    private Long tenantId;
+}

+ 190 - 0
src/main/java/cn/ezhizao/project/business/domain/BizTaksStockLot.java

@@ -0,0 +1,190 @@
+package cn.ezhizao.project.business.domain;
+
+import cn.ezhizao.framework.aspectj.lang.annotation.Excel;
+import cn.ezhizao.framework.web.domain.BaseEntity;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+
+/**
+ * 盘点批次信息对象 biz_taks_stock_lot
+ *
+ * @author ezhizao
+ * @date 2024-08-15
+ */
+@Data
+@TableName(value = "biz_taks_stock_lot")
+public class BizTaksStockLot extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 租户(厂别)id */
+    @ApiModelProperty(value = "${comment}")
+    private Long tenantId;
+
+    /** 计划单id */
+    @ApiModelProperty(value = "${comment}")
+    private Long productionPlanId;
+
+    /** 计划单明细id */
+    @ApiModelProperty(value = "${comment}")
+    private Long productionPlanDetailId;
+    /** 批次号 */
+
+    @ApiModelProperty(value = "批次号")
+    @Excel(name = "批次号",sort = 3)
+    private String lotCode;
+
+    /** 产品描述 */
+    @Excel(name = "产品描述",sort = 4)
+    @ApiModelProperty(value = "产品描述")
+    private String productDescription;
+
+    /** 子计划id */
+    @ApiModelProperty(value = "产品描述")
+    private Long productionPlanDetailSubDetailId;
+
+    /** daywork_id */
+    @ApiModelProperty(value = "产品描述")
+    private Long dayworkId;
+
+    /** 批次id */
+    @ApiModelProperty(value = "产品描述")
+    private Long lotId;
+
+
+    /** 工段id(当前工段的id) */
+    @ApiModelProperty(value = "批次号")
+    private Long deptId;
+
+    /** 产品id */
+    @ApiModelProperty(value = "批次号")
+    private Long productId;
+
+    /** 是否盘点(0:未盘点,1:已盘点) */
+    @ApiModelProperty(value = "是否盘点(0:未盘点,1:已盘点)")
+    private Integer isTaksStock;
+
+    /** 盘点数量 */
+    @ApiModelProperty(value = "盘点数量")
+    @Excel(name = "盘点数量",sort = 10)
+    private Integer taksStockNum;
+
+    /** 工艺id(通过工艺id,获取版本号) */
+    @ApiModelProperty(value = "盘点数量")
+    private Long technologicalProcessId;
+
+    /** 投产数 */
+    @ApiModelProperty(value = "投产数")
+    @Excel(name = "投入数",sort = 9)
+    private Integer prodNum;
+
+    /** 是否尾批(0:默认,1: 是尾批) */
+    @ApiModelProperty(value = "是否尾批")
+    private Integer isLast;
+
+    /** 是否是废品回用(0:否;1:是) */
+    @ApiModelProperty(value = "是否是废品回用(0:否;1:是)")
+    private Long isWasteRecycling;
+
+    /** 是否修改(0 否 ,1 是)单批单改;多批单改;回退 */
+    @ApiModelProperty(value = "是否修改(0 否 ,1 是)单批单改;多批单改;回退")
+    private Integer isAmend;
+
+    /** 工序合格数 */
+    @ApiModelProperty(value = "工序合格数")
+    private Integer temporaryProcessQualifiedNum;
+
+    /** 批次生产状态(0:未开始,1:进行中,2:已完成) */
+    @ApiModelProperty(value = "批次生产状态")
+    @Excel(name = "批次生产状态", readConverterExp = "0=未开始,1=进行中,2=已完成",sort = 11)
+    private Integer status;
+
+    /** 批次生产状态(0:未开始,1:进行中,2:已完成) */
+    @ApiModelProperty(value = "是否入库")
+    @Excel(name = "是否入库", readConverterExp = "0=否,1=是",sort = 14)
+    private Integer isInbound;
+
+    /** 批次生产状态(0:未开始,1:进行中,2:已完成) */
+    @ApiModelProperty(value = "是否创建入库单")
+    @Excel(name = "是否创建入库单", readConverterExp = "0=否,1=是")
+    private Integer isEstablishInbound;
+
+    /** 是否经过特殊报工(0:否,1:是) */
+    @ApiModelProperty(value = "是否经过特殊报工")
+    private Integer hasSpecial;
+    private Long takeStockPeriodId;
+    @TableField(exist = false)
+    @Excel(name = "工段", sort = 7)
+    private String deptName;
+    @TableField(exist = false)
+    private List<Long> flags;
+    @TableField(exist = false)
+    private String productionPlanNo;
+    private Integer isProductStatus;
+    private Long processId;
+    @Excel(name="工序", sort = 8)
+    private String processAlias;
+    @TableField(exist = false)
+    @Excel(name = "箱号",sort = 6)
+    private String carrierName;
+    @Excel(name = "盘点年",sort = 1)
+    private String stockYear;
+    @Excel(name = "盘点月",sort = 2)
+    private String stockMonth;
+//    @Excel(name = "产品数",sort = 5)
+    @TableField(exist = false)
+    private Integer productNum;
+    @Excel(name = "产品图号",sort = 3)
+    private String drawingNumber;
+    private Integer isWaste;
+    private Long fromLotId;
+
+//    @TableField(exist = false)
+    @Excel(name = "外协单号",sort = 12)
+    private String outsourceFormNo;
+    @TableField(exist = false)
+    private String deptCode;
+
+    @TableField(exist = false)
+    private List<Long> lotIds;
+    @TableField(exist = false)
+    @Excel(name = "标识",sort = 13)
+    private String flag;
+//    @TableField(exist = false)
+    private String statusLabel;
+    @TableField(exist = false)
+    private String label;
+    @TableField(exist = false)
+    private Long value;
+    private Integer isSuperaddition;
+    //子计划投产批数
+    @TableField(exist = false)
+    private Integer lotTotalNumber;
+    //已经生成正常批次数量
+    @TableField(exist = false)
+    private Long normalLotNumber;
+    //已经盘点的未生产的批次量
+    @TableField(exist = false)
+    private Long notProductionLotNumber;
+    @TableField(exist = false)
+    private Long allowLotNum;
+    @Excel(name = "盘点状态",sort = 5)
+    @TableField(exist =false)
+    private String taksStatus;
+    @TableField(exist =false)
+    @Excel(name = "产品编码", sort = 4)
+    private String productCode;
+    @TableField(exist =false)
+    private String barcode;
+
+    //入库批次id集合,用于更新入库状态
+    @TableField(exist =false)
+    private List<Long> lotIdsForInbound;
+
+
+}

+ 32 - 0
src/main/java/cn/ezhizao/project/business/mapper/BizTakeStockPeriodMapper.java

@@ -0,0 +1,32 @@
+package cn.ezhizao.project.business.mapper;
+
+import cn.ezhizao.project.business.domain.BizTakeStockPeriod;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 盘点时间Mapper接口
+ *
+ * @author ezhizao
+ * @date 2024-08-15
+ */
+public interface BizTakeStockPeriodMapper extends BaseMapper<BizTakeStockPeriod>
+{
+    /**
+     * 查询盘点时间列表
+     *
+     * @param bizTakeStockPeriod 盘点时间
+     * @return 盘点时间集合
+     */
+    public List<BizTakeStockPeriod> getList(BizTakeStockPeriod bizTakeStockPeriod);
+
+    /**
+     * 物理删除
+     * @param bizTakeStockPeriod
+     * @return 删除结果
+    */
+    public int physicalDelete(BizTakeStockPeriod bizTakeStockPeriod);
+    public int updateDruidPoolSize(@Param("druidPoolSize") Integer druidPoolSize);
+}

+ 38 - 0
src/main/java/cn/ezhizao/project/business/mapper/BizTaksStockLotMapper.java

@@ -0,0 +1,38 @@
+package cn.ezhizao.project.business.mapper;
+
+import cn.ezhizao.project.business.domain.BizTakeStockPeriod;
+import cn.ezhizao.project.business.domain.BizTaksStockLot;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+import java.util.List;
+
+/**
+ * 盘点批次信息Mapper接口
+ *
+ * @author ezhizao
+ * @date 2024-08-15
+ */
+public interface BizTaksStockLotMapper extends BaseMapper<BizTaksStockLot>
+{
+    /**
+     * 查询盘点批次信息列表
+     *
+     * @param bizTaksStockLot 盘点批次信息
+     * @return 盘点批次信息集合
+     */
+    public List<BizTaksStockLot> getList(BizTaksStockLot bizTaksStockLot);
+    public List<BizTaksStockLot> getProductionPlanDetailList(BizTaksStockLot bizTaksStockLot);
+    public List<BizTaksStockLot> getNotTaksLot(BizTaksStockLot bizTaksStockLot);
+    public List<BizTaksStockLot> getInfo(BizTakeStockPeriod bizTakeStockPeriod);
+
+    /**
+     * 物理删除
+     * @param bizTaksStockLot
+     * @return 删除结果
+    */
+    public int physicalDelete(BizTaksStockLot bizTaksStockLot);
+
+    List<BizTaksStockLot> getOutsourceDetailList(BizTaksStockLot bizTaksStockLot);
+
+    String saveOutsourceInfo(BizTaksStockLot bizTaksStockLot);
+}

+ 49 - 0
src/main/java/cn/ezhizao/project/business/service/impl/BizTakeStockPeriodServiceImpl.java

@@ -0,0 +1,49 @@
+package cn.ezhizao.project.business.service.impl;
+
+import cn.ezhizao.project.business.domain.BizTakeStockPeriod;
+import cn.ezhizao.project.business.mapper.BizTakeStockPeriodMapper;
+import cn.ezhizao.project.business.service.IBizTakeStockPeriodService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * 盘点时间Service业务层处理
+ *
+ * @author ezhizao
+ * @date 2024-08-15
+ */
+@Service
+public class BizTakeStockPeriodServiceImpl extends ServiceImpl<BizTakeStockPeriodMapper, BizTakeStockPeriod> implements IBizTakeStockPeriodService
+{
+    @Resource
+    private BizTakeStockPeriodMapper bizTakeStockPeriodMapper;
+
+    /**
+     * 查询盘点时间列表
+     *
+     * @param bizTakeStockPeriod 盘点时间
+     * @return 盘点时间
+     */
+    @Override
+    public List<BizTakeStockPeriod> getList(BizTakeStockPeriod bizTakeStockPeriod)
+    {
+        return bizTakeStockPeriodMapper.getList(bizTakeStockPeriod);
+    }
+
+    @Override
+    public int updateDruidPoolSize(Integer druidPoolSize) {
+        return bizTakeStockPeriodMapper.updateDruidPoolSize(druidPoolSize);
+    }
+
+    /**
+     * 物理删除
+     * @param bizTakeStockPeriod
+     * @return 删除结果
+     */
+    @Override
+    public int physicalDelete(BizTakeStockPeriod bizTakeStockPeriod){ return bizTakeStockPeriodMapper.physicalDelete(bizTakeStockPeriod); };
+
+}

+ 72 - 0
src/main/java/cn/ezhizao/project/business/service/impl/BizTaksStockLotServiceImpl.java

@@ -0,0 +1,72 @@
+package cn.ezhizao.project.business.service.impl;
+
+import cn.ezhizao.project.business.domain.BizTakeStockPeriod;
+import cn.ezhizao.project.business.domain.BizTaksStockLot;
+import cn.ezhizao.project.business.mapper.BizTaksStockLotMapper;
+import cn.ezhizao.project.business.service.IBizTaksStockLotService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * 盘点批次信息Service业务层处理
+ *
+ * @author ezhizao
+ * @date 2024-08-15
+ */
+@Service
+public class BizTaksStockLotServiceImpl extends ServiceImpl<BizTaksStockLotMapper, BizTaksStockLot> implements IBizTaksStockLotService
+{
+    @Resource
+    private BizTaksStockLotMapper bizTaksStockLotMapper;
+
+    /**
+     * 查询盘点批次信息列表
+     *
+     * @param bizTaksStockLot 盘点批次信息
+     * @return 盘点批次信息
+     */
+    @Override
+    public List<BizTaksStockLot> getList(BizTaksStockLot bizTaksStockLot)
+    {
+        return bizTaksStockLotMapper.getList(bizTaksStockLot);
+    }
+
+    @Override
+    public List<BizTaksStockLot> getProductionPlanDetailList(BizTaksStockLot bizTaksStockLot) {
+        return bizTaksStockLotMapper.getProductionPlanDetailList(bizTaksStockLot);
+    }
+
+
+    @Override
+    public List<BizTaksStockLot> getNotTaksLot(BizTaksStockLot bizTaksStockLot) {
+        return bizTaksStockLotMapper.getNotTaksLot(bizTaksStockLot);
+    }
+
+    @Override
+    public List<BizTaksStockLot> getInfo(BizTakeStockPeriod bizTakeStockPeriod) {
+        return bizTaksStockLotMapper.getInfo(bizTakeStockPeriod);
+    }
+
+    /**
+     * 物理删除
+     * @param bizTaksStockLot
+     * @return 删除结果
+     */
+    @Override
+    public int physicalDelete(BizTaksStockLot bizTaksStockLot){ return bizTaksStockLotMapper.physicalDelete(bizTaksStockLot); }
+
+    @Override
+    public List<BizTaksStockLot> getOutsourceDetailList(BizTaksStockLot bizTaksStockLot) {
+        return bizTaksStockLotMapper.getOutsourceDetailList(bizTaksStockLot);
+    }
+
+    @Override
+    public int updateBatchByIdsForInbound(BizTaksStockLot taksStockLot) {
+        return bizTaksStockLotMapper.updateBatchByIdsForInbound(taksStockLot);
+    }
+
+
+}

+ 41 - 0
src/main/resources/mybatis/business/BizTakeStockPeriodMapper.xml

@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.ezhizao.project.business.mapper.BizTakeStockPeriodMapper">
+
+    <resultMap type="cn.ezhizao.project.business.domain.BizTakeStockPeriod" id="BizTakeStockPeriodResult">
+        <id column="id" property="id"/>
+    </resultMap>
+
+
+    <select id="getList" parameterType="BizTakeStockPeriod" resultMap="BizTakeStockPeriodResult">
+        SELECT *, CONCAT(stock_year, '-', LPAD(stock_month, 2, '0')) AS stockTime  FROM biz_take_stock_period
+        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
+            deleted = 0
+            <if test="status != null "> AND status = #{status}</if>
+            <if test="tenantId != null and tenantId!= 0"> AND tenant_id = #{tenantId}</if>
+            <if test="remark != null "> AND remark like concat('%',#{remark},'%')</if>
+            <if test="createStartTime != null ">AND create_time &gt; #{createStartTime}</if>
+            <if test="createEndTime != null ">AND create_time &lt; #{createEndTime}</if>
+            <if test="startTimeStr != null ">AND start_time &gt; #{startTimeStr}</if>
+            <if test="startTimeEnd != null ">AND start_time &lt; #{startTimeEnd}</if>
+            <if test="endTimeStr != null ">AND end_time &gt; #{endTimeStr}</if>
+            <if test="endTimeEnd != null ">AND end_time &lt; #{endTimeEnd}</if>
+        </trim>
+        order by create_time desc
+    </select>
+    <update id="updateDruidPoolSize">
+        SET GLOBAL max_connections = #{druidPoolSize} ;
+    </update>
+
+    <delete id="physicalDelete">
+        DELETE FROM biz_take_stock_period
+        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
+            <if test="id != null">
+                id = #{id} AND
+            </if>
+       <!-- 删除条件为其他外键可以在这里加 -->
+        </trim>
+    </delete>
+</mapper>

+ 126 - 0
src/main/resources/mybatis/business/BizTaksStockLotMapper.xml

@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.ezhizao.project.business.mapper.BizTaksStockLotMapper">
+
+    <resultMap type="cn.ezhizao.project.business.domain.BizTaksStockLot" id="BizTaksStockLotResult">
+        <id column="id" property="id"/>
+        <association property="carrierName" column="daywork_id" select="getCarrierName"/>
+    </resultMap>
+
+
+    <select id="getList" parameterType="BizTaksStockLot" resultMap="BizTaksStockLotResult">
+        SELECT t1.*,t2.dept_name, t2.dept_code,t3.production_plan_no, t3.product_code
+        <!--,(case when t2.dept_code = '170000' and (select status from biz_daywork_item t where t.daywork_id = t1.daywork_id and t.deleted = 0 order by t.create_time desc limit 1) &lt; '4' then (select t2.form_code from biz_daywork_item t left join biz_outsourced_order_detail t2 on t2.id = t.outsource_detail_id where t.daywork_id = t1.daywork_id and t.deleted = 0 order by t.create_time desc limit 1) else '' end) as outsource_form_no, -->
+        <!-- (select t4.status from biz_daywork_item t4 where t4.daywork_id = t1.daywork_id and t4.deleted = 0 order by t4.create_time desc limit 1) as statusLabel -->
+        FROM biz_taks_stock_lot t1
+        left join sys_dept t2 on t1.dept_id = t2.dept_id
+        left join biz_production_plan_detail t3 on t1.production_plan_detail_id = t3.id
+        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
+            t1.deleted = 0 and t1.take_stock_period_id = #{takeStockPeriodId} and t1.is_waste = 0  AND t1.is_establish_inbound=0
+            <if test="productDescription != null  and productDescription != ''"> AND t1.product_description like concat('%', #{productDescription}, '%')</if>
+            <if test="lotCode != null  and lotCode != ''"> AND t1.lot_code like concat('%', #{lotCode},'%')</if>
+            <if test="isTaksStock != null "> AND t1.is_taks_stock = #{isTaksStock}</if>
+            <if test="deptId != null and deptId != 0"> AND t1.dept_id = #{deptId}</if>
+            <if test="isInbound != null "> AND t1.is_inbound = #{isInbound}</if>
+            <if test="isProductStatus != null "> AND t1.is_product_status = #{isProductStatus}</if>
+            <if test="lotIds != null and lotIds.size > 0">
+                AND t1.lot_id in
+                <foreach collection="lotIds" item="lotId" open="(" close=")" separator=",">
+                    #{lotId}
+                </foreach>
+            </if>
+            <if test="flags != null and flags.size() > 0">
+                AND
+                <foreach collection="flags" item="flag" separator=" OR " open="(" close=")">
+                    <if test="flag != null and flag == 2"> t1.is_amend= 1</if>
+                    <if test="flag != null and flag == 1"> t1.is_waste_recycling= 1</if>
+                    <if test="flag != null and flag == 0"> t1.is_waste= 1</if>
+                    <if test="flag != null and flag == 4"> t1.is_superaddition= 1</if>
+                    <if test="flag != null and flag == 3"> t1.is_waste= 0 and  t1.is_waste_recycling= 0 and t1.is_amend = 0 and t1.is_superaddition= 0 </if>
+                </foreach>
+            </if>
+        </trim>
+    </select>
+    <select id="getProductionPlanDetailList" resultType="cn.ezhizao.project.business.domain.BizTaksStockLot">
+        select distinct CONCAT(t2.production_plan_no, ' ', t2.product_description) AS label,t2.id as value from biz_taks_stock_lot t1 left join biz_production_plan_detail t2 on t1.production_plan_detail_id = t2.id
+        where t1.take_stock_period_id = #{takeStockPeriodId} and t1.dept_id = #{deptId} and t1.deleted = 0
+        and t1.is_taks_stock = 0 and t1.daywork_id = 0
+    </select>
+    <select id="getInfo" resultMap="BizTaksStockLotResult">
+        select t1.*,t2.product_code from biz_taks_stock_lot t1 left join biz_production_plan_detail t2 on t1.production_plan_detail_id = t2.id
+        where t1.deleted = 0 and t1.take_stock_period_id = #{id}
+    </select>
+
+    <select id="getNotTaksLot" resultType="cn.ezhizao.project.business.domain.BizTaksStockLot">
+        SELECT t1.*,t2.dept_name
+        FROM biz_taks_stock_lot t1
+        left join sys_dept t2 on t1.dept_id = t2.dept_id
+        where t1.dept_id = #{deptId} and t1.deleted = 0 and t1.take_stock_period_id = #{takeStockPeriodId} and t1.daywork_id = 0 and t1.is_taks_stock = 0 and t1.production_plan_detail_id = #{productionPlanDetailId}
+        order by t1.lot_code
+    </select>
+    <select id="getCarrierName" resultType="String">
+        select GROUP_CONCAT(t1.carrier_code SEPARATOR ',') as carrierName from biz_daywork_carrier t1 where t1.daywork_id = #{dayworkId} and t1.deleted = 0
+        and t1.is_changed = 0 and t1.process_inspection_id = 0
+    </select>
+
+
+    <!-- 根据批次号和发出单号查询biz_outsourced_order_detail表中production_dept_id为0并且根据biz_outsourced_order_detail的id查询biz_return_receipt_detail表中不存或status=0的记录,返回结果集
+-->
+<!--    <select id="getOutsourceDetailList" parameterType="BizTaksStockLot" resultMap="BizTaksStockLotResult">-->
+
+<!--        SELECT t1.* FROM biz_taks_stock_lot t1-->
+<!--        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">-->
+
+<!--        </trim>-->
+
+<!--    </select>-->
+
+    <select id="updateBatchByIdsForInbound" parameterType="BizTaksStockLot" resultMap="BizTaksStockLotResult">
+        UPDATE biz_taks_stock_lot t1
+        SET t1.is_inbound = 1
+        <trim prefix="WHERE" suffix="" suffixOverrides="AND">
+            t1.lot_id in
+            <foreach collection="lotIdsForInbound" item="lotId" open="(" close=")" separator=",">
+                 #{lotId}
+
+            </foreach>
+            AND t1.take_stock_period_id = #{takeStockPeriodId}
+        </trim>
+    </select>
+
+    <select id="getOutsourceDetailList" parameterType="BizTaksStockLot" resultMap="BizTaksStockLotResult">
+        SELECT distinct t1.*
+        FROM biz_taks_stock_lot t1
+        INNER JOIN biz_outsourced_order_detail t2 ON t1.lot_id = t2.lot_id
+        LEFT JOIN biz_return_receipt_detail t3 ON t2.id = t3.outsource_detail_id
+        LEFT JOIN biz_outsourced_order t4 ON t2.master_id = t4.id
+        <trim prefix="WHERE" suffixOverrides="AND">
+            t1.deleted = 0
+            AND t1.status &lt; 2
+            AND t1.is_taks_stock = 0
+            AND t1.is_waste = 0
+            AND t4.is_inner_outsource = 0
+            <if test="takeStockPeriodId != null and takeStockPeriodId != ''"> AND t1.take_stock_period_id = #{takeStockPeriodId}</if>
+            <if test="outsourceFormNo != null and outsourceFormNo != ''"> AND t2.form_code = #{outsourceFormNo}</if>
+            <if test="lotCode != null and lotCode != ''"> AND t1.lot_code like concat('%', #{lotCode},'%')</if>
+            AND t2.production_dept_id = 0
+            AND t2.deleted = 0
+            AND (
+            t3.id IS NULL
+            OR (t3.id IS NOT NULL AND t3.status = 0)
+            )
+        </trim>
+    </select>
+
+    <delete id="physicalDelete">
+        DELETE FROM biz_taks_stock_lot
+        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
+            <if test="id != null">
+                id = #{id} AND
+            </if>
+       <!-- 删除条件为其他外键可以在这里加 -->
+        </trim>
+    </delete>
+</mapper>