| | |
| | | package com.zy.asrs.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.core.common.BaseRes; |
| | | import com.core.common.Cools; |
| | | import com.core.common.DateUtils; |
| | | import com.core.common.SnowflakeIdWorker; |
| | |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.asrs.utils.MatUtils; |
| | | import com.zy.common.model.DetlDto; |
| | | import com.zy.common.model.enums.WorkNoType; |
| | | import com.zy.common.utils.NodeUtils; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.expression.spel.ast.NullLiteral; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.tools.JavaCompiler; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | |
| | | private TagService tagService; |
| | | @Autowired |
| | | private TagMapper tagMapper; |
| | | @Autowired |
| | | private WaitPakinService waitPakinService; |
| | | @Autowired |
| | | private WrkDetlService wrkDetlService; |
| | | @Autowired |
| | | private TestMastService testMastService; |
| | | @Autowired |
| | | private LocMastService locMastService; |
| | | @Autowired |
| | | private WorkService workService; |
| | | |
| | | @Override |
| | | @Transactional |
| | |
| | | |
| | | } |
| | | |
| | | /*...........................赣州新增..............以下.............赣州新增...........................*/ |
| | | @Override |
| | | @Transactional |
| | | public void combPACK(CombParam param) { |
| | | if (Cools.isEmpty(param.getPackNo())) { |
| | | throw new CoolException(BaseRes.PARAM); |
| | | } |
| | | // 判断是否有相同Pack码的数据 |
| | | if (waitPakinService.selectCount(new EntityWrapper<WaitPakin>(). |
| | | eq("zpallet", param.getPackNo()).eq("io_status", "N")) > 0) { |
| | | throw new CoolException(param.getPackNo() + "数据正在进行入库"); |
| | | } |
| | | |
| | | int countLoc = locDetlService.selectCount(new EntityWrapper<LocDetl>().eq("zpallet",param.getPackNo())); |
| | | int countWrk = wrkDetlService.selectCount(new EntityWrapper<WrkDetl>().eq("zpallet",param.getPackNo())); |
| | | if (countLoc > 0 || countWrk > 0) { |
| | | throw new CoolException("工作档/库存条码数据已存在===>>" + param.getPackNo()); |
| | | } |
| | | |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | java.util.Date date1=null; |
| | | try { |
| | | date1= sdf.parse(param.getRequestTime()); |
| | | } catch (ParseException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | java.sql.Date requestTime = new java.sql.Date(date1.getTime()); |
| | | |
| | | // 生成入库通知档 |
| | | // Mat mat = matService.selectByMatnr(param.getPackName()); |
| | | // if (Cools.isEmpty(mat)) { |
| | | // throw new CoolException(param.getPackName() + "商品档案不存在"); |
| | | // } |
| | | WaitPakin waitPakin = new WaitPakin(); |
| | | // waitPakin.sync(mat); |
| | | waitPakin.setMatnr(param.getPackName()); |
| | | waitPakin.setMaktx(param.getPackName()); |
| | | waitPakin.setZpallet(param.getPackNo()); // Pack码 |
| | | waitPakin.setIoStatus("N"); // 入出状态 |
| | | waitPakin.setAnfme(1.0); // 数量 |
| | | waitPakin.setStatus("Y"); // 状态 |
| | | waitPakin.setAppeUser(null); |
| | | waitPakin.setAppeTime(requestTime); |
| | | waitPakin.setModiUser(null); |
| | | waitPakin.setModiTime(requestTime); |
| | | waitPakin.setDeadWarn(param.getSettingTimes()); |
| | | if (!waitPakinService.insert(waitPakin)) { |
| | | throw new CoolException("保存入库通知档失败"); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public void infoReview(Review review) { |
| | | Wrapper wrapper = new EntityWrapper<TestMast>() |
| | | .eq("loc_no", review.getLocNo()) |
| | | .eq("barcode", review.getBarcode()) |
| | | .eq("user_Id", review.getUserId()); |
| | | LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", review.getLocNo())); |
| | | if (null == locMast ||locMast.getPackStatus()!=1) { |
| | | throw new CoolException("产品状态不是 1:待测试"); |
| | | } |
| | | TestMast testMast = testMastService.selectOne(wrapper); |
| | | if(null != testMast){ |
| | | if (testMast.getStatus()==1){ |
| | | testMast.setStatus(3); |
| | | testMast.setModiTime(new Date()); |
| | | if (!testMastService.update(testMast,wrapper)){ |
| | | throw new CoolException("更新测试状态失败"); |
| | | } |
| | | locMast.setPackStatus(2); |
| | | if (!locMastService.update(locMast,new EntityWrapper<LocMast>().eq("loc_no", review.getLocNo()))){ |
| | | throw new CoolException("更新产品状态失败"); |
| | | } |
| | | }else if (Cools.isEmpty(testMast.getStatus())){ |
| | | throw new CoolException("状态异常"); |
| | | }else { |
| | | throw new CoolException("状态不是 1:申请中"); |
| | | } |
| | | } else { |
| | | throw new CoolException("测试申请失败"); |
| | | } |
| | | } |
| | | |
| | | |
| | | @Override |
| | | @Transactional |
| | | public Boolean testFinish(Review review) { |
| | | Boolean success=true; |
| | | Wrapper wrapper = new EntityWrapper<TestMast>() |
| | | .eq("loc_no", review.getLocNo()) |
| | | .eq("barcode", review.getBarcode()) |
| | | .eq("user_Id", review.getUserId()); |
| | | LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", review.getLocNo())); |
| | | if (locMast.getPackStatus()!=2){ |
| | | throw new CoolException("产品状态不是 2:测试中"); |
| | | } |
| | | TestMast testMast = testMastService.selectOne(wrapper); |
| | | if(null != testMast){ |
| | | if (testMast.getStatus()==3){ |
| | | testMast.setStatus(4); |
| | | testMast.setModiTime(new Date()); |
| | | if (!testMastService.update(testMast,wrapper)){ |
| | | throw new CoolException("更改测试状态失败"); |
| | | } |
| | | locMast.setPackStatus(3); |
| | | if (!locMastService.update(locMast, wrapper)){ |
| | | throw new CoolException("更改产品状态失败"); |
| | | } |
| | | }else if (Cools.isEmpty(testMast.getStatus())){ |
| | | throw new CoolException("状态异常"); |
| | | }else { |
| | | throw new CoolException("状态不是 2:测试中"); |
| | | } |
| | | } else { |
| | | throw new CoolException("状态异常"); |
| | | } |
| | | |
| | | return success; |
| | | } |
| | | |
| | | /*...........................赣州新增..............以上.............赣州新增...........................*/ |
| | | |
| | | } |