wu
2023-12-11 6272cdfab213408d753a98f25d0a26f4b6d39a9a
springboot-vue3/src/main/java/com/example/springboot/mapper/HomeMapper.java
@@ -3,9 +3,12 @@
import org.apache.ibatis.annotations.*;
import com.example.springboot.entity.CarPosition;
import com.example.springboot.entity.Glass;
import com.example.springboot.entity.StorageCage;
import com.example.springboot.entity.alarmmg;
import com.example.springboot.entity.north_glass_buffer1;
import com.example.springboot.entity.Out_slice;
import com.example.springboot.entity.Queue;
import com.example.springboot.entity.RolePermission;
import java.util.List;
@@ -32,7 +35,7 @@
  List<StorageCage> selectRack4();
  // 根据任务类型查询当前正在出片,进片的玻璃信息
  @Select("select *,concat(glasswidth,' x ',glassheight) as lengthwidth from storage_cage where state=#{task_type} limit 1")
  @Select("select * from storage_cage where state=#{task_type}")
  List<StorageCage> selectinout(@Param("task_type") Integer task_type);
  // 查询是否存在此订单
@@ -68,10 +71,10 @@
  List<alarmmg> SelectAlarmmgInfo();
  //获取理片笼内玻璃信息
  @Select("select *,concat(glasswidth,' x ',glassheight) as lengthwidth from storage_cage  ")
  List<StorageCage> SelectCageInfo(short cage);
  @Select("select * from storage_cage where position(#{cage} in ifnull(glass_id,\"\"))")
  List<StorageCage> SelectCageInfo(String cage);
  @Update("update storage_cage set state=0,glass_id=null,order_id=null,glasswidth=null,glassheight=null where glass_id=#{glassid}")
  @Update("update storage_cage set state=0,glass_id=null,order_id=null,glasswidth=null,glassheight=null,glasswidthmm=null,glassheightmm=null,listid=null,boxid=null where glass_id=#{glassid}")
  void DeleteByGlassID(String glassid);
  //查询小车位置
@@ -87,19 +90,96 @@
  StorageCage SelectGlassInfo(String glassid);
  //查询玻璃信息
  @Select("select * from glass where glassid=#{glassid}")
  Glass SelectGlassByGlassID(String glassid);
