| | |
| | | } |
| | | |
| | | @RequestMapping("/viewLocMapList.action") |
| | | public R queryViewLocMapListByPages(@RequestParam(defaultValue = "1")Integer row){ |
| | | public R queryViewLocMapListByPages(@RequestParam(defaultValue = "0")Integer row){ |
| | | // 获取排级数据 |
| | | // 表格标题:列 ===>> 升序 |
| | | List<String> bays = reportQueryMapper.getViewLocBayCount(row); |
| | |
| | | @TableField("out_ok") |
| | | private String outOk; |
| | | |
| | | @ApiModelProperty(value= "高低类型{0:未知,1:低库位,2:高库位}") |
| | | @ApiModelProperty(value= "高低类型{0:未知,1:低库位,2:高库位,3:中库位}") |
| | | @TableField("loc_type1") |
| | | private Short locType1; |
| | | |
| | |
| | | return "低库位"; |
| | | case 2: |
| | | return "高库位"; |
| | | case 3: |
| | | return "中库位"; |
| | | default: |
| | | return String.valueOf(this.locType1); |
| | | } |
| | |
| | | @TableField("loc_type") |
| | | private String locType; |
| | | |
| | | @ApiModelProperty(value= "高低类型{0:未知,1:低库位,2:高库位}") |
| | | @ApiModelProperty(value= "高低类型{0:未知,1:低库位,2:高库位,3:中库位}") |
| | | @TableField("loc_type1") |
| | | private Short locType1; |
| | | |
| | |
| | | return "低库位"; |
| | | case 2: |
| | | return "高库位"; |
| | | case 3: |
| | | return "中库位"; |
| | | default: |
| | | return String.valueOf(this.locType1); |
| | | } |
| New file |
| | |
| | | package com.zy.asrs.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import com.core.common.Cools; |
| | | import com.core.common.SpringUtils; |
| | | import com.zy.system.entity.User; |
| | | import com.zy.system.service.UserService; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.io.Serializable; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | @TableName("asr_loc_rule") |
| | | public class LocRule implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * ID |
| | | */ |
| | | @ApiModelProperty(value= "ID") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 商品编号 |
| | | */ |
| | | @ApiModelProperty(value= "商品编号") |
| | | private String matnr; |
| | | |
| | | /** |
| | | * 规格 |
| | | */ |
| | | @ApiModelProperty(value= "规格") |
| | | private String specs; |
| | | |
| | | /** |
| | | * 型号 |
| | | */ |
| | | @ApiModelProperty(value= "型号") |
| | | private String model; |
| | | |
| | | /** |
| | | * 客户 |
| | | */ |
| | | @ApiModelProperty(value= "客户") |
| | | private String cstmr; |
| | | |
| | | /** |
| | | * 批号 |
| | | */ |
| | | @ApiModelProperty(value= "批号") |
| | | private String batch; |
| | | |
| | | /** |
| | | * 其他 |
| | | */ |
| | | @ApiModelProperty(value= "其他") |
| | | private String other; |
| | | |
| | | /** |
| | | * 开始排 |
| | | */ |
| | | @ApiModelProperty(value= "开始排") |
| | | @TableField("row_beg") |
| | | private Integer rowBeg; |
| | | |
| | | /** |
| | | * 结束排 |
| | | */ |
| | | @ApiModelProperty(value= "结束排") |
| | | @TableField("row_end") |
| | | private Integer rowEnd; |
| | | |
| | | /** |
| | | * 开始列 |
| | | */ |
| | | @ApiModelProperty(value= "开始列") |
| | | @TableField("bay_beg") |
| | | private Integer bayBeg; |
| | | |
| | | /** |
| | | * 结束列 |
| | | */ |
| | | @ApiModelProperty(value= "结束列") |
| | | @TableField("bay_end") |
| | | private Integer bayEnd; |
| | | |
| | | /** |
| | | * 开始层 |
| | | */ |
| | | @ApiModelProperty(value= "开始层") |
| | | @TableField("lev_beg") |
| | | private Integer levBeg; |
| | | |
| | | /** |
| | | * 结束层 |
| | | */ |
| | | @ApiModelProperty(value= "结束层") |
| | | @TableField("lev_end") |
| | | private Integer levEnd; |
| | | |
| | | /** |
| | | * 上限 |
| | | */ |
| | | @ApiModelProperty(value= "上限") |
| | | private Integer limit; |
| | | |
| | | /** |
| | | * 状态 1: 正常 0: 禁用 |
| | | */ |
| | | @ApiModelProperty(value= "状态 1: 正常 0: 禁用 ") |
| | | private Integer status; |
| | | |
| | | /** |
| | | * 添加人员 |
| | | */ |
| | | @ApiModelProperty(value= "添加人员") |
| | | @TableField("create_by") |
| | | private Long createBy; |
| | | |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @ApiModelProperty(value= "添加时间") |
| | | @TableField("create_time") |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | private Date createTime; |
| | | |
| | | /** |
| | | * 修改人员 |
| | | */ |
| | | @ApiModelProperty(value= "修改人员") |
| | | @TableField("update_by") |
| | | private Long updateBy; |
| | | |
| | | /** |
| | | * 修改时间 |
| | | */ |
| | | @ApiModelProperty(value= "修改时间") |
| | | @TableField("update_time") |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | private Date updateTime; |
| | | |
| | | /** |
| | | * 备注 |
| | | */ |
| | | @ApiModelProperty(value= "备注") |
| | | private String memo; |
| | | |
| | | public LocRule() {} |
| | | |
| | | public LocRule(String matnr, String specs, String model, String cstmr, String batch, String other, Integer rowBeg, Integer rowEnd, Integer bayBeg, Integer bayEnd, Integer levBeg, Integer levEnd, Integer limit, Integer status, Long createBy, Date createTime, Long updateBy, Date updateTime, String memo) { |
| | | this.matnr = matnr; |
| | | this.specs = specs; |
| | | this.model = model; |
| | | this.cstmr = cstmr; |
| | | this.batch = batch; |
| | | this.other = other; |
| | | this.rowBeg = rowBeg; |
| | | this.rowEnd = rowEnd; |
| | | this.bayBeg = bayBeg; |
| | | this.bayEnd = bayEnd; |
| | | this.levBeg = levBeg; |
| | | this.levEnd = levEnd; |
| | | this.limit = limit; |
| | | this.status = status; |
| | | this.createBy = createBy; |
| | | this.createTime = createTime; |
| | | this.updateBy = updateBy; |
| | | this.updateTime = updateTime; |
| | | this.memo = memo; |
| | | } |
| | | |
| | | // LocRule locRule = new LocRule( |
| | | // null, // 商品编号 |
| | | // null, // 规格 |
| | | // null, // 型号 |
| | | // null, // 客户 |
| | | // null, // 批号 |
| | | // null, // 其他 |
| | | // null, // 开始排 |
| | | // null, // 结束排 |
| | | // null, // 开始列 |
| | | // null, // 结束列 |
| | | // null, // 开始层 |
| | | // null, // 结束层 |
| | | // null, // 上限 |
| | | // null, // 状态 |
| | | // null, // 添加人员 |
| | | // null, // 添加时间 |
| | | // null, // 修改人员 |
| | | // null, // 修改时间 |
| | | // null // 备注 |
| | | // ); |
| | | |
| | | public String getStatus$(){ |
| | | if (null == this.status){ return null; } |
| | | switch (this.status){ |
| | | case 1: |
| | | return "正常"; |
| | | case 0: |
| | | return "禁用"; |
| | | default: |
| | | return String.valueOf(this.status); |
| | | } |
| | | } |
| | | |
| | | public String getCreateBy$(){ |
| | | UserService service = SpringUtils.getBean(UserService.class); |
| | | User user = service.selectById(this.createBy); |
| | | if (!Cools.isEmpty(user)){ |
| | | return String.valueOf(user.getNickname()); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public String getCreateTime$(){ |
| | | if (Cools.isEmpty(this.createTime)){ |
| | | return ""; |
| | | } |
| | | return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.createTime); |
| | | } |
| | | |
| | | public String getUpdateBy$(){ |
| | | UserService service = SpringUtils.getBean(UserService.class); |
| | | User user = service.selectById(this.updateBy); |
| | | if (!Cools.isEmpty(user)){ |
| | | return String.valueOf(user.getNickname()); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public String getUpdateTime$(){ |
| | | if (Cools.isEmpty(this.updateTime)){ |
| | | return ""; |
| | | } |
| | | return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.updateTime); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | this.bgc = "#bac296"; |
| | | this.color = "#fff"; |
| | | break; |
| | | case "G": |
| | | this.bgc = "#90EE90"; // 浅绿色 |
| | | this.color = "#000"; // 字体颜色(建议深色以保证对比度) |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | |
| | | // 堆垛机数量 |
| | | private Integer crnAmount; |
| | | |
| | | // 高低类型: 1:低库位 2:高库位 |
| | | // 高低类型:0:未知,1:低库位,2:高库位,3:中库位 |
| | | private Short locType1; |
| | | |
| | | // 宽窄类型: 1:窄库位 2:宽库位 |
| | |
| | | @Select("SELECT ld.loc_no FROM asr_loc_detl ld LEFT JOIN asr_loc_mast lm ON ld.loc_no = lm.loc_no WHERE (1 = 1 AND ld.matnr = #{matnr} AND (lm.row1 >= #{start} AND lm.row1 <= #{end}) AND lm.loc_sts = 'F' AND DateDiff(dd, ld.appe_time, getdate()) = 0) ORDER BY ld.appe_time ASC") |
| | | List<String> selectSameDetlToday(@Param("matnr") String matnr, @Param("start") Integer start, @Param("end") Integer end); |
| | | |
| | | List<String> selectSameDetlTodayBatch(@Param("matnr") String matnr,@Param("batch") String batch, @Param("start") Integer start, @Param("end") Integer end); |
| | | List<LocDetl> selectSameDetlTodayBatch(@Param("matnr") String matnr,@Param("batch") String batch, @Param("start") Integer start, @Param("end") Integer end); |
| | | |
| | | List<LocDetl> getStockStatis(Map<String, Object> map); |
| | | |
| | |
| | | // LocMast selectLocByLocStsPakInO2(@Param("locNos") List<String> locNos,@Param("whsType") Long whsType); |
| | | |
| | | LocMast selectLocByLocStsPakInO2(@Param("crnNo") Integer crnNo,@Param("bay") Integer bay,@Param("lev") Integer lev,@Param("gro") Integer gro,@Param("whsType") Long whsType); |
| | | |
| | | List<LocMast> queryFreeLocMast2(Short locType1, Integer rowBeg, Integer rowEnd, Integer bayBeg, Integer bayEnd, Integer levBeg, Integer levEnd); |
| | | } |
| New file |
| | |
| | | package com.zy.asrs.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.zy.asrs.entity.LocRule; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | @Mapper |
| | | @Repository |
| | | public interface LocRuleMapper extends BaseMapper<LocRule> { |
| | | |
| | | } |
| | |
| | | * @param batch 批次号 |
| | | * @return locNo 库位号 |
| | | */ |
| | | List<String> getSameDetlToday(String matnr, String batch, Integer start, Integer end); |
| | | List<LocDetl> getSameDetlToday(String matnr, String batch, Integer start, Integer end); |
| | | |
| | | Page<LocDetl> getStockStatis(Page<LocDetl> page); |
| | | |
| | |
| | | // LocMast selectLocByLocStsPakInO(Integer curRow,Integer nearRow,List<String> locNos); |
| | | // LocMast selectLocByLocStsPakInO(Integer curRow,Integer nearRow,List<String> locNos, Long whsType); |
| | | LocMast selectLocByLocStsPakInO(Integer curRow,Integer nearRow,LocMast locNoo, Long whsType); |
| | | |
| | | /* |
| | | 检索库位 |
| | | */ |
| | | List<LocMast> queryFreeLocMast2(Short locType1, Integer rowBeg, Integer rowEnd, Integer bayBeg, Integer bayEnd, Integer levBeg, Integer levEnd); |
| | | |
| | | } |
| New file |
| | |
| | | package com.zy.asrs.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.zy.asrs.entity.LocRule; |
| | | |
| | | public interface LocRuleService extends IService<LocRule> { |
| | | |
| | | LocRule find(String matnr, String batch, int startRow, int endRow); |
| | | |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<String> getSameDetlToday(String matnr,String batch, Integer start, Integer end) { |
| | | public List<LocDetl> getSameDetlToday(String matnr,String batch, Integer start, Integer end) { |
| | | return this.baseMapper.selectSameDetlTodayBatch(matnr,batch, start, end); |
| | | } |
| | | |
| | |
| | | } |
| | | return this.baseMapper.selectLocShuttleMoveUnilateralN(bay,lev,type); |
| | | } |
| | | |
| | | @Override |
| | | public List<LocMast> queryFreeLocMast2(Short locType1, Integer rowBeg, Integer rowEnd, Integer bayBeg, Integer bayEnd, Integer levBeg, Integer levEnd) { |
| | | return this.baseMapper.queryFreeLocMast2(locType1, rowBeg, rowEnd, bayBeg, bayEnd, levBeg, levEnd); |
| | | } |
| | | } |
| New file |
| | |
| | | package com.zy.asrs.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.core.common.Cools; |
| | | import com.zy.asrs.entity.LocRule; |
| | | import com.zy.asrs.entity.Mat; |
| | | import com.zy.asrs.mapper.LocRuleMapper; |
| | | import com.zy.asrs.service.LocRuleService; |
| | | import com.zy.asrs.service.MatService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service("locRuleService") |
| | | public class LocRuleServiceImpl extends ServiceImpl<LocRuleMapper, LocRule> implements LocRuleService { |
| | | |
| | | @Autowired |
| | | private MatService matService; |
| | | |
| | | @Override |
| | | public LocRule find(String matnr, String batch, int startRow, int endRow) { |
| | | if (Cools.isEmpty(matnr)) { |
| | | return null; |
| | | } |
| | | Mat mat = matService.selectByMatnr(matnr); |
| | | if (Cools.isEmpty(mat)) { |
| | | return null; |
| | | } |
| | | LocRule locRule = null; |
| | | do { |
| | | locRule = this.selectOne(new EntityWrapper<LocRule>().eq("matnr", matnr).ge("row_beg", startRow).le("row_end", endRow).eq("status", 1)); |
| | | if (null != locRule) { |
| | | break; |
| | | } |
| | | locRule = this.selectOne(new EntityWrapper<LocRule>().eq("specs", mat.getSpecs()).ge("row_beg", startRow).le("row_end", endRow).eq("status", 1)); |
| | | if (null != locRule) { |
| | | break; |
| | | } |
| | | locRule = this.selectOne(new EntityWrapper<LocRule>().eq("model", mat.getModel()).ge("row_beg", startRow).le("row_end", endRow).eq("status", 1)); |
| | | if (null != locRule) { |
| | | break; |
| | | } |
| | | locRule = this.selectOne(new EntityWrapper<LocRule>().eq("batch", batch).ge("row_beg", startRow).le("row_end", endRow).eq("status", 1)); |
| | | if (null != locRule) { |
| | | break; |
| | | } |
| | | } while (false); |
| | | return locRule; |
| | | } |
| | | } |
| | |
| | | @Data |
| | | public class LocTypeDto { |
| | | |
| | | // 高低类型{0:未知,1:低库位,2:高库位} |
| | | // 高低类型{0:未知,1:低库位,2:高库位,3:中库位} |
| | | private Short locType1; |
| | | |
| | | // 宽窄类型{0:未知,1:窄库位,2:宽库位} |
| | |
| | | } |
| | | |
| | | public LocTypeDto(BasDevp basDevp) { |
| | | this.locType1 = 1; // 低库位 |
| | | if (basDevp.getLocType1() == null || basDevp.getLocType1() == 0) { |
| | | throw new CoolException("plc高低检测异常"); |
| | | } |
| | | if (basDevp.getLocType1() == 1) { |
| | | this.locType1 = 1; // 低库位 |
| | | } else { |
| | | this.locType1 = 2; // 高库位 |
| | | } |
| | | log.info(JSON.toJSONString(this)); |
| | | } |
| | | |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.concurrent.atomic.AtomicReference; |
| | | |
| | |
| | | private SlaveProperties slaveProperties; |
| | | @Autowired |
| | | private WrkDetlService wrkDetlService; |
| | | |
| | | @Autowired |
| | | private LocRuleService locRuleService; |
| | | /** |
| | | * 生成工作号 |
| | | * |
| | |
| | | case 4: |
| | | return getLocNoRun4(whsType, staDescId, sourceStaNo, matnr, batch, grade, 4, locTypeDto, 0); |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | | log.error("站点={} 未查询到对应的规则", sourceStaNo); |
| | | } catch (CoolException ex) { |
| | | log.error("入库失败,错误信息: {}", ex.getMessage(), ex); |
| | | } |
| | | return null; |
| | | } |
| | |
| | | } |
| | | |
| | | public StartupDto getLocNoRun4(Integer whsType, Integer staDescId, Integer sourceStaNo, String matnr, String batch, String grade, Integer moveCrnNo, LocTypeDto locTypeDto, int times) { |
| | | int rowCount = 0; //轮询轮次 |
| | | int crnNo = 0; |
| | | int crnNo = 1;//小车编号备用 |
| | | RowLastno rowLastno = rowLastnoService.selectById(4); |
| | | LocMast locMast = null; // 目标库位 |
| | | StartupDto startupDto = new StartupDto(); |
| | | int MaxBay = rowLastno.getCurrentRow(); |
| | | int sRow = rowLastno.getsRow(); |
| | | int eRow = rowLastno.geteRow(); |
| | | //满版空板入库规则 |
| | | switch (staDescId){ |
| | | //全板 |
| | | case 1: |
| | | // 从第 3 列开始 轮询每一列 |
| | | int currentBay = 1; |
| | | while (currentBay <= MaxBay) { // |
| | | locMast = locMastService.selectOne(new EntityWrapper<LocMast>() |
| | | .ge("row1", sRow) // 排范围:起始到结束 |
| | | .le("row1", eRow) |
| | | .ne("row1", 8) // 排除第8排 |
| | | .eq("loc_sts", "O") // 空库位 |
| | | .eq("bay1", currentBay) // 当前列 |
| | | .eq("loc_type1", locTypeDto.getLocType1()) |
| | | .orderBy("row1 ASC, lev1 ASC")); // 按排和层排序 |
| | | |
| | | if (!Cools.isEmpty(locMast)) { |
| | | // 检查是否符合商品编号和批号规则 |
| | | LocDetl locDetl = locDetlService.selectOne(new EntityWrapper<LocDetl>() |
| | | .eq("loc_no", locMast.getLocNo()) |
| | | .andNew() |
| | | .eq("matnr", matnr) |
| | | .eq("batch", batch)); |
| | | |
| | | if (!Cools.isEmpty(matnr) && staDescId != 10) { |
| | | int lev = 0; |
| | | // List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>().eq("matnr", matnr)); |
| | | // if (!Cools.isEmpty(locDetls)){ |
| | | // for (LocDetl locDetl : locDetls){ |
| | | // if (locMast != null){ |
| | | // break; |
| | | // } |
| | | // LocMast locMast1 = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", locDetl.getLocNo())); |
| | | // if (Cools.isEmpty(locMast1)) { |
| | | // continue; |
| | | // } |
| | | // if (locMast1.getLev1() != lev && locMast1.getLev1() !=3) { |
| | | // List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | // .eq("lev1", locMast1.getLev1()) |
| | | // .orderBy("bay1",false)); |
| | | // if (Cools.isEmpty(locMasts)){ |
| | | // throw new CoolException("数据异常,请联系管理员===》库位未知"); |
| | | // } |
| | | // for (LocMast locMast2 : locMasts) { |
| | | // if (locMast2.getLocSts().equals("O") ) { |
| | | // if (locMast == null){ |
| | | // locMast = locMast2; |
| | | // } |
| | | // }else if (locMast2.getLocSts().equals("F")){ |
| | | // locMast = null; |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | // if(Cools.isEmpty(locMast)){ |
| | | // List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | // .eq("lev1", 1) |
| | | // .orderBy("bay1",false)); |
| | | // for (LocMast locMast2 : locMasts) { |
| | | // if (locMast2.getLocSts().equals("O") ) { |
| | | // if (locMast == null){ |
| | | // locMast = locMast2; |
| | | // } |
| | | // }else if (locMast2.getLocSts().equals("F")){ |
| | | // locMast = null; |
| | | // } |
| | | // } |
| | | // } |
| | | // if(Cools.isEmpty(locMast)){ |
| | | // List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | // .eq("lev1", 2) |
| | | // .orderBy("bay1",false)); |
| | | // for (LocMast locMast2 : locMasts) { |
| | | // if (locMast2.getLocSts().equals("O") ) { |
| | | // if (locMast == null){ |
| | | // locMast = locMast2; |
| | | // } |
| | | // }else if (locMast2.getLocSts().equals("F")){ |
| | | // locMast = null; |
| | | // } |
| | | // } |
| | | // } |
| | | // }else { |
| | | for (int i = 1; i <= 2; i++) { |
| | | if (locMast != null) { |
| | | break; |
| | | } |
| | | // List<LocMast> locMastsF = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | // .eq("lev1", i) |
| | | // .eq("loc_sts", "F")); |
| | | // if (!Cools.isEmpty(locMastsF)) { |
| | | // continue; |
| | | // } |
| | | List<LocMast> locMastsR = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | .eq("lev1", i) |
| | | .eq("loc_sts", "R")); |
| | | if (!Cools.isEmpty(locMastsR)) { |
| | | WrkMast wrkMast = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("loc_no", locMastsR.get(0).getLocNo())); |
| | | if (Cools.isEmpty(wrkMast)) { |
| | | continue; |
| | | } |
| | | List<WrkDetl> wrkDetls = wrkDetlService.selectByWrkNo(wrkMast.getWrkNo()); |
| | | if (!wrkDetls.get(0).getMatnr().equals(matnr)) { |
| | | continue; |
| | | } |
| | | } |
| | | List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | .eq("lev1", i) |
| | | .orderBy("bay1", false)); |
| | | if (Cools.isEmpty(locMasts)) { |
| | | throw new CoolException("数据异常,请联系管理员===》库位未知"); |
| | | } |
| | | for (LocMast locmast3 : locMasts) { |
| | | if (locmast3.getLocSts().equals("O")) { |
| | | if (locMast == null) { |
| | | locMast = locmast3; |
| | | if (Cools.isEmpty(locDetl) || (matnr.equals(locDetl.getMatnr()) && batch.equals(locDetl.getBatch()))) { |
| | | // 找到符合条件的库位,跳出循环 |
| | | break; |
| | | } |
| | | } else if (locmast3.getLocSts().equals("F")) { |
| | | locMast = null; |
| | | } |
| | | |
| | | // 当前列无空位,检查下一列 |
| | | currentBay++; |
| | | } |
| | | // ③ 如果第一排全满,检索第8排 |
| | | if (Cools.isEmpty(locMast)) { |
| | | for (int bay = 1; bay <= MaxBay; bay++) { |
| | | locMast = locMastService.selectOne(new EntityWrapper<LocMast>() |
| | | .eq("row1", 8) // 第8排 |
| | | .eq("loc_sts", "O") // 空库位状态 |
| | | .eq("bay1", bay) // 当前列 |
| | | .orderBy("lev1 ASC")); // 按层排序 |
| | | |
| | | if (!Cools.isEmpty(locMast)) { |
| | | break; // 找到符合条件的库位,退出循环 |
| | | } |
| | | } |
| | | } |
| | | } |
| | | // } |
| | | } else { |
| | | //空板入库 |
| | | List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | .eq("lev1", 3) |
| | | .orderBy("bay1", true)); |
| | | if (Cools.isEmpty(locMasts)) { |
| | | throw new CoolException("数据异常,请联系管理员===》库位未知"); |
| | | } |
| | | for (LocMast locmast : locMasts) { |
| | | if (locmast.getLocSts().equals("O")) { |
| | | if (locMast == null) { |
| | | locMast = locmast; |
| | | } |
| | | } else if (locmast.getLocSts().equals("D")) { |
| | | locMast = null; |
| | | |
| | | // 如果没有找到符合条件的库位 |
| | | if (Cools.isEmpty(locMast)) { |
| | | log.error("系统没有空库位!!! 尺寸规格: {},", JSON.toJSONString(locTypeDto)); |
| | | throw new CoolException("没有空库位"); |
| | | } |
| | | } |
| | | break; |
| | | // 空板规则 |
| | | case 10: |
| | | // ① 优先检索第1排所有列状态为 "D" 的库位 |
| | | // 标签,用于跳出外层循环 |
| | | outerLoop: |
| | | for (int bay = 1; bay <= MaxBay; bay++) { |
| | | locMast = locMastService.selectOne(new EntityWrapper<LocMast>() |
| | | .eq("row1", sRow) // 第一排 |
| | | .eq("loc_sts", "D") // 空板状态 |
| | | .eq("bay1", bay) // 当前列 |
| | | .ne("row1", 8) // 排除第8排 |
| | | .orderBy("lev1 ASC")); // 按层排序 |
| | | |
| | | if (!Cools.isEmpty(locMast)) { |
| | | // 从当前列找到状态为 "D" 的库位后,向外依次检索排 |
| | | for (int row = sRow + 1; row <= eRow; row++) { // 从第二排开始 |
| | | LocMast potentialLoc = locMastService.selectOne(new EntityWrapper<LocMast>() |
| | | .eq("row1", row) // 当前排 |
| | | .eq("loc_sts", "O") // 空库位状态 |
| | | .eq("bay1", bay) // 当前列 |
| | | .ne("row1", 8) // 排除第8排 |
| | | .eq("lev1",locMast.getLev1())); //当前层 |
| | | |
| | | if (!Cools.isEmpty(potentialLoc)) { |
| | | locMast = potentialLoc; // 更新为找到的空库位 |
| | | break outerLoop; // 找到符合条件的库位,跳出外层循环 |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | // ② 如果第1排没有找到 "D",检索状态为 "O" 的库位 |
| | | if (Cools.isEmpty(locMast)) { |
| | | for (int bay = 1; bay <= MaxBay; bay++) { |
| | | locMast = locMastService.selectOne(new EntityWrapper<LocMast>() |
| | | .eq("row1", sRow) // 第一排 |
| | | .eq("loc_sts", "O") // 空库位状态 |
| | | .eq("bay1", bay) // 当前列 |
| | | .orderBy("lev1 ASC")); // 按层排序 |
| | | |
| | | if (!Cools.isEmpty(locMast)) { |
| | | break; // 找到符合条件的库位,退出循环 |
| | | } |
| | | } |
| | | } |
| | | |
| | | // ③ 如果第一排全满,检索第8排 |
| | | if (Cools.isEmpty(locMast)) { |
| | | for (int bay = 1; bay <= MaxBay; bay++) { |
| | | locMast = locMastService.selectOne(new EntityWrapper<LocMast>() |
| | | .eq("row1", 8) // 第8排 |
| | | .eq("loc_sts", "O") // 空库位状态 |
| | | .eq("bay1", bay) // 当前列 |
| | | .orderBy("lev1 ASC")); // 按层排序 |
| | | |
| | | if (!Cools.isEmpty(locMast)) { |
| | | break; // 找到符合条件的库位,退出循环 |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 如果仍然没有找到符合条件的库位 |
| | | if (Cools.isEmpty(locMast)) { |
| | | log.error("系统没有空库位!!! 尺寸规格: {},", JSON.toJSONString(locTypeDto)); |
| | | throw new CoolException("没有空库位"); |
| | | } |
| | | break; |
| | | |
| | | default: |
| | | throw new CoolException("不支持的库位规则类型: " + staDescId); |
| | | |
| | | } |
| | | |
| | | |
| | | // 递归查询 |
| | | if (Cools.isEmpty(locMast) || !locMast.getLocSts().equals("O")) { |
| | | // 当前巷道无空库位时,递归调整至下一巷道,检索全部巷道无果后,跳出递归 |
| | | if (times < rowCount * 2) { |
| | | times = times + 1; |
| | | return getLocNoRun4(whsType, staDescId, sourceStaNo, matnr, batch, grade, moveCrnNo, locTypeDto, times); |
| | | } |
| | | log.error("系统没有空库位!!! 尺寸规格: {}, 轮询次数:{}", JSON.toJSONString(locTypeDto), times); |
| | | throw new CoolException("没有空库位"); |
| | | } |
| | | // 返回找到的库位 |
| | | String locNo = locMast.getLocNo(); |
| | | |
| | | // 生成工作号 |
| | | int workNo = getWorkNo(0); |
| | | // 返回dto |
| | | startupDto.setWorkNo(workNo); |
| | | startupDto.setCrnNo(1); |
| | | startupDto.setCrnNo(locMast.getCrnNo()); |
| | | startupDto.setSourceStaNo(sourceStaNo); |
| | | startupDto.setLocNo(locNo); |
| | | |
| | | return startupDto; |
| | | } |
| | | |
| | |
| | | public synchronized Re getLocNo(@RequestBody SearchLocParam param) { |
| | | log.info("收到WCS入库接口请求====>>入参:{}", param); |
| | | if (Cools.isEmpty(param.getCargoHeight())) { |
| | | return Re.error("入出库类型不能为空"); |
| | | return Re.error("高低库类型不能为空"); |
| | | } |
| | | if (Cools.isEmpty(param.getFromPort())) { |
| | | return Re.error("源站编号不能为空"); |
| | | } |
| | | List<WaitPakin> waitPakins = null; |
| | | if (param.getFromPort().equals("100")) { |
| | | if (param.getFromPort().equals("101")) { |
| | | |
| | | //有空板出库时禁止入库 |
| | | int wrkCount = wrkMastService.selectCount(new EntityWrapper<WrkMast>().eq("io_type",110).eq("sta_no",100).notIn("wrk_sts",7)); |
| | |
| | | return Re.error("有空板出库到100站时时禁止入库"); |
| | | } |
| | | |
| | | if (Cools.isEmpty(param.getBarCode())) { |
| | | if (Cools.isEmpty(param.getBarCode()) && param.getIoType() != 10) { |
| | | return Re.error("条码不能为空"); |
| | | } |
| | | waitPakins = waitPakinService.selectList(new EntityWrapper<WaitPakin>().eq("zpallet", param.getBarCode())); |
| | | if (Cools.isEmpty(waitPakins)) { |
| | | if (Cools.isEmpty(waitPakins) && param.getIoType() != 10) { |
| | | WrkMast wrkMast = wrkMastService.selectByBarcode(param.getBarCode()); |
| | | if (wrkMast != null && wrkMast.getIoType() == 103) { |
| | | return Re.parse(CodeRes.PICK_600); |
| | |
| | | } |
| | | }else { |
| | | //有满板出库时禁止空板入库 |
| | | int wrkCount = wrkMastService.selectCount(new EntityWrapper<WrkMast>().eq("sta_no",200).andNew().eq("io_type",101).or().eq("io_type",110)); |
| | | int wrkCount = wrkMastService.selectCount(new EntityWrapper<WrkMast>().eq("sta_no",100).andNew().eq("io_type",101).or().eq("io_type",110)); |
| | | if(wrkCount > 0){ |
| | | return Re.error("有满板出库时禁止空板入库"); |
| | | } |
| | |
| | | LocTypeDto locTypeDto = new LocTypeDto(sourceStaNo); |
| | | |
| | | StartupDto dto = null; |
| | | switch (param.getFromPort()) { |
| | | case "100"://满托盘入库 |
| | | switch (param.getIoType()) { |
| | | case 1://满托盘入库 |
| | | assert waitPakins != null; |
| | | dto = startupFullPutStore(Integer.valueOf(param.getFromPort()), param.getBarCode(), locTypeDto, waitPakins); |
| | | break; |
| | | case "200"://空托盘入库 |
| | | case 10://空托盘入库 |
| | | dto = emptyPlateIn(Integer.valueOf(param.getFromPort()), locTypeDto, param.getBarCode()); |
| | | break; |
| | | default: |
| | |
| | | List<String> matnrs = waitPakins.stream().map(WaitPakin::getMatnr).distinct().collect(Collectors.toList()); |
| | | List<String> batchs = waitPakins.stream().map(WaitPakin::getBatch).distinct().collect(Collectors.toList()); |
| | | StartupDto dto = commonService.getLocNo(1, devpNo, matnrs.get(0), batchs.get(0), null, locTypeDto); |
| | | if(dto == null){ |
| | | throw new CoolException("没有检索到空库位"); |
| | | } |
| | | int workNo = dto.getWorkNo(); |
| | | Date now = new Date(); |
| | | // 生成工作档 |
| | |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.fasterxml.jackson.annotation.JsonProperty; |
| | | import com.fasterxml.jackson.annotation.ObjectIdGenerators; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | |
| | | */ |
| | | private double cargoWeight; |
| | | |
| | | /** |
| | | * 入库模式 |
| | | * 1,全板 10,空板 |
| | | */ |
| | | private Integer ioType; |
| | | |
| | | |
| | | |
| | | // // 库位规格( 0:未知, 1:低库位, 2:高库位) |
| | |
| | | server: |
| | | port: 8085 |
| | | port: 8090 |
| | | servlet: |
| | | context-path: /@pom.build.finalName@ |
| | | |
| | |
| | | enabled: false |
| | | datasource: |
| | | driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver |
| | | url: jdbc:sqlserver://127.0.0.1:1433;databasename=wzjaasrs |
| | | url: jdbc:sqlserver://127.0.0.1:1433;databasename=ddthasrs |
| | | username: sa |
| | | password: sa@123 |
| | | mvc: |
| | |
| | | |
| | | #License相关配置 |
| | | license: |
| | | subject: wzjaasrs |
| | | subject: ddthasrs |
| | | publicAlias: publicCert |
| | | storePass: public_zhongyang_123456789 |
| | | licensePath: license.lic |
| | |
| | | # 双深 |
| | | doubleDeep: true |
| | | # 双深库位排号 |
| | | doubleLocs: 1,4,5,8,9,12,13,16 |
| | | doubleLocs: 1,2,3,4,5 |
| | | # 一个堆垛机负责的货架排数 |
| | | groupCount: 4 |
| | | # 左深库位排号 |
| | | doubleLocsLeft: 1,5,9,13 |
| | | # 右深库位排号 |
| | | doubleLocsRight: 4,8,12,16 |
| | | #是否开启wms下发任务给wcs |
| | | workIssued-fig : true |
| | | #地址 |
| | | url : 192.168.110.100:8082 |
| | | url : localhost:8082 |
| | | #wms下发任务给wcs |
| | | workIssued : fromWms/taskReceive |
| | | #库位同步 |
| | | loc: fromWms/cargoNoSyn |
| | | #入库站 |
| | | inDevp : 100 |
| | | inDevp : 101 |
| | | #出库站 |
| | | outDevp : 200 |
| | | outDevp : 100 |
| | | # wms参数配置 |
| | | wms-parameter: |
| | | # 自动补空板功能开关 |
| | |
| | | INNER JOIN man_mat b ON a.matnr=#{matnrOld} AND b.matnr=#{matnr}; |
| | | </update> |
| | | |
| | | <select id="selectSameDetlTodayBatch" resultType="java.lang.String"> |
| | | SELECT ld.loc_no FROM asr_loc_detl ld |
| | | <select id="selectSameDetlTodayBatch" resultMap="BaseResultMap"> |
| | | SELECT * FROM asr_loc_detl ld |
| | | LEFT JOIN asr_loc_mast lm ON ld.loc_no = lm.loc_no |
| | | WHERE 1 = 1 |
| | | AND ld.matnr = #{matnr} |
| | |
| | | AND loc_sts in ('O') order by row1 |
| | | </select> |
| | | |
| | | <select id="queryFreeLocMast2" resultMap="BaseResultMap"> |
| | | select * |
| | | from asr_loc_mast |
| | | where 1=1 |
| | | and loc_sts='O' |
| | | <if test="locType1 != null"> |
| | | and loc_type1 = #{locType1} |
| | | </if> |
| | | |
| | | <if test="rowBeg != null"> |
| | | and row1 >= #{rowBeg} |
| | | </if> |
| | | <if test="rowEnd != null"> |
| | | and row1 <= #{rowEnd} |
| | | </if> |
| | | <if test="bayBeg != null"> |
| | | and bay1 >= #{bayBeg} |
| | | </if> |
| | | <if test="bayEnd != null"> |
| | | and bay1 <= #{bayEnd} |
| | | </if> |
| | | <if test="levBeg != null"> |
| | | and lev1 >= #{levBeg} |
| | | </if> |
| | | <if test="levEnd != null"> |
| | | and lev1 <= #{levEnd} |
| | | </if> |
| | | order by loc_sts desc ,row1 desc,lev1 asc,bay1 asc |
| | | </select> |
| | | |
| | | </mapper> |
| New file |
| | |
| | | <?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="com.zy.asrs.mapper.LocRuleMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.zy.asrs.entity.LocRule"> |
| | | <id column="id" property="id" /> |
| | | <result column="matnr" property="matnr" /> |
| | | <result column="specs" property="specs" /> |
| | | <result column="model" property="model" /> |
| | | <result column="cstmr" property="cstmr" /> |
| | | <result column="batch" property="batch" /> |
| | | <result column="other" property="other" /> |
| | | <result column="row_beg" property="rowBeg" /> |
| | | <result column="row_end" property="rowEnd" /> |
| | | <result column="bay_beg" property="bayBeg" /> |
| | | <result column="bay_end" property="bayEnd" /> |
| | | <result column="lev_beg" property="levBeg" /> |
| | | <result column="lev_end" property="levEnd" /> |
| | | <result column="limit" property="limit" /> |
| | | <result column="status" property="status" /> |
| | | <result column="create_by" property="createBy" /> |
| | | <result column="create_time" property="createTime" /> |
| | | <result column="update_by" property="updateBy" /> |
| | | <result column="update_time" property="updateTime" /> |
| | | <result column="memo" property="memo" /> |
| | | |
| | | </resultMap> |
| | | |
| | | </mapper> |
| | |
| | | || html.trim()==='D' |
| | | || html.trim()==='O' |
| | | || html.trim()==='Z' |
| | | |
| | | ){ |
| | | |
| | | } else { |
| | |
| | | <option value="0">未知</option> |
| | | <option value="1">低库位</option> |
| | | <option value="2">高库位</option> |
| | | <option value="3">中库位</option> |
| | | </select> |
| | | </div> |
| | | </div> |