| | |
| | | import com.zy.asrs.service.ManLocDetlService; |
| | | import com.zy.asrs.service.MatService; |
| | | import com.zy.asrs.service.NodeService; |
| | | import com.zy.asrs.utils.SaasUtils; |
| | | import com.zy.asrs.utils.VersionUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | manLocDetl.setCreateTime(now); |
| | | manLocDetl.setModiTime(now); |
| | | manLocDetl.setCreateBy(userId); |
| | | SaasUtils.insertLog(0,manLocDetl.getLocNo(),manLocDetl.getMatnr(), manLocDetl.getAnfme()); |
| | | manLocDetlService.insert(manLocDetl); |
| | | |
| | | } |
| | |
| | | if (manLocDetl.getAnfme() - param.getCount() < 0) { |
| | | return R.error("物料:"+ param.getMatnr() + " 在库位中数量不足"); |
| | | }else { |
| | | |
| | | manLocDetl.setAnfme(manLocDetl.getAnfme() - param.getCount()); |
| | | manLocDetlService.update(manLocDetl,new EntityWrapper<ManLocDetl>() |
| | | .eq("loc_no",node.getUuid()) |
| | | .eq("matnr",param.getMatnr())); |
| | | SaasUtils.insertLog(1,manLocDetl.getLocNo(), manLocDetl.getMatnr(),manLocDetl.getAnfme()); |
| | | } |
| | | } |
| | | } |
| | | return R.ok("出库成功"); |
| | | } |
| | | |
| | | @Transactional |
| | | @Override |
| | | public void locMove(String sourceLocNo, String targetLocNo, Long userId) { |
| | | List<ManLocDetl> targets = manLocDetlService.selectList(new EntityWrapper<ManLocDetl>() |
| | | .like("loc_no", sourceLocNo)); |
| | | for (ManLocDetl target : targets) { |
| | | Node uuid = nodeService.selectOne(new EntityWrapper<Node>() |
| | | .eq("uuid", targetLocNo)); |
| | | if (uuid == null || uuid.equals("")) { |
| | | throw new RuntimeException("无法查询到移库的目标库位"); |
| | | } |
| | | manLocDetlService.deleteById(target); |
| | | target.setLocNo(uuid.getUuid()); |
| | | target.setNodeId(uuid.getId()); |
| | | SaasUtils.insertLog(2,target.getLocNo(), target.getMatnr(), target.getAnfme()); |
| | | manLocDetlService.insert(target); |
| | | } |
| | | } |
| | | } |