//  @Select("select * from glass where glassid=#{glassid}")
  @Select("SELECT ordernumber,listnumber,boxnumber,barcode,glasslength,glassheight,glasslength_mm,glassheight_mm FROM north_glass_buffer1 where barcode=#{barcode}")
  north_glass_buffer1 SelectGlassByGlassID(String barcode);
  //启用/禁用理片笼格子
  @Update("update storage_cage set disabled=#{disabled} where cage=#{cage} and cell=#{cell}")
  void Disabled(short cage, short cell, short disabled);
  //理片笼新增玻璃
  @Update("update storage_cage set state=1,glass_id=#{glass.glassId},order_id=#{glass.orderId},glasswidth=#{glass.width},glassheight=#{glass.height} where cage=#{cage} and cell=#{cell} and tier=#{tier}")
  void Inglassid(Glass glass, short cage, short cell, short tier);
  @Update("update storage_cage set state=1,glass_id=#{glass.glassId},order_id=#{glass.orderId},glasswidth=#{glass.glasswidth},glassheight=#{glass.glassheight},glasswidthmm=#{glass.glasswidthmm},glassheightmm=#{glass.glassheightmm},listid=#{glass.listId},boxid=#{glass.boxId} where cage=#{cage} and cell=#{cell} and tier=#{tier}")
  void Inglassid(Queue glass, short cage, short cell, short tier);
  //查询理片笼中是否有此玻璃
  @Select("select count(*) from storage_cage where glass_id=#{glassId}")
  short SelectStorageByGlassId(String glassId);
  //根据订单查询玻璃信息
  @Select("select * from north_glass_buffer1 where position(#{orderid} in ordernumber)")
  List<north_glass_buffer1> SelectGlass(String orderid);
  //获取上片队列信息
  @Select("select * from queue where id=#{id}")
  Queue GetQueueInfo(int id);
  //手动添加扫码位玻璃
  @Update("update queue set glassid=#{queue.glassId},orderid=#{queue.orderId},listId=#{queue.listId},boxId=#{queue.boxId},glasswidth=#{queue.glasswidth},glassheight=#{queue.glassheight},glasswidthmm=#{queue.glasswidthmm},glassheightmm=#{queue.glassheightmm},state=1 where id=#{id}")
  void InsertQueueGlassId(Queue queue,Short id);
  //确认扫码位玻璃信息
  @Update("update queue set state=1 where id=1")
  void UpdateQueueState();
  //手动添加扫码位玻璃
  @Update("update queue set glassid=null,orderid=null,listid=null,boxid=null,glasswidth=null,glassheight=null,glasswidthmm=null,glassheightmm=null,state=0 where id=#{id}")
  void DeleteQueueGlass(String id);
  //查询此订单在理片笼里的玻璃数
  @Select("select count(*) from storage_cage where order_id=#{orderid}")
  Short SelectGlassNo(String orderid);
  //根据玻璃id从客户表查询数据
  @Select("select * from north_glass_buffer1 where barcode=#{glassid}")
  north_glass_buffer1 SelectBoxNo(String glassid);
  //查询出片队列信息
  @Select("select * from out_slice where state=0 or state=1 or state=2 order by sequence")
  List<Out_slice> SelectProductionqueue();
  //根据玻璃id查询笼内玻璃信息
  @Select("select * from storage_cage where glass_id=#{glassid}")
  StorageCage SelectStorageGlassById(String glassid);
  //根据玻璃id删除出片队列玻璃
  @Update("update out_slice set state=4 where barcode=#{FrameNo} and (state=0 or state=1 or state=2)")
  void DeleteProductionQueueGlass(String id);
  //根据铝框id查询对应玻璃信息
  @Select("select * from north_glass_buffer1 where FrameBarcode=#{FrameBarcode}")
  List<north_glass_buffer1> SelectAluminumFrameInfoById(String FrameBarcode);
  //查询玻璃是否已存在于出片队列
  @Select("select * from out_slice where glassid=#{getbarcode} and (state=0 or state=1 or state=2)")
  Out_slice SelectQueueByglassid(String getbarcode);
  //添加出片队列
  @Insert("INSERT INTO out_slice( `glassId`, `barcode`, `glasswidth`, `glassheight`, `state`, `flip`, `sequence`, `time` ,`position`) VALUES ( #{glassid}, #{FrameNo}, #{glasslengthMm}, #{glassheightMm}, 0, #{flip}, #{sequence}, now(), #{position});")
  void AddOutSliceS(String glassid, String flip, String FrameNo, String glasslengthMm, String glassheightMm, int sequence, String position);
  //出片队列调序
  @Update("update out_slice set sequence=#{sequence} where glassid=#{glassId}")
  void UpdateOutSliceSequence(String glassId,int sequence);
  //查询出片队列最大顺序
  @Select("select ifnull(max(sequence),0)+1 from out_slice ")
  Short SelectMaxSquence();
  //查询用户权限
  @Select("select rp.* from role_permission rp inner join role r on rp.role_id=r.id and r.name=#{token} and (permission_id=32 or permission_id=33 or permission_id=34 or permission_id=35)")
  List<RolePermission> SelectPermissionByUserName(String token);
  //完成出片任务
  @Update("update out_slice set state=2 where id=#{id}")
  void CompleteQueue(String id);
  //查询铝框id对应玻璃完成数量
  @Select("select count(*) from out_slice where barcode=#{frameid} and state<2")
  Short SelectCountByFrameNo(String frameid);
  //铝框id对应玻璃改完全部完成状态
  @Update("update out_slice set state=3 where barcode=#{frameid} and state=2")
  void CompleteQueueByFrameNo(String frameid);
}