| | |
| | | import com.zy.asrs.mapper.ManLocDetlMapper; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.common.model.WrkDto; |
| | | import com.zy.common.service.CommonService; |
| | | import com.zy.common.web.BaseController; |
| | | import com.zy.system.entity.license.AbstractServerInfos; |
| | | import org.apache.logging.log4j.LogManager; |
| | |
| | | private ManLocDetlMapper manLocDetlMapper; |
| | | @Autowired |
| | | private WrkDetlLogService wrkDetlLogService; |
| | | @Autowired |
| | | private MatService matService; |
| | | @Autowired |
| | | private MatBarcodeService matBarcodeService; |
| | | @Autowired |
| | | private CommonService commonService; |
| | | |
| | | |
| | | private static Logger logger = LogManager.getLogger(MobileController.class); |
| | |
| | | return R.ok().add(vos); |
| | | } |
| | | |
| | | |
| | | @RequestMapping("/callBarcode") |
| | | @ManagerAuth(memo = "PDA呼叫托盘出库") |
| | | public R callBarcode(@RequestBody CombParam combParam) { |
| | | logger.info("PDA呼叫托盘出库"); |
| | | if (combParam == null){ |
| | | return R.parse(BaseRes.PARAM); |
| | | } |
| | | combParam.getCombMats().forEach(combMat -> { |
| | | Mat mat = matService.selectByMatnr(combMat.getMatnr()); |
| | | if (mat == null){ |
| | | throw new CoolException("商品档案不存在"); |
| | | } |
| | | MatBarcode matBarcode = matBarcodeService.selectbyMatnr(combMat.getMatnr()); |
| | | if (matBarcode == null){ |
| | | throw new CoolException("该物料未与托盘绑定"); |
| | | } |
| | | LocMast locMast=locMastService.selectByBarcode(matBarcode.getZpallet()); |
| | | if (locMast == null){ |
| | | throw new CoolException("未找到与该物料绑定的托盘"); |
| | | } |
| | | int wrkNo=commonService.getWorkNo(0); |
| | | Date now = new Date(); |
| | | //生成工作档 |
| | | WrkMast wrkMast=new WrkMast(); |
| | | wrkMast.setWrkNo(wrkNo); |
| | | wrkMast.setIoTime(new Date()); |
| | | wrkMast.setWrkSts(11L);//工作状态:生成出库ID |
| | | wrkMast.setIoType(101);//入出库状态:并板出库 |
| | | wrkMast.setIoPri(13D);//优先级 |
| | | wrkMast.setCrnNo(locMast.getCrnNo()); |
| | | // wrkMast.setSourceStaNo(dto.getSourceStaNo());//源站 |
| | | wrkMast.setStaNo(101);// 目标站 |
| | | wrkMast.setSourceLocNo(locMast.getLocNo());// 源库位 |
| | | wrkMast.setBarcode(matBarcode.getZpallet()); // 托盘码 |
| | | wrkMast.setFullPlt("Y"); // 满板:Y |
| | | wrkMast.setPicking("N"); // 拣料 |
| | | wrkMast.setExitMk("N"); // 退出 |
| | | wrkMast.setEmptyMk("N"); // 空板 |
| | | wrkMast.setLinkMis("Y"); |
| | | // wrkMast.setScWeight(weight); |
| | | wrkMast.setCtnType(0); // 容器类型 |
| | | // 操作人员数据 |
| | | wrkMast.setAppeTime(now); |
| | | wrkMast.setModiTime(now); |
| | | boolean res = wrkMastService.insert(wrkMast); |
| | | if (!res) { |
| | | throw new CoolException("保存工作档失败"); |
| | | } |
| | | if (locMast.getLocSts().equals("F")) { |
| | | locMast.setLocSts("R"); // R.出库预约 |
| | | locMast.setModiTime(now); |
| | | if (!locMastService.updateById(locMast)) { |
| | | throw new CoolException("改变库位状态失败"); |
| | | } |
| | | } else { |
| | | throw new CoolException(locMast.getLocNo() + "目标库位状态不为F"); |
| | | } |
| | | }); |
| | | return R.ok(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.zy.asrs.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | @Data |
| | | @TableName("cust_matnr_barcode") |
| | | public class MatBarcode implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value= "托盘条码") |
| | | private String zpallet; |
| | | @ApiModelProperty(value= "商品编号") |
| | | private String matnr; |
| | | |
| | | @ApiModelProperty(value= "商品名称") |
| | | private String maktx; |
| | | @ApiModelProperty(value= "规格") |
| | | private String specs; |
| | | |
| | | @ApiModelProperty(value= "型号") |
| | | private String model; |
| | | } |
| | |
| | | * 获取目标库位所在巷道最深空库位 深<浅 |
| | | * */ |
| | | LocMast selectLocByLocStsPakInO2(@Param("locNos") List<String> locNos); |
| | | |
| | | LocMast selectByBarcode(@Param("zpallet")String zpallet); |
| | | } |
New file |
| | |
| | | package com.zy.asrs.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.zy.asrs.entity.MatBarcode; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | @Mapper |
| | | @Repository |
| | | public interface MatBarcodeMapper extends BaseMapper<MatBarcode> { |
| | | MatBarcode selectByMatnr(@Param("matnr")String matnr); |
| | | } |
| | |
| | | * 获取目标库位所在巷道最深空库位 |
| | | * */ |
| | | LocMast selectLocByLocStsPakInO(Integer curRow,Integer nearRow,List<String> locNos); |
| | | |
| | | LocMast selectByBarcode(String zpallet); |
| | | } |
New file |
| | |
| | | package com.zy.asrs.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.zy.asrs.entity.MatBarcode; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service |
| | | public interface MatBarcodeService extends IService<MatBarcode> { |
| | | MatBarcode selectbyMatnr(String matnr); |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public LocMast selectByBarcode(String zpallet) { |
| | | return this.baseMapper.selectByBarcode(zpallet); |
| | | } |
| | | |
| | | @Override |
| | | public Boolean checkWhole(List<LocDetl> locDetls) { |
| | | return null; |
| | | } |
New file |
| | |
| | | package com.zy.asrs.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.zy.asrs.entity.MatBarcode; |
| | | import com.zy.asrs.mapper.MatBarcodeMapper; |
| | | import com.zy.asrs.service.MatBarcodeService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service("MatBarcodeService") |
| | | public class MatBarcodeServiceImpl extends ServiceImpl<MatBarcodeMapper, MatBarcode> implements MatBarcodeService { |
| | | @Override |
| | | public MatBarcode selectbyMatnr(String matnr) { |
| | | return this.baseMapper.selectByMatnr(matnr); |
| | | } |
| | | } |
| | |
| | | private ManLocDetlService manLocDetlService; |
| | | @Autowired |
| | | private ManLocDetlMapper manLocDetlMapper; |
| | | @Autowired |
| | | private MatBarcodeService matBarcodeService; |
| | | |
| | | |
| | | @Override |
| | |
| | | if (Cools.isEmpty(mat)) { |
| | | throw new CoolException(detlDto.getMatnr() + "商品档案不存在"); |
| | | } |
| | | //校验当前物料与托盘绑定信息是否正确 |
| | | MatBarcode matBarcode = new MatBarcode(); |
| | | MatBarcode mb=matBarcodeService.selectbyMatnr(detlDto.getMatnr()); |
| | | if (mb != null && !mb.getZpallet().equals(param.getBarcode())){ |
| | | throw new CoolException(detlDto.getMatnr()+"该物料与其他托盘绑定,请先解绑"); |
| | | }else{ |
| | | matBarcode.setZpallet(param.getBarcode());//托盘码 |
| | | matBarcode.setMatnr(mat.getMatnr());//物料号 |
| | | matBarcode.setMaktx(mat.getMaktx());//物料名称 |
| | | matBarcode.setSpecs(mat.getSpecs());//规格 |
| | | matBarcode.setModel(mat.getModel());//型号 |
| | | } |
| | | WaitPakin waitPakin = new WaitPakin(); |
| | | waitPakin.sync(mat); |
| | | waitPakin.setProType(detlDto.getProType()); |
| | |
| | | waitPakin.setModiTime(now); |
| | | if (!waitPakinService.insert(waitPakin)) { |
| | | throw new CoolException("保存入库通知档失败"); |
| | | } |
| | | if (!matBarcodeService.insert(matBarcode)){ |
| | | throw new CoolException("物料与托盘绑定失败"); |
| | | } |
| | | } |
| | | // 关联组托 |
| | |
| | | if (Cools.isEmpty(mat)) { |
| | | throw new CoolException(orderDetl.getMatnr() + "商品档案不存在"); |
| | | } |
| | | //校验当前物料与托盘绑定信息是否正确 |
| | | MatBarcode matBarcode = new MatBarcode(); |
| | | MatBarcode mb=matBarcodeService.selectbyMatnr(orderDetl.getMatnr()); |
| | | if (mb != null && !mb.getZpallet().equals(param.getBarcode())){ |
| | | throw new CoolException(orderDetl.getMatnr()+"该物料与其他托盘绑定,请先解绑"); |
| | | }else{ |
| | | matBarcode.setZpallet(param.getBarcode());//托盘码 |
| | | matBarcode.setMatnr(mat.getMatnr());//物料号 |
| | | matBarcode.setMaktx(mat.getMaktx());//物料名称 |
| | | matBarcode.setSpecs(mat.getSpecs());//规格 |
| | | matBarcode.setModel(mat.getModel());//型号 |
| | | } |
| | | WaitPakin waitPakin = new WaitPakin(); |
| | | waitPakin.sync(mat); |
| | | waitPakin.setOrderNo(order.getOrderNo()); // 单据编号 |
| | |
| | | if (!waitPakinService.insert(waitPakin)) { |
| | | throw new CoolException("保存入库通知档失败"); |
| | | } |
| | | if (!matBarcodeService.insert(matBarcode)){ |
| | | throw new CoolException("物料与托盘绑定失败"); |
| | | } |
| | | }); |
| | | |
| | | orderService.updateSettle(order.getId(), 2L, userId); |
| | |
| | | @Data |
| | | public class LocTypeDto { |
| | | |
| | | // 高低类型{0:未知,1:低库位,2:高库位} |
| | | // 高低类型{0:未知,1:低库位,2:高库位,3:中库位} |
| | | private Short locType1; |
| | | |
| | | // 宽窄类型{0:未知,1:窄库位,2:宽库位} |
| | |
| | | } |
| | | if (basDevp.getLocType1() == 1) { |
| | | this.locType1 = 1; // 低库位 |
| | | } else { |
| | | } else if (basDevp.getLocType1() ==2){ |
| | | this.locType1 = 2; // 高库位 |
| | | } else { |
| | | this.locType1 = 3; // 中库位 |
| | | } |
| | | log.info(JSON.toJSONString(this)); |
| | | } |
| | |
| | | return getLocNo(whsType,staDescId,sourceStaNo,matnr,batch,grade,0,locTypeDto,0); |
| | | } |
| | | |
| | | @Transactional |
| | | public StartupDto getLocNo(Integer whsType, Integer staDescId, Integer sourceStaNo, String matnr, String batch, String grade, LocTypeDto locTypeDto,String barcode) { |
| | | whsType = Utils.GetWhsType(sourceStaNo); |
| | | return getLocNo1(whsType,staDescId,sourceStaNo,matnr,batch,grade,0,locTypeDto,0,barcode); |
| | | } |
| | | |
| | | /** |
| | | * 检索库位号 |
| | | * |
| | |
| | | startupDto.setCrnNo(crnNo); |
| | | startupDto.setSourceStaNo(sourceStaNo); |
| | | startupDto.setLocNo(locNo); |
| | | return startupDto; |
| | | } |
| | | |
| | | /* |
| | | * 检索库位号 |
| | | * */ |
| | | @Transactional |
| | | public StartupDto getLocNo1(Integer whsType, Integer staDescId, Integer sourceStaNo, String matnr, String batch, String grade, Integer moveCrnNo, LocTypeDto locTypeDto, int times,String barcode){ |
| | | StartupDto startupDto = new StartupDto(); |
| | | Wrapper<StaDesc> wrapper = null; |
| | | StaDesc staDesc = null; |
| | | BasDevp staNo = null; |
| | | int crnNo = 1; //堆垛机号 |
| | | if (Utils.BooleanWhsTypeSta(whsType, staDescId)) { |
| | | // 获取目标站 |
| | | wrapper = new EntityWrapper<StaDesc>() |
| | | .eq("type_no", staDescId) |
| | | .eq("stn_no", sourceStaNo) |
| | | .eq("crn_no", crnNo); |
| | | staDesc = staDescService.selectOne(wrapper); |
| | | if (Cools.isEmpty(staDesc)) { |
| | | log.error("type_no={},stn_no={},crn_no={}", staDescId, sourceStaNo, crnNo); |
| | | throw new CoolException("入库路径不存在"); |
| | | // crnNo = 0; |
| | | } |
| | | staNo = basDevpService.selectById(staDesc.getCrnStn()); |
| | | if (!staNo.getAutoing().equals("Y")) { |
| | | throw new CoolException("目标站"+staDesc.getCrnStn()+"不可用"); |
| | | // crnNo = 0; |
| | | } |
| | | startupDto.setStaNo(staNo.getDevNo()); |
| | | } |
| | | int workNo = getWorkNo(0); |
| | | startupDto.setWorkNo(workNo); |
| | | startupDto.setSourceStaNo(sourceStaNo); |
| | | startupDto.setCrnNo(1); |
| | | //第一次入库 |
| | | //后续入库(托盘和库位已经绑定) |
| | | LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("barcode", barcode)); |
| | | if (locMast != null){ |
| | | if (!locMast.getLocSts().equals("O")){ |
| | | log.error("与该托盘绑定的库位已被占用,托盘码:{},库位号:{}",barcode,locMast.getLocNo()); |
| | | } else { |
| | | startupDto.setLocNo(locMast.getLocNo()); |
| | | } |
| | | } else { |
| | | //托盘与库位未绑定 走第一次入库逻辑 |
| | | } |
| | | return startupDto; |
| | | } |
| | | } |
| | |
| | | // 检索库位 |
| | | 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, 1, devpNo, matnrs.get(0), batchs.get(0), null, locTypeDto); |
| | | StartupDto dto = commonService.getLocNo(1, 1, devpNo, matnrs.get(0), batchs.get(0), null, locTypeDto,barcode); |
| | | StartupDto dto = commonService.getLocNo(1, 1, devpNo, matnrs.get(0), batchs.get(0), null, locTypeDto); |
| | | int workNo = dto.getWorkNo(); |
| | | Date now = new Date(); |
| | | // 生成工作档 |
| | |
| | | if (locMast.getLocSts().equals("O")) { |
| | | locMast.setLocSts("S"); // S.入库预约 |
| | | locMast.setModiTime(now); |
| | | if (locMast.getBarcode()==null){ |
| | | locMast.setBarcode(barcode);//托盘与库位绑定 |
| | | } |
| | | if (!locMastService.updateById(locMast)) { |
| | | throw new CoolException("改变库位状态失败"); |
| | | } |
| | |
| | | // 源站点状态检测 |
| | | BasDevp sourceStaNo = basDevpService.checkSiteStatus(devpNo, true); |
| | | // 检索库位 |
| | | StartupDto dto = commonService.getLocNo(1, 10, devpNo, null, null, null, locTypeDto,barcode); |
| | | StartupDto dto = commonService.getLocNo(1, 10, devpNo, null, null, null, locTypeDto); |
| | | int workNo = dto.getWorkNo(); |
| | | // 生成工作档 |
| | | WrkMast wrkMast = new WrkMast(); |
| | |
| | | if (locMast.getLocSts().equals("O")) { |
| | | locMast.setLocSts("S"); // S.入库预约 |
| | | locMast.setModiTime(new Date()); |
| | | if (locMast.getBarcode()==null){ |
| | | locMast.setBarcode(barcode);//托盘与库位绑定 |
| | | } |
| | | if (!locMastService.updateById(locMast)) { |
| | | throw new CoolException("改变库位状态失败"); |
| | | } |
| | |
| | | AND loc_sts in ('O') order by row1 |
| | | </select> |
| | | |
| | | <select id="selectByBarcode" resultMap="BaseResultMap"> |
| | | SELECT top 1 * FROM [dbo].[asr_loc_mast] WHERE barcode = #{zpallet} |
| | | </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.MatBarcodeMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.zy.asrs.entity.MatBarcode"> |
| | | <result column="zpallet" property="zpallet" /> |
| | | <!-- <result column="loc_no" property="locNo" />--> |
| | | <!-- <result column="anfme" property="anfme" />--> |
| | | <result column="matnr" property="matnr" /> |
| | | <result column="maktx" property="maktx" /> |
| | | <!-- <result column="batch" property="batch" />--> |
| | | <!-- <result column="order_no" property="orderNo" />--> |
| | | |
| | | <result column="specs" property="specs" /> |
| | | <result column="model" property="model" /> |
| | | <!-- <result column="color" property="color" />--> |
| | | <!-- <result column="brand" property="brand" />--> |
| | | <!-- <result column="unit" property="unit" />--> |
| | | <!-- <result column="price" property="price" />--> |
| | | <!-- <result column="sku" property="sku" />--> |
| | | <!-- <result column="units" property="units" />--> |
| | | <!-- <result column="barcode" property="barcode" />--> |
| | | <!-- <result column="origin" property="origin" />--> |
| | | <!-- <result column="manu" property="manu" />--> |
| | | <!-- <result column="manu_date" property="manuDate" />--> |
| | | <!-- <result column="item_num" property="itemNum" />--> |
| | | <!-- <result column="safe_qty" property="safeQty" />--> |
| | | <!-- <result column="weight" property="weight" />--> |
| | | <!-- <result column="length" property="length" />--> |
| | | <!-- <result column="volume" property="volume" />--> |
| | | <!-- <result column="three_code" property="threeCode" />--> |
| | | <!-- <result column="supp" property="supp" />--> |
| | | <!-- <result column="supp_code" property="suppCode" />--> |
| | | <!-- <result column="be_batch" property="beBatch" />--> |
| | | <!-- <result column="dead_time" property="deadTime" />--> |
| | | <!-- <result column="dead_warn" property="deadWarn" />--> |
| | | <!-- <result column="source" property="source" />--> |
| | | <!-- <result column="inspect" property="inspect" />--> |
| | | <!-- <result column="danger" property="danger" />--> |
| | | |
| | | <!-- <result column="status" property="status" />--> |
| | | <!-- <result column="io_status" property="ioStatus" />--> |
| | | |
| | | <!-- <result column="modi_time" property="modiTime" />--> |
| | | <!-- <result column="modi_user" property="modiUser" />--> |
| | | <!-- <result column="appe_time" property="appeTime" />--> |
| | | <!-- <result column="appe_user" property="appeUser" />--> |
| | | <!-- <result column="memo" property="memo" />--> |
| | | </resultMap> |
| | | |
| | | <select id="selectByMatnr" resultMap="BaseResultMap"> |
| | | select top 1 * from cust_matnr_barcode where 1=1 and matnr = #{matnr} |
| | | </select> |
| | | </mapper> |