ZengTao
2024-05-10 73263f94cf46a409b0d6fd329b1caa645422379b
springboot-vue3/src/main/java/com/example/springboot/mapper/AlbaniaMapper.java
@@ -12,10 +12,10 @@
@Repository
public interface AlbaniaMapper  {
    //判断笼内是否有合适的类型空格
    @Select("select id from storage_cage where glasstype=#{glasstype} and width>=#{width}+#{widths} and state=0 and disabled=0 order by id limit 1")
    @Select("select id from storage_cage where glasstype=#{glasstype} and width>=#{width}+#{widths}  and disabled=0 order by id limit 1")
    StorageCage SelectCage(int glasstype,Double width,int widths);
    //判断笼内没有玻璃的空格
    @Select("select id from storage_cage where number=0 and cage>#{cage} and cage<#{cage2} and disabled=0 order by id limit 1")
    @Select("select id from storage_cage where (number is null or number=0) and cage>#{cage} and cage<#{cage2} and disabled=0 order by id limit 1")
    StorageCage SelectNewCell(int cage,int cage2);
    //增加玻璃数
    @Update("update storage_cage set number=number+1,width=width-glasswidth where id=#{id}")
@@ -27,8 +27,8 @@
    @Insert("INSERT INTO `albania`.`storage_task`(`task_type`, `task_state`, `shelf_rack`, `load_rack`,start_time,glass_id,glasstype,flowcard,mateid,tier) VALUES (#{tasktype},#{taskstate},#{shelfrack},#{loadrack},now(),#{glassid},#{glasstype},#{flowcard},#{mateid},#{tier});")
    void Inserttask(int tasktype, int taskstate, int shelfrack, int loadrack, String glassid, int glasstype,String flowcard,int mateid,int tier);
    //新增一条笼子数据
    @Update("UPDATE `albania`.`storage_cage` SET `glass_id` =#{glassid}, `width` =width-#{glasswidth}, `glasswidth` =#{glasswidth}, `glassheight` =#{glassheight}, `glasswidthmm` =#{glasswidthmm}, `glassheightmm` = #{glassheightmm},  `state` = #{state}, `glasstype` = #{glasstype}, `number` = #{number} WHERE `id` =#{id};")
    void AddCage(int id,String glassid,Double glasswidth,Double glassheight,Double glasswidthmm,Double glassheightmm,int state,String glasstype,int number);
    @Update("UPDATE `albania`.`storage_cage` SET `glass_id` =#{glassid}, `width` =width-#{glasswidth}, `glasswidth` =#{glasswidth}, `glassheight` =#{glassheight}, `glasswidthmm` =#{glasswidth}, `glassheightmm` = #{glassheight},  `state` = #{state}, `glasstype` = #{glasstype}, `number` = #{number} WHERE `id` =#{id};")
    void AddCage(int id,String glassid,Double glasswidth,Double glassheight,int state,int glasstype,int number);
    //获取进片数据
    @Select("select glassid,flowcard,glasswidth as width,glassheight as height,glasswidthmm,glassheightmm,glasstype,thickness  from queue where state=1 limit 1")
    GlassInfo SelectGlass();
@@ -57,10 +57,15 @@
    @Select("select method from flowcard where state=1 and line=#{line} ORDER BY starttime LIMIT 1;")
    GlassInfo SelectMethod(int line);
    //直出模式任务查询
    @Select("select b.flowcard,b.glasstype,b.mateid,a.totaltier as id,IFNULL(c.number,0)as number,b.glassid from flowcard a  left join glassinfo b on a.flowcard=b.flowcard left join(select sum(number)as number,glasstype from storage_cage GROUP BY glasstype)c on b.glasstype=c.glasstype where a.line=#{line} and c.number>0")
    @Select("select b.flowcard,b.glassid,b.glasstype,b.mateid,b.width,b.tier,a.totaltier as id,IFNULL(c.number,0)as number,b.glassid from flowcard a  left join glassinfo b on a.flowcard=b.flowcard left join(select sum(number)as number,glasstype from storage_cage GROUP BY glasstype)c on b.glasstype=c.glasstype where a.line=#{line} and c.number>0 limit 1")
    GlassInfo SelectOutGlass2(int line);
    //查询直通模式下最后一块
    @Select("select b.tier from flowcard a  left join glassinfo b on a.flowcard=b.flowcard left join(select sum(number)as number,glasstype from storage_cage GROUP BY glasstype)c on b.glasstype=c.glasstype where a.line=2 and c.number>0 ORDER BY b.tier desc LIMIT 1")
    int SelectOutGlassend(int line);
    //增加笼子表宽高
    @Select("update storage_cage a set a.glasswidth=#{width},a.glassheight=#{height} where id=#{id} ")
    void UpdateStorage(double width,double height,int id);
    //更改队列表状态
    @Update("update queue set state=2 where glassid=#{glassid};")
    void UpdateQueueState(String glassid);