| | |
| | | |
| | | @RequestMapping(value = "/locMast/list/auth") |
| | | @ManagerAuth |
| | | public R list(@RequestParam(defaultValue = "1")Integer curr, |
| | | @RequestParam(defaultValue = "10")Integer limit, |
| | | @RequestParam(required = false)String orderByField, |
| | | @RequestParam(required = false)String orderByType, |
| | | @RequestParam Map<String, Object> param){ |
| | | public R list(@RequestParam(defaultValue = "1") Integer curr, |
| | | @RequestParam(defaultValue = "10") Integer limit, |
| | | @RequestParam(required = false) String orderByField, |
| | | @RequestParam(required = false) String orderByType, |
| | | @RequestParam Map<String, Object> param) { |
| | | excludeTrash(param); |
| | | EntityWrapper<LocMast> wrapper = new EntityWrapper<>(); |
| | | convert(param, wrapper); |
| | | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} |
| | | if (!Cools.isEmpty(orderByField)) { |
| | | wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType)); |
| | | } |
| | | return R.ok(locMastService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){ |
| | | for (Map.Entry<String, Object> entry : map.entrySet()){ |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper) { |
| | | for (Map.Entry<String, Object> entry : map.entrySet()) { |
| | | String val = String.valueOf(entry.getValue()); |
| | | if (val.contains(RANGE_TIME_LINK)){ |
| | | if (val.contains(RANGE_TIME_LINK)) { |
| | | String[] dates = val.split(RANGE_TIME_LINK); |
| | | wrapper.ge(entry.getKey(), DateUtils.convert(dates[0])); |
| | | wrapper.le(entry.getKey(), DateUtils.convert(dates[1])); |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/locMast/update/auth") |
| | | @ManagerAuth(memo = "库位修改") |
| | | public R update(LocMast locMast){ |
| | | if (Cools.isEmpty(locMast) || null==locMast.getLocNo()){ |
| | | @RequestMapping(value = "/locMast/update/auth") |
| | | @ManagerAuth(memo = "库位修改") |
| | | public R update(LocMast locMast) { |
| | | if (Cools.isEmpty(locMast) || null == locMast.getLocNo()) { |
| | | return R.error(); |
| | | } |
| | | LocMast oldLocMast = locMastService.selectById(locMast.getLocNo()); |
| | | if (locX(locMast.getLocNo())){ |
| | | if (oldLocMast.getLocSts().equals("X")){ |
| | | if (locX(locMast.getLocNo())) { |
| | | if (oldLocMast.getLocSts().equals("X")) { |
| | | return R.error("此处没有库位,请根据现场情况操作!!!"); |
| | | }else { |
| | | } else { |
| | | locMast.setLocSts("X"); |
| | | } |
| | | } |
| | |
| | | locMastService.updateById(locMast); |
| | | return R.ok(); |
| | | } |
| | | public boolean locX(String locNo){ |
| | | switch (locNo){ |
| | | case "1300601": case "1300602": case "1300603": case "1300604": case "1300605": case "1300606": |
| | | case "1300701": case "1300702": case "1300703": case "1300704": case "1300705": case "1300706": |
| | | case "1301301": case "1301302": case "1301303": case "1301304": case "1301305": case "1301306": |
| | | case "1301401": case "1301402": case "1301403": case "1301404": case "1301405": case "1301406": |
| | | case "1302001": case "1302002": case "1302003": case "1302004": case "1302005": case "1302006": |
| | | case "1301205": case "1301206": |
| | | |
| | | public boolean locX(String locNo) { |
| | | switch (locNo) { |
| | | case "1300601": |
| | | case "1300602": |
| | | case "1300603": |
| | | case "1300604": |
| | | case "1300605": |
| | | case "1300606": |
| | | case "1300701": |
| | | case "1300702": |
| | | case "1300703": |
| | | case "1300704": |
| | | case "1300705": |
| | | case "1300706": |
| | | case "1301301": |
| | | case "1301302": |
| | | case "1301303": |
| | | case "1301304": |
| | | case "1301305": |
| | | case "1301306": |
| | | case "1301401": |
| | | case "1301402": |
| | | case "1301403": |
| | | case "1301404": |
| | | case "1301405": |
| | | case "1301406": |
| | | case "1302001": |
| | | case "1302002": |
| | | case "1302003": |
| | | case "1302004": |
| | | case "1302005": |
| | | case "1302006": |
| | | case "1301205": |
| | | case "1301206": |
| | | case "1302402": |
| | | case "1402402": |
| | | return true; |
| | |
| | | |
| | | @RequestMapping(value = "/locMast/delete/auth") |
| | | @ManagerAuth(memo = "库位删除") |
| | | public R delete(@RequestParam String param){ |
| | | public R delete(@RequestParam String param) { |
| | | List<LocMast> list = JSONArray.parseArray(param, LocMast.class); |
| | | if (Cools.isEmpty(list)){ |
| | | if (Cools.isEmpty(list)) { |
| | | return R.error(); |
| | | } |
| | | for (LocMast entity : list){ |
| | | for (LocMast entity : list) { |
| | | locMastService.delete(new EntityWrapper<>(entity)); |
| | | } |
| | | return R.ok(); |
| | |
| | | |
| | | @RequestMapping(value = "/locMast/export/auth") |
| | | @ManagerAuth(memo = "库位导出") |
| | | public R export(@RequestBody JSONObject param){ |
| | | public R export(@RequestBody JSONObject param) { |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | EntityWrapper<LocMast> wrapper = new EntityWrapper<>(); |
| | | Map<String, Object> map = excludeTrash(param.getJSONObject("locMast")); |
| | |
| | | wrapper.like("loc_no", condition); |
| | | Page<LocMast> page = locMastService.selectPage(new Page<>(0, 10), wrapper); |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | for (LocMast locMast : page.getRecords()){ |
| | | for (LocMast locMast : page.getRecords()) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("id", locMast.getLocNo()); |
| | | map.put("value", locMast.getLocNo()); |
| | |
| | | @ManagerAuth |
| | | public R query(@RequestBody JSONObject param) { |
| | | Wrapper<LocMast> wrapper = new EntityWrapper<LocMast>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val")); |
| | | if (null != locMastService.selectOne(wrapper)){ |
| | | if (null != locMastService.selectOne(wrapper)) { |
| | | return R.parse(BaseRes.REPEAT).add(getComment(LocMast.class, String.valueOf(param.get("key")))); |
| | | } |
| | | return R.ok(); |
| | |
| | | // @Transactional |
| | | public R init(LocMastInitParam param) { |
| | | List<LocMast> list = new ArrayList<>(); |
| | | for (int r=param.getStartRow(); r<=param.getEndRow(); r++){ |
| | | for (int b=param.getStartBay(); b<=param.getEndBay(); b++) { |
| | | for (int l=param.getStartLev(); l<=param.getEndLev(); l++) { |
| | | for (int r = param.getStartRow(); r <= param.getEndRow(); r++) { |
| | | for (int b = param.getStartBay(); b <= param.getEndBay(); b++) { |
| | | for (int l = param.getStartLev(); l <= param.getEndLev(); l++) { |
| | | // 获取库位号 |
| | | String locNo = String.format("%02d", r) + String.format("%03d", b) + String.format("%02d", l); |
| | | // 获取堆垛机号 |
| | | int crnNo = 0; |
| | | Shelves shelves = new Shelves(param.getEndRow() - param.getStartRow() + 1, param.getCrnAmount()); |
| | | for (List<Integer> node : shelves.nodes){ |
| | | for (List<Integer> node : shelves.nodes) { |
| | | if (node.contains(r)) { |
| | | crnNo = shelves.nodes.indexOf(node) + 1; |
| | | break; |
| | | } |
| | | } |
| | | Date now = new Date(); |
| | | Date now = new Date(); |
| | | LocMast locMast = new LocMast(); |
| | | locMast.setLocNo(locNo); |
| | | locMast.setLocSts("O"); |
| | |
| | | locMastService.insertBatch(list); |
| | | return R.ok("初始化成功"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 初始化组 |
| | | */ |
| | | // @GetMapping("/locMast/group") |
| | | private void group(){ |
| | | int i=1; |
| | | for(int row=1;row<17;row++){//列 |
| | | for (int lev=1;lev<8;lev++){//层 |
| | | String s="group1="+i; |
| | | locMastService.updateForSet(s,new EntityWrapper<LocMast>().eq("bay1",row).eq("lev1",lev).ge("row1",1).le("row1",3)); |
| | | i++; |
| | | } |
| | | } |
| | | System.out.println("i="+i); |
| | | for(int row=1;row<17;row++){//排 |
| | | for (int lev=1;lev<8;lev++){//层 |
| | | String s="group1="+i; |
| | | locMastService.updateForSet(s,new EntityWrapper<LocMast>().eq("bay1",row).eq("lev1",lev).ge("row1",5).le("row1",8)); |
| | | i++; |
| | | } |
| | | } |
| | | System.out.println("i="+i); |
| | | for(int row=1;row<17;row++){//排 |
| | | for (int lev=1;lev<8;lev++){//层 |
| | | String s="group1="+i; |
| | | locMastService.updateForSet(s,new EntityWrapper<LocMast>().eq("bay1",row).eq("lev1",lev).ge("row1",9).le("row1",11)); |
| | | i++; |
| | | } |
| | | } |
| | | System.out.println("i="+i); |
| | | for(int row=1;row<17;row++){//排 |
| | | for (int lev=1;lev<8;lev++){//层 |
| | | String s="group1="+i; |
| | | locMastService.updateForSet(s,new EntityWrapper<LocMast>().eq("bay1",row).eq("lev1",lev).ge("row1",13).le("row1",16)); |
| | | i++; |
| | | } |
| | | } |
| | | System.out.println("i="+i); |
| | | for(int row=1;row<17;row++){//排 |
| | | for (int lev=1;lev<8;lev++){//层 |
| | | String s="group1="+i; |
| | | locMastService.updateForSet(s,new EntityWrapper<LocMast>().eq("bay1",row).eq("lev1",lev).ge("row1",17).le("row1",19)); |
| | | i++; |
| | | } |
| | | } |
| | | System.out.println("i="+i); |
| | | for(int row=1;row<17;row++){//排 |
| | | for (int lev=1;lev<8;lev++){//层 |
| | | String s="group1="+i; |
| | | locMastService.updateForSet(s,new EntityWrapper<LocMast>().eq("bay1",row).eq("lev1",lev).ge("row1",21).le("row1",24)); |
| | | i++; |
| | | } |
| | | } |
| | | System.out.println("i="+i); |
| | | for(int row=1;row<17;row++){//排 |
| | | for (int lev=1;lev<8;lev++){//层 |
| | | String s="group1="+i; |
| | | locMastService.updateForSet(s,new EntityWrapper<LocMast>().eq("bay1",row).eq("lev1",lev).ge("row1",25).le("row1",27)); |
| | | i++; |
| | | } |
| | | } |
| | | System.out.println("i="+i); |
| | | for(int row=1;row<17;row++){//排 |
| | | for (int lev=1;lev<8;lev++){//层 |
| | | String s="group1="+i; |
| | | locMastService.updateForSet(s,new EntityWrapper<LocMast>().eq("bay1",row).eq("lev1",lev).ge("row1",29).le("row1",31)); |
| | | i++; |
| | | } |
| | | } |
| | | System.out.println("i="+i); |
| | | } |
| | | } |
| | |
| | | package com.zy.asrs.controller; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.annotations.AppAuth; |
| | | import com.core.common.*; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.WrkMast; |
| | | import com.zy.asrs.entity.param.*; |
| | | import com.zy.asrs.service.OpenService; |
| | | import com.zy.asrs.service.WrkMastService; |
| | | import com.zy.common.model.DetlDto; |
| | | import com.zy.common.web.BaseController; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | |
| | | @Autowired |
| | | private OpenService openService; |
| | | @Autowired |
| | | private WrkMastService wrkMastService; |
| | | |
| | | @PostMapping("/order/matSync/default/v1") |
| | | @AppAuth(memo = "商品信息同步接口") |
| | |
| | | |
| | | /*********************************同步物料档案和订单****************************************************/ |
| | | |
| | | /*********************************wcs接口对接****************************************************/ |
| | | |
| | | /** |
| | | * 任务开始 |
| | | */ |
| | | @RequestMapping("/start/task") |
| | | public HashMap<String ,Object> startTask(@RequestBody HashMap<String,Object> map) { |
| | | String taskNo = map.get("TaskNo")+""; |
| | | HashMap<String ,Object> map1 = new HashMap<>(); |
| | | if(Cools.isEmpty(taskNo)){ |
| | | map1.put("ReturnStatus", "1"); |
| | | map1.put("ErrorMessage", "任务号为空"); |
| | | }else{ |
| | | WrkMast wrkMast = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("wrk_no",Integer.valueOf(taskNo))); |
| | | if(wrkMast == null){ |
| | | map1.put("ReturnStatus", "1"); |
| | | map1.put("ErrorMessage", "没有找到该任务号:"+taskNo); |
| | | }else{ |
| | | if(wrkMast.getIoType()==1){ |
| | | wrkMast.setWrkSts(3L);//入库开始 |
| | | }else if(wrkMast.getIoType()==11){ |
| | | wrkMast.setWrkSts(13L);//出库开始 |
| | | } |
| | | wrkMast.setModiTime(new Date()); |
| | | if(wrkMastService.updateById(wrkMast)){ |
| | | map1.put("ReturnStatus", "0"); |
| | | map1.put("ErrorMessage", ""); |
| | | }else{ |
| | | map1.put("ReturnStatus", "1"); |
| | | map1.put("ErrorMessage", "更新任务状态失败"+wrkMast); |
| | | } |
| | | } |
| | | } |
| | | return map1; |
| | | } |
| | | |
| | | /** |
| | | * 搬运到目的地 |
| | | */ |
| | | @RequestMapping("/destination/task") |
| | | public HashMap<String ,Object> destinationTask(@RequestBody HashMap<String,Object> map) { |
| | | String taskNo = map.get("TaskNo")+""; |
| | | HashMap<String ,Object> map1 = new HashMap<>(); |
| | | if(Cools.isEmpty(taskNo)){ |
| | | map1.put("ReturnStatus", "1"); |
| | | map1.put("ErrorMessage", "任务号为空"); |
| | | }else{ |
| | | WrkMast wrkMast = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("wrk_no",Integer.valueOf(taskNo))); |
| | | if(wrkMast == null){ |
| | | map1.put("ReturnStatus", "1"); |
| | | map1.put("ErrorMessage", "没有找到该任务号:"+taskNo); |
| | | }else{ |
| | | if(wrkMast.getIoType()==1){ |
| | | wrkMast.setWrkSts(4L);//任务结束 |
| | | }else if(wrkMast.getIoType()==11){ |
| | | wrkMast.setWrkSts(13L);//出库到站点上 |
| | | } |
| | | wrkMast.setModiTime(new Date()); |
| | | if(wrkMastService.updateById(wrkMast)){ |
| | | map1.put("ReturnStatus", "0"); |
| | | map1.put("ErrorMessage", ""); |
| | | }else{ |
| | | map1.put("ReturnStatus", "1"); |
| | | map1.put("ErrorMessage", "更新任务状态失败"+wrkMast); |
| | | } |
| | | } |
| | | } |
| | | return map1; |
| | | } |
| | | |
| | | /** |
| | | * 搬运到目的地 |
| | | */ |
| | | @RequestMapping("/leave/task") |
| | | public HashMap<String ,Object> leaveTask(@RequestBody HashMap<String,Object> map) { |
| | | String taskNo = map.get("TaskNo")+""; |
| | | HashMap<String ,Object> map1 = new HashMap<>(); |
| | | if(Cools.isEmpty(taskNo)){ |
| | | map1.put("ReturnStatus", "1"); |
| | | map1.put("ErrorMessage", "任务号为空"); |
| | | }else{ |
| | | WrkMast wrkMast = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("wrk_no",Integer.valueOf(taskNo))); |
| | | if(wrkMast == null){ |
| | | map1.put("ReturnStatus", "1"); |
| | | map1.put("ErrorMessage", "没有找到该任务号:"+taskNo); |
| | | }else{ |
| | | wrkMast.setWrkSts(14L);//出库到站点上 |
| | | wrkMast.setModiTime(new Date()); |
| | | if(wrkMastService.updateById(wrkMast)){ |
| | | map1.put("ReturnStatus", "0"); |
| | | map1.put("ErrorMessage", ""); |
| | | }else{ |
| | | map1.put("ReturnStatus", "1"); |
| | | map1.put("ErrorMessage", "更新任务状态失败"+wrkMast); |
| | | } |
| | | } |
| | | } |
| | | return map1; |
| | | } |
| | | } |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping("/create/waitPain/wrkMast/start") |
| | | @ManagerAuth(memo = "生成任务") |
| | | public R createWaitPainWrkMastStart(@RequestBody List<WaitPakin> list) { |
| | | StartupDto startupDto = workService.createWaitPainWrkMastStart(list, getUserId()); |
| | | return R.ok("任务号:" + startupDto.getWorkNo() + ";目标库位:" + startupDto.getLocNo()); |
| | | } |
| | | // @RequestMapping("/create/waitPain/wrkMast/start") |
| | | // @ManagerAuth(memo = "生成任务") |
| | | // public R createWaitPainWrkMastStart(@RequestBody List<WaitPakin> list) { |
| | | // StartupDto startupDto = workService.createWaitPainWrkMastStart(list, getUserId()); |
| | | // return R.ok("任务号:" + startupDto.getWorkNo() + ";目标库位:" + startupDto.getLocNo()); |
| | | // } |
| | | |
| | | @RequestMapping("/deal/preHave/start") |
| | | @ManagerAuth(memo = "先入品处理") |
| | |
| | | import com.core.common.Cools; |
| | | import com.core.common.SpringUtils; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | |
| | | @TableName("asr_bas_crnp") |
| | | @Data |
| | | public class BasCrnp implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | |
| | | |
| | | /** |
| | | * 状态 |
| | | * 1.联机 |
| | | * 2.手动 |
| | | * 3.充电中 |
| | | */ |
| | | @ApiModelProperty(value= "状态") |
| | | @TableField("crn_sts") |
| | |
| | | @TableField("emp_in") |
| | | private String empIn; |
| | | |
| | | @ApiModelProperty(value= "") |
| | | /** |
| | | * 找小车标记,优先找有1的小车所在层,再去找没有小车的所在层 |
| | | */ |
| | | @ApiModelProperty(value= "入库标记") |
| | | @TableField("tank_qty") |
| | | private Integer tankQty; |
| | | |
| | | @ApiModelProperty(value= "小车所在层") |
| | | @TableField("lev1") |
| | | private Integer lev1; |
| | | |
| | | @ApiModelProperty(value= "") |
| | | @TableField("tank_qty1") |
| | | private Integer tankQty1; |
| | | |
| | | |
| | | |
| | | public BasCrnp() {} |
| | | |
| | | public BasCrnp(String inEnable,String outEnable,Integer crnSts,Integer wrkNo,Long crnErr,String frmLocno,Integer frmSta,Integer toSta,String toLocno,Long appeUser,Date appeTime,Long modiUser,Date modiTime,String hpMk,String retrieveMk,String ctlHp,String ctlRest,String empIn,Integer tankQty,Integer tankQty1) { |
| | |
| | | @TableField("ctn_no") |
| | | private String ctnNo; |
| | | |
| | | @ApiModelProperty(value= "组") |
| | | @TableField("group1") |
| | | private Integer group1; |
| | | |
| | | /** |
| | | * 深浅库位排号 |
| | | * 1.最深库位 |
| | | * 从小到大,越大的库位越浅 |
| | | */ |
| | | @ApiModelProperty(value= "库位属性") |
| | | @TableField("loc_attribute") |
| | | private Integer locAttribute; |
| | | |
| | | public String getWhsType$(){ |
| | | BasWhsService service = SpringUtils.getBean(BasWhsService.class); |
New file |
| | |
| | | package com.zy.asrs.entity.result; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class StorageResult { |
| | | private String ErrorMessage = ""; |
| | | private Integer ReturnStatus = 0; |
| | | private Results Results; |
| | | |
| | | @Data |
| | | public static class Results{ |
| | | //库位号 |
| | | private String ShelfUnitId; |
| | | //任务号 |
| | | private Integer TaskNo; |
| | | } |
| | | |
| | | } |
| | |
| | | Integer selectEmptyLocCount(@Param("locType1") Short locType1, @Param("crnNo") Integer crnNo); |
| | | |
| | | List<LocMast> queryShallowLocFMast(@Param("crnNo") Integer crnNo); |
| | | |
| | | List<LocMast> querySame(@Param("matnr") String matnr,@Param("lev1") Integer lev1); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.zy.asrs.entity.LocDetl; |
| | | import com.zy.asrs.entity.LocMast; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | * @return |
| | | */ |
| | | List<LocMast> queryShallowLocFMast(Integer crnNo); |
| | | |
| | | List<LocMast> querySame(String matnr,Integer lev1); |
| | | } |
| | |
| | | throw new CoolException(devpNo+"站点不存在"); |
| | | } |
| | | if (pakin) { |
| | | if(station.getAutoing()==null || !station.getAutoing().equals("Y")) { |
| | | throw new CoolException(devpNo+"站点不是自动状态"); |
| | | if(station.getCanining()==null || !station.getAutoing().equals("Y")) { |
| | | throw new CoolException(devpNo+"站点不是能入状态"); |
| | | } |
| | | if(station.getLoading()==null || !station.getLoading().equals("Y")) { |
| | | throw new CoolException(devpNo+"站点无物"); |
| | | } |
| | | if(station.getWrkNo()!=null && station.getWrkNo()>0 && station.getWrkNo() < 9990) { |
| | | throw new CoolException(devpNo+"站点已有工作号"); |
| | | } |
| | | // if(!station.getInEnable().equals("Y")) { |
| | | // throw new CoolException(devpNo+"站点不是可入状态"); |
| | | // if(wrkMastService.getWorkingMast(devpNo)>0){ |
| | | // throw new CoolException(devpNo+"站点不能同时生成两笔入库工作档"); |
| | | // } |
| | | if(wrkMastService.getWorkingMast(devpNo)>0){ |
| | | throw new CoolException(devpNo+"站点不能同时生成两笔入库工作档"); |
| | | } |
| | | } |
| | | return station; |
| | | } |
| | |
| | | public List<LocMast> queryShallowLocFMast(Integer crnNo) { |
| | | return this.baseMapper.queryShallowLocFMast(crnNo); |
| | | } |
| | | |
| | | @Override |
| | | public List<LocMast> querySame(String matnr,Integer lev1) { |
| | | return this.baseMapper.querySame(matnr,lev1); |
| | | } |
| | | } |
| | |
| | | } |
| | | LocTypeDto locTypeDto = new LocTypeDto(); |
| | | locTypeDto.setLocType1((short) 1); |
| | | return wcsController.startupFullPutStore(301, list.get(0).getZpallet(), locTypeDto, list); |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | |
| | | import com.zy.common.model.Shelves; |
| | | import com.zy.common.model.StartupDto; |
| | | import com.zy.common.properties.SlaveProperties; |
| | | import io.swagger.models.auth.In; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | |
| | | /** |
| | | * 生成工作号 |
| | | * |
| | | * @param wrkMk 0:入库 1 - 3000 ; 1:拣料/并板/盘点 3001 - 6000 ; 2: 出库 6001 -9000 ; 3:其他 9001 -9999 |
| | | * @return workNo(工作号) |
| | | */ |
| | |
| | | int workNo = wrkLastno.getWrkNo(); |
| | | int sNo = wrkLastno.getSNo(); |
| | | int eNo = wrkLastno.getENo(); |
| | | workNo = workNo>=eNo ? sNo : workNo+1; |
| | | workNo = workNo >= eNo ? sNo : workNo + 1; |
| | | while (true) { |
| | | WrkMast wrkMast = wrkMastService.selectById(workNo); |
| | | if (null != wrkMast) { |
| | | workNo = workNo>=eNo ? sNo : workNo+1; |
| | | workNo = workNo >= eNo ? sNo : workNo + 1; |
| | | } else { |
| | | break; |
| | | } |
| | | } |
| | | // 修改序号记录 |
| | | if (workNo > 0){ |
| | | if (workNo > 0) { |
| | | wrkLastno.setWrkNo(workNo); |
| | | wrkLastnoService.updateById(wrkLastno); |
| | | } |
| | |
| | | if (workNo == 0) { |
| | | throw new CoolException("生成工作号失败,请联系管理员"); |
| | | } else { |
| | | if (wrkMastService.selectById(workNo)!=null) { |
| | | if (wrkMastService.selectById(workNo) != null) { |
| | | throw new CoolException("生成工作号" + workNo + "在工作档中已存在"); |
| | | } |
| | | } |
| | |
| | | |
| | | /** |
| | | * 检索库位号 |
| | | * @param whsType 类型 1:双深式货架 |
| | | * @param staDescId 路径工作类型 |
| | | * |
| | | * @param whsType 类型 1:双深式货架 |
| | | * @param staDescId 路径工作类型 |
| | | * @param sourceStaNo 源站 |
| | | * @param matNos 商品编号集合 |
| | | * @param matNos 商品编号集合 |
| | | * @return locNo 检索到的库位号 |
| | | */ |
| | | @Transactional |
| | | public StartupDto getLocNo(Integer whsType, Integer staDescId, Integer sourceStaNo, List<String> matNos, LocTypeDto locTypeDto, int times) { |
| | | // whsType = getWhsType(sourceStaNo, times); |
| | | public StartupDto getLocNo4(Integer whsType, Integer staDescId, Integer sourceStaNo, List<String> matNos, LocTypeDto locTypeDto, int times) { |
| | | StartupDto startupDto = new StartupDto(); |
| | | |
| | | // if (sourceStaNo < 200){ |
| | | // whsType = 1; |
| | | // } else if (sourceStaNo > 199 && sourceStaNo < 300){ |
| | | // whsType = 2; |
| | | // } else if (sourceStaNo > 299 && sourceStaNo < 400){ |
| | | // whsType = 3; |
| | | // } else if (sourceStaNo > 399){ |
| | | // whsType = 4; |
| | | // } |
| | | |
| | | if (sourceStaNo ==101||sourceStaNo==103){ |
| | | if (sourceStaNo == 101 || sourceStaNo == 103) { |
| | | whsType = 1; |
| | | } else if (sourceStaNo ==105||sourceStaNo==107){ |
| | | } else if (sourceStaNo == 105 || sourceStaNo == 107) { |
| | | whsType = 2; |
| | | } else{ |
| | | } else { |
| | | throw new CoolException("站点数据异常,请联系管理员"); |
| | | } |
| | | |
| | |
| | | if (Utils.isShallowLoc(slaveProperties, loc.getLocNo())) { |
| | | continue; |
| | | } |
| | | String shallowLocNo = Utils.getShallowLoc(slaveProperties, loc.getLocNo()); |
| | | String shallowLocNo = Utils.getShallowLoc(slaveProperties, loc.getLocNo()); |
| | | // 检测目标库位是否为空库位 |
| | | LocMast shallowLoc = locMastService.selectById(shallowLocNo); |
| | | if (shallowLoc != null && shallowLoc.getLocSts().equals("O")) { |
| | | if (shallowLoc.getLocType1()<locTypeDto.getLocType1()){ |
| | | if (shallowLoc.getLocType1() < locTypeDto.getLocType1()) { |
| | | continue; |
| | | } |
| | | if (basCrnpService.checkSiteError(shallowLoc.getCrnNo(), true)) { |
| | |
| | | if (curRow == 0) { |
| | | curRow = 4; |
| | | } |
| | | for (int i = 0; i < shelves.group; i ++) { |
| | | for (int i = 0; i < shelves.group; i++) { |
| | | curRow = shelves.start(curRow); |
| | | if (curRow < 0) { |
| | | throw new CoolException("检索库位失败,请联系管理员"); |
| | | } |
| | | Integer crnNo1 = shelves.get(curRow); |
| | | crnNo1 = crnNo1 + divides*1; |
| | | crnNo1 = crnNo1 + divides * 1; |
| | | if (basCrnpService.checkSiteError(crnNo1, true)) { |
| | | crnNo = crnNo1; |
| | | curRow = curRow + divides*4; |
| | | curRow = curRow + divides * 4; |
| | | break; |
| | | } |
| | | } |
| | |
| | | } |
| | | BasDevp staNo = basDevpService.selectById(staDesc.getCrnStn()); |
| | | if (!staNo.getAutoing().equals("Y")) { |
| | | throw new CoolException("目标站"+staDesc.getCrnStn()+"不可用"); |
| | | throw new CoolException("目标站" + staDesc.getCrnStn() + "不可用"); |
| | | } |
| | | |
| | | // 更新库位排号 |
| | | rowLastno.setCurrentRow(curRow); |
| | | rowLastnoService.updateById(rowLastno); |
| | | |
| | | // 开始查找库位 ==============================>> |
| | | |
| | | // 1.当检索库排为浅库位排时,优先寻找当前库排的深库位排 |
| | | if (locMast == null) { |
| | | if (Utils.isShallowLoc(slaveProperties, curRow)) { |
| | | Integer deepRow = Utils.getDeepRow(slaveProperties, curRow); |
| | | locMast = locMastService.queryFreeLocMast(deepRow, locTypeDto.getLocType1()); |
| | | // todo:luxiaotao 如果用浅排找到的深库位,那么则需要判断这个深库位对应的浅库位是否有货(F、X、D) |
| | | // 因库位移转、需预留空库位 |
| | | if (!locMastService.checkEmptyCount(locMast)) { |
| | | locMast = null; |
| | | } |
| | | } |
| | | if (Cools.isEmpty(locMast)) { |
| | | locMast = locMastService.queryFreeLocMast(curRow, locTypeDto.getLocType1()); |
| | | // 因库位移转、需预留空库位 |
| | | if (!locMastService.checkEmptyCount(locMast)) { |
| | | locMast = null; |
| | | } |
| | | // 目标库位 ===>> 浅库位, 则校验其深库位是否为 F D X |
| | | if (null != locMast && Utils.isShallowLoc(slaveProperties, locMast.getLocNo())) { |
| | | LocMast deepLoc = locMastService.selectById(Utils.getDeepLoc(slaveProperties, locMast.getLocNo())); |
| | | if (!deepLoc.getLocSts().equals("F") && !deepLoc.getLocSts().equals("D") && !deepLoc.getLocSts().equals("X")) { |
| | | locMast = null; |
| | | } |
| | | } |
| | | // 目标库位 ===>> 深库位, 则校验其浅库位是否为 O |
| | | if (null != locMast && Utils.isDeepLoc(slaveProperties, locMast.getLocNo())) { |
| | | LocMast shallowLoc = locMastService.selectById(Utils.getShallowLoc(slaveProperties, locMast.getLocNo())); |
| | | if (!shallowLoc.getLocSts().equals("O")) { |
| | | locMast = null; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 2.库位当前所属尺寸无空库位时,调整尺寸参数,向上兼容检索库位 |
| | | if (Cools.isEmpty(locMast)) { |
| | | // 当前巷道无空库位时,递归调整至下一巷道,检索全部巷道无果后,跳出递归 |
| | | if (times < rowCount) { |
| | | times = times + 1; |
| | | return getLocNo(1, staDescId, sourceStaNo, matNos, locTypeDto, times); |
| | | } |
| | | |
| | | // 轻货物找轻库位为空时,可以去找重库位仓 |
| | | if (locTypeDto.getLocType1() == 1) { |
| | | locTypeDto.setLocType1((short) 2); |
| | | return getLocNo(1, staDescId, sourceStaNo, matNos, 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(crnNo); |
| | | startupDto.setSourceStaNo(sourceStaNo); |
| | | startupDto.setStaNo(staNo.getDevNo()); |
| | | startupDto.setLocNo(locNo); |
| | | return startupDto; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 检索库位号 |
| | | * |
| | | * @param whsType 类型 1:双深式货架 |
| | | * @param staDescId 路径工作类型 |
| | | * @param sourceStaNo 源站 |
| | | * @param matNos 商品编号集合 |
| | | * @return locNo 检索到的库位号 |
| | | */ |
| | | @Transactional |
| | | public StartupDto getLocNo(Integer whsType, Integer staDescId, Integer sourceStaNo, List<String> matNos, LocTypeDto locTypeDto, int times) { |
| | | // whsType = getWhsType(sourceStaNo, times); |
| | | StartupDto startupDto = new StartupDto(); |
| | | |
| | | // if (sourceStaNo < 200){ |
| | | // whsType = 1; |
| | | // } else if (sourceStaNo > 199 && sourceStaNo < 300){ |
| | | // whsType = 2; |
| | | // } else if (sourceStaNo > 299 && sourceStaNo < 400){ |
| | | // whsType = 3; |
| | | // } else if (sourceStaNo > 399){ |
| | | // whsType = 4; |
| | | // } |
| | | |
| | | if (sourceStaNo == 101 || sourceStaNo == 103) { |
| | | whsType = 1; |
| | | } else if (sourceStaNo == 105 || sourceStaNo == 107) { |
| | | whsType = 2; |
| | | } else { |
| | | throw new CoolException("站点数据异常,请联系管理员"); |
| | | } |
| | | |
| | | RowLastno rowLastno = rowLastnoService.selectById(whsType); |
| | | if (Cools.isEmpty(rowLastno)) { |
| | | throw new CoolException("1数据异常,请联系管理员"); |
| | | } |
| | | |
| | | // ===============>>>> 开始执行 |
| | | int curRow = rowLastno.getCurrentRow(); |
| | | int sRow = rowLastno.getsRow(); |
| | | int eRow = rowLastno.geteRow(); |
| | | int crn_qty = rowLastno.getCrnQty(); |
| | | int rowCount = eRow - sRow + 1; |
| | | // 目标堆垛机号 |
| | | int crnNo = 0; |
| | | // 目标库位 |
| | | LocMast locMast = null; |
| | | |
| | | // 靠近摆放规则 --- 同天同规格物料 |
| | | if (!Cools.isEmpty(matNos)) { |
| | | List<String> locNos = locDetlService.getSameDetlToday(matNos.get(0), sRow, eRow); |
| | | for (String locNo : locNos) { |
| | | if (Utils.isShallowLoc(slaveProperties, locNo)) { |
| | | continue; |
| | | } |
| | | String shallowLocNo = Utils.getShallowLoc(slaveProperties, locNo); |
| | | // 检测目标库位是否为空库位 |
| | | LocMast shallowLoc = locMastService.selectById(shallowLocNo); |
| | | if (shallowLoc != null && shallowLoc.getLocSts().equals("O")) { |
| | | if (VersionUtils.locMoveCheckLocType(shallowLoc, locTypeDto)) { |
| | | if (basCrnpService.checkSiteError(shallowLoc.getCrnNo(), true)) { |
| | | locMast = shallowLoc; |
| | | crnNo = locMast.getCrnNo(); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 靠近摆放规则 --- 空托 |
| | | if (staDescId == 10) { |
| | | List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("loc_sts", "D").ge("row1", sRow).le("row1", eRow)); |
| | | if (locMasts.size() > 0) { |
| | | for (LocMast loc : locMasts) { |
| | | if (Utils.isShallowLoc(slaveProperties, loc.getLocNo())) { |
| | | continue; |
| | | } |
| | | String shallowLocNo = Utils.getShallowLoc(slaveProperties, loc.getLocNo()); |
| | | // 检测目标库位是否为空库位 |
| | | LocMast shallowLoc = locMastService.selectById(shallowLocNo); |
| | | if (shallowLoc != null && shallowLoc.getLocSts().equals("O")) { |
| | | if (shallowLoc.getLocType1() < locTypeDto.getLocType1()) { |
| | | continue; |
| | | } |
| | | if (basCrnpService.checkSiteError(shallowLoc.getCrnNo(), true)) { |
| | | locMast = shallowLoc; |
| | | crnNo = locMast.getCrnNo(); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 如果没有相近物料,则按规则轮询货架 |
| | | if (null == locMast) { |
| | | Shelves shelves = new Shelves(rowCount, crn_qty); |
| | | int divides = (int) Arith.divides(1, curRow - 1, 4); |
| | | curRow = (int) Arith.remainder(curRow, 4); |
| | | if (curRow == 0) { |
| | | curRow = 4; |
| | | } |
| | | for (int i = 0; i < shelves.group; i++) { |
| | | curRow = shelves.start(curRow); |
| | | if (curRow < 0) { |
| | | throw new CoolException("检索库位失败,请联系管理员"); |
| | | } |
| | | Integer crnNo1 = shelves.get(curRow); |
| | | crnNo1 = crnNo1 + divides * 1; |
| | | if (basCrnpService.checkSiteError(crnNo1, true)) { |
| | | crnNo = crnNo1; |
| | | curRow = curRow + divides * 4; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (crnNo == 0) { |
| | | throw new CoolException("没有可用的堆垛机"); |
| | | } |
| | | // 获取目标站 |
| | | Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>() |
| | | .eq("type_no", staDescId) |
| | | .eq("stn_no", sourceStaNo) |
| | | .eq("crn_no", crnNo); |
| | | StaDesc staDesc = staDescService.selectOne(wrapper); |
| | | if (Cools.isEmpty(staDesc)) { |
| | | log.error("type_no={},stn_no={},crn_no={}", staDescId, sourceStaNo, crnNo); |
| | | throw new CoolException("入库路径不存在"); |
| | | } |
| | | BasDevp staNo = basDevpService.selectById(staDesc.getCrnStn()); |
| | | if (!staNo.getAutoing().equals("Y")) { |
| | | throw new CoolException("目标站" + staDesc.getCrnStn() + "不可用"); |
| | | } |
| | | |
| | | // 更新库位排号 |
| | |
| | | return msg.substring(0, 16); |
| | | } else { |
| | | StringBuilder msgBuilder = new StringBuilder(msg); |
| | | for(int i = 0; i < count - msg.length(); ++i) { |
| | | for (int i = 0; i < count - msg.length(); ++i) { |
| | | msgBuilder.insert(0, "0"); |
| | | } |
| | | return msgBuilder.toString(); |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @param waitPakin 组托的物料 |
| | | * @param arr 保存顺序层 |
| | | * @param d 下标 |
| | | * @param locType 物料是否为特殊物料 |
| | | * @param locType1 1.满托 2.空托 |
| | | * @return |
| | | */ |
| | | public LocMast getLocNo2(WaitPakin waitPakin, Integer[] arr, Integer d, Integer locType, Integer locType1) { |
| | | LocMast locMast = null; |
| | | //一.查询入库货物是否是特殊摆放货物 |
| | | if (locType == 2) { |
| | | //查找层标记的 |
| | | LocMast locMast1 = locMastService.selectOne(new EntityWrapper<LocMast>() |
| | | .eq("lev1", arr[d]) |
| | | .eq("loc_sts", "O") |
| | | .eq("loc_type1", 2) |
| | | .eq("loc_attribute", 1)); |
| | | if (!Cools.isEmpty(locMast1)) { |
| | | locMast = locMast1; |
| | | } |
| | | } else { |
| | | List<LocMast> locMasts = new ArrayList<>(); |
| | | //二.空栈板摆放规则 |
| | | //1.该层相同空栈板 |
| | | //2.获得locAttribute库位属性为1的所有库位 |
| | | //3.查看组里是否还有空位 |
| | | if (locType1 == 2) { |
| | | locMasts = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | .eq("lev1", arr[d]) |
| | | .eq("loc_sts", "D") |
| | | .eq("loc_type1", 1) |
| | | .eq("loc_attribute", 1)); |
| | | if (!Cools.isEmpty(locMasts)) { |
| | | for (LocMast locMast1 : locMasts) { |
| | | //4.查看该组是否有预约入库和预约出库的库位,有的话直接跳过该组 |
| | | List<LocMast> locMasts2 = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | .eq("group1", locMast1.getGroup1()) |
| | | .in("loc_sts", "P", "Q", "R", "S")); |
| | | if (!Cools.isEmpty(locMasts2)) { |
| | | continue; |
| | | } |
| | | //5.找出同一组的空库位 |
| | | //6.对深浅库位进行排序 |
| | | List<LocMast> locMasts1 = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | .eq("group1", locMast1.getGroup1()) |
| | | .eq("loc_sts", "O") |
| | | .orderBy("locAttribute")); |
| | | if (Cools.isEmpty(locMasts1)) { |
| | | continue; |
| | | } |
| | | //7.查看 |
| | | locMast = locMasts1.get(0); |
| | | } |
| | | } |
| | | } else { |
| | | //三.正常货物入库 |
| | | //1.该层相同物料摆放 |
| | | //2.获得locAttribute库位属性为1的所有库位 |
| | | //3.查看组里是否还有空位 |
| | | locMasts = locMastService.querySame(waitPakin.getMatnr(), arr[d]); |
| | | if (!Cools.isEmpty(locMasts)) { |
| | | for (LocMast locMast1 : locMasts) { |
| | | //4.查看该组是否有预约入库和预约出库的库位,有的话直接跳过该组 |
| | | List<LocMast> locMasts2 = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | .eq("group1", locMast1.getGroup1()) |
| | | .in("loc_sts", "P", "Q", "R", "S")); |
| | | if (!Cools.isEmpty(locMasts2)) { |
| | | continue; |
| | | } |
| | | //5.找出同一组的空库位 |
| | | //6.对深浅库位进行排序 |
| | | List<LocMast> locMasts1 = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | .eq("group1", locMast1.getGroup1()) |
| | | .eq("loc_sts", "O") |
| | | .orderBy("locAttribute")); |
| | | if (Cools.isEmpty(locMasts1)) { |
| | | continue; |
| | | } |
| | | //7.查看 |
| | | locMast = locMasts1.get(0); |
| | | } |
| | | } |
| | | |
| | | } |
| | | //四.没有相同物料,进行正常找库 |
| | | if (Cools.isEmpty(locMast)) { |
| | | //查找该层所有空的"loc_attribute",1 |
| | | List<LocMast> locMastList = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | .eq("lev1", arr[d]) |
| | | .eq("loc_sts", "O") |
| | | .eq("loc_type1", 1) |
| | | .eq("loc_attribute", 1) |
| | | .orderBy("row1", false) |
| | | .orderBy("bay1", false)); |
| | | if (!Cools.isEmpty(locMastList)) { |
| | | locMast = locMastList.get(0); |
| | | } |
| | | } |
| | | //该层没有找到库位时进入递归换层找库位 |
| | | if (Cools.isEmpty(locMast)) { |
| | | if (d > 6) { |
| | | throw new CoolException("没有空库位"); |
| | | } |
| | | if (d == 6 && locType == 2) { |
| | | return getLocNo2(waitPakin, arr, 0, 1, locType1); |
| | | } |
| | | return getLocNo2(waitPakin, arr, d++, locType, locType1); |
| | | } |
| | | } |
| | | return locMast; |
| | | } |
| | | |
| | | } |
| | |
| | | import com.core.common.R; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.entity.result.StorageResult; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.common.CodeRes; |
| | | import com.zy.common.model.LocTypeDto; |
| | |
| | | private WaitPakinService waitPakinService; |
| | | @Autowired |
| | | private LocDetlService locDetlService; |
| | | @Autowired |
| | | private BasCrnpService basCrnpService; |
| | | |
| | | @PostMapping("/pakin/loc/v1") |
| | | @ResponseBody |
| | | public synchronized R getLocNo(@RequestBody SearchLocParam param) { |
| | | public synchronized R getLocNo(@RequestBody(required = false) SearchLocParam param) { |
| | | StorageResult storageResult=new StorageResult(); |
| | | log.info("收到WCS入库接口请求====>>入参:{}", param); |
| | | if (Cools.isEmpty(param.getIoType())) { |
| | | if (Cools.isEmpty(param.getWcsIoType())) { |
| | | return R.error("入出库类型不能为空"); |
| | | } |
| | | if (Cools.isEmpty(param.getSourceStaNo())) { |
| | | if (Cools.isEmpty(param.getWcsSourceStaNo())) { |
| | | return R.error("源站编号不能为空"); |
| | | } |
| | | List<WaitPakin> waitPakins = null; |
| | | if (param.getIoType() == 1) { |
| | | if (Cools.isEmpty(param.getBarcode())) { |
| | | if (param.getWcsIoType() == 1) { |
| | | if (Cools.isEmpty(param.getBoxNo())) { |
| | | return R.error("条码不能为空"); |
| | | } |
| | | waitPakins = waitPakinService.selectList(new EntityWrapper<WaitPakin>().eq("zpallet", param.getBarcode())); |
| | | waitPakins = waitPakinService.selectList(new EntityWrapper<WaitPakin>().eq("zpallet", param.getBoxNo())); |
| | | if (Cools.isEmpty(waitPakins)) { |
| | | WrkMast wrkMast = wrkMastService.selectByBarcode(param.getBarcode()); |
| | | WrkMast wrkMast = wrkMastService.selectByBarcode(param.getBoxNo()); |
| | | if (wrkMast != null && wrkMast.getIoType() == 103) { |
| | | return R.parse(CodeRes.PICK_600); |
| | | } |
| | | return R.parse(CodeRes.NO_COMB_700); |
| | | } |
| | | int countLoc = locDetlService.selectCount(new EntityWrapper<LocDetl>().eq("zpallet",param.getBarcode())); |
| | | int countWrk = wrkDetlService.selectCount(new EntityWrapper<WrkDetl>().eq("zpallet",param.getBarcode())); |
| | | int countLoc = locDetlService.selectCount(new EntityWrapper<LocDetl>().eq("zpallet",param.getBoxNo())); |
| | | int countWrk = wrkDetlService.selectCount(new EntityWrapper<WrkDetl>().eq("zpallet",param.getBoxNo())); |
| | | if (countLoc > 0 || countWrk > 0) { |
| | | return R.error(CodeRes.EXIST_500); |
| | | } |
| | | } |
| | | if (Cools.isEmpty(param.getLocType1())){ |
| | | return R.error("高低检测信号不能为空"); |
| | | } |
| | | |
| | | // 源站点状态检测 |
| | | BasDevp sourceStaNo = basDevpService.checkSiteStatus(param.getSourceStaNo(), true); |
| | | sourceStaNo.setLocType1(param.getLocType1()); |
| | | LocTypeDto locTypeDto = new LocTypeDto(sourceStaNo); |
| | | |
| | | StartupDto dto = null; |
| | | switch (param.getIoType()) { |
| | | switch (param.getWcsIoType()) { |
| | | case 1://满托盘入库 |
| | | assert waitPakins != null; |
| | | dto = startupFullPutStore(param.getSourceStaNo(), param.getBarcode(), locTypeDto, waitPakins); |
| | | storageResult = startupFullPutStore(param.getWcsSourceStaNo(), param.getBoxNo(), waitPakins); |
| | | break; |
| | | case 10://空托盘入库 |
| | | dto = emptyPlateIn(param.getSourceStaNo(), locTypeDto, param.getBarcode()); |
| | | case 2://空托盘入库 |
| | | storageResult = emptyPlateIn(param.getWcsSourceStaNo(), param.getBoxNo()); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | log.info("WCS入库接口返参:{},托盘码:{}", dto, param.getBarcode()); |
| | | return R.ok().add(dto); |
| | | log.info("WCS入库接口返参:{},托盘码:{}", storageResult, param.getBoxNo()); |
| | | return R.ok().add(storageResult); |
| | | } |
| | | |
| | | /** |
| | | * 全板入库 |
| | | */ |
| | | @Transactional |
| | | public StartupDto startupFullPutStore(Integer devpNo, String barcode, LocTypeDto locTypeDto, List<WaitPakin> waitPakins) { |
| | | // 源站点状态检测 |
| | | BasDevp sourceStaNo = basDevpService.checkSiteStatus(devpNo, true); |
| | | public StorageResult startupFullPutStore(Integer devpNo, String barcode, List<WaitPakin> waitPakins) { |
| | | StorageResult storageResult=new StorageResult(); |
| | | Integer[] arr=arr(); |
| | | int type=Cools.isEmpty(waitPakins.get(0).getBeBatch())?1:waitPakins.get(0).getBeBatch(); |
| | | // 检索库位 |
| | | List<String> matNos = waitPakins.stream().map(WaitPakin::getMatnr).distinct().collect(Collectors.toList()); |
| | | StartupDto dto = commonService.getLocNo(1, 1, devpNo, matNos, locTypeDto,0); |
| | | int workNo = dto.getWorkNo(); |
| | | LocMast locMast1 =commonService.getLocNo2(waitPakins.get(0),arr,0,type,1); |
| | | int workNo = commonService.getWorkNo(0); |
| | | Date now = new Date(); |
| | | // 生成工作档 |
| | | WrkMast wrkMast = new WrkMast(); |
| | |
| | | wrkMast.setWrkSts(2L); // 工作状态:生成入库ID |
| | | wrkMast.setIoType(1); // 入出库状态:1.入库 |
| | | wrkMast.setIoPri(13D); // 优先级 |
| | | wrkMast.setCrnNo(dto.getCrnNo()); |
| | | wrkMast.setSourceStaNo(dto.getSourceStaNo()); |
| | | wrkMast.setStaNo(dto.getStaNo()); |
| | | wrkMast.setLocNo(dto.getLocNo()); |
| | | wrkMast.setSourceStaNo(devpNo); |
| | | wrkMast.setLocNo(locMast1.getLocNo()); |
| | | wrkMast.setBarcode(barcode); // 托盘码 |
| | | wrkMast.setFullPlt("Y"); // 满板:Y |
| | | wrkMast.setPicking("N"); // 拣料 |
| | | wrkMast.setExitMk("N"); // 退出 |
| | | wrkMast.setEmptyMk("N"); // 空板 |
| | | wrkMast.setLinkMis("Y"); |
| | | wrkMast.setCtnType(sourceStaNo.getCtnType()); // 容器类型 |
| | | wrkMast.setCtnType(1); // 容器类型 |
| | | // 操作人员数据 |
| | | wrkMast.setAppeTime(now); |
| | | wrkMast.setModiTime(now); |
| | |
| | | Wrapper<WaitPakin> wrapper = new EntityWrapper<WaitPakin>() |
| | | .eq("zpallet", barcode); |
| | | WaitPakin setParam = new WaitPakin(); |
| | | setParam.setLocNo(dto.getLocNo()); |
| | | setParam.setLocNo(locMast1.getLocNo()); |
| | | setParam.setIoStatus("Y"); |
| | | setParam.setModiTime(now); |
| | | if (!waitPakinService.update(setParam, wrapper)) { |
| | | throw new CoolException("更新通知档失败"); |
| | | } |
| | | // 更新源站点信息 |
| | | sourceStaNo.setWrkNo(workNo); |
| | | sourceStaNo.setModiTime(now); |
| | | if (!basDevpService.updateById(sourceStaNo)){ |
| | | throw new CoolException("更新源站失败"); |
| | | } |
| | | // 更新目标库位状态 |
| | | LocMast locMast = locMastService.selectById(dto.getLocNo()); |
| | | LocMast locMast = locMastService.selectById(locMast1.getLocNo()); |
| | | if (locMast.getLocSts().equals("O")){ |
| | | locMast.setLocSts("S"); // S.入库预约 |
| | | locMast.setModiTime(now); |
| | |
| | | throw new CoolException("改变库位状态失败"); |
| | | } |
| | | } else { |
| | | throw new CoolException(dto.getLocNo()+"目标库位已被占用"); |
| | | throw new CoolException(locMast1.getLocNo()+"目标库位已被占用"); |
| | | } |
| | | return dto; |
| | | StorageResult.Results results=new StorageResult.Results(); |
| | | results.setTaskNo(workNo); |
| | | results.setShelfUnitId(locMast1.getLocNo()); |
| | | storageResult.setResults(results); |
| | | return storageResult; |
| | | } |
| | | |
| | | @Transactional |
| | | public StartupDto emptyPlateIn(Integer devpNo, LocTypeDto locTypeDto, String barcode) { |
| | | // 源站点状态检测 |
| | | BasDevp sourceStaNo = basDevpService.checkSiteStatus(devpNo, true); |
| | | public StorageResult emptyPlateIn(Integer devpNo, String barcode) { |
| | | StorageResult storageResult=new StorageResult(); |
| | | // 检索库位 |
| | | StartupDto dto = commonService.getLocNo(1, 10, devpNo, null, locTypeDto,0); |
| | | int workNo = dto.getWorkNo(); |
| | | Integer[] arr=arr(); |
| | | // 检索库位 |
| | | LocMast locMast1 =commonService.getLocNo2(null,arr,0,1,2); |
| | | int workNo = commonService.getWorkNo(0); |
| | | // 生成工作档 |
| | | WrkMast wrkMast = new WrkMast(); |
| | | wrkMast.setWrkNo(workNo); |
| | |
| | | wrkMast.setWrkSts(2L); // 工作状态:生成入库ID |
| | | wrkMast.setIoType(10); // 入出库状态:10.空板入库 |
| | | wrkMast.setIoPri(13D); // 优先级 |
| | | wrkMast.setCrnNo(dto.getCrnNo()); |
| | | wrkMast.setSourceStaNo(dto.getSourceStaNo()); |
| | | wrkMast.setStaNo(dto.getStaNo()); |
| | | wrkMast.setLocNo(dto.getLocNo()); |
| | | wrkMast.setSourceStaNo(devpNo); |
| | | wrkMast.setLocNo(locMast1.getLocNo()); |
| | | wrkMast.setFullPlt("N"); // 满板 |
| | | wrkMast.setPicking("N"); // 拣料 |
| | | wrkMast.setExitMk("N"); // 退出 |
| | | wrkMast.setEmptyMk("Y"); // 空板 |
| | | wrkMast.setLinkMis("Y"); |
| | | wrkMast.setBarcode(barcode); |
| | | wrkMast.setCtnType(sourceStaNo.getCtnType()); // 容器类型 |
| | | wrkMast.setCtnType(2); // 容器类型 |
| | | // 操作人员数据 |
| | | wrkMast.setAppeTime(new Date()); |
| | | wrkMast.setModiTime(new Date()); |
| | |
| | | if (!res) { |
| | | throw new CoolException("保存工作档失败"); |
| | | } |
| | | // 更新源站点信息 |
| | | sourceStaNo.setWrkNo(workNo); |
| | | sourceStaNo.setModiTime(new Date()); |
| | | if (!basDevpService.updateById(sourceStaNo)){ |
| | | throw new CoolException("更新源站失败"); |
| | | } |
| | | // 更新目标库位状态 |
| | | LocMast locMast = locMastService.selectById(dto.getLocNo()); |
| | | LocMast locMast = locMastService.selectById(locMast1.getLocNo()); |
| | | if (locMast.getLocSts().equals("O")){ |
| | | locMast.setLocSts("S"); // S.入库预约 |
| | | locMast.setModiTime(new Date()); |
| | |
| | | throw new CoolException("改变库位状态失败"); |
| | | } |
| | | } else { |
| | | throw new CoolException(dto.getLocNo()+"目标库位已被占用"); |
| | | throw new CoolException(locMast1.getLocNo()+"目标库位已被占用"); |
| | | } |
| | | return dto; |
| | | StorageResult.Results results=new StorageResult.Results(); |
| | | results.setTaskNo(workNo); |
| | | results.setShelfUnitId(locMast1.getLocNo()); |
| | | storageResult.setResults(results); |
| | | return storageResult; |
| | | } |
| | | |
| | | @Transactional |
| | | public Integer[] arr() { |
| | | //获取有标记的小车,按顺序进行记录 |
| | | int count =basCrnpService.selectCount(new EntityWrapper<BasCrnp>()); |
| | | //初始化数组 |
| | | Integer [] arr=new Integer[7]; |
| | | //数组标记 |
| | | int i=0; |
| | | BasCrnp basCrnp=basCrnpService.selectOne(new EntityWrapper<BasCrnp>().eq("tank_qty",1)); |
| | | //没有找到标记时按默认一号小车所在层开始排 |
| | | if(Cools.isEmpty(basCrnp)){ |
| | | for(int q=1;q<=count;q++){ |
| | | basCrnp=basCrnpService.selectOne(new EntityWrapper<BasCrnp>().eq("crn_no",q)); |
| | | if(Cools.isEmpty(basCrnp)){ |
| | | log.error(q+"号小车没有找到"); |
| | | continue; |
| | | } |
| | | if(basCrnp.getCrnErr()>0||basCrnp.getCrnSts()!=1){ |
| | | log.error(q+"号小车报警或者在充电跳过此车"); |
| | | continue; |
| | | } |
| | | arr[i]=basCrnp.getLev1(); |
| | | i++; |
| | | if(q==1){ |
| | | basCrnp.setTankQty(0); |
| | | basCrnpService.update(basCrnp,new EntityWrapper<BasCrnp>().eq("crn_no",1)); |
| | | }else if(q==2){ |
| | | basCrnp.setTankQty(1); |
| | | basCrnpService.update(basCrnp,new EntityWrapper<BasCrnp>().eq("crn_no",2)); |
| | | } |
| | | } |
| | | }else{ |
| | | basCrnp.setTankQty(0); |
| | | basCrnpService.update(basCrnp,new EntityWrapper<BasCrnp>().eq("crn_no",basCrnp.getCrnNo())); |
| | | arr[i]=basCrnp.getLev1(); |
| | | i++; |
| | | int o=basCrnp.getCrnNo(); |
| | | for(int q=1;q<count;q++){ |
| | | if(++o>count){ |
| | | o=1; |
| | | } |
| | | basCrnp=basCrnpService.selectOne(new EntityWrapper<BasCrnp>().eq("crn_no",o)); |
| | | if(q==1){ |
| | | basCrnp.setTankQty(1); |
| | | basCrnpService.update(basCrnp,new EntityWrapper<BasCrnp>().eq("crn_no",o)); |
| | | } |
| | | arr[i]=basCrnp.getLev1(); |
| | | i++; |
| | | } |
| | | |
| | | } |
| | | for (int w=1;w<=7;w++){ |
| | | boolean boo=true; |
| | | for(int g=0;g<count;g++){ |
| | | if(arr[g]==w){ |
| | | boo=false; |
| | | break; |
| | | } |
| | | } |
| | | if(boo){ |
| | | arr[i]=w; |
| | | i++; |
| | | } |
| | | } |
| | | return arr; |
| | | } |
| | | |
| | | } |
| | |
| | | package com.zy.common.web.param; |
| | | |
| | | import com.alibaba.fastjson.annotation.JSONField; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | |
| | | @Data |
| | | public class SearchLocParam { |
| | | |
| | | private Integer ioType; |
| | | //托盘码 |
| | | @JSONField(name = "BoxNo") |
| | | private String boxNo; |
| | | //执行状态 0:成功 1:失败 |
| | | @JSONField(name = "WCSStatus") |
| | | private Integer wcsStatus=0; |
| | | //错误信息 具体的错误信息(超高,超重等) |
| | | @JSONField(name = "WCSErrorMessage") |
| | | private String wcsErrorMessage=""; |
| | | |
| | | private Integer sourceStaNo; |
| | | //源站点 |
| | | @JSONField(name = "WCSSourceStaNo") |
| | | private Integer wcsSourceStaNo; |
| | | |
| | | private String barcode; |
| | | |
| | | // 库位规格( 0:未知, 1:低库位, 2:高库位) |
| | | private Short locType1; |
| | | //空板满板 |
| | | @JSONField(name = "WCSIoType") |
| | | private Integer wcsIoType; |
| | | |
| | | } |
| | |
| | | <result column="tank_qty" property="tankQty" /> |
| | | <result column="tank_qty1" property="tankQty1" /> |
| | | <result column="origin" property="origin" /> |
| | | <result column="lev1" property="lev1" /> |
| | | </resultMap> |
| | | |
| | | </mapper> |
| | |
| | | <result column="mk" property="mk" /> |
| | | <result column="barcode" property="barcode" /> |
| | | <result column="ctn_no" property="ctnNo" /> |
| | | <result column="group1" property="group1" /> |
| | | <result column="loc_attribute" property="locAttribute" /> |
| | | |
| | | </resultMap> |
| | | |
| | |
| | | ) |
| | | and (loc_sts = 'F' or loc_sts = 'D') and crn_no = #{crnNo} |
| | | </select> |
| | | |
| | | <select id="querySame" resultMap="BaseResultMap"> |
| | | select l.* from asr_loc_mast l,asr_loc_detl d where 1=1 |
| | | and l.loc_no = d.loc_no |
| | | and d.matnr = #{matnr} |
| | | and l.lev1 = #{lev1} |
| | | and l.loc_attribute = 1 |
| | | and l.loc_type1 = 1 |
| | | and l.loc_sts = 'F' |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | ,{field: 'row1', align: 'center',title: '排', sort:true} |
| | | ,{field: 'bay1', align: 'center',title: '列', sort:true} |
| | | ,{field: 'lev1', align: 'center',title: '层', sort:true} |
| | | ,{field: 'group1', align: 'center',title: '组', sort:true} |
| | | ,{field: 'locAttribute', align: 'center',title: '深浅库位号', sort:true} |
| | | ,{field: 'fullPlt', align: 'center',title: '满板', templet:function(row){ |
| | | var html = "<input value='fullPlt' type='checkbox' lay-skin='primary' lay-filter='tableCheckbox' disabled table-index='"+row.LAY_TABLE_INDEX+"'"; |
| | | if(row.fullPlt === 'Y'){html += " checked ";} |
| | |
| | | <input class="layui-input" type="text" name="lev1" placeholder="层" autocomplete="off"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-inline"> |
| | | <div class="layui-input-inline"> |
| | | <input class="layui-input" type="text" name="group1" placeholder="组" autocomplete="off"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-inline"> |
| | | <div class="layui-input-inline"> |
| | | <input class="layui-input" type="text" name="loc_attribute" placeholder="深浅库位号" autocomplete="off"> |
| | | </div> |
| | | </div> |
| | | <!-- 待添加 --> |
| | | <div id="data-search-btn" class="layui-btn-container layui-form-item" style="display: inline-block"> |
| | | <button id="search" class="layui-btn layui-btn-primary layui-btn-radius" lay-submit lay-filter="search">搜索</button> |
| | |
| | | <input id="lev1" class="layui-input" type="text" autocomplete="off" disabled="disabled"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-inline" style="width:80%;"> |
| | | <label class="layui-form-label">组:</label> |
| | | <div class="layui-input-inline"> |
| | | <input id="group1" class="layui-input" type="text" autocomplete="off" disabled="disabled"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-inline" style="width:80%;"> |
| | | <label class="layui-form-label">深浅库位号:</label> |
| | | <div class="layui-input-inline"> |
| | | <input id="locAttribute" class="layui-input" type="text" autocomplete="off" disabled="disabled"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-inline" style="width:80%;display: none"> |
| | | <label class="layui-form-label">满 板:</label> |
| | | <div class="layui-input-inline" style="text-align: left"> |